public async Task Add(IRole role) { TownGuild guild = Database.GetGuild(Context.Guild); if (guild == null) { return; } CrossAlert alert = guild.CrossAlerts.FirstOrDefault(x => x.Role == role.Id); if (alert == null) { alert = new CrossAlert() { Role = role.Id }; guild.CrossAlerts.Add(alert); } await ReplyAsync("Editing cross alert...\n" + $"Please answer the following questions ('{SkipCharacter}' to skip / leave default)"); await AskChannel($"Which channel should be alerted?", alert.Channel, value => alert.Channel = value); Database.Guilds.Update(guild); await ReplyAsync("Done!"); }
public async Task Delete(IRole role) { TownGuild guild = Database.GetGuild(Context.Guild); if (guild == null) { return; } CrossAlert alert = guild.CrossAlerts.FirstOrDefault(x => x.Role == role.Id); if (alert == null) { await ReplyAsync("Alert not found for " + role.Mention); } else { await ReplyAsync("Deleted filter for " + role.Mention); guild.CrossAlerts.Remove(alert); Database.Guilds.Update(guild); } }