Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

135
Vistas
Discord.js | Add a role with a reaction

I've been on my discord bot for several days because I encountered a problem ...

I wanted to add the possibility of having a role following a reaction.

But it doesn't work as soon as I add the line to add the role, if I remove it it works fine.

code :

bot.on("messageReactionAdd", (reaction, member) => {

    if(reaction.message.id === "894623823855493171"){

        member.roles.add('892423129345978438');
        reaction.message.channel.send(`Tu as réagi : ✅ ${member}`);

    }
       
})
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

member is actually a User. The better way to do this is to get the GuildMember from the Guild. You can use GuildMemberManager.resolve

bot.on("messageReactionAdd", (reaction, user) => {
  if(reaction.message.id === "894623823855493171"){
    const member = reaction.guild.members.resolve(user)
    member.roles.add('892423129345978438');
    reaction.message.channel.send(`Tu as réagi : ✅ ${member}`);
  }
})
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda