0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

opalでbotkitを使った最小限slack bot

Last updated at Posted at 2017-03-16

下準備

  • botkit
> npm init
> npm install botkit --save
  • opal
> gem install opal

ソース

  • app.rb
require 'opal'
require 'native'

`const Botkit = require('botkit');`

token="[APIトークン]"

controller = Native(`Botkit.slackbot()`)

controller.spawn({ "token" => token }).startRTM do |err|
    if err
        exit
    end
end

controller.hears('hi', ['direct_message', 'direct_mention', 'mention'], Proc.new do |bot, msg|
    Native(`bot`).reply(msg, 'hi')
end)

~

実行

> opal -c app.rb > app.js
> node app.js
0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?