0.0.2 • Published 8 years ago

botbuilder-load-scripts v0.0.2

Weekly downloads
3
License
MIT
Repository
github
Last release
8 years ago

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