Options
All
  • Public
  • Public/Protected
  • All
Menu

Class DiscordConnector

Class used for acting based on received events.

This class is automatically instantiated by the library and is documented for reference.

Hierarchy

Index

Constructors

  • Create a new Discord Connector.

    Parameters

    • id: number

      id of the shard that created this class.

    • client: <internal>.Client

      Main client instance.

    Returns DiscordConnector

Properties

_checkPresenceData: any

Checks presence data and fills in missing elements.

param data

Data to send.

returns

Data after it's fixed/checked.

_checkRequestGuildMembersData: any

Checks request guild members data and fills in missing elements.

param data

Data to send.

returns

Data after it's fixed/checked.

_checkVoiceStateUpdateData: any

Checks voice state update data and fills in missing elements.

param data

Data to send.

returns

Data after it's fixed/checked.

_closing: any
_reconnect: any

Reset this connector to be ready to resume or hard reconnect, then connect.

param resume

Whether or not the client intends to send an OP 6 RESUME later.

_trace: null | string
betterWs: BetterWs
clearHeartBeat: any

Clear the heart beat interval, set it to null and set the cached heartbeat_interval as 0.

handleDispatch: any

Handle dispatch events.

param message

Message received from the websocket.

handleWsClose: any

Handle a close from the underlying websocket.

param code

Websocket close code.

param reason

Close reason if any.

heartbeat: any

Send an OP 1 HEARTBEAT to the gateway.

heartbeatInterval: number
heartbeatTimeout: null | Timeout
id: number
lastACKAt: number
lastHeartbeatSend: number
latency: number
messageAction: any

Called with a parsed Websocket message to execute further actions.

param message

Message that was received.

options: Omit<IClientOptions, "snowtransferInstance"> & { endpoint?: string; token: string }
reconnect: boolean
reset: any

Hard reset this connector.

resume: any

Send an OP 6 RESUME to the gateway.

seq: number
sessionId: null | string
status: "ready" | "disconnected" | "connecting" | "identifying" | "resuming"
default: typeof DiscordConnector
defaultMaxListeners: number

Methods

  • Connect to Discord.

    Returns Promise<void>

  • Close the websocket connection and disconnect.

    Returns Promise<void>

  • getMaxListeners(): number
  • identify(force?: boolean): Promise<void>
  • Send an OP 2 IDENTIFY to the gateway or an OP 6 RESUME if forceful identify is falsy.

    Parameters

    • Optional force: boolean

      Whether CloudStorm should send an OP 2 IDENTIFY even if there's a session that could be resumed.

    Returns Promise<void>

  • Parameters

    Returns ((...args: any[]) => any)[]

  • Send an OP 3 PRESENCE_UPDATE to the gateway.

    Parameters

    Returns Promise<void>

  • Send an OP 8 REQUEST_GUILD_MEMBERS to the gateway.

    Parameters

    Returns Promise<void>

  • Send an OP 4 VOICE_STATE_UPDATE to the gateway.

    Parameters

    Returns Promise<void>

Generated using TypeDoc