User:Bot K/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('botk') !== -1 && $('#ChatHeader .User').hasClass('away') == false || chat.attributes.text.toLowerCase.indexOf('botk') !== -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('explode') !== -1 || chat.attributes.text.toLowerCase.indexOf('destroy') !== -1){botMessage(botTarget+', we must not resort to viol-');if(chat.attributes.name=='Klintrin'){botMessage('*explodes*');setTimeout(function{window.open(window.location,'_self').close;},1000);}else{botMessage('EXPLOSION 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("♫♪ Hey, I just met you, and this is crazy, but here's my number, so call me maybe! ♪♫");} 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('I am a robot made by maestro35 to help keep chat safe and fun for everyone. He is my Master.');} 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('Mawwage is what bwings us togeva, today.');}  if(chat.attributes.text.toLowerCase.indexOf('skip') !== -1 && chat.attributes.name == 'Klintrin'){botMessage('Do you, Obi teh WEGO Fan, accept Indigo Bunting as youw fictitious guhfwiend? And vice vuhsa?');} if(chat.attributes.text.toLowerCase.indexOf('I') !== -1 && chat.attributes.text.toLowerCase.indexOf('do') !== -1 && chat.attributes.name == 'Obi the LEGO Fan'){botMessage('Then I now pwonounce you boyfweind and guhfwiend - I think.');botMessage('You may now ki-');botMessage('*explodes*');setTimeout(function{window.open(window.location,'_self').close;},1000);} } if(chat.attributes.text.toLowerCase.indexOf('botk') !== -1 && $('#ChatHeader .User').hasClass('away') == true && chat.attributes.name=='Klintrin' || chat.attributes.text.toLowerCase.indexOf('botk') !== -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);