lavalink-client 2.3.5 → 2.4.0

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.
Files changed (62) hide show
  1. package/README.md +73 -6
  2. package/dist/cjs/structures/Constants.d.ts +4 -0
  3. package/dist/cjs/structures/Constants.js +7 -2
  4. package/dist/cjs/structures/Filters.d.ts +24 -0
  5. package/dist/cjs/structures/Filters.js +34 -10
  6. package/dist/cjs/structures/LavalinkManager.d.ts +4 -5
  7. package/dist/cjs/structures/LavalinkManager.js +36 -14
  8. package/dist/cjs/structures/LavalinkManagerStatics.d.ts +2 -0
  9. package/dist/cjs/structures/LavalinkManagerStatics.js +11 -2
  10. package/dist/cjs/structures/Node.d.ts +107 -13
  11. package/dist/cjs/structures/Node.js +294 -76
  12. package/dist/cjs/structures/NodeManager.d.ts +2 -2
  13. package/dist/cjs/structures/NodeManager.js +19 -19
  14. package/dist/cjs/structures/Player.d.ts +51 -1
  15. package/dist/cjs/structures/Player.js +62 -0
  16. package/dist/cjs/structures/Queue.d.ts +9 -10
  17. package/dist/cjs/structures/Queue.js +3 -3
  18. package/dist/cjs/structures/Types/Manager.d.ts +59 -1
  19. package/dist/cjs/structures/Types/Node.d.ts +23 -1
  20. package/dist/cjs/structures/Types/Player.d.ts +5 -1
  21. package/dist/cjs/structures/Types/Queue.d.ts +6 -6
  22. package/dist/cjs/structures/Types/Track.d.ts +3 -1
  23. package/dist/cjs/structures/Types/Utils.d.ts +81 -8
  24. package/dist/cjs/structures/Utils.js +11 -9
  25. package/dist/esm/structures/Constants.d.ts +4 -0
  26. package/dist/esm/structures/Constants.js +6 -1
  27. package/dist/esm/structures/Filters.d.ts +24 -0
  28. package/dist/esm/structures/Filters.js +34 -10
  29. package/dist/esm/structures/LavalinkManager.d.ts +4 -5
  30. package/dist/esm/structures/LavalinkManager.js +36 -14
  31. package/dist/esm/structures/LavalinkManagerStatics.d.ts +2 -0
  32. package/dist/esm/structures/LavalinkManagerStatics.js +11 -2
  33. package/dist/esm/structures/Node.d.ts +107 -13
  34. package/dist/esm/structures/Node.js +294 -76
  35. package/dist/esm/structures/NodeManager.d.ts +2 -2
  36. package/dist/esm/structures/NodeManager.js +20 -20
  37. package/dist/esm/structures/Player.d.ts +51 -1
  38. package/dist/esm/structures/Player.js +62 -0
  39. package/dist/esm/structures/Queue.d.ts +9 -10
  40. package/dist/esm/structures/Queue.js +3 -3
  41. package/dist/esm/structures/Types/Manager.d.ts +59 -1
  42. package/dist/esm/structures/Types/Node.d.ts +23 -1
  43. package/dist/esm/structures/Types/Player.d.ts +5 -1
  44. package/dist/esm/structures/Types/Queue.d.ts +6 -6
  45. package/dist/esm/structures/Types/Track.d.ts +3 -1
  46. package/dist/esm/structures/Types/Utils.d.ts +81 -8
  47. package/dist/esm/structures/Utils.js +8 -6
  48. package/dist/types/structures/Constants.d.ts +4 -0
  49. package/dist/types/structures/Filters.d.ts +24 -0
  50. package/dist/types/structures/LavalinkManager.d.ts +4 -5
  51. package/dist/types/structures/LavalinkManagerStatics.d.ts +2 -0
  52. package/dist/types/structures/Node.d.ts +107 -13
  53. package/dist/types/structures/NodeManager.d.ts +2 -2
  54. package/dist/types/structures/Player.d.ts +51 -1
  55. package/dist/types/structures/Queue.d.ts +9 -10
  56. package/dist/types/structures/Types/Manager.d.ts +59 -1
  57. package/dist/types/structures/Types/Node.d.ts +23 -1
  58. package/dist/types/structures/Types/Player.d.ts +5 -1
  59. package/dist/types/structures/Types/Queue.d.ts +6 -6
  60. package/dist/types/structures/Types/Track.d.ts +3 -1
  61. package/dist/types/structures/Types/Utils.d.ts +81 -8
  62. package/package.json +29 -18
