#modal build gives ValidationError s.string Expected a string primitive?
10 messages · Page 1 of 1 (latest)
async function postInital(interaction) {
const modal = new ModalBuilder()
.setTitle("Application for Staff")
.setCustomId("staffApplication");
const howOld = new TextInputBuilder()
.setCustomId("howOld")
.setPlaceholder("How old are you?")
.setStyle(TextInputStyle.Short)
.setMinLength(1);
const howLong = new TextInputBuilder()
.setCustomId("howLong")
.setPlaceholder("How long have you been in this server?")
.setStyle(TextInputStyle.Short);
const why = new TextInputBuilder()
.setCustomId("why")
.setPlaceholder("Why do you want to be staff?")
.setStyle(TextInputStyle.Paragraph)
.setMinLength(200);
const howActive = new TextInputBuilder()
.setCustomId("howActive")
.setPlaceholder("How active are you/can you be?")
.setStyle(TextInputStyle.Paragraph);
const anythingElse = new TextInputBuilder()
.setCustomId("anythingElse")
.setPlaceholder("Anything else you want to add?")
.setStyle(TextInputStyle.Paragraph);
const firstActionRow = new ActionRowBuilder().addComponents(howOld);
const secondActionRow = new ActionRowBuilder().addComponents(howLong);
const thirdActionRow = new ActionRowBuilder().addComponents(why);
const fourthActionRow = new ActionRowBuilder().addComponents(howActive);
const fifthActionRow = new ActionRowBuilder().addComponents(anythingElse);
modal.addComponents(
firstActionRow,
secondActionRow,
thirdActionRow,
fourthActionRow,
fifthActionRow
);
await interaction.showModal(modal);
}
That the function that is referenced in the stack trace expected a string but you gave it something else
Right, but I don't pass anything other then text?
That looks fine to me
Then show the full error
It's early, my bad
ValidationError > s.string
Expected a string primitive
Received:
| undefined
at StringValidator.handle (C:\Users\tsomm\Desktop\code\raiderbot-v2\node_modules\@sapphire\shapeshift\dist\index.js:1654:70)
at StringValidator.parse (C:\Users\tsomm\Desktop\code\raiderbot-v2\node_modules\@sapphire\shapeshift\dist\index.js:113:88)
at Object.validateRequiredParameters (C:\Users\tsomm\Desktop\code\raiderbot-v2\node_modules\@discordjs\builders\dist\components\textInput\Assertions.cjs:20:18)
at TextInputBuilder.toJSON (C:\Users\tsomm\Desktop\code\raiderbot-v2\node_modules\@discordjs\builders\dist\components\textInput\TextInput.cjs:53:18)
at C:\Users\tsomm\Desktop\code\raiderbot-v2\node_modules\@discordjs\builders\dist\components\ActionRow.cjs:26:64
at Array.map (<anonymous>)
at ActionRowBuilder.toJSON (C:\Users\tsomm\Desktop\code\raiderbot-v2\node_modules\@discordjs\builders\dist\components\ActionRow.cjs:26:35)
at C:\Users\tsomm\Desktop\code\raiderbot-v2\node_modules\@discordjs\builders\dist\interactions\modals\Modal.cjs:41:64
at Array.map (<anonymous>)
at ModalBuilder.toJSON (C:\Users\tsomm\Desktop\code\raiderbot-v2\node_modules\@discordjs\builders\dist\interactions\modals\Modal.cjs:41:35)
at ChatInputCommandInteraction.showModal (C:\Users\tsomm\Desktop\code\raiderbot-v2\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:248:46)
at Object.postInital (C:\Users\tsomm\Desktop\code\raiderbot-v2\util\applicationHandler.js:43:23)
at Object.execute (C:\Users\tsomm\Desktop\code\raiderbot-v2\commands\applications.js:52:42)
at Object.execute (C:\Users\tsomm\Desktop\code\raiderbot-v2\events\interactionCreate.js:466:23)
at Client.<anonymous> (C:\Users\tsomm\Desktop\code\raiderbot-v2\index.js:47:50)
at Client.emit (node:events:513:28)
You are missing labels
oh