QueueManager
Queue manager
Extends
Section titled “Extends”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new QueueManager(distube): QueueManager;Create a new base object.
Parameters
Section titled “Parameters”distube
Section titled “distube”The DisTube instance
Returns
Section titled “Returns”QueueManager
Inherited from
Section titled “Inherited from”Properties
Section titled “Properties”collection
Section titled “collection”collection: Collection<string, Queue>;The collection of items for this manager.
Inherited from
Section titled “Inherited from”distube
Section titled “distube”distube: DisTube;The DisTube instance this object belongs to.
Inherited from
Section titled “Inherited from”Accessors
Section titled “Accessors”client
Section titled “client”Get Signature
Section titled “Get Signature”get client(): Client;Discord.js client
Returns
Section titled “Returns”Client
Inherited from
Section titled “Inherited from”handler
Section titled “handler”Get Signature
Section titled “Get Signature”get handler(): DisTubeHandler;DisTube handler
Returns
Section titled “Returns”Inherited from
Section titled “Inherited from”options
Section titled “options”Get Signature
Section titled “Get Signature”get options(): Options;DisTube options
Returns
Section titled “Returns”Inherited from
Section titled “Inherited from”plugins
Section titled “plugins”Get Signature
Section titled “Get Signature”get plugins(): DisTubePlugin[];DisTube plugins
Returns
Section titled “Returns”Inherited from
Section titled “Inherited from”queues
Section titled “queues”Get Signature
Section titled “Get Signature”get queues(): QueueManager;The queue manager
Returns
Section titled “Returns”QueueManager
Inherited from
Section titled “Inherited from”Get Signature
Section titled “Get Signature”get size(): number;The size of the collection.
Returns
Section titled “Returns”number
Inherited from
Section titled “Inherited from”voices
Section titled “voices”Get Signature
Section titled “Get Signature”get voices(): DisTubeVoiceManager;The voice manager
Returns
Section titled “Returns”Inherited from
Section titled “Inherited from”Methods
Section titled “Methods”add(idOrInstance, data): QueueManager;Add an item to the collection.
The item is not added when there is already one for the same guild.
Parameters
Section titled “Parameters”idOrInstance
Section titled “idOrInstance”The guild id, or anything that can be resolved to a guild id
The item to add
Returns
Section titled “Returns”QueueManager
This manager, to allow chaining
Throws
Section titled “Throws”DisTubeError When the value cannot be resolved to a guild id
Inherited from
Section titled “Inherited from”create()
Section titled “create()”create(channel, textChannel?): Promise<Queue>;Create a Queue
Parameters
Section titled “Parameters”channel
Section titled “channel”VoiceBasedChannel
A voice channel
textChannel?
Section titled “textChannel?”GuildTextBasedChannel
Default text channel
Returns
Section titled “Returns”Promise<Queue>
The created queue
Throws
Section titled “Throws”DisTubeError When the guild already has a queue, or when the voice channel cannot be joined
debug()
Section titled “debug()”debug(message): void;Emit debug event
Parameters
Section titled “Parameters”message
Section titled “message”string
debug message
Returns
Section titled “Returns”void
Nothing
Inherited from
Section titled “Inherited from”emit()
Section titled “emit()”emit(eventName, ...args): boolean;Emit the DisTube of this base
Parameters
Section titled “Parameters”eventName
Section titled “eventName”keyof DisTubeEvents
Event name
…any
arguments
Returns
Section titled “Returns”boolean
true when the event had listeners, false otherwise
Inherited from
Section titled “Inherited from”emitError()
Section titled “emitError()”emitError( error, queue, song?): void;Emit error event
Parameters
Section titled “Parameters”Error
error
The queue encountered the error
Song<unknown>
The playing song when encountered the error
Returns
Section titled “Returns”void
Nothing
Inherited from
Section titled “Inherited from”get(idOrInstance): Queue | undefined;Get the item of a guild.
Parameters
Section titled “Parameters”idOrInstance
Section titled “idOrInstance”The guild id, or anything that can be resolved to a guild id
Returns
Section titled “Returns”Queue | undefined
The item of the guild, or undefined when there is none
Throws
Section titled “Throws”DisTubeError When the value cannot be resolved to a guild id
Inherited from
Section titled “Inherited from”handleSongFinish()
Section titled “handleSongFinish()”handleSongFinish(queue): Promise<void>;Handle the queue when a Song finish
Parameters
Section titled “Parameters”queue
Returns
Section titled “Returns”Promise<void>
A promise that resolves when the next song is playing
has(idOrInstance): boolean;Check whether a guild has an item.
Parameters
Section titled “Parameters”idOrInstance
Section titled “idOrInstance”The guild id, or anything that can be resolved to a guild id
Returns
Section titled “Returns”boolean
true when there is an item for the guild
Throws
Section titled “Throws”DisTubeError When the value cannot be resolved to a guild id
Inherited from
Section titled “Inherited from”playSong()
Section titled “playSong()”playSong( queue, emitPlaySong?, options?): Promise<void>;Play a song on voice connection with queue properties
Parameters
Section titled “Parameters”The guild queue to play
emitPlaySong?
Section titled “emitPlaySong?”boolean = true
Whether or not emit Events.PLAY_SONG event
options?
Section titled “options?”Optional options
keepSongOnError?
Section titled “keepSongOnError?”boolean
Whether the current song has to stay in the queue when the stream cannot be started
Returns
Section titled “Returns”Promise<void>
A promise that resolves when the song is playing
Throws
Section titled “Throws”DisTubeError When the song does not have any stream URL
preloadNextSong()
Section titled “preloadNextSong()”preloadNextSong(queue): Promise<void>;Preload the next song in the queue.
Parameters
Section titled “Parameters”The guild queue
Returns
Section titled “Returns”Promise<void>
remove()
Section titled “remove()”remove(idOrInstance): boolean;Remove the item of a guild.
Parameters
Section titled “Parameters”idOrInstance
Section titled “idOrInstance”The guild id, or anything that can be resolved to a guild id
Returns
Section titled “Returns”boolean
true when an item was removed, false otherwise
Throws
Section titled “Throws”DisTubeError When the value cannot be resolved to a guild id
Inherited from
Section titled “Inherited from”scheduleCrossfade()
Section titled “scheduleCrossfade()”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.
Parameters
Section titled “Parameters”The guild queue
Returns
Section titled “Returns”void
schedulePreload()
Section titled “schedulePreload()”schedulePreload(queue): void;Schedule preloading the next song in the queue before the current song finishes.
Parameters
Section titled “Parameters”The guild queue
Returns
Section titled “Returns”void