error when deploying commands

i think the error is about subcommands and the only command i have with subcommands is this one:
data: new SlashCommandBuilder()
.setName('echo')
.setDescription('Sends the message as the Bot')
.addSubcommand(subcommand =>
subcommand.setName('normal')
.setDescription('Sends a normal message')
.addStringOption(option =>
option.setName('message')
.setDescription('The message to send')
.setRequired(true)
)
)
.addSubcommand(subcommand =>
subcommand.setName('embed')
.setDescription('Sends an embed message')
.addStringOption(option =>
option.setName('description')
.setDescription('The description of the embed')
.setRequired(true)
)
.addStringOption(option =>
option.setName('title')
.setDescription('The title of the embed')
)
.addStringOption(option =>
option.setName('timestamp')
.setDescription('Should the embed have a timestamp?')
.addChoices(
{ name: 'True', value: 'true' },
{ name: 'False', value: 'false' }
)
)
)
.addStringOption(option =>
option.setName('replyornor')
.setDescription('Should the message be sent as a command reply or separate message?')
.addChoices(
{ name: 'Reply', value: 'The message will be sent as a reply to the command'},
{ name: 'Message', value: 'The message will be sent as a separate message'}
)
)
.setIntegrationTypes([ApplicationIntegrationType.UserInstall])
.setContexts([InteractionContextType.Guild, InteractionContextType.BotDM, InteractionContextType.PrivateChannel]),
data: new SlashCommandBuilder()
.setName('echo')
.setDescription('Sends the message as the Bot')
.addSubcommand(subcommand =>
subcommand.setName('normal')
.setDescription('Sends a normal message')
.addStringOption(option =>
option.setName('message')
.setDescription('The message to send')
.setRequired(true)
)
)
.addSubcommand(subcommand =>
subcommand.setName('embed')
.setDescription('Sends an embed message')
.addStringOption(option =>
option.setName('description')
.setDescription('The description of the embed')
.setRequired(true)
)
.addStringOption(option =>
option.setName('title')
.setDescription('The title of the embed')
)
.addStringOption(option =>
option.setName('timestamp')
.setDescription('Should the embed have a timestamp?')
.addChoices(
{ name: 'True', value: 'true' },
{ name: 'False', value: 'false' }
)
)
)
.addStringOption(option =>
option.setName('replyornor')
.setDescription('Should the message be sent as a command reply or separate message?')
.addChoices(
{ name: 'Reply', value: 'The message will be sent as a reply to the command'},
{ name: 'Message', value: 'The message will be sent as a separate message'}
)
)
.setIntegrationTypes([ApplicationIntegrationType.UserInstall])
.setContexts([InteractionContextType.Guild, InteractionContextType.BotDM, InteractionContextType.PrivateChannel]),
5 Replies
d.js toolkit
d.js toolkit4w 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! - Marked as resolved by OP
𝑨𝒃𝒔𝒐𝒍𝒖𝒕𝒆 𝑪𝒂𝒓𝒏𝒂𝒈𝒆
discord.js - 14.16.3 node - 22.10.0
duck
duck4w ago
when using subcommands/groups, you can't have other option types at the same level since you can't use the base command separate from the subcommands which is to say, you'd need to add the string option to the subcommand rather than the base command

Did you find this page helpful?