Get command options while doing modal

I'm making a command with multiple options and this command is showing a modal. When I get the modal, I would like to get the command options too. Is it possible? Where the date is stocked?
5 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!
Akerck ⏚
Akerck ⏚OP5mo ago
Discord.js version: discord.js@14.19.2 Node version: v20.11.0
d.js docs
d.js docs5mo ago
:method: ChatInputCommandInteraction#awaitModalSubmit() discord.js@14.21.0 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);
TÆMBØ
TÆMBØ5mo ago
Use a promisified collector so you can handle the modal submission in the same scope as the command
d.js toolkit
d.js toolkit5mo ago
The thread owner has marked this issue as solved.

Did you find this page helpful?