mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-14 10:33:30 +01:00
* feat: add @discordjs/util * fix: builders test * refactor: make rest use lazy for ESM import * chore: make requested changes * Apply suggestions from code review Co-authored-by: Parbez <imranbarbhuiya.fsd@gmail.com> Co-authored-by: A. Román <kyradiscord@gmail.com> * chore: make requested changes and add tests * chore: regen lockfile * test: add type tests * chore: push missing files * chore: make requested changes * chore: update CI stuff * chore: fix lockfile * chore: make requested changes Co-authored-by: Parbez <imranbarbhuiya.fsd@gmail.com> Co-authored-by: A. Román <kyradiscord@gmail.com> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
26 lines
729 B
TypeScript
26 lines
729 B
TypeScript
import type { Awaitable } from '@discordjs/util';
|
|
import type { GatewaySendPayload } from 'discord-api-types/v10';
|
|
import type { WebSocketShardDestroyOptions } from '../../ws/WebSocketShard';
|
|
|
|
/**
|
|
* Strategies responsible for spawning, initializing connections, destroying shards, and relaying events
|
|
*/
|
|
export interface IShardingStrategy {
|
|
/**
|
|
* Initializes all the shards
|
|
*/
|
|
connect(): Awaitable<void>;
|
|
/**
|
|
* Destroys all the shards
|
|
*/
|
|
destroy(options?: Omit<WebSocketShardDestroyOptions, 'recover'>): Awaitable<void>;
|
|
/**
|
|
* Sends a payload to a shard
|
|
*/
|
|
send(shardId: number, payload: GatewaySendPayload): Awaitable<void>;
|
|
/**
|
|
* Spawns all the shards
|
|
*/
|
|
spawn(shardIds: number[]): Awaitable<void>;
|
|
}
|