Advertisement
Guest User

Untitled

a guest
Feb 16th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.17 KB | None | 0 0
  1. if(command === "tempmute") {
  2. message.delete(2000)
  3. if(!message.member.hasPermission("MANAGE_MESSAGES")) return message.channel.send({embed: {
  4. color: Math.floor(Math.random() * 16777214) + 1,
  5. description: `${message.author} ❗ You don't have permissions.`,
  6. }});
  7.  
  8. let synexMute = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[0]));
  9. if(!synexMute) return message.channel.send({embed: {
  10. color: Math.floor(Math.random() * 16777214) + 1,
  11. description: `${message.author} Please choose a specific user.`,
  12. }});
  13.  
  14. if(!message.member.hasPermission("MANAGE_MESSAGES")) return message.channel.send({embed: {
  15. color: Math.floor(Math.random() * 16777214) + 1,
  16. description: "You can not temp-mute this person."
  17. }});
  18.  
  19. let mutetime = args[1];
  20.  
  21. if(!mutetime)
  22. return message.channel.send({embed: {
  23. color: Math.floor(Math.random() * 16777214) + 1,
  24. description: "Please add a duration for the mute.",
  25. }});
  26.  
  27. let mutereason = args.slice(2).join(' ');
  28. if(!mutereason)
  29. return message.channel.send({embed: {
  30. color: Math.floor(Math.random() * 16777214) + 1,
  31. description: "Please add a reason for the mute.",
  32. }});
  33.  
  34. let role = message.guild.roles.find(r => r.name === "MUTED");
  35. if(!role){
  36. try {
  37. role = await message.guild.createRole({
  38. name: "MUTED",
  39. color:"#000000",
  40. permissions:[]
  41. });
  42.  
  43. message.guild.channels.forEach(async (channel, id) => {
  44. await channel.overwritePermissions(role, {
  45. SEND_MESSAGES: false,
  46. CREATE_INSTANT_INVITE: true,
  47. READ_MESSAGE_HISTORY: true,
  48. SPEAK: false,
  49. SEND_TTS_MESSAGES: false,
  50. EMBED_LINKS: false,
  51. ATTACH_FILES: false,
  52. ADD_REACTIONS: false
  53. });
  54. });
  55. } catch (e) {
  56. }
  57. }
  58.  
  59. if(synexMute.roles.has(role.id)) return message.channel.send({embed: {
  60. color: Math.floor(Math.random() * 16777214) + 1,
  61. description: `${synexMute} is already muted.`,
  62. }});
  63.  
  64. await(synexMute.addRole(role));
  65. message.channel.send({embed: {
  66. color: Math.floor(Math.random() * 16777214) + 1,
  67. description: `${synexMute} has been successfuly muted for **${ms(ms(mutetime))}**`,
  68. }});
  69.  
  70. setTimeout(function(){
  71. synexMute.removeRole(role.id);
  72. }, ms(mutetime));
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement