Modal Help
I have created a Context Menu Builder using Reciple (TS) with the file name
1️⃣ AddIt.ts
, I also have modals handler 2️⃣ Modals.ts
. I want to show the modal (from 1️⃣
, already did that part of code), then wait for user input and when the user submits the modal, I want the information back from 2️⃣
to the command file (1️⃣
)10 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!so, you want to show the modal, and when it is submitted, pass that onto
2️⃣
?
and then what 2️⃣
returns, you want to send back to 1️⃣
?No, when it is submitted, it passes that onto
1️⃣
. Because my MAIN problem is, that I can't access the targetMessage data in Modals.ts
(or idk how)
So the "command" (Context Menu) should do this:
1. Right click on the desired request and go to Apps and then click on the Context Menu
2. Open a modal where I add name of the request, picture of the request and a download link (Google Drive)
3. I submit and then it should send to "content-download" channel an embed containing name
, picture
and downloadLink
4. After that sends another message to "content-news" where it should say something like:
✅ Content Name Done! (link [to the "content-download" message that was send on Step 3]) (requested by [author of the message I right clicked in the first place])I can't figure out (and I'm stuck) at grabbing the author of the message I used the context menu on, because I can't access in
2️⃣ Modals.ts
(as it's not the main interaction and is a different function)
I have done getting the link for the message sent in Step 3 alreadyyou might need to pass the targetMessage to AddIt.ts
I can access targetMessage in
AddIt.ts
, just that I can't do that in Modals.ts
oh, i read it wrong then,
you might need to pass it to
Modals.ts
or store it in a databaseYh, but how can I do that?
Ooooh
That's easier for me
Thank you!
I completely forgot about databases
But if I were to pass it, how can I do so? That could help me learn some more JavaScript/TypeScript/discord.js ;)
ContextMenuCommandInteraction#awaitModalSubmit()
Collects a single modal submit interaction that passes the filter. The Promise will reject if the time expires.
Thank you! But I solved it using MongoDB