2
1

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.

errBot を導入して Slack と連携させてみる

Posted at

errBot のインストール

$ mkvirtualenv -p `which python3` errenv
(errenv) $ pip install errbot
(errenv) $ mkdir mybot
(errenv) $ cd mybot/
(errenv) ~/mybot$ errbot --init
Your Errbot directory has been correctly initialized !
Just do "errbot" and it should start in text/development mode.

errBot を起動してみる

(errenv) ~/mybot$ errbot

bot のコンソールが起動するのでコマンドを入力してみる

 >>> !tryme
It works !

コンソールを終了するには python のコンソールと同じように Ctrl + DCtrl + C

slackclient のインストール

(errenv) $ pip install slackclient

errbot 設定ファイルの編集

(errenv) $ vi ~/mybot/config.py

設定ファイルのテンプレート
https://raw.githubusercontent.com/errbotio/errbot/master/errbot/config-template.py

とりあえず BACKENDBOT_ADMINSBOT_IDENTITY だけ変更しておく

import logging

BACKEND = 'Slack'

-- snip --

BOT_ADMINS = ('@xxxx', )
BOT_IDENTITY = {
    'token': 'xoxb-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
}

slack の token は
https://my.slack.com/services/new/bot
から取得

errbot をデーモンとして起動

(errenv) $ errbot --daemon

適当なチャンネルに bot を招待してテストしてみる

スクリーンショット 2016-09-12 15.30.39.png

2
1
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
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?