Is there a way to use a context menu builder and then get the message's author?

I want to right click > Apps > Click on my Context Menu App > console.log the author of the message (which I use the Apps on)
20 Replies
d.js toolkit
d.js toolkit2y 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!
LightAndy
LightAndyOP2y ago
d.js docs
d.js docs2y ago
property MessageContextMenuCommandInteraction#targetMessage The message this interaction was sent from
chewie
chewie2y ago
Then call .author on that
LightAndy
LightAndyOP2y ago
Sorry, but can you give me an example? :)
chewie
chewie2y ago
There is no example to give Its literally just interaction.targetMessage.author
LightAndy
LightAndyOP2y ago
oh That's it?
chewie
chewie2y ago
Like it says above
LightAndy
LightAndyOP2y ago
Damn, I'm brain dead Thanks
LightAndy
LightAndyOP2y ago
Code Error:
chewie
chewie2y ago
Use that typeguard
LightAndy
LightAndyOP2y ago
That worked, thank you! And then is there a way to use that variable (const messageAuthor = interaction.targetMessage.author) from Adauga.ts to Modals.ts?
chewie
chewie2y ago
If you handle the modal in the same file, yes Otherwise I dont see how
LightAndy
LightAndyOP2y ago
Oh ok, thank you I added the modal handler to the Adauga.ts file as well and here is the code. Now how can I access the messageAuthor variable if I'm running another function?
chewie
chewie2y ago
Thats not really what I meant at all
d.js docs
d.js docs2y ago
method InteractionResponses#awaitModalSubmit() Collects a single modal submit interaction that passes the filter. The Promise will reject if the time expires.
LightAndy
LightAndyOP2y ago
The link's empty, nothing in that page
d.js docs
d.js docs2y ago
method MessageContextMenuCommandInteraction#awaitModalSubmit() Collects a single modal submit interaction that passes the filter. The Promise will reject if the time expires.
LightAndy
LightAndyOP2y ago
Oh thanks Thank you very much

Did you find this page helpful?