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
- 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 staffmodals arent message components
node version: 18.13.0
ChatInputCommandInteraction#awaitModalSubmit()
Collects a single modal submit interaction that passes the filter. The Promise will reject if the time expires.
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?<ChatInputCommandInteraction>.options
just like you would regularly
you can choose to await or to use a then
if function is async but you're using
then
- use await
May I ask for an example, please?
Is this before
showModal()
?
How can the bot hold onto the first interaction?you still have access to it
oh? how can I retrieve it?
so the modal submission interaction includes the slash command interaction?
no
you call awaitModalSubmit on the interaction