Advertisement
Rashwan-

Kick command

Mar 23rd, 2020
651
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. if (command === "kick") {
  2. let modRole = message.guild.roles.find("name", "Mods");
  3. if(!message.member.roles.has(modRole.id)) {
  4. return message.reply("You pleb, you don't have the permission to use this command.").catch(console.error);
  5. }
  6. if(message.mentions.users.size === 0) {
  7. return message.reply("Please mention a user to kick").catch(console.error);
  8. }
  9. let kickMember = message.guild.member(message.mentions.users.first());
  10. if(!kickMember) {
  11. return message.reply("That user does not seem valid");
  12. }
  13. if(!message.guild.member(bot.user).hasPermission("KICK_MEMBERS")) {
  14. return message.reply("I don't have the permissions (KICK_MEMBER) to do this.").catch(console.error);
  15. }
  16. kickMember.kick().then(member => {
  17. message.reply(`${member.user.username} was succesfully kicked.`).catch(console.error);
  18. }).catch(console.error)
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement