.xpadd will now work on roles

This commit is contained in:
Kwoth
2022-07-26 15:47:55 +02:00
parent a7b3a238f5
commit 0f8291c589
5 changed files with 34 additions and 3 deletions

View File

@@ -726,6 +726,17 @@ public class XpService : INService, IReadyExecutor, IExecNoCommand
// });
// }
public async Task<int> AddXpToUsersAsync(ulong guildId, long amount, params ulong[] userIds)
{
await using var ctx = _db.GetDbContext();
return await ctx.GetTable<UserXpStats>()
.Where(x => x.GuildId == guildId && userIds.Contains(x.UserId))
.UpdateAsync(old => new()
{
Xp = old.Xp + amount
});
}
public void AddXp(ulong userId, ulong guildId, int amount)
{
using var uow = _db.GetDbContext();