Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
819
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const discord = require('discord.js');
  2. const prefix = '$';
  3. const commands = ["help", "hello", "joke", "GAMER GOD AWARD", "spam"];
  4. const client = new discord.Client();
  5.  
  6. client.on('ready', () => {
  7.     client.user.setGame('Do $help');
  8.     client.user.setStatus('online');
  9.     console.log("BOT STARTED!");
  10. });
  11.  
  12. for (i = 0; i < commands.length; i++) {
  13.     commands[i] = prefix + commands[i];
  14. }
  15. let gamergodchosen = 0;
  16.  
  17. client.on('message', (message) => {
  18.     if (message.author.bot) return;
  19.  
  20.  
  21.     if (message.content === commands[0]) {
  22.         let e = "Here is a list of commands: \n";
  23.         for (i = 0; i < commands.length; i++) {
  24.             e += (i != (commands.length - 1)) ? commands[i] + "\n" : commands[i];
  25.         }
  26.         message.reply(e);
  27.     }
  28.  
  29.  
  30.     if (message.content === commands[1]) {
  31.         message.reply('hello! :smile:');
  32.     }
  33.  
  34.  
  35.     if (message.content === commands[2]) {
  36.         let jsonjokes = require('./jokes.json');
  37.         let rn = Math.floor(Math.random() * jsonjokes.jokes.length);
  38.         message.reply(jsonjokes.jokes[rn]);
  39.     }
  40.  
  41.  
  42.     if (message.content === commands[3]) {
  43.         //You have been deemed a Gamer God
  44.         if (gamergodchosen === 0) {
  45.             message.reply("YOU HAVE BEEN DEEMED *THE GAMER GOD*! **YOU WILL ONLY SEE THIS ONCE!** :trophy:");
  46.             gamergodchosen = 1;
  47.         }
  48.     }
  49.  
  50.  
  51.     let spam = message.content.split(' ');
  52.  
  53.     if (spam[0] === commands[4] && spam[1] && spam[2]) {
  54.         let times = Number(spam[1]).toFixed(0);
  55.         if (times > 100) {
  56.             message.reply('Number is larger than 100.');
  57.             return;
  58.         }
  59.         if (times < 1) {
  60.             message.reply('Number is less than 1.');
  61.             return;
  62.         }
  63.         let msg = "";
  64.         for (i = 2; i < spam.length; i++) {
  65.             msg += spam[i];
  66.         }
  67.  
  68.         client.startTyping(message.channel);
  69.         for (i = 0; i < (times + 1); i++) {
  70.             message.channel.sendMessage(msg);
  71.         }
  72.         client.stopTyping(message.channel);
  73.     }
  74.  
  75.  
  76.  
  77. });
  78.  
  79. client.login('MzI2NTY0NzU4NjI5Mzg0MTky.DCs7mQ.Iy2qNc6_FGAeGj6THkdXULWjHKs');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement