さてようやくHubotの開発準備が整ったので
以下を参考にHelloworldを書いてみました。

# hubot --create whisper
# cd whisper/
# chmod +x bin/hubot
# bin/hubot
npm http GET http://registry.npmjs.org/hubot/2.3.2
npm http GET http://registry.npmjs.org/hubot-scripts
npm http GET http://registry.npmjs.org/optparse/1.0.3
npm http 200 http://registry.npmjs.org/hubot-scripts
npm http GET http://registry.npmjs.org/hubot-scripts/-/hubot-scripts-2.5.16.tgz
npm http 304 http://registry.npmjs.org/optparse/1.0.3
npm http 200 http://registry.npmjs.org/hubot/2.3.2
npm http GET http://registry.npmjs.org/hubot/-/hubot-2.3.2.tgz
npm http 200 http://registry.npmjs.org/hubot-scripts/-/hubot-scripts-2.5.16.tgz
npm http 200 http://registry.npmjs.org/hubot/-/hubot-2.3.2.tgz
npm http GET http://registry.npmjs.org/coffee-script/1.3.3
npm http GET http://registry.npmjs.org/scoped-http-client/0.9.7
npm http GET http://registry.npmjs.org/log/1.3.0
npm http GET http://registry.npmjs.org/connect/2.3.4
npm http GET http://registry.npmjs.org/connect_router/1.8.6
npm http 304 http://registry.npmjs.org/log/1.3.0
npm http 304 http://registry.npmjs.org/scoped-http-client/0.9.7
npm http 304 http://registry.npmjs.org/connect_router/1.8.6
npm http 304 http://registry.npmjs.org/connect/2.3.4
npm WARN deprecated connect_router@1.8.6: Please use https://github.com/expressjs/urlrouter instead. Note that some bugfixes introduced in urlrouter may cause unexpected behavior in a few rare edge cases.
npm http 304 http://registry.npmjs.org/coffee-script/1.3.3
npm http GET http://registry.npmjs.org/qs/0.4.2
npm http GET http://registry.npmjs.org/mime/1.2.4
npm http GET http://registry.npmjs.org/formidable/1.0.11
npm http GET http://registry.npmjs.org/crc/0.2.0
npm http GET http://registry.npmjs.org/cookie/0.0.4
npm http GET http://registry.npmjs.org/fresh/0.0.1
npm http GET http://registry.npmjs.org/bytes/0.0.1
npm http GET http://registry.npmjs.org/range-parser/0.0.4
npm http GET http://registry.npmjs.org/debug
npm http 304 http://registry.npmjs.org/cookie/0.0.4
npm http 304 http://registry.npmjs.org/mime/1.2.4
npm http 304 http://registry.npmjs.org/crc/0.2.0
npm http 304 http://registry.npmjs.org/fresh/0.0.1
npm http 304 http://registry.npmjs.org/debug
npm http 304 http://registry.npmjs.org/range-parser/0.0.4
npm http 304 http://registry.npmjs.org/bytes/0.0.1
npm http 304 http://registry.npmjs.org/qs/0.4.2
npm http 304 http://registry.npmjs.org/formidable/1.0.11
npm http GET http://registry.npmjs.org/ms/0.6.2
npm http 304 http://registry.npmjs.org/ms/0.6.2
npm http GET http://registry.npmjs.org/redis/0.8.4
npm http 200 http://registry.npmjs.org/redis/0.8.4
npm http GET http://registry.npmjs.org/redis/-/redis-0.8.4.tgz
npm http 200 http://registry.npmjs.org/redis/-/redis-0.8.4.tgz
optparse@1.0.3 ./node_modules/optparse
hubot@2.3.2 ./node_modules/hubot
tqq connect_router@1.8.6
tqq log@1.3.0
tqq scoped-http-client@0.9.7
tqq coffee-script@1.3.3
mqq connect@2.3.4
hubot-scripts@2.5.16 ./node_modules/hubot-scripts
mqq redis@0.8.4
path.exists is now called `fs.exists`.
Hubot> [Sun Jan 11 2015 09:33:32 GMT+0900 (JST)] ERROR Unable to load /root/whisper/node_modules/hubot-scripts/src/scripts/redis-brain: TypeError: Object #<Brain> has no method 'setAutoSave'
TypeError: Object #<Brain> has no method 'setAutoSave'
    at module.exports (/root/whisper/node_modules/hubot-scripts/src/scripts/redis-brain.coffee:13:17)
    at Robot.loadFile (/root/whisper/node_modules/hubot/src/robot.coffee:146:24)
    at Robot.loadHubotScripts (/root/whisper/node_modules/hubot/src/robot.coffee:160:28)
    at /root/whisper/node_modules/hubot/bin/hubot💯26
    at fs.js:272:14
    at Object.oncomplete (fs.js:108:15)
