Select Menu Collector

I'm struggling with collecting the response from my select menu. I don't get any errors in the terminal, I only get the "Interaction has failed" message on Discord after selecting a value. This is the code:
const selectResponseMsg = await interaction.editReply({ embeds: [embed], components: [row], fetchReply: true, ephemeral: true })
const collector = selectResponseMsg.createMessageComponentCollector({ componentType: 'SELECTMENU', time: 60000 });

collector.on('collect', i => {
if (i.user.id === interaction.user.id) {
i.reply(`${i.user.id} chose ${i.customId}`);
} else {
i.reply({ content: `No.`, ephemeral: true });
}
});

collector.on('end', collected => {
console.log(`Collected ${collected.size} interactions.`);
});
const selectResponseMsg = await interaction.editReply({ embeds: [embed], components: [row], fetchReply: true, ephemeral: true })
const collector = selectResponseMsg.createMessageComponentCollector({ componentType: 'SELECTMENU', time: 60000 });

collector.on('collect', i => {
if (i.user.id === interaction.user.id) {
i.reply(`${i.user.id} chose ${i.customId}`);
} else {
i.reply({ content: `No.`, ephemeral: true });
}
});

collector.on('end', collected => {
console.log(`Collected ${collected.size} interactions.`);
});
5 Replies
d.js docs
d.js docs2y 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.
Almeida
Almeida2y ago
show how you're creating the collector
larkx
larkx2y ago
Sorry, I sent the wrong code.
const selectResponseMsg = await interaction.editReply({ embeds: [embed], components: [row], fetchReply: true, ephemeral: true })
const collector = selectResponseMsg.createMessageComponentCollector({ componentType: 'SELECTMENU', time: 60000 });

collector.on('collect', i => {
if (i.user.id === interaction.user.id) {
i.reply(`${i.user.id} chose ${i.customId}`);
} else {
i.reply({ content: `No.`, ephemeral: true });
}
});

collector.on('end', collected => {
console.log(`Collected ${collected.size} interactions.`);
});
const selectResponseMsg = await interaction.editReply({ embeds: [embed], components: [row], fetchReply: true, ephemeral: true })
const collector = selectResponseMsg.createMessageComponentCollector({ componentType: 'SELECTMENU', time: 60000 });

collector.on('collect', i => {
if (i.user.id === interaction.user.id) {
i.reply(`${i.user.id} chose ${i.customId}`);
} else {
i.reply({ content: `No.`, ephemeral: true });
}
});

collector.on('end', collected => {
console.log(`Collected ${collected.size} interactions.`);
});
Almeida
Almeida2y ago
SELECT_MENU in the componentType option
larkx
larkx2y ago
Still seem to be getting the issue