#How can I add options to .addStringOption(option = option.setName(stringoption).setDescription(d
1 messages · Page 1 of 1 (latest)
Select box?
can you add select boxes to slash commands?
I tried
.addOptions(["opt1","opt2"]) but I got this error
ZodError: [
{
"code": "invalid_type",
"expected": "array",
"received": "string",
"path": [
0
],
"message": "Expected array, received string"
},
{
"code": "invalid_type",
"expected": "array",
"received": "string",
"path": [
1
],
"message": "Expected array, received string"
},
{
"code": "invalid_type",
"expected": "array",
"received": "string",
"path": [
2
],
"message": "Expected array, received string"
},
{
"code": "invalid_type",
"expected": "array",
"received": "string",
"path": [
3
],
"message": "Expected array, received string"
},
{
"code": "invalid_type",
"expected": "array",
"received": "string",
"path": [
4
],
"message": "Expected array, received string"
},
{
"code": "invalid_type",
"expected": "array",
"received": "string",
"path": [
5
],
"message": "Expected array, received string"
},
{
"code": "invalid_type",
"expected": "array",
"received": "string",
"path": [
6
],
"message": "Expected array, received string"
}
]```
Oh, I got you
const { SlashCommandBuilder } = require('@discordjs/builders');
const data = new SlashCommandBuilder()
.setName('gif')
.setDescription('Sends a random gif!')
.addStringOption(option =>
option.setName('category')
.setDescription('The gif category')
.setRequired(true)
.addChoice('Funny', 'gif_funny')
.addChoice('Meme', 'gif_meme')
.addChoice('Movie', 'gif_movie'));
so are those like internal and external names?
It is an example, you need to focus on .addChoice()
yea im wondering why it takes 2 arguments
that does work when specifying 2 arguments instead of one
I think it's something similar to a selection box inside an action row
The name is what the user sees and uses. value is what you get in the back
perfect, thankyou!
AH addChoices works with an array of arrays, docs just dont say anything about it