[Sun Jan 11 2015 09:33:33 GMT+0900 (JST)] ERROR Unable to load /root/whisper/node_modules/hubot-scripts/src/scripts/tweet: Error: Cannot find module 'ntwitter'
Error: Cannot find module 'ntwitter'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/root/whisper/node_modules/hubot-scripts/src/scripts/tweet.coffee:4:14)
    at Object.<anonymous> (/root/whisper/node_modules/hubot-scripts/src/scripts/tweet.coffee:61:4)
    at Module._compile (module.js:456:26)
    at Object.require.extensions..coffee (/root/whisper/node_modules/hubot/node_modules/coffee-script/lib/coffee-script/coffee-script.js:22:21)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
[Sun Jan 11 2015 09:33:33 GMT+0900 (JST)] ERROR Error: Redis connection to localhost:6379 failed - connect ECONNREFUSED

Hubot>


なんかめちゃくちゃエラー出ましたけど。。。w
とりあえずプロンプトが出たのでOK。

Hubot> hubot help
Hubot> 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 convert me <expression> to <units> - Convert expression to given units.
hubot die - End hubot process
hubot echo <text> - Reply back with <text>
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 math me <expression> - Calculate the given expression.
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>
Hubot> exit

なんか動いているようです。
さっそくHelloWorldを書いてみます。

# vi scripts/hello.coffee

----
# Description:
#   Hubotと挨拶.
#
# Commands:
#   hubot hello - Reply with hello

# Hubotのスクリプトはモジュールとして記述し,
# Hubot起動時にrequireされてexportした関数が呼び出されます
module.exports = (robot) ->
  robot.respond /HELLO$/i, (msg) ->
    msg.send "こんにちは。景太さん。何か御用でうぃすか?"
    msg.send "こんにちは。景太さん。何か御用でうぃすか?"
    msg.send "大事な事でうぃすから2回言いましたでうぃすよ。"
---

# bin/hubot
path.exists is now called `fs.exists`.
Hubot> [Mon Jan 12 2015 23:08:24 GMT+0900 (JST)] ERROR Unable to load /root/whisper/node_modules/hubot-scripts/src/scripts/redis-brain: TypeError: Object #<Brain> has no method 'setAutoSave'
TypeError: Object #<Brain> has no method 'setAutoSave'
    at module.exports (/root/whisper/node_modules/hubot-scripts/src/scripts/redis-brain.coffee:13:17)
    at Robot.loadFile (/root/whisper/node_modules/hubot/src/robot.coffee:146:24)
    at Robot.loadHubotScripts (/root/whisper/node_modules/hubot/src/robot.coffee:160:28)
    at /root/whisper/node_modules/hubot/bin/hubot💯26
    at fs.js:272:14
    at Object.oncomplete (fs.js:108:15)
[Mon Jan 12 2015 23:08:24 GMT+0900 (JST)] ERROR Unable to load /root/whisper/node_modules/hubot-scripts/src/scripts/tweet: Error: Cannot find module 'ntwitter'
Error: Cannot find module 'ntwitter'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/root/whisper/node_modules/hubot-scripts/src/scripts/tweet.coffee:4:14)
    at Object.<anonymous> (/root/whisper/node_modules/hubot-scripts/src/scripts/tweet.coffee:61:4)
    at Module._compile (module.js:456:26)
    at Object.require.extensions..coffee (/root/whisper/node_modules/hubot/node_modules/coffee-script/lib/coffee-script/coffee-script.js:22:21)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
[Mon Jan 12 2015 23:08:24 GMT+0900 (JST)] ERROR Error: Redis connection to localhost:6379 failed - connect ECONNREFUSED

Hubot>
Hubot> hubot hello
Hubot> こんにちは。景太さん。何か御用でうぃすか?
Hubot> こんにちは。景太さん。何か御用でうぃすか?
Hubot> 大事な事でうぃすから2回言いましたでうぃすよ。
Hubot>

よし!できた。
相変わらず起動時にエラーがでるけど問題なく動くようです。
もちろんキャラクターはこれ。
http://www.tv-tokyo.co.jp/anime/youkai-watch/sp/chara/

(C)LEVEL-5/妖怪ウォッチプロジェクト・テレビ東京


エラーは tweet.coffee が原因なのかな?
ついったーの何かなのかな。っと。

あと、(msg) -> の中身は複数行かけるんだということが分かった。

一歩前進。