Example #1
0
        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);
            }
        }
Example #2
0
        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);
                }
            }
        }