public async Task ToggleVerboseErrors() { await Context.Message.AddReactionAsync(new Emoji("👌")); _config.VerboseErrors = !_config.VerboseErrors; _config.SaveConfig(true); _config.ReloadConfig(false); var toCueUp = "verboseErrors_disable"; if (_config.VerboseErrors) { toCueUp = "verboseErrors_enable"; } await ReplyAsync($":ok_hand: `{StringResourceHandler.GetTextStatic("Admin", toCueUp)}`").ConfigureAwait(false); }
public async Task AddCustomReaction(string trigger, [Remainder] string response) { if (_config.EnableCustomReactions) { var pleasewait = Context.Channel.EnterTypingState(); int respnum = 1; bool keyAlreadyExists = false; foreach (var existingKey in _config.CustomReactions.Keys) { if (existingKey.ToLowerInvariant() == trigger.ToLowerInvariant()) { keyAlreadyExists = true; _config.CustomReactions[existingKey].Add(response); respnum = _config.CustomReactions[existingKey].Count; break; } } if (!keyAlreadyExists) { _config.CustomReactions.Add(trigger, new List <string>()); _config.CustomReactions[trigger].Add(response); } _config.SaveConfig(true); _config.ReloadConfig(false); var replyEmbed = new EmbedBuilder() .WithTitle("✨ " + StringResourceHandler.GetTextStatic("CustomReactions", "AddCustomReaction")) .AddField(StringResourceHandler.GetTextStatic("CustomReactions", "trigger"), trigger) .AddField(StringResourceHandler.GetTextStatic("CustomReactions", "response", respnum), response) .Build(); await Context.Message.AddReactionAsync(new Emoji("✨")); pleasewait.Dispose(); await ReplyAsync(Context.User.Mention, false, replyEmbed); } else { await Context.Message.AddReactionAsync(new Emoji("⛔")); await ReplyAsync($":no_entry: `{StringResourceHandler.GetTextStatic("CustomReactions", "disabled")}`").ConfigureAwait(false); } }