Skip to content

Instantly share code, notes, and snippets.

@anderskitson
Created March 2, 2016 04:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anderskitson/3a1703c405c163beb59a to your computer and use it in GitHub Desktop.
Save anderskitson/3a1703c405c163beb59a to your computer and use it in GitHub Desktop.
var Botkit = require('botkit')
var Witbot = require('witbot')
var slackToken = process.env.SLACK_TOKEN
var witToken = process.env.WIT_TOKEN
var controller = Botkit.slackbot({
debug: false
})
controller.spawn({
token: slackToken
}).startRTM(function(err, bot, payload){
if (err){
throw new Error('Error conntecting to slack: ', err)
}
console.log("Connected to slack")
})
var witbot = Witbot(witToken)
controller.hears('.*', 'direct_message,direct_mention', function(bot, message){
witbot.process(message.text, bot, message)
})
witbot.hears('hello', 0.5, function(bot, message, outcome) {
bot.reply(message, 'Hello to you as well!')
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment