new Cli(opts)
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
opts |
Object | CLI options
Properties
|
- Source:
Methods
getConfig() → (nullable) {Object}
Get the loaded and parsed bridge config. Only set after run() has been called.
- Source:
Returns:
The config
- Type
- Object
getRegistrationFilePath() → {string}
Get the path to the registration file. This may be different to the one supplied
in the constructor if the user passed a -f flag.
- Source:
Returns:
The path to the registration file.
- Type
- string
run()
Run the app from the command line. Will parse sys args.
- Source:
Type Definitions
generateRegistration(reg, callback)
Invoked when you should generate a registration.
Parameters:
Name | Type | Description |
---|---|---|
reg |
AppServiceRegistration | A new registration object with the app
service url provided by --url set. |
callback |
function | The callback that you should invoke when the
registration has been generated. It should be called with the
AppServiceRegistration provided in this function. |
- Source:
Example
generateRegistration: function(reg, callback) {
reg.setHomeserverToken(AppServiceRegistration.generateToken());
reg.setAppServiceToken(AppServiceRegistration.generateToken());
reg.setSenderLocalpart("my_first_bot");
callback(reg);
}
runBridge(port, confignullable, reg)
Invoked when you should run the bridge.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
port |
Number | The port to listen on. | |
config |
Object |
<nullable> |
The loaded and parsed config. |
reg |
AppServiceRegistration | The registration to run as. |
- Source:
Example
runBridge: function(port, config, reg) {
// configure bridge
// listen on port
}