Skip to content

Commit

Permalink
Add pagination to MessageReactions
Browse files Browse the repository at this point in the history
  • Loading branch information
0x263b committed Jul 22, 2019
1 parent 8d8906c commit 6b2908e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion restapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -2117,7 +2117,9 @@ func (s *Session) MessageReactionsRemoveAll(channelID, messageID string) error {
// messageID : The message ID.
// emojiID : Either the unicode emoji for the reaction, or a guild emoji identifier.
// limit : max number of users to return (max 100)
func (s *Session) MessageReactions(channelID, messageID, emojiID string, limit int) (st []*User, err error) {
// beforeID : If provided all reactions returned will be before given ID.
// afterID : If provided all reactions returned will be after given ID.
func (s *Session) MessageReactions(channelID, messageID, emojiID string, limit int, beforeID, afterID string) (st []*User, err error) {
uri := EndpointMessageReactions(channelID, messageID, emojiID)

v := url.Values{}
Expand All @@ -2126,6 +2128,13 @@ func (s *Session) MessageReactions(channelID, messageID, emojiID string, limit i
v.Set("limit", strconv.Itoa(limit))
}

if afterID != "" {
v.Set("after", afterID)
}
if beforeID != "" {
v.Set("before", beforeID)
}

if len(v) > 0 {
uri += "?" + v.Encode()
}
Expand Down

0 comments on commit 6b2908e

Please sign in to comment.