Help — Collector not catching ModalSubmitInteraction

Hey, I’m building a paginator and I’m using a collector for the navigation buttons. That part works fine. But I also want to use a modal (showModal) for a “go to page” feature The problem: I added isModalSubmit() handling inside the same collector, but it never fires when I submit the modal. Buttons are collected just fine, but modal submits don’t get picked up at all.
9 Replies
d.js toolkit
d.js toolkit3mo ago
Freycikkk
FreycikkkOP3mo ago
DJS: v14.22.1 NODE: v22.16.0 got the solution nvm
duck
duck3mo ago
it sounds like you're attempting to use a component collector to collect a modal submit modals aren't components, so you'd use a separate collector
d.js docs
d.js docs3mo ago
documentation suggestion for @Freycikkk: :method: ButtonInteraction#awaitModalSubmit() discord.js@14.22.1 Collects a single modal submit interaction that passes the filter. The Promise will reject if the time expires.
// Collect a modal submit interaction
const filter = (interaction) => interaction.customId === 'modal';
interaction.awaitModalSubmit({ filter, time: 15_000 })
.then(interaction => console.log(`${interaction.customId} was submitted!`))
.catch(console.error);
// Collect a modal submit interaction
const filter = (interaction) => interaction.customId === 'modal';
interaction.awaitModalSubmit({ filter, time: 15_000 })
.then(interaction => console.log(`${interaction.customId} was submitted!`))
.catch(console.error);
Freycikkk
FreycikkkOP3mo ago
now i'm using InteractionCollector
duck
duck3mo ago
then could you show your code?
Freycikkk
FreycikkkOP3mo ago
no i meant i got the solution and now i'm using InteractionCollector its working the way i wanted it to be
duck
duck3mo ago
then feel free to hit the Solved button
d.js toolkit
d.js toolkit3mo ago
The thread owner has marked this issue as solved.

Did you find this page helpful?