#Error 400 on Command

1 messages · Page 1 of 1 (latest)

quasi wadi
#

This is what i have at the moment. Helper.GetCategoriesOfCommands() just gets a list of attributes that hold Names and Descriptions.

        [SlashCommand("help", "Help Command")] // let's define this method as a command
        public async Task HelpCommand(InteractionContext ctx) // this command takes no arguments
        {
            var categories = Helper.GetCategoriesOfCommands();
            var options = new List<DiscordSelectComponentOption>();
            foreach (var category in categories)
            {
                if(options.Count != 0)
                    options.Add(new DiscordSelectComponentOption(
                        $"{category.Name} Commands",
                        category.Name,
                        category.Description,
                        isDefault: true,
                        emoji: new DiscordComponentEmoji(854260064906117121))
                    );
                options.Add(new DiscordSelectComponentOption(
                    $"{category.Name} Commands",
                    category.Name,
                    category.Description,
                    emoji: new DiscordComponentEmoji(854260064906117121))
                );
            }

            // Make the dropdown
            var dropdown = new DiscordSelectComponent("dropdown", null, options, false, 1, 2);
            var builder = new DiscordInteractionResponseBuilder()
            .WithContent("Look, it's a dropdown!")
            .AddComponents(dropdown);
            // respond with the word "Example"
            await ctx.CreateResponseAsync(builder);
        }
copper kiteBOT
#
Automated suggestion: How to find a solution to a `BadRequestException`

It's true that the BadRequestException doesn't provide that much information to the console. To get more info about what you did wrong, catch the BadRequestException yourself, and check the .JsonMessage and the .Errors properties.

quasi wadi
#

you are amazing lol