Skip to content

QueueManager

Queue manager

new QueueManager(distube): QueueManager;

Create a new base object.

DisTube

The DisTube instance

QueueManager

GuildIdManager.constructor

collection: Collection<string, Queue>;

The collection of items for this manager.

GuildIdManager.collection


distube: DisTube;

The DisTube instance this object belongs to.

GuildIdManager.distube

get client(): Client;

Discord.js client

Client

GuildIdManager.client


get handler(): DisTubeHandler;

DisTube handler

DisTubeHandler

GuildIdManager.handler


get options(): Options;

DisTube options

Options

GuildIdManager.options


get plugins(): DisTubePlugin[];

DisTube plugins

DisTubePlugin[]

GuildIdManager.plugins


get queues(): QueueManager;

The queue manager

QueueManager

GuildIdManager.queues


get size(): number;

The size of the collection.

number

GuildIdManager.size


get voices(): DisTubeVoiceManager;

The voice manager

DisTubeVoiceManager

GuildIdManager.voices

add(idOrInstance, data): QueueManager;

Add an item to the collection.

The item is not added when there is already one for the same guild.

GuildIdResolvable

The guild id, or anything that can be resolved to a guild id

Queue

The item to add

QueueManager

This manager, to allow chaining

DisTubeError When the value cannot be resolved to a guild id

GuildIdManager.add


create(channel, textChannel?): Promise<Queue>;

Create a Queue

VoiceBasedChannel

A voice channel

GuildTextBasedChannel

Default text channel

Promise<Queue>

The created queue

DisTubeError When the guild already has a queue, or when the voice channel cannot be joined


debug(message): void;

Emit debug event

string

debug message

void

Nothing

GuildIdManager.debug


emit(eventName, ...args): boolean;

Emit the DisTube of this base

keyof DisTubeEvents

Event name

…any

arguments

boolean

true when the event had listeners, false otherwise

GuildIdManager.emit


emitError(
error,
queue,
song?
): void;

Emit error event

Error

error

Queue

The queue encountered the error

Song<unknown>

The playing song when encountered the error

void

Nothing

GuildIdManager.emitError


get(idOrInstance): Queue | undefined;

Get the item of a guild.

GuildIdResolvable

The guild id, or anything that can be resolved to a guild id

Queue | undefined

The item of the guild, or undefined when there is none

DisTubeError When the value cannot be resolved to a guild id

GuildIdManager.get


handleSongFinish(queue): Promise<void>;

Handle the queue when a Song finish

Queue

queue

Promise<void>

A promise that resolves when the next song is playing


has(idOrInstance): boolean;

Check whether a guild has an item.

GuildIdResolvable

The guild id, or anything that can be resolved to a guild id

boolean

true when there is an item for the guild

DisTubeError When the value cannot be resolved to a guild id

GuildIdManager.has


playSong(
queue,
emitPlaySong?,
options?
): Promise<void>;

Play a song on voice connection with queue properties

Queue

The guild queue to play

boolean = true

Whether or not emit Events.PLAY_SONG event

Optional options

boolean

Whether the current song has to stay in the queue when the stream cannot be started

Promise<void>

A promise that resolves when the song is playing

DisTubeError When the song does not have any stream URL


preloadNextSong(queue): Promise<void>;

Preload the next song in the queue.

Queue

The guild queue

Promise<void>


remove(idOrInstance): boolean;

Remove the item of a guild.

GuildIdResolvable

The guild id, or anything that can be resolved to a guild id

boolean

true when an item was removed, false otherwise

DisTubeError When the value cannot be resolved to a guild id

GuildIdManager.remove


scheduleCrossfade(queue): void;

Schedule the crossfade into the next song: a single FFmpeg process mixes the current song (seeked to its final fade window) with the next song, and replaces the playback stream exactly when the fade window begins.

Canceled automatically whenever the preloaded state is invalidated (pause, seek, stop…), as both schedulers share the same generation.

Queue

The guild queue

void


schedulePreload(queue): void;

Schedule preloading the next song in the queue before the current song finishes.

Queue

The guild queue

void