예제 #1
0
        public async Task RemoveCommandAsync(
            [Summary("The name of the command.")] string name)
        {
            if (!CustomCommands.ContainsCommand(name, new string[0]))
            {
                throw new InvalidOperationException($"A command with the name `{name}` does not exist.");
            }

            CustomCommands.RemoveCommand(name);

            await GetDefaultBuilder()
            .WithColor(Color.Green)
            .WithDescription($"The command `{name}` was removed.")
            .Build()
            .SendToChannel(Context.Channel);
        }
예제 #2
0
        public async Task CreateCommandAsync(
            [Summary("The name of the command.")] string name)
        {
            if (CustomCommands.ContainsCommand(name, new string[0]))
            {
                throw new InvalidOperationException($"A command with the name `{name}` already exists!");
            }

            CustomCommands.CreateCommand(name);

            await GetDefaultBuilder()
            .WithColor(Color.Green)
            .WithDescription($"The command `{name}` was added!\n\nUse `ccfeature` to add features to the command!")
            .Build()
            .SendToChannel(Context.Channel);
        }