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
@@ -1,6 +1,6 @@
1
1
  import type { MiniMap } from "../Utils.js";
2
2
  import type { LavalinkFilterData } from "./Filters.js";
3
- import type { NodeStats } from "./Node.js";
3
+ import type { LyricsLine, LyricsResult, NodeStats } from "./Node.js";
4
4
  import type { LavalinkPlayOptions } from "./Player.js";
5
5
  import type { LavalinkTrack, PluginInfo, Track, UnresolvedTrack } from "./Track.js";
6
6
  /** Helper for generating Opaque types. */
@@ -13,15 +13,16 @@ export type IntegerNumber = Opaque<number, 'Int'>;
13
13
  export type FloatNumber = Opaque<number, 'Float'>;
14
14
  export type LavaSrcSearchPlatformBase = "spsearch" | "sprec" | "amsearch" | "dzsearch" | "dzisrc" | "ymsearch";
15
15
  export type LavaSrcSearchPlatform = LavaSrcSearchPlatformBase | "ftts";
16
+ export type JioSaavnSearchPlatform = "jssearch" | "jsrec";
16
17
  export type DuncteSearchPlatform = "speak" | "phsearch" | "pornhub" | "porn" | "tts";
17
18
  export type LavalinkClientSearchPlatform = "bcsearch";
18
19
  export type LavalinkClientSearchPlatformResolve = "bandcamp" | "bc";
19
- export type LavalinkSearchPlatform = "ytsearch" | "ytmsearch" | "scsearch" | "bcsearch" | LavaSrcSearchPlatform | DuncteSearchPlatform | LavalinkClientSearchPlatform;
20
+ export type LavalinkSearchPlatform = "ytsearch" | "ytmsearch" | "scsearch" | "bcsearch" | LavaSrcSearchPlatform | DuncteSearchPlatform | JioSaavnSearchPlatform | LavalinkClientSearchPlatform;
20
21
  export type ClientCustomSearchPlatformUtils = "local" | "http" | "https" | "link" | "uri";
21
22
  export type ClientSearchPlatform = ClientCustomSearchPlatformUtils | // for file/link requests
22
- "youtube" | "yt" | "youtube music" | "youtubemusic" | "ytm" | "musicyoutube" | "music youtube" | "soundcloud" | "sc" | "am" | "apple music" | "applemusic" | "apple" | "musicapple" | "music apple" | "sp" | "spsuggestion" | "spotify" | "spotify.com" | "spotifycom" | "dz" | "deezer" | "yandex" | "yandex music" | "yandexmusic" | "flowerytts" | "flowery" | "flowery.tts" | LavalinkClientSearchPlatformResolve | LavalinkClientSearchPlatform;
23
+ "youtube" | "yt" | "youtube music" | "youtubemusic" | "ytm" | "musicyoutube" | "music youtube" | "soundcloud" | "sc" | "am" | "apple music" | "applemusic" | "apple" | "musicapple" | "music apple" | "sp" | "spsuggestion" | "spotify" | "spotify.com" | "spotifycom" | "dz" | "deezer" | "yandex" | "yandex music" | "yandexmusic" | "flowerytts" | "flowery" | "flowery.tts" | LavalinkClientSearchPlatformResolve | LavalinkClientSearchPlatform | "js" | "jiosaavn";
23
24
  export type SearchPlatform = LavalinkSearchPlatform | ClientSearchPlatform;
