TypeError:DialogflowHandle.handleMessage不是函数
DialogflowHandle.handleMessage(message.body) // here notify handle not a funtion.
这是课程:
const dialogflow = require('dialogflow');
class DialogflowHandle {
handleMessage (sentence) {
this.request.queryInput.text.text = sentence
return new Promise(
(resolve, reject) => {
this.sessionClient.detectIntent(this.request)
.then(resolve)
.catch(reject);
}
)
}
}
最佳答案
handleMessage
是DialogflowHandle
实例上可用的方法。它不能用作DialogflowHandle
构造函数的方法。
const dfh = new DialogflowHandle();
dfh.handleMessage(message.body);