package/README.md CHANGED
@@ -13,7 +13,7 @@ Easy, flexible and feature-rich lavalink@v4 Client. Both for Beginners and Profi
13
13
  <a href="https://www.npmjs.com/package/lavalink-client">
14
14
  <img src="https://img.shields.io/npm/dt/lavalink-client.svg?maxAge=3600&style=for-the-badge&logo=npm&logoColor=red" alt="NPM downloads" />
15
15
  </a>
16
- <a href="https://lc4.gitbook.io/lavalink-client/">
16
+ <a href="https://tomato6966.github.io/lavalink-client/">
17
17
  <img src="https://img.shields.io/badge/Documation-%230288D1.svg?style=for-the-badge&logo=gitbook&logoColor=white" alt="Get Started Now">
18
18
  </a>
19
19
  </p>
@@ -24,7 +24,7 @@ Easy, flexible and feature-rich lavalink@v4 Client. Both for Beginners and Profi
24
24
 
25
25
  # Install
26
26
 
27
- Latest stable Version: **`v2.1.3`**
27
+ Latest stable Version: **`v2.4.0`**
28
28
 
29
29
  <details><summary>👉 via NPM</summary>
30
30
 
@@ -36,7 +36,7 @@ npm install --save lavalink-client
36
36
  Dev Version: (Current)
37
37
 
38
38
  ```bash
39
- npm install tomato6966/lavalink-client
39
+ npm install --save tomato6966/lavalink-client
40
40
  ```
41
41
 
42
42
  </details>
@@ -57,9 +57,10 @@ yarn add tomato6966/lavalink-client
57
57
 
58
58
  # Documentation
59
59
 
