SHARE
TWEET

Untitled

a guest Oct 21st, 2019 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const { Client, RichEmbed } = require('discord.js');
  2. const bot = new Client();
  3. const ms = require("ms");
  4.  
  5. const token = '';
  6.  
  7. const prefix = '.';
  8.  
  9. const embed = new RichEmbed();
  10.  
  11.  
  12. bot.on('ready', () =>{
  13.     console.log('The bot is online');
  14. })
  15.  
  16. bot.on('message', msg=>{
  17.  
  18.     var args = msg.content.substring(prefix.length).split(" ");
  19.  
  20.     switch(args[0]){
  21.         case 'ping':
  22.             msg.channel.send('Pong!');
  23.             break;
  24.         case 'clear':
  25.             if(!args[1]) return msg.reply('Error, please specify a amount to clear.')
  26.             msg.channel.bulkDelete(args[1]);
  27.             break;
  28.         case 'embed':
  29.             (embed).setTitle('```Information```');
  30.             (embed).addField('User\'s Name', msg.author.username);
  31.             (embed).setColor(0xFF2D00);
  32.             (embed).addField('Server name: ', msg.guild.name);
  33.             (embed).setThumbnail(msg.author.avatarURL);
  34.             msg.channel.send(embed);
  35.             break;
  36.         case 'mute':
  37.             let person = msg.guild.member(msg.mentions.users.first() || msg.guild.members.get(args[1]))
  38.             if(!person) return msg.reply("We couldn\'t find that member in the server!");
  39.  
  40.             let mainrole = msg.guild.roles.find(role => role.name === "Community");
  41.             let muterole = msg.guild.roles.find(role => role.name === "Muted");
  42.  
  43.             if(!muterole) return msg.reply('We couldn\'t find the \"Muted\" Role!');
  44.  
  45.             let time = args[2];
  46.  
  47.             if(!time){return msg.reply('Please specify a time!');
  48.         }
  49.  
  50.         person.removeRole(mainrole.id);
  51.         person.addRole(muterole.id);
  52.  
  53.         msg.channel.send(`@${person.user.tag} has now been muted for ${ms(ms(time))}`);
  54.  
  55.         setTimeout(function(){
  56.             person.addRole(mainrole.id);
  57.             person.removeRole(muterole.id);
  58.             msg.channel.send(`${person.user.tag} got unmuted!`)
  59.         },ms(time));
  60.  
  61.  
  62.             break;
  63.  
  64.         case 'adminhelp':
  65.             if(!msg.member.hasPermission('MANAGE_ROLES')) return msg.channel.send('**You have no permission to use this command!**');
  66.             const  Embed = new RichEmbed()
  67.             .setTitle("```Admin Commands```")
  68.             .addField("**Mute**", "\nMutes a member, s = Seconds, m = Minutes = d = Days")
  69.             .addField("**Clear**", "\nClears a chat, .clear (amount).")
  70.             .setColor(0xFF0000)
  71.             msg.delete()
  72.             msg.author.send(Embed);
  73.             msg.channel.send("📩 I have sent you the help command in your dms!");
  74.             break;
  75.         case 'kill':
  76.             if(msg.mentions.users.first()){
  77.                 msg.channel.send(`Killed ${msg.mentions.users.first()}!\nhttps://gph.is/2iuipIy`);
  78.             }else{
  79.                 msg.channel.send("Please mention a member to kill :)");
  80.             }
  81.             break;
  82.         case 'say':
  83.             if(!msg.member.hasPermission(["MANAGE_MESSAGES", "ADMINISTRATOR"])) return msg.channel.send("You do not have permissions to do this!")
  84.  
  85.             let argsresult;
  86.             let mChannel = msg.mentions.channels.first()
  87.            
  88.             msg.delete()
  89.  
  90.             if(mChannel) {
  91.                 argsresult = args.slice(1).join(" ")
  92.                 mChannel.send(argsresult)
  93.             } else {
  94.                 argsresult = args.join(" ")
  95.                 mChannel.send(argsresult)
  96.             }
  97.  
  98.        
  99.  
  100.     }
  101. });
  102.  
  103. bot.on('message', msg=>{
  104.     if(msg.content === `<@${bot.user.id}>`){
  105.         msg.reply('Hey, my prefix is \".\" !');
  106.     }
  107. })
  108.  
  109.  
  110. 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