Classes
Rest
Class representing the REST for the node.
Signature
export declare class RestJSDoc
@classRest
Properties
7Methods
7Properties
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}
readonly userAgent: UserAgent;The user agent for the REST.
@type{UserAgent}
readonly node: NodeStructure;The node for the REST.
@type{Node}
restUrlGetterget restUrl(): string;The REST URL to make requests.
@type{string}
sessionIdGetterget sessionId(): string | null;The session id of the node.
@type{string | null}
Methods
constructorConstructorconstructor(node: NodeStructure);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 datastopPlayer(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 playerdestroyPlayer(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 datagetPlayers(): 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