60
- Check out the [Documentation](https://lc4.gitbook.io/lavalink-client) | or the [TSDocumentation](https://tomato6966.github.io/lavalink-client/) for **Examples**, and **__detailled__ Docs**, and to figure out **how to get started**. *note: it's not fully done yet (see the docs)*
61
-
62
- - __**INFO Note**__: Please use the **[TSDocumentation (auto generated, folder `/tsDocs`)](https://tomato6966.github.io/lavalink-client/)** to get the entire information of lavalink-client, *I don't have time to update the [custom written gitbook-documentation](https://lc4.gitbook.io/lavalink-client) (folder `/docs`, feel free to update it)*
60
+ Check out the [Documentation](https://tomato6966.github.io/lavalink-client/)
61
+ - See all [Manager-Events, e.g. for Track / player and general errors / logs](https://tomato6966.github.io/lavalink-client/extra/manager-events)
62
+ - See all [NodeManager-Events e.g. for Node Errors / logs](https://tomato6966.github.io/lavalink-client/extra/node-events)
63
+ - See the Guide on [How to do resuming](https://tomato6966.github.io/lavalink-client/extra/resuming)
63
64
 
64
65
  # Used in:
65
66
 
@@ -722,3 +723,69 @@ if(previousTrack) {
722
723
  - FIXED autoplay not working :: Accidentally added an invalid if statement, which made autoplay not working anymore (during the if statement to not prevent autoplay spam)
723
724
  - Added a new AutoplayExecution Debug Log
724
725
  - Added more samples to the Testbot related configuration
726
+
727
+
728
+ ## **Version 2.3.6**
729
+ - Added Lyrics Support:
730
+ - New Player Functions:
731
+ - **` const lyrics = await player.getCurrentLyrics(false); `** -> *Get lyrics of current playing track*
732
+ - **` const lyrics = await player.getLyrics(track, true); `** -> *Get lyrics of a specific track with ignoring it's sources*
733
+ - **` player.subscribeLyrics(); `** -> *Subscribe this guild to retrieve "live lyrics" as the song is *playing
734
+ - **` player.unsubscribeLyrics(); `** -> *Unsubscribe from lyrics
735
+ - New Node Functions ( same as from player, just so you can access it without player too ):*
736
+ - **` const lyrics = await player.node.lyrics.getCurrent(player.guildId, false); `**
737
+ - **` const lyrics = await player.node.lyrics.get(track, true); `**
738
+ - **` player.node.lyrics.subscribe(player.guildId); `**
739
+ - **` player.node.lyrics.unsubscribe(player.guildId); `**
740
+ - New Manager Event sfor Lyrics:
741
+ - **` lavalink.on("LyricsLine", (player, track, lyricsLine) => {}); `**
742
+ - **` lavalink.on("LyricsFound", (player, track, data) => {}); `**
743
+ - **` lavalink.on("LyricsNotFound", (player, track, lyricsLine) => {}); `**
744
+
745
+
746
+ ## **Version 2.4.0**
747
+ - Refactored a little the project folder Structure
748
+ - Added PR Packages to install all commits / packages at once `https://pkg.pr.new/Tomato6966/lavalink-client`
749
+ - Removed the dist folder, and added prepare Scripts
750
+ - Added attributes for git linting
751
+ - Removed the old (gitbook) documentation, and swapped it to a NEW TSDOC Themed Documentation via astro.dev and mdx
752
+ - Added new player events:
753
+ - **`playerMuteChange`**** ➡️ **`(player, selfMuted, serverMuted) => {}`
754
+ *Triggered when the player's voice state related to muting changed*
755
+
756
+ - **`playerDeafChange`** ➡️ `(player, selfDeafed, serverDeafed) => {}`
757
+ *Triggered when the player's voice state related to deafing changed*
758
+
759
+ - **`playerSuppressChange`** ➡️ `(player, suppress) => {}`
760
+ *Triggered when the player's voice state related to suppressing changed*
761
+
762
+ - **`playerQueueEmptyStart`** ➡️ `(player, timeoutMs) => {}`
763
+ *Triggered when the queue empty handler started (the timeout)*
764
+
765
+ - **`playerQueueEmptyEnd`** ➡️ `(player) => {}`
766
+ *Triggered when the queue empty handler finished (successfully) and thus destroyed the player*
767
+
768
+ - **`playerQueueEmptyCancel`** ➡️ `(player) => {}`
769
+ *Triggered when the queue empty handler cancelled (e.g. because a new track got added)*
770
+
771
+ ~~- **`playerVoiceEmptyStart`** ➡️ `(player, timeoutMs) => {}`~~
772
+ ~~*Triggered when the voice empty handler started (the timeout)*~~
773
+ *Removed again because of memory overhall and not wanting to handle voice states*
774
+
775
+ ~~- **`playerVoiceEmptyEnd`** ➡️ `(player) => {}`~~
776
+ ~~*Triggered when the voice empty handler finished (successfully) and thus destroyed the player*~~
777
+ *Removed again because of memory overhall and not wanting to handle voice states*
778
+
779
+ ~~- **`playerVoiceEmptyCancel`** ➡️ `(player, userId) => {}`~~
780
+ ~~*Triggered when the voice empty handler cancelled (e.g. when a user rejoined)*~~
781
+ *Removed again because of memory overhall and not wanting to handle voice states*
782
+
783
+ - **`playerVoiceJoin`** ➡️ `(player, userId) => {}`~~
784
+ *Added instead of the playerVoiceEmpty handler, emitted when a user joins the player-vc while there is a player*
785
+ *Allows you to inmplement a custom playerVoiceEmpty handler*
786
+
787
+ - **`playerVoiceLeave`** ➡️ `(player, userId) => {}`~~
788
+ *Added instead of the playerVoiceEmpty handler, emitted when a user leaves (or. switches away) the player-vc while there is a player*
789
+ *Allows you to inmplement a custom playerVoiceEmpty handler*
790
+
791
+ - Added the new events and configuration to the docs
@@ -55,6 +55,10 @@ export declare enum DestroyReasons {
55
55
  TrackErrorMaxTracksErroredPerTime = "TrackErrorMaxTracksErroredPerTime",
56
56
  TrackStuckMaxTracksErroredPerTime = "TrackStuckMaxTracksErroredPerTime"
57
57
  }
58
+ export declare enum DisconnectReasons {
59
+ Disconnected = "Disconnected",
60
+ DisconnectAllNodes = "DisconnectAllNodes"
61
+ }
58
62
  export declare const validSponsorBlocks: string[];
59
63
  /** The audio Outputs Data map declaration */
60
64
  export declare const audioOutputsData: Record<AudioOutputs, ChannelMixFilter>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EQList = exports.audioOutputsData = exports.validSponsorBlocks = exports.DestroyReasons = exports.DebugEvents = void 0;
3
+ exports.EQList = exports.audioOutputsData = exports.validSponsorBlocks = exports.DisconnectReasons = exports.DestroyReasons = exports.DebugEvents = void 0;
4
4
  var DebugEvents;
5
5
  (function (DebugEvents) {
6
6
  DebugEvents["SetSponsorBlock"] = "SetSponsorBlock";
@@ -60,11 +60,16 @@ var DestroyReasons;
60
60
  DestroyReasons["TrackStuckMaxTracksErroredPerTime"] = "TrackStuckMaxTracksErroredPerTime";
61
61
  })(DestroyReasons || (exports.DestroyReasons = DestroyReasons = {}));
62
62
  ;
63
+ var DisconnectReasons;
64
+ (function (DisconnectReasons) {
65
+ DisconnectReasons["Disconnected"] = "Disconnected";
66
+ DisconnectReasons["DisconnectAllNodes"] = "DisconnectAllNodes";
67
+ })(DisconnectReasons || (exports.DisconnectReasons = DisconnectReasons = {}));
63
68
  exports.validSponsorBlocks = ["sponsor", "selfpromo", "interaction", "intro", "outro", "preview", "music_offtopic", "filler"];
64
69
  /** The audio Outputs Data map declaration */
65
70
  exports.audioOutputsData = {
66
71
  mono: {
67
- leftToLeft: 0.5,
72
+ leftToLeft: 0.5, //each channel should in total 0 | 1, 0 === off, 1 === on, 0.5+0.5 === 1
68
73
  leftToRight: 0.5,
69
74
  rightToLeft: 0.5,
70
75
  rightToRight: 0.5,
@@ -87,9 +87,33 @@ export declare class FilterManager {
87
87
  */
88
88
  toggleLowPass(smoothing?: number): Promise<boolean>;
89
89
  lavalinkLavaDspxPlugin: {
90
+ /**
91
+ * Enables / Disables the LowPass effect, (Optional: provide your Own Data)
92
+ * @param boostFactor
93
+ * @param cutoffFrequency
94
+ * @returns
95
+ */
90
96
  toggleLowPass: (boostFactor?: number, cutoffFrequency?: number) => Promise<boolean>;
97
+ /**
98
+ * Enables / Disables the HighPass effect, (Optional: provide your Own Data)
99
+ * @param boostFactor
100
+ * @param cutoffFrequency
101
+ * @returns
102
+ */
91
103
  toggleHighPass: (boostFactor?: number, cutoffFrequency?: number) => Promise<boolean>;
104
+ /**
105
+ * Enables / Disables the Normalization effect.
106
+ * @param {number} [maxAmplitude=0.75] - The maximum amplitude of the audio.
107
+ * @param {boolean} [adaptive=true] - Whether to use adaptive normalization or not.
108
+ * @returns {Promise<boolean>} - The state of the filter after execution.
109
+ */
92
110
  toggleNormalization: (maxAmplitude?: number, adaptive?: boolean) => Promise<boolean>;
111
+ /**
112
+ * Enables / Disables the Echo effect, IMPORTANT! Only works with the correct Lavalink Plugin installed. (Optional: provide your Own Data)
113
+ * @param {number} [decay=0.5] - The decay of the echo effect.
114
+ * @param {number} [echoLength=0.5] - The length of the echo effect.
115
+ * @returns {Promise<boolean>} - The state of the filter after execution.
116
+ */
93
117
  toggleEcho: (decay?: number, echoLength?: number) => Promise<boolean>;
94
118
  };
95
119
  lavalinkFilterPlugin: {
@@ -45,29 +45,29 @@ class FilterManager {
45
45
  filterWidth: 0
46
46
  },
47
47
  timescale: {
48
- speed: 1,
49
- pitch: 1,
48
+ speed: 1, // 0 = x
49
+ pitch: 1, // 0 = x
50
50
  rate: 1 // 0 = x
51
51
  },
52
52
  rotation: {
53
53
  rotationHz: 0
54
54
  },
55
55
  tremolo: {
56
- frequency: 0,
56
+ frequency: 0, // 0 < x
57
57
  depth: 0 // 0 < x = 1
58
58
  },
59
59
  vibrato: {
60
- frequency: 0,
60
+ frequency: 0, // 0 < x <= 14
61
61
  depth: 0 // 0 < x <= 1
62
62
  },
63
63
  pluginFilters: {
64
64
  "lavalink-filter-plugin": {
65
65
  echo: {
66
- delay: 0,
66
+ delay: 0, // in seconds
67
67
  decay: 0 // 0 < 1
68
68
  },
69
69
  reverb: {
70
- delays: [],
70
+ delays: [], // [0.037, 0.042, 0.048, 0.053]
71
71
  gains: [] // [0.84, 0.83, 0.82, 0.81]
72
72
  }
73
73
  },
@@ -231,8 +231,8 @@ class FilterManager {
231
231
  filterWidth: 0
232
232
  },
233
233
  timescale: {
234
- speed: 1,
235
- pitch: 1,
234
+ speed: 1, // 0 = x
235
+ pitch: 1, // 0 = x
236
236
  rate: 1 // 0 = x
237
237
  },
238
238
  pluginFilters: {
@@ -267,11 +267,11 @@ class FilterManager {
267
267
  rotationHz: 0
268
268
  },
269
269
  tremolo: {
270
- frequency: 0,
270
+ frequency: 0, // 0 < x
271
271
  depth: 0 // 0 < x = 1
272
272
  },
273
273
  vibrato: {
274
- frequency: 0,
274
+ frequency: 0, // 0 < x = 14
275
275
  depth: 0 // 0 < x = 1
276
276
  },
277
277
  channelMix: Constants_1.audioOutputsData.stereo,
@@ -431,6 +431,12 @@ class FilterManager {
431
431
  return this.filters.lowPass;
432
432
  }
433
433
  lavalinkLavaDspxPlugin = {
434
+ /**
435
+ * Enables / Disables the LowPass effect, (Optional: provide your Own Data)
436
+ * @param boostFactor
437
+ * @param cutoffFrequency
438
+ * @returns
439
+ */
434
440
  toggleLowPass: async (boostFactor = 1.0, cutoffFrequency = 80) => {
435
441
  if (this.player.node.info && !this.player.node.info?.plugins?.find(v => v.name === "lavadspx-plugin"))
436
442
  throw new Error("Node#Info#plugins does not include the lavadspx plugin");
@@ -455,6 +461,12 @@ class FilterManager {
455
461
  await this.applyPlayerFilters();
456
462
  return this.filters.lavalinkLavaDspxPlugin.lowPass;
457
463
  },
464
+ /**
465
+ * Enables / Disables the HighPass effect, (Optional: provide your Own Data)
466
+ * @param boostFactor
467
+ * @param cutoffFrequency
468
+ * @returns
469
+ */
458
470
  toggleHighPass: async (boostFactor = 1.0, cutoffFrequency = 80) => {
459
471
  if (this.player.node.info && !this.player.node.info?.plugins?.find(v => v.name === "lavadspx-plugin"))
460
472
  throw new Error("Node#Info#plugins does not include the lavadspx plugin");
@@ -479,6 +491,12 @@ class FilterManager {
479
491
  await this.applyPlayerFilters();
480
492
  return this.filters.lavalinkLavaDspxPlugin.highPass;
481
493
  },
494
+ /**
495
+ * Enables / Disables the Normalization effect.
496
+ * @param {number} [maxAmplitude=0.75] - The maximum amplitude of the audio.
497
+ * @param {boolean} [adaptive=true] - Whether to use adaptive normalization or not.
498
+ * @returns {Promise<boolean>} - The state of the filter after execution.
499
+ */
482
500
  toggleNormalization: async (maxAmplitude = 0.75, adaptive = true) => {
483
501
  if (this.player.node.info && !this.player.node.info?.plugins?.find(v => v.name === "lavadspx-plugin"))
484
502
  throw new Error("Node#Info#plugins does not include the lavadspx plugin");
@@ -503,6 +521,12 @@ class FilterManager {
503
521
  await this.applyPlayerFilters();
504
522
  return this.filters.lavalinkLavaDspxPlugin.normalization;
505
523
  },
524
+ /**
525
+ * Enables / Disables the Echo effect, IMPORTANT! Only works with the correct Lavalink Plugin installed. (Optional: provide your Own Data)
526
+ * @param {number} [decay=0.5] - The decay of the echo effect.
527
+ * @param {number} [echoLength=0.5] - The length of the echo effect.
528
+ * @returns {Promise<boolean>} - The state of the filter after execution.
529
+ */
506
530
  toggleEcho: async (decay = 0.5, echoLength = 0.5) => {
507
531
  if (this.player.node.info && !this.player.node.info?.plugins?.find(v => v.name === "lavadspx-plugin"))
508
532
  throw new Error("Node#Info#plugins does not include the lavadspx plugin");
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { EventEmitter } from "events";
3
2
  import { NodeManager } from "./NodeManager.js";
4
3
  import { Player } from "./Player.js";
@@ -137,7 +136,7 @@ export declare class LavalinkManager extends EventEmitter {
137
136
  * ```
138
137
  * @returns
139
138
  */
140
- getPlayer(guildId: string): Player;
139
+ getPlayer(guildId: string): Player | undefined;
141
140
  /**
142
141
  * Create a Music-Player. If a player exists, then it returns it before creating a new one
143
142
  * @param options
@@ -175,7 +174,7 @@ export declare class LavalinkManager extends EventEmitter {
175
174
  * // recommend to do it on the player tho: player.destroy("forcefully destroyed the player");
176
175
  * ```
177
176
  */
178
- destroyPlayer(guildId: string, destroyReason?: string): Promise<Player>;
177
+ destroyPlayer(guildId: string, destroyReason?: string): Promise<void | Player>;
179
178
  /**
180
179
  * Delete's a player from the cache without destroying it on lavalink (only works when it's disconnected)
181
180
  * @param guildId
@@ -187,7 +186,7 @@ export declare class LavalinkManager extends EventEmitter {
187
186
  * // shouldn't be used except you know what you are doing.
188
187
  * ```
189
188
  */
190
- deletePlayer(guildId: string): boolean;
189
+ deletePlayer(guildId: string): boolean | void;
191
190
  /**
192
191
  * Checks wether the the lib is useable based on if any node is connected
193
192
  *
@@ -213,7 +212,7 @@ export declare class LavalinkManager extends EventEmitter {
213
212
  * });
214
213
  * ```
215
214
  */
216
- init(clientData: BotClientOptions): Promise<this>;
215
+ init(clientData: BotClientOptions): Promise<LavalinkManager>;
217
216
  /**
218
217
  * Sends voice data to the Lavalink server.
219
218
  * ! Without this the library won't work
@@ -92,9 +92,9 @@ class LavalinkManager extends events_1.EventEmitter {
92
92
  volumeDecrementer: options?.playerOptions?.volumeDecrementer ?? 1,
93
93
  requesterTransformer: options?.playerOptions?.requesterTransformer ?? null,
94
94
  useUnresolvedData: options?.playerOptions?.useUnresolvedData ?? false,
95
- minAutoPlayMs: options?.playerOptions?.minAutoPlayMs ?? 10000,
95
+ minAutoPlayMs: options?.playerOptions?.minAutoPlayMs ?? 10_000,
96
96
  maxErrorsPerTime: {
97
- threshold: options?.playerOptions?.maxErrorsPerTime?.threshold ?? 35000,
97
+ threshold: options?.playerOptions?.maxErrorsPerTime?.threshold ?? 35_000,
98
98
  maxAmount: options?.playerOptions?.maxErrorsPerTime?.maxAmount ?? 3
99
99
  }
100
100
  },
@@ -111,7 +111,7 @@ class LavalinkManager extends events_1.EventEmitter {
111
111
  },
112
112
  advancedOptions: {
113
113
  enableDebugEvents: options?.advancedOptions?.enableDebugEvents ?? false,
114
- maxFilterFixDuration: options?.advancedOptions?.maxFilterFixDuration ?? 600000,
114
+ maxFilterFixDuration: options?.advancedOptions?.maxFilterFixDuration ?? 600_000,
115
115
  debugOptions: {
116
116
  logCustomSearches: options?.advancedOptions?.debugOptions?.logCustomSearches ?? false,
117
117
  noAudio: options?.advancedOptions?.debugOptions?.noAudio ?? false,
@@ -509,11 +509,16 @@ class LavalinkManager extends events_1.EventEmitter {
509
509
  }
510
510
  /* voice state update */
511
511
  if (update.user_id !== this.options?.client.id) {
512
- this.emit("debug", Constants_1.DebugEvents.NoAudioDebug, {
513
- state: "warn",
514
- message: `voice update user is not equal to provided client id of the LavalinkManager.options.client.id :: user: "${update.user_id}" manager client id: "${this.options?.client.id}"`,
515
- functionLayer: "LavalinkManager > sendRawData()",
516
- });
512
+ if (update.user_id && player.voiceChannelId) {
513
+ this.emit(update.channel_id === player.voiceChannelId ? "playerVoiceJoin" : "playerVoiceLeave", player, update.user_id);
514
+ }
515
+ if (this.options?.advancedOptions?.enableDebugEvents) {
516
+ this.emit("debug", Constants_1.DebugEvents.NoAudioDebug, {
517
+ state: "warn",
518
+ message: `voice update user is not equal to provided client id of the LavalinkManager.options.client.id :: user: "${update.user_id}" manager client id: "${this.options?.client.id}"`,
519
+ functionLayer: "LavalinkManager > sendRawData()",
520
+ });
521
+ }
517
522
  if (this.options?.advancedOptions?.debugOptions?.noAudio === true)
518
523
  console.debug("Lavalink-Client-Debug | NO-AUDIO [::] sendRawData function, voice update user is not equal to provided client id of the manageroptions#client#id", "user:", update.user_id, "manager client id:", this.options?.client.id);
519
524
  return;
@@ -523,6 +528,22 @@ class LavalinkManager extends events_1.EventEmitter {
523
528
  this.emit("playerMove", player, player.voiceChannelId, update.channel_id);
524
529
  player.voice.sessionId = update.session_id;
525
530
  player.voiceChannelId = update.channel_id;
531
+ const selfMuteChanged = typeof update.self_mute === "boolean" && player.voiceState.selfMute !== update.self_mute;
532
+ const serverMuteChanged = typeof update.mute === "boolean" && player.voiceState.serverMute !== update.mute;
533
+ const selfDeafChanged = typeof update.self_deaf === "boolean" && player.voiceState.selfDeaf !== update.self_deaf;
534
+ const serverDeafChanged = typeof update.deaf === "boolean" && player.voiceState.serverDeaf !== update.deaf;
535
+ const suppressChange = typeof update.suppress === "boolean" && player.voiceState.suppress !== update.suppress;
536
+ player.voiceState.selfDeaf = update.self_deaf ?? player.voiceState?.selfDeaf;
537
+ player.voiceState.selfMute = update.self_mute ?? player.voiceState?.selfMute;
538
+ player.voiceState.serverDeaf = update.deaf ?? player.voiceState?.serverDeaf;
539
+ player.voiceState.serverMute = update.mute ?? player.voiceState?.serverMute;
540
+ player.voiceState.suppress = update.suppress ?? player.voiceState?.suppress;
541
+ if (selfMuteChanged || serverMuteChanged)
542
+ this.emit("playerMuteChange", player, player.voiceState.selfMute, player.voiceState.serverMute);
543
+ if (selfDeafChanged || serverDeafChanged)
544
+ this.emit("playerDeafChange", player, player.voiceState.selfDeaf, player.voiceState.serverDeaf);
545
+ if (suppressChange)
546
+ this.emit("playerSuppressChange", player, player.voiceState.suppress);
526
547
  }
527
548
  else {
528
549
  if (this.options?.playerOptions?.onDisconnect?.destroyPlayer === true) {
@@ -532,11 +553,13 @@ class LavalinkManager extends events_1.EventEmitter {
532
553
  if (this.options?.playerOptions?.onDisconnect?.autoReconnect === true) {
533
554
  try {
534
555
  const positionPrevios = player.position;
535
- this.emit("debug", Constants_1.DebugEvents.PlayerAutoReconnect, {
536
- state: "log",
537
- message: `Auto reconnecting player because LavalinkManager.options.playerOptions.onDisconnect.autoReconnect is true`,
538
- functionLayer: "LavalinkManager > sendRawData()",
539
- });
556
+ if (this.options?.advancedOptions?.enableDebugEvents) {
557
+ this.emit("debug", Constants_1.DebugEvents.PlayerAutoReconnect, {
558
+ state: "log",
559
+ message: `Auto reconnecting player because LavalinkManager.options.playerOptions.onDisconnect.autoReconnect is true`,
560
+ functionLayer: "LavalinkManager > sendRawData()",
561
+ });
562
+ }
540
563
  await player.connect();
541
564
  // replay the current playing stream
542
565
  await player.play({
@@ -554,7 +577,6 @@ class LavalinkManager extends events_1.EventEmitter {
554
577
  player.voice = Object.assign({});
555
578
  return;
556
579
  }
557
- return;
558
580
  }
559
581
  }
560
582
  }
@@ -7,7 +7,9 @@ export declare const LavalinkPlugins: {
7
7
  LavaSrc: string;
8
8
  GoogleCloudTTS: string;
9
9
  LavaSearch: string;
10
+ Jiosaavn_Plugin: string;
10
11
  LavalinkFilterPlugin: string;
12
+ JavaTimedLyricsPlugin: string;
11
13
  };
12
14
  /** Lavalink Sources regexes for url validations */
13
15
  export declare const SourceLinksRegexes: Record<SourcesRegex, RegExp>;
@@ -65,7 +65,12 @@ exports.DefaultSources = {
65
65
  "http": "http",
66
66
  "https": "https",
67
67
  "link": "link",
68
- "uri": "uri"
68
+ "uri": "uri",
69
+ // jiosaavn
70
+ "jiosaavn": "jssearch",
71
+ "js": "jssearch",
72
+ "jssearch": "jssearch",
73
+ "jsrec": "jsrec"
69
74
  };
70
75
  /** Lavalink Plugins definiton */
71
76
  exports.LavalinkPlugins = {
@@ -73,7 +78,9 @@ exports.LavalinkPlugins = {
73
78
  LavaSrc: "lavasrc-plugin",
74
79
  GoogleCloudTTS: "tts-plugin",
75
80
  LavaSearch: "lavasearch-plugin",
76
- LavalinkFilterPlugin: "lavalink-filter-plugin"
81
+ Jiosaavn_Plugin: "jiosaavn-plugin",
82
+ LavalinkFilterPlugin: "lavalink-filter-plugin",
83
+ JavaTimedLyricsPlugin: "java-lyrics-plugin"
77
84
  };
78
85
  /** Lavalink Sources regexes for url validations */
79
86
  exports.SourceLinksRegexes = {
@@ -111,6 +118,8 @@ exports.SourceLinksRegexes = {
111
118
  SpotifyAlbumRegex: /(https?:\/\/)(www\.)?open\.spotify\.com\/((?<region>[a-zA-Z-]+)\/)?(user\/(?<user>[a-zA-Z0-9-_]+)\/)?album\/(?<identifier>[a-zA-Z0-9-_]+)/,
112
119
  AllSpotifyRegex: /(https?:\/\/)(www\.)?open\.spotify\.com\/((?<region>[a-zA-Z-]+)\/)?(user\/(?<user>[a-zA-Z0-9-_]+)\/)?(?<type>track|album|playlist|artist|episode|show)\/(?<identifier>[a-zA-Z0-9-_]+)/,
113
120
  appleMusic: /https?:\/\/?(?:www\.)?music\.apple\.com\/(\S+)/,
121
+ /** From jiosaavn-plugin */
122
+ jiosaavn: /(https?:\/\/)(www\.)?jiosaavn\.com\/(?<type>song|album|featured|artist)\/([a-zA-Z0-9-_\/,]+)/,
114
123
  /** FROM DUNCTE BOT PLUGIN */
115
124
  tiktok: /https:\/\/www\.tiktok\.com\//,
116
125
  mixcloud: /https:\/\/www\.mixcloud\.com\//,