I am trying to reply to a command with a modal, but every time I show it i get this error:
ValidationError > s.nativeEnum(T)
Expected the value to be a string or number
Received:
| undefined
at NativeEnumValidator.handle (C:\Users\micle\Documents\Programmi\Node\discordBot\node_modules\@sapphire\shapeshift\src\validators\NativeEnumValidator.ts:34:23)
at NativeEnumValidator.parse (C:\Users\micle\Documents\Programmi\Node\discordBot\node_modules\@sapphire\shapeshift\src\validators\BaseValidator.ts:102:48)
at Object.validateRequiredParameters (C:\Users\micle\Documents\Programmi\Node\discordBot\node_modules\@discordjs\builders\src\components\textInput\Assertions.ts:14:27)
at TextInputBuilder.toJSON (C:\Users\micle\Documents\Programmi\Node\discordBot\node_modules\@discordjs\builders\src\components\textInput\TextInput.ts:53:5)
at C:\Users\micle\Documents\Programmi\Node\discordBot\node_modules\@discordjs\builders\src\components\ActionRow.ts:23:64
at Array.map (<anonymous>)
at ActionRowBuilder.toJSON (C:\Users\micle\Documents\Programmi\Node\discordBot\node_modules\@discordjs\builders\src\components\ActionRow.ts:23:35)
at C:\Users\micle\Documents\Programmi\Node\discordBot\node_modules\@discordjs\builders\src\interactions\modals\Modal.ts:36:64
at Array.map (<anonymous>)
at ModalBuilder.toJSON (C:\Users\micle\Documents\Programmi\Node\discordBot\node_modules\@discordjs\builders\src\interactions\modals\Modal.ts:36:35)
I tried to remove fields, to rename them and to change ActionRowBuilder<T> type, but it still don't work.
Here's my code:
execute: async (interaction, bot) => {
const modal = new ModalBuilder()
.setTitle(INFO.modalTitle)
.setCustomId(INFO.name);
const channelsName = new TextInputBuilder()
.setCustomId(MODALOPTIONS.channelsName.ID)
.setLabel(MODALOPTIONS.channelsName.label)
.setPlaceholder(MODALOPTIONS.channelsName.placeholder)
.setMinLength(MODALOPTIONS.channelsName.minLength)
.setMaxLength(MODALOPTIONS.channelsName.maxLength);
const firstActionRow = new ActionRowBuilder<TextInputBuilder>()
.addComponents(channelsName);
modal.addComponents(firstActionRow);
console.log(modal)
await interaction.showModal(modal);
}
Edit: I've been able to send it. I was just missing to set the style of the parameter, but now I'm stucked again on adding a SelectMenuBuilder to the modal. If I create the ActionRowBuilder<SelectMenuBuilder> then I can't add it to the modal, if I create is as ActionRowBuilder<any> il does let me, but then it throws an error when I send the modal