public async Task addCommand(string name, [Remainder] string text) { if (CommandHandler.CustomCommands.Any(c => c.Command == name.ToLower()) || CommandHandler.CustomCommands.Any(c => c.Aliases.Any(a => a == name.ToLower()))) { await ReplyAsync($"There already exists a command with the name or alias `{name}`"); return; } var cmd = new CustomCommand(name, text); CommandHandler.CustomCommands.Add(cmd); var em = new EmbedBuilder(); em.AddField(new EmbedFieldBuilder().WithName("Name").WithValue(cmd.Command).WithIsInline(true)); em.AddField(new EmbedFieldBuilder().WithName("Aliases").WithValue(cmd.GetAliases()).WithIsInline(true)); em.AddField(new EmbedFieldBuilder().WithName("Value").WithValue(cmd.Value).WithIsInline(false)); em.AddField(new EmbedFieldBuilder().WithName("Delete").WithValue(cmd.Delete).WithIsInline(true)); File.WriteAllText("files/customCommands.json", JsonConvert.SerializeObject(CommandHandler.CustomCommands, Formatting.Indented)); await ReplyAsync($"The command `{cmd.Command}` has been created!", embed : em.Build()); }