Class: Cli

Cli

new Cli(opts)

Parameters:
Name Type Description
opts Object CLI options
Properties
Name Type Attributes Description
run function The function called when you should run the bridge. The first arg is the port to listen on. The second are is the parsed config object if set.
generateRegistration Cli~generateRegistration The function called when you should generate a registration.
bridgeConfig Object <optional>
Bridge-specific config info. If null, no --config option will be present in the CLI. Default: null.
Properties
Name Type Attributes Description
affectsRegistration boolean <optional>
True to make the --config option required when generating the registration. The parsed config can be accessed via Cli.getConfig().
schema string | Object Path to a schema YAML file (string) or the parsed schema file (Object).
defaults Object <optional>
The default options for the config file.
enableRegistration boolean <optional>
Enable '--generate-registration'. Default True.
registrationPath string <optional>
The path to write the registration file to.
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

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);
}