Skip to main content

InvalidRequestBucket

Documentation


Documentation / @discordeno/rest / InvalidRequestBucket

Interface: InvalidRequestBucket

Defined in: invalidBucket.ts:122

Properties​

activeRequests​

activeRequests: number

Defined in: invalidBucket.ts:136

The amount of requests that were requested from this bucket.


errorStatuses​

errorStatuses: number[]

Defined in: invalidBucket.ts:134

The request statuses that count as an invalid request.


handleCompletedRequest​

handleCompletedRequest: (code, sharedScope) => void

Defined in: invalidBucket.ts:153

Handler for whenever a request is validated. This should update the requested values or trigger any other necessary stuff.

Parameters​

code​

number

sharedScope​

boolean

Returns​

void


interval​

interval: number

Defined in: invalidBucket.ts:128

The time that discord allows to make the max number of invalid requests. Defaults to 10 minutes


invalidRequests​

invalidRequests: number

Defined in: invalidBucket.ts:124

current invalid amount


isRequestAllowed​

isRequestAllowed: () => boolean

Defined in: invalidBucket.ts:147

Checks if a request is allowed at this time.

Returns​

boolean


logger​

logger: Pick<typeof logger, "debug" | "info" | "warn" | "error" | "fatal">

Defined in: invalidBucket.ts:142

The logger that will be used for the bucket


max​

max: number

Defined in: invalidBucket.ts:126

max invalid requests allowed until ban. Defaults to 10,000


processing​

processing: boolean

Defined in: invalidBucket.ts:140

Whether or not the waiting queue is already processing.


processWaiting​

processWaiting: () => Promise<void>

Defined in: invalidBucket.ts:151

Begins processing the waiting queue of requests.

Returns​

Promise<void>


requestsAllowed​

requestsAllowed: () => number

Defined in: invalidBucket.ts:145

Gives the number of requests that are currently allowed.

Returns​

number


resetAt​

resetAt: number | undefined

Defined in: invalidBucket.ts:130

When the timeout for this bucket has started at.


safety​

safety: number

Defined in: invalidBucket.ts:132

how safe to be from max. Defaults to 1


waiting​

waiting: (value) => void[]

Defined in: invalidBucket.ts:138

The requests that are currently pending.

Parameters​

value​

void | PromiseLike<void>

Returns​

void


waitUntilRequestAvailable​

waitUntilRequestAvailable: () => Promise<void>

Defined in: invalidBucket.ts:149

Waits until a request is available

Returns​

Promise<void>