A Concierge Module is a module that listens for messages from users and acts upon them. Long running operations should not be performed by this module type - these should be done by services.
These functions should be implemented as needed on the exports
object of your module. A module may also optionally implement any methods avalible to a service.
- run(api, event)
The main entry point of the module.
- match(event, commandPrefix)
Evaluates if the module should be run for the given event.
- help(commandPrefix)
Gets help text for the module.
These properties are set automatically by Concierge on the exports
object. They should not be manually overridden unless there is a valid reason for doing so.
- config
Object for storing configuration data of the module within.
- platform
A reference to the Concierge core platform. This provides access to control methods of the bot and a means to get access directly to integration APIs.
- __descriptor
The internal representation of `kassy.json`. Contains information such as the name and version of the module.
The main entry point of the module.
This will only be executed if match returns true
.
Required
Kind: API method
Returns: true
if no further modules should be executed, false
|undefined
(nothing) otherwise.
Param | Type | Description |
---|---|---|
api | IntegrationApi |
The API associated with the integration that the event was raised on. See Api.md. |
event | EventObject |
An object describing the event that was raised. See Event.md. |
Example A simple hello world implementation:
exports.run = (api, event) => {
api.sendMessage('Hello World', event.thread_id);
}
Evaluates if the module should be run for the given event. This will be run for every received event so should not contain any time consuming code, instead should just return true/false depending on if it should be run or not.
Required
Note: This method should not be implemented if the "command"
property has been provided in kassy.json
. See Kassy.json.md#command for details.
Kind: API method
Returns: true
if the module should run, false otherwise.
Param | Type | Description |
---|---|---|
event | EventObject |
An object describing the event that was raised. See Event.md. |
commandPrefix | string |
The command prefix associated with the integration that the event was raised on. See Api.md#commandPrefix. |
Example A simple hello world implementation:
exports.match = (event, commandPrefix) => {
return event.arguments[0] === commandPrefix + 'HelloWorld';
}
Gets help text for the module. This method is only ever used by the (installed by default) help module. Even though it is not required, it is highly recommended and is the standard way of providing help for a module.
Optional
Note: This method should not be implemented if the "help"
property has been provided in kassy.json
. See Kassy.json.md#help for details.
Kind: API method
Returns: array[array[string, string, string?]]
, see Kassy.json.md#help for details.
Param | Type | Description |
---|---|---|
commandPrefix | string |
The command prefix associated with the integration that the help was requested on. See Api.md#commandPrefix. |
Example A simple hello world implementation:
exports.help = (commandPrefix) => {
return [
[commandPrefix + 'HelloWorld', 'Prints "Hello World".'],
[commandPrefix + 'HelloWorldExtended', 'Prints "Hello World".', 'Prints "Hello World" with extended help.']
];
}
Kind: Object property
Object for storing configuration data of the module within. Provided the config (or other persistence) module is installed, any property set on this object will automatically be persisted between restarts of your module; usually to a config.json
file within your modules directory. Please note that although this file has the same name as the global configuration file, it is not the same (different location and contains configuration only for your module).
Kind: Object property
A reference to the Concierge core platform. This provides access to control methods of the bot and a means to get access directly to integration APIs. Refer to JSDoc in platform.js for details.
Kind: Object property Unstable: Should be treated as unstable, and has only been provided for convinience
The internal representation of kassy.json
. Contains information such as the name and version of the module. See Kassy.json.md. Note that although it may be similar in structure to kassy.json
, it is not the same and will contain some additional properties.