Skip to content

Class: RatelimitManager

Constructors

constructor

• new RatelimitManager(limit)

Creates a new ratelimit manager

Parameters

Name Type Description
limit RatelimitOptions Settings for this ratelimit manager

Properties

limit

• limit: RatelimitOptions

The settings for this ratelimit manager


cache

• cache: Collection<any, Ratelimit>

All currently managed limits

Methods

get

▸ get(id): Ratelimit

Gets a ratelimit object directly

Parameters

Name Type
id any

Returns

Ratelimit


set

▸ set(id, data): void

Sets a ratelimit object directly

Parameters

Name Type
id any
data Ratelimit

Returns

void


check

▸ check(id): Ratelimit

Checks if something is ratelimited without counting as a call

Parameters

Name Type Description
id any An identifier of what you want to ratelimit

Returns

Ratelimit

A ratelimit object, if ratelimited


call

▸ call(id, cache?): Ratelimit

Calls this ratelimit

Parameters

Name Type Description
id any An identifier of what you want to ratelimit
cache? any Additional data to store

Returns

Ratelimit

A ratelimit object, if ratelimited


clear

▸ clear(id): boolean

Resets a ratelimit

Parameters

Name Type Description
id any An identifier of what you want to ratelimit

Returns

boolean

Back to top