Only images now wrap in Bbcode to embed when uploaded to Litterbox and sent to Sneedchat. Images are also clickable urls via the double wrapping of [url][img]
This commit is contained in:
@@ -190,12 +190,16 @@ func (b *Bridge) onDiscordMessageCreate(s *discordgo.Session, m *discordgo.Messa
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ct := strings.ToLower(att.ContentType)
|
ct := strings.ToLower(att.ContentType)
|
||||||
if strings.HasPrefix(ct, "video") || strings.HasSuffix(strings.ToLower(att.Filename), ".mp4") ||
|
|
||||||
strings.HasSuffix(strings.ToLower(att.Filename), ".webm") {
|
// Images → wrap inside clickable URL with an image preview
|
||||||
attachmentsBB = append(attachmentsBB, fmt.Sprintf("[url=%s][video]%s[/video][/url]", url, url))
|
if strings.HasPrefix(ct, "image/") {
|
||||||
|
attachmentsBB = append(attachmentsBB,
|
||||||
|
fmt.Sprintf("[url=%s][img]%s[/img][/url]", url, url))
|
||||||
} else {
|
} else {
|
||||||
attachmentsBB = append(attachmentsBB, fmt.Sprintf("[url=%s][img]%s[/img][/url]", url, url))
|
// Everything else → plain URL (videos, archives, PDFs, audio, etc)
|
||||||
|
attachmentsBB = append(attachmentsBB, url)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
combined := contentText
|
combined := contentText
|
||||||
|
|||||||
Reference in New Issue
Block a user