Hubotでusing deprecated documentation syntax

More than 3 years have passed since last update.

ping.coffeeをping.jsへ書き換えようとしたときに生じたエラー(?


もとのping.coffee

# Description:

# Utility commands surrounding Hubot uptime.
#
# Commands:
# hubot ping - Reply with pong
# hubot echo <text> - Reply back with <text>
# hubot time - Reply with current time
# hubot die - End hubot process

module.exports = (robot) ->
robot.respond /PING$/i, (msg) ->
msg.send "PONG!"

robot.respond /ADAPTER$/i, (msg) ->
msg.send robot.adapterName

robot.respond /ECHO (.*)$/i, (msg) ->
msg.send msg.match[1]

robot.respond /TIME$/i, (msg) ->
msg.send "Server time is: #{new Date()}"

robot.respond /DIE$/i, (msg) ->
msg.send "Goodbye, cruel world."
process.exit 0

ここから単純なコマンドでここだけ抜き出そうとしたら、

module.exports = (robot) ->

robot.respond /PING$/i, (msg) ->
msg.send "PONG!"

実行するとこんなメッセージが

[Tue Oct 14 2014 18:50:59 GMT+0900 (JST)] INFO /Users/ryousuke/Sites/offside/hubot/scripts/bbpull.js is using deprecated documentation syntax


descriptionを入れる必要があるみたい

たぶんドキュメントに書いてるんだろうけど..

# Description:

# Utility commands surrounding Hubot uptime.
#
# Commands:
# hubot ping - Reply with pong
# hubot echo <text> - Reply back with <text>
# hubot time - Reply with current time
# hubot die - End hubot process

module.exports = (robot) ->
robot.respond /PING$/i, (msg) ->
msg.send "PONG!"


js変換するとこんな感じです。 commandsは無くても問題ないかも。

// Description:

// Messing around with the today API.
// Commands:
// hubot today - Return today at random.

module.exports = function(robot) {
return robot.respond(/BBB$/i, function(msg) {
return msg.send("PONGbbb!");
});
};


まとめ

hubotはコメントアウトのメッセージまで読み込んでたんですね。