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

186
Vistas
How to solve if roles changed bot shows nickname updated
  if (!((String(oldMember.nickame)) == (String(newMember.nickname)))) {
    gwebhook.send({
      embeds: [new Discord.MessageEmbed()
      .setAuthor(newMember.guild.name, newMember.guild.iconURL({dynamic: true}))
      .setTitle('Member Nickname Update')
      .setColor("YELLOW")
      .addField('Before', String(oldMember.nickname), true)
      .addField('After', String(newMember.nickname), true)]
    });
  }

It gives logs even when role changed.

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

0

The issue here is a simple typo. First, let's simplify your code removing all of those redundant and not-so-pretty String() casts:

if (!(oldMember.nickame == newMember.nickname)) {
    gwebhook.send({
      embeds: [new Discord.MessageEmbed()
      .setAuthor(newMember.guild.name, newMember.guild.iconURL({dynamic: true}))
      .setTitle('Member Nickname Update')
      .setColor("YELLOW")
      .addField('Before', oldMember.nickname, true)
      .addField('After', newMember.nickname, true)]
    });
  }

That makes the code a lot easier to look at. And now the issue is obvious. You did oldMember.nickame instead of oldMember.nickname in your if statement. Since oldMember.nickame is undefined (as it is not an existent property of guild members due to the typo), it will always not be equal to newMember.nickname. Therefore, whenever a member is updated in any way (whether nickname change, role change, or any other member change), the code inside this if statement will always be executed. Just fix the typo and the code should work as expected:

if (oldMember.nickname != newMember.nickname)
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