lavalink-client 2.9.7 → 2.9.9

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.cjs CHANGED
@@ -589,11 +589,12 @@ var QueueSymbol = /* @__PURE__ */ Symbol("LC-Queue");
589
589
  var NodeSymbol = /* @__PURE__ */ Symbol("LC-Node");
590
590
  var escapeRegExp = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
591
591
  function parseLavalinkConnUrl(connectionUrl) {
592
- if (!connectionUrl.startsWith("lavalink://"))
593
- throw new Error(`ConnectionUrl (${connectionUrl}) must start with 'lavalink://'`);
592
+ if (!connectionUrl.startsWith("lavalink://") && !connectionUrl.startsWith("nodelink://"))
593
+ throw new Error(`ConnectionUrl (${connectionUrl}) must start with 'lavalink://' or 'nodelink://'`);
594
594
  const parsed = new import_node_url.URL(connectionUrl);
595
595
  return {
596
596
  authorization: parsed.password,
597
+ nodeType: connectionUrl.startsWith("lavalink://") ? "Lavalink" : "NodeLink",
597
598
  id: parsed.username,
598
599
  host: parsed.hostname,
599
600
  port: Number(parsed.port)
@@ -2414,7 +2415,7 @@ var LavalinkNode = class _LavalinkNode {
2414
2415
  player.filterManager.checkFiltersState(oldFilterTimescale);
2415
2416
  }
2416
2417
  }
2417
- if (res?.guildId === "string" && typeof res?.voice !== "undefined") {
2418
+ if (typeof res?.guildId === "string" && typeof res?.voice !== "undefined") {
2418
2419
  const player = this._LManager.getPlayer(data.guildId);
2419
2420
  if (!player) return;
2420
2421
  if (typeof res?.voice?.connected === "boolean" && res.voice.connected === false) {
@@ -5379,21 +5380,39 @@ var Player = class {
5379
5380
  );
5380
5381
  }
5381
5382
  /**
5382
- * Set custom data.
5383
+ * Set custom data. (Deprecated - Use Player#setData instead.)
5383
5384
  * @param key
5384
5385
  * @param value
5386
+ * @deprecated Use Player#setData instead.
5385
5387
  */
5386
5388
  set(key, value) {
5387
5389
  this.data[key] = value;
5388
5390
  return this;
5389
5391
  }
5390
5392
  /**
5391
- * Get custom data.
5393
+ * Get custom data. (Deprecated - Use Player#getData instead.)
5392
5394
  * @param key
5395
+ * @deprecated Use Player#getData instead.
5393
5396
  */
5394
5397
  get(key) {
5395
5398
  return this.data[key];
5396
5399
  }
5400
+ /**
5401
+ * Set custom data.
5402
+ * @param key
5403
+ * @param value
5404
+ */
5405
+ setData(key, value) {
5406
+ this.data[key] = value;
5407
+ return this;
5408
+ }
5409
+ /**
5410
+ * Get custom data.
5411
+ * @param key
5412
+ */
5413
+ getData(key) {
5414
+ return this.data[key];
5415
+ }
5397
5416
  /**
5398
5417
  * Delete specific custom data.
5399
5418
  * @param key
package/dist/index.d.cts CHANGED
@@ -404,12 +404,13 @@ declare const UnresolvedTrackSymbol: unique symbol;
404
404
  declare const QueueSymbol: unique symbol;
405
405
  declare const NodeSymbol: unique symbol;
406
406
  /**
407
- * Parses Node Connection Url: "lavalink://<nodeId>:<nodeAuthorization(Password)>@<NodeHost>:<NodePort>"
407
+ * Parses Node Connection Url: "lavalink://<nodeId>:<nodeAuthorization(Password)>@<NodeHost>:<NodePort>" or "nodelink://<nodeId>:<nodeAuthorization(Password)>@<NodeHost>:<NodePort>"
408
408
  * @param connectionUrl
409
409
  * @returns
410
410
  */
411
411
  declare function parseLavalinkConnUrl(connectionUrl: string): {
412
412
  authorization: string;
413
+ nodeType: NodeTypes;
413
414
  id: string;
414
415
  host: string;
415
416
  port: number;
@@ -2680,16 +2681,29 @@ declare class Player {
2680
2681
  */
2681
2682
  constructor(options: PlayerOptions, LavalinkManager: LavalinkManager, dontEmitPlayerCreateEvent?: boolean);
2682
2683
  /**
2683
- * Set custom data.
2684
+ * Set custom data. (Deprecated - Use Player#setData instead.)
2684
2685
  * @param key
2685
2686
  * @param value
2687
+ * @deprecated Use Player#setData instead.
2686
2688
  */
2687
2689
  set(key: string, value: unknown): this;
2688
2690
  /**
2689
- * Get custom data.
2691
+ * Get custom data. (Deprecated - Use Player#getData instead.)
2690
2692
  * @param key
2693
+ * @deprecated Use Player#getData instead.
2691
2694
  */
2692
2695
  get<T>(key: string): T;
2696
+ /**
2697
+ * Set custom data.
2698
+ * @param key
2699
+ * @param value
2700
+ */
2701
+ setData(key: string, value: unknown): this;
2702
+ /**
2703
+ * Get custom data.
2704
+ * @param key
2705
+ */
2706
+ getData<T>(key: string): T;
2693
2707
  /**
2694
2708
  * Delete specific custom data.
2695
2709
  * @param key
package/dist/index.d.ts CHANGED
@@ -404,12 +404,13 @@ declare const UnresolvedTrackSymbol: unique symbol;
404
404
  declare const QueueSymbol: unique symbol;
405
405
  declare const NodeSymbol: unique symbol;
406
406
  /**
407
- * Parses Node Connection Url: "lavalink://<nodeId>:<nodeAuthorization(Password)>@<NodeHost>:<NodePort>"
407
+ * Parses Node Connection Url: "lavalink://<nodeId>:<nodeAuthorization(Password)>@<NodeHost>:<NodePort>" or "nodelink://<nodeId>:<nodeAuthorization(Password)>@<NodeHost>:<NodePort>"
408
408
  * @param connectionUrl
409
409
  * @returns
410
410
  */
411
411
  declare function parseLavalinkConnUrl(connectionUrl: string): {
412
412
  authorization: string;
413
+ nodeType: NodeTypes;
413
414
  id: string;
414
415
  host: string;
415
416
  port: number;
@@ -2680,16 +2681,29 @@ declare class Player {
2680
2681
  */
2681
2682
  constructor(options: PlayerOptions, LavalinkManager: LavalinkManager, dontEmitPlayerCreateEvent?: boolean);
2682
2683
  /**
2683
- * Set custom data.
2684
+ * Set custom data. (Deprecated - Use Player#setData instead.)
2684
2685
  * @param key
2685
2686
  * @param value
2687
+ * @deprecated Use Player#setData instead.
2686
2688
  */
2687
2689
  set(key: string, value: unknown): this;
2688
2690
  /**
2689
- * Get custom data.
2691
+ * Get custom data. (Deprecated - Use Player#getData instead.)
2690
2692
  * @param key
2693
+ * @deprecated Use Player#getData instead.
2691
2694
  */
2692
2695
  get<T>(key: string): T;
2696
+ /**
2697
+ * Set custom data.
2698
+ * @param key
2699
+ * @param value
2700
+ */
2701
+ setData(key: string, value: unknown): this;
2702
+ /**
2703
+ * Get custom data.
2704
+ * @param key
2705
+ */
2706
+ getData<T>(key: string): T;
2693
2707
  /**
2694
2708
  * Delete specific custom data.
2695
2709
  * @param key
package/dist/index.js CHANGED
@@ -525,11 +525,12 @@ var QueueSymbol = /* @__PURE__ */ Symbol("LC-Queue");
525
525
  var NodeSymbol = /* @__PURE__ */ Symbol("LC-Node");
526
526
  var escapeRegExp = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
527
527
  function parseLavalinkConnUrl(connectionUrl) {
528
- if (!connectionUrl.startsWith("lavalink://"))
529
- throw new Error(`ConnectionUrl (${connectionUrl}) must start with 'lavalink://'`);
528
+ if (!connectionUrl.startsWith("lavalink://") && !connectionUrl.startsWith("nodelink://"))
529
+ throw new Error(`ConnectionUrl (${connectionUrl}) must start with 'lavalink://' or 'nodelink://'`);
530
530
  const parsed = new URL2(connectionUrl);
531
531
  return {
532
532
  authorization: parsed.password,
533
+ nodeType: connectionUrl.startsWith("lavalink://") ? "Lavalink" : "NodeLink",
533
534
  id: parsed.username,
534
535
  host: parsed.hostname,
535
536
  port: Number(parsed.port)
@@ -2350,7 +2351,7 @@ var LavalinkNode = class _LavalinkNode {
2350
2351
  player.filterManager.checkFiltersState(oldFilterTimescale);
2351
2352
  }
2352
2353
  }
2353
- if (res?.guildId === "string" && typeof res?.voice !== "undefined") {
2354
+ if (typeof res?.guildId === "string" && typeof res?.voice !== "undefined") {
2354
2355
  const player = this._LManager.getPlayer(data.guildId);
2355
2356
  if (!player) return;
2356
2357
  if (typeof res?.voice?.connected === "boolean" && res.voice.connected === false) {
@@ -5315,21 +5316,39 @@ var Player = class {
5315
5316
  );
5316
5317
  }
5317
5318
  /**
5318
- * Set custom data.
5319
+ * Set custom data. (Deprecated - Use Player#setData instead.)
5319
5320
  * @param key
5320
5321
  * @param value
5322
+ * @deprecated Use Player#setData instead.
5321
5323
  */
5322
5324
  set(key, value) {
5323
5325
  this.data[key] = value;
5324
5326
  return this;
5325
5327
  }
5326
5328
  /**
5327
- * Get custom data.
5329
+ * Get custom data. (Deprecated - Use Player#getData instead.)
5328
5330
  * @param key
5331
+ * @deprecated Use Player#getData instead.
5329
5332
  */
5330
5333
  get(key) {
5331
5334
  return this.data[key];
5332
5335
  }
5336
+ /**
5337
+ * Set custom data.
5338
+ * @param key
5339
+ * @param value
5340
+ */
5341
+ setData(key, value) {
5342
+ this.data[key] = value;
5343
+ return this;
5344
+ }
5345
+ /**
5346
+ * Get custom data.
5347
+ * @param key
5348
+ */
5349
+ getData(key) {
5350
+ return this.data[key];
5351
+ }
5333
5352
  /**
5334
5353
  * Delete specific custom data.
5335
5354
  * @param key
package/dist/index.mjs CHANGED
@@ -525,11 +525,12 @@ var QueueSymbol = /* @__PURE__ */ Symbol("LC-Queue");
525
525
  var NodeSymbol = /* @__PURE__ */ Symbol("LC-Node");
526
526
  var escapeRegExp = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
527
527
  function parseLavalinkConnUrl(connectionUrl) {
528
- if (!connectionUrl.startsWith("lavalink://"))
529
- throw new Error(`ConnectionUrl (${connectionUrl}) must start with 'lavalink://'`);
528
+ if (!connectionUrl.startsWith("lavalink://") && !connectionUrl.startsWith("nodelink://"))
529
+ throw new Error(`ConnectionUrl (${connectionUrl}) must start with 'lavalink://' or 'nodelink://'`);
530
530
  const parsed = new URL2(connectionUrl);
531
531
  return {
532
532
  authorization: parsed.password,
533
+ nodeType: connectionUrl.startsWith("lavalink://") ? "Lavalink" : "NodeLink",
533
534
  id: parsed.username,
534
535
  host: parsed.hostname,
535
536
  port: Number(parsed.port)
@@ -2350,7 +2351,7 @@ var LavalinkNode = class _LavalinkNode {
2350
2351
  player.filterManager.checkFiltersState(oldFilterTimescale);
2351
2352
  }
2352
2353
  }
2353
- if (res?.guildId === "string" && typeof res?.voice !== "undefined") {
2354
+ if (typeof res?.guildId === "string" && typeof res?.voice !== "undefined") {
2354
2355
  const player = this._LManager.getPlayer(data.guildId);
2355
2356
  if (!player) return;
2356
2357
  if (typeof res?.voice?.connected === "boolean" && res.voice.connected === false) {
@@ -5315,21 +5316,39 @@ var Player = class {
5315
5316
  );
5316
5317
  }
5317
5318
  /**
5318
- * Set custom data.
5319
+ * Set custom data. (Deprecated - Use Player#setData instead.)
5319
5320
  * @param key
5320
5321
  * @param value
5322
+ * @deprecated Use Player#setData instead.
5321
5323
  */
5322
5324
  set(key, value) {
5323
5325
  this.data[key] = value;
5324
5326
  return this;
5325
5327
  }
5326
5328
  /**
5327
- * Get custom data.
5329
+ * Get custom data. (Deprecated - Use Player#getData instead.)
5328
5330
  * @param key
5331
+ * @deprecated Use Player#getData instead.
5329
5332
  */
5330
5333
  get(key) {
5331
5334
  return this.data[key];
5332
5335
  }
5336
+ /**
5337
+ * Set custom data.
5338
+ * @param key
5339
+ * @param value
5340
+ */
5341
+ setData(key, value) {
5342
+ this.data[key] = value;
5343
+ return this;
5344
+ }
5345
+ /**
5346
+ * Get custom data.
5347
+ * @param key
5348
+ */
5349
+ getData(key) {
5350
+ return this.data[key];
5351
+ }
5333
5352
  /**
5334
5353
  * Delete specific custom data.
5335
5354
  * @param key
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lavalink-client",
3
- "version": "2.9.7",
3
+ "version": "2.9.9",
4
4
  "description": "Easy, flexible and feature-rich lavalink@v4 Client. Both for Beginners and Proficients. - Supports NodeLink@v3 too.",
5
5
  "keywords": [
6
6
  "advanced",