Hubot | Hubot の core scripts の別名呼び出し
概要
Hubot をインストールすると、はじめに付属してくる core scripts があります。
CoreScript GitHub
https://github.com/github/hubot/tree/master/src/scripts
例えば、パグの画像 URL を返却する pug me や、
ロボット三原則を返却する rules などがあります。
各コマンドは正規表現で文字列をチェックして、対応する文字列なら処理を行うようにできていますが、
rubocop help は正規表現の呼び出し方のうち1つだけしか記載していません。
ソースコードをみないと、本当はここで挙げるような呼び出し方ができることが分からなくなっています。
確認したバージョン
hubot-2.4.7。2014/08/13時点の最新は 2.8.0 ですが、
kandan と連携して使っている都合上、 2.4.7 で確認しています。
Kandan + Hubot についてはこちらを参照。
http://qiita.com/tbpgr/items/73b68cec23888d4570cf
help に明示されている内容
help を見てみましょう。
ここに記述されていない内容を、隠しコマンドとして説明します。
Events:
debug - {user: <user object to send message to>}
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 parameters to try to return an animated GIF instead.
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 returns a random top result.
hubot map me <query> - Returns a map view of the area returned by `query`.
hubot mustache me <query> - Searches Google Images for the specified query and mustaches 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 then prints that bad boy out.
hubot translate me from <source> into <target> <phrase> - Translates <phrase> from <source> into <target>. Both <source> and <target> are optional
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.
ship it - Display a motivation squirrel
hubot help からは読み取れない呼び出し方があるコマンド群
※2014/08/13 時点の情報
command | 内容 | ソースコード |
---|---|---|
satellite map me <query> | helpには map me <query> しか記述されていませんが、 マップ タイプを指定可能です。 Google Earth の航空写真を表示します。 |
maps.coffee |
terrain map me <query> | helpには map me <query> しか記述されていませんが、 マップ タイプを指定可能です。 通常のビューと航空写真を混合して表示します。 |
maps.coffee |
hybrid map me <query> | helpには map me <query> しか記述されていませんが、 マップ タイプを指定可能です。 地形情報に基づいて物理的なマップ タイルを表示します。 |
maps.coffee |
/(what are )?the (three|3 )?(rules|laws)/i | helpには the rules しか記述されていませんが、 左記の正規表現に一致すれば同様の結果を返却します。 |
rules.coffee |
animate( me)? (.*) | helpには animate me しか記述されていませんが、 左記の正規表現に一致すれば同様の結果を返却します。 最もシンプルに呼び出すなら animate <query> |
google-images.coffee |
(image|img)( me)? (.*) | helpには image me しか記述されていませんが、 左記の正規表現に一致すれば同様の結果を返却します。 最もシンプルに呼び出すなら img <query> |
google-images.coffee |
/(?:mo?u)?sta(?:s|c)he?(?: me)? (.*)/i | helpには mustache me しか記述されていませんが、 左記の正規表現に一致すれば同様の結果を返却します。 最もシンプルに呼び出すなら stache <query> |
google-images.coffee |
pug bomb | helpにはpug bomb N しか記述されていませんが、 Nを省略するとデフォルトで5件のパグ画像を返却します |
pugme.coffee |
how many pugs are there | ヘルプに明記されていないコマンド。 http://pugme.herokuapp.com で 扱っているパグ画像の数を返却します |
pugme.coffee |
参照