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 Parameters
Section titled “Type Parameters”| Type Parameter | Default type |
|---|---|
Metadata |
undefined |
Target |
VoiceChannelTarget |
Properties
Section titled “Properties”| Property | Type |
|---|---|
guildId |
string |
Accessors
Section titled “Accessors”autoplay
Section titled “autoplay”Get Signature
Section titled “Get Signature”get autoplay():
boolean
Returns
Section titled “Returns”boolean
current
Section titled “current”Get Signature
Section titled “Get Signature”get current():
QueueItem<Metadata> |undefined
Returns
Section titled “Returns”QueueItem<Metadata> | undefined
history
Section titled “history”Get Signature
Section titled “Get Signature”get history(): readonly
QueueItem<Metadata>[]
Recently ended occurrences, newest last, bounded by DisTubeOptions.historySize.
Returns
Section titled “Returns”readonly QueueItem<Metadata>[]
paused
Section titled “paused”Get Signature
Section titled “Get Signature”get paused():
boolean
Whether the current item is paused; every item starts unpaused.
Returns
Section titled “Returns”boolean
playbackRate
Section titled “playbackRate”Get Signature
Section titled “Get Signature”get playbackRate():
number
Source seconds the voice’s filter selection plays per wall second, as the engine reports it; 1 without a voice.
Returns
Section titled “Returns”number
position
Section titled “position”Get Signature
Section titled “Get Signature”get position():
number
Elapsed source seconds of the current item; 0 without a started one.
Returns
Section titled “Returns”number
repeat
Section titled “repeat”Get Signature
Section titled “Get Signature”get repeat():
RepeatMode
Returns
Section titled “Returns”status
Section titled “status”Get Signature
Section titled “Get Signature”get status():
QueueStatus
Returns
Section titled “Returns”upcoming
Section titled “upcoming”Get Signature
Section titled “Get Signature”get upcoming(): readonly
QueueItem<Metadata>[]
Returns
Section titled “Returns”readonly QueueItem<Metadata>[]
Get Signature
Section titled “Get Signature”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.
Returns
Section titled “Returns”DisTubeVoice<Target> | undefined
Methods
Section titled “Methods”add(
input, …args):Promise<readonlyQueueItem<Metadata>[]>
Resolves input and commits it in call order. Rejects INVALID_STATE if the guild has no voice by then.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
input |
PlayInput |
…args |
AddArguments<Metadata> |
Returns
Section titled “Returns”Promise<readonly QueueItem<Metadata>[]>
clear()
Section titled “clear()”clear(): readonly
QueueItem<Metadata>[]
Removes every waiting item without ending the current one and returns them in order.
Returns
Section titled “Returns”readonly QueueItem<Metadata>[]
jump()
Section titled “jump()”jump(
target,options?):Promise<void>
Ends the current item and starts the waiting occurrence named by ID or one-based position.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
target |
string | number |
options? |
JumpOptions |
Returns
Section titled “Returns”Promise<void>
move()
Section titled “move()”move(
itemId,beforeItemId?):void
Moves a waiting occurrence before another one, or to the tail.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
itemId |
string |
beforeItemId? |
string |
Returns
Section titled “Returns”void
pause()
Section titled “pause()”pause():
Promise<void>
Commits once the Player acknowledges; idempotent.
Returns
Section titled “Returns”Promise<void>
previous()
Section titled “previous()”previous():
Promise<void>
Replays the most recent history Song as a new occurrence; the current item returns to the front.
Returns
Section titled “Returns”Promise<void>
remove()
Section titled “remove()”remove(
target): readonlyQueueItem<Metadata>[]
Removes waiting occurrences and returns them in order.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
target |
RemoveTarget |
Returns
Section titled “Returns”readonly QueueItem<Metadata>[]
resume()
Section titled “resume()”resume():
Promise<void>
Commits once the Player acknowledges; idempotent.
Returns
Section titled “Returns”Promise<void>
seek()
Section titled “seek()”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.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
seconds |
number |
Returns
Section titled “Returns”Promise<void>
setAutoplay()
Section titled “setAutoplay()”setAutoplay(
enabled):void
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
enabled |
boolean |
Returns
Section titled “Returns”void
setRepeat()
Section titled “setRepeat()”setRepeat(
mode):void
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
mode |
RepeatMode |
Returns
Section titled “Returns”void
shuffle()
Section titled “shuffle()”shuffle():
void
Returns
Section titled “Returns”void
skip()
Section titled “skip()”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.
Returns
Section titled “Returns”Promise<QueueItem<Metadata> | undefined>
stop()
Section titled “stop()”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.
Returns
Section titled “Returns”Promise<void>