Skip to content

vvatanabe/botbuilder-load-scripts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

botbuilder-load-scripts

Load modularized botbuilder dialog scripts.

Build Status Coverage Status npm version

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

About

Load modularized botbuilder dialog scripts.

Resources

Stars

Watchers

Forks

Packages

No packages published