【问题标题】:botkit-sms: Integrating middleware pluginbotkit-sms:集成中间件插件
【发布时间】:2017-04-28 06:29:14
【问题描述】:

我正在尝试 api.ai 中间件插件与 botkit-sms,我正在尝试调试源代码,为什么这不起作用,但如果你能提供一些输入会有所帮助

库源代码https://github.com/krismuniz/botkit-sms/

var apiai = require('botkit-middleware-apiai')({
  token: '...',
  skip_bot: true // or false. If true, the middleware don't send the bot reply/says to api.ai
})

controller.middleware.receive.use(apiai.receive)

controller.hears('.*', 'message_received', apiai.hears, function (bot, message) {
  console.log('received :: ' + message)
  bot.reply(message, 'got the message')
})

【问题讨论】:

    标签: node.js botkit


    【解决方案1】:

    在这里将apiai.hears 传递给hears 函数会改变模式匹配和hears 的工作方式。您现在正在匹配意图,而不是用户在用户输入上使用正则表达式。

    但问题是匹配时API.ai middleware uses an === operator,而不是正则表达式。所以模式.* 不会匹配任何东西,除非你有一个名为它的意图。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-09-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多