if (message.content.startsWith('?ban')) { const user = message.mentions.users.first(); if (user) { const member = message.guild.members.resolve(user); if (member) { member .ban({ reason: 'You Banned!', }) .then(() => { message.channel.send(`${user.tag} **Successfully banned**`); }) .catch(err => { message.channel.send('bot cannot ban whoever you want'); console.error(err); }); } else { message.channel.send("he is not in server!"); } } else { message.channel.send("you don't did mention someone for ban !"); } }