willuhmjs - ```jsValidationError s.string Exp...

ValidationError > s.string
Expected a string primitive

Received:
| undefined

at StringValidator.handle (/workspaces/Dapper/node_modules/@sapphire/shapeshift/src/validators/StringValidator.ts:77:64)
at StringValidator.parse (/workspaces/Dapper/node_modules/@sapphire/shapeshift/src/validators/BaseValidator.ts:102:48)
at validateRequiredParameters (/workspaces/Dapper/node_modules/@discordjs/builders/src/components/textInput/Assertions.ts:26:17)
at TextInputBuilder.toJSON (/workspaces/Dapper/node_modules/@discordjs/builders/src/components/textInput/TextInput.ts:132:3)
at <anonymous> (/workspaces/Dapper/node_modules/@discordjs/builders/src/components/ActionRow.ts:103:61)
at Array.map (<anonymous>)
at ActionRowBuilder.toJSON (/workspaces/Dapper/node_modules/@discordjs/builders/src/components/ActionRow.ts:103:32)
at <anonymous> (/workspaces/Dapper/node_modules/@discordjs/builders/src/interactions/modals/Modal.ts:82:61)
at Array.map (<anonymous>)
at ModalBuilder.toJSON (/workspaces/Dapper/node_modules/@discordjs/builders/src/interactions/modals/Modal.ts:82:32)
ValidationError > s.string
Expected a string primitive

Received:
| undefined

at StringValidator.handle (/workspaces/Dapper/node_modules/@sapphire/shapeshift/src/validators/StringValidator.ts:77:64)
at StringValidator.parse (/workspaces/Dapper/node_modules/@sapphire/shapeshift/src/validators/BaseValidator.ts:102:48)
at validateRequiredParameters (/workspaces/Dapper/node_modules/@discordjs/builders/src/components/textInput/Assertions.ts:26:17)
at TextInputBuilder.toJSON (/workspaces/Dapper/node_modules/@discordjs/builders/src/components/textInput/TextInput.ts:132:3)
at <anonymous> (/workspaces/Dapper/node_modules/@discordjs/builders/src/components/ActionRow.ts:103:61)
at Array.map (<anonymous>)
at ActionRowBuilder.toJSON (/workspaces/Dapper/node_modules/@discordjs/builders/src/components/ActionRow.ts:103:32)
at <anonymous> (/workspaces/Dapper/node_modules/@discordjs/builders/src/interactions/modals/Modal.ts:82:61)
at Array.map (<anonymous>)
at ModalBuilder.toJSON (/workspaces/Dapper/node_modules/@discordjs/builders/src/interactions/modals/Modal.ts:82:32)
what is the common user error associated with modals? I am trying to create a simple one but I get this error.
4 Replies
Mark
Mark3y ago
code for the modal?
Will
WillOP3y ago
const modal = new ModalBuilder()
.setTitle(`Editing ${user.username}'s profile`)
.setCustomId("edit_profile_modal");
const DapScoreInput = new TextInputBuilder()
.setCustomId("dap_score_input")
.setPlaceholder("DapScore")
.setValue(""+UserGuildData.userDap || "0")
.setMinLength(1)
.setStyle(TextInputStyle.Short);

const DapsGivenInput = new TextInputBuilder()
.setCustomId("daps_given_input")
.setPlaceholder("Daps Given")
.setValue(""+UserGuildData.dapsGiven || "0")
.setMinLength(1)
.setStyle(TextInputStyle.Short);

const DapsRecievedInput = new TextInputBuilder()
.setCustomId("daps_recieved_input")
.setPlaceholder("Daps Recieved")
.setValue(""+UserGuildData.dapsRecieved || "0")
.setMinLength(1)
.setStyle(TextInputStyle.Short);

const firstActionRow = new ActionRowBuilder().addComponents(
DapScoreInput
);

const secondActionRow = new ActionRowBuilder().addComponents(
DapsGivenInput
);

const thirdActionRow = new ActionRowBuilder().addComponents(
DapsRecievedInput
);

// @ts-ignore:code
modal.addComponents(firstActionRow, secondActionRow, thirdActionRow);
await interaction.showModal(modal);
const modal = new ModalBuilder()
.setTitle(`Editing ${user.username}'s profile`)
.setCustomId("edit_profile_modal");
const DapScoreInput = new TextInputBuilder()
.setCustomId("dap_score_input")
.setPlaceholder("DapScore")
.setValue(""+UserGuildData.userDap || "0")
.setMinLength(1)
.setStyle(TextInputStyle.Short);

const DapsGivenInput = new TextInputBuilder()
.setCustomId("daps_given_input")
.setPlaceholder("Daps Given")
.setValue(""+UserGuildData.dapsGiven || "0")
.setMinLength(1)
.setStyle(TextInputStyle.Short);

const DapsRecievedInput = new TextInputBuilder()
.setCustomId("daps_recieved_input")
.setPlaceholder("Daps Recieved")
.setValue(""+UserGuildData.dapsRecieved || "0")
.setMinLength(1)
.setStyle(TextInputStyle.Short);

const firstActionRow = new ActionRowBuilder().addComponents(
DapScoreInput
);

const secondActionRow = new ActionRowBuilder().addComponents(
DapsGivenInput
);

const thirdActionRow = new ActionRowBuilder().addComponents(
DapsRecievedInput
);

// @ts-ignore:code
modal.addComponents(firstActionRow, secondActionRow, thirdActionRow);
await interaction.showModal(modal);
Mark
Mark3y ago
maybe someone else who knows more can answer, i haven't actually used v13/14/modals meguFace but having the code will help. if you catch your error and log it, you can also post that when it pops up again, it should point to the line.
Sawako
Sawako3y ago
TextInputBuilders missing .setLabel
Want results from more Discord servers?
Add your server