Skip to main content
Version: v2.9.2

TrackUtils

Table of Contentsโ€‹

Class Definitionโ€‹

export abstract class TrackUtils {}

Propertiesโ€‹

Property Type Description
managerManagerThe Manager instance.

Constructorโ€‹

new TrackUtils(manager: Manager)
Parameter Type Description Optional
managerManagerThe Manager instance.

Methodsโ€‹

build()โ€‹

build<T = User | ClientUser>(data: TrackData, requester?: T): Track

Builds a Track from the raw data from Lavalink and a optional requester.

Parametersโ€‹

Parameter Type Description Optional
dataTrackDataThe raw data from Lavalink.
requesterPortableUserThe requester.

Returnsโ€‹

Type Description
Track | undefinedThe first element in the queue, or undefined if the queue is empty.

init()โ€‹

init(manager: Manager): void

Initializes the TrackUtils instance.

Parametersโ€‹

Parameter Type Description Optional
managerManagerThe Manager instance.

isErrorOrEmptySearchResult()โ€‹

isErrorOrEmptySearchResult(result: SearchResult): result is ErrorOrEmptySearchResult

Checks if the search result is an error or an empty result.

Parametersโ€‹

Parameter Type Description Optional
resultSearchResultThe search result.

Returnsโ€‹

Type Description
booleanReturns true if the search result is an error or an empty result.

setTrackPartial()โ€‹

setTrackPartial(partial: TrackPartial[]): void

Sets the partial properties for the Track class. If a Track has some of its properties removed by the partial, it will be considered a partial Track.

Parametersโ€‹

Parameter Type Description Optional
partialTrackPartial[]The partial data for the track.

validate()โ€‹

validate(trackOrTracks: unknown): boolean

Checks if the provided argument is a valid Track or an array of Tracks.

Parametersโ€‹

Parameter Type Description Optional
trackOrTracksunknownThe track or an array of tracks to validate.

Returnsโ€‹

Type Description
booleanReturns true if the provided argument is a valid Track or an array of Tracks.

revive()โ€‹

revive(track: Track): Track

Revives a track.

Parametersโ€‹

Parameter Type Description Optional
trackTrackThe track to revive.

Returnsโ€‹

Type Description
TrackThe revived track.