Skip to content

NodeLinkNode

Defined in: src/structures/NodeLink.ts:28

Lavalink Node creator class

new NodeLinkNode(options: LavalinkNodeOptions, manager: NodeManager): NodeLinkNode;

Defined in: src/structures/NodeLink.ts:31

ParameterType
optionsLavalinkNodeOptions
managerNodeManager

NodeLinkNode

LavalinkNode.constructor

Property (defined in)TypeDefault valueDescription
calls
(src/structures/Node.ts:82)
number0The amount of rest calls the node has made.
decode
(src/structures/Node.ts:922)
objectundefinedDecode Track or Tracks
decode.multipleTracks
(src/structures/Node.ts:959)
(encodeds: string[], requester: unknown) => Promise<Track[]>undefinedDecodes multiple tracks into their info Example `const encodedBase64_1 = ‘QAACDgMACk5vIERpZ2dpdHkAC0JsYWNrc3RyZWV0AAAAAAAEo4AABjkxNjQ5NgABAB9odHRwczovL2RlZXplci5jb20vdHJhY2svOTE2NDk2AQBpaHR0cHM6Ly…
decode.singleTrack
(src/structures/Node.ts:935)
(encoded: string, requester: unknown) => Promise<Track>undefinedDecode a single track into its info Example `const encodedBase64 = ‘QAACDgMACk5vIERpZ2dpdHkAC0JsYWNrc3RyZWV0AAAAAAAEo4AABjkxNjQ5NgABAB9odHRwczovL2RlZXplci5jb20vdHJhY2svOTE2NDk2AQBpaHR0cHM6Ly9lLWNk…
info
(src/structures/Node.ts:121)
LavalinkInfonullActual Lavalink Information of the Node
isAlive
(src/structures/Node.ts:77)
booleanfalse
lyrics
(src/structures/Node.ts:972)
objectundefined
lyrics.get
(src/structures/Node.ts:986)
(track: Track, skipTrackSource: boolean) => Promise<LyricsResult>undefinedGet the lyrics of a track Example const lyrics = await player.node.lyrics.get(track, true); // use it of player instead: // const lyrics = await player.getLyrics(track, true);
lyrics.getCurrent
(src/structures/Node.ts:1021)
(guildId: string, skipTrackSource: boolean) => Promise<LyricsResult>undefinedGet the lyrics of the current playing track Example const lyrics = await player.node.lyrics.getCurrent(guildId); // use it of player instead: // const lyrics = await player.getCurrentLyrics();
lyrics.subscribe
(src/structures/Node.ts:1056)
(guildId: string) => Promise<unknown>undefinedsubscribe to lyrics updates for a guild Example await player.node.lyrics.subscribe(guildId); // use it of player instead: // const lyrics = await player.subscribeLyrics();
lyrics.unsubscribe
(src/structures/Node.ts:1080)
(guildId: string) => Promise<void>undefinedunsubscribe from lyrics updates for a guild Example await player.node.lyrics.unsubscribe(guildId); // use it of player instead: // const lyrics = await player.unsubscribeLyrics();
nodeType
({LavalinkNode.nodeType}
src/structures/NodeLink.ts:29)
"NodeLink"undefined
options
(src/structures/Node.ts:80)
LavalinkNodeOptionsundefinedThe provided Options of the Node
reconnectionState
(src/structures/Node.ts:123)
ReconnectionStateReconnectionState.IDLEcurrent state of the Reconnections
resuming
(src/structures/Node.ts:119)
objectundefinedWether the node resuming is enabled or not
resuming.enabled
(src/structures/Node.ts:119)
booleanundefined
resuming.timeout
(src/structures/Node.ts:119)
numberundefined
routePlannerApi
(src/structures/Node.ts:1371)
objectundefinedLavalink’s Route Planner Api
routePlannerApi.getStatus
(src/structures/Node.ts:1383)
() => Promise<RoutePlanner>undefinedGet routplanner Info from Lavalink for ip rotation Example `const routePlannerStatus = await player.node.routePlannerApi.getStatus(); const usedBlock = routePlannerStatus.details?.ipBlock; const c…
routePlannerApi.unmarkAllFailedAddresses
(src/structures/Node.ts:1417)
() => Promise<unknown>undefinedRelease all blacklisted IP addresses into pool of IPs Example await player.node.routePlannerApi.unmarkAllFailedAddresses();
routePlannerApi.unmarkFailedAddress
(src/structures/Node.ts:1398)
(address: string) => Promise<unknown>undefinedRelease blacklisted IP address into pool of IPs for ip rotation Example await player.node.routePlannerApi.unmarkFailedAddress("ipv6address");
sessionId?
(src/structures/Node.ts:117)
stringnullThe current sessionId, only present when connected
specificFilters
(src/structures/NodeLink.ts:111)
objectundefinedDescription NodeLink has a lot of filters SPECIFICALLY for NodeLink, check the documentation for more information. Link documentiation
specificFilters.chorus
(src/structures/NodeLink.ts:132)
(player: Player, options: NodeLink_ChorusFilter, disableFilter: boolean) => Promise<boolean>undefinedSimulates multiple voices playing together with modulated delays
specificFilters.compressor
(src/structures/NodeLink.ts:147)
(player: Player, options: NodeLink_CompressorFilter, disableFilter: boolean) => Promise<boolean>undefinedDynamic range compression for balanced audio levels
specificFilters.echo
(src/structures/NodeLink.ts:117)
(player: Player, options: NodeLink_EchoFilter, disableFilter: boolean) => Promise<boolean>undefinedCreates delay-based echo with feedback control
specificFilters.highPass
(src/structures/NodeLink.ts:162)
(player: Player, options: NodeLink_HighPassFilter, disableFilter: boolean) => Promise<boolean>undefinedFilters out low frequencies, letting high frequencies pass through
specificFilters.phaser
(src/structures/NodeLink.ts:177)
(player: Player, options: NodeLink_PhaserFilter, disableFilter: boolean) => Promise<boolean>undefinedSweeps all-pass filters across the frequency spectrum for a swooshing effect
specificFilters.resetNodeLinkFilters
(src/structures/NodeLink.ts:207)
(player: Player) => Promise<boolean>undefinedResets all NodeLink filters
specificFilters.spatial
(src/structures/NodeLink.ts:192)
(player: Player, options: NodeLink_SpatialFilter, disableFilter: boolean) => Promise<boolean>undefinedCreates spatial audio using cross-channel delays and modulation
stats
(src/structures/Node.ts:84)
NodeStatsundefinedStats from lavalink, will be updated via an interval by lavalink.
_NodeLinkClass
(src/structures/Node.ts:78)
unknownnull
get _checkForPlugins(): boolean;

Defined in: src/structures/Node.ts:152

Returns wether the plugin validations are enabled or not

boolean

LavalinkNode._checkForPlugins


get _checkForSources(): boolean;

Defined in: src/structures/Node.ts:159

Returns wether the source validations are enabled or not

boolean

LavalinkNode._checkForSources


get connected(): boolean;

Defined in: src/structures/Node.ts:190

Returns if connected to the Node.

const isConnected = player.node.connected;
console.log("node is connected: ", isConnected ? "yes" : "no")

boolean

LavalinkNode.connected


get connectionStatus(): string;

Defined in: src/structures/Node.ts:207

Returns the current ConnectionStatus

try {
const statusOfConnection = player.node.connectionStatus;
console.log("node's connection status is:", statusOfConnection)
} catch (error) {
console.error("no socket available?", error)
}

string

LavalinkNode.connectionStatus


get heartBeatPing(): number;

Defined in: src/structures/Node.ts:145

Returns the Heartbeat Ping of the Node

number

LavalinkNode.heartBeatPing


get id(): string;

Defined in: src/structures/Node.ts:703

Get the id of the node

const nodeId = player.node.id;
console.log("node id is: ", nodeId)

string

LavalinkNode.id


get isNodeReconnecting(): boolean;

Defined in: src/structures/Node.ts:1581

If already trying to reconnect or pending, return

boolean

LavalinkNode.isNodeReconnecting


get reconnectionAttemptCount(): number;

Defined in: src/structures/Node.ts:1617

number

LavalinkNode.reconnectionAttemptCount

addMixerLayer(
player: Player,
trackToAdd: Track,
volume: number): Promise<AddMixerLayerResponse>;

Defined in: src/structures/NodeLink.ts:47

Adds a new audio track to be mixed over the current playback.

ParameterTypeDescription
playerPlayerThe player to add the mixer layer to.
trackToAddTrackThe track to add to the mixer layer.
volumenumberThe volume of the track to add to the mixer layer. (0 - 100)

Promise<AddMixerLayerResponse>

documentiation


changeAudioTrackLanguage(player: Player, language_audioTrackId: string): Promise<any>;

Defined in: src/structures/NodeLink.ts:316

NodeLink supports selecting specific audio tracks for videos that contain multiple audio streams (e.g., Netflixstyle dubs, multi-language YouTube videos). This function changes the current language of the audio, in place at the same position of the current track. You can always do it manually by providing extra field in the track object “audioTrackId”

ParameterTypeDescription
playerPlayerThe player to apply the filter to
language_audioTrackIdstringThe language of the audio track to select, see it in the pluginInfo.audioTracks

Promise<any>


connect(sessionId?: string): void;

Defined in: src/structures/Node.ts:631

Connect to the Lavalink Node

ParameterTypeDescription
sessionId?stringProvide the Session Id of the previous connection, to resume the node and it’s player(s)

void

void

player.node.connect(); // if provided on bootup in managerOptions#nodes, this will be called automatically when doing lavalink.init()
// or connect from a resuming session:
player.node.connect("sessionId");

LavalinkNode.connect


deleteSponsorBlock(player: Player): Promise<void>;

Defined in: src/structures/Node.ts:2235

Delete the sponsorblock plugins

ParameterTypeDescription
playerPlayerpassthrough the player

Promise<void>

void

// use it on the player via player.deleteSponsorBlock();
const sponsorBlockSegments = await player.node.deleteSponsorBlock(player);

LavalinkNode.deleteSponsorBlock


destroy(
destroyReason?: string,
deleteNode?: boolean,
movePlayers?: boolean): void;

Defined in: src/structures/Node.ts:724

Destroys the Node-Connection (Websocket) and all player’s of the node

ParameterTypeDefault valueDescription
destroyReason?stringundefinedDestroy Reason to use when destroying the players
deleteNode?booleantruewether to delete the nodte from the nodes list too, if false it will emit a disconnect.
movePlayers?booleanfalsewhether to movePlayers to different eligible connected node. If false players won’t be moved

void

void

true
false

Destroys node and its players

player.node.destroy("custom Player Destroy Reason", true);

destroys only the node and moves its players to different connected node.

player.node.destroy("custom Player Destroy Reason", true, true);

LavalinkNode.destroy


destroyPlayer(guildId: any): Promise<void>;

Defined in: src/structures/Node.ts:610

Destroys the Player on the Lavalink Server

ParameterTypeDescription
guildIdany-

Promise<void>

request result

// use player.destroy() instead
player.node.destroyPlayer(player.guildId);

LavalinkNode.destroyPlayer


disconnect(disconnectReason?: string): void;

Defined in: src/structures/Node.ts:839

Disconnects the Node-Connection (Websocket)

ParameterTypeDescription
disconnectReason?stringDisconnect Reason to use when disconnecting Node

void

void

Also the node will not get re-connected again.

player.node.disconnect("Forcefully disconnect the connection to the node.");

LavalinkNode.disconnect


fetchAllPlayers(): Promise<
| InvalidLavalinkRestRequest
| LavalinkPlayer[]>;

Defined in: src/structures/Node.ts:862

Gets all Players of a Node

Promise< | InvalidLavalinkRestRequest | LavalinkPlayer[]>

array of players inside of lavalink

const node = lavalink.nodes.get("NODEID");
const playersOfLavalink = await node?.fetchAllPlayers();

LavalinkNode.fetchAllPlayers


fetchConnectionMetrics(): Promise<NodeLinkConnectionMetrics>;

Defined in: src/structures/Node.ts:1116

Request NodeLink connection metrics. https://nodelink.js.org/docs/differences#connection-metrics

Promise<NodeLinkConnectionMetrics>

the connection metrics of the node

const connectionMetrics = await player.node.fetchConnectionMetrics();

LavalinkNode.fetchConnectionMetrics


fetchInfo(): Promise<LavalinkInfo>;

Defined in: src/structures/Node.ts:1155

Request Lavalink information.

Promise<LavalinkInfo>

lavalink info object

const lavalinkInfo = await player.node.fetchInfo();
const availablePlugins:string[] = lavalinkInfo.plugins.map(plugin => plugin.name);
const availableSources:string[] = lavalinkInfo.sourceManagers;

LavalinkNode.fetchInfo


fetchPlayer(guildId: string): Promise<
| LavalinkPlayer
| InvalidLavalinkRestRequest>;

Defined in: src/structures/Node.ts:881

Gets specific Player Information

ParameterType
guildIdstring

Promise< | LavalinkPlayer | InvalidLavalinkRestRequest>

lavalink player object if player exists on lavalink

const node = lavalink.nodes.get("NODEID");
const playerInformation = await node?.fetchPlayer("guildId");

LavalinkNode.fetchPlayer


fetchStats(): Promise<BaseNodeStats>;

Defined in: src/structures/Node.ts:1103

Request Lavalink statistics.

Promise<BaseNodeStats>

the lavalink node stats

const lavalinkStats = await player.node.fetchStats();

LavalinkNode.fetchStats


fetchVersion(): Promise<string>;

Defined in: src/structures/Node.ts:1133

Request Lavalink version.

Promise<string>

the current used lavalink version

const lavalinkVersion = await player.node.fetchVersion();

LavalinkNode.fetchVersion


getChapters(player: Player, track?:
| UnresolvedTrack
| Track): Promise<NodeLinkChapter[]>;

Defined in: src/structures/NodeLink.ts:251

Retrieve Chapters of Youtube Videos.

ParameterTypeDescription
playerPlayerThe Player you use with that node.
track?| UnresolvedTrack | Trackif not provided, it will use the current track

Promise<NodeLinkChapter[]>

Array of NodeLinkChapter objects (if empty than there are no chapters available)


getConnectionMetrics(): Promise<ConnectionMetricsResponse>;

Defined in: src/structures/NodeLink.ts:267

Promise<ConnectionMetricsResponse>


getDirectStream(track:
| UnresolvedTrack
| Track): Promise<DirectStreamResponse>;

Defined in: src/structures/NodeLink.ts:277

Stream audio directly from NodeLink without Discord voice connection. | Note this must be enabled by NodeLink…

ParameterType
track| UnresolvedTrack | Track

Promise<DirectStreamResponse>


getHealthStatus(thresholds?: HealthStatusThresholdOptions): HealthStatusObject;

Defined in: src/structures/Node.ts:1206

Get the node’s health status with performance assessment.

ParameterType
thresholds?HealthStatusThresholdOptions

HealthStatusObject

Object containing health status, performance rating, load balancing info, and recommendations

const health = node.getHealthStatus();
console.log(`Node Status: ${health.status}`); // "healthy" | "degraded" | "critical" | "offline"
console.log(`Performance: ${health.performance}`); // "excellent" | "good" | "fair" | "poor"
console.log(`Penalty Score: ${health.penaltyScore}`); // Lower is better for load balancing
console.log(`Estimated Capacity: ${health.estimatedRemainingCapacity} more players`);
console.log(`Overloaded: ${health.isOverloaded}`);
console.log(`Needs Restart: ${health.needsRestart}`);
if (health.recommendations.length) {
console.log("Recommendations:", health.recommendations);
}

LavalinkNode.getHealthStatus


getSponsorBlock(player: Player): Promise<SponsorBlockSegment[]>;

Defined in: src/structures/Node.ts:2165

Get the current sponsorblocks for the sponsorblock plugin

ParameterTypeDescription
playerPlayerpassthrough the player

Promise<SponsorBlockSegment[]>

sponsorblock seggment from lavalink

// use it on the player via player.getSponsorBlock();
const sponsorBlockSegments = await player.node.getSponsorBlock(player);

LavalinkNode.getSponsorBlock


getYoutubeConfig(validate?: boolean): Promise<{
isConfigured: boolean;
isValid: boolean;
refreshToken: string;
visitorData: string;
}>;

Defined in: src/structures/NodeLink.ts:357

ParameterTypeDefault value
validatebooleanfalse

Promise<{ isConfigured: boolean; isValid: boolean; refreshToken: string; visitorData: string; }>


getYoutubeOAUTH(refreshToken: string): Promise<YoutubeOAuthResponse>;

Defined in: src/structures/NodeLink.ts:375

ParameterType
refreshTokenstring

Promise<YoutubeOAuthResponse>


isLavalinkNode(): this is LavalinkNode;

Defined in: src/structures/Node.ts:1485

Checks if the node is a Lavalink node

this is LavalinkNode

true if the node is a Lavalink node

LavalinkNode.isLavalinkNode


isNodeLink(): this is NodeLinkNode;

Defined in: src/structures/Node.ts:1477

Checks if the node is a NodeLink node

this is NodeLinkNode

true if the node is a NodeLink node

LavalinkNode.isNodeLink


lavaSearch(
query: LavaSearchQuery,
requestUser: unknown,
throwOnEmpty?: boolean): Promise<
| LavaSearchResponse
| SearchResult>;

Defined in: src/structures/Node.ts:490

Search something using the lavaSearchPlugin (filtered searches by types)

ParameterTypeDefault valueDescription
queryLavaSearchQueryundefinedLavaSearchQuery Object
requestUserunknownundefinedRequest User for creating the player(s)
throwOnEmptybooleanfalseWether to throw on an empty result or not

Promise< | LavaSearchResponse | SearchResult>

LavaSearchresult (SearchResult if link is provided)

// use player.search() instead
player.node.lavaSearch({ types: ["playlist", "album"], query: "Rick Astley", source: "spotify" }, interaction.user);

LavalinkNode.lavaSearch


listMixerLayers(player: Player): Promise<ListMixerLayersResponse>;

Defined in: src/structures/NodeLink.ts:67

Retrieves a list of currently active mix layers.

ParameterTypeDescription
playerPlayerThe player to list the mixer layers for.

Promise<ListMixerLayersResponse>

documentiation


loadDirectStream(
track:
| UnresolvedTrack
| Track,
volume: number,
position: number,
filters: string | object): Promise<ReadableStream<any>>;

Defined in: src/structures/NodeLink.ts:292

Stream raw PCM audio for custom processing or recording.

ParameterTypeDescription
track| UnresolvedTrack | TrackThe track to stream
volumenumberThe volume to stream at
positionnumberThe position to stream from
filtersstring | objectThe filters to apply to the stream

Promise<ReadableStream<any>>

Returns a raw PCM stream with Content-Type: audio/l16;rate=48000;channels=2.


nodeLinkLyrics(
player: Player,
track?:
| UnresolvedTrack
| Track,
language?: string): Promise<
| NodeLinkLyrics
| NodeLinkNoLyrics>;

Defined in: src/structures/NodeLink.ts:228

Retrieve Lyrics of Youtube Videos.

ParameterTypeDefault valueDescription
playerPlayerundefinedThe Player you use with that node.
track?| UnresolvedTrack | Trackundefinedif not provided, it will use the current track
language?string"en"if not provided, it will use the default language (en)

Promise< | NodeLinkLyrics | NodeLinkNoLyrics>

NodeLinkLyrics either synced/unsynced or NodeLinkNoLyrics


nodeMetricSummary(): NodeMetricSummary;

Defined in: src/structures/Node.ts:1163

Returns the metric summary of the node

NodeMetricSummary

the metric summary of the node

LavalinkNode.nodeMetricSummary


rawRequest(endpoint: string, modify?: ModifyRequest): Promise<{
options: RequestInit & object;
response: Response;
}>;

Defined in: src/structures/Node.ts:272

Raw Request util function

ParameterTypeDescription
endpointstringendpoint string
modify?ModifyRequestmodify the request

Promise<{ options: RequestInit & object; response: Response; }>

object containing request and option information

player.node.rawRequest(`/loadtracks?identifier=Never gonna give you up`, (options) => options.method = "GET");

LavalinkNode.rawRequest


removeMixerLayer(player: Player, mixId: string): Promise<boolean>;

Defined in: src/structures/NodeLink.ts:98

Removes a specific mix layer.

ParameterTypeDescription
playerPlayerThe player to remove the mix layer from.
mixIdstringThe ID of the mix layer to remove.

Promise<boolean>

documentiation


request(
endpoint: string,
modify: ModifyRequest,
parseAsText: true): Promise<string>;

Defined in: src/structures/Node.ts:325

Makes an API call to the Node. Should only be used for manual parsing like for not supported plugins

ParameterTypeDescription
endpointstringThe endpoint that we will make the call to
modifyModifyRequestUsed to modify the request before being sent
parseAsTexttrue-

Promise<string>

The returned data

player.node.request(`/loadtracks?identifier=Never gonna give you up`, (options) => options.method = "GET", false);

LavalinkNode.request

request(
endpoint: string,
modify?: ModifyRequest,
parseAsText?: false): Promise<any>;

Defined in: src/structures/Node.ts:326

Makes an API call to the Node. Should only be used for manual parsing like for not supported plugins

ParameterTypeDescription
endpointstringThe endpoint that we will make the call to
modify?ModifyRequestUsed to modify the request before being sent
parseAsText?false-

Promise<any>

The returned data

player.node.request(`/loadtracks?identifier=Never gonna give you up`, (options) => options.method = "GET", false);

LavalinkNode.request


search(
query: SearchQuery,
requestUser: unknown,
throwOnEmpty?: boolean): Promise<SearchResult>;

Defined in: src/structures/Node.ts:358

Search something raw on the node, please note only add tracks to players of that node

ParameterTypeDefault valueDescription
querySearchQueryundefinedSearchQuery Object
requestUserunknownundefinedRequest User for creating the player(s)
throwOnEmptybooleanfalseWether to throw on an empty result or not

Promise<SearchResult>

Searchresult

// use player.search() instead
player.node.search({ query: "Never gonna give you up by Rick Astley", source: "soundcloud" }, interaction.user);
player.node.search({ query: "https://deezer.com/track/123456789" }, interaction.user);

LavalinkNode.search


setSponsorBlock(player: Player, segments?: SponsorBlockSegment[]): Promise<void>;

Defined in: src/structures/Node.ts:2186

Set the current sponsorblocks for the sponsorblock plugin

ParameterTypeDescription
playerPlayerpassthrough the player
segmentsSponsorBlockSegment[]-

Promise<void>

void

// use it on the player via player.setSponsorBlock();
const sponsorBlockSegments = await player.node.setSponsorBlock(player, ["sponsor", "selfpromo"]);

LavalinkNode.setSponsorBlock


updateMixerLayerVolume(
player: Player,
mixId: string,
volume: number): Promise<boolean>;

Defined in: src/structures/NodeLink.ts:81

Updates the volume of a specific mix layer.

ParameterTypeDescription
playerPlayerThe player to update the mixer layer volume for.
mixIdstringThe ID of the mix layer to update.
volumenumberThe volume of the mix layer to update. (0 - 100)

Promise<boolean>

documentiation


updatePlayer(data: PlayerUpdateInfo): Promise<LavalinkPlayer>;

Defined in: src/structures/Node.ts:566

Update the Player State on the Lavalink Server

ParameterTypeDescription
dataPlayerUpdateInfodata to send to lavalink and sync locally

Promise<LavalinkPlayer>

result from lavalink

// use player.search() instead
player.node.updatePlayer({ guildId: player.guildId, playerOptions: { paused: true } }); // example to pause it

LavalinkNode.updatePlayer


updateSession(resuming?: boolean, timeout?: number): Promise<
| InvalidLavalinkRestRequest
| Session>;

Defined in: src/structures/Node.ts:900

Updates the session with and enables/disables resuming and timeout

ParameterTypeDescription
resuming?booleanWhether resuming is enabled for this session or not
timeout?numberThe timeout in seconds (default is 60s)

Promise< | InvalidLavalinkRestRequest | Session>

the result of the request

const node = player.node || lavalink.nodes.get("NODEID");
await node?.updateSession(true, 180e3); // will enable resuming for 180seconds

LavalinkNode.updateSession


updateYoutubeConfig(refreshToken?: string, visitorData?: string): Promise<any>;

Defined in: src/structures/NodeLink.ts:340

Updates the YouTube configuration (RefreshToken or VisitorData) in real-time.

ParameterType
refreshToken?string
visitorData?string

Promise<any>


updateYoutubeOAUTH(refreshToken: string): Promise<YoutubeOAuthResponse>;

Defined in: src/structures/NodeLink.ts:386

ParameterType
refreshTokenstring

Promise<YoutubeOAuthResponse>