<commit_before>'use strict'

var Botkit = require('botkit')
var Wit = require('node-wit')

var token = process.env.SLACK_TOKEN
var witToken = process.env.WIT_TOKEN

var controller = Botkit .slackbot({
  // reconnect to Slack RTM when connection goes bad
  retry: Infinity,
  debug: false
})

// Assume single team mode if we have a SLACK_TOKEN
if (token) {
  console.log('Starting in single-team mode')
  controller.spawn({
    token: token,
    retry: Infinity
  }).startRTM(function (err, bot, payload) {
    if (err) {
      throw new Error(err)
    }

    console.log('Connected to Slack RTM')
  })
// Otherwise assume multi-team mode - setup beep boop resourcer connection
} else {
  console.log('Starting in Beep Boop multi-team mode')
  require('beepboop-botkit').start(controller, { debug: true })
}

var client = new function Wit({
    accessToken: witToken,
    actions: {
        send(request, response) {
            return new Promise(function (resolve, reject) {
                console.log(JSON.stringify(response));
                return resolve();
            });
        },
        myAction({sessionId, context, text, entities}) {
            console.log(`Session ${sessionId} received ${text}`);
            console.log(`The current context is ${JSON.stringify(context)}`);
            console.log(`Wit extracted ${JSON.stringify(entities)}`);
            return Promise.resolve(context);
        }
    }
})<commit_msg>ec6 fix<commit_after>'use strict'

var Botkit = require('botkit')
var Wit = require('node-wit')

var token = process.env.SLACK_TOKEN
var witToken = process.env.WIT_TOKEN

var controller = Botkit .slackbot({
  // reconnect to Slack RTM when connection goes bad
  retry: Infinity,
  debug: false
})

// Assume single team mode if we have a SLACK_TOKEN
if (token) {
  console.log('Starting in single-team mode')
  controller.spawn({
    token: token,
    retry: Infinity
  }).startRTM(function (err, bot, payload) {
    if (err) {
      throw new Error(err)
    }

    console.log('Connected to Slack RTM')
  })
// Otherwise assume multi-team mode - setup beep boop resourcer connection
} else {
  console.log('Starting in Beep Boop multi-team mode')
  require('beepboop-botkit').start(controller, { debug: true })
}

var client = new function Wit({
    accessToken: witToken,
    actions: {
        send(request, response) {
            return new Promise(function (resolve, reject) {
                console.log(JSON.stringify(response))
                return resolve()
            })
        },
        myAction({sessionId, context, text, entities}) {
            console.log(`Session ${sessionId} received ${text}`)
            console.log(`The current context is ${JSON.stringify(context)}`)
            console.log(`Wit extracted ${JSON.stringify(entities)}`)
            return Promise.resolve(context)
        }
    }
})
{'fraction_non_alphanumeric': 0.12321116928446771, 'fraction_numerical': 0.00034904013961605586, 'mean_word_length': 2.8010610079575597, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '689277', 'n_tokens_mistral': 851, 'n_tokens_neox': 847, 'n_words': 237}