botbuilder-load-scripts
v0.0.2
Published
Load modularized botbuilder dialog scripts
Downloads
2
Maintainers
Readme
botbuilder-load-scripts
Load modularized botbuilder dialog scripts.
Usage
./scripts/hello.js:
'use strict'
module.exports = bot => {
bot.getDialog('/').matches('hello', session => {
session.send('hello')
})
}
./scripts/bye.js
'use strict'
module.exports = bot => {
bot.getDialog('/').matches('bye', session => {
session.send('bye')
})
}
./greet-bot.js:
'use strict'
const builder = require('botbuilder')
// Add load functions
const bot = require('botbuilder-load-scripts')(new builder.TextBot())
bot.add('/', new builder.CommandDialog())
// load directory
bot.load('./scripts')
// load file
bot.loadFile('./scripts', 'hello,js')
// load script
bot.loadScript(bot => {
bot.getDialog('/').matches('bye', session => {
session.send('bye')
})
})
bot.listen()
Install
With npm do:
$ npm install botbuilder-load-scripts --save
License
MIT