How to fetch an command interaction and extract message

I'm trying to fetch a interaction message, the resulting Message object's content key has bot's reply in it. How can I also get the user's message content
4 Replies
d.js toolkit
d.js toolkit14mo 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 OP
Ensyde
Ensyde14mo ago
From what I understand, you want to get what the user typed in while using a slash command? To do that, you will have to add a string option to your command and then get the option's content. https://discordjs.guide/slash-commands/parsing-options.html#command-options
discord.js Guide
Imagine a guide... that explores the many possibilities for your discord.js bot.
d.js docs
d.js docs14mo ago
property Message#interaction Partial data of the interaction that this message is a reply to
oddiz
oddizOP14mo ago
to be clear I'd like to get what user typed for the slash command when I fetch messages of the channel is there any way to fetch that interaction object with it's id? From what I've seen the only time I can get interaction.option is when it's fired up from client event listener. when I fetch the messages in a channel I get the Message object @Qjuh linked but message.interaction doesn't have options key, it only has id, type, commandName, user I'm adding chatgpt integration to my bot so I'd like to add previous messages to the query but way to do it seems to be without slash commands you can still see what user typed for interaction in discord UI, so i thought maybe there is a way to fetch it later via API got it, thanks for the assist ThumbsUp
Want results from more Discord servers?
Add your server