const member = message.mentions.members.first()
if (!message.mentions.users.size) {
return message.channel.send('You have to mention a user to kick him!');
} else if (member === message.author) {
return message.channel.send('You can\'t kick yourself!');
} else if (!member.kickable) {
return message.channel.send('You cannot kick this user!');
} else {
return member
.kick()
.then(() => message.message.send(`${member.user.tag} was kicked.`))
.catch(error => message.message.send(`Sorry, an error occured.`))
}
I'm trying to create a code that kicks a user, but in some situations I don't want the user to be able to kick another user. One of these situations is when the user to be kicked is the same one who writes the command. The problem is that i can't do this piece of code and every time it tells me: 'You cannot kick this user!' when it should say: 'You can't kick myself'. How can i display that message when i try to kick myself? P.S. Sorry for my english, i'm italian