Last active
October 10, 2016 04:47
Revisions
-
carpeliam revised this gist
Oct 10, 2016 . No changes.There are no files selected for viewing
-
carpeliam created this gist
Oct 10, 2016 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,9 @@ --- applications: - name: your-app-here command: node slack.js # no-route: true health-check-type: none domain: cfapps.io env: SLACK_API_TOKEN: your-token-here This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ { "name": "wow, what a cool slack bot you just created", "version": "1.0.0", "description": "build whatever you can imagine", "scripts": { "test": "echo \"Error: no test specified... yet!\" && exit 1" }, "keywords": [ "slack", "bot" ], "author": "This is you", "license": "open source is good! open source your bot and add your license here", "dependencies": { "botkit": "^0.4.0" } } This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,28 @@ var Botkit = require('botkit'); var token = process.env.SLACK_API_TOKEN || ''; var controller = Botkit.slackbot({ debug: process.env.NODE_ENV !== 'production' //include "log: false" to disable logging //or a "logLevel" integer from 0 to 7 to adjust logging verbosity }); // connect the bot to a stream of messages controller.spawn({ token: token }).startRTM(); // give the bot something to listen for. controller.hears('reserve', [ 'direct_message', 'direct_mention', 'mention' ], function(bot, message) { bot.reply(message, 'You just reserved a spot. Well, not really.'); } ); controller.hears('remove me', [ 'direct_message', 'direct_mention', 'mention' ], function(bot, message) { bot.reply(message, 'Thanks for letting me know! I\'ll remove you from the queue. Well, not really.'); } );