Skip to main content
Extremely Popular
Go to Latest
interface InvalidRequestBucket
import { type InvalidRequestBucket } from "https://deno.land/x/discordeno@17.2.0/rest/createInvalidRequestBucket.ts";

Properties

current: number

current invalid amount

max: number

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

interval: number

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

timeoutId: number

timer to reset to 0

safety: number

how safe to be from max. Defaults to 1

frozenAt: number

when first request in this period was made

errorStatuses: number[]

The request statuses that count as an invalid request.

requested: number

The amount of requests that were requested from this bucket.

waiting: ((value: void | PromiseLike<void>) => void)[]

The requests that are currently pending.

processing: boolean

Whether or not the waiting queue is already processing.

requestsAllowed: () => number

Gives the number of requests that are currently allowed.

isRequestAllowed: () => boolean

Checks if a request is allowed at this time.

waitUntilRequestAvailable: () => Promise<void>

Waits until a request is available

processWaiting: () => Promise<void>

Begins processing the waiting queue of requests.

handleCompletedRequest: (code: number, sharedScope: boolean) => void

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