<commit_before>require('dotenv').config()
const Botkit = require('botkit');
const request = require('request');


if (!process.env.SLACK_API_TOKEN || !process.env.RECRUIT_TALK_API_TOKEN) {
  console.log('Error: Specify token in environment');
  process.exit(1);
}

const controller = Botkit.slackbot({ debug: true });
controller.spawn({ token: process.env.SLACK_API_TOKEN }).startRTM(function(err){
  if (err) {
    throw new Error(err);
  }
});


// comunications
controller.hears(
  '',
  ['direct_message', 'direct_mention', 'mention'],
  function(bot, message) {
    const options = {
      uri: "https://api.a3rt.recruit-tech.co.jp/talk/v1/smalltalk",
      method: 'POST',
      headers: {
        "Content-type": "application/x-www-form-urlencoded",
      },
      json: true,
      form: {
        "apikey": process.env.RECRUIT_TALK_API_TOKEN,
        "query": message.text
      }
    };

    request.post(options, function(error, response, body){
      console.log("デバグ")
      console.log(body)
      if(body.status === 0 ) {
        bot.reply(message, body.results[0].reply);
      else if(body.status === 2000 ) {
        bot.reply(message, 'あ、そういうの分かんないんで');
      } else {
        bot.reply(message, '故障中！故障中！');
      }
    });
  }
);

<commit_msg>fix a bug<commit_after>require('dotenv').config()
const Botkit = require('botkit');
const request = require('request');


if (!process.env.SLACK_API_TOKEN || !process.env.RECRUIT_TALK_API_TOKEN) {
  console.log('Error: Specify token in environment');
  process.exit(1);
}

const controller = Botkit.slackbot({ debug: true });
controller.spawn({ token: process.env.SLACK_API_TOKEN }).startRTM(function(err){
  if (err) {
    throw new Error(err);
  }
});


// comunications
controller.hears(
  '',
  ['direct_message', 'direct_mention', 'mention'],
  function(bot, message) {
    const options = {
      uri: "https://api.a3rt.recruit-tech.co.jp/talk/v1/smalltalk",
      method: 'POST',
      headers: {
        "Content-type": "application/x-www-form-urlencoded",
      },
      json: true,
      form: {
        "apikey": process.env.RECRUIT_TALK_API_TOKEN,
        "query": message.text
      }
    };

    request.post(options, function(error, response, body){
      console.log("デバグ")
      console.log(body)
      if(body.status === 0 ) {
        bot.reply(message, body.results[0].reply);
      } else if(body.status === 2000 ) {
        bot.reply(message, 'あ、そういうの分かんないんで');
      } else {
        bot.reply(message, '故障中！故障中！');
      }
    });
  }
);


{'fraction_non_alphanumeric': 0.1714172604908947, 'fraction_numerical': 0.007125890736342043, 'mean_word_length': 2.9858044164037856, 'pattern_counts': {'":': 6, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '2570521', 'n_tokens_mistral': 920, 'n_tokens_neox': 898, 'n_words': 144}