From cf263af44c92c1abc5c0f6aa2d3ebc121be27efc Mon Sep 17 00:00:00 2001 From: Ske Date: Sun, 4 Aug 2019 13:50:06 +0200 Subject: [PATCH] Fix wraparound on paginated lists --- PluralKit.Bot/ContextUtils.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/PluralKit.Bot/ContextUtils.cs b/PluralKit.Bot/ContextUtils.cs index 23de8067..c6afd928 100644 --- a/PluralKit.Bot/ContextUtils.cs +++ b/PluralKit.Bot/ContextUtils.cs @@ -83,6 +83,9 @@ namespace PluralKit.Bot { if (reaction.Emote.Name == "\u23E9") currentPage = pageCount - 1; // >> if (reaction.Emote.Name == Emojis.Error) break; // X + // C#'s % operator is dumb and wrong, so we fix negative numbers + if (currentPage < 0) currentPage += pageCount; + // If we can, remove the user's reaction (so they can press again quickly) if (await ctx.HasPermission(ChannelPermission.ManageMessages) && reaction.User.IsSpecified) await msg.RemoveReactionAsync(reaction.Emote, reaction.User.Value);