Skip to content

Commit

Permalink
Implemented MESSAGE_REACTION_REMOVE_EMOJI event type
Browse files Browse the repository at this point in the history
Refactored related event structs to be more accurate
  • Loading branch information
SamusAranX committed Jul 10, 2024
1 parent dec4d43 commit e54e9ac
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 4 deletions.
24 changes: 24 additions & 0 deletions eventhandlers.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 24 additions & 1 deletion events.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,15 +274,38 @@ func (m *MessageDelete) UnmarshalJSON(b []byte) error {
return json.Unmarshal(b, &m.Message)
}

type MessageReactionType int

Check failure on line 277 in events.go

View workflow job for this annotation

GitHub Actions / lint

exported type `MessageReactionType` should have comment or be unexported (golint)

const (
MessageReactionTypeNormal MessageReactionType = 0

Check failure on line 280 in events.go

View workflow job for this annotation

GitHub Actions / lint

exported const MessageReactionTypeNormal should have comment (or a comment on this block) or be unexported (golint)
MessageReactionTypeBurst MessageReactionType = 1
)

// 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.
Expand Down
4 changes: 1 addition & 3 deletions structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -2153,11 +2153,9 @@ type APIErrorMessage struct {
Message string `json:"message"`
}

// MessageReaction stores the data for a message reaction.
// 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"`
}
Expand Down

0 comments on commit e54e9ac

Please sign in to comment.