#MessageComponentCollector within a MessageComponentCollector
5 messages · Page 1 of 1 (latest)
• 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.
Code:
// create select menu
const select = new ActionRowBuilder<SelectMenuBuilder>().addComponents(
new SelectMenuBuilder()
.setCustomId(Date.now.toString())
.setPlaceholder("Claim a role")
.addOptions(...);
...
// create component selector
const collector = this.message.createMessageComponentCollector({ componentType: ComponentType.StringSelect });
collector.on("collect", async (interaction: SelectMenuInteraction) => {
// validate option
if (!isValid(interaction.values[0], interaction.user.id)) {
const waitListButton = new ActionRowBuilder<ButtonBuilder>()
.addComponents(
new ButtonBuilder()
.setCustomId(`${message.id}-${user.id}`)
.setLabel("Join waitlist")
.setStyle(ButtonStyle.Success)
);
const waitlistMessage = await interaction.reply({ content: "join waitlist...", ephemeral: true, components: [waitListButton] });
const waitlistCollector = waitlistMessage.createMessageComponentCollector({
componentType: ComponentType.Button,
time: 30_000,
});
waitlistCollector.on("collect", async (interaction: ButtonInteraction) => {
console.log(`<@${interaction.user.id}> joined the waitlist`);
await interaction.reply({ content: "Thank you for joining the waitlist", ephemeral: true });
});
return;
}
// handle valid selection
...
await interaction.deferUpdate();
});
The waitlist collector fails and the console.log is never called - I expect due to the original interaction already being resolved/returned
Just wonder if this sort of usecase is valid/possible, and if so, how? :)