Skip to content

Commit

Permalink
feat(state): update only last message id for thread update
Browse files Browse the repository at this point in the history
Implements updating message id in MESSAGE_CREATE and MESSAGE_DELETE events. Refer to https://discord.com/developers/docs/topics/gateway#thread-update for more info.
  • Loading branch information
FedorLap2006 committed Feb 2, 2022
1 parent 1d308df commit efed253
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions state.go
Expand Up @@ -802,7 +802,6 @@ func (s *State) MessageAdd(message *Message) error {
}

if c.IsThread() {
c.MessageCount++
c.LastMessageID = message.ID
}

Expand Down Expand Up @@ -834,7 +833,6 @@ func (s *State) messageRemoveByID(channelID, messageID string) error {
if i == len(c.Messages)-1 && len(c.Messages) > 0 {
c.LastMessageID = c.Messages[i-1].ID
}
c.MessageCount--
}
c.Messages = append(c.Messages[:i], c.Messages[i+1:]...)
return nil
Expand Down

0 comments on commit efed253

Please sign in to comment.