#[TAG_FIELD_MISSING]: Field "type" is required to determine the model type.

1 messages · Page 1 of 1 (latest)

river folio
#

I am creating a slash command group like so:

public override registerApplicationCommands(registry: Subcommand.Registry) {
    registry.registerChatInputCommand(
        new SlashCommandBuilder() //
            .setName(CommandName.Admin) //
            .setDescription('Administrative commands.')
            .setDefaultMemberPermissions(PermissionFlagsBits.ManageGuild)
            .addSubcommandGroup(
                new SlashCommandSubcommandGroupBuilder() //
                    .setName(CommandName.AdminMines)
                    .setDescription('Administrative commands related to the mines game.')
                    .addSubcommand(
                        new SlashCommandSubcommandBuilder() //
                            .setName(CommandName.AdminMinesStressTest)
                            .setDescription('Initializes a stress test in the specified channel.')
                            .addChannelOption(
                                new SlashCommandChannelOption() //
                                    .setName(CommandParameterName.Channel)
                                    .addChannelTypes(...this._minesGameStressTestChannelTypes)
                                    .setDescription('The channel in which to run the stress test.')
                                    .setRequired(true)
                            )
                            .addIntegerOption(
                                new SlashCommandIntegerOption() //
                                    .setName(CommandParameterName.GameCount)
                                    .setDescription('The amount of games to simulate.')
                                    .setMinValue(1)
                                    .setMaxValue(100)
                                    .setRequired(true)
                            )
                    )
            ),
    )

But I'm getting an error shown in this pastebin: https://pastebin.com/raw/DxR6KSGE

eager pagodaBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> ✅ Mark Solution

subtle ridge
#

I cannot access the pastebin anymore? Also are you sure the error is from the register? Make sure to check your stacktrace. It saying model would suggest it's elsewhere

river folio
river folio
#

@subtle ridge I've noticed this happens whenever there's subcommands involved, doesn't need to be a subcommand group

#

I've been digging through examples and Sapphire's documentation but I can't figure out what I'm doing wrong... I've worked with subcommands before and never ran into this particular issue

river folio
#

I've fixed this by passing a callback to the registry (using builder => return builder (...)) .
I'm not sure why this fixes it or why it doesn't work when I pass new instances of the builder classes though