Hubot服务台:如果x不在,则回复错误



我允许hubot与slack集成,充当服务台。

到目前为止,脚本(coffeescript(会查找关键字,如果关键字不存在,那么我需要hubot返回类似"对不起,我找不到你要查找的内容"的内容。

以下是关键字查询的示例;

module.exports = (robot) ->
robot.hear /ansible/i, (res) ->
res.send "Hi, for all ansible related querys, please go to 
www.github.com/ansible/ansiblehelp"

例如,如果答案不在问题中,hubot需要回答"对不起,我找不到你要找的东西"。

这可能吗?

感谢

尝试使用catchAll子句来提供默认响应:

module.exports = (robot) ->
robot.catchAll (msg) ->
if msg.message.match /// ^#{robot.name}s ///
msg.reply "Sorry I can't find what you are looking for"

应答源

类似答案

最新更新