diff --git a/eventhandlers.go b/eventhandlers.go index 1d0a61638..a109b516f 100644 --- a/eventhandlers.go +++ b/eventhandlers.go @@ -50,6 +50,7 @@ const ( messageReactionAddEventType = "MESSAGE_REACTION_ADD" messageReactionRemoveEventType = "MESSAGE_REACTION_REMOVE" messageReactionRemoveAllEventType = "MESSAGE_REACTION_REMOVE_ALL" + messageReactionRemoveEmojiEventType = "MESSAGE_REACTION_REMOVE_EMOJI" messageUpdateEventType = "MESSAGE_UPDATE" presenceUpdateEventType = "PRESENCE_UPDATE" presencesReplaceEventType = "PRESENCES_REPLACE" @@ -917,6 +918,26 @@ func (eh messageReactionRemoveAllEventHandler) Handle(s *Session, i interface{}) } } +// messageReactionRemoveEmojiEventHandler is an event handler for MessageReactionRemoveEmoji events. +type messageReactionRemoveEmojiEventHandler func(*Session, *MessageReactionRemoveEmoji) + +// Type returns the event type for MessageReactionRemoveEmoji events. +func (eh messageReactionRemoveEmojiEventHandler) Type() string { + return messageReactionRemoveEmojiEventType +} + +// New returns a new instance of MessageReactionRemoveEmoji. +func (eh messageReactionRemoveEmojiEventHandler) New() interface{} { + return &MessageReactionRemoveEmoji{} +} + +// Handle is the handler for MessageReactionRemoveEmoji events. +func (eh messageReactionRemoveEmojiEventHandler) Handle(s *Session, i interface{}) { + if t, ok := i.(*MessageReactionRemoveEmoji); ok { + eh(s, t) + } +} + // messageUpdateEventHandler is an event handler for MessageUpdate events. type messageUpdateEventHandler func(*Session, *MessageUpdate) @@ -1402,6 +1423,8 @@ func handlerForInterface(handler interface{}) EventHandler { return messageReactionRemoveEventHandler(v) case func(*Session, *MessageReactionRemoveAll): return messageReactionRemoveAllEventHandler(v) + case func(*Session, *MessageReactionRemoveEmoji): + return messageReactionRemoveEmojiEventHandler(v) case func(*Session, *MessageUpdate): return messageUpdateEventHandler(v) case func(*Session, *PresenceUpdate): @@ -1488,6 +1511,7 @@ func init() { registerInterfaceProvider(messageReactionAddEventHandler(nil)) registerInterfaceProvider(messageReactionRemoveEventHandler(nil)) registerInterfaceProvider(messageReactionRemoveAllEventHandler(nil)) + registerInterfaceProvider(messageReactionRemoveEmojiEventHandler(nil)) registerInterfaceProvider(messageUpdateEventHandler(nil)) registerInterfaceProvider(presenceUpdateEventHandler(nil)) registerInterfaceProvider(presencesReplaceEventHandler(nil)) diff --git a/events.go b/events.go index e19290ec0..a8ad2fbd9 100644 --- a/events.go +++ b/events.go @@ -277,12 +277,28 @@ func (m *MessageDelete) UnmarshalJSON(b []byte) error { // MessageReactionAdd is the data for a MessageReactionAdd event. type MessageReactionAdd struct { *MessageReaction - Member *Member `json:"member,omitempty"` + UserID string `json:"user_id"` + Member *Member `json:"member,omitempty"` + Emoji Emoji `json:"emoji"` + MessageAuthorID string `json:"message_author_id,omitempty"` + Burst bool `json:"burst"` + BurstColors []string `json:"burst_colors,omitempty"` + Type MessageReactionType `json:"type"` } // MessageReactionRemove is the data for a MessageReactionRemove event. type MessageReactionRemove struct { *MessageReaction + UserID string `json:"user_id"` + Emoji Emoji `json:"emoji"` + Burst bool `json:"burst"` + Type MessageReactionType `json:"type"` +} + +// MessageReactionRemoveEmoji is the data for a MessageReactionRemoveEmoji event. +type MessageReactionRemoveEmoji struct { + *MessageReaction + Emoji Emoji `json:"emoji"` } // MessageReactionRemoveAll is the data for a MessageReactionRemoveAll event. diff --git a/structs.go b/structs.go index 475107c0d..49c946803 100644 --- a/structs.go +++ b/structs.go @@ -2153,11 +2153,18 @@ type APIErrorMessage struct { Message string `json:"message"` } -// MessageReaction stores the data for a message reaction. +// MessageReactionType is the type of reaction. Burst-type reactions are Super Reactions. +type MessageReactionType int + +// Block contains all known MessageReactionType values. +const ( + MessageReactionTypeNormal MessageReactionType = 0 + MessageReactionTypeBurst MessageReactionType = 1 +) + +// MessageReaction stores partial data for a message reaction. type MessageReaction struct { - UserID string `json:"user_id"` MessageID string `json:"message_id"` - Emoji Emoji `json:"emoji"` ChannelID string `json:"channel_id"` GuildID string `json:"guild_id,omitempty"` }