Last active
May 14, 2016 19:37
-
-
Save perfectmak/35bc2cede4c506f9b80578a163674d8f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const pinger = require('./ping-bot'); | |
const Botkit = require('botkit'); | |
//require beepboop's library | |
const BeepBoop = require('beepboop-botkit'); | |
//as usual, initialize a slackbot controller | |
const controller = Botkit.slackbot(); | |
/** | |
* But instead of spawning a process, you pass the controller to BeepBoop. | |
* BeepBoop handles managing processes for different teams that install your app, | |
* and it routes all the required controller events to make it easy to handle. | |
*/ | |
const beepboop = BeepBoop.start(controller, { | |
debug: true //you might want to enable debug for testing :) | |
}); | |
//then as usual handle when a direct message or direct mention event is triggered | |
controller.on(['direct_message', 'direct_mention'], (bot, message) => { | |
pinger(message.text, (response) => { | |
bot.reply(message, response); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment