seyfert 3.1.3-dev-14848708518.0 → 3.1.3-dev-14894629220.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -37,6 +37,7 @@ export declare class WorkerClient<Ready extends boolean = boolean> extends BaseC
|
|
|
37
37
|
loadEvents(dir?: string): Promise<void>;
|
|
38
38
|
postMessage(body: WorkerMessages): unknown;
|
|
39
39
|
handleManagerMessages(data: ManagerMessages): Promise<any>;
|
|
40
|
+
calculateShardId(guildId: string): number;
|
|
40
41
|
private generateNonce;
|
|
41
42
|
private generateSendPromise;
|
|
42
43
|
tellWorker<R, V extends Record<string, unknown>>(workerId: number, func: (_: this, vars: V) => R, vars: V): Promise<R>;
|
|
@@ -46,7 +47,7 @@ export declare class WorkerClient<Ready extends boolean = boolean> extends BaseC
|
|
|
46
47
|
protected onPacket(packet: GatewayDispatchPayload, shardId: number): Promise<void>;
|
|
47
48
|
}
|
|
48
49
|
export declare function generateShardInfo(shard: Shard): WorkerShardInfo;
|
|
49
|
-
interface WorkerClientOptions extends BaseClientOptions {
|
|
50
|
+
export interface WorkerClientOptions extends BaseClientOptions {
|
|
50
51
|
commands?: NonNullable<Client['options']>['commands'];
|
|
51
52
|
handlePayload?: ShardManagerOptions['handlePayload'];
|
|
52
53
|
gateway?: ClientOptions['gateway'];
|
|
@@ -55,4 +56,3 @@ interface WorkerClientOptions extends BaseClientOptions {
|
|
|
55
56
|
sendPayloadToParent?: boolean;
|
|
56
57
|
handleManagerMessages?(message: ManagerMessages): any;
|
|
57
58
|
}
|
|
58
|
-
export {};
|
|
@@ -335,11 +335,16 @@ class WorkerClient extends base_1.BaseClient {
|
|
|
335
335
|
return this.onPacket(packet, shardId);
|
|
336
336
|
};
|
|
337
337
|
}
|
|
338
|
+
workerData.totalShards = data.totalShards;
|
|
339
|
+
workerData.shards = [...this.shards.keys()];
|
|
338
340
|
this.resharding.clear();
|
|
339
341
|
}
|
|
340
342
|
break;
|
|
341
343
|
}
|
|
342
344
|
}
|
|
345
|
+
calculateShardId(guildId) {
|
|
346
|
+
return (0, common_1.calculateShardId)(guildId, this.workerData.totalShards);
|
|
347
|
+
}
|
|
343
348
|
generateNonce() {
|
|
344
349
|
const uuid = (0, node_crypto_1.randomUUID)();
|
|
345
350
|
if (this.promises.has(uuid))
|
|
@@ -88,7 +88,9 @@ export type ManagerWorkerAlreadyExistsResharding = CreateManagerMessage<'WORKER_
|
|
|
88
88
|
export type ManagerSpawnShards = CreateManagerMessage<'SPAWN_SHARDS', Pick<ShardOptions, 'info' | 'properties' | 'compress'>>;
|
|
89
89
|
export type ManagerSpawnShardsResharding = CreateManagerMessage<'SPAWN_SHARDS_RESHARDING', Pick<ShardOptions, 'info' | 'properties' | 'compress'>>;
|
|
90
90
|
export type DisconnectAllShardsResharding = CreateManagerMessage<'DISCONNECT_ALL_SHARDS_RESHARDING'>;
|
|
91
|
-
export type ConnnectAllShardsResharding = CreateManagerMessage<'CONNECT_ALL_SHARDS_RESHARDING'
|
|
91
|
+
export type ConnnectAllShardsResharding = CreateManagerMessage<'CONNECT_ALL_SHARDS_RESHARDING', {
|
|
92
|
+
totalShards: number;
|
|
93
|
+
}>;
|
|
92
94
|
export type ManagerSendPayload = CreateManagerMessage<'SEND_PAYLOAD', GatewaySendPayload & {
|
|
93
95
|
shardId: number;
|
|
94
96
|
nonce: string;
|