From 55cc806efd8c819b66f96371e6157568e3758a49 Mon Sep 17 00:00:00 2001 From: Emma Alyx Wunder Date: Thu, 11 Jul 2024 15:17:50 +0200 Subject: [PATCH] Moved MessageReactionType from events.go to structs.go --- eventhandlers.go | 48 ++++++++++++++++++++++++------------------------ events.go | 9 --------- structs.go | 9 +++++++++ 3 files changed, 33 insertions(+), 33 deletions(-) diff --git a/eventhandlers.go b/eventhandlers.go index 1064011c3..a109b516f 100644 --- a/eventhandlers.go +++ b/eventhandlers.go @@ -49,8 +49,8 @@ const ( messagePollVoteRemoveEventType = "MESSAGE_POLL_VOTE_REMOVE" messageReactionAddEventType = "MESSAGE_REACTION_ADD" messageReactionRemoveEventType = "MESSAGE_REACTION_REMOVE" - messageReactionRemoveEmojiEventType = "MESSAGE_REACTION_REMOVE_EMOJI" messageReactionRemoveAllEventType = "MESSAGE_REACTION_REMOVE_ALL" + messageReactionRemoveEmojiEventType = "MESSAGE_REACTION_REMOVE_EMOJI" messageUpdateEventType = "MESSAGE_UPDATE" presenceUpdateEventType = "PRESENCE_UPDATE" presencesReplaceEventType = "PRESENCES_REPLACE" @@ -898,26 +898,6 @@ func (eh messageReactionRemoveEventHandler) Handle(s *Session, i interface{}) { } } -// messageReactionRemoveEmojiEventHandler is an event handler for MessageReactionRemoveAll 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) - } -} - // messageReactionRemoveAllEventHandler is an event handler for MessageReactionRemoveAll events. type messageReactionRemoveAllEventHandler func(*Session, *MessageReactionRemoveAll) @@ -938,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) @@ -1421,10 +1421,10 @@ func handlerForInterface(handler interface{}) EventHandler { return messageReactionAddEventHandler(v) case func(*Session, *MessageReactionRemove): return messageReactionRemoveEventHandler(v) - case func(*Session, *MessageReactionRemoveEmoji): - return messageReactionRemoveEmojiEventHandler(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): @@ -1510,8 +1510,8 @@ func init() { registerInterfaceProvider(messagePollVoteRemoveEventHandler(nil)) registerInterfaceProvider(messageReactionAddEventHandler(nil)) registerInterfaceProvider(messageReactionRemoveEventHandler(nil)) - registerInterfaceProvider(messageReactionRemoveEmojiEventHandler(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 0ae111870..a8ad2fbd9 100644 --- a/events.go +++ b/events.go @@ -274,15 +274,6 @@ func (m *MessageDelete) UnmarshalJSON(b []byte) error { return json.Unmarshal(b, &m.Message) } -// 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 -) - // MessageReactionAdd is the data for a MessageReactionAdd event. type MessageReactionAdd struct { *MessageReaction diff --git a/structs.go b/structs.go index add2b1f53..49c946803 100644 --- a/structs.go +++ b/structs.go @@ -2153,6 +2153,15 @@ type APIErrorMessage struct { Message string `json:"message"` } +// 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 { MessageID string `json:"message_id"`