Advertisement
Slowstone72

OTHER bot

Dec 20th, 2024
22
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 1.94 KB | Software | 0 0
  1. /* Ancient code published for archival purposes. May or may not work or be relevant.
  2. Feel free to do whatever you want with this, if anything.
  3. Archive from 2017-10-07 - contents may be older. */
  4.  
  5. // MPP.chat.send('::' + localStorage.names)
  6.  
  7. MPP.client.on("a", function (msg) {
  8.     // functions //
  9.     function sendChat(text) {
  10.         MPP.chat.send(text);
  11.     }
  12.     function randNum(min, max) {
  13.         return Math.round(Math.random() * (max - min) + min);
  14.     }
  15.      
  16.     // defines //
  17.     var args = msg.a.split(" "); // split message into an array at each space
  18.     var cmd = args[0].toLowerCase(); // the first part should be the command
  19.     var input = msg.a.substring(cmd.length).trim(); // trim off everything past the command, and that's our input
  20.  
  21.     var cmdChar = ">";
  22.  
  23.     // Commands //
  24.  
  25.     if (cmd == cmdChar+"cham") {
  26.         sendChat("Cham Bot v. 1.0 type /help for help.");
  27.     }
  28.  
  29.     if (cmd == cmdChar+"dice") {
  30.         sendChat("Dice:"+randNum(1,6));
  31.     }
  32.    
  33.     if (cmd == cmdChar+"credits") {
  34.         sendChat("Special thanks to Logan And Fennece for helping me figure out how to bot. :)");
  35.     }
  36.  
  37.     if (cmd == cmdChar+"help") {
  38.         sendChat("Complete Commands: >help, >credits, >cham, >dodge.");
  39.     }
  40.  
  41.     /* if (cmd == "hello" || cmd == "hi" || cmd == "hola" || cmd == "meow" || cmd == "aye") {
  42.         sendChat("Hi there!");
  43.     } */  
  44.  
  45.     if (cmd == cmdChar +"/swag/") {
  46.         sendChat("Playing Swag.mid.");
  47.         sendChat("Error: Too little Swag :(")
  48.     }
  49.     if (cmd == cmdChar +"logan") {
  50.         sendChat("The definition of \"Meow\"");
  51.     }
  52.     if (cmd == cmdChar+"dodge") {
  53.         if (input == "") {
  54.             sendChat("Dodge: >dodge [value]");
  55.         } else {
  56.             // input less than one OR input greater than 3
  57.             if (input < 1 || input > 3) {
  58.                 sendChat("Enter a number between 1 and 3. [Dodge Failed]");
  59.             // if the above condition is false they enter it within the bounds
  60.             } else {
  61.                 if (input == randNum(1,3) ) {
  62.                     sendChat("[Dodge Succeeded]");
  63.                 }
  64.                 else {
  65.                     sendChat("[Dodge Failed]");
  66.                 }
  67.             }
  68.         }
  69.     }
  70. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement