Rest
A wrapper for the Lavalink REST API that streamlines interactions with Lavalink kinda like how a Command Block simplifies complex commands in Minecraft.
Constructor
new Rest(node)
Methods
.setSessionId()
Connects to the Lavalink server using the WebSocket.
Parameter | Type | Description |
---|---|---|
sessionId | String | The session ID. |
Returns: String
Exemple
<Rest>.setSessionId(sessionId);
.getAllPlayers()
Retrieves all the players that are currently running on the node.
Returns: Promise
Exemple
<Rest>.getAllPlayers();
.updatePlayer(options)
Sends a PATCH request to the node to update player related data.
Parameter | Type | Description |
---|---|---|
options | playOptions | The session ID. |
Returns: Promise
Exemple
<Rest>.updatePlayer({
guildId: this.options.guildId,
/** Pauses the player. This is just an example. */
data: { paused: toggle }
});
.get(path)
Sends a GET request to the specified endpoint and returns the response data.
Returns: Promise
Parameter | Type | Description |
---|---|---|
path | RouteLike | The path. |
Exemple:
<Rest>.get(`endpoint here`)
.patch(endpoint, body)
Sends a PATCH request to the specified endpoint and returns the response data.
Returns: Promise
Parameter | Type | Description |
---|---|---|
endpoint | RouteLike | The path. |
body | unknown | The parameters you'd like to modify. |
Exemple:
<Rest>.patch(`endpoint here`, {
parameters: here
})
.post(endpoint, body)
Sends a POST request to the specified endpoint and returns the response data.
Returns: Promise
Parameter | Type | Description |
---|---|---|
endpoint | RouteLike | The path. |
body | unknown | The parameters you'd like to modify. |
Exemple:
<Rest>.post(`endpoint here`, {
parameters: here
})
.get(endpoint)
Sends a GET request to the specified endpoint and returns the response data.
Returns: Promise
Parameter | Type | Description |
---|---|---|
endpoint | RouteLike | The path. |
Exemple:
<Rest>.delete(`endpoint here`)