refactor(Sharding): use options objects (#5510)

Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
This commit is contained in:
monbrey
2021-05-01 05:46:20 +10:00
committed by GitHub
parent 116ecf246e
commit c9b53539d5
4 changed files with 39 additions and 34 deletions

14
typings/index.d.ts vendored
View File

@@ -1368,9 +1368,9 @@ declare module 'discord.js' {
public eval<T>(fn: (client: Client) => T): Promise<T[]>;
public fetchClientValue(prop: string): Promise<any>;
public kill(): void;
public respawn(delay?: number, spawnTimeout?: number): Promise<ChildProcess>;
public respawn(options?: { delay?: number, timeout?: number }): Promise<ChildProcess>;
public send(message: any): Promise<Shard>;
public spawn(spawnTimeout?: number): Promise<ChildProcess>;
public spawn(timeout?: number): Promise<ChildProcess>;
public on(event: 'spawn' | 'death', listener: (child: ChildProcess) => void): this;
public on(event: 'disconnect' | 'ready' | 'reconnecting', listener: () => void): this;
@@ -1401,7 +1401,7 @@ declare module 'discord.js' {
public broadcastEval<T>(fn: (client: Client) => T, shard: number): Promise<T>;
public fetchClientValues(prop: string): Promise<any[]>;
public fetchClientValues(prop: string, shard: number): Promise<any>;
public respawnAll(shardDelay?: number, respawnDelay?: number, spawnTimeout?: number): Promise<void>;
public respawnAll(options?: { shardDelay?: number, respawnDelay?: number, timeout?: number }): Promise<void>;
public send(message: any): Promise<void>;
public static singleton(client: Client, mode: ShardingManagerMode): ShardClientUtil;
@@ -1437,12 +1437,12 @@ declare module 'discord.js' {
public createShard(id: number): Shard;
public fetchClientValues(prop: string): Promise<any[]>;
public fetchClientValues(prop: string, shard: number): Promise<any>;
public respawnAll(
public respawnAll(options?: {
shardDelay?: number,
respawnDelay?: number,
spawnTimeout?: number,
): Promise<Collection<number, Shard>>;
public spawn(amount?: number | 'auto', delay?: number, spawnTimeout?: number): Promise<Collection<number, Shard>>;
timeout?: number,
}): Promise<Collection<number, Shard>>;
public spawn(options?: { amount?: number | 'auto', delay?: number, timeout?: number }): Promise<Collection<number, Shard>>;
public on(event: 'shardCreate', listener: (shard: Shard) => void): this;