<commit_before>const Discord = require("discord.js");
const bot = new Discord.Client({fetchAllMembers: true});
const config = require('./config.json');
const util = require("util");
const fs = require('fs');
const moment = require("moment");

const log = (msg) => {
  console.log(`[${moment().format("YYYY-MM-DD HH:mm:ss")}] ${msg}`);
};

bot.commands = new Discord.Collection();
fs.readdir(`./cmd/`, (err, files) => {
  if(err) console.error(err);
  console.log(`Loading a total of ${files.length} commands.`);
  files.map(f=> {
    let props = require(`./cmd/${f}`);
    console.log(`Loading Command: ${props.help.name}. :ok_hand:`);
    bot.commands.set(props.help.name, props);
  });
});

bot.on('message', msg => {
  if(!msg.content.startsWith(config.prefix)) return;
  var command = msg.content.split(" ")[0].slice(config.prefix.length);
  var params = msg.content.split(" ").slice(1);
  if(bot.commands.has(command)) {
    var cmd = bot.commands.get(command);
    if(cmd.help.restrict && !cmd.help.restrict(msg.author.id)) return;
    cmd.run(bot, msg, params);
  }
});

bot.on('ready', () => {
  log(`GuideBot: Ready to serve ${bot.users.size} users, in ${bot.channels.size} channels of ${bot.guilds.size} servers.`);
  console.log("=> Ready");
});

bot.on('error', console.error);
bot.on('warn', console.warn);

bot.login(config.botToken);

bot.reload = function(command) {
  bot.commands.delete(command);
  delete require.cache[require.resolve(`./cmd/${command}`)];
  bot.commands.set(command, require(`./cmd/${command}`));
};<commit_msg>Changed map() to forEach() so Gawdl3y could stop annoying me with performance<commit_after>const Discord = require("discord.js");
const bot = new Discord.Client({fetchAllMembers: true});
const config = require('./config.json');
const fs = require('fs');
const moment = require("moment");

const log = (msg) => {
  console.log(`[${moment().format("YYYY-MM-DD HH:mm:ss")}] ${msg}`);
};

bot.commands = new Discord.Collection();
fs.readdir(`./cmd/`, (err, files) => {
  if(err) console.error(err);
  console.log(`Loading a total of ${files.length} commands.`);
  files.map(f=> {
    let props = require(`./cmd/${f}`);
    console.log(`Loading Command: ${props.help.name}. :ok_hand:`);
    bot.commands.set(props.help.name, props);
  });
});

bot.on('message', msg => {
  if(!msg.content.startsWith(config.prefix)) return;
  var command = msg.content.split(" ")[0].slice(config.prefix.length);
  var params = msg.content.split(" ").slice(1);
  if(bot.commands.has(command)) {
    var cmd = bot.commands.get(command);
    if(cmd.help.restrict && !cmd.help.restrict(msg.author.id)) return;
    cmd.run(bot, msg, params);
  }
});

bot.on('ready', () => {
  log(`GuideBot: Ready to serve ${bot.users.size} users, in ${bot.channels.size} channels of ${bot.guilds.size} servers.`);
  console.log("=> Ready");
});

bot.on('error', console.error);
bot.on('warn', console.warn);

bot.login(config.botToken);

bot.reload = function(command) {
  bot.commands.delete(command);
  delete require.cache[require.resolve(`./cmd/${command}`)];
  bot.commands.set(command, require(`./cmd/${command}`));
};
{'fraction_non_alphanumeric': 0.22236421725239616, 'fraction_numerical': 0.001597444089456869, 'mean_word_length': 4.631294964028777, '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': '7256485', 'n_tokens_mistral': 1075, 'n_tokens_neox': 1084, 'n_words': 206}