mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-01 20:46:08 +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 {
|
||||
APIGatewayBotInfo,
|
||||
@ -73,6 +74,8 @@ export interface WorkerManagerOptions extends Omit<ShardManagerOptions, 'handleP
|
||||
handleWorkerMessage?(message: WorkerMessages): any;
|
||||
|
||||
properties?: DeepPartial<NonNullable<ShardManagerOptions['properties']>>;
|
||||
|
||||
getRC?(): Awaitable<InternalRuntimeConfig | InternalRuntimeConfigHTTP>;
|
||||
}
|
||||
|
||||
export interface ShardData {
|
||||
|
@ -46,7 +46,7 @@ export class WorkerManager extends Map<
|
||||
return chunks;
|
||||
}
|
||||
|
||||
options: PickPartial<Required<WorkerManagerOptions>, 'adapter' | 'handleWorkerMessage' | 'handlePayload'>;
|
||||
options: PickPartial<Required<WorkerManagerOptions>, 'adapter' | 'handleWorkerMessage' | 'handlePayload' | 'getRC'>;
|
||||
debugger?: Logger;
|
||||
connectQueue!: ConnectQueue;
|
||||
workerQueue: (() => void)[] = [];
|
||||
@ -553,9 +553,11 @@ export class WorkerManager extends Map<
|
||||
}
|
||||
|
||||
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.token ??= rc.token;
|
||||
this.rest ??= new ApiHandler({
|
||||
|
Loading…
x
Reference in New Issue
Block a user