discord.js ban user by id code example
Example 1: discord.js get user by id
client.users.cache.find(user => user.id === 'USER-ID')
Example 2: Discord.js ban command
if (msg.member.hasPermission("BAN_MEMBERS")) {
if (msg.members.mentions.first()) {
try {
msg.members.mentions.first().ban();
} catch {
msg.reply("I do not have permissions to ban" + msg.members.mentions.first());
}
} else {
msg.reply("You do not have permissions to ban" + msg.members.mentions.first());
}
}