Skip to main content
Version: v2.8.6 (current)

Queue

Constructor

new Magmastream.Queue(guildId: string, manager: Manager)
Parameter Type Description Optional
guildIdstring as Guild.idThe guild ID
managerManagerThe Manager instance.

Table of contents

Properties Methods
currentadd()
guildIdclear()
managerduration()
previousremove()
roundRobinShuffle()
shuffle()
size()
totalSize()
userBlockShuffle()

Properties

current

The current track

Return: track{} | null

guildId

The guild ID property.

Return: string as Guild.id

manager

The Manager instance.

Return: Manager

previous

The previous track

Return: track{} | null

Methods

add(track, offset)

Adds a track to the queue.

Return: void

Parameter Type Description Optional
tracktrack{} | track{}[]The track or tracks to add. Can be a single Track or an array of Tracks.
offsetnumberThe position to add the track(s) at. If not provided, the track(s) will be added at the end of the queue.

clear()

Clears the queue.

This will remove all tracks from the queue and emit a state update event.

Return: void

duration()

The total duration of the queue in milliseconds.

This includes the duration of the currently playing track.

Return: number

remove(start | position, end)

Removes track(s) from the queue.

Return: track{}[]

Parameter Type Description Optional
positionnumberIf a single number is provided, it will be treated as the position of the track to remove.
const { Manager } = require('magmastream');

const manager = new Manager({
...ManagerOptions
})

const searchResponse = await manager.search('Never Gonna Give You Up');

const player = client.lavalink.create({
...PlayerOptions
});

player.connect()
player.queue.add(searchResponse.tracks);

player.play();

setTimeout(() => {
player.queue.remove(2)
}, 5000);

roundRobinShuffle()

Shuffles the queue to play tracks requested by each user one by one.

Return: void

shuffle()

Shuffles the queue.

This will randomize the order of the tracks in the queue and emit a state update event.

Return: void

size()

The size of tracks in the queue.

This does not include the currently playing track.

Return: number

totalSize()

The total size of tracks in the queue including the current track.

This includes the current track if it is not null.

Return: number

userBlockShuffle()

Shuffles the queue to play tracks requested by each user one block at a time.

Return: void