<commit_before>const Discord = require("discord.js");
const MSS = require("./../../functions/");
const config = require("./../../config.json");
const fs = require("fs");
var commands = [];
var print = "What manual page do you want?\n" + config.MSS.prefix + "man <command>\n" + config.MSS.prefix + "man all\n";

//Get all .json files in this directory to read the man data.
fs.readdir("./commands/", function(err, items) {
	items.forEach(function(item) {
		var file = item.replace(/['"]+/g, "");
		print += "> " + file + "\n";
		//Include the meta.json files in the commands directory
		commands[file] = require("./../" + file + "/meta.json");
	});
});

module.exports = function manpages(message) {
	let input = message.content.replace(/\n/g, " ").split(" ");

	//Return the usage of the man command if no attributes were given
	if(!input[1]) {
		message.reply(print);
		return false;
	}

	//Remove all non-alphanumeric characters just in case people put the prefix in
	input[1] = input[1].replace(/[^a-z0-9]/gi,'');

	//Return an entire list of commands via DM
	if(input[1] === "all") {
		message.reply("I sent a message via Direct Messaging with details enclosed.");

		commands.forEach(function(item, index) {
			var embed = new Discord.RichEmbed()
				.setTitle(item.meta.name)
				.setAuthor("MSS Man Pages", "http://moustacheminer.com/mss.png")
				.setColor("#00AE86")
				.setDescription(item.meta.description)
				.setFooter("MSS-Discord, " + config.MSS.version, "")
				.setTimestamp()
				.setURL(item.meta.url);

			item.meta.examples.forEach(function(element) {
				embed.addField(config.MSS.prefix + index + " " + element.var, element.description);
			});

			message.author.sendEmbed(embed, "", { disableEveryone: true });

			console.log(index);
		});

		return false;
	}

	//Return if it doesn't exist
	if (!commands[input[1]]) {
		MSS.msg.react(message, false, "link");
		message.reply("No manual entry for " + input[1]);
		return false;
	}

	var embed = new Discord.RichEmbed()
		.setTitle(commands[input[1]].meta.name)
		.setAuthor("MSS Man Pages", "http://moustacheminer.com/mss.png")
		.setColor("#00AE86")
		.setDescription(commands[input[1]].meta.description)
		.setFooter("MSS-Discord, " + config.MSS.version, "")
		.setTimestamp()
		.setURL(commands[input[1]].meta.url);

	commands[input[1]].meta.examples.forEach(function(element) {
		embed.addField(config.MSS.prefix + input[1] + " " + element.var, element.description);
	});

	message.channel.sendEmbed(embed, input[1], { disableEveryone: true });
}<commit_msg>blank string<commit_after>const Discord = require("discord.js");
const MSS = require("./../../functions/");
const config = require("./../../config.json");
const fs = require("fs");
var commands = [];
var print = "What manual page do you want?\n" + config.MSS.prefix + "man <command>\n" + config.MSS.prefix + "man all\n";

//Get all .json files in this directory to read the man data.
fs.readdir("./commands/", function(err, items) {
	items.forEach(function(item) {
		var file = item.replace(/['"]+/g, "");
		print += "> " + file + "\n";
		//Include the meta.json files in the commands directory
		commands[file] = require("./../" + file + "/meta.json");
	});
});

module.exports = function manpages(message) {
	let input = message.content.replace(/\n/g, " ").split(" ");

	//Return the usage of the man command if no attributes were given
	if(!input[1]) {
		message.reply(print);
		return false;
	}

	//Remove all non-alphanumeric characters just in case people put the prefix in
	input[1] = input[1].replace(/[^a-z0-9]/gi,'');

	//Return an entire list of commands via DM
	if(input[1] === "all") {
		message.reply("I sent a message via Direct Messaging with details enclosed.");

		commands.forEach(function(item, index) {
			var embed = new Discord.RichEmbed()
				.setTitle(item.meta.name)
				.setAuthor("MSS Man Pages", "http://moustacheminer.com/mss.png")
				.setColor("#00AE86")
				.setDescription(item.meta.description)
				.setFooter("MSS-Discord, " + config.MSS.version, "")
				.setTimestamp()
				.setURL(item.meta.url);

			item.meta.examples.forEach(function(element) {
				embed.addField(config.MSS.prefix + index + " " + element.var, element.description);
			});

			message.author.sendEmbed(embed, "" , { disableEveryone: true });

			console.log(index);
		});

		return false;
	}

	//Return if it doesn't exist
	if (!commands[input[1]]) {
		MSS.msg.react(message, false, "link");
		message.reply("No manual entry for " + input[1]);
		return false;
	}

	var embed = new Discord.RichEmbed()
		.setTitle(commands[input[1]].meta.name)
		.setAuthor("MSS Man Pages", "http://moustacheminer.com/mss.png")
		.setColor("#00AE86")
		.setDescription(commands[input[1]].meta.description)
		.setFooter("MSS-Discord, " + config.MSS.version, "")
		.setTimestamp()
		.setURL(commands[input[1]].meta.url);

	commands[input[1]].meta.examples.forEach(function(element) {
		embed.addField(config.MSS.prefix + input[1] + " " + element.var, element.description);
	});

	message.channel.sendEmbed(embed, input[1], { disableEveryone: true });
}

{'fraction_non_alphanumeric': 0.18618382208226728, 'fraction_numerical': 0.008659712654989176, 'mean_word_length': 3.867816091954023, 'pattern_counts': {'":': 0, '<': 5, '<?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': '326327', 'n_tokens_mistral': 1864, 'n_tokens_neox': 1694, 'n_words': 377}