Interface CliOpts<ConfigType>

interface CliOpts<ConfigType> {
    bridgeConfig?: {
        affectsRegistration?: boolean;
        defaults: Record<string, unknown>;
        schema: string | Record<string, unknown>;
    };
    enableLocalpart?: boolean;
    enableRegistration?: boolean;
    generateRegistration?: ((reg, cb) => void);
    noUrl?: boolean;
    onConfigChanged?: ((config) => void);
    registrationPath?: string;
    run: ((port, config, registration) => void);
}

Type Parameters

  • ConfigType extends Record<string, unknown>

Properties

bridgeConfig?: {
    affectsRegistration?: boolean;
    defaults: Record<string, unknown>;
    schema: string | Record<string, unknown>;
}

Bridge-specific config info. If not defined, --config option will not be present in the CLI

Type declaration

  • Optional affectsRegistration?: boolean

    If true, the config will be required when generating a registration file.

  • defaults: Record<string, unknown>

    The default options for the config file.

  • schema: string | Record<string, unknown>

    Path to a schema YAML file (string) or the parsed schema file (object).

enableLocalpart?: boolean

Enable '--localpart [-l]' to allow users to configure the bot localpart.

Default

true
enableRegistration?: boolean

Enable '--generate-registration' to allow users to generate a registration file.

Default

true
generateRegistration?: ((reg, cb) => void)

The function called when you should generate a registration. Must be defined unless enableRegistration is false.

Type declaration

    • (reg, cb): void
    • The function called when you should generate a registration. Must be defined unless enableRegistration is false.

      Parameters

      • reg: AppServiceRegistration
      • cb: ((finalReg) => void)
          • (finalReg): void
          • Parameters

            • finalReg: AppServiceRegistration

            Returns void

      Returns void

noUrl?: boolean

Don't ask user for appservice url when generating registration.

Default

false
onConfigChanged?: ((config) => void)

This function is when the config is hot-reloaded. If not defined, hot-reloading is disabled.

You can hot-reload the bridge by sending a SIGHUP signal to the bridge.

Type declaration

    • (config): void
    • This function is when the config is hot-reloaded. If not defined, hot-reloading is disabled.

      You can hot-reload the bridge by sending a SIGHUP signal to the bridge.

      Parameters

      Returns void

registrationPath?: string

The path to write the registration file to. Users can overwrite this with -f.

Default

"registration.yaml"
run: ((port, config, registration) => void)

This function called when you should run the bridge.

Type declaration

    • (port, config, registration): void
    • This function called when you should run the bridge.

      Parameters

      • port: null | number
      • config: null | ConfigType
      • registration: null | AppServiceRegistration

      Returns void

Generated using TypeDoc