How to get the previous message from a message ?
Hello!
I would like to get the previous message from a message, and create a link like
https://discord.com/channels/${interaction.guild.id}/${message.channel.id}/${message.id}
. If I can make that, I would like help, thanks!7 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 staffPrevious message as in? Like get the message it's replied to?
Oh sorry for not specifying. The previous message, like @d.js toolkit message preceding your message
Oh, you specify the
before
option in fetch with limit
1. Pass the message id in before
option of which you want the get previous message of
Like
Will return a collection I believeowh, thanks that works! ✅
Yeah, as for the url. You can just do <Message>.url to get that
good, thanks again!