#!/usr/bin/env node

const fs = require('fs');
const path = require('path');

process.chdir(path.resolve(__dirname, '..'));

require(`../js/battle-dex.js`); // only needed for toId
global.BattleText = require(`../data/text.js`).BattleText;
require(`../js/battle-text-parser.js`);

const parser = new BattleTextParser();

const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});

rl.on('line', line => {
  process.stdout.write(parser.extractMessage(line));
});
