2017-04-21 25 views
1

我正在嘗試api.ai中間件插件與botkit-sms,我試圖調試源代碼,爲什麼這不起作用,但如果您可以提供圖書館https://github.com/krismuniz/botkit-sms/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') 
}) 

回答

1

傳遞apiai.hears到就聽功能在這裏的一些輸入

修改源代碼模式匹配,以及如何聽到的作品。您現在正在匹配意圖,而不是用戶在用戶輸入上使用正則表達式。

但問題是API.ai middleware uses an === operator匹配時,而不是正則表達式。所以模式.*不會匹配任何東西,除非你有一個意圖命名。