Rest
Handles direct HTTP interactions with the Lavalink REST API (v4). Used internally by the Node and Player classes but can be accessed for advanced operations.
The Rest class is a wrapper around the Lavalink v4 REST API. It handles authentication, request headers, and response parsing. Every Node instance has its own Rest property.
Methods
loadTracks(identifier)
loadTracks(identifier)#
→Promise<IRESTLoadTracks>Resolves a track, playlist, or search query against the Lavalink node.
The search query or URL (e.g. ytsearch:faded, https://...).
updatePlayer(guildId, data, noReplace)
updatePlayer(guildId, data, noReplace)#
→Promise<any>Updates the state of a player on the Lavalink server (play track, pause, seek, volume, filters).
The Guild ID.
The update payload (track, position, paused, volume, filters, etc.).
If true, the operation will be ignored if a track is already playing.
destroyPlayer(guildId)
destroyPlayer(guildId)#
→Promise<void>Destroys the player on the remote Lavalink server.
The Guild ID.
getPlayers()
getPlayers()#
→Promise<IRESTGetPlayers[]>Retrieves a list of all active players on this specific Lavalink session.
getPlayer(guildId)
getPlayer(guildId)#
→Promise<any>Retrieves the specific state of a player for a guild.
The Guild ID.
decodeTrack(encodedTrack)
decodeTrack(encodedTrack)#
→Promise<ITrack>Decodes a single base64 track string using the Lavalink API.
The base64 encoded string.
decodeTracks(encodedTracks)
decodeTracks(encodedTracks)#
→Promise<ITrack[]>Decodes an array of base64 track strings in a single request.
Array of base64 encoded strings.
getInfo()
Retrieves general information about the Lavalink server (version, build time, git commit, etc.).
getStats()
getStats()#
→Promise<INodeStats>Retrieves current system statistics (CPU, memory, players, uptime).
getVersion()
getVersion()#
→Promise<string>Retrieves the plain version string of the Lavalink server.
updateSession(resuming, timeout)
updateSession(resuming, timeout)#
→Promise<any>Updates the session configuration for resuming.
Whether resuming is enabled.
The number of seconds the session should stay alive after disconnect.
getRoutePlannerStatus()
getRoutePlannerStatus()#
→Promise<IRoutePlannerStatus>Retrieves the status of the IP route planner (if enabled on the server).
freeFailedAddress(address)
freeFailedAddress(address)#
→Promise<void>Unmarks a failed IP address in the route planner, allowing it to be used again.
The IP address to free.
freeAllFailedAddresses()
freeAllFailedAddresses()#
→Promise<void>Unmarks all failed IP addresses in the route planner.