<commit_before>/* Emoticons Plugin
 * This is a chat-plugin for an Emoticons system on PS
 * You will need a line in command-parser.js to actually
 * parse this so that it works.  Also, you will need to
 * add a few lines to the PM command (chat.js).
 * Credits: panpawn, jd
 */
'use strict';

const fs = require('fs');
let emotes = {};


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: {}, // holds the emoticons, to be merged with json later on

	// handles replacing emoticon messages with the HTML and then PS formats message
	// this is also used for the PM command (located in chat.js)
	processEmoticons: function (text) {
		let patterns = [], metachars = /[[\]{}()*+?.\\|^$\-,&#\s]/g;

		for (let i in this.chatEmotes) {
			if (this.chatEmotes[i]) {
				patterns.push(`(${i.replace(metachars, "\\$&")})`);
			}
		}

		let message = text.replace(new RegExp(patterns.join('|'), 'g'), match => {
			return typeof this.chatEmotes[match] !== 'undefined' ?
				`<img src="${this.chatEmotes[match]}" title="${match}"/>` :
				match;
		});
		if (message === text) return text;

		message = Gold.formatMessage(message); // PS formatting
<commit_msg>jd is painfully persistent sometimes<commit_after>/* Emoticons Plugin
 * This is a chat-plugin for an Emoticons system on PS
 * You will need a line in command-parser.js to actually
 * parse this so that it works.  Also, you will need to
 * add a few lines to the PM command (chat.js).
 * Credits: panpawn, jd
 */
'use strict';

const fs = require('fs');
let emotes = {};


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: {}, // holds the emoticons, to be merged with json later on

	// handles replacing emoticon messages with the HTML and then PS formats message
	// this is also used for the PM command (located in chat.js)
	processEmoticons: function (text) {
		let patterns = [], metachars = /[[\]{}()*+?.\\|^$\-,&#\s]/g;

		for (let i in this.chatEmotes) {
			if (this.chatEmotes[i] && i.toLowerCase() !== 'fukya') {
				patterns.push(`(${i.replace(metachars, "\\$&")})`);
			}
		}

		let message = text.replace(new RegExp(patterns.join('|'), 'g'), match => {
			return typeof this.chatEmotes[match] !== 'undefined' ?
				`<img src="${this.chatEmotes[match]}" title="${match}"/>` :
				match;
		});
		if (message === text) return text;

		message = Gold.formatMessage(message); // PS formatting

{'fraction_non_alphanumeric': 0.14910979228486648, 'fraction_numerical': 0.000741839762611276, 'mean_word_length': 3.65, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4978805', 'n_tokens_mistral': 917, 'n_tokens_neox': 853, 'n_words': 308}