lavalink-client 2.6.5 → 2.6.7

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/README.md CHANGED
@@ -114,8 +114,11 @@ This client powers various Discord bots:
114
114
  - [Stelle](https://github.com/Ganyu-Studios/stelle-music) (@EvilG-MC)
115
115
  - [Panais](https://panais.xyz/) (@LucasB25)
116
116
  - [Akyn](https://akynbot.vercel.app/) (@notdeltaxd)
117
+ - [ARINO](https://site.arinoapp.qzz.io/) (@ryanwtf88)
117
118
  - **Bots Community (Users):**
118
119
  - [Soundy](https://github.com/idMJA/Soundy) (@idMJA)
120
+ - [BeatBot ](https://getbeatbot.vercel.app/) (@zenitsujs)
121
+ - [Atom Music](https://top.gg/bot/1320469557411971165) (@sakshamyep)
119
122
 
120
123
  ***
121
124
 
@@ -456,3 +459,5 @@ if (response.tracks.length > 0) {
456
459
  </details>
457
460
 
458
461
  </div>
462
+
463
+
package/dist/index.d.mts CHANGED
@@ -332,6 +332,7 @@ declare class FilterManager {
332
332
  * ```
333
333
  */
334
334
  applyPlayerFilters(): Promise<void>;
335
+ privateNot0(value: number | undefined): boolean;
335
336
  /**
336
337
  * Checks if the filters are correctly stated (active / not-active) - mostly used internally.
337
338
  * @param oldFilterTimescale
@@ -1668,18 +1669,18 @@ declare class ManagerUtils {
1668
1669
  * This check is not done automatically, you need to check it yourself by doing:
1669
1670
  * @example
1670
1671
  * ```ts
1671
- * const tracks = await player.search("Adele");
1672
+ * const res = await player.search("Adele");
1672
1673
  *
1673
1674
  * // short hand:
1674
- * const validTracks = tracks.filter(client.lavalink.utils.isNotBrokenTrack)
1675
+ * const validTracks = res.tracks.filter(client.lavalink.utils.isNotBrokenTrack)
1675
1676
  * // or with options:
1676
- * const vaildTracks = tracks.filter(t => client.lavalink.utils.isNotBrokenTrack(t, 29e3));
1677
+ * const validTracks = res.tracks.filter(t => client.lavalink.utils.isNotBrokenTrack(t, 29e3));
1677
1678
  *
1678
1679
  * // then you can add it to the queue.
1679
1680
  * await player.queue.add(validTracks);
1680
1681
  * ```
1681
1682
  */
1682
- isNotBrokenTrack(data: Track, minDuration?: number): data is Track;
1683
+ isNotBrokenTrack(data: Track | UnresolvedTrack, minDuration?: number): data is Track;
1683
1684
  /**
1684
1685
  * Validate if a data is equal to a track
1685
1686
  * @param data the Track to validate
package/dist/index.d.ts CHANGED
@@ -332,6 +332,7 @@ declare class FilterManager {
332
332
  * ```
333
333
  */
334
334
  applyPlayerFilters(): Promise<void>;
335
+ privateNot0(value: number | undefined): boolean;
335
336
  /**
336
337
  * Checks if the filters are correctly stated (active / not-active) - mostly used internally.
337
338
  * @param oldFilterTimescale
@@ -1668,18 +1669,18 @@ declare class ManagerUtils {
1668
1669
  * This check is not done automatically, you need to check it yourself by doing:
1669
1670
  * @example
1670
1671
  * ```ts
1671
- * const tracks = await player.search("Adele");
1672
+ * const res = await player.search("Adele");
1672
1673
  *
1673
1674
  * // short hand:
1674
- * const validTracks = tracks.filter(client.lavalink.utils.isNotBrokenTrack)
1675
+ * const validTracks = res.tracks.filter(client.lavalink.utils.isNotBrokenTrack)
1675
1676
  * // or with options:
1676
- * const vaildTracks = tracks.filter(t => client.lavalink.utils.isNotBrokenTrack(t, 29e3));
1677
+ * const validTracks = res.tracks.filter(t => client.lavalink.utils.isNotBrokenTrack(t, 29e3));
1677
1678
  *
1678
1679
  * // then you can add it to the queue.
1679
1680
  * await player.queue.add(validTracks);
1680
1681
  * ```
1681
1682
  */
1682
- isNotBrokenTrack(data: Track, minDuration?: number): data is Track;
1683
+ isNotBrokenTrack(data: Track | UnresolvedTrack, minDuration?: number): data is Track;
1683
1684
  /**
1684
1685
  * Validate if a data is equal to a track
1685
1686
  * @param data the Track to validate
package/dist/index.js CHANGED
@@ -677,12 +677,12 @@ var ManagerUtils = class {
677
677
  * This check is not done automatically, you need to check it yourself by doing:
678
678
  * @example
679
679
  * ```ts
680
- * const tracks = await player.search("Adele");
680
+ * const res = await player.search("Adele");
681
681
  *
682
682
  * // short hand:
683
- * const validTracks = tracks.filter(client.lavalink.utils.isNotBrokenTrack)
683
+ * const validTracks = res.tracks.filter(client.lavalink.utils.isNotBrokenTrack)
684
684
  * // or with options:
685
- * const vaildTracks = tracks.filter(t => client.lavalink.utils.isNotBrokenTrack(t, 29e3));
685
+ * const validTracks = res.tracks.filter(t => client.lavalink.utils.isNotBrokenTrack(t, 29e3));
686
686
  *
687
687
  * // then you can add it to the queue.
688
688
  * await player.queue.add(validTracks);
@@ -2882,6 +2882,9 @@ var FilterManager = class {
2882
2882
  this.player.ping.lavalink = Math.round((performance.now() - now) / 10) / 100;
2883
2883
  return;
2884
2884
  }
2885
+ privateNot0(value) {
2886
+ return typeof value === "number" && value !== 0;
2887
+ }
2885
2888
  /**
2886
2889
  * Checks if the filters are correctly stated (active / not-active) - mostly used internally.
2887
2890
  * @param oldFilterTimescale
@@ -2896,9 +2899,10 @@ var FilterManager = class {
2896
2899
  * ```
2897
2900
  */
2898
2901
  checkFiltersState(oldFilterTimescale) {
2899
- this.filters.rotation = this.data.rotation.rotationHz !== 0;
2900
- this.filters.vibrato = this.data.vibrato.frequency !== 0 || this.data.vibrato.depth !== 0;
2901
- this.filters.tremolo = this.data.tremolo.frequency !== 0 || this.data.tremolo.depth !== 0;
2902
+ this.data = this.data ?? {};
2903
+ this.filters.rotation = this.privateNot0(this.data.rotation?.rotationHz);
2904
+ this.filters.vibrato = this.privateNot0(this.data.vibrato?.frequency) || this.privateNot0(this.data.vibrato?.depth);
2905
+ this.filters.tremolo = this.privateNot0(this.data.tremolo?.frequency) || this.privateNot0(this.data.tremolo?.depth);
2902
2906
  const lavalinkFilterData = this.data.pluginFilters?.["lavalink-filter-plugin"] || { echo: { decay: this.data.pluginFilters?.echo?.decay && !this.data.pluginFilters?.echo?.echoLength ? this.data.pluginFilters.echo.decay : 0, delay: this.data.pluginFilters?.echo?.delay || 0 }, reverb: { gains: [], delays: [], ...this.data.pluginFilters.reverb } };
2903
2907
  this.filters.lavalinkFilterPlugin.echo = lavalinkFilterData.echo.decay !== 0 || lavalinkFilterData.echo.delay !== 0;
2904
2908
  this.filters.lavalinkFilterPlugin.reverb = lavalinkFilterData.reverb?.delays?.length !== 0 || lavalinkFilterData.reverb?.gains?.length !== 0;
@@ -3764,6 +3768,9 @@ var Queue = class {
3764
3768
  * ```
3765
3769
  */
3766
3770
  async remove(removeQueryTrack) {
3771
+ if (removeQueryTrack === null || removeQueryTrack === void 0 || Array.isArray(removeQueryTrack) && removeQueryTrack.length === 0) {
3772
+ return null;
3773
+ }
3767
3774
  const oldStored = typeof this.queueChanges?.tracksRemoved === "function" ? this.utils.toJSON() : null;
3768
3775
  if (typeof removeQueryTrack === "number") {
3769
3776
  const toRemove2 = this.tracks[removeQueryTrack];
package/dist/index.mjs CHANGED
@@ -617,12 +617,12 @@ var ManagerUtils = class {
617
617
  * This check is not done automatically, you need to check it yourself by doing:
618
618
  * @example
619
619
  * ```ts
620
- * const tracks = await player.search("Adele");
620
+ * const res = await player.search("Adele");
621
621
  *
622
622
  * // short hand:
623
- * const validTracks = tracks.filter(client.lavalink.utils.isNotBrokenTrack)
623
+ * const validTracks = res.tracks.filter(client.lavalink.utils.isNotBrokenTrack)
624
624
  * // or with options:
625
- * const vaildTracks = tracks.filter(t => client.lavalink.utils.isNotBrokenTrack(t, 29e3));
625
+ * const validTracks = res.tracks.filter(t => client.lavalink.utils.isNotBrokenTrack(t, 29e3));
626
626
  *
627
627
  * // then you can add it to the queue.
628
628
  * await player.queue.add(validTracks);
@@ -2822,6 +2822,9 @@ var FilterManager = class {
2822
2822
  this.player.ping.lavalink = Math.round((performance.now() - now) / 10) / 100;
2823
2823
  return;
2824
2824
  }
2825
+ privateNot0(value) {
2826
+ return typeof value === "number" && value !== 0;
2827
+ }
2825
2828
  /**
2826
2829
  * Checks if the filters are correctly stated (active / not-active) - mostly used internally.
2827
2830
  * @param oldFilterTimescale
@@ -2836,9 +2839,10 @@ var FilterManager = class {
2836
2839
  * ```
2837
2840
  */
2838
2841
  checkFiltersState(oldFilterTimescale) {
2839
- this.filters.rotation = this.data.rotation.rotationHz !== 0;
2840
- this.filters.vibrato = this.data.vibrato.frequency !== 0 || this.data.vibrato.depth !== 0;
2841
- this.filters.tremolo = this.data.tremolo.frequency !== 0 || this.data.tremolo.depth !== 0;
2842
+ this.data = this.data ?? {};
2843
+ this.filters.rotation = this.privateNot0(this.data.rotation?.rotationHz);
2844
+ this.filters.vibrato = this.privateNot0(this.data.vibrato?.frequency) || this.privateNot0(this.data.vibrato?.depth);
2845
+ this.filters.tremolo = this.privateNot0(this.data.tremolo?.frequency) || this.privateNot0(this.data.tremolo?.depth);
2842
2846
  const lavalinkFilterData = this.data.pluginFilters?.["lavalink-filter-plugin"] || { echo: { decay: this.data.pluginFilters?.echo?.decay && !this.data.pluginFilters?.echo?.echoLength ? this.data.pluginFilters.echo.decay : 0, delay: this.data.pluginFilters?.echo?.delay || 0 }, reverb: { gains: [], delays: [], ...this.data.pluginFilters.reverb } };
2843
2847
  this.filters.lavalinkFilterPlugin.echo = lavalinkFilterData.echo.decay !== 0 || lavalinkFilterData.echo.delay !== 0;
2844
2848
  this.filters.lavalinkFilterPlugin.reverb = lavalinkFilterData.reverb?.delays?.length !== 0 || lavalinkFilterData.reverb?.gains?.length !== 0;
@@ -3704,6 +3708,9 @@ var Queue = class {
3704
3708
  * ```
3705
3709
  */
3706
3710
  async remove(removeQueryTrack) {
3711
+ if (removeQueryTrack === null || removeQueryTrack === void 0 || Array.isArray(removeQueryTrack) && removeQueryTrack.length === 0) {
3712
+ return null;
3713
+ }
3707
3714
  const oldStored = typeof this.queueChanges?.tracksRemoved === "function" ? this.utils.toJSON() : null;
3708
3715
  if (typeof removeQueryTrack === "number") {
3709
3716
  const toRemove2 = this.tracks[removeQueryTrack];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lavalink-client",
3
- "version": "2.6.5",
3
+ "version": "2.6.7",
4
4
  "description": "Easy, flexible and feature-rich lavalink@v4 Client. Both for Beginners and Proficients.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -56,12 +56,12 @@
56
56
  "homepage": "https://tomato6966.github.io/lavalink-client/",
57
57
  "devDependencies": {
58
58
  "@eslint/eslintrc": "^3.3.1",
59
- "@eslint/js": "^9.30.1",
60
- "@types/node": "^24.0.13",
59
+ "@eslint/js": "^9.39.1",
60
+ "@types/node": "^24.10.0",
61
61
  "@types/ws": "^8.18.1",
62
- "@typescript-eslint/eslint-plugin": "^8.36.0",
63
- "@typescript-eslint/parser": "^8.36.0",
64
- "eslint": "^9.30.1",
62
+ "@typescript-eslint/eslint-plugin": "^8.46.3",
63
+ "@typescript-eslint/parser": "^8.46.3",
64
+ "eslint": "^9.39.1",
65
65
  "tsup": "^8.5.0",
66
66
  "typescript": "^5.9.3"
67
67
  },