Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Aluf
- // @namespace JSBot
- // @author 3nvisi0n
- // @version 1.3.3.7
- // @description Chat bot for H0rnet.
- // @include http://m.xat.com:10049/*
- // @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.js
- // @icon https://mo-bot.googlecode.com/hg/icons/Mo-Bot.png
- // @icon64 https://mo-bot.googlecode.com/hg/icons/Mo-Bot.png
- // ==/UserScript==
- //////////////////
- //---SETTINGS---//
- //////////////////
- var cmdChar = "!"; //Character that starts all commands
- var BUFFER_TIME = 3;//How long to wait before parsing messages(so we don't parse old ones)
- window.unsafeWindow = window;
- AddMessB = unsafeWindow.AddMess;//don't change this is needed for overload
- var startTime = time(); //Used so we don't parse old messages
- var lastTab = 0;
- onload = autowelcome;
- //Function stolen from somewhere I don't remember
- String.prototype.between = function(prefix, suffix) {
- s = this;
- var i = s.indexOf(prefix);
- if (i >= 0) {
- s = s.substring(i + prefix.length);
- }
- else {
- return '';
- }
- if (suffix) {
- i = s.indexOf(suffix);
- if (i >= 0) {
- s = s.substring(0, i);
- }
- else {
- return '';
- }
- }
- return s;
- }
- //grabs the unix timestamp
- function time() {
- return Math.round((new Date()).getTime() / 1000);
- }
- var lock = new Boolean();
- //Big switch for all cmd handling
- function handleCommand(cmd,argu,id) {
- words = argu.split(" ");
- var args = argu.split(" ");
- if (id == "426474638") {
- switch(cmd.toLowerCase()) {
- //reboot
- case "reboot": reb00t(); break;
- case "botkill": shutdown(); break;
- case "test": setTimeout( function() { respond("Up and running"); },1000); break;
- case "autowelcome": autowelcome(id); break;
- case "livebtcprice": setTimeout( function() { respond("http://preev.com"); },1000); break;
- case "goto": gotoChat(argu); break;
- case "spam": setInterval( function() { sendMessage(argu); },1); break;
- case "adv": setInterval( function() { sendMessage(argu); },40000); break;
- case "kick": kick(argu,"Because H0rnet decided so."); break;
- case "ban": ban(argu,"Because H0rnet decided so.", args[1]); break;
- case "member": member(argu); break;
- case "guest": guest(argu); break;
- case "mod": mod(argu); break;
- case "unban": unban(argu); break;
- }
- }
- switch(cmd.toLowerCase()) {
- case "yell":
- case "say": setTimeout( function() { respond("["+id+"] "+ argu); },1000); break;
- case "pacmaninsult": setTimeout( function() { respond(argu + ", you eat more balls than pac man"); },1000); break;
- case "repoot": setTimeout( function() { respond("Repooted "+argu+""); },1000); break;
- case "quagmire": setTimeout( function() { respond("Giggity Giggity Goo!"); },1000); break;
- //essay
- case "essay": setTimeout( function() { respond("essaytyper.com"); },1000); break;
- //Facts
- case "funfact": setTimeout( function() { funfacts(); },1000); break;
- //8ball
- case "8ball": setTimeout( function() { eightBall(argu); },1000); break;
- //Encryptions
- case "md5": setTimeout( function() { crypto( argu, "MD5" ); },1000); break;
- case "sha1": setTimeout( function() { crypto( argu, "SHA1" ); },1000); break;
- case "sha256": setTimeout( function() { crypto( argu, "SHA256" ); },1000); break;
- case "sha384": setTimeout( function() { crypto( argu, "SHA384" ); },1000); break;
- case "sha512": setTimeout( function() { crypto( argu, "SHA512" ); },1000); break;
- case "md2": setTimeout( function() { crypto( argu, "MD2" ); },1000); break;
- //insult
- case "insult": setTimeout( function() { insult( argu ); },1000); break;
- //Time
- case "time": time(); break;
- case "date": datetime(); break;
- //locking
- case "lock":
- if(id != "426474638"){
- return;
- }
- lock = true;
- setTimeout( function() {respond("Locking H0rnetBot") },1000);
- break;
- case "unlock":
- if(id != "426474638"){
- return;
- }
- lock = false;
- setTimeout( function() { respond("Unlocking H0rnetBot"); },1000);
- break;
- }
- }
- //Overloads display function
- unsafeWindow.AddMess = function AddMess(tab, s)
- {
- {
- curTime = time();
- last = s.between("(",")");
- if(curTime >= startTime+BUFFER_TIME) { //Don't start parsing until BUFFER_TIME s has passed
- var id = tab;
- if(tab==0) id = s.between("(",")");
- lastTab = tab;
- if(s.indexOf("<B>")>=0) {
- var msg = s.between("<B>","</B>")+" ";
- if(msg.charAt(0) == cmdChar) {
- if(lock && id != "426474638") {
- return;
- }
- var cmd = msg.substring(1,msg.indexOf(" "));
- handleCommand(cmd,msg.substring(msg.indexOf(" ")+1),id);
- }
- }
- }
- }
- AddMessB(tab,s);
- }
- function autowelcome()
- {
- setTimeout( function() { sendMessage(" Bot is here!"); } ,2000);
- }
- function reb00t() {
- sendMessage("[Reboot]: Rebooting bot!");
- setTimeout(function() { history.go(-1) }, 2000);
- }
- function shutdown() {
- setTimeout( function() { sendMessage("Killing bot!"); } ,2000);
- setTimeout(function() {
- history.go(-5)
- },1000);
- }
- ////////////////////////
- //MODERATION FUCNTIONS//
- ////////////////////////
- function kick(id,reason) {
- unsafeWindow.DoMessage(id, '/k', reason);
- }
- function ban(id,reason,time) {
- unsafeWindow.DoMessage(id, '/g'+(time*3600), reason);
- }
- function guest(id) {
- unsafeWindow.DoMessage(id, '/r', '');
- }
- function member(id) {
- unsafeWindow.DoMessage(id, '/e', '');
- }
- function mod(id) {
- unsafeWindow.DoMessage(id, '/m', '');
- }
- function owner(id) {
- unsafeWindow.DoMessage(id, '/M', '');
- }
- function gotoChat(argu) {
- unsafeWindow.DoMessage('/go', argu);
- }
- //////////////////////
- //RESPONSE FUCNTIONS//
- //////////////////////
- //Responds to whereever the message came from
- //in PC/PM(mobile doesn't differentiate) responds via PC
- //from main respond to main
- function respond(message) {
- if(lastTab==0) {
- sendMessage(message);
- } else {
- sendPC(message,lastTab);
- }
- }
- //Simply sends a message to main chat
- function sendMessage(message) {
- xmlHttp2 = unsafeWindow.getHTTPObject();
- xmlHttp2.open('GET','/Post?m='+message,true);
- xmlHttp2.setRequestHeader("Content-Type", "text/plain");
- xmlHttp2.setRequestHeader("Connection", "close");
- xmlHttp2.send(null);
- }
- //Sends a message out to PC
- function sendPC(message,id) {
- xmlHttp2 = unsafeWindow.getHTTPObject();
- xmlHttp2.open('GET','/Post?u='+id+'&t='+message,true);
- xmlHttp2.setRequestHeader("Content-Type", "text/plain");
- xmlHttp2.setRequestHeader("Connection", "close");
- xmlHttp2.send(null);
- }
- function datetime() //date & time
- {
- var currentDate = new Date() //reset date
- var day = currentDate.getDate() //dd
- var month = currentDate.getMonth() + 1 //mm
- var year = currentDate.getFullYear() //yyyy
- var hr = currentDate.getHours() //hh
- var min = currentDate.getMinutes() //mm
- var sec = currentDate.getSeconds() //ss
- sendMessage( "Date: " + day + "/" + month + "/" + year + " Time: " + hr + "h:" + min + "m:" + sec +"s" );
- }
- function eightBall( argu )
- {
- var randomNumber = Math.floor( Math.random() * 4 ) + 1;
- if( randomNumber == 1 ) sendMessage( "["+ argu +"] Certainly" );
- else if( randomNumber == 2 ) sendMessage( "["+ argu +"] Yes" );
- else if( randomNumber == 3 ) sendMessage( "["+ argu +"] Yes" );
- else if( randomNumber == 4 ) sendMessage( "["+ argu +"] Yes" );
- }
- function crypto( arg, alg ) //encryption..
- {
- setTimeout( function() // unsafeWindow cannot call GM_cryptoHash()
- {
- var hashed = GM_cryptoHash( arg, alg );
- if( alg == "SHA512" ) setTimeout( function() { sendMessage( hashed ); }, 1750 );
- else if( alg == "SHA384" || alg == "SHA256" ) setTimeout( function() { sendMessage(hashed ); }, 1500 );
- else setTimeout( function() { sendMessage( hashed ); }, 1000 );
- }, 1);
- }
- function insult( argu ) //I should of used var insult= [...] but I'm too lazy, by Twin, for some annoying people.
- {
- var randomNumber = Math.floor( Math.random() * 35 ) + 1;
- if( randomNumber == 1 ) sendMessage( argu + ", get the fuck out of this chatroom, faggot." );
- else if( randomNumber == 2 ) sendMessage( argu + ", would you please shut the fuck up?" );
- else if( randomNumber == 3 ) sendMessage( argu + ", you are a retard." );
- else if( randomNumber == 4 ) sendMessage( argu + ", you are the worste skid I have ever seen." );
- else if( randomNumber == 5 ) sendMessage( argu + ", you are pathetic" );
- else if( randomNumber == 6 ) sendMessage( argu + ", since you have joined this room, our IQ have lowered by 3, I hope you are proud, and may God have mercy on you." );
- else if( randomNumber == 7 ) sendMessage( argu + ", even if you were twice as smart, you would still be stupid." );
- else if( randomNumber == 8 ) sendMessage( argu + ", fuck off." );
- else if( randomNumber == 9 ) sendMessage( argu + ", you are unwanted in this chat, please leave by clicking sign out." );
- else if( randomNumber == 11 ) sendMessage( argu + ", I would slap you, but that would be animal abuse." );
- else if( randomNumber == 12 ) sendMessage( argu + ", shock me, say something intelligent. " );
- else if( randomNumber == 13 ) sendMessage( argu + ", you are so fat that you download cheats for Wii Fit." );
- else if( randomNumber == 14 ) sendMessage( argu + ", you are the reason God created the middle finger." );
- else if( randomNumber == 15 ) sendMessage( argu + ", you are a cunt" );
- else if( randomNumber == 16 ) sendMessage( argu + ", yo momma is so poor, I saw her chasing the garbage truck with a shopping list." );
- else if( randomNumber == 17 ) sendMessage( argu + ", you are like a light switch, even a little kid can turn you on." );
- else if( randomNumber == 18 ) sendMessage( argu + ", you are a noob" );
- else if( randomNumber == 19 ) sendMessage( argu + ", insert insult here (redface)" );
- else if( randomNumber == 20 ) sendMessage( argu + ", nobody loves you" );
- else if( randomNumber == 21 ) sendMessage( argu + ", I could compare you to shit, but that would be an insult for the word shit." );
- else if( randomNumber == 22 ) sendMessage( argu + ", you are as smart as a plank" );
- else if( randomNumber == 23 ) sendMessage( argu + ", I hope a airplane crashes on you while you sleep." );
- else if( randomNumber == 24 ) sendMessage( argu + ", error is the only word I can use to define how nowhere you are." );
- else if( randomNumber == 25 ) sendMessage( argu + ", gtfo (d)" );
- else if( randomNumber == 26 ) sendMessage( argu + ", you are not cool :( " );
- else if( randomNumber == 27 ) sendMessage( argu + ", you are not smart." );
- else if( randomNumber == 28 ) sendMessage( argu + ", stfu please" );
- else if( randomNumber == 29 ) sendMessage( argu + ", you are a tool" );
- else if( randomNumber == 30 ) sendMessage( argu + ", I wish cancer on you and all your family." );
- else if( randomNumber == 31 ) sendMessage( argu + ", out of over 1,000,000 sperm, you were the fastest?" );
- else if( randomNumber == 32 ) sendMessage( argu + ", I would ask how old you are, but I know you cant count that high." );
- else if( randomNumber == 33 ) sendMessage( argu + ", you eat more balls than pac-man (xd)");
- else if( randomNumber == 34 ) sendMessage( argu + ", you eat more balls than pac-man (xd)");
- else if( randomNumber == 35 ) sendMessage( argu + ", you eat more balls than pac-man (xd)");
- }
- function funfacts() {
- var randomNumber = Math.floor( Math.random() * 20 ) + 1;
- if( randomNumber == 1 ) sendMessage("If you yelled for 8 years, 7 months and 6 days, you would have produced enough sound energy to heat one cup of coffee.");
- else if( randomNumber == 2 ) sendMessage("The strongest muscle in proportion to its size in the human body is the tongue.");
- else if( randomNumber == 3 ) sendMessage("Every time you lick a stamp, you're consuming 1/10 of a calorie.");
- else if( randomNumber == 4 ) sendMessage("The human heart creates enough pressure when it pumps out to the body to squirt blood 30 feet.");
- else if( randomNumber == 5 ) sendMessage("Banging your head against a wall uses 150 calories an hour.");
- else if( randomNumber == 6 ) sendMessage("The average person falls asleep in seven minutes.");
- else if( randomNumber == 7 ) sendMessage("Your stomach has to produce a new layer of mucus every two weeks otherwise it will digest itself");
- else if( randomNumber == 8 ) sendMessage("Humans are the only primates that don't have pigment in the palms of their hands.");
- else if( randomNumber == 9 ) sendMessage("Thirty-five percent of the people who use personal ads for dating are already married.");
- else if( randomNumber == 10 ) sendMessage("It's possible to lead a cow upstairs...but not downstairs");
- else if( randomNumber == 11 ) sendMessage("Dogs have four toes on their hind feet, and five on their front feet.");
- else if( randomNumber == 12 ) sendMessage("Butterflies taste with their feet.");
- else if( randomNumber == 13 ) sendMessage("A pregnant goldfish is called a twit.");
- else if( randomNumber == 14 ) sendMessage("A cockroach will live nine days without it's head, before it starves to death.");
- else if( randomNumber == 15 ) sendMessage("Elephants are the only mamals that can't jump.");
- else if( randomNumber == 16 ) sendMessage("A duck's quack doesn't echo, and no one knows why.");
- else if( randomNumber == 17 ) sendMessage("Snails can sleep for 3 years without eating");
- else if( randomNumber == 18 ) sendMessage("Porcupines float in water.");
- else if( randomNumber == 19 ) sendMessage("A giraffe can clean its ears with its 21-inch tongue!");
- else if( randomNumber == 20 ) sendMessage("A Saudi Arabian woman can get a divorce if her husband doesn't give her coffee.");
- }
Advertisement
Add Comment
Please, Sign In to add comment