Rest
Table of Contentsโ
Class Definitionโ
export class Rest {}
Propertiesโ
Property Type Description isNodeLinkboolean Whether the connected node is a NodeLink node. managerManagerThe Manager instance.
Constructorโ
new Rest(node: Node, manager: Manager)
Parameter Type Description Optional nodeNodeThe node instance. managerManagerThe manager instance.
Methodsโ
delete()โ
async delete(endpoint: string): Promise<unknown>Sends a DELETE request to the specified endpoint.
Parametersโ
Parameter Type Description Optional endpointstring The endpoint path. Returnsโ
Type Description Promise<unknown> The response data.
destroyPlayer()โ
async destroyPlayer(guildId: string): Promise<unknown>Sends a DELETE request to the Lavalink session to destroy the player for the given guild.
Parametersโ
Parameter Type Description Optional guildIdstring The guild ID of the player to destroy. Returnsโ
Type Description Promise<unknown> The response data.
get()โ
async get(endpoint: string): Promise<unknown>Sends a GET request to the specified endpoint.
Parametersโ
Parameter Type Description Optional endpointstring The endpoint path. Returnsโ
Type Description Promise<unknown> The response data.
getPlayer()โ
async getPlayer(guildId: string): Promise<LavaPlayer>Fetches the current Lavalink player state for the given guild from the active session.
Parametersโ
Parameter Type Description Optional guildIdstring The guild ID. Returnsโ
Type Description Promise< LavaPlayer>The raw Lavalink player object.
patch()โ
async patch(endpoint: string, body: unknown): Promise<unknown>Sends a PATCH request to the specified endpoint.
Parametersโ
Parameter Type Description Optional endpointstring The endpoint path. bodyunknown The request body. Returnsโ
Type Description Promise<unknown> The response data.
post()โ
async post(endpoint: string, body: unknown): Promise<unknown>Sends a POST request to the specified endpoint.
Parametersโ
Parameter Type Description Optional endpointstring The endpoint path. bodyunknown The request body. Returnsโ
Type Description Promise<unknown> The response data.
put()โ
async put(endpoint: string, body: unknown): Promise<unknown>Sends a PUT request to the specified endpoint.
Parametersโ
Parameter Type Description Optional endpointstring The endpoint path. bodyunknown The request body. Returnsโ
Type Description Promise<unknown> The response data.
setSessionId()โ
setSessionId(sessionId: string): stringUpdates the active session ID. Called internally after a session resume.
Parametersโ
Parameter Type Description Optional sessionIdstring The new session ID. Returnsโ
Type Description string The set session ID.
updatePlayer()โ
async updatePlayer(options: RestPlayOptions): Promise<unknown>Sends a PATCH request to update the Lavalink player state for the given guild.
Parametersโ
Parameter Type Description Optional optionsRestPlayOptionsThe player update options. Returnsโ
Type Description Promise<unknown> The response data.
updateSession()โ
async updateSession(resuming: boolean, timeout: number): Promise<unknown>Sends a PATCH request to update the session's resume configuration on the Lavalink node.
Parametersโ
Parameter Type Description Optional resumingboolean Whether the session should be configured for resuming. timeoutnumber The resume timeout in seconds. Returnsโ
Type Description Promise<unknown> The response data.