HUBOTに最初から含まれているサンプルのスクリプト(math.coffee、pugme.coffee、youtube.coffee等)を利用すると、以下のような警告が出るケースがある。
Hubot> hubot math me 1 + 2
Hubot> [Mon Jul 15 2013 00:22:55 GMT+0900 (JST)] WARNING @http() is going to be deprecated in 3.0.0 use @robot.http()
3
Hubot>
警告が出ている理由はResponseクラスのhttpメソッドを利用しているためである(ResponseクラスのhttpメソッドはHUBOTのバージョン3.0.0で廃止予定と言っている)。
実際に警告を出している場所は以下(response.coffee)。
class Response
... snip ...
http: (url) ->
@robot.logger.warning '@http() is going to be deprecated in 3.0.0 use @robot.http()'
@robot.http(url)
module.exports = Response
この警告を消すにはResponseクラスのhttpメソッドを利用する変わりに、Robotクラスのhttpメソッドを利用すれば良い。
具体的には以下のようにmath.coffeeを修正する。
module.exports = (robot) ->
robot.respond /(calc|calculate|convert|math|maths)( me)? (.*)/i, (msg) ->
# msg.httpの変わりにrobot.httpを使う
# msg
robot
.http('https://www.google.com/ig/calculator')
.query
hl: 'en'
q: msg.match[3]
... snip ...
【備考】
ver 2.6.0以降ではyoutube.coffeeは@robot.http()を利用するように修正されている。また、Responseクラスも警告メッセージを出さないよう修正されている。