Preview environment

class WebSocketManager

implements

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

Constructors

constructor()

Constructs a new instance of the WebSocketManager class

readonly
options : WebSocketManagerOptions

The options being used by this manager

[Symbol.asyncDispose]() : Promise<void>

connect() : Promise<void>

destroy(
options?: Omit<WebSocketShardDestroyOptions, 'recover'>
) : Awaitable<void>

fetchGatewayInformation(
force?: boolean
) : Promise<APIGatewayBotInfo>

Fetches the gateway information from Discord - or returns it from cache if available

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?: boolean
) : Promise<number[]>

Yields the ids of the shards this manager should manage

send(
shardId: number
) : Awaitable<void>

updateShardCount(
shardCount: number | null
) : Promise<this>

Updates your total shard count on-the-fly, spawning shards as needed