botbuilder-load-scripts

0.0.2 • Public • Published

botbuilder-load-scripts

Load modularized botbuilder dialog scripts.

Build Status Coverage Status

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

Package Sidebar

Install

npm i botbuilder-load-scripts

Weekly Downloads

0

Version

0.0.2

License

MIT

Last publish

Collaborators

  • vvatanabe