Discord Player
API reference

GuildQueue and node

Queue options, methods, state, and the playback node.

You are reading the v8 docsDev

GuildQueue schedules tracks. queue.node is a GuildQueuePlayerNode that controls the Remedia session.

Queue options

const queue = await player.createQueue(guildId, { maxSize: 100, metadata: { textChannelId } });
OptionDescription
metadataYour data, stored on the queue
maxSize, maxHistorySizeLimits for upcoming and past tracks. Zero or less means unlimited
disableHistoryDo not record history
repeatModeInitial repeat mode
volumeInitial volume percentage, 0 to 200
filterGraphRaw FFmpeg graph for new sessions
selfDeaf, selfMuteInitial voice flags
crossfadeCrossfade for this queue. false disables it
selectNodeChooses the Remedia node for the first session
leaveOnEmpty, leaveOnEnd, leaveOnStopLeave policies
leaveOnEmptyCooldown, leaveOnEndCooldown, leaveOnStopCooldownDelay in milliseconds
pauseOnEmptyPause when the channel is confirmed empty
onBeforeCreateStream, onStreamExtracted, onAfterCreateStreamResource hooks

Options apply when the queue is created.

Methods

MethodDescription
connect(options)Join or move to options.channelId
play(resource, options?)Queue a track, batch, playlist, or search result and start if idle
playNext()Start the next upcoming track when idle
skip(reason?, description?)Skip the current track. Returns the next track or null
skipTo(target), jump(target)Skip to an upcoming track
stop()Stop playback and keep upcoming tracks
destroy(), delete()Stop, leave voice, and remove the queue
addTrack(trackOrPlaylist), addTracks(tracks)Add to the end
prepend(), append(), insertTrack()Add at a position
removeTrack(), moveTrack(), swapTracks(), copyTrack()Change upcoming tracks
clear()Remove upcoming tracks and history
setSelfDeaf(enabled), setSelfMute(enabled)Voice flags
enableShuffle(), disableShuffle(), toggleShuffle()Shuffle
setRepeatMode(mode)Set the repeat mode
setMaxSize(n), setMaxHistorySize(n)Change limits

connect() options extend the Remedia session options and add connectTimeoutMs. The initial join deadline defaults to 100 seconds.

State

PropertyDescription
guildIdThe guild ID
currentTrackThe playing or paused track, or null
tracksUpcoming tracks
size, maxSize, maxHistorySizeCounts and limits. size excludes the current track
estimatedDurationDuration of upcoming tracks in milliseconds
historyThe history manager
nodeThe playback node
metadataYour data
repeatMode, isShufflingRepeat and shuffle state
isPlaying()true while playing, including when paused
filtersSame as node.filters
syncedLyricsSynchronized lyrics
statsCounters for finished and failed tracks
signalAbortSignal that aborts as soon as destroy() starts

Lifetime signal

queue.signal aborts when queue.destroy() or queue.delete() starts, including when the Player destroys the queue. It stays aborted if cleanup fails. Stopping, skipping, pausing, or replacing a session does not abort it. A new queue for the same guild gets a new signal.

Pass it to cancellable APIs, or listen with { once: true }. Before you work with a stored queue, call queue.signal.throwIfAborted().

Playback node

await queue.node.pause();
await queue.node.seek(15_000);
await queue.node.setVolume(80);
MemberDescription
pause(), resume(), setPaused(paused)Playback state
seek(ms)Seek to a position
setVolume(percent)0 to 200
volumeCurrent volume percentage
playbackTime, streamTimeElapsed playback time in milliseconds
totalDurationTrack duration in milliseconds
getTimestamp(){ current, total, progress } or null
createProgressBar(options?)Text progress bar
isIdle(), isPlaying(), isPaused()Session status
filtersAudio filters
getSession()The Remedia session. Throws without one. getSession(false) returns null
play(track, options?)Managed playback of a track. With no argument, starts the next track
play(source)Raw playback of a Remedia media source. It does not use the queue
stopSession()Stop the raw session audio
skip(), skipTo(), jump(), stop()Delegates to the queue

Prefer the queue methods for commands. They keep history, repeat, and events consistent.

Continue reading

Events

On this page