1

我正在尝试开发 Facebook Messenger 聊天机器人。我已经将我的信使和节点服务器设置为相互交谈,但是当我尝试从信使发送消息时,在它到达节点服务器后,它会尝试使用 node-wit 库执行合并操作,这会导致错误。

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) 在 C:\Users\username\node_modules\node-wit\lib\wit.js:32:9 在 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;
      }
    }
  );
4

1 回答 1

0

尝试将您的节点升级到版本 6。这是与版本相关的问题。让我知道升级后它是否可以正常工作。

于 2017-04-05T10:27:37.797 回答