<commit_before>function BridgePlugin(bot) {
	var self = this;
	self.name = "bridge";
	self.help = "bridge relay compatiblity plugin";
	self.depend = ["util"];

	self.bridgeRe = /^bridge$/;
	self.relayRe = /^\[([^\]]+)\] (.*)$/;

	self.targetChannels = {};
	self._say = null;
	self._action = null;
	self._notice = null;

	self.say = function(chan, name, text) {
		bot.say(chan, name + ": " + text);
	};

	self.action = function(chan, name, text) {
		bot.action(chan, name + ": " + text);
	};

	self.enable = function() {
		self._say = bot.say; // copy old function
		bot.say = function(target, message) {
			if (target in self.targetChannels) // bridge say
				return self.say(self.targetChannels[target], target, message);
			else
				return self._say.call(this, target, message);
		};

		self._action = bot.action; // copy old function
		bot.action = function(target, message) {
			if (target in self.targetChannels) // bridge action
				return self.action(self.targetChannels[target], target, message);
			else
				return self._action.call(this, target, message);
		};

		self._notice = bot.notice; // copy old function
		bot.notice = function(target, message) {
			if (target in self.targetChannels) // bridge notice
				return self.say(self.targetChannels[target], target, message);
			else
				return self._notice.call(this, target, message);
		};
	};

	self.disable = function() {
		bot.say = self._say; // restore old function
		self._say = null;
		bot.action = self._action; // restore old function
		self._action = null;
		bot.notice = self._notice; // restore old function
		self._notice = null;
	};

	self.events = {
		"message#": function(nick, to, text, message) {
			if (!nick.match(self.bridgeRe))
				return;

			var m = text.match(self.relayRe);
			if (m) {
				var name = bot.plugins.util.stripColors(m[1]);
				var text2 = m[2];

				self.targetChannels[name] = to;

				var message2 = {
					nick: name,
					user: to,
					host: "bridge-" + name,
					command: "PRIVMSG",
					args: [to, text2]
				};
				message2.prefix = message2.nick + "!" + message2.user + "@" + message2.host;
				bot.emit("raw", message2);<commit_msg>bridge: add extra nick argument check<commit_after>function BridgePlugin(bot) {
	var self = this;
	self.name = "bridge";
	self.help = "bridge relay compatiblity plugin";
	self.depend = ["util"];

	self.bridgeRe = /^bridge$/;
	self.relayRe = /^\[([^\]]+)\] (.*)$/;

	self.targetChannels = {};
	self._say = null;
	self._action = null;
	self._notice = null;

	self.say = function(chan, name, text) {
		bot.say(chan, name + ": " + text);
	};

	self.action = function(chan, name, text) {
		bot.action(chan, name + ": " + text);
	};

	self.enable = function() {
		self._say = bot.say; // copy old function
		bot.say = function(target, message) {
			if (target in self.targetChannels) // bridge say
				return self.say(self.targetChannels[target], target, message);
			else
				return self._say.call(this, target, message);
		};

		self._action = bot.action; // copy old function
		bot.action = function(target, message) {
			if (target in self.targetChannels) // bridge action
				return self.action(self.targetChannels[target], target, message);
			else
				return self._action.call(this, target, message);
		};

		self._notice = bot.notice; // copy old function
		bot.notice = function(target, message) {
			if (target in self.targetChannels) // bridge notice
				return self.say(self.targetChannels[target], target, message);
			else
				return self._notice.call(this, target, message);
		};
	};

	self.disable = function() {
		bot.say = self._say; // restore old function
		self._say = null;
		bot.action = self._action; // restore old function
		self._action = null;
		bot.notice = self._notice; // restore old function
		self._notice = null;
	};

	self.events = {
		"message#": function(nick, to, text, message) {
			if (nick && !nick.match(self.bridgeRe))
				return;

			var m = text.match(self.relayRe);
			if (m) {
				var name = bot.plugins.util.stripColors(m[1]);
				var text2 = m[2];

				self.targetChannels[name] = to;

				var message2 = {
					nick: name,
					user: to,
					host: "bridge-" + name,
					command: "PRIVMSG",
					args: [to, text2]
				};
				message2.prefix = message2.nick + "!" + message2.user + "@" + message2.host;
				bot.emit("raw", message2);
{'fraction_non_alphanumeric': 0.16073080481036078, 'fraction_numerical': 0.004625346901017576, 'mean_word_length': 3.150671785028791, 'pattern_counts': {'":': 6, '<': 3, '<?xml version=': 0, '>': 3, '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': '6493036', 'n_tokens_mistral': 1668, 'n_tokens_neox': 1445, 'n_words': 353}