Skip to main content
Latest
interface QueueBucket
import { type QueueBucket } from "https://deno.land/x/discordeno@18.0.1/rest/createQueueBucket.ts";

Properties

remaining: number

Amount of requests that have are remaining. Defaults to 1.

max: number

Max requests for this bucket. Defaults to 1.

interval: number

The time that discord allows to make the max number of requests. Defaults to 0

timeoutId: number

timer to reset to 0

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

The requests that are currently pending.

pending: BucketRequest[]

The requests that are currently pending.

processing: boolean

Whether or not the waiting queue is already processing.

processingPending: boolean

Whether or not the pending queue is already processing.

firstRequest: boolean

Whether the first request is pending.

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.

processPending: () => Promise<void>

Begins processing the pending queue of requests.

handleCompletedRequest: (headers: { remaining: number; interval: number; max: number; }) => void

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

makeRequest: (options: BucketRequest) => Promise<void>

Adds a request to the queue.