<commit_before>"use strict";

exports.init = function (y, config, messages, cron, logger) {
	messages.add('kill_reboot_confirm', "I'll be back.");

	y.on('message', function (message) {
		if (/!reboot\b/i.test(message.plainBody())) {
			logger.info("!reboot");

			var rebootConfirmMessage = messages.get('kill_reboot_confirm');

			y.sendMessage(function (err, msg) {
				logger.info('sending reboot confirm message: OK');
				var thread = y.thread(msg.threadId());
				thread.setProperty('type', 'reboot');
				thread.setProperty('status', 'open');
				y.persistThread(thread);
				logger.warn('exiting');
				process.exit(0);

			}, rebootConfirmMessage, { 'reply_to' : message.id() });
		}
	});

	y.on('threadloaded', function (thread) {
		console.log('thl', thread);
	});

};<commit_msg>reboot<commit_after>"use strict";

exports.init = function (y, config, messages, cron, logger) {
	messages.add('kill_reboot_confirm', "I'll be back.");
	messages.add('kill_reboot_rebooted', "I'm back.");

	y.on('message', function (message) {
		if (/!reboot\b/i.test(message.plainBody())) {
			logger.info("!reboot");

			var rebootConfirmMessage = messages.get('kill_reboot_confirm');

			y.sendMessage(function (err, msg) {
				logger.info('sending reboot confirm message: OK');
				var thread = y.thread(msg.threadId());
				thread.setProperty('type', 'reboot');
				thread.setProperty('status', 'open');
				y.persistThread(thread);
				logger.warn('exiting');
				process.exit(0);

			}, rebootConfirmMessage, { 'reply_to' : message.id() });
		}
	});

	y.on('threadloaded', function (thread) {
		if (thread.property('type') === 'reboot' && thread.property('status') === 'open') {
			var rebootedMessage = messages.get('kill_reboot_rebooted');

			y.sendMessage(function (err, msg) {
				logger.info('sending rebooted message: OK');
				var thread = y.thread(msg.threadId());
				thread.setProperty('status', 'closed');
				y.persistThread(thread);

			}, rebootedMessage, { 'reply_to' : thread.id() });
		}
	});

};
{'fraction_non_alphanumeric': 0.1918489065606362, 'fraction_numerical': 0.0009940357852882703, 'mean_word_length': 4.485013623978202, 'pattern_counts': {'":': 0, '<': 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': '7081130', 'n_tokens_mistral': 775, 'n_tokens_neox': 663, 'n_words': 121}