User:Holo Pearl/smashing.js

/** * Commands for User:Holo_Pearl *  By User:AnimatedCartoons */ 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 === '!cake': send('The cake is simply smashing.'); break; case t === '!sweg': send('https://www.youtube.com/watch?v=_CFB4JisVks'); break; case t === '!lemons': send('All right, I&#8217;ve been thinking, when life gives you lemons, don&#8217;t make lemonade! Make life take the lemons back! Get mad! I don&#8217;t want your lemons! What am I supposed to do with these? Demand to see life&#8217;s manager! Make life rue the day it thought it could give Cave Johnson lemons! Do you know who I am? I&#8217;m the man whose gonna burn your house down - with the lemons! I&#8217;m gonna get my engineers to invent a combustible lemon that&#8217;ll burn your house down!'); 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 === '!cmds': send('You can view the smashing commands here.'); break; case t === '!site': send('You are using Wikia.com, a website dedicated to wiki farming.'); break; case t === '!tou': send('Wikia&#8217;s Terms of Use are located here.'); break; case t === '!rules': send('You can find the simply amazing chat rules here.'); break; case t === '!mods': send('This wiki&#8217;s smashing chat moderators are listed here.'); break; case t === '!admins': send('This wiki&#8217;s smashing bureaucrats and admins are listed here.'); break; case t === '!fun': send('Smashing you say? You may be looking for this: http://theuselessweb.com'); break; case t === '!donut': send('Blargh.'); break; case t === '!baby': send('http://www.youtube.com/watch?v=kffacxfA7G4'); break; case t === '!swag': send('The user above is simply smashing.'); break; case t === '!test': send('I am currently up and smashing!'); break; case t === '!sweg': send('https://www.youtube.com/watch?v=_CFB4JisVks'); break; case t === '!dead': send('Chat is indeed very smashing.'); 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);