public async Task RemoveCustomCommand(CommandContext ctx) { Console.WriteLine(DateTime.Now.ToString("[HH:mm:ss] ", CultureInfo.CreateSpecificCulture("en-GB")) + "removecmd Command"); string[] splits; splits = ctx.Message.Content.Split(new char[] { ' ' }, 3); if (Useful.MemberIsBotOperator(ctx.Member) || ctx.Member.IsOwner) { CustomCommand.RemoveCommandByName(splits[1], CustomCommand.CustomCommands); CustomCommand.SaveCustomCommands(CustomCommand.CustomCommands); string message = "Command " + splits[1] + " removed."; await ctx.RespondAsync(message).ConfigureAwait(false); } }
public async Task RemoveCustomCommand(CommandContext ctx, string commandName) { logger.Info("removecmd Command", Useful.GetDiscordName(ctx)); if (Useful.MemberIsBotOperator(ctx.Member) || ctx.Member.IsOwner) { if (CustomCommand.RemoveCommandByName(commandName)) { CustomCommand.SaveCustomCommands(); await ctx.RespondAsync("Command " + commandName + " removed.").ConfigureAwait(false); } else { await ctx.RespondAsync("Command " + commandName + " not found.").ConfigureAwait(false); } } }
public async Task AddCustomCommand(CommandContext ctx, string commandName, [RemainingText] string format) { logger.Info("addcmd Command", Useful.GetDiscordName(ctx)); if (CustomCommand.CommandExists(commandName) == true) { string message = "Command " + commandName + " already exists."; await ctx.RespondAsync(message).ConfigureAwait(false); } if (string.IsNullOrWhiteSpace(format)) { return; } CustomCommand.CustomCommands.Add(new CustomCommand(ctx.User.Username, commandName, format)); CustomCommand.SaveCustomCommands(); }
public async Task AddCustomCommand(CommandContext ctx) { Console.WriteLine(DateTime.Now.ToString("[HH:mm:ss] ", CultureInfo.CreateSpecificCulture("en-GB")) + "addcmd Command"); string nick = ctx.User.Username; string[] splits; string message; splits = ctx.Message.Content.Split(new char[] { ' ' }, 3); if (CustomCommand.CommandExists(splits[0], CustomCommand.CustomCommands) == true) { message = "Command " + splits[0] + " already exists."; await ctx.RespondAsync(message).ConfigureAwait(false); } CustomCommand.CustomCommands.Add(new CustomCommand(nick, splits[1], splits[2])); CustomCommand.SaveCustomCommands(CustomCommand.CustomCommands); }