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 toolkit10mo 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
More Posts
Some issue with the code that doesn't allow the creation of slash command error code 400discord.js slash command ```js const { Client, GatewayIntentBits } = require('discord.js'); const c`fetchStarterMessage()` doesnt give me the first message of the threadI am trying to get the first message associated with the thread. But the message object returned frochannel.send('content'); error ponying to .sendTypeError: Cannot read properties of undefined (reading 'send') i am trying to send a message to a cChannelNotCached Error when make thread## Version discord.js - 14.12.1 node js - 18.6.0 ## Question I got an error when I try to make a thrGetting User Guild Avatar/BannerHi I'd like to know how can i get the user's avatar and banner in the current guild Currently I getGuildMember.setNickname weird issueIm using a modal for my discords verify system, where they input text and that text then becomes theMultiple Schema creation on message for level???So basically I have the leveling system and on the surface it seems to work, but there is just a fewGetting "Unknown interaction" error even with interaction.deferReply()Hey folks, I am getting a strange error with this code: ```ts class StandingsInteraction { publUnknown Interaction on awaitModalSubmit()Hi everyone, im kinda scratching my head here trying to figure out whats going on. https://pastebin.member.dmChannel.awaitMessages() breaking when updating from v14.11 to v14.12I currently have the following code which works perfectly in discord.js v14.11 however when I upgrad