This interaction failed (StringSelectMenuBuilder)

command.js
let rankbind_database_embed_select_menu = new StringSelectMenuBuilder()
.setCustomId('rankbinds')
.setPlaceholder('Choose the group rankbind to view.')

for (const database_group_id of guild_rankbinds_database.__v) {
const guild_rankbinds_database_group = await noblox.getGroup(database_group_id);

rankbind_database_embed_select_menu.addOptions(
new StringSelectMenuOptionBuilder()
.setLabel(guild_rankbinds_database_group.name)
.setValue(`${database_group_id}_${guild_rankbinds_database_group.name}`)
);
};

const rankbind_database_embed_action_row = new ActionRowBuilder()
.addComponents(rankbind_database_embed_select_menu);

await interaction.editReply({ content: 'Interact with the select menu.', components: [rankbind_database_embed_action_row] });
break;
let rankbind_database_embed_select_menu = new StringSelectMenuBuilder()
.setCustomId('rankbinds')
.setPlaceholder('Choose the group rankbind to view.')

for (const database_group_id of guild_rankbinds_database.__v) {
const guild_rankbinds_database_group = await noblox.getGroup(database_group_id);

rankbind_database_embed_select_menu.addOptions(
new StringSelectMenuOptionBuilder()
.setLabel(guild_rankbinds_database_group.name)
.setValue(`${database_group_id}_${guild_rankbinds_database_group.name}`)
);
};

const rankbind_database_embed_action_row = new ActionRowBuilder()
.addComponents(rankbind_database_embed_select_menu);

await interaction.editReply({ content: 'Interact with the select menu.', components: [rankbind_database_embed_action_row] });
break;
9 Replies
d.js toolkit
d.js toolkit5mo 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!
aw0k3n
aw0k3nOP5mo ago
interaction-create.js
else if (interaction.isSelectMenu()) {
const option = interaction.values[0].split('_')[0];

if (interaction.customId == 'rankbinds') {
const guild_rankbinds_database = await rankbinds_schema.findById({ _id: interaction.guild.id });

let rankbinds_database_embed = new EmbedBuilder()
.setColor('#E4D04C')

for (const database_group_id of guild_rankbinds_database.__v) {
const guild_rankbinds_database_group = await noblox.getGroup(database_group_id);

if (database_group_id == option) {
rankbinds_database_embed.setDescription(`Group Name: ${database_group_id ? guild_rankbinds_database_group.name : 'None.'}\nGroup ID: ${database_group_id ? database_group_id : 'None.'}`)

for (const rankbind of guild_rankbinds_database.rankbinds) {
if (rankbind[1].group_id == database_group_id) {
rankbinds_database_embed.addFields({ name: `Rankbind: ${rankbind[0]}`, value: `Template: ${rankbind[1].template}\nRoles: ${rankbind[1].roles.map((id) => `<@&${id}>`).join(', ')}\nPriority: ${rankbind[1].priority}\nIdentifier: ${rankbind[1].identifier ? rankbind[1].identifier : 'None.'}\nIdentifier Placement: ${rankbind[1].identifier_placement ? rankbind[1].identifier_placement : 'None.'}`, inline: true })
};
};

if (!rankbinds_database_embed.data.fields) rankbinds_database_embed.addFields({ name: 'No existing rankbinds:', value: 'There are no existing rankbinds to this guild.' });

break;
};
};

await interaction.message.edit({ embeds: [rankbinds_database_embed] });
else if (interaction.isSelectMenu()) {
const option = interaction.values[0].split('_')[0];

if (interaction.customId == 'rankbinds') {
const guild_rankbinds_database = await rankbinds_schema.findById({ _id: interaction.guild.id });

let rankbinds_database_embed = new EmbedBuilder()
.setColor('#E4D04C')

for (const database_group_id of guild_rankbinds_database.__v) {
const guild_rankbinds_database_group = await noblox.getGroup(database_group_id);

if (database_group_id == option) {
rankbinds_database_embed.setDescription(`Group Name: ${database_group_id ? guild_rankbinds_database_group.name : 'None.'}\nGroup ID: ${database_group_id ? database_group_id : 'None.'}`)

for (const rankbind of guild_rankbinds_database.rankbinds) {
if (rankbind[1].group_id == database_group_id) {
rankbinds_database_embed.addFields({ name: `Rankbind: ${rankbind[0]}`, value: `Template: ${rankbind[1].template}\nRoles: ${rankbind[1].roles.map((id) => `<@&${id}>`).join(', ')}\nPriority: ${rankbind[1].priority}\nIdentifier: ${rankbind[1].identifier ? rankbind[1].identifier : 'None.'}\nIdentifier Placement: ${rankbind[1].identifier_placement ? rankbind[1].identifier_placement : 'None.'}`, inline: true })
};
};

if (!rankbinds_database_embed.data.fields) rankbinds_database_embed.addFields({ name: 'No existing rankbinds:', value: 'There are no existing rankbinds to this guild.' });

break;
};
};

await interaction.message.edit({ embeds: [rankbinds_database_embed] });
aw0k3n
aw0k3nOP5mo ago
My problem is that when first interacting with the select menu, no errors show up.
No description
treble/luna
treble/luna5mo ago
you never reply to the interaction also isSelectMenu is outdated
aw0k3n
aw0k3nOP5mo ago
But if you were to interact with it (and wait a bit), this error happens.
No description
treble/luna
treble/luna5mo ago
use isStringSelectMenu
aw0k3n
aw0k3nOP5mo ago
Yeah, I saw that. I was going to change it after I fix this. Ah.
treble/luna
treble/luna5mo ago
as for your issue, use <Interaction>.update instead of your .edit
aw0k3n
aw0k3nOP5mo ago
Thank you. I'll also use isStringSelectMenu.
Want results from more Discord servers?
Add your server