Error with registering slash commands in v-14.

i have this code which outputs this error the screenshot (discord said message to big)
12 Replies
d.js toolkit
d.js toolkit15mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
duck
duck15mo ago
option type 2 is for subcommand groups, which are expected to contain subcommands consider using the ApplicationCommandOptionType enum for readability
TheOverWatcher
TheOverWatcherOP15mo ago
i changed it to this and the error became Started refreshing application (/) commands. DiscordAPIError[50035]: Invalid Form Body 3.options[0].options[0].required[APPLICATION_COMMAND_REQUIRED_INVALID]: Required cannot be configured for this type of option 3.options[0].options[1].required[APPLICATION_COMMAND_REQUIRED_INVALID]: Required cannot be configured for this type of option at handleErrors (C:\Users\Charis\node_modules@discordjs\rest\src\lib\handlers\Shared.ts:148:10) at processTicksAndRejections (node:internal/process/task_queues:95:5) at async SequentialHandler.runRequest (C:\Users\Charis\node_modules@discordjs\rest\src\lib\handlers\SequentialHandler.ts:398:20) at async SequentialHandler.queueRequest (C:\Users\Charis\node_modules@discordjs\rest\src\lib\handlers\SequentialHandler.ts:168:11) at async _REST.request (C:\Users\Charis\node_modules@discordjs\rest\src\lib\REST.ts:211:20) { requestBody: { files: undefined, json: [ [Object], [Object], [Object], [Object] ] }, rawError: { message: 'Invalid Form Body', code: 50035, errors: { '3': [Object] } }, code: 50035, status: 400, method: 'PUT', url: 'https://discord.com/api/v10/applications/1121751400297279549/commands'
duck
duck15mo ago
that's correct, subcommands (and subcommand groups) cannot be configured to be required or not required they are always required this isn't the change I was expecting you to make, as I assumed those options were intended to be user input rather that the issue was simply you were looking to make the option named subcommand a subcommand as opposed to a subcommand group
TheOverWatcher
TheOverWatcherOP15mo ago
at this point im just gonna try everything until it works but i dont think it will so what should i do now
duck
duck15mo ago
first, what exactly is the goal in having these subcommands? what do you want your command to look like?
TheOverWatcher
TheOverWatcherOP15mo ago
/nation (input subcommand) (input name if not subcommand == dev)
duck
duck15mo ago
just to clarify, is it that you were looking for search, reslist, etc to be the subcommands themselves?
TheOverWatcher
TheOverWatcherOP15mo ago
yes
duck
duck15mo ago
then you'd likely want to make them subcommands of their respective commands directly rather than with a subcommand group as is, you'd end up with /nation subcommand search then you can add options to the subcommands for actual user input
TheOverWatcher
TheOverWatcherOP15mo ago
ok thanks for the help
duck
duck15mo ago
as mentioned previously, subcommands cannot be configured to be required or not, so you'd need to remove each subcommand's required property
Want results from more Discord servers?
Add your server