Skip to content

Commit fbf9a5d

Browse files
author
Sebastian
authored
Add query params to channels.GetReactions (#301)
1 parent 6e679fd commit fbf9a5d

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

discord/message.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,13 @@ type ReactionCountDetails struct {
372372
Normal int `json:"normal"`
373373
}
374374

375+
type MessageReactionType int
376+
377+
const (
378+
MessageReactionTypeNormal MessageReactionType = iota
379+
MessageReactionTypeBurst
380+
)
381+
375382
// MessageActivityType is the type of MessageActivity https://com/developers/docs/resources/channel#message-object-message-activity-types
376383
type MessageActivityType int
377384

rest/channels.go

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ type Channels interface {
3636
BulkDeleteMessages(channelID snowflake.ID, messageIDs []snowflake.ID, opts ...RequestOpt) error
3737
CrosspostMessage(channelID snowflake.ID, messageID snowflake.ID, opts ...RequestOpt) (*discord.Message, error)
3838

39-
GetReactions(channelID snowflake.ID, messageID snowflake.ID, emoji string, opts ...RequestOpt) ([]discord.User, error)
39+
GetReactions(channelID snowflake.ID, messageID snowflake.ID, emoji string, reactionType discord.MessageReactionType, after int, limit int, opts ...RequestOpt) ([]discord.User, error)
4040
AddReaction(channelID snowflake.ID, messageID snowflake.ID, emoji string, opts ...RequestOpt) error
4141
RemoveOwnReaction(channelID snowflake.ID, messageID snowflake.ID, emoji string, opts ...RequestOpt) error
4242
RemoveUserReaction(channelID snowflake.ID, messageID snowflake.ID, emoji string, userID snowflake.ID, opts ...RequestOpt) error
@@ -184,8 +184,17 @@ func (s *channelImpl) CrosspostMessage(channelID snowflake.ID, messageID snowfla
184184
return
185185
}
186186

187-
func (s *channelImpl) GetReactions(channelID snowflake.ID, messageID snowflake.ID, emoji string, opts ...RequestOpt) (users []discord.User, err error) {
188-
err = s.client.Do(GetReactions.Compile(nil, channelID, messageID, emoji), nil, &users, opts...)
187+
func (s *channelImpl) GetReactions(channelID snowflake.ID, messageID snowflake.ID, emoji string, reactionType discord.MessageReactionType, after int, limit int, opts ...RequestOpt) (users []discord.User, err error) {
188+
values := discord.QueryValues{
189+
"type": reactionType,
190+
}
191+
if after != 0 {
192+
values["after"] = after
193+
}
194+
if limit != 0 {
195+
values["limit"] = limit
196+
}
197+
err = s.client.Do(GetReactions.Compile(values, channelID, messageID, emoji), nil, &users, opts...)
189198
return
190199
}
191200

0 commit comments

Comments
 (0)