Skip to content

Instantly share code, notes, and snippets.

@o0h
Created October 13, 2018 13:17
Show Gist options
  • Select an option

  • Save o0h/398adbecb6946b41ece752dca2399c01 to your computer and use it in GitHub Desktop.

Select an option

Save o0h/398adbecb6946b41ece752dca2399c01 to your computer and use it in GitHub Desktop.
Slack用の最低限のbotkit
// obtain from:
// Botkitで最小構成のSlack Bot https://qiita.com/nobukatsu/items/88917a2348628244bc42
// howdyai/botkit https://github.com/howdyai/botkit
const botkit = require('botkit')
const controller = botkit.slackbot({ debug: true })
controller.hears('hello', ['direct_message', 'direct_mention'], (bot, message) => {
bot.reply(message, 'Hello yourself!')
})
controller
.spawn({
token: process.env.SLACK_TOKEN
})
.startRTM(function(err) {
if (err) {
throw new Error(err)
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment