Class Client

Revolt.js Clients

Hierarchy

  • EventEmitter<Events>
    • Client

Constructors

  • Create Revolt.js Client

    Parameters

    • Optional options: Partial<ClientOptions>
    • Optional configuration: {
          app: string;
          build: {
              commit_sha: string;
              commit_timestamp: string;
              origin_url: string;
              semver: string;
              timestamp: string;
          };
          features: {
              autumn: {
                  enabled: boolean;
                  url: string;
              };
              captcha: {
                  enabled: boolean;
                  key: string;
              };
              email: boolean;
              invite_only: boolean;
              january: {
                  enabled: boolean;
                  url: string;
              };
              voso: {
                  enabled: boolean;
                  url: string;
                  ws: string;
              };
          };
          revolt: string;
          vapid: string;
          ws: string;
      }
      • app: string

        Description

        URL pointing to the client serving this node

      • build: {
            commit_sha: string;
            commit_timestamp: string;
            origin_url: string;
            semver: string;
            timestamp: string;
        }

        Description

        Build information

        • commit_sha: string

          Description

          Commit Hash

        • commit_timestamp: string

          Description

          Commit Timestamp

        • origin_url: string

          Description

          Git Origin URL

        • semver: string

          Description

          Git Semver

        • timestamp: string

          Description

          Build Timestamp

      • features: {
            autumn: {
                enabled: boolean;
                url: string;
            };
            captcha: {
                enabled: boolean;
                key: string;
            };
            email: boolean;
            invite_only: boolean;
            january: {
                enabled: boolean;
                url: string;
            };
            voso: {
                enabled: boolean;
                url: string;
                ws: string;
            };
        }

        Description

        Features enabled on this Revolt node

        • autumn: {
              enabled: boolean;
              url: string;
          }

          Description

          File server service configuration

          • enabled: boolean

            Description

            Whether the service is enabled

          • url: string

            Description

            URL pointing to the service

        • captcha: {
              enabled: boolean;
              key: string;
          }

          Description

          hCaptcha configuration

          • enabled: boolean

            Description

            Whether captcha is enabled

          • key: string

            Description

            Client key used for solving captcha

        • email: boolean

          Description

          Whether email verification is enabled

        • invite_only: boolean

          Description

          Whether this server is invite only

        • january: {
              enabled: boolean;
              url: string;
          }

          Description

          Proxy service configuration

          • enabled: boolean

            Description

            Whether the service is enabled

          • url: string

            Description

            URL pointing to the service

        • voso: {
              enabled: boolean;
              url: string;
              ws: string;
          }

          Description

          Voice server configuration

          • enabled: boolean

            Description

            Whether voice is enabled

          • url: string

            Description

            URL pointing to the voice API

          • ws: string

            Description

            URL pointing to the voice WebSocket server

      • revolt: string

        Description

        Revolt API Version

      • vapid: string

        Description

        Web Push VAPID public key

      • ws: string

        Description

        WebSocket URL

    Returns Client

Properties

#reconnectTimeout: undefined | number
#session: undefined | PrivateSession
#setConnectionFailureCount: Setter<number>
#setReady: Setter<boolean>
account: AccountCollection
api: API
channelUnreads: ChannelUnreadCollection
channelWebhooks: ChannelWebhookCollection
configuration: undefined | {
    app: string;
    build: {
        commit_sha: string;
        commit_timestamp: string;
        origin_url: string;
        semver: string;
        timestamp: string;
    };
    features: {
        autumn: {
            enabled: boolean;
            url: string;
        };
        captcha: {
            enabled: boolean;
            key: string;
        };
        email: boolean;
        invite_only: boolean;
        january: {
            enabled: boolean;
            url: string;
        };
        voso: {
            enabled: boolean;
            url: string;
            ws: string;
        };
    };
    revolt: string;
    vapid: string;
    ws: string;
}

