Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

678
Views
How can I check if a message is a reply and check the replied message content? (discord.js)

Here's my goal: Check if the message containing the command is a reply to other message If it is then check the content of the message user replied to. For example: Message 1: Hello! How are you? Message 2 (a reply to message 1): !command

Now I want my bot to check if message 2 is a reply and if it is, check and console.log contents of message 1

I'm using discord.js v13.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can use <Message>.reference to check for a reply.

For example, to check if msg2 is a reply to msg1 and log the contents of msg1:

if (msg2.type === 'REPLY' && msg2.reference.messageId === msg1.id)
  console.log(msg1.content);

If you don't have msg1 and you need to find it, you can use <Message>.fetchReference to fetch the reply.

if (msg2.type === 'REPLY') {
  const msg1 = await msg2.fetchReference();
  console.log(msg1.content);
}
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!