在hubot coffeescript中匹配用户Query的问题

时间:2017-04-27 10:33:53

标签: elasticsearch hubot

我已经整合了Slack - Hubot - Elasticsearch。这是为了从松弛中查询弹性搜索。

首先,我们为hubot中的群集指定别名,以便添加到其大脑中。

现在,我在coffescript中提到了一个查询,如下所示,

 robot.hear /nodes (.*)/i, (msg) ->
    if msg.message.user.id is robot.name
      return

    catNodes msg, msg.match[1], (text) ->
      msg.send text

当用户查询松散的东西以及任何工作与节点匹配时,应该给我输出。

当我查询"为我提供节点列表iris" ,它给了我正确的输出。

如果有人查询"为我提供虹膜中的节点列表"它给了我

  

无法识别群集别名:in iris

在查询中的节点抛出错误输出之后我给出的任何内容。

我该如何解决这个问题......

1 个答案:

答案 0 :(得分:0)

这个问题实际上是在hubot问题跟踪器上得到了解答

https://github.com/github/hubot/issues/1310

提取物:

也许你可以使用像

这样的东西
robot.hear /nodes(?: in| for| at| on}? (\w+)/i, (msg) ->