<commit_before>const path = require('path');
const chalk = require('chalk');

module.exports = function (Kirbi) {
	let commandFiles;
	let commandDirectory;
	try {
		commandDirectory = '/modules';
		commandFiles = Kirbi.getFileArray(commandDirectory);
	} catch (err) {
		console.log(chalk.red(err));
	}

	// Helpers
	Kirbi.addCommand = function (commandName, commandObject) {
		try {
			Kirbi.Commands[commandName] = commandObject;
		} catch (err) {
			console.log(err);
		}
	};
	Kirbi.commandCount = function () {
		return Object.keys(Kirbi.Commands).length;
	};
	Kirbi.setupCommands = function () {
		Kirbi.Commands = {};

		// Load command files
		commandFiles.forEach(commandFile => {
			try {
				commandFile = require(`${path.join(commandDirectory, commandFile)}`)(Kirbi.Config, Kirbi.Auth);
			} catch (err) {
				console.log(chalk.red(`Improper setup of the '${commandFile}' command file. : ${err}`));
			}

			if (commandFile) {
				if (commandFile.commands) {
					commandFile.commands.forEach(command => {
						if (command in commandFile) {
							Kirbi.addCommand(command, commandFile[command]);
						}
					});
				}
			}
		});

		// Load simple commands from json file
		let jsonCommands = [];
		try {
			jsonCommands = Kirbi.getJsonObject('/config/commands.json');
		} catch (err) { }

		jsonCommands.forEach(jsonCommand => {
			const command = jsonCommand.command;
			const description = jsonCommand.description;
			const response = jsonCommand.response;

			Kirbi.addCommand(command, {
				description,
				process: (msg, suffix, isEdit, cb) => {
					cb({
						embed: {<commit_msg>ES6 fixes<commit_after>const path = require('path');
const chalk = require('chalk');

module.exports = Kirbi => {
	let commandFiles;
	let commandDirectory;
	try {
		commandDirectory = '/modules';
		commandFiles = Kirbi.getFileArray(commandDirectory);
	} catch (err) {
		console.log(chalk.red(err));
	}

	// Helpers
	Kirbi.addCommand = (commandName, commandObject) => {
		try {
			Kirbi.Commands[commandName] = commandObject;
		} catch (err) {
			console.log(err);
		}
	};
	Kirbi.commandCount = () => {
		return Object.keys(Kirbi.Commands).length;
	};
	Kirbi.setupCommands = () => {
		Kirbi.Commands = {};

		// Load command files
		commandFiles.forEach(commandFile => {
			try {
				commandFile = require(`${path.join(commandDirectory, commandFile)}`)(Kirbi);
			} catch (err) {
				console.log(chalk.red(`Improper setup of the '${commandFile}' command file. : ${err}`));
			}

			if (commandFile) {
				if (commandFile.commands) {
					commandFile.commands.forEach(command => {
						if (command in commandFile) {
							Kirbi.addCommand(command, commandFile[command]);
						}
					});
				}
			}
		});

		// Load simple commands from json file
		let jsonCommands = [];
		try {
			jsonCommands = Kirbi.getJsonObject('/config/commands.json');
		} catch (err) { }

		jsonCommands.forEach(jsonCommand => {
			const command = jsonCommand.command;
			const description = jsonCommand.description;
			const response = jsonCommand.response;

			Kirbi.addCommand(command, {
				description,
				process: (msg, suffix, isEdit, cb) => {
					cb({
						embed: {
{'fraction_non_alphanumeric': 0.14620995876942594, 'fraction_numerical': 0.0003171582619727244, 'mean_word_length': 3.4611032531824613, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '3776176', 'n_tokens_mistral': 1206, 'n_tokens_neox': 1022, 'n_words': 198}