centosでhubotとslackを連携させてみた | bgbgbg
でslackとhubotを連携させましたが、#general以外のチャンネルに参加できない..
普通にinviteしてあげたら違うチャンネルに参加できるようです
参加させたいチャンネルで
/invite hubot
としてあげたら
参加出来ました
slackの使い方を覚えたほうがよさそうです
ひびのきろく
centosでhubotとslackを連携させてみた | bgbgbg
でslackとhubotを連携させましたが、#general以外のチャンネルに参加できない..
普通にinviteしてあげたら違うチャンネルに参加できるようです
参加させたいチャンネルで
/invite hubot
としてあげたら
参加出来ました
slackの使い方を覚えたほうがよさそうです
hubotを入れてみた | bgbgbg
のつづきで、hubotとslackを連携させてみました
hubotとslackのadapterはインスト-ルは済んでるところから始めます
slackのintegrationの設定でhubotを追加します
HUBOT_SLACK_TOKEN=xxxxxxxxxxxxxxxxxxxxxxxxxxxx
とかいうTOKENをくれるのでcentosの環境変数に設定します
.bashrcに書いて読み込みました
$ vim ~/.bashrc
export HUBOT_SLACK_TOKEN=xxxxxxxxxxxxxxxxxxxxxxxxxxxx
.bashrcを読み込み直して
$ source ~/.bashrc
起動
$ bin/hubot -a slack
でslack連携hubotが起動します
試しにslackで
hubot ping
hubot img hello
とかすると
となります
hubotをデーモン化します
http://qiita.com/kon_yu/items/cdc452bcd2bb89f85de1
を参考にしました
$ sudo npm install -g forever
したらできあがりでしたが、ちっともHubotが反応せず..
sudo npm install -g coffee-script
してなかったので動きませんでした..
しなおしたら無事できました
hubotを入れてみました
https://hubot.github.com/docs/
を見ながら
$ sudo npm install -g yo generator-hubot
$ yo hubot
Make sure you are in the directory you want to scaffold into.
This generator can also be run with: yo hubot
                     _____________________________  
                    /                              
   //              |      Extracting input for    |
  ////    _____    |   self-replication process   |
 //////  /_____                                / 
 ======= |[^_/_]|   /----------------------------  
  |   | _|___@@__|__                                
  +===+/  ///     _                               
   | |_ /// HUBOT/                             
   |___///      /                              
               /   +---+                            
          ____/    |   |                            
           | //|    +===+                            
            //      |xx|                    
? Owner: sample@sample.co.jp
? Bot name: hubot
? Description: A simple helpful robot for your Company
? Bot adapter: (campfire) slack
? Bot adapter: slack
   create bin/hubot
   create bin/hubot.cmd
   create Procfile
   create README.md
   create external-scripts.json
   create hubot-scripts.json
   create .gitignore
   create package.json
   create scripts/example.coffee
   create .editorconfig
                     _____________________________  
 _____              /                              
                  |   Self-replication process   |
 |    |    _____    |          complete...         |
 |__|   /_____        Good luck with that.    / 
   |//+  |[^_/_]|   /----------------------------  
  |   | _|___@@__|__                                
  +===+/  ///     _                               
   | |_ /// HUBOT/                             
   |___///      /                              
               /   +---+                            
          ____/    |   |                            
           | //|    +===+                            
            //      |xx|                            
adapterはslackを選びました
いちおうgitで管理しておきます
.gitignoreは用意してくれているので
$ git init
$ git add .
$ git commit -m ‘initial commit’
hubotを起こします
$ bin/hubot
hubot> [Wed Apr 29 2015 23:57:48 GMT+0900 (JST)] ERROR hubot-heroku-alive included, but missing HUBOT_HEROKU_KEEPALIVE_URL. heroku config:set HUBOT_HEROKU_KEEPALIVE_URL=$(heroku apps:info -s  | grep web_url | cut -d= -f2)
[Wed Apr 29 2015 23:57:49 GMT+0900 (JST)] INFO Using default redis on localhost:6379
hubot>
で立ち上がりました
話しかけます
hubot> hubot ping
PONG
PONGと返事がきました
ひとまずここまで
npmでパッケージ一覧を見る
$ npm list -g
インストールする
$ npm install  -g (パッケージ名)
$ npm i  -g (パッケージ名)
アンインストールする
$ npm uninstall -g (パッケージ名)
$ npm remove -g (パッケージ名)
$ npm r -g (パッケージ名)
とりあえずこれだけでしのげています