ModalBuilder() is not working !
else if (interaction.commandName === "userregister") {
console.log('hello world register !');
const modal = new ModalBuilder()
.setTitle("Register User Form")
.setCustomId('registerUserModal')
.setComponents(
new ActionRowBuilder().setComponents(
new TextInputBuilder()
.setLabel('username')
.setCustomId('username')
.setStyle(TextInputStyle.Short)
)
);
interaction.showModal(modal);else if (interaction.commandName === "userregister") {
console.log('hello world register !');
const modal = new ModalBuilder()
.setTitle("Register User Form")
.setCustomId('registerUserModal')
.setComponents(
new ActionRowBuilder().setComponents(
new TextInputBuilder()
.setLabel('username')
.setCustomId('username')
.setStyle(TextInputStyle.Short)
)
);
interaction.showModal(modal);and gives me this error:
file:///C:/Users/kura/Desktop/slash_tutorial/node_modules/@sapphire/shapeshift/dist/index.mjs:465
return errors.length === 0 ? Result.ok(transformed) : Result.err(new CombinedPropertyError(errors));
^
CombinedPropertyError: Received one or more errors
at ArrayValidator.handle (file:///C:/Users/kura/Desktop/slash_tutorial/node_modules/@sapphire/shapeshift/dist/index.mjs:465:70)
at ArrayValidator.parse (file:///C:/Users/kura/Desktop/slash_tutorial/node_modules/@sapphire/shapeshift/dist/index.mjs:204:88)
at validateRequiredParameters (file:///C:/Users/kura/Desktop/slash_tutorial/node_modules/@discordjs/builders/dist/index.mjs:1232:23)
at ModalBuilder.toJSON (file:///C:/Users/kura/Desktop/slash_tutorial/node_modules/@discordjs/builders/dist/index.mjs:1299:5)
at ChatInputCommandInteraction.showModal (C:\Users\kura\Desktop\slash_tutorial\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:256:46)
at Client.<anonymous> (file:///C:/Users/kura/Desktop/slash_tutorial/src/index.js:56:25)
at Client.emit (node:events:513:28)
at InteractionCreateAction.handle (C:\Users\kura\Desktop\slash_tutorial\node_modules\discord.js\src\client\actions\InteractionCreate.js:97:12)
at module.exports [as INTERACTION_CREATE] (C:\Users\kura\Desktop\slash_tutorial\node_modules\discord.js\src\client\websocket\handlers\INTERACTION_CREATE.js:4:36)
at WebSocketManager.handlePacket (C:\Users\kura\Desktop\slash_tutorial\node_modules\discord.js\src\client\websocket\WebSocketManager.js:354:31) {
errors: [
[
0,
ExpectedValidationError: Expected
at InstanceValidator.handle (file:///C:/Users/kura/Desktop/slash_tutorial/node_modules/@sapphire/shapeshift/dist/index.mjs:722:75)
at InstanceValidator.run (file:///C:/Users/kura/Desktop/slash_tutorial/node_modules/@sapphire/shapeshift/dist/index.mjs:190:23)
at ArrayValidator.handle (file:///C:/Users/kura/Desktop/slash_tutorial/node_modules/@sapphire/shapeshift/dist/index.mjs:459:37)
at ArrayValidator.parse (file:///C:/Users/kura/Desktop/slash_tutorial/node_modules/@sapphire/shapeshift/dist/index.mjs:204:88)
at validateRequiredParameters (file:///C:/Users/kura/Desktop/slash_tutorial/node_modules/@discordjs/builders/dist/index.mjs:1232:23)
at ModalBuilder.toJSON (file:///C:/Users/kura/Desktop/slash_tutorial/node_modules/@discordjs/builders/dist/index.mjs:1299:5)
at ChatInputCommandInteraction.showModal (C:\Users\kura\Desktop\slash_tutorial\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:256:46)
at Client.<anonymous> (file:///C:/Users/kura/Desktop/slash_tutorial/src/index.js:56:25)
at Client.emit (node:events:513:28)
at InteractionCreateAction.handle (C:\Users\kura\Desktop\slash_tutorial\node_modules\discord.js\src\client\actions\InteractionCreate.js:97:12) {
validator: 's.instance(V)',
given: ActionRowBuilder {
data: { type: 1 },
components: [ [TextInputBuilder] ]
},
expected: [class ActionRowBuilder extends ComponentBuilder]
}
]
]
}
Node.js v18.16.0
[nodemon] app crashed - waiting for file changes before starting...file:///C:/Users/kura/Desktop/slash_tutorial/node_modules/@sapphire/shapeshift/dist/index.mjs:465
return errors.length === 0 ? Result.ok(transformed) : Result.err(new CombinedPropertyError(errors));
^
CombinedPropertyError: Received one or more errors
at ArrayValidator.handle (file:///C:/Users/kura/Desktop/slash_tutorial/node_modules/@sapphire/shapeshift/dist/index.mjs:465:70)
at ArrayValidator.parse (file:///C:/Users/kura/Desktop/slash_tutorial/node_modules/@sapphire/shapeshift/dist/index.mjs:204:88)
at validateRequiredParameters (file:///C:/Users/kura/Desktop/slash_tutorial/node_modules/@discordjs/builders/dist/index.mjs:1232:23)
at ModalBuilder.toJSON (file:///C:/Users/kura/Desktop/slash_tutorial/node_modules/@discordjs/builders/dist/index.mjs:1299:5)
at ChatInputCommandInteraction.showModal (C:\Users\kura\Desktop\slash_tutorial\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:256:46)
at Client.<anonymous> (file:///C:/Users/kura/Desktop/slash_tutorial/src/index.js:56:25)
at Client.emit (node:events:513:28)
at InteractionCreateAction.handle (C:\Users\kura\Desktop\slash_tutorial\node_modules\discord.js\src\client\actions\InteractionCreate.js:97:12)
at module.exports [as INTERACTION_CREATE] (C:\Users\kura\Desktop\slash_tutorial\node_modules\discord.js\src\client\websocket\handlers\INTERACTION_CREATE.js:4:36)
at WebSocketManager.handlePacket (C:\Users\kura\Desktop\slash_tutorial\node_modules\discord.js\src\client\websocket\WebSocketManager.js:354:31) {
errors: [
[
0,
ExpectedValidationError: Expected
at InstanceValidator.handle (file:///C:/Users/kura/Desktop/slash_tutorial/node_modules/@sapphire/shapeshift/dist/index.mjs:722:75)
at InstanceValidator.run (file:///C:/Users/kura/Desktop/slash_tutorial/node_modules/@sapphire/shapeshift/dist/index.mjs:190:23)
at ArrayValidator.handle (file:///C:/Users/kura/Desktop/slash_tutorial/node_modules/@sapphire/shapeshift/dist/index.mjs:459:37)
at ArrayValidator.parse (file:///C:/Users/kura/Desktop/slash_tutorial/node_modules/@sapphire/shapeshift/dist/index.mjs:204:88)
at validateRequiredParameters (file:///C:/Users/kura/Desktop/slash_tutorial/node_modules/@discordjs/builders/dist/index.mjs:1232:23)
at ModalBuilder.toJSON (file:///C:/Users/kura/Desktop/slash_tutorial/node_modules/@discordjs/builders/dist/index.mjs:1299:5)
at ChatInputCommandInteraction.showModal (C:\Users\kura\Desktop\slash_tutorial\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:256:46)
at Client.<anonymous> (file:///C:/Users/kura/Desktop/slash_tutorial/src/index.js:56:25)
at Client.emit (node:events:513:28)
at InteractionCreateAction.handle (C:\Users\kura\Desktop\slash_tutorial\node_modules\discord.js\src\client\actions\InteractionCreate.js:97:12) {
validator: 's.instance(V)',
given: ActionRowBuilder {
data: { type: 1 },
components: [ [TextInputBuilder] ]
},
expected: [class ActionRowBuilder extends ComponentBuilder]
}
]
]
}
Node.js v18.16.0
[nodemon] app crashed - waiting for file changes before starting...