<commit_before>const Discord = require('discord.js');
const client = new Discord.Client();

const SteamCommunity = require('steamcommunity');
var community = new SteamCommunity();

const fs = require('fs');

const gamemod = require('./lib/game_utils.js');
const steamgame = require('./lib/steamgame.js');
const utils = require('./lib/utils.js');
const hascmd = utils.hascmd;
const slots = require('./lib/slots.js');

var whoppl = JSON.parse(fs.readFileSync('./texts/whois.json').toString("utf-8"));

const hiddenppl = {
  "god": "me",
  "england": "my city"
};

var everyone = Object.keys(whoppl).join(", ");
var helpdocs = JSON.parse(fs.readFileSync('./texts/helpdocs.json').toString("utf-8"));
var jokes = (fs.readFileSync('./texts/jokes.txt').toString("utf-8").split("\n"));
for (let i = 0; i < jokes.length; i++) {
  while (jokes[i].includes("///"))
    jokes[i] = jokes[i].replace("///", "\n");
}
var graves = JSON.parse(fs.readFileSync('./texts/graves.json').toString("utf-8"));

var gamedata = JSON.parse(fs.readFileSync("./game_data.json"));
var ghandler = new gamemod.GameData(gamedata);

var emojiHolder;

process.stdin.setEncoding('utf8');
var commands = {
  "UNKNOWN_COMMAND": function() {
    return "Unknown command. Type `help` for help.";
  },
  "reload": function() {
    whoppl = JSON.parse(fs.readFileSync('./texts/whois.json').toString("utf-8"));
    everyone = Object.keys(whoppl).join(", ");
    helpdocs = JSON.parse(fs.readFileSync('./texts/helpdocs.json').toString("utf-8"));
    jokes = (fs.readFileSync('./texts/jokes.txt').toString("utf-8").split("\n"));
    for (let i = 0; i < jokes.length; i++) {
      while (jokes[i].includes("///"))
        jokes[i] = jokes[i].replace("///", "\n");
    }
    return "Reloaded.";
  },
  "test": function() {
    console.log(jokes.join("\n"));
    return "yep";
  },
  "stop": function() {
    fs.writeFileSync("./game_data.json", ghandler.dataToSave());
    process.exit(0);
    return "Stopping.";
  }
};
var anchorloc;
process.stdin.on('data', (text) => {
  var stuff;
  while (text.indexOf('\n') !== -1 || text.indexOf('\r') !== -1 || text.indexOf('  ') !== -1) {
    text = text.replace(/\n|\r|\t/, '').replace(/  /, ' ');
  }
  var args = text.split(' ');
  var command = args[0].toLowerCase();
  var trip = false;
  for (var key in commands) {
    if (key === command) {
      trip = true;
      stuff = commands[key](args[1], args[2], args[3]);
      if (Array.isArray(stuff)) {} else {
        console.log(stuff);
      }
    }
  }
  if (!trip) {
    stuff = commands.UNKNOWN_COMMAND();
    if (Array.isArray(stuff)) {
      for (var i = 0; i < stuff.length; i++) {
        console.log(stuff[i]);
      }
    } else {
      console.log(stuff);
    }
  }
});

function whois(person) {
  let trueppl = Object.assign({}, whoppl, hiddenppl);
  for (var key in trueppl) {
    if (person.toLowerCase() === key) {
      return person + " is " + trueppl[key];
    }
  }
}



client.on('ready', () => {
  console.log('Connected and initialized.');
});

function formatPrice(prices) {
  let ret = "";
  for (var i = 0; i < (prices.length < 5 ? prices.length : 5); i++) {
    ret += prices[i].market_hash_name + " costs $" + (prices[i].price / 100) + "\n";
  }
  return ret;
}

function getPrice(item, appid, cb) {
  community.marketSearch({
    query: item,
    appid
  }, (err, items) => {
    if (err) {
      cb(err.message);
    } else {
      cb(formatPrice(items));
    }
  });
}

