Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

209
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!