Error - No subcommand group specified for interaction. While Having SubcommandGroup and Subcommand ( root ) #7761
-
Which package is this bug report for?discord.js Issue descriptionf we got code like the one i provided and do Code sampleoptions: [{
name: 'random',
description: 'random',
type: 'SUB_COMMAND_GROUP',
options: [{
name: 'random',
description: 'random',
type: 'SUB_COMMAND'
},
]
},{
name: 'randoms',
description: 'randoms',
type: 'SUB_COMMAND'
}],
// in run
const subcmdg = interaction.options.getSubcommandGroup() Package version13.5.0 Node.js versionv16.14.0 Operating systemFedora 35 Priority this issue should haveMedium (should be fixed soon) Which partials do you have configured?No Partials Which gateway intents are you subscribing to?No Intents I have tested this issue on a development releaseNo response |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
This isn't a bug. Your bot is receiving the application command that is not a subcommand group, which is only one other command as seen from your reproducible code sample. |
Beta Was this translation helpful? Give feedback.
-
Subcommand group and Subcommand are default to interaction.options.getSubcommandGroup(false) U can check this pr to know more |
Beta Was this translation helpful? Give feedback.
-
oh thanks imranbhuiya |
Beta Was this translation helpful? Give feedback.
Subcommand group and Subcommand are default to
required = true
. So when a user uses your Subcommand but not subcommandgroup, it'll throw error. This was changed in main branch so in v14 for Subcommandgrouprequired
is default to false. For now u can passrequired = false
like this to avoid the errorU can check this pr to know more
#7217