Skip to content

Manager

Manages the connection and communication with the Discord Gateway using multiple shards.

This serves as the primary class for developers wanting to interact with the Discord Gateway, this class is responsible for creating the required shards sending messages asynchronously through each shard.

Manager.token  :: Secret
Manager.intents  :: number
Manager.webSocketVersion  :: number
Manager.largeThreshold  :: number?
Manager.shouldReconnect  :: boolean
Manager.ready  :: boolean
Manager.shardIds  :: { ShardId }
Manager.shards  :: {
{ [ShardId]: WebSocket.Shard } }
Manager.logger  :: Logger
Manager.onDisconnected  :: Emitter<ShardPayload<{ errorCode: number? }>
Manager.onReconnected  :: Emitter<ShardPayload<{}>
Manager.onConnected  :: Emitter<ShardPayload<{}>
Manager.onHeartbeat  :: Emitter<ShardPayload<{ latency: number }>
Manager.onDispatch  :: Payload<unknown>
Manager.onAllShardsReady  :: Emitter<ShardPayload<{ shardId: number, ReadyPayload }>
Manager : connectAsync ( gatewayInformation )  -> FutureLike<string, nil>

Will create, as well as connect all of the shards this application requires in order to communicate back and fourth between discords WebSocket

Parameters

gatewayInformation: GetGatewayBotResponse
Manager : sendAsync ( operation data )  -> ()

Will send a message through all shards this Manager is currently responsible for. This message is sent to the discord WebSocket.

Parameters

operation: Opcode
data: T
Manager . new ( settings )  -> Manager

Will instantiate a new Manager class.

Parameters

settings: Secret<string>

Returns

Manager