Track
Represents a track
Properties
rawData
Raw track data from the source node or provider.
track
Encoded track string (string).
info
Object containing all metadata about the track:
Properties
identifier: stringseekable: boolean— Whether the track is seekable.author: string— Track author or artist.length: number— Duration in milliseconds.stream: boolean— If the source is a stream/live.position: number(may be present) — Current playback position.title: string— Track title.uri: string— Track URL.requester: any— The requester object.sourceName: string— Platform/source eg. ‘youtube’, ‘soundcloud’, etc.isrc: string | null— ISRC code if available._cachedThumbnail: string | null— Used internally; caches any fetched thumbnail data for speed.thumbnail: string | null— Computed property. Returns cached thumbnail, uses provider thumbnail/artwork when present, or attempts extraction using utility for v3/v4 as per node version. Always prefer this for getting track artwork.- Logic prioritizes:
- Already cached value
- Provider thumbnail (eg. YouTube artwork url)
- For Lavalink v4:
artworkUrlfield - If all else fails, uses helper (
getImageUrl(this)) to dynamically construct a suitable fallback.
- Logic prioritizes:
pluginInfo
Raw plugin info object, if provided by backend.
Methods
resolve(riffy)
Attempts to resolve (find/correct) the best matching official version for this track using current author/title.
-
Parameters:
riffy: Riffy instance—used for resolver function (riffy.resolve).
-
Returns:
Promise<Track | undefined> -
Matching logic:
- First, attempts to find an official audio track (matching author or author-topic and title) in search results.
- If not found, prefers duration-matched candidates (±2s).
- If still not found, prefers duration AND title match within tolerance.
- As a last fallback, accepts the first result of
riffy.resolvesearch results.
const found = await track.resolve(riffy);
if (found) {
// found.track and found.info.* are now updated to best match
}The computed thumbnail is the safest way to obtain the best/final artwork, as it works across all sources (YouTube/SoundCloud/Spotify/etc) and all supported Lavalink versions.