From 56155782c3152143ea3e145dd50ab20ad322cfb3 Mon Sep 17 00:00:00 2001 From: spiral Date: Wed, 30 Mar 2022 03:06:21 -0400 Subject: [PATCH] fix: don't crash if user tries to add a reaction on a page before the reactions are done filling up this is kinda a hacky fix since it just ignores the user input, but it's the best that can be done until Paginate is moved to interactions (buttons) --- PluralKit.Bot/Utils/ContextUtils.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/PluralKit.Bot/Utils/ContextUtils.cs b/PluralKit.Bot/Utils/ContextUtils.cs index 4cfd4597..5060dabb 100644 --- a/PluralKit.Bot/Utils/ContextUtils.cs +++ b/PluralKit.Bot/Utils/ContextUtils.cs @@ -169,8 +169,14 @@ public static class ContextUtils if (currentPage < 0) currentPage += pageCount; // If we can, remove the user's reaction (so they can press again quickly) - if ((await ctx.BotPermissions).HasFlag(PermissionSet.ManageMessages)) - await ctx.Rest.DeleteUserReaction(msg.ChannelId, msg.Id, reaction.Emoji, reaction.UserId); + if ((await ctx.BotPermissions).HasFlag(PermissionSet.ManageMessages)) try + { + await ctx.Rest.DeleteUserReaction(msg.ChannelId, msg.Id, reaction.Emoji, reaction.UserId); + } + catch (TooManyRequestsException) + { + continue; + } // Edit the embed with the new page var embed = await MakeEmbedForPage(currentPage);