LoginSignup
7
7

More than 5 years have passed since last update.

Hubot | Hubotの shell adapter を試す

Posted at

Hubot | Hubotの shell adapter を試す

概要

Hubotの shell adapter を試します。

Shell Adapter 検証用のボットを作成

$ hubot --create shell_hubot
$ cd shell_hubot

Hubotの起動

$ bin/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 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 what role does <user> have - Find out what roles are assigned to a specific 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.
ship it - Display a motivation squirrel

help command

個別コマンドのヘルプを表示します

Hubot> Hubot help ship it
Hubot> ship it - Display a motivation squirrel
Hubot> http://images.cheezburger.com/completestore/2011/11/2/aa83c0c4-2123-4bd3-8097-966c9461b30c.jpg

animate me

指定ワードへのアニメーションGIFへのリンクを返却。
下記の例は猫画像へのリンク。

Hubot> hubot animate me cat
Hubot> http://big.assets.huffingtonpost.com/1120cat.gif

echo

Hubot> hubot echo hoge
Hubot> hoge

map me

指定ワードの地図へのリンクを返却

Hubot> Hubot map me japan
Hubot> http://maps.google.com/maps/api/staticmap?markers=japan&size=400x400&maptype=roadmap&sensor=false&format=png
Hubot> http://maps.google.com/maps?q=japan&hl=en&sll=37.0625,-95.677068&sspn=73.579623,100.371094&vpsrc=0&hnear=japan&t=m&z=11

pug me

パグ画像へのリンクを返却

Hubot> Hubot pug me
Hubot> http://26.media.tumblr.com/tumblr_lk0hdcDvTa1qjoblyo1_500.jpg

pug bomb N

パグ画像へのリンクを指定件数分返却

Hubot> Hubot pug bomb 5
Hubot> http://25.media.tumblr.com/tumblr_lirbk7KDNc1qb166so1_500.jpg
Hubot> http://24.media.tumblr.com/tumblr_lii05kwp5A1qb08qmo1_500.jpg
Hubot> http://25.media.tumblr.com/tumblr_ltc8tzPvTT1qd5kcqo1_500.jpg
Hubot> http://29.media.tumblr.com/tumblr_ll267csxAQ1qb08qmo1_500.jpg
Hubot> http://27.media.tumblr.com/tumblr_ls6tpnEwe71r3ip8io1_500.jpg

ship it

リリースするぞ!という雰囲気のリスの画像。
日本語の「リス」と「リ リース 」が少しかかっているのは偶然なのか。

Hubot> ship it
Hubot> https://img.skitch.com/20111026-r2wsngtu4jftwxmsytdke6arwd.png

the rules

ロボットの三原則を表示する

Hubot> Hubot the rules
Hubot> 1. A robot may not injure a human being or, through inaction, allow a human being to come to harm.
2. A robot must obey any orders given to it by human beings, except where such orders would conflict with the First Law.
3. A robot must protect its own existence as long as such protection does not conflict with the First or Second Law.

time

Hubot> Hubot time
Hubot> Server time is: Tue Aug 05 2014 23:48:00 GMT+0900 (JST)

補足

上記の利用例の画像系のURLは実際にHubotが出力したものなので、
どんな画像なのか気になる人はリンク先を参照ください。

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