Skip to main content

Queue

@discordeno/bot


Documentation / @discordeno/bot / Queue

Class: Queue

Defined in: packages/rest/dist/types/queue.d.ts:2

Constructors

new Queue()

new Queue(rest, options): Queue

Defined in: packages/rest/dist/types/queue.d.ts:38

Parameters

rest

RestManager

options

QueueOptions

Returns

Queue

Properties

deleteQueueDelay

deleteQueueDelay: number

Defined in: packages/rest/dist/types/queue.d.ts:28

The time in milliseconds to wait before deleting this queue if it is empty. Defaults to 60000(one minute).


deleteQueueTimeout?

optional deleteQueueTimeout: Timeout

Defined in: packages/rest/dist/types/queue.d.ts:30

The timeout for the deletion of this queue


firstRequest

firstRequest: boolean

Defined in: packages/rest/dist/types/queue.d.ts:22

Whether the first request is pending.


frozenAt

frozenAt: number

Defined in: packages/rest/dist/types/queue.d.ts:26

When requests started being made to determine when the interval will reset it.


identifier

identifier: string

Defined in: packages/rest/dist/types/queue.d.ts:37

The identifier for this request, may be the request authorization or fallback to the bot auth

Remarks

This is used to get the identify this queue from the queue mapping of the rest manager


interval

interval: number

Defined in: packages/rest/dist/types/queue.d.ts:10

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


max

max: number

Defined in: packages/rest/dist/types/queue.d.ts:8

Max requests for this this. Defaults to 1.


pending

pending: SendRequestOptions[]

Defined in: packages/rest/dist/types/queue.d.ts:16

The requests that are currently pending.


processing

processing: boolean

Defined in: packages/rest/dist/types/queue.d.ts:18

Whether or not the waiting queue is already processing.


processingPending

processingPending: boolean

Defined in: packages/rest/dist/types/queue.d.ts:20

Whether or not the pending queue is already processing.


remaining

remaining: number

Defined in: packages/rest/dist/types/queue.d.ts:6

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


rest

rest: RestManager

Defined in: packages/rest/dist/types/queue.d.ts:4

The rest manager


timeoutId

timeoutId: undefined | Timeout

Defined in: packages/rest/dist/types/queue.d.ts:12

timer to reset to 0


url

url: string

Defined in: packages/rest/dist/types/queue.d.ts:24

The url that all the requests in this queue are sent to.


waiting

waiting: (value) => void[]

Defined in: packages/rest/dist/types/queue.d.ts:14

The requests that are currently pending.

Parameters

value

void | PromiseLike<void>

Returns

void

Accessors

queueType

Get Signature

get queueType(): string

Defined in: packages/rest/dist/types/queue.d.ts:58

Returns

string

Methods

cleanup()

cleanup(): void

Defined in: packages/rest/dist/types/queue.d.ts:55

Cleans up the queue by checking if there is nothing left and removing it.

Returns

void


handleCompletedRequest()

handleCompletedRequest(headers): void

Defined in: packages/rest/dist/types/queue.d.ts:47

Parameters

headers
interval

number

max

number

remaining

number

Returns

void


isQueueClearable()

isQueueClearable(): boolean

Defined in: packages/rest/dist/types/queue.d.ts:57

Simply checks if the queue is able to be cleared or it has requests pending.

Returns

boolean


isRequestAllowed()

isRequestAllowed(): boolean

Defined in: packages/rest/dist/types/queue.d.ts:40

Check if there is any remaining requests that are allowed.

Returns

boolean


makeRequest()

makeRequest(options): Promise<void>

Defined in: packages/rest/dist/types/queue.d.ts:53

Checks if a request is available and adds it to the queue. Also triggers queue processing if not already processing.

Parameters

options

SendRequestOptions

Returns

Promise<void>


processPending()

processPending(): Promise<void>

Defined in: packages/rest/dist/types/queue.d.ts:46

Process the queue of all requests pending to be sent.

Returns

Promise<void>


processWaiting()

processWaiting(): Promise<void>

Defined in: packages/rest/dist/types/queue.d.ts:44

Process the queue of requests waiting to be handled.

Returns

Promise<void>


waitUntilRequestAvailable()

waitUntilRequestAvailable(): Promise<void>

Defined in: packages/rest/dist/types/queue.d.ts:42

Pauses the execution until a request is allowed to be made.

Returns

Promise<void>