diff --git a/bridge/discord/handlers.go b/bridge/discord/handlers.go index 16bb9977f..747214f48 100644 --- a/bridge/discord/handlers.go +++ b/bridge/discord/handlers.go @@ -2,6 +2,7 @@ package bdiscord import ( "strings" + "time" "github.com/bwmarrin/discordgo" "github.com/davecgh/go-spew/spew" @@ -75,6 +76,13 @@ func (b *Bdiscord) messageUpdate(s *discordgo.Session, m *discordgo.MessageUpdat } // only when message is actually edited if m.Message.EditedTimestamp != nil { + // message must have been edited within MaxEditDays + // (there is a discord glitch where old message edits get sent without user interaction) + delay := time.Since(*m.Message.EditedTimestamp) + if delay >= time.Duration(b.GetInt("MaxEditDays"))*24*time.Hour { + return + } + b.Log.Debugf("Sending edit message") m.Content += b.GetString("EditSuffix") msg := &discordgo.MessageCreate{