Skip to main content
Version: v2.10.3

Node

Represents a connected Lavalink v4 or NodeLink server. The same class handles both backends; native helpers require a connected NodeLink node.

Signatures below match the public source surface in 2.10.3. Use manager/player factories for ordinary application setup.

Constructorโ€‹

constructor(
public manager: Manager,
public options: NodeOptions
);

Propertiesโ€‹

Property or getterDeclaration
socketpublic socket: WebSocket | null = null
statspublic stats: NodeStats
sessionIdpublic sessionId: string | null
restpublic readonly rest: Rest
infopublic info: LavalinkInfo | null = null
isNodeLinkpublic isNodeLink: boolean = false
connectedpublic get connected(): boolean
addresspublic get address(): string
managerpublic manager: Manager
optionspublic options: NodeOptions

Methodsโ€‹

loadSessionIdsโ€‹

public async loadSessionIds(): Promise<void>;

Loads session IDs from the sessionIds.json file if it exists.

updateSessionIdโ€‹

public async updateSessionId(): Promise<void>;

Updates the session ID in the sessionIds.json file.

connectโ€‹

public async connect(): Promise<void>;

Connects to the Node.

destroyโ€‹

public async destroy(): Promise<void>;

Destroys the node and cleans up associated resources.

trackEndโ€‹

public async trackEnd(player: Player, track: Track, payload: TrackEndEvent): Promise<void>;

Internal playback event handler. Applications normally consume the manager's trackEnd callback instead of invoking this.

queueEndโ€‹

public async queueEnd(player: Player, track: Track, payload: TrackEndEvent): Promise<void>;

Internal queue-end/autoplay handler. Applications normally consume the manager's queueEnd callback.

getLyricsโ€‹

public async getLyrics(track: Track, skipTrackSource: boolean = false, language?: string): Promise<Lyrics | NodeLinkGetLyrics>;

Loads supported Lavalink-plugin lyrics or native NodeLink lyrics. On NodeLink, the optional language is sent to the native endpoint.

getChaptersโ€‹

public async getChapters(track: Track): Promise<NodeLinkChapter[]>;

Loads chapters for a track using NodeLink.

getNodeLinkChaptersโ€‹

public async getNodeLinkChapters(track: Track): Promise<NodeLinkChapter[]>;

Loads chapters for a track using NodeLink.

getNodeLinkMeaningโ€‹

public async getNodeLinkMeaning(track: Track, language: string = "en"): Promise<NodeLinkMeaningResult>;

Loads NodeLink meaning/background information for a track.

lyricsSubscribeโ€‹

public async lyricsSubscribe(guildId: string, skipTrackSource: boolean = false): Promise<unknown>;

Subscribes to lyrics for a player.

lyricsUnsubscribeโ€‹

public async lyricsUnsubscribe(guildId: string): Promise<unknown>;

Unsubscribes from lyrics for a player.

fetchInfoโ€‹

public async fetchInfo(): Promise<LavalinkInfo>;

Fetches Lavalink node information.

getSponsorBlockโ€‹

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

Returns configured SponsorBlock categories, not detailed segment objects. Uses the supported Lavalink plugin or native NodeLink settings.

getNodeLinkSponsorBlockStateโ€‹

public async getNodeLinkSponsorBlockState(player: Player): Promise<NodeLinkSponsorBlockState>;

Returns the complete NodeLink SponsorBlock state for a player.

updateNodeLinkSponsorBlockโ€‹

public async updateNodeLinkSponsorBlock(player: Player, update: NodeLinkSponsorBlockUpdate): Promise<NodeLinkSponsorBlockState>;

Updates NodeLink SponsorBlock behavior for a player.

setNodeLinkSponsorBlockSegmentsโ€‹

public async setNodeLinkSponsorBlockSegments(player: Player, segments: NodeLinkSponsorBlockSegment[]): Promise<NodeLinkSponsorBlockState>;

Replaces the NodeLink SponsorBlock segment list for a player.

addMixโ€‹

public async addMix(player: Player, track: Track, volume?: number): Promise<NodeLinkMix>;

Adds a NodeLink audio mix layer to the player.

addNodeLinkMixโ€‹

public async addNodeLinkMix(player: Player, track: Track, volume?: number): Promise<NodeLinkMix>;

Adds a NodeLink audio mix layer to the player.

getMixesโ€‹

public async getMixes(player: Player): Promise<NodeLinkMix[]>;

Gets the active NodeLink audio mix layers for the player.

getNodeLinkMixesโ€‹

public async getNodeLinkMixes(player: Player): Promise<NodeLinkMix[]>;

Gets the active NodeLink audio mix layers for the player.

updateMixโ€‹

public async updateMix(player: Player, mixId: string, volume: number): Promise<void>;

Updates a NodeLink audio mix layer volume.

updateNodeLinkMixโ€‹

public async updateNodeLinkMix(player: Player, mixId: string, volume: number): Promise<void>;

Updates a NodeLink audio mix layer volume.

removeMixโ€‹

public async removeMix(player: Player, mixId: string): Promise<void>;

Removes a NodeLink audio mix layer.

removeNodeLinkMixโ€‹

public async removeNodeLinkMix(player: Player, mixId: string): Promise<void>;

Removes a NodeLink audio mix layer.

setSponsorBlockโ€‹

public async setSponsorBlock(player: Player, segments: SponsorBlockSegment[] = [SponsorBlockSegment.Sponsor, SponsorBlockSegment.SelfPromo]): Promise<void>;

Sets the sponsorblock segments for a player.

deleteSponsorBlockโ€‹

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

Deletes the sponsorblock segments for a player.

Types and Guidesโ€‹