LoginSignup
0
1

More than 5 years have passed since last update.

hubot

Last updated at Posted at 2018-09-09

昔やった時に残したテキストが出てきたので、こっちに移しておく。
あくまで自分用。

rootパスワード変更

alfas123@localhost:~$ sudo passwd root
[sudo] password for alfas123:
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

sudoにユーザー追加

#sudo gpasswd -a ユーザー名 sudo

$は一旦落ちて、再度ログインしないと駄目。

gitインストール

$sudo apt-get install git

node.jsインストール

$curl -L https://deb.nodesource.com/setup_6.x | sudo bash -
$sudo apt-get install -y nodejs

hubotをインストールしてテンプレート作成

$sudo npm install -g yo generator-hubot

$mkdir myhubot
$cd myhubot
$yo hubot

? Owner alfas123
? Bot name hellobot
? Description A simple helpful robot for your Company
? 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

怒られるので、不要なhubot-scripts.jsonを破棄して、external-scripts.jsonの要らない行を削除。

/myhubot$ rm hubot-scripts.json
/myhubot$ vi external-scripts.json
bin/hubot

 

slackのApps&integrations

hubotは検索して選ぶ。APItokenを手に入れる。
 

シェル作成
/myhubot$ vi hellobot.sh

#!/bin/sh
export HUBOT_SLACK_TOKEN=xoxb-123456789012-xxxxxxxxxxxxxxxxxxxxxxxx
./bin/hubot --adapter slack
/myhubot$ chmod u+x hellobot.sh
実行
/myhubot$ ./hellobot.sh

foreverのインストールとデーモン化

$sudo npm install forever -g
$forever start -w -c coffee node_modules/.bin/hubot --adapter slack

 

 

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