{"size": 606, "ext": "js", "max_stars_repo_path": "skills/reply.js", "max_stars_repo_name": "sri-akshat/jarvis", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "skills/reply.js", "max_issues_repo_name": "sri-akshat/jarvis", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "skills/reply.js", "max_forks_repo_name": "sri-akshat/jarvis", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 33.6666666667, "max_line_length": 102, "alphanum_fraction": 0.7706270627}
var RtmClient = require('@slack/client').RtmClient;
var RTM_EVENTS = require('@slack/client').RTM_EVENTS;
var APIAI_SERVICE = require('./apiai/apiaiService.js');

var bot_token = process.env.npm_package_config_SLACK_BOT_TOKEN || '';
var rtm = new RtmClient(bot_token);
rtm.start();

var successCallback = function(response,message){
    rtm.sendMessage(response.result.fulfillment.speech, message.channel);
}

var errorCallback = function(error,message){
    rtm.sendMessage(error, message.channel);
}

rtm.on(RTM_EVENTS.MESSAGE, APIAI_SERVICE.getResponse.bind(this, rtm, successCallback, errorCallback));
