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 toolkit11mo 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📸
LightAndy📸11mo ago
discord.js@14.12.1 v20.5.0
d.js docs
d.js docs11mo ago
property MessageContextMenuCommandInteraction#targetMessage The message this interaction was sent from
chewie 🌈
chewie 🌈11mo ago
Then call .author on that
LightAndy📸
LightAndy📸11mo ago
Sorry, but can you give me an example? :)
chewie 🌈
chewie 🌈11mo ago
There is no example to give Its literally just interaction.targetMessage.author
LightAndy📸
LightAndy📸11mo ago
oh That's it?
chewie 🌈
chewie 🌈11mo ago
Like it says above
LightAndy📸
LightAndy📸11mo ago
Damn, I'm brain dead Thanks
LightAndy📸
LightAndy📸11mo ago
Code Error:
chewie 🌈
chewie 🌈11mo ago
Use that typeguard
LightAndy📸
LightAndy📸11mo 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 🌈
chewie 🌈11mo ago
If you handle the modal in the same file, yes Otherwise I dont see how
LightAndy📸
LightAndy📸11mo 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 🌈
chewie 🌈11mo ago
Thats not really what I meant at all
d.js docs
d.js docs11mo ago
method InteractionResponses#awaitModalSubmit() Collects a single modal submit interaction that passes the filter. The Promise will reject if the time expires.
LightAndy📸
LightAndy📸11mo ago
The link's empty, nothing in that page
d.js docs
d.js docs11mo ago
method MessageContextMenuCommandInteraction#awaitModalSubmit() Collects a single modal submit interaction that passes the filter. The Promise will reject if the time expires.
LightAndy📸
LightAndy📸11mo ago
Oh thanks Thank you very much