mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-03 05:26:07 +00:00
feat: getRC in workerManager
This commit is contained in:
parent
a0a70066ef
commit
d8d6ff6b47
@ -1,3 +1,4 @@
|
|||||||
|
import type { InternalRuntimeConfig, InternalRuntimeConfigHTTP } from '../../client/base';
|
||||||
import type { Awaitable, DeepPartial, Logger } from '../../common';
|
import type { Awaitable, DeepPartial, Logger } from '../../common';
|
||||||
import type {
|
import type {
|
||||||
APIGatewayBotInfo,
|
APIGatewayBotInfo,
|
||||||
@ -73,6 +74,8 @@ export interface WorkerManagerOptions extends Omit<ShardManagerOptions, 'handleP
|
|||||||
handleWorkerMessage?(message: WorkerMessages): any;
|
handleWorkerMessage?(message: WorkerMessages): any;
|
||||||
|
|
||||||
properties?: DeepPartial<NonNullable<ShardManagerOptions['properties']>>;
|
properties?: DeepPartial<NonNullable<ShardManagerOptions['properties']>>;
|
||||||
|
|
||||||
|
getRC?(): Awaitable<InternalRuntimeConfig | InternalRuntimeConfigHTTP>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ShardData {
|
export interface ShardData {
|
||||||
|
@ -46,7 +46,7 @@ export class WorkerManager extends Map<
|
|||||||
return chunks;
|
return chunks;
|
||||||
}
|
}
|
||||||
|
|
||||||
options: PickPartial<Required<WorkerManagerOptions>, 'adapter' | 'handleWorkerMessage' | 'handlePayload'>;
|
options: PickPartial<Required<WorkerManagerOptions>, 'adapter' | 'handleWorkerMessage' | 'handlePayload' | 'getRC'>;
|
||||||
debugger?: Logger;
|
debugger?: Logger;
|
||||||
connectQueue!: ConnectQueue;
|
connectQueue!: ConnectQueue;
|
||||||
workerQueue: (() => void)[] = [];
|
workerQueue: (() => void)[] = [];
|
||||||
@ -553,9 +553,11 @@ export class WorkerManager extends Map<
|
|||||||
}
|
}
|
||||||
|
|
||||||
async start() {
|
async start() {
|
||||||
const rc = await BaseClient.prototype.getRC<InternalRuntimeConfig>();
|
const rc =
|
||||||
|
((await this.options.getRC?.()) as InternalRuntimeConfig | undefined) ??
|
||||||
|
(await BaseClient.prototype.getRC<InternalRuntimeConfig>());
|
||||||
|
|
||||||
this.options.debug ||= rc.debug;
|
this.options.debug ||= rc.debug ?? false;
|
||||||
this.options.intents ||= rc.intents ?? 0;
|
this.options.intents ||= rc.intents ?? 0;
|
||||||
this.options.token ??= rc.token;
|
this.options.token ??= rc.token;
|
||||||
this.rest ??= new ApiHandler({
|
this.rest ??= new ApiHandler({
|
||||||
|
Loading…
x
Reference in New Issue
Block a user