diff --git a/chat-plugins/emotes.js b/chat-plugins/emotes.js
deleted file mode 100644
index 0fa14fbfa8528..0000000000000
--- a/chat-plugins/emotes.js
+++ /dev/null
@@ -1,318 +0,0 @@
-/* Emoticons Plugin
- * This is a chat-plugin for an Emoticons system on PS
- * You will need a line in parser to actually parse
- * this so that it works. Also, you will need need to
- * add a few lines to the PM command.
- * Credits: panpawn
- *
- * Current Features:
- * - Emoticon Moderated chat based on rank (for chat rooms)
- * - Command based adding and removing of emoticons
- * - Saves the emote moderated chat status in each chat room on restart
- * - Checks if a user is shadowbanned and reacts accordingly
- * - Does not require server-side CSS (./config/custom.css) elements for usernames
- * - Checks the number of chat emoticons in one message and won't parse if it is more than Gold.emoticons.maxChatEmotes
- * - Administrators can toggle how many emoticons users can do in their messages with a command
- * - Now parses for PS formats such as bold, italics, and strikethrough
- * - PMs emoticons
- *
- * TODO:
- * - Links parsing in emoticon messages?
- * - Limit to number of PMs emoticons in one message...?
- */
-
-var fs = require('fs');
-var serialize = require('node-serialize');
-var emotes = {};
-var style = "background:none;border:0;padding:0 5px 0 0;font-family:Verdana,Helvetica,Arial,sans-serif;font-size:9pt;cursor:pointer";
-
-if (typeof Gold === 'undefined') global.Gold = {};
-
-Gold.emoticons = {
- maxChatEmotes: 4, //the default maximum number of emoticons in one chat message that gets parsed
- adminBypassMaxChatEmotes: true, //can administrators use as many emoticons as they wish?
- chatEmotes: {},
- processEmoticons: function(text) {
- var patterns = [],
- metachars = /[[\]{}()*+?.\\|^$\-,\s]/g,
- self = this;
- for (var i in this.chatEmotes) {
- if (this.chatEmotes.hasOwnProperty(i)) {
- patterns.push('(' + i.replace(metachars, "\\$&") + ')');
- }
- }
- return text.replace(new RegExp(patterns.join('|'), 'g'), function(match) {
- return typeof self.chatEmotes[match] != 'undefined' ?
- '' :
- match;
- });
- },
- checkEmoteModchat: function(user, room) {
- var rank = (user.group !== ' ' ? user.group : (room.auth ? room.auth[user.userid] : user.group));
- switch (room.emoteModChat) {
- case undefined:
- case false:
- return true;
- break;
- case 'ac':
- case 'autoconfirmed':
- return (user.autoconfirmed ? true : false);
- break;
- default:
- groups = Config.groupsranking;
- var i = groups.indexOf(rank); // rank # of user
- var u = groups.indexOf(room.emoteModChat); // rank # of emote modchat
- if (i >= u) return true;
- }
- return false;
- },
- processChatData: function(user, room, connection, message) {
- var match = false;
- var parsed_message = this.processEmoticons(message);
- for (var i in this.chatEmotes) {
- if (~message.indexOf(i)) {
- if ((parsed_message.match(/
' + '' + Tools.escapeHTML(user.name) + ': ' + message + ''
- );
- room.update();
- Users.ShadowBan.addMessage(user, "To " + room, origmsg);
- break;
- case false:
- if (!this.checkEmoteModchat(user, room)) {
- kitty = message = this.processEmoticons(message);
- var message = Tools.escapeHTML(kitty);
- return (message);
- return;
- } else if (this.checkEmoteModchat(user, room)) {
- if (!match || message.charAt(0) === '!') return true;
- message = Tools.escapeHTML(message);
- message = this.processEmoticons(message);
-
- //PS formatting
- message = message.replace(/\_\_([^< ](?:[^<]*?[^< ])?)\_\_(?![^<]*?<\/a)/g, '$1'); //italics
- message = message.replace(/\*\*([^< ](?:[^<]*?[^< ])?)\*\*/g, '$1'); //bold
- message = message.replace(/\~\~([^< ](?:[^<]*?[^< ])?)\~\~/g, '
$1'); //strikethrough
-
- if (user.hiding) {
- room.addRaw(' ' + message + '');
- room.update();
- }
- room.addRaw(user.getIdentity(room).substr(0,1) + ' ' + message + '');
- room.update();
- room.messageCount++;
- return false;
- }
- break;
- }
- },
- processPMsParsing: function (message) {
- emoteRegex = [];
- for (var emote in this.chatEmotes) {
- emoteRegex.push(emote);
- }
- emoteRegex = new RegExp('(' + emoteRegex.join('|') + ')', 'g');
- self = this;
- if (emoteRegex.test(message)) {
- message = message.replace(emoteRegex, function (match) {
- return '';
- });
- return message;
- }
- return false;
- }
-};
-
-
-// commands
-
-function loadEmotes() {
- try {
- emotes = serialize.unserialize(fs.readFileSync('config/emotes.json', 'utf8'));
- Object.merge(Gold.emoticons.chatEmotes, emotes);
- } catch (e) {}
-}
-setTimeout(function(){loadEmotes();},1000);
-
-function saveEmotes() {
- try {
- fs.writeFileSync('config/emotes.json',serialize.serialize(emotes));
- Object.merge(Gold.emoticons.chatEmotes, emotes);
- } catch (e) {}
-}
-
-exports.commands = {
- emotes: 'ezemote',
- temotes: 'ezemote',
- temote: 'ezemote',
- emote: 'ezemote',
- ec: 'ezemote',
- ezemote: function (target, room, user) {
- if (!target) target = "help";
- var parts = target.split(',');
- for (var u in parts) parts[u] = parts[u].trim();
-
- try {
- switch (toId(parts[0])) {
-
- case 'add':
- if (!this.can('pban')) return this.errorReply("Access denied.");
- if (!this.canTalk()) return this.errorReply("You cannot do this while unable to talk.");
- if (!(parts[2] || parts[3])) return this.errorReply("Usage: /emote add, [emoticon], [link]");
- var emoteName = parts[1];
- if (Gold.emoticons.chatEmotes[emoteName]) return this.errorReply("ERROR - the emoticon: " + emoteName + " already exists.");
- var link = parts.splice(2, parts.length).join(',');
- var fileTypes = [".gif",".png",".jpg"];
- if (!~fileTypes.indexOf(link.substr(-4))) return this.errorReply("ERROR: the emoticon you are trying to add must be a gif, png, or jpg.");
- emotes[emoteName] = Gold.emoticons.chatEmotes[emoteName] = link;
- saveEmotes();
- this.sendReply("The emoticon " + emoteName + " has been added.");
- this.logModCommand(user.name + " added the emoticon: " + emoteName);
- Rooms.get('staff').add("The emoticon " + emoteName + " was added by " + Tools.escapeHTML(user.name) + ".");
- Rooms.get('staff').update();
- break;
-
- case 'rem':
- case 'remove':
- case 'del':
- case 'delete':
- if (!this.can('pban')) return this.errorReply("Access denied.");
- if (!this.canTalk()) return this.errorReply("You cannot do this while unable to talk.");
- if (!parts[1]) return this.errorReply("/emote remove, [emoticon]");
- emoteName = parts[1];
- if (!Gold.emoticons.chatEmotes[emoteName]) return this.errorReply("ERROR - the emoticon: " + emoteName + " does not exist.");
- delete Gold.emoticons.chatEmotes[emoteName];
- delete emotes[emoteName];
- saveEmotes();
- this.sendReply("The emoticon " + emoteName + " has been removed.");
- this.logModCommand(user.name + " removed the emoticon: " + emoteName);
- Rooms.get('staff').add("The emoticon " + emoteName + " was removed by " + Tools.escapeHTML(user.name) + ".");
- Rooms.get('staff').update();
- break;
-
- case 'list':
- if (!this.canBroadcast()) return;
- if (this.broadcasting) return this.errorReply("ERROR: this command is too spammy to broadcast. Use / instead of ! to see it for yourself.");
- var output = "There's a total of " + Object.size(emotes) + " emoticons added with this command:
";
- for (var e in emotes) {
- output += e + "
";
- }
- this.sendReplyBox("
| " +
- " " + - "(By: panpawn) " + - "/emote add, [emote], [link] - Adds a chat emoticon. Requires ~." + - "/emote remove, [emote] - Removes a chat emoticon. Requires ~." + - "/emote modchat, set, [rank symbol / disable] - Sets moderated chat for chat emoticons in the respected room to the respected rank. Requires @, #, &, ~." + - "/emote modchat, disable - Disables moderated chat for chat emoticons (enabled by default.) Requires @, #, &, ~." + - "/emote modchat - Views the current moderated chat status of chat emoticons." + - "/emote list - Shows the chat emoticons in a list form." + - "/emote view - Shows all of the current chat emoticons with the respected image." + - "/emote object - Shows the object of Gold.emoticons.chatEmotes. (Mostly for development usage)" + - "/emote max, [max emotes / message] - Sets the max emoticon messages per chat message. Requires ~." + - "/emote help - Shows this help command." + - " |