From 10b8f7c351952215016fff7cd83c0a09763fad33 Mon Sep 17 00:00:00 2001 From: Gregory DALMAR Date: Mon, 18 Jun 2018 15:42:17 +0200 Subject: [PATCH] Add pagination to MessageReactions --- restapi.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/restapi.go b/restapi.go index 5dc0467..2249dcc 100644 --- a/restapi.go +++ b/restapi.go @@ -1946,7 +1946,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{} @@ -1955,6 +1957,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 = fmt.Sprintf("%s?%s", uri, v.Encode()) }