Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
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 0 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
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.