User:StevenBot/wikia.js

/**    * Import scripts used for chat logging */   importScriptPage('User:Monchoman45/ChatHacks.js', 'c'); var logInterval = 300000; importScriptPage('User:Joeytje50/ChatLogger.js', 'runescape'); /**    * Commands for User:StevenBot *  By User:AnimatedCartoons, User:DeviantSerpent */   var send = function (m) { mainRoom.socket.send(new models.ChatEntry({ roomId: this.roomId, name: mw.config.get('wgUserName'), text: m       }).xport); },       commands = function (chat) { if (chat.attributes.name !== mw.config.get('wgUserName')) { var t = chat.attributes.text, n = chat.attributes.name; switch (true) { case t === '!hello': send('Hello there ' + n + '!'); break; case t === '!emotes': send('You can view the emoticons here.'); break; case t === '!logs': send('You can view the logs here.'); break; case t === '!test': send('I am currently up and running!'); break; case t === '!cmds': send('You can view the commands here.'); break; case t === '!site': send('You are using Wikia.com, a website dedicated to wiki farming.'); break; case t === '!tou': send('Wikias Terms of Use are located here.'); break; case t === '!rules': send('You can find the chat rules here.'); break; case t === '!mods': send('This wikis chat moderators are listed here.'); break; case t === '!fun': send('Fun you say? You may be looking for this: http://theuselessweb.com'); break; case t === '!donut': send('◯'); break; case t === '!baby': send('http://www.youtube.com/watch?v=kffacxfA7G4'); break; case t === '!swag': send('The user above me has some serious swag.'); break; case /^\!tell/.test(t): if (localStorage.getItem('cmd') !== 'on') { return; }                   var s = t.slice(8), a = s.split('~'); if (s === '') { return; }                   if (!localStorage.getItem('tell ' + a[0])) { localStorage.setItem('tell ' + a[0], a[0] + ': ' + a[1] + ', from ' + n); send('Okay! I will tell ' + a[0] + ' after his/her next message.'); } else { send(a[1] + ' already has a message sent by ' + n + '. Please wait for him/her to speak and try again.'); }                   break; case /^\!note/.test(t): if (localStorage.getItem('cmd') !== 'on') { return; }                   if (!localStorage.getItem('note ' + n)) { localStorage.setItem('note ' + n, 'Note: ' + t.slice(5)); send('Noted! I will message it to you after your next message.'); } else { send('You already have given me a note! Please try again.'); send(localStorage.getItem('note ' + n)); localStorage.removeItem('note ' + n); }                   break; case /^\!miss/.test(t): if (localStorage.getItem('cmd') !== 'on') { return; }                   if (!localStorage.getItem('miss ' + t.slice(6))) { localStorage.setItem('miss ' + t.slice(6), n); send('Okay! I will message ' + t.slice(6) + ' that you missed him/her after he/she has messaged.'); } else { var l = localStorage.getItem('miss ' + t.slice(6)), h = l.split('~'); localStorage.setItem('miss ' + t.slice(6), l + '~' + n); send('Okay! I will message ' + t.slice(6) + ' that you missed him/her, including ' + h.length + '.'); }                   break; case /^\!on/.test(t): if (!mainRoom.userMain.attributes.isModerator) { return; }                               if (localStorage.getItem('cmd') !== 'on') { localStorage.setItem('cmd', 'on'); send('Commands activated!'); } else { send('Commands are already activated!'); }                               break; case /^\!off/.test(t): if (!mainRoom.userMain.attributes.isModerator) { return; }                               if (localStorage.getItem('cmd') !== 'off') { localStorage.setItem('cmd', 'off'); send('Commands deactivated!'); } else { send('Commands are already deactivated!'); }                               break; default: if (localStorage.getItem('cmd') !== 'on') { return; }                               if (localStorage.getItem('note ' + n)) { send(localStorage.getItem('note ' + n)); localStorage.removeItem('note ' + n); }                               if (localStorage.getItem('remind ' + n)) { send(localStorage.getItem('remind ' + n)); localStorage.removeItem('remind ' + n); }                               if (localStorage.getItem('miss ' + n)) { send(n + ': ' + localStorage.getItem('miss ' + n) + ' missed you!'); localStorage.removeItem('miss ' + n); }                           }                        }                    };                    mainRoom.model.chats.bind('afteradd', commands);