Skip to content

DisTubeQueue

One guild’s schedule over its DisTubeVoice: current, upcoming, bounded history, repeat and autoplay. Only the queue starts tracks, so it owns pause, resume and seek of its current item.

Schedule edits commit before they return and throw instead of rejecting. A queue is deleted on stop, exhaustion, voice loss, leave or shutdown; a deleted queue rejects every command except stop with INVALID_STATE.

Type Parameter Default type
Metadata undefined
Target VoiceChannelTarget
Property Type
guildId string

get autoplay(): boolean

boolean


get current(): QueueItem<Metadata> | undefined

QueueItem<Metadata> | undefined


get history(): readonly QueueItem<Metadata>[]

Recently ended occurrences, newest last, bounded by DisTubeOptions.historySize.

readonly QueueItem<Metadata>[]


get paused(): boolean

Whether the current item is paused; every item starts unpaused.

boolean


get playbackRate(): number

Source seconds the voice’s filter selection plays per wall second, as the engine reports it; 1 without a voice.

number


get position(): number

Elapsed source seconds of the current item; 0 without a started one.

number


get repeat(): RepeatMode

RepeatMode


get status(): QueueStatus

QueueStatus


get upcoming(): readonly QueueItem<Metadata>[]

readonly QueueItem<Metadata>[]


get voice(): DisTubeVoice<Target> | undefined

Undefined until the first commit and after deletion, so a held queue never reaches a voice another queue now uses.

DisTubeVoice<Target> | undefined

add(input, …args): Promise<readonly QueueItem<Metadata>[]>

Resolves input and commits it in call order. Rejects INVALID_STATE if the guild has no voice by then.

Parameter Type
input PlayInput
…args AddArguments<Metadata>

Promise<readonly QueueItem<Metadata>[]>


clear(): readonly QueueItem<Metadata>[]

Removes every waiting item without ending the current one and returns them in order.

readonly QueueItem<Metadata>[]


jump(target, options?): Promise<void>

Ends the current item and starts the waiting occurrence named by ID or one-based position.

Parameter Type
target string | number
options? JumpOptions

Promise<void>


move(itemId, beforeItemId?): void

Moves a waiting occurrence before another one, or to the tail.

Parameter Type
itemId string
beforeItemId? string

void


pause(): Promise<void>

Commits once the Player acknowledges; idempotent.

Promise<void>


previous(): Promise<void>

Replays the most recent history Song as a new occurrence; the current item returns to the front.

Promise<void>


remove(target): readonly QueueItem<Metadata>[]

Removes waiting occurrences and returns them in order.

Parameter Type
target RemoveTarget

readonly QueueItem<Metadata>[]


resume(): Promise<void>

Commits once the Player acknowledges; idempotent.

Promise<void>


seek(seconds): Promise<void>

Seeks the current item within a known duration. Rejects UNSUPPORTED for a stream resource or a Player that cannot seek the item, and INVALID_STATE when the item ends before the seek lands.

Parameter Type
seconds number

Promise<void>


setAutoplay(enabled): void

Parameter Type
enabled boolean

void


setRepeat(mode): void

Parameter Type
mode RepeatMode

void


shuffle(): void

void


skip(): Promise<QueueItem<Metadata> | undefined>

Ends the current item, or drops the waiting head while nothing is current, and plays the next. Resolves, once the ended item has stopped, the item that was first in upcoming when the skip committed, or undefined when none waited. Rejects INVALID_STATE while an earlier skip, jump or previous is still ending its item.

Promise<QueueItem<Metadata> | undefined>


stop(): Promise<void>

Deletes the queue and keeps the voice with its settings. While the first join is pending it leaves instead. Repeated calls, also on a deleted queue, share one completion.

Promise<void>