mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-11 01:38:27 -04:00
15 lines
494 B
C#
15 lines
494 B
C#
#nullable disable
|
|
using LinqToDB;
|
|
using NadekoBot.Services.Database.Models;
|
|
|
|
namespace NadekoBot.Modules.Xp.Extensions;
|
|
|
|
public static class Extensions
|
|
{
|
|
public static async Task<LevelStats> GetLevelDataFor(this ITable<UserXpStats> userXp, ulong guildId, ulong userId)
|
|
=> await userXp
|
|
.Where(x => x.GuildId == guildId && x.UserId == userId)
|
|
.FirstOrDefaultAsync() is UserXpStats uxs
|
|
? new(uxs.Xp + uxs.AwardedXp)
|
|
: new(0);
|
|
} |