2017-06-29 25 views
2

我正在使用skype客戶端的bot應用程序。 只要服務器收到第一條消息,就會在服務器日誌中發現(內部)錯誤。與集成Skype錯誤與節點 - [TypeError:無法讀取屬性'記錄器'的未定義]

示例代碼

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客戶端會收到來自聊天機器人和callingBot響應

實際結果

出現下列錯誤

/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) 
[email protected]:~/advbot/calling$ A 

回答

1

我已經解決了將

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

的問題我已閱讀https://github.com/Microsoft/BotBuilder/issues/2846

+0

我已經usi在我的文件中這行代碼,但沒有運氣和Skype和FB客戶端給我的ABC帳戶相同的錯誤,但它與另一個帳戶工作。 –

相關問題