
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
botbuilder-dialog-loader
Advanced tools
A Library that helps to autload Microsoft Bot Framework dialogs
A Library that helps to autload Microsoft Bot Framework dialogs. Autoloads dialogs from provided folder, able to pass custom arguments for dialogs. It is supposed that every javascript file in the folder will expose only function with bot as first argument. Recommendation**: match dialog id's with the dialog folder structure.
So require('botbuilder-dialog-loader')
will return a function that requires next arguments:
. bot - a UniversalBot instance;
. basePath - a path to dialogs folder;
. config - (optional) a configuration object. Every object's key reflects to
a folder or to a concrete javascript file (without extension). Key's value
should contain or an object (in case of folder) or an array of arguments,
that will be passed to thefile. Example:
{
"folderA" : {
"folderB" : {
"some_dialogs" : [arg1, ..., argN] // A
}
},
"welcome" : ["Hello", "Wolrd!"]
}
/src/dialogs
;/src/dialogs/welcome.js
;welcome.js
:module.exports = function (bot,name) {
bot.dialog('/welcome', [function (session) {
session.send(`My name is - ${name}`)
session.beginDialog('/askForName')
},
function (session, results) {
session.endDialog(`Hi, ${results.response}!`);
setTimeout( function () {
process.exit()
},1000);
}
]);
}
/src/dialogs/askForName.js
;askForName.js
:const botbuilder = require('botbuilder');
module.exports = function (bot) {
bot.dialog('/askForName', [function (session) {
botbuilder.Prompts.text(session, 'What is your name?');
}]);
}
index.js
, a Code:const botbuilder = require('botbuilder');
const path = require('path');
const loader = require('botbuilder-dialog-loader');
let connector = new botbuilder.ConsoleConnector().listen();
let bot = new botbuilder.UniversalBot(connector);
let basePath = path.dirname(__filename) + '/src/dialogs/';
bot.dialog('/', function ( session ) {
session.beginDialog( '/welcome');
})
loader( bot, basePath, {
"welcome" : ["DialogLoader"]
});
console.log('Press any key...');
npm install --save botbuilder-dialog-loader
FAQs
A Library that helps to autload Microsoft Bot Framework dialogs
The npm package botbuilder-dialog-loader receives a total of 1 weekly downloads. As such, botbuilder-dialog-loader popularity was classified as not popular.
We found that botbuilder-dialog-loader demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.