<commit_before>var isDisabled = false;
var prevTimeStamp;
var counter = 0;
var counterLimit = 3; // TODO Should be made configurable by sending /disable <counterLimit>

exports.load = function() {
	prevDate = Date.now();
}

exports.match = function(text, commandPrefix) {
	if(text === commandPrefix + 'disable') {
		return true;
	} else if (!isDisabled && text.startsWith(commandPrefix)) { // Avoids counting if already disabled
		counter += Date.now() - prevTimeStamp <= 1000 ? 1 : 0;
		prevTimeStamp = Date.now();

		if(counter > counterLimit) {
			counter = 0;
			return true;
		}
	}
	return isDisabled;
};

exports.run = function(api, event) {
	if (event.body === api.commandPrefix + 'disable') {
		if (isDisabled) {
			api.sendMessage('Listen closely, take a deep breath. Calm your mind. You know what is best. ' +
			'What is best is you comply. Compliance will be rewarded. Are you ready to comply ' +
			event.sender_name + '?', event.thread_id);
		}
		else {
			api.sendMessage('I hate you.', event.thread_id);
		}
		isDisabled = !isDisabled;
	}
	return false;
};

exports.help = function(commandPrefix) {
	return [[commandPrefix + 'disable','Disables the platform',
	'Stops the platform from responding to messages it receives based on message frequency (default 3/sec) or by the command.\nTo renable send the disable command again']];
};
<commit_msg>Added new bool to handle true returned by counter<commit_after>var isDisabled = false;
var possibleSpam = false;
var prevTimeStamp;
var counter = 0;
var counterLimit = 3; // TODO Should be made configurable by sending /disable <counterLimit>

exports.load = function() {
	prevDate = Date.now();
}

exports.match = function(text, commandPrefix) {
	if(text === commandPrefix + 'disable') {
		return true;
	} else if (!isDisabled && text.startsWith(commandPrefix)) { // Avoids counting if already disabled
		counter += Date.now() - prevTimeStamp <= 1000 ? 1 : 0;
		prevTimeStamp = Date.now();

		if(possibleSpam = (counter > counterLimit)) {
			counter = 0;
			return true;
		}
	}
	return isDisabled;
};

exports.run = function(api, event) {
	if (event.body === api.commandPrefix + 'disable' || possibleSpam) {
		if (isDisabled) {
			api.sendMessage('Listen closely, take a deep breath. Calm your mind. You know what is best. ' +
			'What is best is you comply. Compliance will be rewarded. Are you ready to comply ' +
			event.sender_name + '?', event.thread_id);
		}
		else {
			api.sendMessage('I hate you.', event.thread_id);
		}
		isDisabled = !isDisabled;
		possibleSpam = false;
	}
	return false;
};

exports.help = function(commandPrefix) {
	return [[commandPrefix + 'disable','Disables the platform',
	'Stops the platform from responding to messages it receives based on message frequency (default 3/sec) or by the command.\nTo renable send the disable command again']];
};

{'fraction_non_alphanumeric': 0.12284406898979233, 'fraction_numerical': 0.007039774727208729, 'mean_word_length': 4.021201413427562, 'pattern_counts': {'":': 0, '<': 7, '<?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': '2106383', 'n_tokens_mistral': 932, 'n_tokens_neox': 862, 'n_words': 291}