import { Module, ModuleOptions } from './index.js'; import { Circuit, CircuitFunction } from '../circuit.js'; import { SerializableRecord } from '../helpers/serializable.js'; /** * Properties that customizes the ratelimit behavior. */ export declare abstract class RatelimitOptions extends ModuleOptions { /** * Specifies the time period during which the ratelimit is calculated */ limitPeriod?: number; /** * Specifies the maximum number of requests during the period */ limitForPeriod?: number; } /** * Returned when the ratelimit is reached. * @param message Ratelimited * @param remainingTimeInRatelimit Remaining time in ratelimit state */ export declare class RatelimitError extends Error { remainingTimeInRatelimit: number; constructor(remainingTimeInRatelimit: number, name: string); } /** * The Ratelimit module can be used to avoid sending too many requests during a configurable period of time. */ export declare class Ratelimit extends Module { /** * Specifies the time period during which the ratelimit is calculated */ limitPeriod: number; /** * Specifies the maximum number of requests during the period */ limitForPeriod: number; private requestsTime; constructor(options?: RatelimitOptions); getState(): Promise; setState(state: SerializableRecord[], ttl?: number): Promise; clearState(): Promise; execute(circuit: Circuit, promise: CircuitFunction, ...params: any[]): Promise; private addCurrentRequest; private _promiseRatelimit; }