1
Fork 0
mirror of https://gitlab.com/Kwoth/nadekobot.git synced 2024-10-02 12:09:07 +00:00

change: .whosplaying is now properly paginated

This commit is contained in:
Kwoth 2024-08-16 23:56:05 +00:00
parent 67616deb79
commit f764a650da

View file

@ -122,21 +122,27 @@ public partial class Utility : NadekoModule
}
}
userNames.Shuffle();
var i = 0;
if (userNames.Count == 0)
{
await Response().Error(strs.nobody_playing_game).SendAsync();
return;
}
var users = userNames.GroupBy(_ => i++ / 2)
.Select(ig => string.Concat(ig.Select(el => $"• {el,-27}")))
.Join('\n');
await Response()
.Confirm(Format.Code(users))
.Sanitize()
.Paginated()
.Items(userNames)
.PageSize(20)
.Page((names, _) =>
{
if (names.Count == 0)
{
return _sender.CreateEmbed()
.WithErrorColor()
.WithDescription(GetText(strs.nobody_playing_game));
}
var eb = _sender.CreateEmbed()
.WithOkColor();
var users = names.Join('\n');
return eb.WithDescription(users);
})
.SendAsync();
}