Playbook brings conversational context and branching to Hubot.
Modules are available as properties and their instances as collection items.
Uses singleton pattern to make sure only one Playbook is created when used in multiple script files loaded by the same Hubot.
Kind: global class
Playbook
Dialogue
Scene
Promise
Scene
Director
Transcript
Transcript
Improv
Playbook
Playbook
Playbook
Attach Playbook to robot unless already done.
Kind: instance method of Playbook
Returns: Playbook
- Self for chaining
Param | Type | Default | Description |
---|---|---|---|
robot | Robot |
Hubot instance | |
[improvise] | boolean |
true |
Enable/disable improv module and middleware (default true) |
Dialogue
Create stand-alone dialogue (not within scene).
Kind: instance method of Playbook
Returns: Dialogue
- New Dialogue instance
Param | Type | Description |
---|---|---|
res | Response |
Hubot Response object |
[…args] | * |
Optional other Dialogue constructor args |
Scene
Create new Scene.
Kind: instance method of Playbook
Returns: Scene
- New Scene instance
Param | Type | Description |
---|---|---|
[…args] | * |
Optional Scene constructor args |
Promise
Create and enter Scene.
Kind: instance method of Playbook
Returns: Promise
- Resolves with final enter middleware context
Param | Type | Description |
---|---|---|
res | Response |
Response object from entering participant |
[…args] | * |
Both Scene and Dialogue constructor args |
[cb] | function |
Called with context after enter middleware done |
Scene
Create scene and setup listener to enter.
Kind: instance method of Playbook
Returns: Scene
- New Scene instance
Param | Type | Description | |
---|---|---|---|
type | string |
Robot listener type: hear | respond |
regex | RegExp |
Match pattern | |
[…args] | * |
Scene constructor args | |
callback | function |
Callback to fire after entered |
Alias of sceneListen with hear as specified type.
Kind: instance method of Playbook
Param | Type | Description |
---|---|---|
[…args] | * |
Scene constructor args |
Alias of sceneListen with respond as specified type.
Kind: instance method of Playbook
Param | Type | Description |
---|---|---|
[…args] | * |
Scene constructor args |
Director
Create new Director.
Kind: instance method of Playbook
Returns: Director
- New Director instance
Param | Type | Description |
---|---|---|
[…args] | * |
Director constructor args |
Transcript
Create a transcript with optional config to record events from modules
Kind: instance method of Playbook
Returns: Transcript
- The new transcript
Param | Type | Description |
---|---|---|
[…args] | * |
Transcript constructor args |
Transcript
Create transcript and record a given module in one step.
Kind: instance method of Playbook
Returns: Transcript
- The new transcript
Param | Type | Description |
---|---|---|
instance | * |
A Playbook module (dialogue, scene or director) |
[…args] | * |
Constructor args |
Improv
Initialise Improv singleton module, or update configuration if exists.
Access methods via Playbook.improv
property.
Kind: instance method of Playbook
Returns: Improv
- Improv interface
Param | Type | Description |
---|---|---|
[options] | Object |
Key/val options for config |
Exit all scenes, end all dialogues.
Kind: instance method of Playbook
Playbook
Shutdown and re-initialise instance (mostly for tests).
Kind: instance method of Playbook
Returns: Playbook
- - The reset instance
Playbook
Load outline and setup scene listeners for global bits.
Kind: instance method of Playbook
Returns: Playbook
- The reset instance
Param | Type | Description |
---|---|---|
[…args] | * |
Additional outline constructor args |