Track
Represents a single audio track, containing metadata like title, author, duration, and the encoded string required by Lavalink.
The Track class wraps the raw data received from Lavalink into a usable object. It provides helper methods for thumbnails, cloning, and serialization.
Properties
Track Fields
Metadata and state for the audio track.
Core Data
The base64 encoded string from Lavalink. This is what you send to the node to play the song.
The unique identifier of the track (e.g., YouTube Video ID).
The title of the track.
The length of the track in milliseconds.
The original URL of the track.
State & Extra
The starting position of the track (usually 0).
Whether the track is a live stream.
Whether the track supports seeking.
The source platform (e.g., youtube, spotify, soundcloud).
The URL of the album art or thumbnail provided by the source.
The user or object that requested this track.
Getters
thumbnail
Returns the artwork URL if available. If not, and the source is YouTube, it automatically generates the mqdefault thumbnail URL based on the identifier.
const thumb = track.thumbnail;
Methods
setRequester(requester)
Sets the requester for the track. This is useful for displaying who added the song.
The user or object to set as requester.
track.setRequester(message.author);
setPosition(position)
Sets the starting position of the track. This does NOT seek the active player; it only modifies the track object's metadata for when it is eventually played.
Position in milliseconds.
track.setPosition(30000); // Start at 30s
clone()
isPartialTrack()
isPartialTrack()#
→booleanReturns true if the track was created with partial data loading enabled in the Manager options.
if (track.isPartialTrack()) {
console.log("This track has incomplete metadata.");
}