import { Serializable } from "child_process"; import EventEmitter from "events"; import { ClusterManager as Manager } from "../Core/ClusterManager"; import { ChildClient } from "../Structures/Child"; import { RawMessage } from "../Structures/IPCMessage"; import { PromiseHandler } from "../Structures/PromiseHandler"; import { WorkerClient } from "../Structures/Worker"; import { Awaitable, ClusterClientEvents, DjsDiscordClient, evalOptions, Serialized } from "../types/shared"; export declare class ClusterClient extends EventEmitter { client: DiscordClient; mode: 'process' | 'worker'; shardList: number[]; queue: { mode: 'auto' | string | undefined; }; maintenance: string | undefined | Boolean; ready: boolean; process: ChildClient | WorkerClient | null; messageHandler: any; promise: PromiseHandler; constructor(client: DiscordClient); /** * cluster's id */ get id(): number; /** * Array of shard IDs of this client * @deprecated use client.cluster.shards for getting a collecton of ws shards or client.cluster.shardList for an array of ids */ get ids(): number[] | import("discord.js").Collection; /** * */ get shards(): import("discord.js").Collection; /** * Total number of clusters */ get count(): number; /** * Gets some Info like Cluster_Count, Number, Total shards... */ get info(): import("../Structures/Data").ClusterClientData; /** * Sends a message to the master process. * @fires Cluster#message */ send(message: Serializable): Promise | undefined; /** * Fetches a client property value of each cluster, or a given cluster. * @example * client.cluster.fetchClientValues('guilds.cache.size') * .then(results => console.log(`${results.reduce((prev, val) => prev + val, 0)} total guilds`)) * .catch(console.error); * @see {@link ClusterManager#fetchClientValues} */ fetchClientValues(prop: string, cluster?: number): Promise; /** * Evaluates a script or function on the Cluster Manager * @example * client.cluster.evalOnManager('process.uptime') * .then(result => console.log(result)) * .catch(console.error); * @see {@link ClusterManager#evalOnManager} */ evalOnManager(script: string): Promise; evalOnManager(script: string, options?: evalOptions): Promise; evalOnManager(fn: (manager: Manager) => T, options?: evalOptions): Promise; evalOnManager(fn: (manager: Manager) => T, options?: evalOptions): Promise; /** * Evaluates a script or function on all clusters, or a given cluster, in the context of the {@link DjsDiscordClient}s. * @example * client.cluster.broadcastEval('this.guilds.cache.size') * .then(results => console.log(`${results.reduce((prev, val) => prev + val, 0)} total guilds`)) * .catch(console.error); * @see {@link ClusterManager#broadcastEval} */ broadcastEval(script: string): Promise; broadcastEval(script: string, options?: evalOptions): Promise; broadcastEval(fn: (client: DiscordClient) => Awaitable): Promise[]>; broadcastEval(fn: (client: DiscordClient) => Awaitable, options?: { cluster?: number; timeout?: number; }): Promise>; broadcastEval(fn: (client: DiscordClient, context: Serialized

) => Awaitable, options?: evalOptions

): Promise[]>; broadcastEval(fn: (client: DiscordClient, context: Serialized

) => Awaitable, options?: evalOptions

): Promise>; /** * Sends a Request to the ParentCluster and returns the reply * @example * client.cluster.request({content: 'hello'}) * .then(result => console.log(result)) //hi * .catch(console.error); * @see {@link IPCMessage#reply} */ request(message: RawMessage): Promise; /** * Requests a respawn of all clusters. * @see {@link ClusterManager#respawnAll} */ respawnAll(options?: { clusterDelay?: number; respawnDelay?: number; timeout?: number; }): Promise | undefined; /** * Handles an IPC message. * @private */ private _handleMessage; _eval(script: string): Promise; /** * Sends a message to the master process, emitting an error from the client upon failure. */ _respond(type: string, message: Serializable): void; triggerReady(): boolean; triggerClusterReady(): boolean; /** * * @param maintenance Whether the cluster should opt in maintenance when a reason was provided or opt-out when no reason was provided. * @param all Whether to target it on all clusters or just the current one. * @returns The maintenance status of the cluster. */ triggerMaintenance(maintenance: string, all?: boolean): string; /** * Manually spawn the next cluster, when queue mode is on 'manual' */ spawnNextCluster(): Promise | undefined; /** * gets the total Internal shard count and shard list. */ static getInfo(): import("../Structures/Data").ClusterClientData; } export interface ClusterClient { emit: (>(event: K, ...args: ClusterClientEvents[K]) => boolean) & ((event: Exclude>, ...args: any[]) => boolean); off: (>(event: K, listener: (...args: ClusterClientEvents[K]) => void) => this) & ((event: Exclude>, listener: (...args: any[]) => void) => this); on: (>(event: K, listener: (...args: ClusterClientEvents[K]) => void) => this) & ((event: Exclude>, listener: (...args: any[]) => void) => this); once: (>(event: K, listener: (...args: ClusterClientEvents[K]) => void) => this) & ((event: Exclude>, listener: (...args: any[]) => void) => this); removeAllListeners: (>(event?: K) => this) & ((event?: Exclude>) => this); } //# sourceMappingURL=ClusterClient.d.ts.map