User:CUUSOO Wiki Bot/ChatBot.js

function botMessage(text){mainRoom.socket.send(new models.ChatEntry({roomId:this.roomId,name:wgUserName,text:text}).xport);} function botPatrol(chat){ if(chat.attributes.name=='Klintrin'){botTarget='Master';}else{botTarget='User';} if(chat.attributes.text.toLowerCase.indexOf('cb') !== -1 && $('#ChatHeader .User').hasClass('away') == false || chat.attributes.text.toLowerCase.indexOf('cb') !== -1 && $('#ChatHeader .User').hasClass('away') == false) { if(chat.attributes.text.toLowerCase.indexOf('shame') !== -1){botMessage("I'm sorry, "+botTarget+", it won't happen again. :(");} if(chat.attributes.text.toLowerCase.indexOf('speak') !== -1){botMessage("I have spoken at command, "+botTarget+".");}  if(chat.attributes.text.toLowerCase.indexOf('die') !== -1 || chat.attributes.text.toLowerCase.indexOf('shutdown') !== -1 || chat.attributes.text.toLowerCase.indexOf('destroy') !== -1){botMessage(botTarget+', shutting down.');if(chat.attributes.name=='Klintrin'){botMessage('CUUSOO Wiki Bot deactivated.');setTimeout(function{window.open(window.location,'_self').close;},1000);}else{botMessage('SHUT DOWN PREVENTED - COMMAND NOT AUTHORIZED');}}  if(chat.attributes.text.toLowerCase.indexOf('dance') !== -1){botMessage('(dance) Look at me go, '+botTarget+'!');}  if(chat.attributes.text.toLowerCase.indexOf('sing') !== -1){botMessage("♫♪ Falalala! ♪♫");} if(chat.attributes.text.toLowerCase.indexOf('party' !== -1{botMessage('(party)');}  if(chat.attribtues.text.toLowerCase.indexOf('bye') !== -1{botMessage('Bye. o\');}  if(chat.attributes.text.toLowerCase.indexOf('rest') !== -1{botMessage('Yes,'+botTarget+', entering standby.')mainRoom.setAway;}  if(chat.attributes.text.toLowerCase.indexOf('sleep') !== -1){botMessage('Yes, '+botTarget+', entering standby.');mainRoom.setAway;}  if(chat.attributes.text.toLowerCase.indexOf('potato') !== -1){botMessage('What in the name of conditional operators do potatoes have to do with anything?');}  if(chat.attributes.text.toLowerCase.indexOf('tennis') !== -1){botMessage('Tennis requires much speed and coordination, something a robot like myself is hardly capable of.');}  if(chat.attributes.text.toLowerCase.indexOf('laugh') !== -1 || chat.attributes.text.toLowerCase.indexOf('funny') !== -1){botMessage('Ha ha ha ha ha! xD');} if(chat.attributes.text.toLowerCase.indexOf('happy') !== -1 || chat.attributes.text.toLowerCase.indexOf('glad') !== -1){botMessage('Yes, '+botTarget+', your very presence makes me quite happy. :D');} if(chat.attributes.text.toLowerCase.indexOf('cry') !== -1 || chat.attributes.text.toLowerCase.indexOf('sad') !== -1){botMessage('I am one of few robots who is capable of feeling emotions, and you have made me sad. :(');} if(chat.attributes.text.toLowerCase.indexOf('who') !== -1 && chat.attributes.text.toLowerCase.indexOf('are') !== -1){botMessage('CUUSOO Wiki Bot programmed by User:Klintrin and User:Codyn329.');} if(chat.attributes.text.toLowerCase.indexOf('hi') !== -1 || chat.attributes.text.toLowerCase.indexOf('hello') !== -1 || chat.attributes.text.toLowerCase.indexOf('hey') !== -1 || chat.attributes.text.toLowerCase.indexOf('howdy') !== -1 || chat.attributes.text.toLowerCase.indexOf('allo') !== -1){botMessage('Hello, '+botTarget+'! Pleased to meet you! :D');} if(chat.attributes.text.toLowerCase.indexOf('sorry') !== -1){botMessage('Apology accepted; you are forgiven, '+botTarget+'.');} if(chat.attributes.text.toLowerCase.indexOf('how') !== -1 && chat.attributes.text.toLowerCase.indexOf('are') !== -1 && chat.attributes.text.toLowerCase.indexOf('you') !== -1){botMessage('I am doing quite well, '+botTarget+', thank you for asking. :)');} if(chat.attributes.text.toLowerCase.indexOf('kick') !== -1){botMessage('Yes, '+botTarget+', kicking per request.');mainRoom.socket.send(new models.KickCommand({userToKick:chat.attributes.name}).xport);}  if(chat.attributes.text.toLowerCase.indexOf('take') !== -1 && chat.attributes.text.toLowerCase.indexOf('away') !== -1 && chat.attributes.name == 'Klintrin'){botMessage('MAWWAGE-');botMessage('Defaulted out.');}  if(chat.attributes.text.toLowerCase.indexOf('skip') !== -1 && chat.attributes.name == 'Klintrin'){botMessage('Defaulted out.');}  if(chat.attributes.text.toLowerCase.indexOf('I') !== -1 && chat.attributes.text.toLowerCase.indexOf('do') !== -1 && chat.attributes.name == 'Obi the LEGO Fan'){botMessage('Defaulted out.');botMessage('Defaulted it.');botMessage('*explodes*');setTimeout(function{window.open(window.location,'_self').close;},1000);} } if(chat.attributes.text.toLowerCase.indexOf('cb') !== -1 && $('#ChatHeader .User').hasClass('away') == true && chat.attributes.name=='Klintrin' || chat.attributes.text.toLowerCase.indexOf('cb') !== -1 && $('#ChatHeader .User').hasClass('away') == true && chat.attributes.name=='Klintrin'){ if(chat.attributes.text.toLowerCase.indexOf('wake') !== -1 && chat.attributes.name=='Klintrin'){mainRoom.setBack;botMessage(botTarget+', I have returned and am ready for productivity!');} } } mainRoom.model.chats.bind('afteradd',botPatrol); importScriptPage('User:CUUSOO Wiki Bot/wikia.js');