Skip to content

Commit

Permalink
Introduce PartialEmoji
Browse files Browse the repository at this point in the history
  • Loading branch information
sebm253 committed Apr 1, 2023
1 parent 6125af7 commit fe8db22
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 28 deletions.
8 changes: 4 additions & 4 deletions discord/emoji.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ type EmojiUpdate struct {
Roles *[]snowflake.ID `json:"roles,omitempty"`
}

type ReactionEmoji struct {
ID snowflake.ID `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Animated bool `json:"animated"`
type PartialEmoji struct {
ID *snowflake.ID `json:"id"`
Name *string `json:"name"`
Animated bool `json:"animated"`
}
3 changes: 1 addition & 2 deletions discord/guild_onboarding.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ type GuildOnboardingPromptOption struct {
ID snowflake.ID `json:"id"`
ChannelIDs []snowflake.ID `json:"channel_ids"`
RoleIDs []snowflake.ID `json:"role_ids"`
EmojiID *snowflake.ID `json:"emoji_id"`
EmojiName *string `json:"emoji_name"`
Emoji PartialEmoji `json:"emoji"`
Title string `json:"title"`
Description *string `json:"description"`
}
Expand Down
4 changes: 2 additions & 2 deletions events/dm_message_reaction_events.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type GenericDMMessageReaction struct {
UserID snowflake.ID
ChannelID snowflake.ID
MessageID snowflake.ID
Emoji discord.ReactionEmoji
Emoji discord.PartialEmoji
}

// DMMessageReactionAdd indicates that a discord.User added a discord.MessageReaction to a discord.Message in a Channel (requires the gateway.IntentDirectMessageReactions)
Expand All @@ -30,7 +30,7 @@ type DMMessageReactionRemoveEmoji struct {
*GenericEvent
ChannelID snowflake.ID
MessageID snowflake.ID
Emoji discord.ReactionEmoji
Emoji discord.PartialEmoji
}

// DMMessageReactionRemoveAll indicates someone removed all discord.MessageReaction(s) from a discord.Message in a Channel (requires the gateway.IntentDirectMessageReactions)
Expand Down
6 changes: 3 additions & 3 deletions events/guild_message_reaction_events.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ type GenericGuildMessageReaction struct {
ChannelID snowflake.ID
MessageID snowflake.ID
GuildID snowflake.ID
Emoji discord.ReactionEmoji
Emoji discord.PartialEmoji
}

// Member returns the Member that reacted to the discord.Message from the cache.
func (e *GenericGuildMessageReaction) Member() (discord.Member, bool) {
return e.Client().Caches().Member(e.GuildID, e.UserID)
}

// GuildMessageReactionAdd indicates that a discord.Member added a discord.ReactionEmoji to a discord.Message in a discord.GuildMessageChannel(requires the gateway.IntentGuildMessageReactions)
// GuildMessageReactionAdd indicates that a discord.Member added a discord.PartialEmoji to a discord.Message in a discord.GuildMessageChannel(requires the gateway.IntentGuildMessageReactions)
type GuildMessageReactionAdd struct {
*GenericGuildMessageReaction
Member discord.Member
Expand All @@ -38,7 +38,7 @@ type GuildMessageReactionRemoveEmoji struct {
ChannelID snowflake.ID
MessageID snowflake.ID
GuildID snowflake.ID
Emoji discord.ReactionEmoji
Emoji discord.PartialEmoji
}

// GuildMessageReactionRemoveAll indicates someone removed all discord.MessageReaction(s) from a discord.Message in a Channel (requires the gateway.IntentGuildMessageReactions)
Expand Down
4 changes: 2 additions & 2 deletions events/message_reaction_events.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type GenericReaction struct {
ChannelID snowflake.ID
MessageID snowflake.ID
GuildID *snowflake.ID
Emoji discord.ReactionEmoji
Emoji discord.PartialEmoji
}

// MessageReactionAdd indicates that a discord.User added a discord.MessageReaction to a discord.Message in a discord.Channel(this+++ requires the gateway.IntentGuildMessageReactions and/or gateway.IntentDirectMessageReactions)
Expand All @@ -33,7 +33,7 @@ type MessageReactionRemoveEmoji struct {
ChannelID snowflake.ID
MessageID snowflake.ID
GuildID *snowflake.ID
Emoji discord.ReactionEmoji
Emoji discord.PartialEmoji
}

// MessageReactionRemoveAll indicates someone removed all discord.MessageReaction(s) from a discord.Message in a discord.Channel(requires the gateway.IntentGuildMessageReactions and/or gateway.IntentDirectMessageReactions)
Expand Down
30 changes: 15 additions & 15 deletions gateway/gateway_events.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,12 @@ func (EventGuildAuditLogEntryCreate) messageData() {}
func (EventGuildAuditLogEntryCreate) eventData() {}

type EventMessageReactionAdd struct {
UserID snowflake.ID `json:"user_id"`
ChannelID snowflake.ID `json:"channel_id"`
MessageID snowflake.ID `json:"message_id"`
GuildID *snowflake.ID `json:"guild_id"`
Member *discord.Member `json:"member"`
Emoji discord.ReactionEmoji `json:"emoji"`
UserID snowflake.ID `json:"user_id"`
ChannelID snowflake.ID `json:"channel_id"`
MessageID snowflake.ID `json:"message_id"`
GuildID *snowflake.ID `json:"guild_id"`
Member *discord.Member `json:"member"`
Emoji discord.PartialEmoji `json:"emoji"`
}

func (e *EventMessageReactionAdd) UnmarshalJSON(data []byte) error {
Expand All @@ -212,21 +212,21 @@ func (EventMessageReactionAdd) messageData() {}
func (EventMessageReactionAdd) eventData() {}

type EventMessageReactionRemove struct {
UserID snowflake.ID `json:"user_id"`
ChannelID snowflake.ID `json:"channel_id"`
MessageID snowflake.ID `json:"message_id"`
GuildID *snowflake.ID `json:"guild_id"`
Emoji discord.ReactionEmoji `json:"emoji"`
UserID snowflake.ID `json:"user_id"`
ChannelID snowflake.ID `json:"channel_id"`
MessageID snowflake.ID `json:"message_id"`
GuildID *snowflake.ID `json:"guild_id"`
Emoji discord.PartialEmoji `json:"emoji"`
}

func (EventMessageReactionRemove) messageData() {}
func (EventMessageReactionRemove) eventData() {}

type EventMessageReactionRemoveEmoji struct {
ChannelID snowflake.ID `json:"channel_id"`
MessageID snowflake.ID `json:"message_id"`
GuildID *snowflake.ID `json:"guild_id"`
Emoji discord.ReactionEmoji `json:"emoji"`
ChannelID snowflake.ID `json:"channel_id"`
MessageID snowflake.ID `json:"message_id"`
GuildID *snowflake.ID `json:"guild_id"`
Emoji discord.PartialEmoji `json:"emoji"`
}

func (EventMessageReactionRemoveEmoji) messageData() {}
Expand Down

0 comments on commit fe8db22

Please sign in to comment.