Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if (command === "kick") {
  2.  
  3. if (!message.member.roles.some(r => ["17| Chairman", "16| Vice Chairman", "15| Chief Executive Officers", "13| Developers", "12| Chief Operating Officer", "Athina", "Paradise Bot Tester", "Bot Commander"].includes(r.name)))
  4. return message.reply("Sorry, you don't have permissions to use this! | ** Requires Bot Commander Role**");
  5.  
  6.  
  7. let member = message.mentions.members.first();
  8.  
  9. if (!member)
  10. return message.reply({
  11. embed: {
  12. color: mathforcolor,
  13. description: `Please mention a valid member of this server. :warning:`
  14. }
  15. });
  16. if (!member.kickable)
  17. return message.reply("I can't kick this user, make sure I'm a higher role than them. If this continues to show up, please use the ~bother command.");
  18.  
  19.  
  20. let reason = args.slice(1).join(' ');
  21. if (!reason)
  22. return message.reply({
  23. embed: {
  24. color: mathforcolor,
  25. description: `Please indicate a reason for the kick!`
  26. }
  27. })
  28.  
  29. .catch(error => message.reply(`Sorry ${message.author} I couldn't kick because of : ${error}`));
  30. await message.channel.send('Say `Yes` if you would like to kick this user! You have 30 seconds before this prompt will cancel.')
  31.  
  32. try {
  33. var response = await message.channel.awaitMessages(m => m.author.id = message.author.id, {
  34. max: 1,
  35. time: 30000,
  36. errors: [`time`],
  37. });
  38.  
  39. if(message.author.id !== response.author.id) return;
  40.  
  41. if (response.first().content.toLowerCase() === `yes`) {
  42. message.reply({
  43. embed: {
  44. color: mathforcolor,
  45. description: `${member.user.tag} has been kicked by ${message.author.tag} because: ${reason}`,
  46. },
  47. });
  48.  
  49. member.ban(reason);
  50. client.users.get(member.id).send(`Hello, ${member.user.tag}, you have been kicked from ${message.guild.name} because: ${reason} `).catch(error => message.reply(`Sorry ${message.author} I couldn't send a ban message to this user because of : ${error} :warning:`));
  51. } else {
  52. message.channel.send('The response was not `Yes`, cancelling')
  53. }
  54. } catch (err) {
  55. console.log(err + 'err')
  56. return message.channel.send(`There was no collected message that passed the filter within the time limit or the message was not 'yes'!`);
  57. }
  58.  
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement