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)
This commit is contained in:
spiral 2022-03-30 03:06:21 -04:00
parent eb4ee2afc1
commit 56155782c3
No known key found for this signature in database
GPG Key ID: 244A11E4B0BCF40E

View File

@ -169,8 +169,14 @@ public static class ContextUtils
if (currentPage < 0) currentPage += pageCount; if (currentPage < 0) currentPage += pageCount;
// If we can, remove the user's reaction (so they can press again quickly) // If we can, remove the user's reaction (so they can press again quickly)
if ((await ctx.BotPermissions).HasFlag(PermissionSet.ManageMessages)) if ((await ctx.BotPermissions).HasFlag(PermissionSet.ManageMessages)) try
await ctx.Rest.DeleteUserReaction(msg.ChannelId, msg.Id, reaction.Emoji, reaction.UserId); {
await ctx.Rest.DeleteUserReaction(msg.ChannelId, msg.Id, reaction.Emoji, reaction.UserId);
}
catch (TooManyRequestsException)
{
continue;
}
// Edit the embed with the new page // Edit the embed with the new page
var embed = await MakeEmbedForPage(currentPage); var embed = await MakeEmbedForPage(currentPage);