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

139
Visualizações
Bot won't detect its own reaction even when fetching

My discord bot is supposed to remove the last reaction if a user clicks a second reaction. I tried fetching the message, reaction and reaction users. Whatever I do, if my bot was restarted after it reacted, reaction.me is always false. How can I fix this?

This is my current code:

//trying to detect a 2nd user reaction gives expected result
console.log('Reaction.me: ', reaction.me) //always false no matter how many times I click the reaction
if(user.bot) return;
if(reaction.partial) await reaction.fetch().catch(console.log)
if(reaction.message.partial) await reaction.message.fetch().catch(console.log);
await reaction.users.fetch()
await reaction.message.reactions.cache.find(r => r.emoji.name === (reaction.emoji.name === '⬆️') ? '⬇️' : '⬆️').users.fetch()
if(!reaction.me) return; //always returns early here

Note: after further testing, it seems that the client user is found in the cache, but reaction.me remains false. It does fix my problem, but I would like to understand why I have this problem with reaction.me.

about 4 years ago · Juan Pablo Isaza
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