Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

208
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda