WorkerClient
Signature
export interface WorkerClient<Ready extends boolean = boolean> extends RegisteredPluginExtensionProperties
49Methods
22Properties
memberUpdateHandler: MemberUpdateHandler;presenceUpdateHandler: PresenceUpdateHandler;collectors: Collectors;events: EventHandler;me: When<Ready, ClientUserStructure>;promises: Map<string, { resolve: (value: any) => void; timeout: NodeJS.Timeout;}>;shards: Map<number, Shard>;resharding: Map<number, Shard>;options: WorkerClientOptions;workerIdGetterget workerId(): number;latencyGetterget latency(): number;applicationIdGetterget applicationId(): When<Ready, string, ''>;applicationIdSetterset applicationId(id: string);workerDataGetterget workerData(): WorkerData;hotReloadStateGetterget hotReloadState(): 'active' | 'standby' | 'stopped';Where this worker stands in a hot reload: `'active'` handles gateway events, `'standby'` is a replacement still preparing next to the worker it replaces, and `'stopped'` was replaced and is draining. Outside a hot reload it is always `'active'`.
isHotReloadReplacementGetterget isHotReloadReplacement(): boolean;Whether `WorkerManager.hotReload` started this worker as a replacement for another one.
rest: ApiHandler<this>;cache: Cache;applications: ApplicationShorter;users: UsersShorter;channels: ChannelShorter;guilds: GuildShorter;messages: MessageShorter;members: MemberShorter;webhooks: WebhookShorter;templates: TemplateShorter;roles: RoleShorter;reactions: ReactionShorter;emojis: EmojiShorter;threads: ThreadShorter;bans: BanShorter;interactions: InteractionShorter;voiceStates: VoiceStateShorter;soundboards: SoundboardShorter;invites: InvitesShorter;stageInstances: StageInstanceShorter;monetization: MonetizationShorter;debugger?: Logger;logger: Logger;langs: LangsHandler;commands: CommandHandler;components: ComponentHandler;handleCommand: HandleCommand;middlewares?: ClientMiddlewares;readonly plugins: ResolvedPluginList;shared: PluginSharedRegistry;proxyGetterget proxy(): APIRoutes;botIdSetterset botId(id: string);botIdGetterget botId(): string;Methods
setServices(rest: ServicesOptions): void;setWorkerData(data: WorkerData): void;start(options?: Omit<DeepPartial<StartOptions>, 'httpConnection' | 'token' | 'connection'>): Promise<void>;loadEvents(dir?: string): Promise<void>;postMessage(body: WorkerMessages | ClientHeartbeaterMessages): Promise<unknown>;handleManagerMessages(data: ManagerMessages | WorkerHeartbeaterMessages): Promise<any>;requestHotReload(options?: WorkerHotReloadRequestOptions & { onProgress?(event: HotReloadProgress): void;}): Promise<HotReloadResult>;Asks the `WorkerManager` to hot reload workers, possibly including this one. See `WorkerManager.hotReload` for how the reload works and what it guarantees. `onProgress` receives each stage as the manager reports it. If this worker is replaced, the promise resolves with the entries so far, including this worker's own, before it is told to drain, so it can still reply or log. Its stop and drain still follow. A plain `Client` has no manager; hot reload needs the `WorkerManager`.
calculateShardId(guildId: string): number;sendGatewayPayload<T extends GatewaySendPayload>(shardId: number, payload: T): Promise<boolean>;Sends a Gateway payload through the worker client's plugin wrappers and shard rate limiter.
`false` when a plugin wrapper vetoes the payload, otherwise `true` after it is sent.
tellWorker<R, V extends Record<string, unknown>>(workerId: number, func: (_: this, vars: V) => R, vars: V): Promise<R>;tellWorkers<R, V extends Record<string, unknown>>(func: (_: this, vars: V) => R, vars: V): Promise<Awaited<R>[]>;createShard(id: number, data: Pick<ManagerSpawnShards, 'info' | 'compress' | 'properties'>): Shard;resumeShard(shardId: number, shardData: MakeRequired<ShardData>): Promise<unknown>;reloadPluginContributions(): Promise<void>;close(): Promise<void>;Closes resources managed by the plugin lifecycle. This waits for in-flight plugin setup and runs `SeyfertPlugin.teardown`. It does not close the gateway, REST client, or cache adapter.
onInteractionRequest(rawBody: APIInteraction): Promise<{ headers: { 'Content-Type'?: string; }; response: APIInteractionResponse | FormData;}>;rawBody- body of interaction
uploadCommands({ applicationId, cachePath }?: { applicationId?: string; cachePath?: string;}): Promise<void>;loadCommands(dir?: string): Promise<void>;loadComponents(dir?: string): Promise<void>;loadLangs(dir?: string): Promise<void>;t(locale: string): SeyfertLocale;getRC<T extends InternalRuntimeConfigHTTP | InternalRuntimeConfig = InternalRuntimeConfigHTTP | InternalRuntimeConfig>(): Promise<ResolvedRC>;