2017-04-21 11 views
1

botkit-sms로 api.ai 미들웨어 플러그인을 사용하려고합니다. 소스 코드를 디버깅하려고하는데 왜 작동하지 않습니까?하지만 제공 할 수 있다면 도움이 될 것입니다. 여기에 듣는 기능에 apiai.hears 전달 라이브러리 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

의 일부 입력

소스 코드는 패턴 매칭과이 작품을 듣는 방법을 변경합니다. 이제 사용자 입력 대신 regex를 사용하는 대신 intent와 일치합니다.

하지만 문제는 API.ai middleware uses an === operator과 일치 할 때 정규식이 아닙니다. 패턴 .*은 의도 한 의도가 없으면 어떤 것도 일치하지 않습니다.