disable select menu

I was told i cant do it but I just wanna ask here to make sure, am i able to disable an option in a select menu?
4 Replies
d.js toolkit
d.js toolkit2y ago
• What's your exact discord.js npm list discord.js and node node -v version? • Post the full error stack trace, not just the top part! • Show your code! • Explain what exactly your issue is. • Not a discord.js issue? Check out #useful-servers.
Xu Xiaolan
Xu XiaolanOP2y ago
const select = new StringSelectMenuBuilder()
.setCustomId('Team switch:')
.setPlaceholder('Select your card (30 seconds)')

// Initialize a full six slots array
let fullUserCards = new Array(6).fill(undefined);
// Fill it with the known cards
userCards.forEach(card => fullUserCards[card.slot - 1] = card);

// Now, handle each slot in the fullUserCards array
for (let i = 0; i < fullUserCards.length; i++) {
let switchName, switchSlot;
if (fullUserCards[i] === undefined) {
// Handle 'empty' slots
switchName = "Empty";
switchSlot = i + 1;
} else {
// Handle 'filled' slots
switchName = fullUserCards[i].cardName;
switchSlot = fullUserCards[i].slot;
}

select.addOptions(
{
label: `${switchName}`,
description: `Test for ${switchName} card.`,
value: `${switchSlot}`,
}
);
}


const row = new ActionRowBuilder()
.addComponents(select);
const embed = embeds;
const response = await message.reply({
embeds: [embed],
components: [row],
ephemeral: true
});
const select = new StringSelectMenuBuilder()
.setCustomId('Team switch:')
.setPlaceholder('Select your card (30 seconds)')

// Initialize a full six slots array
let fullUserCards = new Array(6).fill(undefined);
// Fill it with the known cards
userCards.forEach(card => fullUserCards[card.slot - 1] = card);

// Now, handle each slot in the fullUserCards array
for (let i = 0; i < fullUserCards.length; i++) {
let switchName, switchSlot;
if (fullUserCards[i] === undefined) {
// Handle 'empty' slots
switchName = "Empty";
switchSlot = i + 1;
} else {
// Handle 'filled' slots
switchName = fullUserCards[i].cardName;
switchSlot = fullUserCards[i].slot;
}

select.addOptions(
{
label: `${switchName}`,
description: `Test for ${switchName} card.`,
value: `${switchSlot}`,
}
);
}


const row = new ActionRowBuilder()
.addComponents(select);
const embed = embeds;
const response = await message.reply({
embeds: [embed],
components: [row],
ephemeral: true
});
im just trying to get it so that when the
switchName = "Empty";
switchName = "Empty";
it also disables that option so a user cant click only view
edocsil
edocsil2y ago
You cannot disable individual options. Only the entire component
Xu Xiaolan
Xu XiaolanOP2y ago
hmm alright, i could've sworen it was a thing, but i must've gotten it confused with that welp thanks
Want results from more Discord servers?
Add your server