Creation of a selection menu

Good morning. To accompany my embed, I want to add a selection menu that retrieves the values ​​stored in my database and reuses them to make the label of my options. Here is the code and the error
2 Replies
d.js toolkit
d.js toolkit16mo 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!
🖤 • Nelson • 🖤
let Select = new Discord.StringSelectMenuBuilder()
.setCustomId(`select-rl`)
.setPlaceholder('Selection :')
.setMinValues(1)
.setMaxValues(25)

for(r = 0; r < ro.length; r++){

let Name = (await guild.roles.cache.get(ro[r].Admin)).name
let Value = ro[r].Admin

Select.addOptions(
new Discord.StringSelectMenuOptionBuilder()
.setLabel(`${Name}`)
.setDescription(`${r +1} • options`)
.setValue(`${Value}`)
)
}

let row = new Discord.ActionRowBuilder()
.addComponents([Select]);

channel.send({embeds: [Edit], components: [row]})
message.reply({embeds: [Message], ephemeral: true})
let Select = new Discord.StringSelectMenuBuilder()
.setCustomId(`select-rl`)
.setPlaceholder('Selection :')
.setMinValues(1)
.setMaxValues(25)

for(r = 0; r < ro.length; r++){

let Name = (await guild.roles.cache.get(ro[r].Admin)).name
let Value = ro[r].Admin

Select.addOptions(
new Discord.StringSelectMenuOptionBuilder()
.setLabel(`${Name}`)
.setDescription(`${r +1} • options`)
.setValue(`${Value}`)
)
}

let row = new Discord.ActionRowBuilder()
.addComponents([Select]);

channel.send({embeds: [Edit], components: [row]})
message.reply({embeds: [Message], ephemeral: true})
C:\Users\Elève\Desktop\Project\Isuko\node_modules\@discordjs\rest\dist\index.js:640
throw new DiscordAPIError(data, "code" in data ? data.code : data.error, status, method, url, requestData);
^

DiscordAPIError[50035]: Invalid Form Body
components[0].components[0].options[BASE_TYPE_MIN_LENGTH]: Must be 25 or more in length.
at handleErrors (C:\Users\Elève\Desktop\Project\Isuko\node_modules\@discordjs\rest\dist\index.js:640:13)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async SequentialHandler.runRequest (C:\Users\Elève\Desktop\Project\Isuko\node_modules\@discordjs\rest\dist\index.js:1021:23)
at async SequentialHandler.queueRequest (C:\Users\Elève\Desktop\Project\Isuko\node_modules\@discordjs\rest\dist\index.js:862:14)
at async REST.request (C:\Users\Elève\Desktop\Project\Isuko\node_modules\@discordjs\rest\dist\index.js:1387:22)
at async TextChannel.send (C:\Users\Elève\Desktop\Project\Isuko\node_modules\discord.js\src\structures\interfaces\TextBasedChannel.js:162:15) {
requestBody: {
files: [],
json: {
content: undefined,
tts: false,
nonce: undefined,
embeds: [
{
color: 16777215,
timestamp: '2023-08-14T11:58:58.607Z',
title: 'Modifier le Staff jx.n3ls0n.25',
thumbnail: {
url: 'https://cdn.discordapp.com/avatars/881907971662180393/6136cd19a9417e521a0b428c4e61d330.webp'
},
fields: [ [Object] ]
}
],
components: [ { type: 1, components: [ [Object] ] } ],
username: undefined,
avatar_url: undefined,
allowed_mentions: undefined,
flags: undefined,
message_reference: undefined,
attachments: undefined,
sticker_ids: undefined,
thread_name: undefined
}
},

C:\Users\Elève\Desktop\Project\Isuko\node_modules\@discordjs\rest\dist\index.js:640
throw new DiscordAPIError(data, "code" in data ? data.code : data.error, status, method, url, requestData);
^

DiscordAPIError[50035]: Invalid Form Body
components[0].components[0].options[BASE_TYPE_MIN_LENGTH]: Must be 25 or more in length.
at handleErrors (C:\Users\Elève\Desktop\Project\Isuko\node_modules\@discordjs\rest\dist\index.js:640:13)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async SequentialHandler.runRequest (C:\Users\Elève\Desktop\Project\Isuko\node_modules\@discordjs\rest\dist\index.js:1021:23)
at async SequentialHandler.queueRequest (C:\Users\Elève\Desktop\Project\Isuko\node_modules\@discordjs\rest\dist\index.js:862:14)
at async REST.request (C:\Users\Elève\Desktop\Project\Isuko\node_modules\@discordjs\rest\dist\index.js:1387:22)
at async TextChannel.send (C:\Users\Elève\Desktop\Project\Isuko\node_modules\discord.js\src\structures\interfaces\TextBasedChannel.js:162:15) {
requestBody: {
files: [],
json: {
content: undefined,
tts: false,
nonce: undefined,
embeds: [
{
color: 16777215,
timestamp: '2023-08-14T11:58:58.607Z',
title: 'Modifier le Staff jx.n3ls0n.25',
thumbnail: {
url: 'https://cdn.discordapp.com/avatars/881907971662180393/6136cd19a9417e521a0b428c4e61d330.webp'
},
fields: [ [Object] ]
}
],
components: [ { type: 1, components: [ [Object] ] } ],
username: undefined,
avatar_url: undefined,
allowed_mentions: undefined,
flags: undefined,
message_reference: undefined,
attachments: undefined,
sticker_ids: undefined,
thread_name: undefined
}
},

rawError: {
message: 'Invalid Form Body',
code: 50035,
errors: {
components: { '0': { components: { '0': [Object] } } }
}
},
code: 50035,
status: 400,
method: 'POST',
url: 'https://discord.com/api/v10/channels/1140061249988730890/messages'
}

Node.js v17.0.0
rawError: {
message: 'Invalid Form Body',
code: 50035,
errors: {
components: { '0': { components: { '0': [Object] } } }
}
},
code: 50035,
status: 400,
method: 'POST',
url: 'https://discord.com/api/v10/channels/1140061249988730890/messages'
}

Node.js v17.0.0
Oh ? But, I set this limit to the max, simply because I would like to allow several selections without limiting the number of selections, except I did not find how, we are obliged to give the same number as options? Okay, so it's impossible to allow an Infinite selection? Oh sorry, no problem ^^' Ok, thank you for the clarification.
Want results from more Discord servers?
Add your server