From 59d2ac8959e3a69174e1e2635d1e73307f7ef689 Mon Sep 17 00:00:00 2001 From: mavolin <48887425+mavolin@users.noreply.github.com> Date: Sat, 21 Nov 2020 15:53:57 +0100 Subject: [PATCH] API: fix wrong constants getting used for fetch limits --- api/guild.go | 4 ++-- api/member.go | 2 +- api/message_reaction.go | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/api/guild.go b/api/guild.go index 49d4ace..69e1505 100644 --- a/api/guild.go +++ b/api/guild.go @@ -147,7 +147,7 @@ func (c *Client) GuildsBefore(before discord.GuildID, limit uint) ([]discord.Gui if limit > 0 { // Only fetch as much as we need. Since limit gradually decreases, // we only need to fetch min(fetch, limit). - fetch = uint(min(maxMessageFetchLimit, int(limit))) + fetch = uint(min(maxGuildFetchLimit, int(limit))) limit -= fetch } @@ -192,7 +192,7 @@ func (c *Client) GuildsAfter(after discord.GuildID, limit uint) ([]discord.Guild if limit > 0 { // Only fetch as much as we need. Since limit gradually decreases, // we only need to fetch min(fetch, limit). - fetch = uint(min(maxMessageFetchLimit, int(limit))) + fetch = uint(min(maxGuildFetchLimit, int(limit))) limit -= fetch } diff --git a/api/member.go b/api/member.go index 5ec1069..431d685 100644 --- a/api/member.go +++ b/api/member.go @@ -47,7 +47,7 @@ func (c *Client) MembersAfter( // Only fetch as much as we need. Since limit gradually decreases, // we only need to fetch min(fetch, limit). if limit > 0 { - fetch = uint(min(maxMessageFetchLimit, int(limit))) + fetch = uint(min(maxMemberFetchLimit, int(limit))) limit -= fetch } diff --git a/api/message_reaction.go b/api/message_reaction.go index 05b5da1..dd9df4c 100644 --- a/api/message_reaction.go +++ b/api/message_reaction.go @@ -64,7 +64,7 @@ func (c *Client) ReactionsBefore( if limit > 0 { // Only fetch as much as we need. Since limit gradually decreases, // we only need to fetch min(fetch, limit). - fetch = uint(min(maxMessageFetchLimit, int(limit))) + fetch = uint(min(maxMessageReactionFetchLimit, int(limit))) limit -= fetch } @@ -110,7 +110,7 @@ func (c *Client) ReactionsAfter( if limit > 0 { // Only fetch as much as we need. Since limit gradually decreases, // we only need to fetch min(fetch, limit). - fetch = uint(min(maxMessageFetchLimit, int(limit))) + fetch = uint(min(maxMessageReactionFetchLimit, int(limit))) limit -= fetch }