Designate Positions through reaction with Discord.Js

Asked

Viewed 179 times

-1

I’m trying to apply positions to those who reacted emote in 1 message, and it’s all working out, until the "if" part from within (when I try to separate the Emotes). With this he does not apply the scroll nor the message that I put for testing, but the messages "Correct message" and "Reacted" are working normally, showing him recognizing the message and that there was a reaction.

require('dotenv').config();

const Discord = require('discord.js');
const client = new Client({
    partials: ['MESSAGE', 'REACTION']
});

client.on('messageReactionAdd',(reaction, user) => {
    console.log("reagiu")

    const { name } = reaction.emoji; 
    const member = reaction.message.guild.members.cache.get(user.id);

        if (reaction.message.id === "803699867544453150") {
            console.log("Mensagem Correta")
            if (name === ""){
                console.log("Emote Banana")
                console.log("banana")
                member.roles.add("803708086857891899")
            }
            if (name === "grapes"){
                console.log("Emote uvas")
                member.roles.add("803707738005045269")
            }
        }
});
  • what is the value of the variable name ?

  • Mano the logic of this name is to prepare to be a "reaction" in Discord, as if it were an empty variable, and is filled when someone reacts with an emote in the message. I don’t know if my thinking is right.

1 answer

-2

Try So

app.on('messageReactionAdd', (react, user) => {         
        const member = react.message.guild.members.cache.get(user.id)
        if (reaction.message.id === "803699867544453150") {
            if (react.emoji.name === ""){
                console.log("Emote Banana")
                console.log("banana")
                member.roles.add("803708086857891899")
            }
            if (react.emoji.name === ""){
                console.log("Emote uvas")
                member.roles.add("803707738005045269")
            }
        }

Browser other questions tagged

You are not signed in. Login or sign up in order to post.