我正在尝试使用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')
})发布于 2017-04-27 22:29:14
在这里,将apiai.hears传递到hears函数会改变模式匹配和hears的工作方式。您现在正在匹配意图,而不是用户对用户输入使用regex。
但问题是, operator在匹配时,不是正则表达式。因此,除非您有一个名为.*的意图,否则该模式不会匹配任何内容。
https://stackoverflow.com/questions/43534607
复制相似问题