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