2

我正在使用 Skype 客户端进行机器人应用程序。服务器一收到第一条消息,就在服务器日志中发现了一个(内部)错误。

示例代码

var restify = require('restify');
var builder = require('botbuilder');
var calling = require('botbuilder-calling');

//=========================================================
// Bot Setup
//=========================================================

// Setup Restify Server
var server = restify.createServer();
server.listen(process.env.port || process.env.PORT || 3978, function () {
   console.log('%s listening to %s', server.name, server.url); 
});

// Create chat bot
var chatConnector = new builder.ChatConnector({
     appId: process.env.MICROSOFT_APP_ID,
    appPassword: process.env.MICROSOFT_APP_PASSWORD
});
var chatBot = new builder.UniversalBot(chatConnector);
server.post('/api/messages', chatConnector.listen());

// Create calling bot
var connector = new calling.CallConnector({
    callbackUrl: 'https://<your host>/api/calls',
    appId: process.env.MICROSOFT_APP_ID,
    appPassword: process.env.MICROSOFT_APP_PASSWORD
});
var callingBot = new calling.UniversalCallBot(connector);
server.post('/api/calls', connector.listen());

//=========================================================
// Chat Dialogs
//=========================================================
// Add root dialog
chatBot.dialog('/', function (session) {
    session.send('Hi... Please call me to interact with me.'); 
});

callingBot.dialog('/', function (session) {
    session.send('Watson... come here!');
});;

当我运行这个节点文件

node app.js 

预期行为

你期望发生的事情。我希望 Skype 客户端会收到来自聊天机器人和 callBot 的响应

实际结果

发生以下错误

/home/marcus/advbot/node_modules/botbuilder/node_modules/promise/lib/done.js:10
      throw err;
      ^

TypeError: Cannot read property 'logger' of undefined
    at UniversalBot.Library.findActiveDialogRoutes (/home/marcus/advbot/node_modules/botbuilder/lib/bots/Library.js:135:20)
    at /home/marcus/advbot/node_modules/botbuilder/lib/bots/Library.js:243:31
    at /home/marcus/advbot/node_modules/botbuilder/node_modules/async/lib/async.js:718:13
    at async.forEachOf.async.eachOf (/home/marcus/advbot/node_modules/botbuilder/node_modules/async/lib/async.js:233:13)
    at _parallel (/home/marcus/advbot/node_modules/botbuilder/node_modules/async/lib/async.js:717:9)
    at Object.async.parallel (/home/marcus/advbot/node_modules/botbuilder/node_modules/async/lib/async.js:731:9)
    at /home/marcus/advbot/node_modules/botbuilder/lib/bots/Library.js:241:23
    at UniversalBot.Library.recognize (/home/marcus/advbot/node_modules/botbuilder/lib/bots/Library.js:68:13)
    at UniversalBot.Library.defaultFindRoutes (/home/marcus/advbot/node_modules/botbuilder/lib/bots/Library.js:236:14)
    at UniversalBot.Library.findRoutes (/home/marcus/advbot/node_modules/botbuilder/lib/bots/Library.js:85:18)
marcus@AppBuilderBot:~/advbot/calling$ A
4

1 回答 1

1

我已经解决了添加的问题

bot.use(builder.Middleware.dialogVersion({ version: 1.0, resetCommand: /^reset/i }));

正如我在https://github.com/Microsoft/BotBuilder/issues/2846中所读到的

于 2017-07-31T08:25:46.620 回答