message.createMessageComponentCollector

Collector is not collecting interactions from the message.
//Replying to the interaction.
const message = await interaction.reply({ components: [packagePanel.toJSON()], flags: [MessageFlags.IsComponentsV2, MessageFlags.Ephemeral, MessageFlags.withResponse] })

//Creating a collector.
const collector = await message.createMessageComponentCollector({
ComponentType: ComponentType.StringSelectMenuBuilder
})

//Starting collector.
collector.on('collect', async i => {
console.log(`A`)
}
//Replying to the interaction.
const message = await interaction.reply({ components: [packagePanel.toJSON()], flags: [MessageFlags.IsComponentsV2, MessageFlags.Ephemeral, MessageFlags.withResponse] })

//Creating a collector.
const collector = await message.createMessageComponentCollector({
ComponentType: ComponentType.StringSelectMenuBuilder
})

//Starting collector.
collector.on('collect', async i => {
console.log(`A`)
}
For example when selecting one of the options from the select menu on the message it will not trigger the console to log A. No errors. Nothin
5 Replies
d.js toolkit
d.js toolkit5mo ago
duck
duck5mo ago
withResponse isn't a message flag, but rather its own interaction reply option alongside components and flags furthermore with withResponse: true, interaction.reply() will resolve in an InteractionCallbackResponse, not the Message, so you'd need to access <InteractionCallbackResponse>.resource.message
d.js docs
d.js docs5mo ago
:method: ChatInputCommandInteraction#reply() discord.js@14.21.0 Creates a reply to this interaction. Use the withResponse option to get the interaction callback response.
// Reply to the interaction and fetch the response
interaction.reply({ content: 'Pong!', withResponse: true })
.then((response) => console.log(`Reply sent with content ${response.resource.message.content}`))
.catch(console.error);
// Reply to the interaction and fetch the response
interaction.reply({ content: 'Pong!', withResponse: true })
.then((response) => console.log(`Reply sent with content ${response.resource.message.content}`))
.catch(console.error);
GhostBear9
GhostBear9OP5mo ago
Thank you so much it works now! No idea that was a thing but now I know.
d.js toolkit
d.js toolkit5mo ago
The thread owner has marked this issue as solved.

Did you find this page helpful?