"ValidationError: Expected a string primitive" when adding options to a StringSelectMenuBuilder

Hey, got a question: I want to add a StringSelectMenuBuilder, and for the options I have this:
const optionsSSM = choices.slice(0, 22).map(choice => ({ name: choice, value: choice }));
// ...
const component = new StringSelectMenuBuilder({
custom_id: ...,
placeholder: ...,
options: optionsSSM
});
const optionsSSM = choices.slice(0, 22).map(choice => ({ name: choice, value: choice }));
// ...
const component = new StringSelectMenuBuilder({
custom_id: ...,
placeholder: ...,
options: optionsSSM
});
choices is an Array[] but when I do this later on in my code, I get the following error:
ValidationError: Expected a string primitive
when I log my optionsSSM in the console, I get this (which in my eyes is a valid format to the StringSelectMenuBuilder class):
[
{
name: 'choice1',
value: 'choice1'
},
{
name: 'choice2',
value: 'choice2'
},
{
name: 'choice3',
value: 'choice3'
},
// And so on
]
[
{
name: 'choice1',
value: 'choice1'
},
{
name: 'choice2',
value: 'choice2'
},
{
name: 'choice3',
value: 'choice3'
},
// And so on
]
3 Replies
d.js toolkit
d.js toolkit12mo 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 OP
treble/luna
treble/luna12mo ago
string select menu options have labels, not names
b3ssel
b3sselOP12mo ago
bruh I have the docs open and I constantly read "name" instead of "label" that was an easy fix thanks for helping me out lol
Want results from more Discord servers?
Add your server