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.
Summary
Properties
Manager.token :: SecretManager.intents :: numberManager.webSocketVersion :: numberManager.largeThreshold :: number?Manager.shouldReconnect :: booleanManager.ready :: booleanManager.shardIds :: { ShardId }Manager.shards :: { [ShardId]: WebSocket.Shard }Manager.logger :: Logger.LoggerManager.onDisconnected :: Emitter<ShardPayload<{ errorCode: number? }>>Manager.onReconnected :: Emitter<ShardPayload<{}>>,Manager.onConnected :: Emitter<ShardPayload<{}>>,Manager.onHeartbeat :: Emitter<ShardPayload<{ latency: number }>>,Manager.onDispatch :: Emitter<ShardPayload<{ shardId: number, event: apiTypes.ReceiveEvent, payload: apiTypes.Payload<unknown> }>>Manager.onAllShardsReady :: Emitter<ShardPayload<{ shardId: number, payload: apiTypes.ReadyPayload }>>Manager.onRateLimited :: Emitter<ShardPayload<{ opcode: number, retryAfter: number, guildId: string? }>>Properties
Section titled “Properties”intents
Section titled “intents”webSocketVersion
Section titled “webSocketVersion”largeThreshold
Section titled “largeThreshold”shouldReconnect
Section titled “shouldReconnect”shardIds
Section titled “shardIds” Manager.shardIds :: { ShardId }
shards
Section titled “shards” Manager.shards :: {
{ [ShardId]: WebSocket.Shard } }
{ [ShardId]: WebSocket.Shard } }
logger
Section titled “logger”onDisconnected
Section titled “onDisconnected”onReconnected
Section titled “onReconnected”onConnected
Section titled “onConnected”onHeartbeat
Section titled “onHeartbeat”onDispatch
Section titled “onDispatch”onAllShardsReady
Section titled “onAllShardsReady”onRateLimited
Section titled “onRateLimited” Manager.onRateLimited :: Emitter<ShardPayload<{ opcode: number, retryAfter: number, guildId: string? }>
Methods
Section titled “Methods”connectAsync
Section titled “connectAsync”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 |
Returns
| FutureLike<string, nil> |
sendAsync
Section titled “sendAsync”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 |
Functions
Section titled “Functions”Manager . new ( settings ) -> Manager
Will instantiate a new Manager class.