public async Task ChangeNotificationType(IUser user, XpNotificationLocation type) { using (var uow = _db.GetDbContext()) { var du = uow.DiscordUsers.GetOrCreate(user); du.NotifyOnLevelUp = type; await uow.SaveChangesAsync(); } }
public async Task ChangeNotificationType(ulong userId, ulong guildId, XpNotificationLocation type) { using (var uow = _db.GetDbContext()) { var user = uow.Xp.GetOrCreateUser(guildId, userId); user.NotifyOnLevelUp = type; await uow.SaveChangesAsync(); } }
public async Task XpNotify(NotifyPlace place = NotifyPlace.Guild, XpNotificationLocation type = XpNotificationLocation.Channel) { if (place == NotifyPlace.Guild) { await _service.ChangeNotificationType(ctx.User.Id, ctx.Guild.Id, type).ConfigureAwait(false); } else { await _service.ChangeNotificationType(ctx.User, type).ConfigureAwait(false); } await ctx.Channel.SendConfirmAsync("👌").ConfigureAwait(false); }
public async Task XpNotify(NotifyPlace place, XpNotificationLocation type) { if (place == NotifyPlace.Guild) { await _service.ChangeNotificationType(ctx.User.Id, ctx.Guild.Id, type).ConfigureAwait(false); } else { await _service.ChangeNotificationType(ctx.User, type).ConfigureAwait(false); } await ctx.OkAsync().ConfigureAwait(false); }
private string GetNotifLocationString(XpNotificationLocation loc) { if (loc == XpNotificationLocation.Channel) { return(GetText("xpn_notif_channel")); } if (loc == XpNotificationLocation.Dm) { return(GetText("xpn_notif_dm")); } return(GetText("xpn_notif_disabled")); }