lavalink-client 1.1.14 → 1.1.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -211,7 +211,8 @@ class LavalinkManager extends events_1.EventEmitter {
211
211
  return await player.destroy(Player_1.DestroyReasons.Disconnected);
212
212
  }
213
213
  this.emit("playerDisconnect", player, player.voiceChannelId);
214
- await player.pause();
214
+ if (!player.paused)
215
+ await player.pause();
215
216
  if (this.options?.playerOptions?.onDisconnect?.autoReconnect === true) {
216
217
  try {
217
218
  await player.connect();
@@ -219,7 +220,7 @@ class LavalinkManager extends events_1.EventEmitter {
219
220
  catch {
220
221
  return await player.destroy(Player_1.DestroyReasons.PlayerReconnectFail);
221
222
  }
222
- return await player.resume();
223
+ return player.paused && await player.resume();
223
224
  }
224
225
  player.voiceChannelId = null;
225
226
  player.voice = Object.assign({});
@@ -475,20 +475,17 @@ class LavalinkNode {
475
475
  this.reconnectAttempts++;
476
476
  }, this.options.retryDelay || 1000);
477
477
  }
478
- open() {
478
+ async open() {
479
479
  if (this.reconnectTimeout)
480
480
  clearTimeout(this.reconnectTimeout);
481
481
  // reset the reconnect attempts amount
482
482
  this.reconnectAttempts = 1;
483
+ this.info = await this.fetchInfo().catch(() => null);
484
+ if (!this.info && ["v3", "v4"].includes(this.version)) {
485
+ const errorString = `Lavalink Node (${this.poolAddress}) does not provide any /${this.version}/info`;
486
+ throw new Error(errorString);
487
+ }
483
488
  this.NodeManager.emit("connect", this);
484
- setTimeout(() => {
485
- this.fetchInfo().then(x => this.info = x).catch(() => null).then(() => {
486
- if (!this.info && ["v3", "v4"].includes(this.version)) {
487
- const errorString = `Lavalink Node (${this.poolAddress}) does not provide any /${this.version}/info`;
488
- throw new Error(errorString);
489
- }
490
- });
491
- }, 1500);
492
489
  }
493
490
  close(code, reason) {
494
491
  this.NodeManager.emit("disconnect", this, { code, reason });
@@ -208,7 +208,8 @@ export class LavalinkManager extends EventEmitter {
208
208
  return await player.destroy(DestroyReasons.Disconnected);
209
209
  }
210
210
  this.emit("playerDisconnect", player, player.voiceChannelId);
211
- await player.pause();
211
+ if (!player.paused)
212
+ await player.pause();
212
213
  if (this.options?.playerOptions?.onDisconnect?.autoReconnect === true) {
213
214
  try {
214
215
  await player.connect();
@@ -216,7 +217,7 @@ export class LavalinkManager extends EventEmitter {
216
217
  catch {
217
218
  return await player.destroy(DestroyReasons.PlayerReconnectFail);
218
219
  }
219
- return await player.resume();
220
+ return player.paused && await player.resume();
220
221
  }
221
222
  player.voiceChannelId = null;
222
223
  player.voice = Object.assign({});
@@ -471,20 +471,17 @@ export class LavalinkNode {
471
471
  this.reconnectAttempts++;
472
472
  }, this.options.retryDelay || 1000);
473
473
  }
474
- open() {
474
+ async open() {
475
475
  if (this.reconnectTimeout)
476
476
  clearTimeout(this.reconnectTimeout);
477
477
  // reset the reconnect attempts amount
478
478
  this.reconnectAttempts = 1;
479
+ this.info = await this.fetchInfo().catch(() => null);
480
+ if (!this.info && ["v3", "v4"].includes(this.version)) {
481
+ const errorString = `Lavalink Node (${this.poolAddress}) does not provide any /${this.version}/info`;
482
+ throw new Error(errorString);
483
+ }
479
484
  this.NodeManager.emit("connect", this);
480
- setTimeout(() => {
481
- this.fetchInfo().then(x => this.info = x).catch(() => null).then(() => {
482
- if (!this.info && ["v3", "v4"].includes(this.version)) {
483
- const errorString = `Lavalink Node (${this.poolAddress}) does not provide any /${this.version}/info`;
484
- throw new Error(errorString);
485
- }
486
- });
487
- }, 1500);
488
485
  }
489
486
  close(code, reason) {
490
487
  this.NodeManager.emit("disconnect", this, { code, reason });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lavalink-client",
3
- "version": "1.1.14",
3
+ "version": "1.1.16",
4
4
  "description": "Easy, flexible and feature-rich lavalink@v4 Client. Both for Beginners and Proficients.",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",