portal: fix isPlainGifMessage to get link preview working (#179)

This commit is contained in:
Ping Chen
2025-04-09 20:37:25 +09:00
committed by GitHub
parent ef093b129f
commit d37b5028e1

View File

@@ -634,7 +634,7 @@ func isPlainGifMessage(msg *discordgo.Message) bool {
}
embed := msg.Embeds[0]
isGifVideo := embed.Type == discordgo.EmbedTypeGifv && embed.Video != nil
isGifImage := embed.Type == discordgo.EmbedTypeImage && embed.Image == nil && embed.Thumbnail != nil
isGifImage := embed.Type == discordgo.EmbedTypeImage && embed.Image == nil && embed.Thumbnail != nil && embed.Title == ""
contentIsOnlyURL := msg.Content == embed.URL || discordLinkRegexFull.MatchString(msg.Content)
return contentIsOnlyURL && (isGifVideo || isGifImage)
}