i need some help with this code from my friend using Discord.js. I can't quite seem to code this, what i wanted is :
When the person / member role is higher than the bot, the bot will send a message that the bot is unable to kick the member with the higher role, but when the person below the bot's role will be kicked
The error is : The bot is unable to kick all members above or below the bot's role
Any solution to this? Maybe i'm missing something
const rolepositionerror = new Discord.MessageEmbed()
.setDescription('You can\'t kick members with equal or higher position!')
.setColor("FF0000")
const targetMember = message.mentions.members.first() || message.guild.members.cache.get(args[0])
const authorHighestRole = message.member.roles.highest
const targetHighestRole = targetMember.roles.highest
if(targetHighestRole = authorHighestRole) return message.channel.send(rolepositionerror)
if(targetMember) {
targetMember.kick()
message.channel.send(userkicked)
}