Expected SlashCommandSubcommandBuilder

data: new SlashCommandBuilder()
.setName('user').setDefaultMemberPermissions(0)
.setDescription('add user')
.addSubcommand(subCommand =>
subCommand.setName("add").setDescription("Add a user")
.addStringOption(option =>
option.setName("nickname").setDescription("nickname of the player").setRequired(true)
)
)
.addSubcommand(subCommand =>
subCommand.setName("remove").setDescription("Remove a user")
.addUserOption(option =>
option.setName("user").setDescription("User to remove")
)
)
.addSubcommand(subCommand => {
subCommand.setName("list").setDescription("Get list of users saved")
}),
async execute(interaction) {
data: new SlashCommandBuilder()
.setName('user').setDefaultMemberPermissions(0)
.setDescription('add user')
.addSubcommand(subCommand =>
subCommand.setName("add").setDescription("Add a user")
.addStringOption(option =>
option.setName("nickname").setDescription("nickname of the player").setRequired(true)
)
)
.addSubcommand(subCommand =>
subCommand.setName("remove").setDescription("Remove a user")
.addUserOption(option =>
option.setName("user").setDescription("User to remove")
)
)
.addSubcommand(subCommand => {
subCommand.setName("list").setDescription("Get list of users saved")
}),
async execute(interaction) {
The introduction of the list subcommand has given this error
ExpectedValidationError: Expected
at _InstanceValidator.handle (C:\dev\discordBotRust\node_modules\@sapphire\shapeshift\dist\cjs\index.cjs:1531:75)
at _InstanceValidator.parse (C:\dev\discordBotRust\node_modules\@sapphire\shapeshift\dist\cjs\index.cjs:972:90)
at assertReturnOfBuilder (C:\dev\discordBotRust\node_modules\@discordjs\builders\dist\index.js:1638:53)
at MixedClass.addSubcommand (C:\dev\discordBotRust\node_modules\@discordjs\builders\dist\index.js:2563:5)
at Object.<anonymous> (C:\dev\discordBotRust\commands\user\user.js:32:10)
at Module._compile (node:internal/modules/cjs/loader:1256:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
at Module.load (node:internal/modules/cjs/loader:1119:32)
at Module._load (node:internal/modules/cjs/loader:960:12)
at Module.require (node:internal/modules/cjs/loader:1143:19) {
validator: 's.instance(V)',
given: undefined,
expected: [Function: SlashCommandSubcommandBuilder]
ExpectedValidationError: Expected
at _InstanceValidator.handle (C:\dev\discordBotRust\node_modules\@sapphire\shapeshift\dist\cjs\index.cjs:1531:75)
at _InstanceValidator.parse (C:\dev\discordBotRust\node_modules\@sapphire\shapeshift\dist\cjs\index.cjs:972:90)
at assertReturnOfBuilder (C:\dev\discordBotRust\node_modules\@discordjs\builders\dist\index.js:1638:53)
at MixedClass.addSubcommand (C:\dev\discordBotRust\node_modules\@discordjs\builders\dist\index.js:2563:5)
at Object.<anonymous> (C:\dev\discordBotRust\commands\user\user.js:32:10)
at Module._compile (node:internal/modules/cjs/loader:1256:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
at Module.load (node:internal/modules/cjs/loader:1119:32)
at Module._load (node:internal/modules/cjs/loader:960:12)
at Module.require (node:internal/modules/cjs/loader:1143:19) {
validator: 's.instance(V)',
given: undefined,
expected: [Function: SlashCommandSubcommandBuilder]
Anyone know why?
2 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 staff
sb
sbOP4w ago
ahhh... thanks 😁

Did you find this page helpful?