Skip to main content

InvalidRequestBucket

@discordeno/restDocs


Documentation / @discordeno/rest / InvalidRequestBucket

Interface: InvalidRequestBucket

Properties

activeRequests

activeRequests: number

The amount of requests that were requested from this bucket.

Defined in

rest/src/invalidBucket.ts:136


errorStatuses

errorStatuses: number[]

The request statuses that count as an invalid request.

Defined in

rest/src/invalidBucket.ts:134


handleCompletedRequest()

handleCompletedRequest: (code, sharedScope) => void

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

Defined in

rest/src/invalidBucket.ts:153


interval

interval: number

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

Defined in

rest/src/invalidBucket.ts:128


invalidRequests

invalidRequests: number

current invalid amount

Defined in

rest/src/invalidBucket.ts:124


isRequestAllowed()

isRequestAllowed: () => boolean

Checks if a request is allowed at this time.

Returns

boolean

Defined in

rest/src/invalidBucket.ts:147


logger

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

The logger that will be used for the bucket

Type declaration

debug()

debug: (...args) => void

Parameters

• ...args: any[]

Returns

void

error()

error: (...args) => void

Parameters

• ...args: any[]

Returns

void

fatal()

fatal: (...args) => void

Parameters

• ...args: any[]

Returns

void

info()

info: (...args) => void

Parameters

• ...args: any[]

Returns

void

log()

log: (level, ...args) => void

Parameters

level: LogLevels

• ...args: any[]

Returns

void

setDepth()

setDepth: (level) => void

Parameters

level: LogDepth

Returns

void

setLevel()

setLevel: (level) => void

Parameters

level: LogLevels

Returns

void

warn()

warn: (...args) => void

Parameters

• ...args: any[]

Returns

void

Defined in

rest/src/invalidBucket.ts:142


max

max: number

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

Defined in

rest/src/invalidBucket.ts:126


processing

processing: boolean

Whether or not the waiting queue is already processing.

Defined in

rest/src/invalidBucket.ts:140


processWaiting()

processWaiting: () => Promise<void>

Begins processing the waiting queue of requests.

Returns

Promise<void>

Defined in

rest/src/invalidBucket.ts:151


requestsAllowed()

requestsAllowed: () => number

Gives the number of requests that are currently allowed.

Returns

number

Defined in

rest/src/invalidBucket.ts:145


resetAt

resetAt: undefined | number

When the timeout for this bucket has started at.

Defined in

rest/src/invalidBucket.ts:130


safety

safety: number

how safe to be from max. Defaults to 1

Defined in

rest/src/invalidBucket.ts:132


waiting

waiting: (value) => void[]

The requests that are currently pending.

Defined in

rest/src/invalidBucket.ts:138


waitUntilRequestAvailable()

waitUntilRequestAvailable: () => Promise<void>

Waits until a request is available

Returns

Promise<void>

Defined in

rest/src/invalidBucket.ts:149