Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

680
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda