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

205
Vistas
Cannot read properties of undefined (reading 'comparePositionTo'

I'm making a kick slashCommand in discord.js v13 and i was trying to compared the user roles and the target role but it doesn't work, I don't know why is that

here's my code:

If(interaction.member.highest.comparePositionTo(target.roles.highest.position > 0)) {
      const kickErr = new MessageEmbed()
        .setDescription(`You cannt kick this member because their role is higher/equal to yours.`)
        .setColor(ee.color)
      return interaction.reply({ embeds: [kickErr] })
    } else if (interaction.guild.me.roles.highest.comparePositionTo(target.roles.highest.position > 0)) {
      const kickErr2 = new MessageEmbed()
        .setDescription(`I cannot kick this member because their role is higher/equal to mine.`)
        .setColor(ee.color)
      return interaction.reply({ embeds: [kickErr2] })
    }
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

It looks like you have this error because on the first line of your code you used

if(interaction.member.highest.comparePositionTo(targ...

Instead of

if(interaction.member.roles.highest.comparePositionTo(targ...

Also, next time you post a question on stackoverflow, make sure to add the full error stack in your post to make it easier to understand

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