discord.js-rate-limiter
Version:
Rate limiter for discord.js.
23 lines (22 loc) • 766 B
TypeScript
export declare class RateLimiter {
amount: number;
interval: number;
private limiters;
/**
* Creates a new RateLimiter object to control rate limiting.
*
* @param amount - Amount of times an action can be done within an interval. Ex: `2` would mean 2 times.
* @param interval - Length of an interval in milliseconds. Ex: `5000` would mean 5 seconds.
*
* @returns RateLimiter object.
*/
constructor(amount: number, interval: number);
/**
* Takes a token from the rate limiter.
*
* @param key Key which identifies the entity being limited (Ex: a username or ID).
*
* @returns Whether this action exceeds the rate limit.
*/
take(key: string): boolean;
}