<commit_before>'use strict';

// Utils
const { print, logError } = require('../../utils/log');

// Bot
const bot = require('../../bot');

// DB
const middlewareHandler = async ({ chat, message }, next) => {
	process.env.NODE_ENV === 'development' && message && print(message);
	if (
		message &&
		message.text &&
		message.entities[0].type !== 'code' &&
		/^\/\w+/.test(message.text) &&
		chat.type !== 'private'
	) {
		try {
			await bot.telegram.deleteMessage(chat.id, message.message_id);
		} catch (err) {
			logError(err);
		}
	}
	return next();
};

module.exports = middlewareHandler;<commit_msg>fixed undefined bug<commit_after>'use strict';

// Utils
const { print, logError } = require('../../utils/log');

// Bot
const bot = require('../../bot');

// DB
const middlewareHandler = async ({ chat, message }, next) => {
	process.env.NODE_ENV === 'development' && message && print(message);
	if (
		message &&
		message.text &&
		/^\/\w+/.test(message.text) &&
		chat.type !== 'private'
	) {
		try {
			await bot.telegram.deleteMessage(chat.id, message.message_id);
		} catch (err) {
			logError(err);
		}
	}
	return next();
};

module.exports = middlewareHandler;
{'fraction_non_alphanumeric': 0.20922288642186165, 'fraction_numerical': 0.0008539709649871904, 'mean_word_length': 3.293040293040293, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '6525184', 'n_tokens_mistral': 422, 'n_tokens_neox': 398, 'n_words': 81}