Don't add reply sender to mentions array manually

Discord already adds it to the native mentions array
This commit is contained in:
Tulir Asokan
2023-06-04 11:33:18 +03:00
parent 8c57b7a69b
commit 4c62fe8b12
3 changed files with 13 additions and 16 deletions

View File

@@ -621,7 +621,7 @@ func isPlainGifMessage(msg *discordgo.Message) bool {
(msg.Embeds[0].Type == discordgo.EmbedTypeImage && msg.Embeds[0].Image == nil && msg.Embeds[0].Thumbnail != nil))
}
func (portal *Portal) convertDiscordMentions(msg *discordgo.Message, replySender id.UserID, syncGhosts bool) *event.Mentions {
func (portal *Portal) convertDiscordMentions(msg *discordgo.Message, syncGhosts bool) *event.Mentions {
var matrixMentions event.Mentions
for _, mention := range msg.Mentions {
puppet := portal.bridge.GetPuppetByID(mention.ID)
@@ -635,9 +635,6 @@ func (portal *Portal) convertDiscordMentions(msg *discordgo.Message, replySender
matrixMentions.UserIDs = append(matrixMentions.UserIDs, puppet.MXID)
}
}
if replySender != "" {
matrixMentions.UserIDs = append(matrixMentions.UserIDs, replySender)
}
slices.Sort(matrixMentions.UserIDs)
matrixMentions.UserIDs = slices.Compact(matrixMentions.UserIDs)
if msg.MentionEveryone {