我想開發的Facebook信使聊天機器人。我已經將我的信使和節點服務器設置爲彼此交談,但是當我嘗試從信使發送消息到達節點服務器後,它會嘗試使用節點智慧庫進行合併操作,從而產生錯誤。正在開發Facebook的信使聊天機器人
C:\Users\username\node_modules\node-wit\lib\wit.js:161 this.converse( ^ TypeError: Cannot read property 'converse' of undefined at C:\Users\username\node_modules\node-wit\lib\wit.js:161:13 at Object.actions.say.merge (C:\Users\username\messenger.js:147:5) at null. (C:\Users\username\node_modules\node-wit\lib\wit.js :230:22) at C:\Users\username\node_modules\node-wit\lib\wit.js:32:9 at process._tickCallback (node.js:355:11)
這裏是我的代碼:
wit.runActions(
sessionId, // the user's current session
msg, // the user's message
sessions[sessionId].context, // the user's current session state
(error, context) => {
if (error) {
console.log('Oops! Got an error from Wit:', error);
} else {
// Our bot did everything it has to do.
// Now it's waiting for further messages to proceed.
console.log('Waiting for futher messages.');
// Updating the user's current session state
sessions[sessionId].context = context;
}
}
);
您沒有得到答案的原因是因爲無法瞭解您的應用程序的工作方式。此外,您的代碼段是從工作教程複製的1:1。所以你的問題必須在另一個位置。 –