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

122
Views
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 answers
Answer question

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 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!