Class: RateLimit<K>
Defined in: projects/utilities/packages/ratelimits/src/lib/RateLimit.ts:3
Type Parameters
Type Parameter | Default type |
---|---|
K | string |
Constructors
new RateLimit()
new RateLimit<
K
>(manager
:RateLimitManager
<K
>):RateLimit
<K
>
Defined in: projects/utilities/packages/ratelimits/src/lib/RateLimit.ts:22
Parameters
Parameter | Type | Description |
---|---|---|
manager | RateLimitManager <K > | The manager for this entry. |
Returns
RateLimit
<K
>
Properties
expires
expires:
number
Defined in: projects/utilities/packages/ratelimits/src/lib/RateLimit.ts:12
The timestamp that represents when this entry will reset back to a available state.
manager
private
manager:RateLimitManager
<K
>
Defined in: projects/utilities/packages/ratelimits/src/lib/RateLimit.ts:17
The RateLimitManager this entry is for.
remaining
remaining:
number
Defined in: projects/utilities/packages/ratelimits/src/lib/RateLimit.ts:7
The remaining amount of times this entry can be dripped before the bucket is empty.
Accessors
expired
Get Signature
get expired():
boolean
Defined in: projects/utilities/packages/ratelimits/src/lib/RateLimit.ts:30
Whether this entry is expired or not, allowing the bucket to be reset.
Returns
boolean
limited
Get Signature
get limited():
boolean
Defined in: projects/utilities/packages/ratelimits/src/lib/RateLimit.ts:37
Whether this entry is limited or not.
Returns
boolean
remainingTime
Get Signature
get remainingTime():
number
Defined in: projects/utilities/packages/ratelimits/src/lib/RateLimit.ts:44
The remaining time in milliseconds before resetting.
Returns
number
Methods
consume()
consume():
this
Defined in: projects/utilities/packages/ratelimits/src/lib/RateLimit.ts:51
Consumes RateLimit.remaining by one if it's not limited, calling RateLimit.reset first if RateLimit.expired is true.
Returns
this
reset()
reset():
this
Defined in: projects/utilities/packages/ratelimits/src/lib/RateLimit.ts:62
Resets the entry back to it's full state.
Returns
this
resetRemaining()
resetRemaining():
this
Defined in: projects/utilities/packages/ratelimits/src/lib/RateLimit.ts:69
Resets the entry's RateLimit.remaining uses back to full state.
Returns
this
resetTime()
resetTime():
this
Defined in: projects/utilities/packages/ratelimits/src/lib/RateLimit.ts:77
Resets the entry's RateLimit.expires to the current time plus RateLimitManager.time.
Returns
this