$lb is now paginated

This commit is contained in:
Kwoth
2017-03-09 02:17:18 +01:00
parent dc283d1054
commit ba19524245
7 changed files with 2126 additions and 2093 deletions

View File

@@ -244,19 +244,26 @@ namespace NadekoBot.Modules.Gambling
}
[NadekoCommand, Usage, Description, Aliases]
public async Task Leaderboard()
public async Task Leaderboard(int page = 1)
{
List<Currency> richest;
using (var uow = DbHandler.UnitOfWork())
{
richest = uow.Currency.GetTopRichest(9).ToList();
richest = uow.Currency.GetTopRichest(9, 9 * (page - 1)).ToList();
}
if (!richest.Any())
return;
var embed = new EmbedBuilder()
.WithOkColor()
.WithTitle(NadekoBot.BotConfig.CurrencySign + " " + GetText("leaderboard"));
.WithTitle(NadekoBot.BotConfig.CurrencySign +
" " + GetText("leaderboard"))
.WithFooter(efb => efb.WithText(GetText("page", page)));
if (!richest.Any())
{
embed.WithDescription(GetText("no_users_found"));
await Context.Channel.EmbedAsync(embed).ConfigureAwait(false);
return;
}
for (var i = 0; i < richest.Count; i++)
{