Is there a way to get slash command option values even after the slash command leads to a modal?

Hi! So I was told to use a collector for this, but I'm not sure how exactly it works. I was taking a look at this. The .then(): was it for after the modal submission? Is it a replacement for async execute() for the modal?
discord.js Guide
Imagine a guide... that explores the many possibilities for your discord.js bot.
11 Replies
d.js toolkit
d.js toolkit12mo 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! - Marked as resolved by staff
treble/luna
treble/luna12mo ago
modals arent message components
leguchi
leguchiOP12mo ago
node version: 18.13.0
d.js docs
d.js docs12mo ago
method ChatInputCommandInteraction#awaitModalSubmit() Collects a single modal submit interaction that passes the filter. The Promise will reject if the time expires.
leguchi
leguchiOP12mo ago
right when is the .then() taking place? I guess that's after the modal submission? Or I guess my question is: How can I get that slash command's option value after the modal submission?
treble/luna
treble/luna12mo ago
<ChatInputCommandInteraction>.options just like you would regularly you can choose to await or to use a then
darp
darp12mo ago
if function is async but you're using then - use await
leguchi
leguchiOP12mo ago
May I ask for an example, please? Is this before showModal()? How can the bot hold onto the first interaction?
treble/luna
treble/luna12mo ago
you still have access to it
leguchi
leguchiOP12mo ago
oh? how can I retrieve it? so the modal submission interaction includes the slash command interaction?
treble/luna
treble/luna12mo ago
no you call awaitModalSubmit on the interaction
Want results from more Discord servers?
Add your server