Fix wraparound on paginated lists

This commit is contained in:
Ske 2019-08-04 13:50:06 +02:00
parent fe22ba4f32
commit cf263af44c

View File

@ -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);