GuildQueue and node
Queue options, methods, state, and the playback node.
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 } });| Option | Description |
|---|---|
metadata | Your data, stored on the queue |
maxSize, maxHistorySize | Limits for upcoming and past tracks. Zero or less means unlimited |
disableHistory | Do not record history |
repeatMode | Initial repeat mode |
volume | Initial volume percentage, 0 to 200 |
filterGraph | Raw FFmpeg graph for new sessions |
selfDeaf, selfMute | Initial voice flags |
crossfade | Crossfade for this queue. false disables it |
selectNode | Chooses the Remedia node for the first session |
leaveOnEmpty, leaveOnEnd, leaveOnStop | Leave policies |
leaveOnEmptyCooldown, leaveOnEndCooldown, leaveOnStopCooldown | Delay in milliseconds |
pauseOnEmpty | Pause when the channel is confirmed empty |
onBeforeCreateStream, onStreamExtracted, onAfterCreateStream | Resource hooks |
Options apply when the queue is created.
Methods
| Method | Description |
|---|---|
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
| Property | Description |
|---|---|
guildId | The guild ID |
currentTrack | The playing or paused track, or null |
tracks | Upcoming tracks |
size, maxSize, maxHistorySize | Counts and limits. size excludes the current track |
estimatedDuration | Duration of upcoming tracks in milliseconds |
history | The history manager |
node | The playback node |
metadata | Your data |
repeatMode, isShuffling | Repeat and shuffle state |
isPlaying() | true while playing, including when paused |
filters | Same as node.filters |
syncedLyrics | Synchronized lyrics |
stats | Counters for finished and failed tracks |
signal | AbortSignal 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);| Member | Description |
|---|---|
pause(), resume(), setPaused(paused) | Playback state |
seek(ms) | Seek to a position |
setVolume(percent) | 0 to 200 |
volume | Current volume percentage |
playbackTime, streamTime | Elapsed playback time in milliseconds |
totalDuration | Track duration in milliseconds |
getTimestamp() | { current, total, progress } or null |
createProgressBar(options?) | Text progress bar |
isIdle(), isPlaying(), isPaused() | Session status |
filters | Audio 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