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

124
Visualizações
My reaction on discord message return nothing

I try to make a bot that sends a message every morning at 9 o'clock with a possible reaction which for the moment writes me something in the console, the message on discord is sent well but the fact of clicking on l emoji does nothing, can you help me solve my problem? Here is the code:

var rule = new schedule.RecurrenceRule();
    rule.hour = 9;
    rule.minute = 0;
    rule.tz = 'Europe/Paris';
    schedule.scheduleJob(rule, async function() {
        var question = await getQuestion();
        message = await client.channels.cache.get(process.env.CHANNEL_ID).send(`**hello @everyone The wake up question.** \n${question}`)
        message.react('👍')
        const filter = (reaction, user) => {
            return (['👍'].includes(reaction.emoji.name) && user.id === message.author.id);
        };
        message.awaitReactions(filter, { max: 1, time: 60000, errors: ['time'] })
            .then(collected => {
                const reaction = collected.first();
                if (reaction.emoji.name === '👍') {
                    console.log("message")
                }
            })
    });
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Maybe you can try to use message.createReactionCollection() instead of message.awaitReactions().

Here is a code that works for me :

msg.react('❌');

const filter1 = (reaction, user) => reaction.emoji.name === '❌' && user.id === message.author.id;

const collector1 = msg.createReactionCollector(filter1, {time: 60000});
  collector1.on('collect', () => {
  msg.delete();
})

//This is a code that works for me, but in your code you don't want to filter reactions with user.id === message.author.id, as the one who will react isn't the one who sent the message

But be careful, as your message is sent automatically every day, don't check if the message author is the one who reacted : remove user.id === message.author.id

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