Type declaration

  • app: string

    Description

    URL pointing to the client serving this node

  • build: {
        commit_sha: string;
        commit_timestamp: string;
        origin_url: string;
        semver: string;
        timestamp: string;
    }

    Description

    Build information

    • commit_sha: string

      Description

      Commit Hash

    • commit_timestamp: string

      Description

      Commit Timestamp

    • origin_url: string

      Description

      Git Origin URL

    • semver: string

      Description

      Git Semver

    • timestamp: string

      Description

      Build Timestamp

  • features: {
        autumn: {
            enabled: boolean;
            url: string;
        };
        captcha: {
            enabled: boolean;
            key: string;
        };
        email: boolean;
        invite_only: boolean;
        january: {
            enabled: boolean;
            url: string;
        };
        voso: {
            enabled: boolean;
            url: string;
            ws: string;
        };
    }

    Description

    Features enabled on this Revolt node

    • autumn: {
          enabled: boolean;
          url: string;
      }

      Description

      File server service configuration

      • enabled: boolean

        Description

        Whether the service is enabled

      • url: string

        Description

        URL pointing to the service

    • captcha: {
          enabled: boolean;
          key: string;
      }

      Description

      hCaptcha configuration

      • enabled: boolean

        Description

        Whether captcha is enabled

      • key: string

        Description

        Client key used for solving captcha

    • email: boolean

      Description

      Whether email verification is enabled

    • invite_only: boolean

      Description

      Whether this server is invite only

    • january: {
          enabled: boolean;
          url: string;
      }

      Description

      Proxy service configuration

      • enabled: boolean

        Description

        Whether the service is enabled

      • url: string

        Description

        URL pointing to the service

    • voso: {
          enabled: boolean;
          url: string;
          ws: string;
      }

      Description

      Voice server configuration

      • enabled: boolean

        Description

        Whether voice is enabled

      • url: string

        Description

        URL pointing to the voice API

      • ws: string

        Description

        URL pointing to the voice WebSocket server

  • revolt: string

    Description

    Revolt API Version

  • vapid: string

    Description

    Web Push VAPID public key

  • ws: string

    Description

    WebSocket URL

connectionFailureCount: Accessor<number>
events: EventClient<1>
options: ClientOptions
ready: Accessor<boolean>
serverMembers: ServerMemberCollection
user: undefined | User
prefixed: string | boolean

Accessors

  • get sessionId(): undefined | string
  • Current session id

    Returns undefined | string

Methods

  • Fetches the configuration of the server if it has not been already fetched.

    Returns Promise<void>

  • Update API object to use authentication.

    Returns void

  • Type Parameters

    • T extends keyof Events

    Parameters

    • event: T
    • fn: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: ArgumentMap<Events>[Extract<T, keyof Events>]

          Returns void

    • Optional context: any

    Returns Client

  • Calls each of the listeners registered for a given event.

    Type Parameters

    • T extends keyof Events

    Parameters

    • event: T
    • Rest ...args: ArgumentMap<Events>[Extract<T, keyof Events>]

    Returns boolean

  • Return an array listing the events for which the emitter has registered listeners.

    Returns (keyof Events)[]

  • Return the number of listeners listening to a given event.

    Parameters

    • event: keyof Events

    Returns number

  • Return the listeners registered for a given event.

    Type Parameters

    • T extends keyof Events

    Parameters

    • event: T

    Returns ((...args) => void)[]

  • Log in with auth data, creating a new session in the process.

    Parameters

    • details: {
          email: string;
          friendly_name?: null | string;
          password: string;
      } | {
          friendly_name?: null | string;
          mfa_response?: null | {
              password: string;
          } | {
              recovery_code: string;
          } | {
              totp_code: string;
          };
          mfa_ticket: string;
      }

      Login data object

    Returns Promise<void>

    An on-boarding function if on-boarding is required, undefined otherwise

  • Log in as a bot

    Parameters

    • token: string

      Bot token

    Returns Promise<void>

  • Prepare a markdown-based message to be displayed to the user as plain text.

    Parameters

    • source: string

      Source markdown text

    Returns string

    Modified plain text

  • Type Parameters

    • T extends keyof Events

    Parameters

    • event: T
    • Optional fn: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: ArgumentMap<Events>[Extract<T, keyof Events>]

          Returns void

    • Optional context: any
    • Optional once: boolean

    Returns Client

  • Add a listener for a given event.

    Type Parameters

    • T extends keyof Events

    Parameters

    • event: T
    • fn: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: ArgumentMap<Events>[Extract<T, keyof Events>]

          Returns void

    • Optional context: any

    Returns Client

  • Add a one-time listener for a given event.

    Type Parameters

    • T extends keyof Events

    Parameters

    • event: T
    • fn: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: ArgumentMap<Events>[Extract<T, keyof Events>]

          Returns void

    • Optional context: any

    Returns Client

  • Proxy a file through January.

    Parameters

    • url: string

      URL to proxy

    Returns undefined | string

    Proxied media URL

  • Remove all listeners, or those of the specified event.

    Parameters

    • Optional event: keyof Events

    Returns Client

  • Remove the listeners of a given event.

    Type Parameters

    • T extends keyof Events

    Parameters

    • event: T
    • Optional fn: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: ArgumentMap<Events>[Extract<T, keyof Events>]

          Returns void

    • Optional context: any
    • Optional once: boolean

    Returns Client

Generated using TypeDoc