magmastream
Advanced tools
Comparing version 2.7.0 to 2.7.1
@@ -645,22 +645,10 @@ "use strict"; | ||
return new Promise(async (resolve, reject) => { | ||
// Get the first available node for processing the decode request | ||
const node = this.nodes.first(); | ||
if (!node) { | ||
// Reject the promise if no nodes are available | ||
return reject(new Error("No available nodes.")); | ||
if (!node) | ||
throw new Error("No available nodes."); | ||
const res = (await node.rest.post("/v4/decodetracks", JSON.stringify(tracks)).catch((err) => reject(err))); | ||
if (!res) { | ||
return reject(new Error("No data returned from query.")); | ||
} | ||
try { | ||
// Send a POST request to the Lavalink API to decode tracks | ||
const res = await node.rest.post("/v4/decodetracks", JSON.stringify(tracks)); | ||
// Check if a valid response is received | ||
if (!res) { | ||
return reject(new Error("No data returned from query.")); | ||
} | ||
// Resolve the promise with the decoded track data | ||
resolve(res); | ||
} | ||
catch (err) { | ||
// Reject the promise if an error occurs during the API request | ||
reject(err); | ||
} | ||
return resolve(res); | ||
}); | ||
@@ -667,0 +655,0 @@ } |
@@ -177,5 +177,4 @@ "use strict"; | ||
disconnect() { | ||
if (this.voiceChannel === null) { | ||
throw new TypeError("The player is not connected."); | ||
} | ||
if (this.voiceChannel === null) | ||
return this; | ||
this.state = "DISCONNECTING"; | ||
@@ -214,4 +213,2 @@ const oldPlayer = this ? { ...this } : null; | ||
destroy(disconnect = true) { | ||
if (typeof disconnect !== "boolean") | ||
throw new TypeError("Disconnect must be a boolean."); | ||
const oldPlayer = this ? { ...this } : null; | ||
@@ -454,4 +451,2 @@ this.state = "DESTROYING"; | ||
throw new TypeError("Volume must be a number."); | ||
if (volume < 0 || volume > 100) | ||
throw new RangeError("Volume must be between 0 and 100."); | ||
const oldPlayer = this ? { ...this } : null; | ||
@@ -458,0 +453,0 @@ this.node.rest.updatePlayer({ |
{ | ||
"name": "magmastream", | ||
"version": "2.7.0", | ||
"version": "2.7.1", | ||
"description": "A user-friendly Lavalink client designed for NodeJS.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
260291
5825