<commit_before>import Bot from 'slackbot-api';
import config from './config';
import loader from './loader';
import initialize from './initialize';
import pocket from './pocket';
import * as utils from './utils';
import Agenda from 'agenda';
import winston from 'winston';

let bot = new Bot(config);

initialize(bot);

bot.on('open', () => {
  bot.utils = utils;
  bot.data.help = [];

  bot.help = (name, description, long) => {
    bot.data.help[name] = {description, long};
  }

  bot.log = new (winston.Logger)({
    transports: [
      new (winston.transports.Console)(),
      new (winston.transports.File)({ filename: 'bolt.log' })
    ]
  });

  bot.log.level = process.env.BOLT_LOG_LEVEL || 'info';

  bot.log.info('Bolt is ready to work!');

  bot.agenda = new Agenda({
    db: {
      address: process.env.MONGOLAB_URI || 'mongodb://127.0.0.1/agenda'
    }
  }, () => {
    bot.agenda.start();

    bot.log.verbose('[agenda] start job queue processing');

    ['start', 'complete', 'success', 'fail'].forEach(event => {
      bot.agenda.on(event, job => {
        bot.log.verbose('[agenda] job %s %s', job.attrs.name, event);
        bot.log.debug('[agenda] job %s, %s', job.attrs.name, event, job.attrs);
      })
    })
  });

  pocket(bot);
  loader(bot);
});<commit_msg>feat(port): listen on process.env.PORT if defined<commit_after>import Bot from 'slackbot-api';
import config from './config';
import loader from './loader';
import initialize from './initialize';
import pocket from './pocket';
import * as utils from './utils';
import Agenda from 'agenda';
import winston from 'winston';

let bot = new Bot(config);

initialize(bot);

bot.on('open', () => {
  bot.utils = utils;
  bot.data.help = [];

  bot.help = (name, description, long) => {
    bot.data.help[name] = {description, long};
  }

  bot.log = new (winston.Logger)({
    transports: [
      new (winston.transports.Console)(),
      new (winston.transports.File)({ filename: 'bolt.log' })
    ]
  });

  bot.log.level = process.env.BOLT_LOG_LEVEL || 'info';

  bot.log.info('Bolt is ready to work!');

  bot.agenda = new Agenda({
    db: {
      address: process.env.MONGOLAB_URI || 'mongodb://127.0.0.1/agenda'
    }
  }, () => {
    bot.agenda.start();

    bot.log.verbose('[agenda] start job queue processing');

    ['start', 'complete', 'success', 'fail'].forEach(event => {
      bot.agenda.on(event, job => {
        bot.log.verbose('[agenda] job %s %s', job.attrs.name, event);
        bot.log.debug('[agenda] job %s, %s', job.attrs.name, event, job.attrs);
      })
    })
  });

  pocket(bot);
  loader(bot);
});

if (process.env.PORT) {
  require('http').createServer().listen(process.env.PORT);
}
{'fraction_non_alphanumeric': 0.1945063103192279, 'fraction_numerical': 0.004454342984409799, 'mean_word_length': 3.1847826086956523, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '4955796', 'n_tokens_mistral': 965, 'n_tokens_neox': 934, 'n_words': 210}