diff --git a/src/NadekoBot/Modules/Gambling/Commands/WaifuClaimCommands.cs b/src/NadekoBot/Modules/Gambling/Commands/WaifuClaimCommands.cs index a6d58fff..02025444 100644 --- a/src/NadekoBot/Modules/Gambling/Commands/WaifuClaimCommands.cs +++ b/src/NadekoBot/Modules/Gambling/Commands/WaifuClaimCommands.cs @@ -377,12 +377,17 @@ namespace NadekoBot.Modules.Gambling [NadekoCommand, Usage, Description, Aliases] [RequireContext(ContextType.Guild)] - public async Task WaifuLeaderboard() + public async Task WaifuLeaderboard(int page = 1) { + page--; + + if (page < 0) + return; + IList waifus; using (var uow = _db.UnitOfWork) { - waifus = uow.Waifus.GetTop(9); + waifus = uow.Waifus.GetTop(9, page * 9); } if (waifus.Count == 0) @@ -400,7 +405,7 @@ namespace NadekoBot.Modules.Gambling var w = waifus[i]; var j = i; - embed.AddField(efb => efb.WithName("#" + (j + 1) + " - " + w.Price + _bc.CurrencySign).WithValue(w.ToString()).WithIsInline(false)); + embed.AddField(efb => efb.WithName("#" + ((page * 9) + j + 1) + " - " + w.Price + _bc.CurrencySign).WithValue(w.ToString()).WithIsInline(false)); } await Context.Channel.EmbedAsync(embed).ConfigureAwait(false); diff --git a/src/NadekoBot/Resources/CommandStrings.resx b/src/NadekoBot/Resources/CommandStrings.resx index b3705bd0..7f3f4bfe 100644 --- a/src/NadekoBot/Resources/CommandStrings.resx +++ b/src/NadekoBot/Resources/CommandStrings.resx @@ -3037,10 +3037,10 @@ waifus waifulb - Shows top 9 waifus. + Shows top 9 waifus. You can specify another page to show other waifus. - `{0}waifus` + `{0}waifus` or `{0}waifulb 3` divorce diff --git a/src/NadekoBot/Services/Database/Repositories/IWaifuRepository.cs b/src/NadekoBot/Services/Database/Repositories/IWaifuRepository.cs index d03c1188..50295897 100644 --- a/src/NadekoBot/Services/Database/Repositories/IWaifuRepository.cs +++ b/src/NadekoBot/Services/Database/Repositories/IWaifuRepository.cs @@ -5,7 +5,7 @@ namespace NadekoBot.Services.Database.Repositories { public interface IWaifuRepository : IRepository { - IList GetTop(int count); + IList GetTop(int count, int skip = 0); WaifuInfo ByWaifuUserId(ulong userId); IList ByClaimerUserId(ulong userId); } diff --git a/src/NadekoBot/Services/Database/Repositories/Impl/WaifuRepository.cs b/src/NadekoBot/Services/Database/Repositories/Impl/WaifuRepository.cs index de6b96ff..3b9a4dc6 100644 --- a/src/NadekoBot/Services/Database/Repositories/Impl/WaifuRepository.cs +++ b/src/NadekoBot/Services/Database/Repositories/Impl/WaifuRepository.cs @@ -29,7 +29,7 @@ namespace NadekoBot.Services.Database.Repositories.Impl .ToList(); } - public IList GetTop(int count) + public IList GetTop(int count, int skip = 0) { if (count < 0) throw new ArgumentOutOfRangeException(nameof(count)); @@ -40,6 +40,7 @@ namespace NadekoBot.Services.Database.Repositories.Impl .Include(wi => wi.Affinity) .Include(wi => wi.Claimer) .OrderByDescending(wi => wi.Price) + .Skip(skip) .Take(count) .ToList(); }