magmastream 2.5.7 → 2.5.8

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.
package/dist/index.d.ts CHANGED
@@ -390,6 +390,8 @@ interface EqualizerBand {
390
390
 
391
391
  /** Handles the requests sent to the Lavalink REST API. */
392
392
  declare class Rest {
393
+ /** The Node that this Rest instance is connected to. */
394
+ private node;
393
395
  /** The ID of the current session. */
394
396
  private sessionId;
395
397
  /** The password for the Node. */
@@ -5,6 +5,8 @@ const tslib_1 = require("tslib");
5
5
  const axios_1 = tslib_1.__importDefault(require("axios"));
6
6
  /** Handles the requests sent to the Lavalink REST API. */
7
7
  class Rest {
8
+ /** The Node that this Rest instance is connected to. */
9
+ node;
8
10
  /** The ID of the current session. */
9
11
  sessionId;
10
12
  /** The password for the Node. */
@@ -12,6 +14,7 @@ class Rest {
12
14
  /** The URL of the Node. */
13
15
  url;
14
16
  constructor(node) {
17
+ this.node = node;
15
18
  this.url = `http${node.options.secure ? "s" : ""}://${node.options.host}:${node.options.port}`;
16
19
  this.sessionId = node.sessionId;
17
20
  this.password = node.options.password;
@@ -51,7 +54,11 @@ class Rest {
51
54
  const response = await (0, axios_1.default)(config);
52
55
  return response.data;
53
56
  }
54
- catch {
57
+ catch (error) {
58
+ if (error?.response?.status === 404) {
59
+ this.node.destroy();
60
+ this.node.manager.createNode(this.node.options).connect();
61
+ }
55
62
  return null;
56
63
  }
57
64
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "magmastream",
3
- "version": "2.5.7",
3
+ "version": "2.5.8",
4
4
  "description": "A user-friendly Lavalink client designed for NodeJS.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -16,10 +16,10 @@
16
16
  "devDependencies": {
17
17
  "@favware/rollup-type-bundler": "^3.3.0",
18
18
  "@types/lodash": "^4.17.6",
19
- "@types/node": "^20.14.9",
19
+ "@types/node": "^20.14.10",
20
20
  "@types/ws": "^8.5.10",
21
- "@typescript-eslint/eslint-plugin": "^7.15.0",
22
- "@typescript-eslint/parser": "^7.15.0",
21
+ "@typescript-eslint/eslint-plugin": "^7.16.0",
22
+ "@typescript-eslint/parser": "^7.16.0",
23
23
  "eslint": "^8.57.0",
24
24
  "npm-run-all": "^4.1.5",
25
25
  "typedoc": "^0.25.13",