Added some convenience methods

This commit is contained in:
Kwoth
2024-04-19 14:56:02 +00:00
parent 1c41fbfce2
commit cc060da1a7
5 changed files with 65 additions and 26 deletions

View File

@@ -1,3 +1,4 @@
using NadekoBot.Db.Models;
using NadekoBot.Services.Currency;
namespace NadekoBot.Services;
@@ -37,4 +38,6 @@ public interface ICurrencyService
IUser user,
long amount,
TxData? txData);
Task<IReadOnlyList<DiscordUser>> GetTopRichest(ulong ignoreId, int count);
}

View File

@@ -1,6 +1,7 @@
#nullable disable
using LinqToDB;
using LinqToDB.EntityFrameworkCore;
using NadekoBot.Db;
using NadekoBot.Db.Models;
using NadekoBot.Services.Currency;
@@ -106,4 +107,10 @@ public sealed class CurrencyService : ICurrencyService, INService
long amount,
TxData txData)
=> await RemoveAsync(user.Id, amount, txData);
public async Task<IReadOnlyList<DiscordUser>> GetTopRichest(ulong ignoreId, int count)
{
await using var uow = _db.GetDbContext();
return await uow.Set<DiscordUser>().GetTopRichest(ignoreId, count);
}
}