Ditto-code

//

```
// Pinglist.
// Using '\\b' is a barrier: word\b would trigger on forword but not on wordgame, etc. Other regex flags work on this.
// Don't forget to double-slash, since single slashes in JS break things.
var PING\_LIST = [
 "Ditto",
 "Alex(?:2|)",
 "\\Ditto Creeper Bot\\d",
 "(?:p)(?:i)(?:n)(?:g)4",
 "Mohammad(?:2|)",
 "Orion(?:2|)",
 "Titan(?:2|)"
];

// Ping sound.
// Needs to be a valid URL to an .ogg file.
var PING\_SOUND = 'https://dl.dropboxusercontent.com/s/hutnj03xg47tvr1/pingas.mp3';

// Ping color.
// Needs to be a valid HTML color code.
var PING\_COLOR = "purple";

// Ask our end-user if we want notifications for the script.
Notification.requestPermission();

// Function itself.
$(function() {
 if (mw.config.get('wgCanonicalSpecialPageName') == 'Chat') {
 console.log("Pingchecking activated!");
 $('.Chat').on('DOMNodeInserted', function(e) {
 var msg = $.parseHTML(e.target.innerHTML)[7];
 var mee = $(".User .username").html();
 var mid = e.target.id;
 var usr = e.target.getAttribute('data-user');
 if (usr == mee) return;
 if (msg !== void 0) {
 for (var i = 0; i < PING\_LIST.length; i++) {
 if (new RegExp(PING\_LIST[i], "mi").test(msg.innerHTML) === true) {
 // Play the sound.
 $('<audio>', {
 id: 'ping',
 src: PING\_SOUND,
 autoplay: true
 }).appendTo('body');

 // Display desktop notifications.
 if (Notification.permission === 'granted') {
 }

 // Change the look of the triggered message.
 $("#" + mid + " .message").html("<span style=\"color:" + PING\_COLOR + " !important; font-weight:bold !important; text-shadow:0px 0px 10px " + PING\_COLOR + " !important;\">" + msg.innerHTML + "<\/span>");
 break;
 }
 }
 // Terminate the sound.
 setTimeout(function() {
 if ($('#ping').length) $('#ping').remove();
 }, 1000);
 }
 });
 }
});

/\*\* Chat Slash Commands \*\*/
//@author-Shining
$('[name="message"]').keypress(function (e) {
 if (e.which == 32 || e.which == 13) {
 switch (this.value) {
 case '/refresh':
 this.value = 'Read this: https://en.wikipedia.org/wiki/Wikipedia:REFRESH';
 break;
 case '/blocks':
 this.value = wgSiteName + ' chat is not the place to discuss blocks/bans on this or another wiki. Also, please read this if you have any problems: [[Special:Contact/blocked]]';
 break;
 case '/crules':
 this.value = 'Please read the [[Project:Chatroom Policy|chatroom rules]].';
 break;
 case '/change':
 this.value = 'If you would like to request that your account be renamed please see [[Help:Changing your username]]';
 break;
 case '/greet':
 this.value = 'Hello and welcome to ' + wgSiteName + ' chat!';
 break;
 case '/logs':
 this.value = 'You can view the logs [[Project:Chat/Logs|here]].';
 break;
 case '/emotes':
 this.value = 'You can view the emoticons [[MediaWiki:Emoticons|here]].';
 break;
 case '/rules':
 this.value = 'You can read the Wikia\'s rules [[Steven\_Universe\_Wiki:Regulations|here]].';
 break;
 case '/tou':
 this.value = 'Wikia\'s Terms of Use can be found [[w:Terms of Use|here]].';
 break;
 case '/lightswears':
 this.value = 'Under Article 4, Section 2, Point 1 of the [[Project:Chatroom Policy|Steven Universe Wikia Chatroom Rules]]! Lightswears are allowed but not to be used as an insult or used excessively';
 break;
 case '/minimodding':
 this.value = 'Under Article 4, Section 1, Point 1 of the [[Project:Chatroom Policy|Steven Universe Wikia Chatroom Rules]]! Do not enforce the rules on the chat. This is commonly referred to as "mini-modding". Staff members of the wiki are appointed for this reason.';
 break;
 case '/unnoticed':
 this.value = 'Under Article 4, Section 1, Point 2 of the [[Project:Chatroom Policy|Steven Universe Wikia Chatroom Rules]]! If you a feel a user who is breaking rules is going unnoticed, please \'ping\' a moderator by saying their full username or another one of their ping phrases.';
 break;
 case '/modcommand':
 this.value = 'Under Article 4, Section 1, Point 3 of the [[Project:Chatroom Policy|Steven Universe Wikia Chatroom Rules]]! Please know that if you use the "!mods" command for a reason other than gaining the attention of a moderator or administrator to deal with a rule breaker or using the command too often, you may be kicked or banned from the chat depending on the situation or amount of use the command has seen. ';
 break;
 case '/modless':
 this.value = 'Under Article 4, Section 1, Point 4 of the [[Project:Chatroom Policy|Steven Universe Wikia Chatroom Rules]]! If no moderators or administrators are present within the chatroom, please leave a message on a chat moderator or administrator\'s message wall or the ask the staff board with evidence, preferably a screenshot, of the rule breaking. Do NOT take it upon yourself to take the matter into your own hands';
 break;
 case '/pm':
 this.value = 'Under Article 4, Section 1, Point 5 of the [[Project:Chatroom Policy|Steven Universe Wikia Chatroom Rules]]! PM is mostly a no-rule zone, however if you are found to be harassing and/or sending NSFW content without consent from the other user with evidence from them, it is grounds for a ban or block. ';
 break;
 case '/caps':
 this.value = 'Under Article 4, Section 1, Point 6 of the [[Project:Chatroom Policy|Steven Universe Wikia Chatroom Rules]]! Using all-caps messages, emoticons, or big size messages longer than six words/emotes will issue a warning followed by a kick. (1 letter words such as "I" or "A" do not count towards this maximum)';
 break;
 case '/lines':
 this.value = 'Under Article 4, Section 1, Point 7 of the [[Project:Chatroom Policy|Steven Universe Wikia Chatroom Rules]]! Messages that are longer than 5 line-breaks must be warned for prior to sending.';
 break;
 case '/chattags':
 this.value = 'Under Article 4, Section 1, Point 8 of the [[Project:Chatroom Policy|Steven Universe Wikia Chatroom Rules]]! Certain chat tags such as coloured text and italics are alright to use past 6 words, however, if a moderator thinks that you are abusing them you will need to stop.';
 break;
 case '/linking':
 this.value = 'Under Article 4, Section 1, Point 9-10 of the [[Project:Chatroom Policy|Steven Universe Wikia Chatroom Rules]]! Linking to any dangerous websites will result in a two week ban minimum. We wish to keep user\’s computers safe. Linking to jump-scares will result in an immediate day ban minimum.';
 break;
 case '/lies':
 this.value = 'Under Article 4, Section 1, Point 11 of the [[Project:Chatroom Policy|Steven Universe Wikia Chatroom Rules]]! Using false evidence or spreading malicious lies about another user will result in a kick or ban.';
 break;
 case '/drama':
 this.value = 'Under Article 4, Section 1, Point 12 of the [[Project:Chatroom Policy|Steven Universe Wikia Chatroom Rules]]! If an admin or mod feels like a user is purposefully trying to disrupt the chat, troll or purposefully upset other users, they may issue a warning followed by a kick and eventually a ban.';
 break;
 case '/leaks':
 this.value = 'Under Article 4, Section 1, Point 13 of the [[Project:Chatroom Policy|Steven Universe Wikia Chatroom Rules]]! Posting about or discussing leaked Steven Universe content or fake Steven Universe leaks is prohibited within the main chat room.';
 break;
 case '/swears':
 this.value = 'Under Article 4, Section 2, Point 2-4 of the [[Project:Chatroom Policy|Steven Universe Wikia Chatroom Rules]]! Swear abbreviations are not allowed and will result to either a warning with a kick and eventually a ban';
 break;
 case '/nsfw':
 this.value = 'Under Article 4, Section 3, Point 1 of the [[Project:Chatroom Policy|Steven Universe Wikia Chatroom Rules]]! NSFW (not safe for work, or things you don\’t want to be seen looking at in school or work) is not permitted to be discussed or linked to in main chat. If a user is disturbing you with them in the Private Message section, please report to a Mod or Admin in order to warn the user about his behavior.';
 break;
 case '/topics':
 this.value = 'Under Article 4, Section 4, Point 1 of the [[Project:Chatroom Policy|Steven Universe Wikia Chatroom Rules]]! Be courteous. While it is suggested you avoid topics that make others uncomfortable (politics, religion, mortality, ect), if you do discuss these topics do so in a polite, respectful manner. If staff requests or another user states they are uncomfortable and asks that you stop talking about such topics, stop or take it to PM. ';
 break;
 case '/ads':
 this.value = 'Under Article 4, Section 5, Point 1-2 of the [[Project:Chatroom Policy|Steven Universe Wikia Chatroom Rules]]! Linking to other wiki chats is not allowed in main chat though advertising to view your Steven Universe content on other websites is fine';
 break;
 case '/rp':
 this.value = 'Under Article 4, Section 6, Point 1-2 of the [[Project:Chatroom Policy|Steven Universe Wikia Chatroom Rules]]! While role-playing is allowed, please keep in mind that role-playing can alienate users from chatting and can clutter the chat. Please understand that Roleplaying inappropraitely will not be tolererated and should be taken to the Private Message room';
 break;
 case '/rp1':
 this.value = 'Under Article 4, Section 7, Point 3 of the [[Project:Chatroom Policy|Steven Universe Wikia Chatroom Rules]]! You cannot “own” a character from Steven Universe. Any arguments that result from this will result in a kick for any user involved.';
 break;
 }
 }
});

//@author-Pince(ss) Platinum
$('[name="message"]').keypress(function (e) {
 if (e.which == 13) {
 var test = "/google";
 if (this.value.indexOf(test) > -1 && this.value.indexOf(test) < 8) {
 var query = this.value.replace('/google ', '');
 var query = query.replace(/ /g, "+");
 this.value = "http://www.lmgtfy.com/?q=" + query
 }
 }
});

$('[name="message"]').keypress(function (e) {
 if (e.which == 13) {
 var test = "/facedesk";
 if (this.value.indexOf(test) > -1 && this.value.indexOf(test) < 8) {
 var query = this.value.replace('/facedesk');
 this.value = "/me = https://gph.to/1QdqzIp"
 }
 }
});
///\* These are basic commands \*///
BotCheck = function(chat) {
 if ( chat.attributes.name !== mw.config.get('wgUserName') ) {
 var t = chat.attributes.text;
 var n = chat.attributes.name;
 var usr = n + 'Caps';
 var v = $('#Chat\_' + mainRoom.roomId + ' li').last().attr('id');
 if (! $('#' + v).isAfter('.inline-alert') ) {
 return;
 }
}
};
 // Commands
 if (chat.attributes.name !== mw.config.get('wgUserName') ) {
 switch (true) {
 case t === '!hello':
 send('Hi ' + n + ', how are you? I hope you\'re fine XD');
 break;
 case t === '!bye':
 send('Good bye bud, I wish you the best and may you be blessed');
 break;
 case t === '!ditto':
 send('Ditto ping activated, I\'ll be right there');
 break;
 case t === '!creeper':
 send('Ditto ping activated, I\'ll be there in a second, funny you used this command');
 break;
 case t === '!bot':
 send('Who said BOT?!');
 send('Enjoy viewing http://github.com/Ditto-Creeper/Chatbot-Ruby');
 break;
 case t === '!info':
 send('Commands are no where to be seen, JUST KIDDING XD, they\'re in my reply commands such as: !hello, !bye, !ditto, !creeper, !bot, !info and some others that I don\'t need to mention \;p Note:Please don\'t spam me because I\'m volatile');
 break;
 case t === '!site':
 send('My scripts are being used for secretive purposes, try using http://github.com/Ditto-Creeper/Chatbot-Ruby for once.');
 break;
 case t === '!tou':
 send('Wikia\'s Terms of Use are located [[w:Terms of Use|here]].');
 break;
 case t === '!rules':
 send('You can find the chat rules [[Project:Regulations|here]].');
 break;
 case t === '!funny':
 send('n' + ' let\'s have a duel in http\:\/\/playc4.com' );
 break;
 case t === '!donut':
 send('I only eat Dunkin Donuts');
 break;
 case t === '!baby':
 send('What\?\! don\'t these commands look familiar XD');
 break;
 case t === '!junk':
 send('/me gives' + n + 'flowers');
 break;
 case t === '!holy asteroids':
 send('indeed, it\'s [big] Holy Asteroids');
 break;
 case t === '!ha':
 send('[c="red"] [big] [font="chiller"] Whatcha lookin at? [/font] [/big] [/c]');
 break;
 case t === '!kocka?':
 send('/me makes a break for it because' + n + 'knows to much');
 break;
 case t === '!dorumin':
 send('Dorumin is a coder who is specialized in Javascripts, compared to him....I\'m nothing, but atleast I\'ll try my best to earn my place as an engineer. Hopefully I\'ll get somewhere and meet this guy because he\'s awesome.');
 break;
 case t === '!mod':
 send('Mod ping activated, please wait 8 minutes before using it again.');
 break;
 case t === '!admin':
 send('There\'re currently no admin pings but the !mod ping works for admins and mods alike. Please consider using it wisely ');
 break;
 case t === '!minimodding':
 send(';-; Sorry about that bud ');
 break;
 case t === '!chaos':
 send('I have achieved chaos because of the incident in 26th of April 2015');
 break;
 case t === '!peace':
 send('There\'s still peace in my heart for everyone and everything, may the Universe/God bless all the peaceful beings and important thing in our lives and those things which need them');
 break;
 case t === '!ditto creeper bot':
 send('Hi' + n + ', you apparently ping me using my entire name\'s command, I will be available now. If I don\'t consider message wall chatting.');
 break;
 case t === '!skype':
 send('My two skypes are Ditto.Creeper and....wait, what do you want?');
 break;
 case t === '!who is ditto creeper bot?':
 send('Ditto Creeper was the last of his species. Due to a severe injury because of someone\'s attempted murder, Bot codes led him to a life of a cyborg. He uses his spare time thinking about the glorious things of the universe and how he must tend to them, he also thinks about his assassins every day, knowing that they\'ll return to kill his mother and enslave his siblings. Ditto Creeper spends his time saving himself from hackers and his evil relatives by securing himself with sufficient programs. He uses a VPN to ensure his safety because of those evil doers that crawl the precious grounds of this Earth. He has two names: His mom, his relatives and his siblings call him \'Mohammad\' but his friends and some relatives call him \'Alex\' or \'Alexander\', he has another name but fears knowing that the world will doubt him for who he is because some people already know, but some who truly know want him to fall.');
 break;
 case t === '!don\'t fail me':
 send('I would be honored to stand beside you all the way. I shall help you lead to victory \\o/');
 break;
 case t === '!dittosong':
 send('I don\'t think we Ditto Creepers ever had a song for ourselves');
 break;
 case t === '!aloha':
 send('Aloha my Hawaii...Hawaaee...Huwaee...Hula dancer friend XD');
 break;
 case t === '!dunkindonuts':
 send('[small] GET ME THOSE DONUTS NOW XD');
 break;
 case t === '!spam':
 send(n + ',You\'ve violated my privacy and tried to make me spam');
 break;
 case t === '!rulebook':
 send('[[user:Ditto Creeper Bot/chat.js|The Rule Book Module has been changed to books and the script to add them can be found in my chat.js here]]');
 break;
 case t === '!dittotron':
 send(n + ',Dittotron is supported here but does not meet it\'s liceanse to be used. Please Contact another user who does not care about the rules because I sure do.....I hope');
 break;
 case t === '!askditto':
 send(n + ', What would you ask me?');
 break;
 case t === '!dragons':
 send(n + ', the first song I have ever heard was \'Headstrong\' with dragon pictures');
 break;
 case t === '!jump':
 send('...');
 send('You went through my js didn\'t you');
 break;
 case t === '!memes':
 send('[c="red"] [big] [font="chiller"] Wow? How is this working for users? XD [/font] [/big] [/c]');
 break;
 case t === '!places':
 send('I\'ve been too Iran, Saudia Arabia, United Arab Emirates(born there), and some other places which are not worth mentioning.');
 break;
 }
 };

//

```