Classes

Rest

Class representing the REST for the node.

Signature

export declare class Rest

JSDoc

@classRest

Properties

readonly url: string;

The URL for the REST.

@type{string}
readonly version: string;

The version for the REST.

@type{string}
readonly restTimeout: number;

The timeout for the REST.

@type{number}
restUrlGetter
get restUrl(): string;

The REST URL to make requests.

@type{string}
get sessionId(): string | null;

The session id of the node.

@type{string | null}

Methods

request<T>(options: RestOptions): Promise<T | null>;

Make a request to the node.

Parameters

options
The options to make the request.

Returns

The response from the node.

updatePlayer(data: Partial<UpdatePlayerInfo>): Promise<LavalinkPlayer | null>;

Update the player data.

Parameters

data
The player data to update.

Returns

The updated player data.

Examples

const player = await node.rest.updatePlayer({
	guildId: "guildId",
	noReplace: true,
	playerOptions: {
		paused: false,
		track: { encoded: "encoded track" },
	},
});

console.log(player); // The updated lavalink player data
stopPlayer(guildId: string): Promise<LavalinkPlayer | null>;

Stop the track in player for the guild.

Parameters

guildId
The guild id to stop the player.

Returns

The updated player data.

Examples

const player = await node.rest.stopPlayer("guildId");
if (player) console.log(player); // The lavalink player
destroyPlayer(guildId: string): Promise<void>;

Destroy the player for the guild.

Parameters

guildId
The guild id to destroy the player.

Returns

Examples

await node.rest.destroyPlayer("guildId");
updateSession(options: SessionResumingOptions): Promise<LavalinkSession | null>;

Update the session for the node

Parameters

options
The session resuming options.

Returns

The updated session data.

Examples

const session = await node.rest.updateSession({ resuming: true, timeout: 30000 });
if (session) console.log(session); // The lavalink session data
getPlayers(): Promise<LavalinkPlayer[]>;

Get all players for the current session.

Returns

The players for the current session.

Examples

const players = await node.rest.getPlayers();
console.log(players); // The lavalink players for the current session