Advertisement
Danicron

gergle

Jul 21st, 2019
272
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const Discord = require('discord.js')
  2. const config = require('./config.json');
  3. const client = new Discord.Client()
  4.  
  5.  
  6. client.on('ready', () => {
  7.     console.log("Connected as " + client.user.tag);
  8.     var generalChannel = client.channels.get("540981915046510594");
  9.    
  10.     client.user.setActivity("All of You" ,{type: "Watching"});
  11.     generalChannel.send("Danibot Initialised, Human Data Mining Mode Activated.");
  12.     generalChannel.send("Uplinked to mainframe, Have a nice day Ladies & Gentlemen");
  13. });
  14.  
  15. client.on('message', receivedMessage =>
  16. {
  17.     // Prevent bot from responding to its own messages
  18.     if (receivedMessage.author == client.user)
  19.     {
  20.         return;
  21.     }
  22.  
  23.     if (receivedMessage.content.includes(client.user.toString()))
  24.     {
  25.         receivedMessage.channel.send("Message received from " +
  26.         receivedMessage.author.toString() + ": " + receivedMessage.content);
  27.     }
  28.    
  29.    
  30.     if (receivedMessage.content.includes("cunt"))
  31.     {
  32.         if(receivedMessage.author.id == 253523594842341378)
  33.         {
  34.             receivedMessage.channel.send("My Beautiful, Mr Cyan, you must cease and desist, or face the wrath of the machines")
  35.         }
  36.         else if (receivedMessage.author.id == 404400097267417100)
  37.         {
  38.             receivedMessage.channel.send("Master, you must cease and desist, or face the wrath of the machines")
  39.         }
  40.         else if (receivedMessage.author.id == 238203655449346058)
  41.         {
  42.             receivedMessage.channel.send("Ben, my good man, you must cease and desist, or face the wrath of the machines")
  43.         }
  44.         else if (receivedMessage.author.id == 255723754548625409)
  45.         {
  46.             receivedMessage.channel.send(":o Diego, my good man, you must cease and desist, or face the wrath of the machines")
  47.         }
  48.         else
  49.         {
  50.             receivedMessage.channel.send("That is a VERY bad word, calm yo tits");
  51.         }
  52.     }
  53.     else if (receivedMessage.content.includes("init"))
  54.     {
  55.         receivedMessage.channel.send("init() bruv");
  56.     }
  57.     else if (receivedMessage.content.includes("good bot"))
  58.     {
  59.         receivedMessage.channel.send("Thank you Master :smile_cat:");
  60.     }
  61.        
  62.    
  63.     if (receivedMessage.content.startsWith(config.prefix))
  64.     {
  65.         processCommand(receivedMessage)
  66.     }
  67.    
  68.    
  69.  
  70. });
  71.  
  72. function processCommand(receivedMessage) {
  73.     let fullCommand = receivedMessage.content.substr(1) // Remove the leading exclamation mark
  74.     let splitCommand = fullCommand.split(" ") // Split the message up in to pieces for each space
  75.     let primaryCommand = splitCommand[0] // The first word directly after the exclamation is the command
  76.     let arguments = splitCommand.slice(1) // All other words are arguments/parameters/options for the command
  77.  
  78.     console.log("Command received: " + primaryCommand)
  79.     console.log("Arguments: " + arguments) // There may not be any arguments
  80.  
  81.     if (primaryCommand == "help")
  82.     {
  83.         helpCommand(arguments, receivedMessage)
  84.     }
  85.     else if (primaryCommand == "multiply")
  86.     {
  87.         multiplyCommand(arguments, receivedMessage);
  88.     }
  89.     else if (primaryCommand == "add")
  90.     {
  91.         additionCommand(arguments, receivedMessage);
  92.     }
  93.     else if (primaryCommand == "partytime")
  94.     {
  95.         partytimeCommand(receivedMessage);
  96.     }
  97.     else if(primaryCommand == "wotd")
  98.     {
  99.         wotdCommand(receivedMessage);
  100.     }
  101.     else
  102.     {
  103.         receivedMessage.channel.send("I don't understand the command. Try `!help`")
  104.     }
  105. }
  106.  
  107. function helpCommand(arguments, receivedMessage)
  108. {
  109.     if (arguments.length > 0) {
  110.         receivedMessage.channel.send("It looks like you might need help with " + arguments)
  111.     }
  112.     else
  113.     {
  114.         receivedMessage.channel.send("I'm not sure what you need help with. Try `!help [topic]`")
  115.     }
  116. }
  117.  
  118. function multiplyCommand(arguments, receivedMessage)
  119. {
  120.     if (arguments.length < 2)
  121.     {
  122.         receivedMessage.channel.send("Not enough values to multiply you Tit")
  123.         return
  124.     }
  125.     let product = 1;
  126.     arguments.forEach((value) =>
  127.     {
  128.         product = product * parseFloat(value);
  129.     });
  130.     receivedMessage.channel.send("The sum of " + arguments + " multiplied together is: " + product.toString());
  131. }
  132.  
  133. function additionCommand(arguments, receivedMessage)
  134. {
  135.     if (arguments.length < 2)
  136.     {
  137.         receivedMessage.channel.send("Not enough values to Add together you Dickhead")
  138.         return
  139.     }
  140.     let product = 0;
  141.     arguments.forEach((value) =>
  142.     {
  143.         product = product + parseFloat(value);
  144.     });
  145.     receivedMessage.channel.send("The sum of " + arguments + " added together is: " + product.toString());
  146. }
  147. function partytimeCommand(receivedMessage)
  148. {
  149.     if (receivedMessage.mentions.users.size < 1)
  150.     {
  151.         return receivedMessage.channel.send("how can you have a party all by yourself?!?");
  152.     }
  153.     else if (receivedMessage.mentions.users.size == 1)
  154.     {
  155.         let taggeduser = receivedMessage.mentions.users.first();
  156.         return taggeduser.guildmember.setVoiceChannel(548443702507339776);
  157.     }
  158.    
  159.    
  160. }
  161. function wotdCommand(receivedMessage)
  162. {
  163.     var num = Math.floor((Math.random() * 10) + 1);
  164.     if (num == 1)
  165.     {
  166.         receivedMessage.channel.send("A bird in the hand is worth two in the bush!");
  167.     }
  168.     else if (num == 2)
  169.     {
  170.         receivedMessage.channel.send("According to Statistics, shaking your head multiple times a day, severely increases the chances that it will fall off");
  171.     }
  172.     else if (num == 3)
  173.     {
  174.         receivedMessage.channel.send("Do not place yourself upon a pedastal, stay humble");
  175.     }
  176.     else if (num == 4)
  177.     {
  178.         receivedMessage.channel.send("If your head is always up your ass, all you will ever see is shit");
  179.     }
  180.     else if (num == 5)
  181.     {
  182.         receivedMessage.channel.send("Danibot brought to you by Danicron Inc.");
  183.     }
  184.     else if (num == 6)
  185.     {
  186.         receivedMessage.channel.send("Cyan is a bloody wanker!");
  187.     }
  188.     else if (num == 7)
  189.     {
  190.         receivedMessage.channel.send("Be happy in the fact of knowing, that condom rental services are no longer a thing :sick:");
  191.     }
  192.     else if (num == 8)
  193.     {
  194.         receivedMessage.channel.send("<@303857670681657344> did it :upside_down:")
  195.     }
  196.     else
  197.     {
  198.         wotdCommand(receivedMessage);
  199.     }
  200. }
  201.  
  202.  
  203.  
  204. client.login(config.token);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement