WebSocketManager

export declare class WebSocketManager extends AsyncEventEmitter<ManagerShardEventsMap> implements AsyncDisposable
export declare class WebSocketManager extends AsyncEventEmitter<ManagerShardEventsMap> implements AsyncDisposable

No summary provided.

Implements

AsyncDisposable
constructor(options)
Constructs a new instance of the WebSocketManager class
NameTypeOptionalDescription
optionsCreateWebSocketManagerOptionsNoNone
Readonly
options:Omit<WebSocketManagerOptions, 'token'>
The options being used by this manager
Readonly
token:string
Gets the token set for this manager. If no token is set, an error is thrown. To set the token, use setToken or pass it in the options.
Remarks
This getter is mostly used to pass the token to the sharding strategy internally, there's not much reason to use it.
[Symbol.asyncDispose]():Promise<void>
connect():Promise<void>
destroy(options?):Awaitable<void>
NameTypeOptionalDescription
optionsOmit<WebSocketShardDestroyOptions, 'recover'>YesNone
fetchGatewayInformation(force?):Promise<APIGatewayBotInfo>
Fetches the gateway information from Discord - or returns it from cache if available
NameTypeOptionalDescription
forcebooleanYesWhether to ignore the cache and force a fresh fetch
fetchStatus():Awaitable<import("@discordjs/collection").Collection<number, import("./WebSocketShard.js").WebSocketShardStatus>>
getShardCount():Promise<number>
Yields the total number of shards across for your bot, accounting for Discord recommendations
getShardIds(force?):Promise<number[]>
Yields the ids of the shards this manager should manage
NameTypeOptionalDescription
forcebooleanYesNone
send(shardId, payload):Awaitable<void>
NameTypeOptionalDescription
shardIdnumberNoNone
payloadGatewaySendPayloadNoNone
setToken(token):void
NameTypeOptionalDescription
tokenstringNoNone
updateShardCount(shardCount):Promise<this>
Updates your total shard count on-the-fly, spawning shards as needed
NameTypeOptionalDescription
shardCountnumber | nullNoThe new shard count to use