public async Task ChangeNotificationType(ulong userId, ulong guildId, XpNotificationType type) { using (var uow = _db.UnitOfWork) { var user = uow.Xp.GetOrCreateUser(guildId, userId); user.NotifyOnLevelUp = type; await uow.CompleteAsync(); } }
public async Task ChangeNotificationType(IUser user, XpNotificationType type) { using (var uow = _db.UnitOfWork) { var du = uow.DiscordUsers.GetOrCreate(user); du.NotifyOnLevelUp = type; await uow.CompleteAsync(); } }
public async Task XpNotify(NotifyPlace place = NotifyPlace.Guild, XpNotificationType type = XpNotificationType.Channel) { if (place == NotifyPlace.Guild) { await _service.ChangeNotificationType(Context.User.Id, Context.Guild.Id, type); } else { await _service.ChangeNotificationType(Context.User, type); } await Context.Channel.SendConfirmAsync("👌").ConfigureAwait(false); }