status-sharding
Version:
Welcome to Status Sharding! This package is designed to provide an efficient and flexible solution for sharding Discord bots, allowing you to scale your bot across multiple processes or workers.
17 lines (16 loc) • 880 B
TypeScript
import { Serializable, StoredPromise } from '../types';
import { BaseMessage, DataType } from '../other/message';
import { ClusterManager } from '../core/clusterManager';
import { ClusterClient } from '../core/clusterClient';
/** Handles promises by storing them in a map and resolving them when the response is received. */
export declare class PromiseHandler {
private instance;
/** List of promises and their unique identifiers. */
nonces: Map<string, StoredPromise>;
/** Creates an instance of PromiseHandler. */
constructor(instance: ClusterManager | ClusterClient);
/** Resolves the promise with the data received. */
resolve<D extends DataType, A = Serializable, P extends object = object>(message: BaseMessage<D, A, P>): void;
/** Creates a promise and stores it in the map. */
create<T>(nonce: string, timeout?: number): Promise<T>;
}