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
- 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!option type
2
is for subcommand groups, which are expected to contain subcommands
consider using the ApplicationCommandOptionType
enum for readabilityi 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'
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 groupat this point im just gonna try everything until it works
but i dont think it will
so what should i do now
first, what exactly is the goal in having these subcommands?
what do you want your command to look like?
/nation (input subcommand) (input name if not subcommand == dev)
just to clarify, is it that you were looking for
search
, reslist
, etc to be the subcommands themselves?yes
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 inputok thanks for the help
as mentioned previously, subcommands cannot be configured to be required or not, so you'd need to remove each subcommand's
required
property