Rest
Provides authenticated HTTP helpers for shared endpoints and guarded native NodeLink endpoints.
Signatures below match the public source surface in 2.10.3. Use manager/player factories for ordinary application setup.
Constructorโ
constructor(node: Node, manager: Manager);
Propertiesโ
| Property or getter | Declaration |
|---|---|
manager | public manager: Manager |
isNodeLink | public isNodeLink: boolean = false |
Methodsโ
setSessionIdโ
public setSessionId(sessionId: string): string;
Sets the session ID.
getPlayerโ
public async getPlayer(guildId: string): Promise<LavaPlayer>;
Fetches a remote player. Currently returns null at runtime with no session despite its declared non-null result type.
getPlayersโ
public async getPlayers(): Promise<LavaPlayer[]>;
Lists this session's remote players. With no session returns []; HTTP-400 fallback only requests locally known players on this node.
updatePlayerโ
public async updatePlayer(options: RestPlayOptions): Promise<LavaPlayer>;
Updates a remote player; guards native fields on Lavalink. Currently returns null at runtime without a session.
destroyPlayerโ
public async destroyPlayer(guildId: string): Promise<void>;
Deletes a remote player, or does nothing when no session is available.
updateSessionโ
public async updateSession(resuming: boolean, timeout: number): Promise<LavalinkSession>;
Updates resumption settings; currently returns null at runtime without a session.
decodeTrackโ
public async decodeTrack(encodedTrack: string): Promise<TrackData>;
Decodes a single Lavalink track.
decodeTracksโ
public async decodeTracks(encodedTracks: string[]): Promise<TrackData[]>;
Sends a JSON array to the decode endpoint and normalizes an array or NodeLink { tracks } response.
getInfoโ
public async getInfo(): Promise<LavalinkInfo>;
Retrieves this node's Lavalink info.
getStatsโ
public async getStats(): Promise<NodeStats>;
Loads stats and supplies a Lavalink-load fallback from NodeLink's nodelinkLoad field.
getNodeLinkConnectionโ
public async getNodeLinkConnection(): Promise<NodeLinkConnectionInfo>;
Returns NodeLink connection diagnostics.
encodeNodeLinkTrackโ
public async encodeNodeLinkTrack(track: NodeLinkTrackEncodeInput): Promise<string>;
Encodes one track info payload using NodeLink.
encodeNodeLinkTracksโ
public async encodeNodeLinkTracks(tracks: NodeLinkTrackEncodeInput[]): Promise<string[]>;
Encodes multiple track info payloads using NodeLink.
getNodeLinkMeaningโ
public async getNodeLinkMeaning(encodedTrack: string, language: string = "en"): Promise<NodeLinkMeaningResult>;
Loads NodeLink meaning/background information for an encoded track.
getNodeLinkTrackStreamโ
public async getNodeLinkTrackStream(encodedTrack: string, itag?: number): Promise<NodeLinkTrackStreamResult>;
Resolves NodeLink's direct stream URL and format metadata.
loadNodeLinkPcmStreamโ
public async loadNodeLinkPcmStream(encodedTrack: string, options: NodeLinkLoadStreamOptions = {}): Promise<UndiciResponse>;
Opens an Undici Response for raw PCM. Consume or cancel response.body; the request timeout does not cover the full body duration.
getRoutePlannerStatusโ
public async getRoutePlannerStatus(): Promise<RoutePlannerStatus>;
Retrieves the route planner status.
freeRoutePlannerAddressโ
public async freeRoutePlannerAddress(address: string): Promise<void>;
Unmarks a failed route planner address.
freeAllRoutePlannerAddressesโ
public async freeAllRoutePlannerAddresses(): Promise<void>;
Unmarks all failed route planner addresses.
getโ
public async get<T>(endpoint: string): Promise<T>;
Sends a GET request to the specified endpoint and returns the response data.
patchโ
public async patch<T>(endpoint: string, body: unknown): Promise<T>;
Sends a PATCH request to the specified endpoint and returns the response data.
postโ
public async post<T>(endpoint: string, body?: unknown): Promise<T>;
Sends a POST request to the specified endpoint and returns the response data.
putโ
public async put<T>(endpoint: string, body: unknown): Promise<T>;
Sends a PUT request to the specified endpoint and returns the response data.
deleteโ
public async delete(endpoint: string): Promise<void>;
Sends a DELETE request to the specified endpoint.