Skip to content

Commit

Permalink
fix false message updates
Browse files Browse the repository at this point in the history
  • Loading branch information
ashishjh-bst committed Sep 25, 2024
1 parent 2b89b95 commit 010f603
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 0 additions & 4 deletions bot/discordevents.go
Original file line number Diff line number Diff line change
Expand Up @@ -404,10 +404,6 @@ func HandleMessageCreateUpdateFirst(evt *eventsystem.EventData) {
if !IsNormalUserMessage(edit.Message) {
return
}
if edit.EditedTimestamp == "" {
return
}

edit.Member.User = edit.Author
edit.Member.GuildID = edit.GuildID
}
Expand Down
7 changes: 7 additions & 0 deletions bot/eventsystem/eventsystem.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,13 @@ func EmitEvent(data *EventData, evt Event) {
}
}

if messageUpdate, ok := data.EvtInterface.(*discordgo.MessageUpdate); ok {
if messageUpdate.EditedTimestamp == "" {
logrus.Debugf("Skipped event as message update wasn't really an edit: %v, %#v", data.Type, messageUpdate)
return
}
}

if len(h[2]) > 0 {
go func() {
defer func() {
Expand Down

0 comments on commit 010f603

Please sign in to comment.