Microsoft BotbuilderSDK: 3.15.0 Language: NodeJs
I have my dialogs in different folders. However, I am trying to initialize them in the app.js folder so that I can use LUIS when the intent matches the dialog, but it is not working.
NOTE - Each dialog works when I call them in a structure similar to the following:
session.beginDialog('hello:Hello')
Here is the full source code:
require('dotenv').config();
const restify = require('restify');
const builder = require('botbuilder');
var fs = require('fs');
var clients = require('restify-clients');
var azure = require('botbuilder-azure');
var listenPort = process.env.port || process.env.PORT || 3978;
var server = restify.createServer()
server.listen(listenPort, '::', () => {
console.log(`smooth like a baby's bottom`)
});
var connector = new builder.ChatConnector({
appId: process.env.MICROSOFT_APP_ID,
appPassword: process.env.MICROSOFT_APP_PASSWORD
});
var bot = new builder.UniversalBot(connector, function (session) {
session.endDialog(`I'm sorry, I did not understand '${session.message.text}'.\nType 'help' to know more about me :)`)
}).set('storage', cosmosStorage);
var luisRL = new builder.LuisRecognizer(process.env.LUIS_MODEL_URL).onEnabled(function (context, callback) {
var enabled = context.dialogStack().length === 0
callback(null, enabled)
});
var intents = new builder.IntentDialog({ recognizers: [luisRL] });
bot.recognizer(intents);
server.post('/api/messages', connector.listen());
bot.on('conversationUpdate', function (message) {
if (message.membersAdded) {
greetings = 'welcome to Joey's Pizza?'
message.membersAdded.forEach(function (identity) {
if (identity.id === message.address.bot.id) {
bot.send(new builder.Message()
.address(message.address)
.text(greetings)
)
}
})
}
});
bot.library(require('./dialogs/reservations').createLibrary());
bot.library(require('./dialogs/order').createLibrary());
bot.library(require('./dialogs/cancellations').createLibrary());