Exemplo n.º 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);
            }
        }
Exemplo n.º 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);
                }
            }
        }
Exemplo n.º 3
0
        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();
        }
Exemplo n.º 4
0
        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);
        }