- Doorman
General-purpose bot framework.
- Plugin
Plugins are the developer-facing component of Doorman. Used to configure behavior by consumers, developers can rely on the Plugin prototype to provide basic functionality needed by an instanced plugin.
- Router ⇐
Fabric.Scribe
Process incoming messages.
- Service
General-purpose bot framework.
Kind: global class
Construct a Doorman.
Param | Type | Description |
---|---|---|
config | Object |
Configuration. |
config.path | Object |
Local path for Store. |
config.services | Array |
List of services to enable. |
config.trigger | String |
Prefix to use as a trigger. |
Look for triggers in a message.
Kind: instance method of Doorman
Param | Type | Description |
---|---|---|
msg | Message |
Message to evaluate. |
doorman.start() ⇒ Doorman
Activates a Doorman instance.
Kind: instance method of Doorman
Returns: Doorman
- Chainable method.
doorman.stop() ⇒ Doorman
Halt a Doorman instance.
Kind: instance method of Doorman
Returns: Doorman
- Chainable method.
doorman.use(plugin) ⇒ Doorman
Configure Doorman to use a Plugin.
Kind: instance method of Doorman
Returns: Doorman
- Chainable method.
Param | Type | Description |
---|---|---|
plugin | Mixed |
Can be of type Map (trigger name => behavior) or Plugin (constructor function). |
doorman._defineTrigger(handler) ⇒ Doorman
Register a Trigger.
Kind: instance method of Doorman
Returns: Doorman
- Instance of Doorman configured to handle Trigger.
Param | Type | Description |
---|---|---|
handler | Trigger |
Trigger to handle. |
Plugins are the developer-facing component of Doorman. Used to configure behavior by consumers, developers can rely on the Plugin prototype to provide basic functionality needed by an instanced plugin.
Kind: global class
- Plugin
- new Plugin(config)
- instance
- static
- .fromName(name) ⇒
Mixed
- .fromName(name) ⇒
Create an instance of a plugin.
Param | Type | Description |
---|---|---|
config | Object |
Configuration to be passed to plugin. |
plugin.route(request) ⇒ Plugin
Route a request to its appropriate handler.
Kind: instance method of Plugin
Returns: Plugin
- Chainable method.
Param | Type | Description |
---|---|---|
request | Mixed |
Temporarily mixed type. |
plugin.subscribe(channel) ⇒ Plugin
Attach the router to a particular message channel.
Kind: instance method of Plugin
Returns: Plugin
- Chainable method.
Param | Type | Description |
---|---|---|
channel | String |
Name of channel. |
Static method for loading a plugin from disk.
Kind: static method of Plugin
Returns: Mixed
- Loaded plugin, or null
.
Param | Type | Description |
---|---|---|
name | String |
Name of the plugin to load. |
Process incoming messages.
Kind: global class
Extends: Fabric.Scribe
- Router ⇐
Fabric.Scribe
- new Router(map)
- .route(msg) ⇒
Array
- .use(plugin, name) ⇒
Router
Maintains a list of triggers ("commands") and their behaviors.
Param | Type | Description |
---|---|---|
map | Object |
Map of command names => behaviors. |
Assembles a list of possible responses to the incoming request.
Kind: instance method of Router
Returns: Array
- List of outputs generated from the input string.
Param | Type | Description |
---|---|---|
msg | String |
Input message to route. |
router.use(plugin, name) ⇒ Router
Attaches a new handler to the router.
Kind: instance method of Router
Returns: Router
- Configured instance of the router.
Param | Type | Description |
---|---|---|
plugin | Plugin |
Instance of the plugin. |
name | Plugin.name |
Name of the plugin. |
Kind: global class
Properties
Name | Description |
---|---|
map | The "map" is a hashtable of "key" => "value" pairs. |
Basic API for connecting Doorman to a new service provider.
Param | Type | Description |
---|---|---|
config | Object |
Configuration for this service. |
service.handler(message) ⇒ Service
Default route handler for an incoming message. Follows the Activity Streams 2.0 spec: https://www.w3.org/TR/activitystreams-core/
Kind: instance method of Service
Returns: Service
- Chainable method.
Param | Type | Description |
---|---|---|
message | Object |
Message object. |
service.send(channel, message) ⇒ Service
Send a message to a channel.
Kind: instance method of Service
Returns: Service
- Chainable method.
Param | Type | Description |
---|---|---|
channel | String |
Channel name to which the message will be sent. |
message | String |
Content of the message to send. |