SHARE
TWEET

Untitled

a guest Oct 6th, 2019 605 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const Discord = require('discord.js');
  2. const bot = new Discord.Client();
  3. const ms = require("ms");
  4.  
  5.  
  6. const token = '';
  7.  
  8. const PREFIX = '!';
  9.  
  10.  
  11. bot.on('ready', () => {
  12.     console.log('This bot is active!');
  13. })
  14.  
  15. bot.on('message', message => {
  16.     let args = message.content.substring(PREFIX.length).split(" ");
  17.  
  18.     switch (args[0]) {
  19.         case 'mute':
  20.             var person  = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[1]));
  21.             if(!person) return  message.reply("I CANT FIND THE USER " + person)
  22.  
  23.             let mainrole = message.guild.roles.find(role => role.name === "Newbie");
  24.             let role = message.guild.roles.find(role => role.name === "mute");
  25.            
  26.  
  27.             if(!role) return message.reply("Couldn't find the mute role.")
  28.  
  29.  
  30.             let time = args[2];
  31.             if(!time){
  32.                 return message.reply("You didnt specify a time!");
  33.             }
  34.  
  35.             person.removeRole(mainrole.id)
  36.             person.addRole(role.id);
  37.  
  38.  
  39.             message.channel.send(`@${person.user.tag} has now been muted for ${ms(ms(time))}`)
  40.  
  41.             setTimeout(function(){
  42.                
  43.                 person.addRole(mainrole.id)
  44.                 person.removeRole(role.id);
  45.                 console.log(role.id)
  46.                 message.channel.send(`@${person.user.tag} has been unmuted.`)
  47.             }, ms(time));
  48.  
  49.  
  50.    
  51.         break;
  52.     }
  53.  
  54.  
  55. });
  56.  
  57.            
  58.                        
  59. bot.login(token);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top