Created
May 4, 2018 06:28
-
-
Save IbrahimTareq/6550c7851ecc3cbb6c1124c30635c6aa to your computer and use it in GitHub Desktop.
Start-up code for your Slackbot
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
// Add support for environmental variables | |
require('dotenv/config'); | |
// Import botkit package | |
var Botkit = require('botkit'); | |
// Create a controller for the Slackbot | |
var controller = Botkit.slackbot({ | |
debug: false | |
}); | |
// Use the token to connect the bot to your Slack app | |
controller.spawn({ | |
token: process.env.TOKEN | |
}).startRTM(); | |
// Determine behaviour of the Slackbot | |
controller.hears(['hello', 'hi'], ['ambient', 'direct_mention', 'mention'], function (bot, message) { | |
bot.reply(message, "Hello."); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment