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

404
Views
TypeError: no se pueden leer las propiedades de undefined (leyendo 'roles')

Así que estoy haciendo un comando para patear a las personas (por supuesto) y hay una parte en la que quiero que las personas sepan si no tienen permiso o si el bot no tiene permiso para patear a la persona especificada, pero luego encontré este error cada vez que intenté ejecutar el código

const rango mencionado = miembro mencionado.roles.posición más alta; ^ TypeError: no se pueden leer las propiedades de undefined (leyendo 'roles')

Mi código completo para ese comando es:

 if (isCommand === 'kick') { const mentionedMember = message.mentions.members.first(); const mentionedRank = mentionedMember.roles.highest.position; const memberRank = message.member.roles.highest.position; const botRank = message.guild.me.roles.highest.position; var embed = new Discord.MessageEmbed() let reason = args.slice(1).join(' ') if(!reason) { reason = 'no defined reason' } if(!message.member.permissions.has('KICK_MEMBERS')) embed = embed .setDescription('You do not have the permission to kick a user!') .setColor("BLUE") message.reply({embeds: [embed]}) if(!message.guild.me.permissions.has('KICK_MEMBERS')) embed = embed .setDescription('I do not have the permission to kick a user') .setColor("BLUE") message.reply({embeds: [embed]}) if(memberRank <= mentionedRank){ embed = embed .setDescription('You cannot kick that user as they have a equal/higher rank as you') .setColor("BLUE") message.reply({embeds: [embed]}) } if(botRank <= mentionedRank){ embed = embed .setDescription('I cannot kick that user as they have a equal/higher rank than me') .setColor("BLUE") message.reply({embeds: [embed]}) } if(!args[0]){ embed = embed .setDescription('Please specify the user that you want to kick!') .setColor("BLUE") message.reply({embeds: [embed]}) } if(member){ member.kick(); let guildname = client.guilds.fetch() embed = embed .setTitle(`${mentionedMember} kicked!`) .setDescription(`${mentionedMember} was kicked from the server for ${reason}.`) .setColor("BLUE") message.reply({embeds: [embed]}) } else{ embed = embed .setDescription(`"${args[0]}" was not found`) .setColor("BLUE") message.reply({embeds: [embed]}) } }
about 4 years ago · Juan Pablo Isaza
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!