You can do this in multiple ways.
You can either check for which permissions have in order to disallow other's from kicking them (For instance, KICK_MEMBERS). That would look something like this:
let member = message.mentions.members.first();
if (member.hasPermission("KICK_MEMBERS)) return message.channel.send("That member can also kick!")
You can also check if they got a certain role which disallows them to be kicked. (Could be moderator role, could be a protected role)
//Get role by ID (Allows you to later change its name, ID will remain the same)
let modRole = message.guild.roles.get("MODROLE_ID");
if (member.role.has(modRole.id)) return message.channel.send("This member is a moderator")
//Find role by name. Means if you change the name of this, you need to change code too.
let protectedRole = message.guild.roles.find(r => r.name === "Protected from kicking")
if (member.role.has(protectedRole.id)) return message.channel.send("This member is protected")
Lastly (that I know of), you can check if they're kickable. But all that does is, say if someone above them is trying to kick them, it will do it.
So if, say an admin, is testing or something, it will just kick the user if kickable = true
if (member.kickable) {
member.kick()
} else {
message.channel.send("This member is above you!)"
}
If you just want to check if they're an actual user, throw this line in at the top:
if (!member.bot) {
//If they're a user
} else {
//If they're a bot
}
There are obviously a lot of fun things you can do with this. But these are the basics.
Hope I helped a bit, and sorry for this late response, I was pretty much just scrolling through the forum and found this unanswered question.