这是我的代码:
module.exports = (robot) ->
robot.hear /check gender for (.*)/i, (res) ->
personName = escape(res.match[1])
res.http("https://api.genderize.io/?name=" + personName)
.header('Accept', 'application/json')
.get() (error, response, body) ->
try
json = JSON.parse(body)
res.send "Probability of " + "#{json.probability}" + " that " + personName + " is a " + "#{json.gender}.\n"
catch error
res.send "something went wrong... #{error}"
例如,当我键入“检查鲍勃性别”时,我总是收到一条错误消息,提示“ ReferenceError”。有人知道如何解决这个问题吗?