Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
readPackageJson(path, async function (err, json) {
if (err) {
console.log(err);
return;
}
// Create bots DialogManager and bind to state storage
const bot = new botbuilder_dialogs_1.DialogManager();
bot.conversationState = new botbuilder_1.ConversationState(new botbuilder_1.MemoryStorage());
bot.userState = new botbuilder_1.UserState(new botbuilder_1.MemoryStorage());
// bind rootDialog
let loader = new botbuilder_dialogs_declarative_1.TypeLoader();
if (resourcesFolder) {
let resourceExplorer = new botbuilder_dialogs_declarative_1.ResourceExplorer();
// resourceExplorer.registerDirectory(`./libraries/botbuilder-dialogs-declarative/tests/resources`);
resourceExplorer.addFolder(`./libraries/botbuilder-dialogs-declarative/tests/resources`);
loader = new botbuilder_dialogs_declarative_1.TypeLoader(null, resourceExplorer);
}
const dialog = await loader.load(json);
bot.rootDialog = dialog;
// Listen for incoming activities.
server.post('/api/messages', (req, res) => {
adapter.processActivity(req, res, async (context) => {
// Route activity to bot.
await bot.onTurn(context);
});
});
});
readPackageJson(path, async function (err, json) {
if (err) {
console.log(err);
return;
}
// Create bots DialogManager and bind to state storage
const bot = new botbuilder_dialogs_1.DialogManager();
bot.conversationState = new botbuilder_1.ConversationState(new botbuilder_1.MemoryStorage());
bot.userState = new botbuilder_1.UserState(new botbuilder_1.MemoryStorage());
// bind rootDialog
let loader = new botbuilder_dialogs_declarative_1.TypeLoader();
if (resourcesFolder) {
let resourceExplorer = new botbuilder_dialogs_declarative_1.ResourceExplorer();
// resourceExplorer.registerDirectory(`./libraries/botbuilder-dialogs-declarative/tests/resources`);
resourceExplorer.addFolder(`./libraries/botbuilder-dialogs-declarative/tests/resources`);
loader = new botbuilder_dialogs_declarative_1.TypeLoader(null, resourceExplorer);
}
const dialog = await loader.load(json);
bot.rootDialog = dialog;
// Listen for incoming activities.
server.post('/api/messages', (req, res) => {
adapter.processActivity(req, res, async (context) => {
// Route activity to bot.
await bot.onTurn(context);
});
});
});
}
console.log(err);
return;
}
// Create bots DialogManager and bind to state storage
const bot = new DialogManager();
bot.conversationState = new ConversationState(new MemoryStorage());
bot.userState = new UserState(new MemoryStorage());
// bind rootDialog
let loader = new TypeLoader();
if (resourcesFolder) {
let resourceExplorer = new ResourceExplorer();
// resourceExplorer.registerDirectory(`./libraries/botbuilder-dialogs-declarative/tests/resources`);
resourceExplorer.addFolder(`./libraries/botbuilder-dialogs-declarative/tests/resources`);
loader = new TypeLoader(null, resourceExplorer);
}
const dialog = await loader.load(json);
bot.rootDialog = dialog as Dialog;
// Listen for incoming activities.
server.post('/api/messages', (req, res) => {
adapter.processActivity(req, res, async (context) => {
// Route activity to bot.
await bot.onTurn(context);
});
});
});
}
async function (err, json) {
if (err) {
console.log(err);
return;
}
// Create bots DialogManager and bind to state storage
const bot = new DialogManager();
bot.conversationState = new ConversationState(new MemoryStorage());
bot.userState = new UserState(new MemoryStorage());
// bind rootDialog
let loader = new TypeLoader();
if (resourcesFolder) {
let resourceExplorer = new ResourceExplorer();
// resourceExplorer.registerDirectory(`./libraries/botbuilder-dialogs-declarative/tests/resources`);
resourceExplorer.addFolder(`./libraries/botbuilder-dialogs-declarative/tests/resources`);
loader = new TypeLoader(null, resourceExplorer);
}
const dialog = await loader.load(json);
bot.rootDialog = dialog as Dialog;
// Listen for incoming activities.
server.post('/api/messages', (req, res) => {
adapter.processActivity(req, res, async (context) => {
// Route activity to bot.
await bot.onTurn(context);
});
});
constructor(private resourcePath: string) {
const typeFactory = new TypeFactory();
const resourceExplorer = new ResourceExplorer();
resourceExplorer.addFolder(this.resourcePath);
this.typeLoader = new TypeLoader(typeFactory, resourceExplorer);
this.typeLoader.addComponent(new AdaptiveComponentRegistration());
this.typeLoader.addComponent(new AdaptiveTestComponentRegistration());
}