BotKit-SMS:集成中间件插件



我正在尝试使用botkit-sms到api.ai中间件插件,我正在尝试调试源代码,为什么它不起作用,但是如果可以的话,将会有所帮助提供一些输入

库的源代码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')
})

apiai.hears传递到听觉功能的功能,改变了模式匹配和听觉的工作方式。您现在正在匹配意图,而不是在用户输入上使用REGEX的用户。

,但问题是API.AI中间件在匹配时使用===操作员,而不是正则是正则。因此,除非您有意图,否则模式.*与任何内容都不匹配。

最新更新