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

240
Visualizações
How to detect if a user has reacted to a embedded reaction of a message in discord js and sends him a message?

I am new to Discord and Discord js and what I am trying to do here is that I wish my discord bot to detect if a user has just reacted to a emoji with that message. The emoji here is [:toolbox:]. I am using a third party bot for sending the message in the channel where the user will react with emoji and he will be assigned the role by third party bot. Once that is done I need to send a personal message to the user. Here is my code

if(reaction.msg.id == "910907568459759617"){
        console.log("Reaction detected.Sending a message to the user in dm");
        reaction.author.send("Holla Can you send me your email id ?");
    }

I am not even able to detect any changes or any click done on reaction emoji on that message. Please help.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

What you are looking for is the Message.createReactionCollector method.

You first need to declare the <Message> object that represents the message on which you'd like to create the reaction collector. One way of doing this would be through a channel ID where the message is sent, and a message ID. Like so:

const message = await (await <Client>.channels.fetch(CHANNEL_ID)).messages.fetch(MESSAGE_ID);

I'm obviously not handling any Promise rejections in these examples for simplicity's sake. You can then use the previously mentioned createReactionCollector method to expect and handle reactions on this message:

const collector = message.createReactionCollector(<ReactionCollectorOptions>);

collector.on("collect", <Reaction> => {
    //TODO
});

collector.on("end", <Collection> => {
    //TODO
});
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