botkit-sms:集成中间件插件

我正在尝试api.ai中间件插件与botkit-sms,我试图debugging源代码,为什么这是行不通的,但会有所帮助,如果你可以提供一些input

图书馆的源代码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传入听到函数会改变模式匹配和apiai.hears的工作方式。 您现在正在匹配意图,而不是用户在用户input上使用正则expression式。

但问题是API.ai中间件在匹配时使用===运算符 ,而不是正则expression式。 所以模式.*不会匹配任何东西,除非你有一个意图命名。