function getImg(item, appid, cb, ecb) {
  if (item.toLowerCase() == "kairu") {
    cb("http://vignette1.wikia.nocookie.net/powerlisting/images/a/ad/Trap-image.png/revision/latest?cb=20160113212524");
    return;
  } else if (item.toLowerCase() == "livid") {
    cb("https://s.thestreet.com/files/tsc/v2008/photos/contrib/uploads/transoceanrig_600x400.jpg");
    return;
  } else if (item.toLowerCase() == "dank") {
    cb("http://st.motortrend.com/uploads/sites/10/2015/11/2015-nissan-juke-sl-suv-angular-front.png?interpolation=lanczos-none&fit=around|300;199");
    return;
  } else if (item.toLowerCase() == "yuna") {
    cb("http://i.imgur.com/5vDmod7.png");
    return;
  } else if (item.toLowerCase() == "abuse") {
    cb("https://cdn.discordapp.com/attachments/167586953061990400/364157623832150017/madman.png");<commit_msg>abbreviations for priceof things<commit_after>const Discord = require('discord.js');
const client = new Discord.Client();

const SteamCommunity = require('steamcommunity');
var community = new SteamCommunity();

const fs = require('fs');

const gamemod = require('./lib/game_utils.js');
const steamgame = require('./lib/steamgame.js');
const utils = require('./lib/utils.js');
const hascmd = utils.hascmd;
const slots = require('./lib/slots.js');

var whoppl = JSON.parse(fs.readFileSync('./texts/whois.json').toString("utf-8"));

const hiddenppl = {
  "god": "me",
  "england": "my city"
};

var everyone = Object.keys(whoppl).join(", ");
var helpdocs = JSON.parse(fs.readFileSync('./texts/helpdocs.json').toString("utf-8"));
var jokes = (fs.readFileSync('./texts/jokes.txt').toString("utf-8").split("\n"));
for (let i = 0; i < jokes.length; i++) {
  while (jokes[i].includes("///"))
    jokes[i] = jokes[i].replace("///", "\n");
}
var graves = JSON.parse(fs.readFileSync('./texts/graves.json').toString("utf-8"));

var gamedata = JSON.parse(fs.readFileSync("./game_data.json"));
var ghandler = new gamemod.GameData(gamedata);

var emojiHolder;

process.stdin.setEncoding('utf8');
var commands = {
  "UNKNOWN_COMMAND": function() {
    return "Unknown command. Type `help` for help.";
  },
  "reload": function() {
    whoppl = JSON.parse(fs.readFileSync('./texts/whois.json').toString("utf-8"));
    everyone = Object.keys(whoppl).join(", ");
    helpdocs = JSON.parse(fs.readFileSync('./texts/helpdocs.json').toString("utf-8"));
    jokes = (fs.readFileSync('./texts/jokes.txt').toString("utf-8").split("\n"));
    for (let i = 0; i < jokes.length; i++) {
      while (jokes[i].includes("///"))
        jokes[i] = jokes[i].replace("///", "\n");
    }
    return "Reloaded.";
  },
  "test": function() {
    console.log(jokes.join("\n"));
    return "yep";
  },
  "stop": function() {
    fs.writeFileSync("./game_data.json", ghandler.dataToSave());
    process.exit(0);
    return "Stopping.";
  }
};
var anchorloc;
process.stdin.on('data', (text) => {
  var stuff;
  while (text.indexOf('\n') !== -1 || text.indexOf('\r') !== -1 || text.indexOf('  ') !== -1) {
    text = text.replace(/\n|\r|\t/, '').replace(/  /, ' ');
  }
  var args = text.split(' ');
  var command = args[0].toLowerCase();
  var trip = false;
  for (var key in commands) {
    if (key === command) {
      trip = true;
      stuff = commands[key](args[1], args[2], args[3]);
      if (Array.isArray(stuff)) {} else {
        console.log(stuff);
      }
    }
  }
  if (!trip) {
    stuff = commands.UNKNOWN_COMMAND();
    if (Array.isArray(stuff)) {
      for (var i = 0; i < stuff.length; i++) {
        console.log(stuff[i]);
      }
    } else {
      console.log(stuff);
    }
  }
});

function whois(person) {
  let trueppl = Object.assign({}, whoppl, hiddenppl);
  for (var key in trueppl) {
    if (person.toLowerCase() === key) {
      return person + " is " + trueppl[key];
    }
  }
}



client.on('ready', () => {
  console.log('Connected and initialized.');
});

function formatPrice(prices) {
  let ret = "";
  for (var i = 0; i < (prices.length < 5 ? prices.length : 5); i++) {
    ret += prices[i].market_hash_name + " costs $" + (prices[i].price / 100) + "\n";
  }
  return ret;
}

function replacify(text) {
  return text.replace(/(?:^| )[fF][nN](?: |$)/g, "Factory New").replace(/(?:^| )[mM][wW](?: |$)/g, "Minimal Wear")
    .replace(/(?:^| )[fF][tT](?: |$)/g, "Field-Tested").replace(/(?:^| )[wW][wW](?: |$)/g, "Well-Worn")
    .replace(/(?:^| )[fF][nN](?: |$)/g, "Battle-Scarred");
}

function getPrice(item, appid, cb) {
  community.marketSearch({
    query: replacify(item),
    appid
  }, (err, items) => {
    if (err) {
      cb(err.message);
    } else {
      cb(formatPrice(items));
    }
  });
}

function getImg(item, appid, cb, ecb) {
  if (item.toLowerCase() == "kairu") {
    cb("http://vignette1.wikia.nocookie.net/powerlisting/images/a/ad/Trap-image.png/revision/latest?cb=20160113212524");
    return;
  } else if (item.toLowerCase() == "livid") {
    cb("https://s.thestreet.com/files/tsc/v2008/photos/contrib/uploads/transoceanrig_600x400.jpg");
    return;
  } else if (item.toLowerCase() == "dank") {
    cb("http://st.motortrend.com/uploads/sites/10/2015/11/2015-nissan-juke-sl-suv-angular-front.png?interpolation=lanczos-none&fit=around|300;199");
    return;
  } else if (item.toLowerCase() == "yuna") {
    cb("http://i.imgur.com/5vDmod7.png");
    return;
  } else if (item.toLowerCase() == "abuse") {
    cb("https://cdn.discordapp.com/attachments/167586953061990400/364157623832150017/madman.png");
{'fraction_non_alphanumeric': 0.22124887690925427, 'fraction_numerical': 0.023809523809523808, 'mean_word_length': 3.4084158415841586, 'pattern_counts': {'":': 12, '<': 13, '<?xml version=': 0, '>': 9, 'https://': 4, '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': '24902', 'n_tokens_mistral': 3393, 'n_tokens_neox': 3303, 'n_words': 575}