SlashCommandBuilder#addStringOption: set(Min/Max)Length is unnecessary when using setChoices

.addStringOption((options) =>
options
.setName("say")
.setDescription("greetings?")
.setMinLength(1)
.setMaxLength(100)
.setChoices(
{
name: "choice 1",
value: "hello",
},
{
name: "choice 2",
value: "hi",
},
{
name: "choice 3",
value: "hallo",
},
)
.setRequired(true),
);
.addStringOption((options) =>
options
.setName("say")
.setDescription("greetings?")
.setMinLength(1)
.setMaxLength(100)
.setChoices(
{
name: "choice 1",
value: "hello",
},
{
name: "choice 2",
value: "hi",
},
{
name: "choice 3",
value: "hallo",
},
)
.setRequired(true),
);
3 Replies
d.js toolkit
d.js toolkit17mo 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!
Lazuee
LazueeOP17mo ago
If it's really unnecessary then setMinLength and setMaxLength should be omitted when using setChoices on the typings. oooh,. setMinLength and setMaxLength validates the setChoices value length. my bad setMinLength and setMaxLength should NOT be use when using setChoices.. setMinLength and setMaxLength should be omitted on the addStringOption typings when using setChoices..
duck
duck17mo ago
to my knowledge, builders validation is for what would error when sent to discord, not just for extraneous data that would end up ignored
Want results from more Discord servers?
Add your server