.whosplaying is now properly paginated

This commit is contained in:
Toastie (DCS Team) 2024-08-17 19:09:01 +12:00
parent da48250ad4
commit 51bfe8d206
Signed by: toastie_t0ast
GPG key ID: 27F3B6855AFD40A4

View file

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