24
- export type SourcesRegex = "YoutubeRegex" | "YoutubeMusicRegex" | "SoundCloudRegex" | "SoundCloudMobileRegex" | "DeezerTrackRegex" | "DeezerArtistRegex" | "DeezerEpisodeRegex" | "DeezerMixesRegex" | "DeezerPageLinkRegex" | "DeezerPlaylistRegex" | "DeezerAlbumRegex" | "AllDeezerRegex" | "AllDeezerRegexWithoutPageLink" | "SpotifySongRegex" | "SpotifyPlaylistRegex" | "SpotifyArtistRegex" | "SpotifyEpisodeRegex" | "SpotifyShowRegex" | "SpotifyAlbumRegex" | "AllSpotifyRegex" | "mp3Url" | "m3uUrl" | "m3u8Url" | "mp4Url" | "m4aUrl" | "wavUrl" | "aacpUrl" | "tiktok" | "mixcloud" | "musicYandex" | "radiohost" | "bandcamp" | "appleMusic" | "TwitchTv" | "vimeo";
25
+ export type SourcesRegex = "YoutubeRegex" | "YoutubeMusicRegex" | "SoundCloudRegex" | "SoundCloudMobileRegex" | "DeezerTrackRegex" | "DeezerArtistRegex" | "DeezerEpisodeRegex" | "DeezerMixesRegex" | "DeezerPageLinkRegex" | "DeezerPlaylistRegex" | "DeezerAlbumRegex" | "AllDeezerRegex" | "AllDeezerRegexWithoutPageLink" | "SpotifySongRegex" | "SpotifyPlaylistRegex" | "SpotifyArtistRegex" | "SpotifyEpisodeRegex" | "SpotifyShowRegex" | "SpotifyAlbumRegex" | "AllSpotifyRegex" | "mp3Url" | "m3uUrl" | "m3u8Url" | "mp4Url" | "m4aUrl" | "wavUrl" | "aacpUrl" | "tiktok" | "mixcloud" | "musicYandex" | "radiohost" | "bandcamp" | "jiosaavn" | "appleMusic" | "TwitchTv" | "vimeo";
25
26
  export interface PlaylistInfo {
26
27
  /** The playlist name */
27
28
  name: string;
@@ -62,7 +63,7 @@ export interface MiniMapConstructor {
62
63
  readonly prototype: MiniMap<unknown, unknown>;
63
64
  readonly [Symbol.species]: MiniMapConstructor;
64
65
  }
65
- export type PlayerEvents = TrackStartEvent | TrackEndEvent | TrackStuckEvent | TrackExceptionEvent | WebSocketClosedEvent | SponsorBlockSegmentEvents;
66
+ export type PlayerEvents = TrackStartEvent | TrackEndEvent | TrackStuckEvent | TrackExceptionEvent | WebSocketClosedEvent | SponsorBlockSegmentEvents | LyricsEvent;
66
67
  export type Severity = "COMMON" | "SUSPICIOUS" | "FAULT";
67
68
  export interface Exception {
68
69
  /** Severity of the error */
@@ -148,9 +149,66 @@ export interface SponsorBlockChaptersLoaded extends PlayerEvent {
148
149
  duration: number;
149
150
  }[];
150
151
  }
152
+ /**
153
+ * Types & Events for Lyrics plugin from Lavalink: https://github.com/topi314/LavaLyrics
154
+ */
155
+ export type LyricsEvent = LyricsFoundEvent | LyricsNotFoundEvent | LyricsLineEvent;
156
+ export type LyricsEventType = "LyricsFoundEvent" | "LyricsNotFoundEvent" | "LyricsLineEvent";
157
+ export interface LyricsFoundEvent extends PlayerEvent {
158
+ /** The lyricsfound event */
159
+ type: "LyricsFoundEvent";
160
+ /** The guildId */
161
+ guildId: string;
162
+ /** The lyrics */
163
+ lyrics: LyricsResult;
164
+ }
165
+ export interface LyricsNotFoundEvent extends PlayerEvent {
166
+ /**The lyricsnotfound event*/
167
+ type: "LyricsNotFoundEvent";
168
+ /**The guildId*/
169
+ guildId: string;
170
+ }
171
+ export interface LyricsLineEvent extends PlayerEvent {
172
+ /**The lyricsline event*/
173
+ type: "LyricsLineEvent";
174
+ /** The guildId */
175
+ guildId: string;
176
+ /** The line number */
177
+ lineIndex: number;
178
+ /** The line */
179
+ line: LyricsLine;
180
+ /**skipped is true if the line was skipped */
181
+ skipped: boolean;
182
+ }
183
+ export interface LyricsFoundEvent extends PlayerEvent {
184
+ /** The lyricsfound event */
185
+ type: "LyricsFoundEvent";
186
+ /** The guildId */
187
+ guildId: string;
188
+ /** The lyrics */
189
+ lyrics: LyricsResult;
190
+ }
191
+ export interface LyricsNotFoundEvent extends PlayerEvent {
192
+ /**The lyricsnotfound event*/
193
+ type: "LyricsNotFoundEvent";
194
+ /**The guildId*/
195
+ guildId: string;
196
+ }
197
+ export interface LyricsLineEvent extends PlayerEvent {
198
+ /**The lyricsline event*/
199
+ type: "LyricsLineEvent";
200
+ /** The guildId */
201
+ guildId: string;
202
+ /** The line number */
203
+ lineIndex: number;
204
+ /** The line */
205
+ line: LyricsLine;
206
+ /**skipped is true if the line was skipped */
207
+ skipped: boolean;
208
+ }
151
209
  export type LoadTypes = "track" | "playlist" | "search" | "error" | "empty";
152
210
  export type State = "CONNECTED" | "CONNECTING" | "DISCONNECTED" | "DISCONNECTING" | "DESTROYING";
153
- export type PlayerEventType = "TrackStartEvent" | "TrackEndEvent" | "TrackExceptionEvent" | "TrackStuckEvent" | "WebSocketClosedEvent" | SponsorBlockSegmentEventType;
211
+ export type PlayerEventType = "TrackStartEvent" | "TrackEndEvent" | "TrackExceptionEvent" | "TrackStuckEvent" | "WebSocketClosedEvent" | SponsorBlockSegmentEventType | LyricsEventType;
154
212
  export type TrackEndReason = "finished" | "loadFailed" | "stopped" | "replaced" | "cleanup";
155
213
  export interface InvalidLavalinkRestRequest {
156
214
  /** Rest Request Data for when it was made */
@@ -178,8 +236,7 @@ export interface LavalinkPlayerVoice {
178
236
  /** The Ping to the voice server */
179
237
  ping?: number;
180
238
  }
181
- export interface LavalinkPlayerVoiceOptions extends Omit<LavalinkPlayerVoice, 'connected' | 'ping'> {
182
- }
239
+ export type LavalinkPlayerVoiceOptions = Omit<LavalinkPlayerVoice, 'connected' | 'ping'>;
183
240
  export interface FailingAddress {
184
241
  /** The failing address */
185
242
  failingAddress: string;
@@ -295,6 +352,22 @@ export interface VoiceState {
295
352
  session_id: string;
296
353
  /** Voice Channel Id */
297
354
  channel_id: string;
355
+ /** Server Mute status */
356
+ mute: boolean;
357
+ /** Server Deaf status */
358
+ deaf: boolean;
359
+ /** Self Deaf status */
360
+ self_deaf: boolean;
361
+ /** Self Mute status */
362
+ self_mute: boolean;
363
+ /** Self Video (Camera) status */
364
+ self_video: boolean;
365
+ /** Self Stream status */
366
+ self_stream: boolean;
367
+ /** Wether the user requests to speak (stage channel) */
368
+ request_to_speak_timestamp: boolean;
369
+ /** Self suppressed status (stage channel) */
370
+ suppress: boolean;
298
371
  }
299
372
  /** The Base64 decodes tring by lavalink */
300
373
  export type Base64 = string;
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.queueTrackEnd = exports.MiniMap = exports.ManagerUtils = exports.parseLavalinkConnUrl = exports.NodeSymbol = exports.QueueSymbol = exports.UnresolvedTrackSymbol = exports.TrackSymbol = void 0;
3
+ exports.MiniMap = exports.ManagerUtils = exports.NodeSymbol = exports.QueueSymbol = exports.UnresolvedTrackSymbol = exports.TrackSymbol = void 0;
4
+ exports.parseLavalinkConnUrl = parseLavalinkConnUrl;
5
+ exports.queueTrackEnd = queueTrackEnd;
4
6
  const node_url_1 = require("node:url");
5
7
  const types_1 = require("node:util/types");
6
8
  const Constants_1 = require("./Constants.js");
@@ -27,7 +29,6 @@ function parseLavalinkConnUrl(connectionUrl) {
27
29
  port: Number(parsed.port),
28
30
  };
29
31
  }
30
- exports.parseLavalinkConnUrl = parseLavalinkConnUrl;
31
32
  class ManagerUtils {
32
33
  LavalinkManager = null;
33
34
  constructor(LavalinkManager) {
@@ -300,12 +301,12 @@ class ManagerUtils {
300
301
  if (LavalinkManagerStatics_1.SourceLinksRegexes.AllDeezerRegex.test(queryString) && !node.info?.sourceManagers?.includes("deezer")) {
301
302
  throw new Error("Query / Link Provided for this Source but Lavalink Node has not 'deezer' enabled");
302
303
  }
303
- if (LavalinkManagerStatics_1.SourceLinksRegexes.AllDeezerRegex.test(queryString) && node.info?.sourceManagers?.includes("deezer") && !node.info?.sourceManagers?.includes("http")) {
304
- throw new Error("Query / Link Provided for this Source but Lavalink Node has not 'http' enabled, which is required to have 'deezer' to work");
305
- }
306
304
  if (LavalinkManagerStatics_1.SourceLinksRegexes.musicYandex.test(queryString) && !node.info?.sourceManagers?.includes("yandexmusic")) {
307
305
  throw new Error("Query / Link Provided for this Source but Lavalink Node has not 'yandexmusic' enabled");
308
306
  }
307
+ if (LavalinkManagerStatics_1.SourceLinksRegexes.jiosaavn.test(queryString) && !node.info?.sourceManagers?.includes("jiosaavn")) {
308
+ throw new Error("Query / Link Provided for this Source but Lavalink Node has not 'jiosaavn' (via jiosaavn-plugin) enabled");
309
+ }
309
310
  return;
310
311
  }
311
312
  transformQuery(query) {
@@ -358,8 +359,11 @@ class ManagerUtils {
358
359
  if (source === "dzisrc" && node.info?.sourceManagers?.includes("deezer") && !node.info?.sourceManagers?.includes("http")) {
359
360
  throw new Error("Lavalink Node has not 'http' enabled, which is required to have 'dzisrc' to work");
360
361
  }
361
- if (source === "dzsearch" && node.info?.sourceManagers?.includes("deezer") && !node.info?.sourceManagers?.includes("http")) {
362
- throw new Error("Lavalink Node has not 'http' enabled, which is required to have 'dzsearch' to work");
362
+ if (source === "jsrec" && !node.info?.sourceManagers?.includes("jiosaavn")) {
363
+ throw new Error("Lavalink Node has not 'jiosaavn' (via jiosaavn-plugin) enabled, which is required to have 'jsrec' to work");
364
+ }
365
+ if (source === "jssearch" && !node.info?.sourceManagers?.includes("jiosaavn")) {
366
+ throw new Error("Lavalink Node has not 'jiosaavn' (via jiosaavn-plugin) enabled, which is required to have 'jssearch' to work");
363
367
  }
364
368
  if (source === "scsearch" && !node.info?.sourceManagers?.includes("soundcloud")) {
365
369
  throw new Error("Lavalink Node has not 'soundcloud' enabled, which is required to have 'scsearch' work");
@@ -409,7 +413,6 @@ class MiniMap extends Map {
409
413
  const iter = this.entries();
410
414
  return Array.from({ length: this.size }, () => {
411
415
  const [key, value] = iter.next().value;
412
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
413
416
  return fn(value, key, this);
414
417
  });
415
418
  }
@@ -451,7 +454,6 @@ async function queueTrackEnd(player) {
451
454
  // return the new current Track
452
455
  return player.queue.current;
453
456
  }
454
- exports.queueTrackEnd = queueTrackEnd;
455
457
  async function applyUnresolvedData(resTrack, data, utils) {
456
458
  if (!resTrack?.info || !data?.info)
457
459
  return;
@@ -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>;
@@ -57,11 +57,16 @@ export var DestroyReasons;
57
57
  DestroyReasons["TrackStuckMaxTracksErroredPerTime"] = "TrackStuckMaxTracksErroredPerTime";
58
58
  })(DestroyReasons || (DestroyReasons = {}));
59
59
  ;
60
+ export var DisconnectReasons;
61
+ (function (DisconnectReasons) {
62
+ DisconnectReasons["Disconnected"] = "Disconnected";
63
+ DisconnectReasons["DisconnectAllNodes"] = "DisconnectAllNodes";
64
+ })(DisconnectReasons || (DisconnectReasons = {}));
60
65
  export const validSponsorBlocks = ["sponsor", "selfpromo", "interaction", "intro", "outro", "preview", "music_offtopic", "filler"];
61
66
  /** The audio Outputs Data map declaration */
62
67
  export const audioOutputsData = {
63
68
  mono: {
64
- leftToLeft: 0.5,
69
+ leftToLeft: 0.5, //each channel should in total 0 | 1, 0 === off, 1 === on, 0.5+0.5 === 1
65
70
  leftToRight: 0.5,
66
71
  rightToLeft: 0.5,
67
72
  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: {
@@ -42,29 +42,29 @@ export class FilterManager {
42
42
  filterWidth: 0
43
43
  },
44
44
  timescale: {
45
- speed: 1,
46
- pitch: 1,
45
+ speed: 1, // 0 = x
46
+ pitch: 1, // 0 = x
47
47
  rate: 1 // 0 = x
48
48
  },
49
49
  rotation: {
50
50
  rotationHz: 0
51
51
  },
52
52
  tremolo: {
53
- frequency: 0,
53
+ frequency: 0, // 0 < x
54
54
  depth: 0 // 0 < x = 1
55
55
  },
56
56
  vibrato: {
57
- frequency: 0,
57
+ frequency: 0, // 0 < x <= 14
58
58
  depth: 0 // 0 < x <= 1
59
59
  },
60
60
  pluginFilters: {
61
61
  "lavalink-filter-plugin": {
62
62
  echo: {
63
- delay: 0,
63
+ delay: 0, // in seconds
64
64
  decay: 0 // 0 < 1
65
65
  },
66
66
  reverb: {
67
- delays: [],
67
+ delays: [], // [0.037, 0.042, 0.048, 0.053]
68
68
  gains: [] // [0.84, 0.83, 0.82, 0.81]
69
69
  }
70
70
  },
@@ -228,8 +228,8 @@ export class FilterManager {
228
228
  filterWidth: 0
229
229
  },
230
230
  timescale: {
231
- speed: 1,
232
- pitch: 1,
231
+ speed: 1, // 0 = x
232
+ pitch: 1, // 0 = x
233
233
  rate: 1 // 0 = x
234
234
  },
235
235
  pluginFilters: {
@@ -264,11 +264,11 @@ export class FilterManager {
264
264
  rotationHz: 0
265
265
  },
266
266
  tremolo: {
267
- frequency: 0,
267
+ frequency: 0, // 0 < x
268
268
  depth: 0 // 0 < x = 1
269
269
  },
270
270
  vibrato: {
271
- frequency: 0,
271
+ frequency: 0, // 0 < x = 14
272
272
  depth: 0 // 0 < x = 1
273
273
  },
274
274
  channelMix: audioOutputsData.stereo,
@@ -428,6 +428,12 @@ export class FilterManager {
428
428
  return this.filters.lowPass;
429
429
  }
430
430
  lavalinkLavaDspxPlugin = {
431
+ /**
432
+ * Enables / Disables the LowPass effect, (Optional: provide your Own Data)
433
+ * @param boostFactor
434
+ * @param cutoffFrequency
435
+ * @returns
436
+ */
431
437
  toggleLowPass: async (boostFactor = 1.0, cutoffFrequency = 80) => {
432
438
  if (this.player.node.info && !this.player.node.info?.plugins?.find(v => v.name === "lavadspx-plugin"))
433
439
  throw new Error("Node#Info#plugins does not include the lavadspx plugin");
@@ -452,6 +458,12 @@ export class FilterManager {
452
458
  await this.applyPlayerFilters();
453
459
  return this.filters.lavalinkLavaDspxPlugin.lowPass;
454
460
  },
461
+ /**
462
+ * Enables / Disables the HighPass effect, (Optional: provide your Own Data)
463
+ * @param boostFactor
464
+ * @param cutoffFrequency
465
+ * @returns
466
+ */
455
467
  toggleHighPass: async (boostFactor = 1.0, cutoffFrequency = 80) => {
456
468
  if (this.player.node.info && !this.player.node.info?.plugins?.find(v => v.name === "lavadspx-plugin"))
457
469
  throw new Error("Node#Info#plugins does not include the lavadspx plugin");
@@ -476,6 +488,12 @@ export class FilterManager {
476
488
  await this.applyPlayerFilters();
477
489
  return this.filters.lavalinkLavaDspxPlugin.highPass;
478
490
  },
491
+ /**
492
+ * Enables / Disables the Normalization effect.
493
+ * @param {number} [maxAmplitude=0.75] - The maximum amplitude of the audio.
494
+ * @param {boolean} [adaptive=true] - Whether to use adaptive normalization or not.
495
+ * @returns {Promise<boolean>} - The state of the filter after execution.
496
+ */
479
497
  toggleNormalization: async (maxAmplitude = 0.75, adaptive = true) => {
480
498
  if (this.player.node.info && !this.player.node.info?.plugins?.find(v => v.name === "lavadspx-plugin"))
481
499
  throw new Error("Node#Info#plugins does not include the lavadspx plugin");
@@ -500,6 +518,12 @@ export class FilterManager {
500
518
  await this.applyPlayerFilters();
501
519
  return this.filters.lavalinkLavaDspxPlugin.normalization;
502
520
  },
521
+ /**
522
+ * Enables / Disables the Echo effect, IMPORTANT! Only works with the correct Lavalink Plugin installed. (Optional: provide your Own Data)
523
+ * @param {number} [decay=0.5] - The decay of the echo effect.
524
+ * @param {number} [echoLength=0.5] - The length of the echo effect.
525
+ * @returns {Promise<boolean>} - The state of the filter after execution.
526
+ */
503
527
  toggleEcho: async (decay = 0.5, echoLength = 0.5) => {
504
528
  if (this.player.node.info && !this.player.node.info?.plugins?.find(v => v.name === "lavadspx-plugin"))
505
529
  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
@@ -89,9 +89,9 @@ export class LavalinkManager extends EventEmitter {
89
89
  volumeDecrementer: options?.playerOptions?.volumeDecrementer ?? 1,
90
90
  requesterTransformer: options?.playerOptions?.requesterTransformer ?? null,
91
91
  useUnresolvedData: options?.playerOptions?.useUnresolvedData ?? false,
92
- minAutoPlayMs: options?.playerOptions?.minAutoPlayMs ?? 10000,
92
+ minAutoPlayMs: options?.playerOptions?.minAutoPlayMs ?? 10_000,
93
93
  maxErrorsPerTime: {
94
- threshold: options?.playerOptions?.maxErrorsPerTime?.threshold ?? 35000,
94
+ threshold: options?.playerOptions?.maxErrorsPerTime?.threshold ?? 35_000,
95
95
  maxAmount: options?.playerOptions?.maxErrorsPerTime?.maxAmount ?? 3
96
96
  }
97
97
  },
@@ -108,7 +108,7 @@ export class LavalinkManager extends EventEmitter {
108
108
  },
109
109
  advancedOptions: {
110
110
  enableDebugEvents: options?.advancedOptions?.enableDebugEvents ?? false,
111
- maxFilterFixDuration: options?.advancedOptions?.maxFilterFixDuration ?? 600000,
111
+ maxFilterFixDuration: options?.advancedOptions?.maxFilterFixDuration ?? 600_000,
112
112
  debugOptions: {
113
113
  logCustomSearches: options?.advancedOptions?.debugOptions?.logCustomSearches ?? false,
114
114
  noAudio: options?.advancedOptions?.debugOptions?.noAudio ?? false,
@@ -506,11 +506,16 @@ export class LavalinkManager extends EventEmitter {
506
506
  }
507
507
  /* voice state update */
508
508
  if (update.user_id !== this.options?.client.id) {
509
- this.emit("debug", DebugEvents.NoAudioDebug, {
510
- state: "warn",
511
- 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}"`,
512
- functionLayer: "LavalinkManager > sendRawData()",
513
- });
509
+ if (update.user_id && player.voiceChannelId) {
510
+ this.emit(update.channel_id === player.voiceChannelId ? "playerVoiceJoin" : "playerVoiceLeave", player, update.user_id);
511
+ }
512
+ if (this.options?.advancedOptions?.enableDebugEvents) {
513
+ this.emit("debug", DebugEvents.NoAudioDebug, {
514
+ state: "warn",
515
+ 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}"`,
516
+ functionLayer: "LavalinkManager > sendRawData()",
517
+ });
518
+ }
514
519
  if (this.options?.advancedOptions?.debugOptions?.noAudio === true)
515
520
  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);
516
521
  return;
@@ -520,6 +525,22 @@ export class LavalinkManager extends EventEmitter {
520
525
  this.emit("playerMove", player, player.voiceChannelId, update.channel_id);
521
526
  player.voice.sessionId = update.session_id;
522
527
  player.voiceChannelId = update.channel_id;
528
+ const selfMuteChanged = typeof update.self_mute === "boolean" && player.voiceState.selfMute !== update.self_mute;
529
+ const serverMuteChanged = typeof update.mute === "boolean" && player.voiceState.serverMute !== update.mute;
530
+ const selfDeafChanged = typeof update.self_deaf === "boolean" && player.voiceState.selfDeaf !== update.self_deaf;
531
+ const serverDeafChanged = typeof update.deaf === "boolean" && player.voiceState.serverDeaf !== update.deaf;
532
+ const suppressChange = typeof update.suppress === "boolean" && player.voiceState.suppress !== update.suppress;
533
+ player.voiceState.selfDeaf = update.self_deaf ?? player.voiceState?.selfDeaf;
534
+ player.voiceState.selfMute = update.self_mute ?? player.voiceState?.selfMute;
535
+ player.voiceState.serverDeaf = update.deaf ?? player.voiceState?.serverDeaf;
536
+ player.voiceState.serverMute = update.mute ?? player.voiceState?.serverMute;
537
+ player.voiceState.suppress = update.suppress ?? player.voiceState?.suppress;
538
+ if (selfMuteChanged || serverMuteChanged)
539
+ this.emit("playerMuteChange", player, player.voiceState.selfMute, player.voiceState.serverMute);
540
+ if (selfDeafChanged || serverDeafChanged)
541
+ this.emit("playerDeafChange", player, player.voiceState.selfDeaf, player.voiceState.serverDeaf);
542
+ if (suppressChange)
543
+ this.emit("playerSuppressChange", player, player.voiceState.suppress);
523
544
  }
524
545
  else {
525
546
  if (this.options?.playerOptions?.onDisconnect?.destroyPlayer === true) {
@@ -529,11 +550,13 @@ export class LavalinkManager extends EventEmitter {
529
550
  if (this.options?.playerOptions?.onDisconnect?.autoReconnect === true) {
530
551
  try {
531
552
  const positionPrevios = player.position;
532
- this.emit("debug", DebugEvents.PlayerAutoReconnect, {
533
- state: "log",
534
- message: `Auto reconnecting player because LavalinkManager.options.playerOptions.onDisconnect.autoReconnect is true`,
535
- functionLayer: "LavalinkManager > sendRawData()",
536
- });
553
+ if (this.options?.advancedOptions?.enableDebugEvents) {
554
+ this.emit("debug", DebugEvents.PlayerAutoReconnect, {
555
+ state: "log",
556
+ message: `Auto reconnecting player because LavalinkManager.options.playerOptions.onDisconnect.autoReconnect is true`,
557
+ functionLayer: "LavalinkManager > sendRawData()",
558
+ });
559
+ }
537
560
  await player.connect();
538
561
  // replay the current playing stream
539
562
  await player.play({
@@ -551,7 +574,6 @@ export class LavalinkManager extends EventEmitter {
551
574
  player.voice = Object.assign({});
552
575
  return;
553
576
  }
554
- return;
555
577
  }
556
578
  }
557
579
  }
@@ -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>;
@@ -62,7 +62,12 @@ export const DefaultSources = {
62
62
  "http": "http",
63
63
  "https": "https",
64
64
  "link": "link",
65
- "uri": "uri"
65
+ "uri": "uri",
66
+ // jiosaavn
67
+ "jiosaavn": "jssearch",
68
+ "js": "jssearch",
69
+ "jssearch": "jssearch",
70
+ "jsrec": "jsrec"
66
71
  };
67
72
  /** Lavalink Plugins definiton */
68
73
  export const LavalinkPlugins = {
@@ -70,7 +75,9 @@ export const LavalinkPlugins = {
70
75
  LavaSrc: "lavasrc-plugin",
71
76
  GoogleCloudTTS: "tts-plugin",
72
77
  LavaSearch: "lavasearch-plugin",
73
- LavalinkFilterPlugin: "lavalink-filter-plugin"
78
+ Jiosaavn_Plugin: "jiosaavn-plugin",
79
+ LavalinkFilterPlugin: "lavalink-filter-plugin",
80
+ JavaTimedLyricsPlugin: "java-lyrics-plugin"
74
81
  };
75
82
  /** Lavalink Sources regexes for url validations */
76
83
  export const SourceLinksRegexes = {
@@ -108,6 +115,8 @@ export const SourceLinksRegexes = {
108
115
  SpotifyAlbumRegex: /(https?:\/\/)(www\.)?open\.spotify\.com\/((?<region>[a-zA-Z-]+)\/)?(user\/(?<user>[a-zA-Z0-9-_]+)\/)?album\/(?<identifier>[a-zA-Z0-9-_]+)/,
109
116
  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-_]+)/,
110
117
  appleMusic: /https?:\/\/?(?:www\.)?music\.apple\.com\/(\S+)/,
118
+ /** From jiosaavn-plugin */
119
+ jiosaavn: /(https?:\/\/)(www\.)?jiosaavn\.com\/(?<type>song|album|featured|artist)\/([a-zA-Z0-9-_\/,]+)/,
111
120
  /** FROM DUNCTE BOT PLUGIN */
112
121
  tiktok: /https:\/\/www\.tiktok\.com\//,
113
122
  mixcloud: /https:\/\/www\.mixcloud\.com\//,