Merge pull request #743 from sschiz/deleted-message

add getting deleted message
This commit is contained in:
bwmarrin 2020-03-02 10:32:42 -06:00 committed by GitHub
commit 53f194f13f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View file

@ -169,6 +169,7 @@ type MessageUpdate struct {
// MessageDelete is the data for a MessageDelete event.
type MessageDelete struct {
*Message
BeforeDelete *Message `json:"-"`
}
// MessageReactionAdd is the data for a MessageReactionAdd event.

View file

@ -893,6 +893,13 @@ func (s *State) OnInterface(se *Session, i interface{}) (err error) {
}
case *MessageDelete:
if s.MaxMessageCount != 0 {
var old *Message
old, err = s.Message(t.ChannelID, t.ID)
if err == nil {
oldCopy := *old
t.BeforeDelete = &oldCopy
}
err = s.MessageRemove(t.Message)
}
case *MessageDeleteBulk: