Class Client

Hierarchy

  • default
    • Client

Constructors

Properties

ws: null | WS = null

Methods

  • Connects to our API and WS servers

    Parameters

    • token: string

      The secret token for the bot

    Returns Promise<void>

  • Executes the handler when someone send a message to a group where the bot present

    Parameters

    • handler: ((ctx: Ctx) => void)
        • (ctx): void
        • Parameters

          Returns void

    Returns void

  • Executes the handler when someone reacts to a message

    Parameters

    • handler: ReactionHandler

    Returns void

  • Executes the handler when the client is successfully connected to the server.

    Parameters

    • handler: (() => void)

      A void function that's called when the client is ready.

        • (): void
        • Returns void

    Returns void

  • Executes the handler when something goes wrong with the websocket connection

    Parameters

    • handler: ((err: Error) => void)
        • (err): void
        • Parameters

          • err: Error

          Returns void

    Returns void

  • Send a Websocket message to our server

    Type Parameters

    • T

    Parameters

    • groupID: string | number

      The ID of the group you want to send message

    • type: MessageEventType

      The type of the message you want to send

    • content: string

      The message content

    • data: null | T = null

      Any additional data you want to send with

    Returns void