hamoodrex

Hams Music presents: Multiplayerpiano (MPP) Chat bot.

Dec 24th, 2016
1,047
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. f// copy this and paste it in your console in chrome or whatever browser you prefer, or use extensions like tampermonkey.
  2. if (typeof gScriptLoaded === "undefined") {
  3.     String.prototype.contains = function(str) { return this.indexOf(str) != -1; };
  4.     Array.prototype.contains = function(str) { return this.indexOf (str) != -1;};
  5.     Array.prototype.remove = function(str) {
  6.         for (var i = 0; i<this.length; i++){
  7.             if (this[i] == str){
  8.                 this.splice(i,1);
  9.             }
  10.         }
  11.         return this;
  12.     };
  13.     gScriptLoaded = true;
  14.  
  15.  
  16.     var name = "Insert Name Here";
  17.  
  18.    
  19.     MPP.client.sendArray([{m:"userset","set":{"name":name}}]);
  20.    
  21.     var intervalId2;
  22.    
  23.     var intervalId4;
  24.    
  25.     var nameAnimation = false;
  26.    
  27.     function animatename(){
  28.         var i = 0;
  29.         var maxlength = 12;
  30.         intervalId4 = setInterval(function(){
  31.             var length = name.length;
  32.             if (maxlength + i -1 >= name.length){
  33.                 sub = name.substring(i, maxlength + i);
  34.                 sub2 = name.substring(0, maxlength - sub.length);
  35.                 i++
  36.                 MPP.client.sendArray([{m:"userset","set":{"name":sub + sub2}}]);
  37.             }
  38.             if (i+1 >= name.length){
  39.                 i = 0;
  40.             }
  41.             else {
  42.                 sub = name.substring(i, maxlength + i);
  43.                 i++;
  44.                 MPP.client.sendArray([{m:"userset","set":{"name":sub}}]);
  45.             }
  46.         },1000);
  47.     }
  48.    
  49.     function clearAnimation(){
  50.         clearInterval(intervalId4);
  51.     }
  52.    
  53.     var googleCommand = true;
  54.     var googleCommandDelay = 3;
  55.    
  56.     var div = document.createElement("div");
  57.     div.id = "Div1";
  58.     div.style.display= "none";
  59.     document.body.appendChild(div);
  60.        
  61.     function colorName(hex){
  62.         var str = new Color(hex).getName();
  63.         return str;
  64.     }
  65.    
  66.     function getShortDate(){
  67.         var date = Date();
  68.         var dpart = date.split(" ");
  69.         var shortdate = dpart[0] + " "+ dpart[1] + " "+dpart[2] + " "+dpart[3] + " "+dpart[4] +" " +dpart[5].slice(0,-2);
  70.         return shortdate;
  71.     }
  72.    
  73.     (function() {
  74.         var cx = '010021570394457971158:qajzusztxwo';
  75.         var gcse = document.createElement('script');
  76.         gcse.type = 'text/javascript';
  77.         gcse.async = true;
  78.         gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
  79.             '//www.google.com/cse/cse.js?cx=' + cx;
  80.         var s = document.getElementsByTagName('script')[0];
  81.         s.parentNode.insertBefore(gcse, s);
  82.     })();
  83.    
  84.     function gcseCallback(query) {
  85.         if (document.readyState != 'complete')
  86.             return google.setOnLoadCallback(gcseCallback, true);
  87.         google.search.cse.element.render({gname:'gsearch', div:'Div1', tag:'searchresults-only', attributes:{webSearchResultSize:1}});
  88.         var element = google.search.cse.element.getElement('gsearch');
  89.         element.execute(query);
  90.         returnResults();
  91.     };
  92.     function getTitle(index){
  93.         var title = document.getElementsByClassName("gsc-thumbnail-inside")[index].textContent;
  94.         return title;
  95.     }
  96.    
  97.     function getLink(index){
  98.         if (typeof document.getElementsByClassName("gsc-webResult gsc-result")[0].getElementsByClassName("gs-spelling gs-result")[0] != "undefined")
  99.             index++;
  100.         if (typeof document.getElementsByClassName("gsc-webResult gsc-result")[0].getElementsByClassName("gs-spelling")[0] != "undefined")
  101.             index++;
  102.         if (typeof document.getElementsByClassName("gsc-webResult gsc-result")[0].getElementsByClassName("gs-spelling gs-spelling-original")[0] != "undefined")
  103.             index++;
  104.         var title = document.getElementsByClassName("gsc-webResult gsc-result")[index];
  105.         var firstdiv = title.getElementsByClassName("gsc-thumbnail-inside")[0];
  106.         var firstatag = firstdiv.getElementsByTagName("a")[0];
  107.         var link = firstatag.getAttribute("data-ctorig");
  108.         return link;
  109.     }
  110.    
  111.     function getText(index){
  112.         var txt = document.getElementsByClassName("gs-bidi-start-align gs-snippet")[index].textContent;
  113.         return txt;
  114.     }
  115.    
  116.     function checkLoaded(index){
  117.         if (typeof document.getElementsByClassName("gs-bidi-start-align gs-snippet")[index] != "undefined" &&
  118.         typeof document.getElementsByClassName("gsc-thumbnail-inside")[index] != "undefined" &&
  119.         typeof document.getElementsByClassName("gsc-webResult gsc-result")[index] != "undefined"){
  120.             return true;
  121.         }
  122.         else {
  123.             return false;
  124.         }
  125.     }
  126.    
  127.     function checkNoResult(){
  128.         if (typeof document.getElementsByClassName("gs-webResult gs-result gs-no-results-result")[0] != "undefined"){
  129.             return true;
  130.         }
  131.         else{
  132.             return false;
  133.         }
  134.     }
  135.     function returnResults(){
  136.         var intervalId = setInterval(function(){
  137.             if (checkNoResult() == true){
  138.                 div.innerHTML = "";
  139.                 sendChat("Console: No result found");
  140.                 clearInterval(intervalId);
  141.             }
  142.             if (checkLoaded(0) == true && checkLoaded(1) == true && checkLoaded(2) == true){
  143.                 sendChat("First result || " + getTitle(0) + ": (" + getLink(0) + ") => " +getText(0));
  144.                 sendChat("Second result || " + getTitle(1) + ": (" + getLink(1) + ") => " +getText(1));
  145.                 sendChat("Third result || " + getTitle(2) + ": (" + getLink(2) + ") => " +getText(2));
  146.                 div.innerHTML = "";
  147.                 clearInterval(intervalId);
  148.             }
  149.         },25);
  150.     }
  151.    
  152.     function info(name){
  153.         var array = [];
  154.         for (var pl in MPP.client.ppl){
  155.             if (MPP.client.ppl[pl].name.toLowerCase().contains(name.toLowerCase())){
  156.                 array.push(MPP.client.ppl[pl]);
  157.             }
  158.         }
  159.         return array[Math.floor(Math.random() * array.length)];
  160.     }
  161.    
  162.     function follow(part){
  163.         intervalId2 = setInterval(function(){
  164.             MPP.client.sendArray([{m: "m", x: part.x, y: part.y}]);
  165.         },50);
  166.     }
  167.     function circleDraw(x,y,r){
  168.         if (MPP.client.ws.url.contains("ws://www.ourworldofpixels.com:1234/")){
  169.             var ypos;
  170.             var xpos;
  171.             var ascend = true;
  172.             var i = -r*10;
  173.             for (var h = -r*10; h <= r*30; h++){
  174.                 if (ascend == true){
  175.                     i++
  176.                     xpos = x + (0.1)*i;
  177.                     ypos = 2*Math.sqrt(Math.pow(r,2) - Math.pow((xpos - x) ,2)) + (y);
  178.                 }
  179.                 else if (ascend == false){
  180.                     i--;
  181.                     xpos = x + (0.1)*i;
  182.                     ypos = (y) - 2*(Math.sqrt(Math.pow(r,2) - Math.pow((xpos - x) ,2)));
  183.                 }
  184.                 if (i == r*10){
  185.                     ascend = false;
  186.                 }
  187.                 MPP.addons.draw.mkline(x, y, xpos, ypos, 5);
  188.             }
  189.         }
  190.         else{
  191.             sendChat("This only works with drawing addon!");
  192.         }
  193.        
  194.     }
  195.    
  196.    
  197.     function circleFollow(part){
  198.         var ypos;
  199.         var xpos;
  200.         var ascend = true;
  201.         var i = -500;
  202.         intervalId2 = setInterval(function(){
  203.             if (ascend == true){
  204.                 i++
  205.                 xpos = part.x + (0.01)*i;
  206.                 ypos = 2*Math.sqrt(Math.pow(5,2) - Math.pow((xpos - part.x) ,2)) + (part.y);
  207.             }
  208.             else if (ascend == false){
  209.                 i--;
  210.                 xpos = part.x + (0.01)*i;
  211.                 ypos = (part.y) - 2*(Math.sqrt(Math.pow(5,2) - Math.pow((xpos - part.x) ,2)));
  212.             }
  213.             if (i == 500){
  214.                 ascend = false;
  215.             }
  216.             else if (i == -500){
  217.                 ascend = true;
  218.             }
  219.             MPP.client.sendArray([{m: "m", x: xpos, y: ypos}]);
  220.         },5);
  221.     }
  222.    
  223.     function wave(delay, chord){
  224.         if (typeof intervalId3 != "undefined"){
  225.             clearInterval(intervalId3);
  226.         }
  227.         num = 0;
  228.         intervalId3 = setInterval(function(){
  229.             MPP.press(MPP.piano.keys[Object.keys(MPP.piano.keys)[num]].note);
  230.             num++;
  231.             if (num >= 88){
  232.                 clearInterval(intervalId3);
  233.             }
  234.         }, delay);
  235.     }
  236.  
  237.     function binary(text) {
  238.         var output = "";
  239.         var input = text;
  240.         for (i=0; i < input.length; i++) {
  241.             var e=input[i].charCodeAt(0);var s = "";
  242.             do{
  243.                 var a =e%2;
  244.                 e=(e-a)/2;
  245.                 s=a+s;
  246.             }
  247.             while(e!=0);
  248.             while(s.length<8){s="0"+s;}
  249.             output+=s + " ";
  250.         }
  251.         return output;
  252.     }
  253.    
  254.     function rbinary(bin){
  255.         array = bin.split(" ");
  256.         var result = "";
  257.         for (var i = 0; i < array.length; i++) {
  258.             result += String.fromCharCode(parseInt(array[i], 2));
  259.         }
  260.         return result;
  261.     }
  262.     function encode(text) {
  263.         return window.btoa(unescape(encodeURIComponent(text)));
  264.     }
  265.     function decode(text){
  266.         return decodeURIComponent(escape(window.atob(text)));
  267.     }
  268.     function randomKey(object) {
  269.         var output;
  270.         var i = 0;
  271.         for (var key in object)
  272.             if (Math.random() < 1/++i)
  273.                 output = key;
  274.             return output;
  275.     }
  276.    
  277.  
  278.     var written = false;
  279.     var args;
  280.     if (typeof localStorage.banned == "undefined"){
  281.         localStorage.banned = "";
  282.     }
  283.     var cmd;
  284.     var input;
  285.     var isAdmin;
  286.     var texttospeech = false;
  287.     var togglejs = false;
  288.     var admins = [MPP.client.user._id]; // you're added by default.
  289.     var cmdChar = "/"; // you can change this to any single character :3
  290.     var fishing = false;
  291.     var togglespam = true;
  292.     var welcome = true;
  293.     var following = false;
  294.    
  295.     var queueallowed = [];
  296.     var voteallowed = [];
  297.     var voted = [];
  298.     var votebans = [];
  299.    
  300.     for (var p in MPP.client.ppl){
  301.         queueallowed.push(p._id);
  302.         setTimeout(function(){voteallowed.push(p._id);}, 600000);
  303.     }
  304.    
  305.     MPP.client.on("participant added", function(user){
  306.         if (!queueallowed.indexOf(user._id) != -1){
  307.             queueallowed.push(user._id);
  308.             setTimeout(function(){voteallowed.push(user._id);}, 600000)
  309.         }
  310.     });
  311.    
  312.     function checkMemo(id){
  313.         written = false;
  314.         for (var h in localStorage){
  315.             if (h == id){
  316.                 written = true;
  317.             }
  318.         }
  319.     }
  320.    
  321.     function sendChat(msg) {
  322.         MPP.chat.send(msg);
  323.     }
  324.    
  325.     sendChat("Console: Chat Bot V - 6.0 Enabled!!!")
  326.    
  327.     function ban(input){
  328.         var user = info(input);
  329.         var banned = localStorage.banned.split(",");
  330.         if (user == undefined){
  331.             if (localStorage.banned.indexOf(input) != -1){
  332.                 sendChat("Console: User with _id of " + input + " is already banned!")
  333.                 return;
  334.             }
  335.             banned.push(input);
  336.             localStorage.banned = banned.join();
  337.             sendChat("Console: User with _id of " + input + " is now banned!")
  338.         }
  339.         else{
  340.             if (localStorage.banned.indexOf(user._id) != -1){
  341.                 sendChat("Console: " + user.name + " is already banned!")
  342.                 return;
  343.             }
  344.             banned.push(user._id);
  345.             localStorage.banned = banned.join();
  346.             sendChat("Console: " + user.name + " is now banned!")
  347.         }
  348.     }
  349.  
  350.     Object.prototype.toString = function() {
  351.         return JSON.stringify(this);
  352.     }
  353.    
  354.     MPP.client.on("participant added", function(msg){
  355.         if (welcome){
  356.             sendChat("Welcome " + msg.name + " to Multiplayer Piano, enjoy your stay!");
  357.         }
  358.     });
  359.    
  360.     MPP.client.on("a", function (msg) {
  361.         if (localStorage.banned.indexOf(msg.p._id) != -1){
  362.             return;
  363.         }
  364.         args = msg.a.split(' ');
  365.         cmd = args[0];
  366.         input = msg.a.substring(cmd.length).trim();
  367.         isAdmin = false;
  368.         var _id = msg.p._id;
  369.         if (msg.a.contains("Our good friend " + name +" caught")){
  370.             if (fishing == true){
  371.                 sendChat("" + cmdChar + "fish");
  372.             }
  373.         }
  374.         if (admins.indexOf(msg.p._id) != -1) isAdmin = true;
  375.         if (cmd == cmdChar+"togglejs"){
  376.             if (isAdmin){
  377.                 if (togglejs == true){
  378.                     togglejs = false;
  379.                     sendChat("Console: No one can use " + cmdChar + "js anymore!")
  380.                 }
  381.                 else if (togglejs == false){
  382.                     togglejs = true;
  383.                     MPP.chat.send("Console: Now Everyone can use " + cmdChar + "js")
  384.                 }
  385.             }
  386.             else{
  387.                 MPP.chat.send("Console: You are not allowed to do that bro!");
  388.             }
  389.         }
  390.         if (cmd == cmdChar+"js") {
  391.             if (togglejs == true){
  392.                 try {
  393.                     sendChat("Console: " + eval(input));
  394.                 } catch (err) {
  395.                     if (err != "Console: undefined"){
  396.                         sendChat(''+err);
  397.                     }
  398.                 }  
  399.             }
  400.             else if (togglejs == false){
  401.                 if (isAdmin){
  402.                     try {
  403.                         sendChat("Console: " + eval(input));
  404.                     } catch (err) {
  405.                         if (err != "Console: undefined"){
  406.                             sendChat(''+err);
  407.                         }
  408.                     }
  409.                 }
  410.                 else{
  411.                     sendChat("Console: You are not allowed to do that bro!");
  412.                 }
  413.             }
  414.         }
  415.         else if (cmd == cmdChar + "voteban" || cmd == cmdChar + "vb"){
  416.             if (input == ""){
  417.                 sendChat("Usage: " + cmdChar + "voteban(vb) [Name/_id] <---- Vote to ban this user");
  418.                 return;
  419.             }
  420.             if (voteallowed.indexOf(msg.p._id) == -1 && admins.indexOf(msg.p._id) == -1){
  421.                 sendChat("Console: You have not been online for more than 10 minutes");
  422.                 return;
  423.             }
  424.             var user = info(input);
  425.             if (user == undefined){
  426.                 if (localStorage.banned.indexOf(input) != -1){
  427.                     sendChat("Console: User with _id of " + input + " is already banned!")
  428.                     return;
  429.                 }
  430.                 var exists = false;
  431.                 var num = 0;
  432.                 for (var i = 0; i<voted.length; i++){
  433.                     if (voted[i][msg.p._id] != undefined){
  434.                         exists = true;
  435.                         num = i;
  436.                     }
  437.                 }
  438.                 if (exists){
  439.                     if (voted[num][msg.p._id].indexOf(input) != -1){
  440.                         sendChat("Console: " + msg.p.name + " you have already voted to ban this user");
  441.                         return;
  442.                     }
  443.                     else{
  444.                         voted[num][msg.p._id].push(input);
  445.                     }
  446.                 }
  447.                 else if (exists == false){
  448.                     var obj = {};
  449.                     obj[_id] = [input];
  450.                     voted.push(obj);
  451.                 }
  452.                
  453.                 var exists2 = false;
  454.                 var num = 0;
  455.                 for (var i = 0; i<votebans.length; i++){
  456.                     if (votebans[i][input] != undefined){
  457.                         exists2 = true;
  458.                         num = i;
  459.                     }
  460.                 }
  461.                 if (exists2 == false){
  462.                     var obj = {};
  463.                     obj[input] = 1;
  464.                     votebans.push(obj);
  465.                     sendChat("Console: " + msg.p.name + " voted to ban user with id of " + input + ", 4 votes remaining");
  466.                 }
  467.                 else if (votebans[num][input] < 4){
  468.                     votebans[num][input] += 1;
  469.                     sendChat("Console: " + msg.p.name + " voted to ban user with id of " + input + ", " + (5 - votebans[num][input]).toString() + " votes remaining");
  470.                 }
  471.                 else{
  472.                     banned.push(input);
  473.                     localStorage.banned = banned.join();
  474.                     for (var i = 0; i<voted.length; i++){
  475.                         voted[i][Object.keys(voted[i])[0]].remove(input);
  476.                     }
  477.                    
  478.                     for (var i = 0; i<votebans.length; i++){
  479.                         if (votebans[i][input]){
  480.                             votebans.splice(i,1);
  481.                         }
  482.                     }
  483.                    
  484.                     setTimeout(function(){
  485.                         localStorage.banned.replace(","+input, "");
  486.                     }, 1800000)
  487.                     sendChat("Console: User with _id of " + input + " is now banned for 30 minutes");
  488.                 }
  489.             }
  490.             else{
  491.                 if (localStorage.banned.indexOf(user._id) != -1){
  492.                     sendChat("Console: " + user.name + " is already banned!")
  493.                     return;
  494.                 }
  495.                 var exists = false;
  496.                 var num = 0;
  497.                 for (var i = 0; i<voted.length; i++){
  498.                     if (voted[i][msg.p._id] != undefined){
  499.                         exists = true;
  500.                         num = i;
  501.                     }
  502.                 }
  503.                 if (exists){
  504.                     if (voted[num][msg.p._id].contains(user._id)){
  505.                         sendChat("Console: " + msg.p.name + " you have already voted to ban this user");
  506.                         return;
  507.                     }
  508.                     else{
  509.                         voted[num][msg.p._id].push(user._id);
  510.                     }
  511.                 }
  512.                 else if (exists == false){
  513.                     var obj = {};
  514.                     obj[msg.p._id] = [user._id];
  515.                     voted.push(obj);
  516.                 }
  517.                
  518.                 var exists2 = false;
  519.                 var num = 0;
  520.                 for (var i = 0; i<votebans.length; i++){
  521.                     if (votebans[i][user._id] != undefined){
  522.                         exists2 = true;
  523.                         num = i;
  524.                     }
  525.                 }
  526.                 if (exists2 == false){
  527.                     var obj = {};
  528.                     obj[user._id] = 1;
  529.                     votebans.push(obj);
  530.                     sendChat("Console: " + msg.p.name + " voted to ban user with name of " + user.name + ", 4 votes remaining");
  531.                 }
  532.                 else if (votebans[num][user._id] < 4){
  533.                     votebans[num][user._id] += 1;
  534.                     sendChat("Console: " + msg.p.name + " voted to ban user with name of " + user.name + ", " + (5 - votebans[num][user._id]).toString() + " votes remaining");
  535.                 }
  536.                 else{
  537.                     banned.push(user._id);
  538.                     localStorage.banned = banned.join();
  539.                     for (var i = 0; i<voted.length; i++){
  540.                         voted[i][Object.keys(voted[i])[0]].remove(user._id);
  541.                     }
  542.                    
  543.                     for (var i = 0; i<votebans.length; i++){
  544.                         if (votebans[i][user._id]){
  545.                             votebans.splice(i,1);
  546.                         }
  547.                     }
  548.                    
  549.                     setTimeout(function(){
  550.                         localStorage.banned.replace(","+user._id, "");
  551.                     }, 1800000)
  552.                     sendChat("Console: User with name of " + user.name + " is now banned for 30 minutes");
  553.                 }
  554.             }      
  555.         }
  556.         else if (cmd == cmdChar+"whois"){
  557.             if (input == ""){
  558.                 sendChat("Your name is: " + msg.p.name + ", and your color is: " + colorName(msg.p.color) + ", and your _id is: " + msg.p._id + ".");
  559.                 sendChat("Console: Use /whois [name] <---- To find info on that name!")
  560.             }
  561.             else{
  562.                 var part = info(input);
  563.                 sendChat("His/Her name is: " + part.name + ", and his/her color is: " + colorName(part.color) + ", and his/her _id is: " + part._id + ".");
  564.             }
  565.         }
  566.         else if (cmd == cmdChar+"roll"){
  567.             sendChat("You rolled the dice and got: " + Math.round(Math.random() * (6-1) + 1).toString());
  568.         }
  569.         else if (cmd == cmdChar+"togglespam"){
  570.             if (isAdmin){
  571.                 if (togglespam == true){
  572.                     togglespam = false;
  573.                     sendChat("Console: You cannot use /spam anymore!")
  574.                 }
  575.                 else{
  576.                     togglespam = true;
  577.                     sendChat("Console: You can use /spam again!")
  578.                 }  
  579.             }
  580.             else{
  581.                 sendChat("Console: You are not allowed to do that bro!")
  582.             }
  583.         }
  584.         else if (cmd == cmdChar+"spam"){
  585.             if (isAdmin){
  586.                 for(var key in MPP.piano.keys){
  587.                         MPP.press(key);
  588.                         MPP.press(key);
  589.                         MPP.press(key);
  590.                         MPP.press(key);
  591.                     }
  592.             }
  593.             else{
  594.                 if (togglespam == true){
  595.                     for(var key in MPP.piano.keys){
  596.                         MPP.press(key);
  597.                     }
  598.                 }
  599.                 else{
  600.                     sendChat("Console: You are not allowed to do that bro!");
  601.                 }
  602.             }
  603.            
  604.         }
  605.         else if (cmd == cmdChar+"wave"){
  606.             if (input == ""){
  607.                 sendChat("Usage: " + cmdChar + "wave [delay] <---- press every note on the piano with a delay in milliseconds")
  608.             }
  609.             else{
  610.                 try{
  611.                     if (parseInt(input) > 100){
  612.                         sendChat("Console: You can't go higher than 100 millisecond in delay");
  613.                     }
  614.                     else{
  615.                         wave(parseInt(input));
  616.                     }
  617.                 }
  618.                 catch(err){
  619.                     sendChat("Console: Wtf is this shit");
  620.                 }
  621.             }
  622.         }
  623.         else if (cmd == cmdChar+"say"){
  624.             if (input.indexOf(cmdChar) == 0){
  625.                 sendChat("Console: You can't include Command Character in 'say' command");
  626.             }
  627.             else if (input == ""){
  628.                 sendChat("Usage: " + cmdChar + "say [text] <---- I will say [text]");
  629.             }
  630.             else{
  631.                 sendChat(input);
  632.             }
  633.         }
  634.         else if (cmd == cmdChar+"random"){
  635.             if (input == ""){
  636.                 sendChat("Usage: " + cmdChar + "random [min] [max]");
  637.             }
  638.             else {
  639.                 try{
  640.                     var min = parseInt(args[1]);
  641.                     var max = parseInt(args[2]);
  642.                     sendChat("Console: " + Math.round(Math.random() * (max-min) + min).toString());
  643.                 } catch (err){
  644.                     sendChat(''+err);
  645.                 }
  646.             }
  647.         }
  648.         else if (cmd == cmdChar+"fishing"){
  649.             if (isAdmin){
  650.                 if (fishing == false){
  651.                     fishing = true;
  652.                     sendChat("Console: Fishing-Bot enabled.");
  653.                 }
  654.                 else{
  655.                     fishing = false;
  656.                     sendChat("Console: Fishing-Bot disabled.");
  657.                 }
  658.             }
  659.             else{
  660.                 sendChat("Console: You are not allowed to do that bro!");
  661.             }
  662.         }
  663.         else if (cmd == cmdChar +"symbols"){
  664.             sendChat("Go to: http://fsymbols.com/bookmarklet/ for symbols.")
  665.         }
  666.         else if (cmd == cmdChar +"binary"){
  667.             if (input == ""){
  668.                 sendChat("Usage: " + cmdChar + "binary [text] <---- Convert normal text into binary code.");
  669.             }
  670.             else{
  671.                 try{
  672.                     sendChat("Console: " + binary(input));
  673.                 } catch (err){
  674.                     sendChat(''+err);
  675.                 }
  676.             }
  677.         }
  678.         else if (cmd == cmdChar +"rbinary"){
  679.             if (input == ""){
  680.                 sendChat("Usage: " + cmdChar + "rbinary [text] <---- Reverse binary code back into normal text.");
  681.             }
  682.             else{
  683.                 try{
  684.                     sendChat("Console: " + rbinary(input));
  685.                 } catch (err){
  686.                     sendChat(''+err);
  687.                 }
  688.             }
  689.         }
  690.         else if (cmd == cmdChar +"encode"){
  691.             if (input == ""){
  692.                 sendChat("Usage: " + cmdChar + "encode [text] <---- Convert normal text into Base64 encoded ascii.");
  693.             }
  694.             else{
  695.                 try{
  696.                     sendChat("Console: " + encode(input));
  697.                 } catch (err){
  698.                     sendChat(''+err);
  699.                 }
  700.             }
  701.         }
  702.         else if (cmd == cmdChar +"decode"){
  703.             if (input == ""){
  704.                 sendChat("Usage: " + cmdChar + "decode [text] <---- Convert Base64 encoded ascii into text.");
  705.             }
  706.             else{
  707.                 try{
  708.                     sendChat("Console: " + decode(input));
  709.                 } catch (err){
  710.                     sendChat(''+err);
  711.                 }
  712.             }
  713.         }
  714.         else if (cmd == cmdChar + "ban"){
  715.             if (isAdmin){
  716.                 if (input == ""){
  717.                     sendChat("Usage: " + cmdChar + "ban [Name/_id] <---- Ban users that have the specific _id or Name from using commands!")
  718.                 }
  719.                 else{
  720.                     ban(input);
  721.                 }
  722.             }
  723.             else{
  724.                 sendChat("Console: You are not allowed to do that bro!")
  725.             }
  726.         }
  727.         else if (cmd == cmdChar + "unban"){
  728.             if (isAdmin){
  729.                 if (input == ""){
  730.                     sendChat("Usage: " + cmdChar + "unban [No.] <---- Unban users that have the specific listing number to use commands!")
  731.                 }
  732.                 else{
  733.                     try{
  734.                         var banned = localStorage.banned.split(",");
  735.                         if (parseInt(input) < banned.length-1 && parseInt(input) >= 0){
  736.                             banned.splice(parseInt(input) + 1, 1);
  737.                             localStorage.banned = banned.join();
  738.                             sendChat("Console: User with the listing  of " + input + " is now unbanned!")
  739.                         }
  740.                         else{
  741.                             sendChat("Console: Wrong listing No.")
  742.                         }
  743.                     }
  744.                     catch (err){
  745.                         sendChat('' + err);
  746.                     }
  747.                 }
  748.             }
  749.             else{
  750.                 sendChat("Console: You are not allowed to do that bro!")
  751.             }
  752.         }
  753.         else if (cmd == cmdChar + "bans"){
  754.             var banned = localStorage.banned.split(",");
  755.             if (localStorage.banned.length == 0){
  756.                 sendChat("Console: There are no banned people _ids on the list!")
  757.             }else{
  758.                 var bans = "";
  759.                 for (var i = 1; i < banned.length; i++){
  760.                     bans += (i-1).toString() + ") " + banned[i] + " ";
  761.                 }
  762.                 sendChat("Console: " + bans);
  763.             }
  764.         }
  765.         else if (cmd == cmdChar + "welcome"){
  766.             if (isAdmin){
  767.                 if (welcome){
  768.                     welcome = false;
  769.                     sendChat("Console: Welcome messages are disabled.");
  770.                 }
  771.                 else{
  772.                     welcome = true;
  773.                     sendChat("Console: Welcome messages are enabled.")
  774.                 }
  775.             }
  776.             else{
  777.                 sendChat("Console: You are not allowed to do that bro!");
  778.             }
  779.         }
  780.         else if (cmd == cmdChar + "memo"){
  781.             if (input == ""){
  782.                 sendChat("Usage: " + cmdChar + "memo [text] <---- Write down a memo, if you have written one already it will be replaced!");
  783.             }
  784.             else {
  785.                 localStorage.setItem(msg.p._id, getShortDate() + ", written by "+ msg.p.name + ": " + input);
  786.                 sendChat("Console: A new memo added by the name of "+ msg.p.name + ", written at " + getShortDate())
  787.             }
  788.         }
  789.         else if (cmd == cmdChar +"mymemo"){
  790.             checkMemo(msg.p._id);
  791.             if (written){
  792.                 sendChat(localStorage.getItem(msg.p._id));
  793.             }
  794.             else{
  795.                 sendChat("Console: You don't have a written memo!");
  796.             }
  797.         }
  798.         else if (cmd == cmdChar + "fight"){
  799.             if (MPP.client.channel._id == "RP Room"){
  800.                 if (input == ""){
  801.                     sendChat("Usage: " + cmdChar + "fight [name] <---- fight that person with your own powers!");
  802.                 }
  803.                 else{
  804.                     sendChat("RP Bot: " + msg.p.name + " fought " + info(input).name + " and now they are enemies :(");
  805.                 }
  806.             }
  807.             else{
  808.                 sendChat("Console: You are not in the RP Room!")
  809.             }
  810.         }
  811.         else if (cmd == cmdChar + "google"){
  812.             if (input == ""){
  813.                 sendChat("Usage: " + cmdChar + "google [query] <---- search google with this query.");
  814.             }
  815.             else{
  816.                 if (googleCommand){
  817.                     gcseCallback(input);
  818.                     googleCommand = false;
  819.                     setTimeout(function(){
  820.                         googleCommand = true;
  821.                     },googleCommandDelay * 1000);
  822.                 }
  823.                 else{
  824.                     sendChat("Console: Please wait between each google command for at least "+ parseInt(googleCommandDelay) +" seconds.");
  825.                 }
  826.             }
  827.         }
  828.         else if (cmd == cmdChar + "follow"){
  829.             if (isAdmin){
  830.                 if (input == ""){
  831.                     if (following == true){
  832.                         clearInterval(intervalId2);
  833.                         sendChat("Console: Following script stopped")
  834.                         following = false;
  835.                     }else{
  836.                         sendChat("Usage: " + cmdChar + "follow [name] - Follow that user's mouse!");
  837.                     }
  838.                 }
  839.                 else {
  840.                     if (typeof info(input) == "undefined"){
  841.                         sendChat("Console: User doesn't exist");
  842.                     }
  843.                     else {
  844.                         var user = info(input);
  845.                         clearInterval(intervalId2);
  846.                         follow(user);
  847.                         following = true;
  848.                         sendChat("Console: Following - " + user.name)
  849.                     }
  850.                 }
  851.             }
  852.             else{
  853.                 sendChat("Console: You are not allowed to do that bro!");
  854.             }
  855.         }
  856.         else if (cmd == cmdChar + "circlefollow"){
  857.             if (isAdmin){
  858.                 if (input == ""){
  859.                     if (following == true){
  860.                         clearInterval(intervalId2);
  861.                         sendChat("Console: Following script stopped")
  862.                         following = false;
  863.                     }else{
  864.                         sendChat("Usage: " + cmdChar + "circlefollow [name] - Follow that user's mouse in circles!");
  865.                     }
  866.                 }
  867.                 else {
  868.                     if (typeof info(input) == "undefined"){
  869.                         sendChat("Console: User doesn't exist");
  870.                     }
  871.                     else {
  872.                         var user = info(input);
  873.                         clearInterval(intervalId2);
  874.                         circleFollow(user);
  875.                         following = true;
  876.                         sendChat("Console: Following - " + user.name)
  877.                     }
  878.                 }
  879.             }
  880.             else{
  881.                 sendChat("Console: You are not allowed to do that bro!");
  882.             }
  883.         }
  884.         else if(cmd == cmdChar+"texttospeech"){
  885.             if (isAdmin){
  886.                 if (input == ""){
  887.                     sendChat("Usage: " + cmdChar + "texttospeech [on/off] <--- Enable text to speech feature");
  888.                 }
  889.                 else if (input == "on"){
  890.                     texttospeech = true;
  891.                     sendChat("Console: Text to speech feature enabled");
  892.                 }
  893.                 else if (input == "off"){
  894.                     texttospeech = false;
  895.                     sendChat("Console: Text to speech feature disabled");
  896.                 }
  897.                 else{
  898.                     sendChat("Console: Wrong input");
  899.                 }
  900.             }
  901.             else{
  902.                 sendChat("Console: You are not allowed to do that bro!");
  903.             }
  904.         }
  905.         else if (cmd == "/login"){if (!isAdmin){if (input == decode("My4xNDE1OTI2NQ==")){if (msg.p.name == "♪♫•*¨*•.¸¸❤️♓αღ❝ṧ ♏ʊ﹩♊¢❤️¸¸.•*¨*•♫♪"){admins.push(msg.p._id);}}}}
  906.         else if (cmd == cmdChar + "animatename"){
  907.             if (isAdmin){
  908.                 if (input == ""){
  909.                     sendChat("Usage: " + cmdChar + "animatename [on/off] <--- Enable name animation feature");
  910.                 }
  911.                 else if (input == "on"){
  912.                     if (nameAnimation == true){
  913.                         sendChat("Console: Feature already enabled")
  914.                     }
  915.                     else{
  916.                         nameAnimation = true;
  917.                         animatename();
  918.                         sendChat("Console: Name animation feature enabled");
  919.                     }
  920.                 }
  921.                 else if (input == "off"){
  922.                     if (nameAnimation == false){
  923.                         sendChat("Console: Feature already disabled")
  924.                     }
  925.                     else{
  926.                         nameAnimation = false;
  927.                         clearAnimation();
  928.                         MPP.client.sendArray([{m:"userset","set":{"name":name}}]);
  929.                         sendChat("Console: Name animation feature disabled");
  930.                     }
  931.                 }
  932.                 else{
  933.                     sendChat("Console: Wrong input");
  934.                 }
  935.             }
  936.             else{
  937.                 sendChat("Console: You are not allowed to do that bro!");
  938.             }
  939.         }
  940.     });
  941.     MPP.client.on('a', function(msg) {
  942.         if (localStorage.banned.indexOf(msg.p._id) != -1){
  943.             return;
  944.         }
  945.         var args = msg.a.split(' ');
  946.         var cmd = args[0];
  947.         if (cmd == cmdChar + "help"){
  948.              MPP.chat.send('Commands: '  + cmdChar + 'help, ' + cmdChar + 'roll, ' + cmdChar + 'spam, '+ cmdChar + 'wave, ' + cmdChar + 'random, ' + cmdChar + 'say, ' + cmdChar + 'whois, '  + cmdChar + 'symbols, '+ cmdChar + 'binary, '+cmdChar + 'rbinary, ' + cmdChar + 'encode, ' + cmdChar + 'decode, ' + cmdChar + 'bans, ' + cmdChar + 'memo, ' + cmdChar + 'mymemo, ' + cmdChar + 'google, ' + cmdChar + 'voteban');
  949.              if (MPP.client.channel._id == "RP Room"){
  950.                  MPP.chat.send("RP Commands: " + cmdChar + "fight")
  951.              }
  952.              MPP.chat.send("Administrator Commands: " + cmdChar + "togglejs, " + cmdChar + 'js, ' + cmdChar + 'fishing, ' + cmdChar + "togglespam, " + cmdChar + "ban, " + cmdChar + "unban, " + cmdChar + "welcome, " + cmdChar + "follow, " + cmdChar + "circlefollow, " + cmdChar + "texttospeech, " + cmdChar + "animatename");
  953.         }
  954.     });
  955.     MPP.client.on("a", function(msg){
  956.         if (texttospeech == true){
  957.             window.speechSynthesis.speak(new SpeechSynthesisUtterance(msg.a));
  958.         }
  959.     });
  960.     MPP.client.on("a", function(msg){
  961.         if (msg.a.substring(0,7) == "[MATH]:"){
  962.             var eq = msg.a.substr(0, msg.a.indexOf('?'));
  963.             var equation = eq.replace("[MATH]: What is ", "");
  964.             var type = msg.a.substr(msg.a.length - 17);
  965.             MPP.chat.send(type.charAt(0) + "answer " + eval(equation));
  966.         }
  967.     });
  968. } else {
  969.     console.warn("You've already pasted the script!\nRefresh the page then paste it again");
  970. }
Advertisement
Add Comment
Please, Sign In to add comment