/// <summary>
        ///  Build the command AS A SUBCOMMAND and put it in a state in which we can use to define it to Discord.
        /// </summary>
        public SlashCommandOptionBuilder BuildSubCommand()
        {
            var builder = new SlashCommandOptionBuilder();

            builder.WithName(Name);
            builder.WithDescription(Description);
            builder.WithType(ApplicationCommandOptionType.SubCommand);
            builder.Options = new List <SlashCommandOptionBuilder>();

            foreach (var parameter in Parameters)
            {
                builder.AddOption(parameter);
            }

            return(builder);
        }
Example #2
0
        private SlashCommandOptionBuilder BuildNestedCommandGroup()
        {
            SlashCommandOptionBuilder builder = new SlashCommandOptionBuilder();

            builder.WithName(commandGroupInfo.groupName);
            builder.WithDescription(commandGroupInfo.description);
            builder.WithType(ApplicationCommandOptionType.SubCommandGroup);
            foreach (var command in Commands)
            {
                builder.AddOption(command.BuildSubCommand());
            }
            foreach (var commandGroup in commandGroups)
            {
                builder.AddOption(commandGroup.BuildNestedCommandGroup());
            }

            return(builder);
        }