lavalink-client 1.1.14 → 1.1.15

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.
@@ -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 });
@@ -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.15",
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",