なみひらブログ

学んだことを日々記録する。~ since 2012/06/24 ~

Hubotを動かす@windows 【インストール~起動まで】

Botツール「Hubot」をwindowsで動かしたときのメモ。
自PCのOSはwindows 7です。以下の操作は全てコマンドプロンプトで実行します。
#本当はLinux系マシンでセットアップしたほうが楽ですが、手持ちのLinux系マシンがないもので。。。

Node.jsのインストール

Hubotを動かすにはNode.jsが必要なので、先にNode.jsでインストールする必要があります。
以下を参考にしました。特にトラブルはありませんでした。
[7]「Node.js」のインストール

Hubotのインストール

ここまでできたら、Hubotのインストールします。
引き続き、以下を参照しました。
[10] npmを用いたHubotのインストール

ハマったポイント

  • プロシキ経由でインターネットにつないでいる場合「npm」コマンドにてプロシキ設定をする必要があります。

npm config set proxy http://{ユーザ名}:{パスワード}@{プロシキサーバ}:{ポート}

  • npmにてインストールに失敗する場合、以下を設定する(リポジトリ設定)。

npm config set registry http://registry.npmjs.org/

Hubotの起動

Hubotのフォルダで以下のコマンドを実行します。※Hubotのフォルダは似たような名前が多いので、どこに今いるのか迷子になります。。。

node node_modules/coffee-script/bin/coffee bin/hubot

起動したら、以下のコマンドを実行してみましょう。

hubot help

コマンド一覧が出たかと思います。

Hubot> hubot help
Hubot> Events:
debug - {user: <user object to send message to>}
Hubot <user> doesn't have <role> role - Removes a role from a user
Hubot <user> has <role> role - Assigns a role to a user
Hubot <user> is a badass guitarist - assign a role to a user
Hubot <user> is not a badass guitarist - remove a role from a user
Hubot animate me <query> - The same thing as `image me`, except adds a few param
eters to try to return an animated GIF instead.
Hubot convert me <expression> to <units> - Convert expression to given units.
Hubot die - End Hubot process
Hubot echo <text> - Reply back with <text>
Hubot fake event <event> - Triggers the <event> event for debugging reasons
Hubot help - Displays all of the help commands that Hubot knows about.
Hubot help <query> - Displays all help commands that match <query>.
Hubot image me <query> - The Original. Queries Google Images for <query> and ret
urns a random top result.
Hubot map me <query> - Returns a map view of the area returned by `query`.
Hubot math me <expression> - Calculate the given expression.
Hubot mustache me <query> - Searches Google Images for the specified query and m
ustaches it.
Hubot mustache me <url> - Adds a mustache to the specified URL.
Hubot ping - Reply with pong
Hubot pug bomb N - get N pugs
Hubot pug me - Receive a pug
Hubot show storage - Display the contents that are persisted in the brain
Hubot show users - Display all users that Hubot knows about
Hubot the rules - Make sure Hubot still knows the rules.
Hubot time - Reply with current time
Hubot translate me <phrase> - Searches for a translation for the <phrase> and th
en prints that bad boy out.
Hubot translate me from <source> into <target> <phrase> - Translates <phrase> fr
om <source> into <target>. Both <source> and <target> are optional
Hubot what role does <user> have - Find out what roles are assigned to a specifi
c user
Hubot who has admin role - Find out who's an admin and can assign roles
Hubot who is <user> - see what roles a user has
Hubot youtube me <query> - Searches YouTube for the query and returns the video
embed link.

コマンドプロンプト上ではありますが、Hubotと会話できるようになりました\(^o^)/

#次は、IRCにつなぐ方法について記載する予定です。