lavalink-client 2.6.1 → 2.6.3

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
@@ -1,6 +1,6 @@
1
- <div style="font-family: Arial, sans-serif; border: 1px solid #ddd; border-radius: 15px; padding: 25px; background-color: #f9f9f9;">
1
+ <div style="font-family: Arial, sans-serif; border: 1px solid #fab788; border-radius: 15px; padding: 25px; ">
2
2
 
3
- <h1 align="center" style="color: #2c3e50; border-bottom: 2px solid #3498db; padding-bottom: 10px;">Lavalink Client</h1>
3
+ <h1 align="center" style="color: #fab788; border-bottom: 2px solid #3498db; padding-bottom: 10px;">Lavalink Client</h1>
4
4
  <p align="center" style="font-size: 1.2em; color: #555;">An easy, flexible, and feature-rich Lavalink v4 Client for both beginners and experts.</p>
5
5
 
6
6
  <div align="center">
@@ -421,7 +421,7 @@ client.lavalink.on("playerDestroy", (player) => {
421
421
  Lavalink client supports most of the major lavalink-plugins.
422
422
  The client itself is - for beginner friendly reasons - atm not extendable (via plugins)
423
423
  You can just use the built in functions (sponsor block, lyrics) or search plattforms (deezer, spotify, apple music, youtube, ...) and use the lavalink-plugins without any configuration on the client side.
424
-
424
+
425
425
  Some plugins require extra-parameters, such as flowerytts:
426
426
  Pass extra parameters to the search function to use plugin-specific features.
427
427
 
@@ -455,4 +455,4 @@ if (response.tracks.length > 0) {
455
455
  ```
456
456
  </details>
457
457
 
458
- </div>
458
+ </div>
package/dist/index.d.mts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { EventEmitter } from 'events';
2
- import internal from 'stream';
3
2
 
4
3
  /** The Audio Outputs type */
5
4
  type AudioOutputs = "mono" | "stereo" | "left" | "right";
@@ -281,9 +280,6 @@ declare const EQList: {
281
280
  Gaming: EQBand[];
282
281
  };
283
282
 
284
- /**
285
- * The FilterManager for each player
286
- */
287
283
  declare class FilterManager {
288
284
  /** The Equalizer bands currently applied to the Lavalink Server */
289
285
  equalizerBands: EQBand[];
@@ -452,7 +448,7 @@ declare class FilterManager {
452
448
  /** Sourcenames provided by lavalink server */
453
449
  type LavalinkSourceNames = "youtube" | "youtubemusic" | "soundcloud" | "bandcamp" | "twitch";
454
450
  /** Source Names provided by lava src plugin */
455
- type LavalinkPlugin_LavaSrc_SourceNames = "deezer" | "spotify" | "applemusic" | "yandexmusic" | "flowery-tts" | "vkmusic" | "tidal" | "qobuz";
451
+ type LavalinkPlugin_LavaSrc_SourceNames = "deezer" | "spotify" | "applemusic" | "yandexmusic" | "flowery-tts" | "vkmusic" | "tidal" | "qobuz" | "pandora";
456
452
  /** Source Names provided by jiosaavan plugin */
457
453
  type LavalinkPlugin_JioSaavn_SourceNames = "jiosaavn";
458
454
  /** The SourceNames provided by lavalink */
@@ -627,7 +623,7 @@ declare class DefaultQueueStore implements QueueStoreManager {
627
623
  * @param guildId The guild ID
628
624
  * @returns The queue for the guild
629
625
  */
630
- get(guildId: string): StoredQueue;
626
+ get(guildId: string): StoredQueue | undefined;
631
627
  /**
632
628
  * Set the queue for a guild
633
629
  * @param guildId The guild ID
@@ -1001,7 +997,7 @@ interface StoredQueue {
1001
997
  }
1002
998
  interface QueueStoreManager {
1003
999
  /** @async get a Value (MUST RETURN UNPARSED!) */
1004
- get: (guildId: string) => Awaitable<StoredQueue | string>;
1000
+ get: (guildId: string) => Awaitable<StoredQueue | string | undefined>;
1005
1001
  /** @async Set a value inside a guildId (MUST BE UNPARSED) */
1006
1002
  set: (guildId: string, value: StoredQueue | string) => Awaitable<void | boolean>;
1007
1003
  /** @async Delete a Database Value based of it's guildId */
@@ -1170,7 +1166,7 @@ interface LavalinkNodeOptions {
1170
1166
  /** Close on error */
1171
1167
  closeOnError?: boolean;
1172
1168
  /** Heartbeat interval , set to <= 0 to disable heartbeat system */
1173
- heartBeatInterval?: 30000;
1169
+ heartBeatInterval?: number;
1174
1170
  /** Recommended, to check wether the client is still connected or not on the stats endpoint */
1175
1171
  enablePingOnStatsCheck?: boolean;
1176
1172
  }
@@ -1265,7 +1261,7 @@ interface VersionObject {
1265
1261
  /** The minor version of this Lavalink server */
1266
1262
  minor: number;
1267
1263
  /** The patch version of this Lavalink server */
1268
- patch: internal;
1264
+ patch: number;
1269
1265
  /** The pre-release version according to semver as a . separated list of identifiers */
1270
1266
  preRelease?: string;
1271
1267
  /** The build metadata according to semver as a . separated list of identifiers */
@@ -1490,7 +1486,7 @@ type Opaque<T, K> = T & {
1490
1486
  type IntegerNumber = Opaque<number, 'Int'>;
1491
1487
  /** Opqaue tyep for floatnumber */
1492
1488
  type FloatNumber = Opaque<number, 'Float'>;
1493
- type LavaSrcSearchPlatformBase = "spsearch" | "sprec" | "amsearch" | "dzsearch" | "dzisrc" | "dzrec" | "ymsearch" | "ymrec" | "vksearch" | "vkrec" | "tdsearch" | "tdrec" | "qbsearch" | "qbisrc" | "qbrec";
1489
+ type LavaSrcSearchPlatformBase = "spsearch" | "sprec" | "amsearch" | "dzsearch" | "dzisrc" | "dzrec" | "ymsearch" | "ymrec" | "vksearch" | "vkrec" | "tdsearch" | "tdrec" | "qbsearch" | "qbisrc" | "qbrec" | "pdsearch" | "pdisrc" | "pdrec";
1494
1490
  type LavaSrcSearchPlatform = LavaSrcSearchPlatformBase | "ftts";
1495
1491
  type JioSaavnSearchPlatform = "jssearch" | "jsrec";
1496
1492
  type DuncteSearchPlatform = "speak" | "phsearch" | "pornhub" | "porn" | "tts";
@@ -1499,9 +1495,9 @@ type LavalinkClientSearchPlatformResolve = "bandcamp" | "bc";
1499
1495
  type LavalinkSearchPlatform = "ytsearch" | "ytmsearch" | "scsearch" | "bcsearch" | LavaSrcSearchPlatform | DuncteSearchPlatform | JioSaavnSearchPlatform | LavalinkClientSearchPlatform;
1500
1496
  type ClientCustomSearchPlatformUtils = "local" | "http" | "https" | "link" | "uri";
1501
1497
  type ClientSearchPlatform = ClientCustomSearchPlatformUtils | // for file/link requests
1502
- "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" | "vk" | "vk music" | "vkmusic" | "tidal" | "tidal music" | "qobuz" | "flowerytts" | "flowery" | "flowery.tts" | LavalinkClientSearchPlatformResolve | LavalinkClientSearchPlatform | "js" | "jiosaavn" | "td" | "tidal" | "tdrec";
1498
+ "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" | "vk" | "vk music" | "vkmusic" | "tidal" | "tidal music" | "qobuz" | "pandora" | "pd" | "pandora music" | "pandoramusic" | "flowerytts" | "flowery" | "flowery.tts" | LavalinkClientSearchPlatformResolve | LavalinkClientSearchPlatform | "js" | "jiosaavn" | "td" | "tidal" | "tdrec";
1503
1499
  type SearchPlatform = LavalinkSearchPlatform | ClientSearchPlatform;
1504
- 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" | "tidal" | "TwitchTv" | "vimeo";
1500
+ 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" | "tidal" | "PandoraTrackRegex" | "PandoraAlbumRegex" | "PandoraArtistRegex" | "PandoraPlaylistRegex" | "AllPandoraRegex" | "TwitchTv" | "vimeo";
1505
1501
  interface PlaylistInfo {
1506
1502
  /** The playlist name */
1507
1503
  name: string;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { EventEmitter } from 'events';
2
- import internal from 'stream';
3
2
 
4
3
  /** The Audio Outputs type */
5
4
  type AudioOutputs = "mono" | "stereo" | "left" | "right";
@@ -281,9 +280,6 @@ declare const EQList: {
281
280
  Gaming: EQBand[];
282
281
  };
283
282
 
284
- /**
285
- * The FilterManager for each player
286
- */
287
283
  declare class FilterManager {
288
284
  /** The Equalizer bands currently applied to the Lavalink Server */
289
285
  equalizerBands: EQBand[];
@@ -452,7 +448,7 @@ declare class FilterManager {
452
448
  /** Sourcenames provided by lavalink server */
453
449
  type LavalinkSourceNames = "youtube" | "youtubemusic" | "soundcloud" | "bandcamp" | "twitch";
454
450
  /** Source Names provided by lava src plugin */
455
- type LavalinkPlugin_LavaSrc_SourceNames = "deezer" | "spotify" | "applemusic" | "yandexmusic" | "flowery-tts" | "vkmusic" | "tidal" | "qobuz";
451
+ type LavalinkPlugin_LavaSrc_SourceNames = "deezer" | "spotify" | "applemusic" | "yandexmusic" | "flowery-tts" | "vkmusic" | "tidal" | "qobuz" | "pandora";
456
452
  /** Source Names provided by jiosaavan plugin */
457
453
  type LavalinkPlugin_JioSaavn_SourceNames = "jiosaavn";
458
454
  /** The SourceNames provided by lavalink */
@@ -627,7 +623,7 @@ declare class DefaultQueueStore implements QueueStoreManager {
627
623
  * @param guildId The guild ID
628
624
  * @returns The queue for the guild
629
625
  */
630
- get(guildId: string): StoredQueue;
626
+ get(guildId: string): StoredQueue | undefined;
631
627
  /**
632
628
  * Set the queue for a guild
633
629
  * @param guildId The guild ID
@@ -1001,7 +997,7 @@ interface StoredQueue {
1001
997
  }
1002
998
  interface QueueStoreManager {
1003
999
  /** @async get a Value (MUST RETURN UNPARSED!) */
1004
- get: (guildId: string) => Awaitable<StoredQueue | string>;
1000
+ get: (guildId: string) => Awaitable<StoredQueue | string | undefined>;
1005
1001
  /** @async Set a value inside a guildId (MUST BE UNPARSED) */
1006
1002
  set: (guildId: string, value: StoredQueue | string) => Awaitable<void | boolean>;
1007
1003
  /** @async Delete a Database Value based of it's guildId */
@@ -1170,7 +1166,7 @@ interface LavalinkNodeOptions {
1170
1166
  /** Close on error */
1171
1167
  closeOnError?: boolean;
1172
1168
  /** Heartbeat interval , set to <= 0 to disable heartbeat system */
1173
- heartBeatInterval?: 30000;
1169
+ heartBeatInterval?: number;
1174
1170
  /** Recommended, to check wether the client is still connected or not on the stats endpoint */
1175
1171
  enablePingOnStatsCheck?: boolean;
1176
1172
  }
@@ -1265,7 +1261,7 @@ interface VersionObject {
1265
1261
  /** The minor version of this Lavalink server */
1266
1262
  minor: number;
1267
1263
  /** The patch version of this Lavalink server */
1268
- patch: internal;
1264
+ patch: number;
1269
1265
  /** The pre-release version according to semver as a . separated list of identifiers */
1270
1266
  preRelease?: string;
1271
1267
  /** The build metadata according to semver as a . separated list of identifiers */
@@ -1490,7 +1486,7 @@ type Opaque<T, K> = T & {
1490
1486
  type IntegerNumber = Opaque<number, 'Int'>;
1491
1487
  /** Opqaue tyep for floatnumber */
1492
1488
  type FloatNumber = Opaque<number, 'Float'>;
1493
- type LavaSrcSearchPlatformBase = "spsearch" | "sprec" | "amsearch" | "dzsearch" | "dzisrc" | "dzrec" | "ymsearch" | "ymrec" | "vksearch" | "vkrec" | "tdsearch" | "tdrec" | "qbsearch" | "qbisrc" | "qbrec";
1489
+ type LavaSrcSearchPlatformBase = "spsearch" | "sprec" | "amsearch" | "dzsearch" | "dzisrc" | "dzrec" | "ymsearch" | "ymrec" | "vksearch" | "vkrec" | "tdsearch" | "tdrec" | "qbsearch" | "qbisrc" | "qbrec" | "pdsearch" | "pdisrc" | "pdrec";
1494
1490
  type LavaSrcSearchPlatform = LavaSrcSearchPlatformBase | "ftts";
1495
1491
  type JioSaavnSearchPlatform = "jssearch" | "jsrec";
1496
1492
  type DuncteSearchPlatform = "speak" | "phsearch" | "pornhub" | "porn" | "tts";
@@ -1499,9 +1495,9 @@ type LavalinkClientSearchPlatformResolve = "bandcamp" | "bc";
1499
1495
  type LavalinkSearchPlatform = "ytsearch" | "ytmsearch" | "scsearch" | "bcsearch" | LavaSrcSearchPlatform | DuncteSearchPlatform | JioSaavnSearchPlatform | LavalinkClientSearchPlatform;
1500
1496
  type ClientCustomSearchPlatformUtils = "local" | "http" | "https" | "link" | "uri";
1501
1497
  type ClientSearchPlatform = ClientCustomSearchPlatformUtils | // for file/link requests
1502
- "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" | "vk" | "vk music" | "vkmusic" | "tidal" | "tidal music" | "qobuz" | "flowerytts" | "flowery" | "flowery.tts" | LavalinkClientSearchPlatformResolve | LavalinkClientSearchPlatform | "js" | "jiosaavn" | "td" | "tidal" | "tdrec";
1498
+ "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" | "vk" | "vk music" | "vkmusic" | "tidal" | "tidal music" | "qobuz" | "pandora" | "pd" | "pandora music" | "pandoramusic" | "flowerytts" | "flowery" | "flowery.tts" | LavalinkClientSearchPlatformResolve | LavalinkClientSearchPlatform | "js" | "jiosaavn" | "td" | "tidal" | "tdrec";
1503
1499
  type SearchPlatform = LavalinkSearchPlatform | ClientSearchPlatform;
1504
- 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" | "tidal" | "TwitchTv" | "vimeo";
1500
+ 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" | "tidal" | "PandoraTrackRegex" | "PandoraAlbumRegex" | "PandoraArtistRegex" | "PandoraPlaylistRegex" | "AllPandoraRegex" | "TwitchTv" | "vimeo";
1505
1501
  interface PlaylistInfo {
1506
1502
  /** The playlist name */
1507
1503
  name: string;
package/dist/index.js CHANGED
@@ -426,6 +426,14 @@ var DefaultSources = {
426
426
  "qobuz": "qbsearch",
427
427
  "qbisrc": "qbisrc",
428
428
  "qbrec": "qbrec",
429
+ // pandora (lavasrc)
430
+ "pandora": "pdsearch",
431
+ "pd": "pdsearch",
432
+ "pdsearch": "pdsearch",
433
+ "pdisrc": "pdisrc",
434
+ "pdrec": "pdrec",
435
+ "pandora music": "pdsearch",
436
+ "pandoramusic": "pdsearch",
429
437
  // speak PLUGIN
430
438
  "speak": "speak",
431
439
  "tts": "tts",
@@ -508,6 +516,12 @@ var SourceLinksRegexes = {
508
516
  tidal: /https?:\/\/?(?:www\.)?(?:tidal|listen)\.tidal\.com\/(?<type>track|album|playlist|artist)\/(?<identifier>[a-zA-Z0-9-_]+)/,
509
517
  /** From jiosaavn-plugin */
510
518
  jiosaavn: /(https?:\/\/)(www\.)?jiosaavn\.com\/(?<type>song|album|featured|artist)\/([a-zA-Z0-9-_/,]+)/,
519
+ /** From pandora */
520
+ PandoraTrackRegex: /^@?(?:https?:\/\/)?(?:www\.)?pandora\.com\/artist\/[\w\-]+(?:\/[\w\-]+)*\/(?<identifier>TR[A-Za-z0-9]+)(?:[?#].*)?$/,
521
+ PandoraAlbumRegex: /^@?(?:https?:\/\/)?(?:www\.)?pandora\.com\/artist\/[\w\-]+(?:\/[\w\-]+)*\/(?<identifier>AL[A-Za-z0-9]+)(?:[?#].*)?$/,
522
+ PandoraArtistRegex: /^@?(?:https?:\/\/)?(?:www\.)?pandora\.com\/artist\/[\w\-]+\/(?<identifier>AR[A-Za-z0-9]+)(?:[?#].*)?$/,
523
+ PandoraPlaylistRegex: /^@?(?:https?:\/\/)?(?:www\.)?pandora\.com\/playlist\/(?<identifier>PL:[\d:]+)(?:[?#].*)?$/,
524
+ AllPandoraRegex: /^@?(?:https?:\/\/)?(?:www\.)?pandora\.com\/(?:playlist\/(?<playlistId>PL:[\d:]+)|artist\/[\w\-]+(?:\/[\w\-]+)*\/(?<identifier>(?:TR|AL|AR)[A-Za-z0-9]+))(?:[?#].*)?$/,
511
525
  /** FROM DUNCTE BOT PLUGIN */
512
526
  tiktok: /https:\/\/www\.tiktok\.com\//,
513
527
  mixcloud: /https:\/\/www\.mixcloud\.com\//,
@@ -768,6 +782,9 @@ var ManagerUtils = class {
768
782
  if (SourceLinksRegexes.tidal.test(queryString) && !node.info?.sourceManagers?.includes("tidal")) {
769
783
  throw new Error("Query / Link Provided for this Source but Lavalink Node has not 'tidal' enabled");
770
784
  }
785
+ if (SourceLinksRegexes.AllPandoraRegex.test(queryString) && !node.info?.sourceManagers?.includes("pandora")) {
786
+ throw new Error("Query / Link Provided for this Source but Lavalink Node has not 'pandora' enabled");
787
+ }
771
788
  return;
772
789
  }
773
790
  transformQuery(query) {
@@ -869,6 +886,9 @@ var ManagerUtils = class {
869
886
  if (source === "qbrec" && !node.info?.sourceManagers?.includes("qobuz")) {
870
887
  throw new Error("Lavalink Node has not 'qobuz' enabled, which is required to have 'qbrec' work");
871
888
  }
889
+ if (["pdsearch", "pdisrc", "pdrec"].includes(source) && !node.info?.sourceManagers?.includes("pandora")) {
890
+ throw new Error("Lavalink Node has not 'pandora' enabled, which is required to have '" + source + "' work");
891
+ }
872
892
  return;
873
893
  }
874
894
  };
@@ -1631,7 +1651,6 @@ var LavalinkNode = class {
1631
1651
  subscribe: async (guildId) => {
1632
1652
  if (!this.sessionId) throw new Error("the Lavalink-Node is either not ready, or not up to date!");
1633
1653
  if (!this.info.plugins.find((v) => v.name === "lavalyrics-plugin")) throw new RangeError(`there is no lavalyrics-plugin available in the lavalink node (required for lyrics): ${this.id}`);
1634
- if (!this.info.plugins.find((v) => v.name === "lavasrc-plugin") && !this.info.plugins.find((v) => v.name === "java-lyrics-plugin")) throw new RangeError(`there is no lyrics source (via lavasrc-plugin / java-lyrics-plugin) available in the lavalink node (required for lyrics): ${this.id}`);
1635
1654
  return await this.request(`/sessions/${this.sessionId}/players/${guildId}/lyrics/subscribe`, (options) => {
1636
1655
  options.method = "POST";
1637
1656
  });
@@ -1651,7 +1670,6 @@ var LavalinkNode = class {
1651
1670
  unsubscribe: async (guildId) => {
1652
1671
  if (!this.sessionId) throw new Error("the Lavalink-Node is either not ready, or not up to date!");
1653
1672
  if (!this.info.plugins.find((v) => v.name === "lavalyrics-plugin")) throw new RangeError(`there is no lavalyrics-plugin available in the lavalink node (required for lyrics): ${this.id}`);
1654
- if (!this.info.plugins.find((v) => v.name === "lavasrc-plugin") && !this.info.plugins.find((v) => v.name === "java-lyrics-plugin")) throw new RangeError(`there is no lyrics source (via lavasrc-plugin / java-lyrics-plugin) available in the lavalink node (required for lyrics): ${this.id}`);
1655
1673
  return await this.request(`/sessions/${this.sessionId}/players/${guildId}/lyrics/subscribe`, (options) => {
1656
1674
  options.method = "DELETE";
1657
1675
  });
@@ -2671,6 +2689,88 @@ var bandCampSearch = async (player, query, requestUser) => {
2671
2689
  };
2672
2690
 
2673
2691
  // src/structures/Filters.ts
2692
+ var DEFAULT_FILTER_DATAS = {
2693
+ volume: 1,
2694
+ lowPass: {
2695
+ smoothing: 0
2696
+ },
2697
+ karaoke: {
2698
+ level: 0,
2699
+ monoLevel: 0,
2700
+ filterBand: 0,
2701
+ filterWidth: 0
2702
+ },
2703
+ timescale: {
2704
+ speed: 1,
2705
+ // 0 = x
2706
+ pitch: 1,
2707
+ // 0 = x
2708
+ rate: 1
2709
+ // 0 = x
2710
+ },
2711
+ rotation: {
2712
+ rotationHz: 0
2713
+ },
2714
+ tremolo: {
2715
+ frequency: 0,
2716
+ // 0 < x
2717
+ depth: 0
2718
+ // 0 < x = 1
2719
+ },
2720
+ vibrato: {
2721
+ frequency: 0,
2722
+ // 0 < x <= 14
2723
+ depth: 0
2724
+ // 0 < x <= 1
2725
+ },
2726
+ channelMix: audioOutputsData.stereo,
2727
+ pluginFilters: {
2728
+ "lavalink-filter-plugin": {
2729
+ echo: {
2730
+ delay: 0,
2731
+ // in seconds
2732
+ decay: 0
2733
+ // 0 < 1
2734
+ },
2735
+ reverb: {
2736
+ delays: [],
2737
+ // [0.037, 0.042, 0.048, 0.053]
2738
+ gains: []
2739
+ // [0.84, 0.83, 0.82, 0.81]
2740
+ }
2741
+ },
2742
+ "high-pass": {
2743
+ // Cuts off frequencies lower than the specified {cutoffFrequency}.
2744
+ // "cutoffFrequency": 1475, // Integer, higher than zero, in Hz.
2745
+ // "boostFactor": 1.0 // Float, higher than 0.0. This alters volume output. A value of 1.0 means no volume change.
2746
+ },
2747
+ "low-pass": {
2748
+ // Cuts off frequencies higher than the specified {cutoffFrequency}.
2749
+ // "cutoffFrequency": 284, // Integer, higher than zero, in Hz.
2750
+ // "boostFactor": 1.24389 // Float, higher than 0.0. This alters volume output. A value of 1.0 means no volume change.
2751
+ },
2752
+ "normalization": {
2753
+ // Attenuates peaking where peaks are defined as having a higher value than {maxAmplitude}.
2754
+ // "maxAmplitude": 0.6327, // Float, within the range of 0.0 - 1.0. A value of 0.0 mutes the output.
2755
+ // "adaptive": true // false
2756
+ },
2757
+ "echo": {
2758
+ // Self-explanatory; provides an echo effect.
2759
+ // "echoLength": 0.5649, // Float, higher than 0.0, in seconds (1.0 = 1 second).
2760
+ // "decay": 0.4649 // Float, within the range of 0.0 - 1.0. A value of 1.0 means no decay, and a value of 0.0 means
2761
+ }
2762
+ }
2763
+ /*distortion: {
2764
+ sinOffset: 0,
2765
+ sinScale: 1,
2766
+ cosOffset: 0,
2767
+ cosScale: 1,
2768
+ tanOffset: 0,
2769
+ tanScale: 1,
2770
+ offset: 0,
2771
+ scale: 1
2772
+ }*/
2773
+ };
2674
2774
  var FilterManager = class {
2675
2775
  /** The Equalizer bands currently applied to the Lavalink Server */
2676
2776
  equalizerBands = [];
@@ -2700,87 +2800,7 @@ var FilterManager = class {
2700
2800
  audioOutput: "stereo"
2701
2801
  };
2702
2802
  /** The Filter Data sent to Lavalink, only if the filter is enabled (ofc.) */
2703
- data = {
2704
- lowPass: {
2705
- smoothing: 0
2706
- },
2707
- karaoke: {
2708
- level: 0,
2709
- monoLevel: 0,
2710
- filterBand: 0,
2711
- filterWidth: 0
2712
- },
2713
- timescale: {
2714
- speed: 1,
2715
- // 0 = x
2716
- pitch: 1,
2717
- // 0 = x
2718
- rate: 1
2719
- // 0 = x
2720
- },
2721
- rotation: {
2722
- rotationHz: 0
2723
- },
2724
- tremolo: {
2725
- frequency: 0,
2726
- // 0 < x
2727
- depth: 0
2728
- // 0 < x = 1
2729
- },
2730
- vibrato: {
2731
- frequency: 0,
2732
- // 0 < x <= 14
2733
- depth: 0
2734
- // 0 < x <= 1
2735
- },
2736
- pluginFilters: {
2737
- "lavalink-filter-plugin": {
2738
- echo: {
2739
- delay: 0,
2740
- // in seconds
2741
- decay: 0
2742
- // 0 < 1
2743
- },
2744
- reverb: {
2745
- delays: [],
2746
- // [0.037, 0.042, 0.048, 0.053]
2747
- gains: []
2748
- // [0.84, 0.83, 0.82, 0.81]
2749
- }
2750
- },
2751
- "high-pass": {
2752
- // Cuts off frequencies lower than the specified {cutoffFrequency}.
2753
- // "cutoffFrequency": 1475, // Integer, higher than zero, in Hz.
2754
- // "boostFactor": 1.0 // Float, higher than 0.0. This alters volume output. A value of 1.0 means no volume change.
2755
- },
2756
- "low-pass": {
2757
- // Cuts off frequencies higher than the specified {cutoffFrequency}.
2758
- // "cutoffFrequency": 284, // Integer, higher than zero, in Hz.
2759
- // "boostFactor": 1.24389 // Float, higher than 0.0. This alters volume output. A value of 1.0 means no volume change.
2760
- },
2761
- "normalization": {
2762
- // Attenuates peaking where peaks are defined as having a higher value than {maxAmplitude}.
2763
- // "maxAmplitude": 0.6327, // Float, within the range of 0.0 - 1.0. A value of 0.0 mutes the output.
2764
- // "adaptive": true // false
2765
- },
2766
- "echo": {
2767
- // Self-explanatory; provides an echo effect.
2768
- // "echoLength": 0.5649, // Float, higher than 0.0, in seconds (1.0 = 1 second).
2769
- // "decay": 0.4649 // Float, within the range of 0.0 - 1.0. A value of 1.0 means no decay, and a value of 0.0 means
2770
- }
2771
- },
2772
- channelMix: audioOutputsData.stereo
2773
- /*distortion: {
2774
- sinOffset: 0,
2775
- sinScale: 1,
2776
- cosOffset: 0,
2777
- cosScale: 1,
2778
- tanOffset: 0,
2779
- tanScale: 1,
2780
- offset: 0,
2781
- scale: 1
2782
- }*/
2783
- };
2803
+ data = structuredClone(DEFAULT_FILTER_DATAS);
2784
2804
  /** The Player assigned to this Filter Manager */
2785
2805
  player;
2786
2806
  /** The Constructor for the FilterManager */
@@ -2953,7 +2973,9 @@ var FilterManager = class {
2953
2973
  */
2954
2974
  async setVolume(volume) {
2955
2975
  if (volume < 0 || volume > 5) throw new SyntaxError("Volume-Filter must be between 0 and 5");
2976
+ this.data = this.data ?? {};
2956
2977
  this.data.volume = volume;
2978
+ this.filters.volume = volume !== 1;
2957
2979
  await this.applyPlayerFilters();
2958
2980
  return this.filters.volume;
2959
2981
  }
@@ -2965,6 +2987,7 @@ var FilterManager = class {
2965
2987
  async setAudioOutput(type) {
2966
2988
  if (this.player.node.info && !this.player.node.info?.filters?.includes("channelMix")) throw new Error("Node#Info#filters does not include the 'channelMix' Filter (Node has it not enable)");
2967
2989
  if (!type || !audioOutputsData[type]) throw "Invalid audio type added, must be 'mono' / 'stereo' / 'left' / 'right'";
2990
+ this.data = this.data ?? {};
2968
2991
  this.data.channelMix = audioOutputsData[type];
2969
2992
  this.filters.audioOutput = type;
2970
2993
  await this.applyPlayerFilters();
@@ -2977,14 +3000,10 @@ var FilterManager = class {
2977
3000
  */
2978
3001
  async setSpeed(speed = 1) {
2979
3002
  if (this.player.node.info && !this.player.node.info?.filters?.includes("timescale")) throw new Error("Node#Info#filters does not include the 'timescale' Filter (Node has it not enable)");
2980
- if (this.filters.nightcore || this.filters.vaporwave) {
2981
- this.data.timescale.pitch = 1;
2982
- this.data.timescale.speed = 1;
2983
- this.data.timescale.rate = 1;
2984
- this.filters.nightcore = false;
2985
- this.filters.vaporwave = false;
2986
- }
2987
- this.data.timescale.speed = speed;
3003
+ this.data = this.data ?? {};
3004
+ this.filters.nightcore = false;
3005
+ this.filters.vaporwave = false;
3006
+ this.data.timescale = { ...DEFAULT_FILTER_DATAS.timescale, speed };
2988
3007
  this.isCustomFilterActive();
2989
3008
  await this.applyPlayerFilters();
2990
3009
  return this.filters.custom;
@@ -2996,14 +3015,10 @@ var FilterManager = class {
2996
3015
  */
2997
3016
  async setPitch(pitch = 1) {
2998
3017
  if (this.player.node.info && !this.player.node.info?.filters?.includes("timescale")) throw new Error("Node#Info#filters does not include the 'timescale' Filter (Node has it not enable)");
2999
- if (this.filters.nightcore || this.filters.vaporwave) {
3000
- this.data.timescale.pitch = 1;
3001
- this.data.timescale.speed = 1;
3002
- this.data.timescale.rate = 1;
3003
- this.filters.nightcore = false;
3004
- this.filters.vaporwave = false;
3005
- }
3006
- this.data.timescale.pitch = pitch;
3018
+ this.data = this.data ?? {};
3019
+ this.filters.nightcore = false;
3020
+ this.filters.vaporwave = false;
3021
+ this.data.timescale = { ...DEFAULT_FILTER_DATAS.timescale, pitch };
3007
3022
  this.isCustomFilterActive();
3008
3023
  await this.applyPlayerFilters();
3009
3024
  return this.filters.custom;
@@ -3015,14 +3030,10 @@ var FilterManager = class {
3015
3030
  */
3016
3031
  async setRate(rate = 1) {
3017
3032
  if (this.player.node.info && !this.player.node.info?.filters?.includes("timescale")) throw new Error("Node#Info#filters does not include the 'timescale' Filter (Node has it not enable)");
3018
- if (this.filters.nightcore || this.filters.vaporwave) {
3019
- this.data.timescale.pitch = 1;
3020
- this.data.timescale.speed = 1;
3021
- this.data.timescale.rate = 1;
3022
- this.filters.nightcore = false;
3023
- this.filters.vaporwave = false;
3024
- }
3025
- this.data.timescale.rate = rate;
3033
+ this.data = this.data ?? {};
3034
+ this.filters.nightcore = false;
3035
+ this.filters.vaporwave = false;
3036
+ this.data.timescale = { ...DEFAULT_FILTER_DATAS.timescale, rate };
3026
3037
  this.isCustomFilterActive();
3027
3038
  await this.applyPlayerFilters();
3028
3039
  return this.filters.custom;
@@ -3034,7 +3045,8 @@ var FilterManager = class {
3034
3045
  */
3035
3046
  async toggleRotation(rotationHz = 0.2) {
3036
3047
  if (this.player.node.info && !this.player.node.info?.filters?.includes("rotation")) throw new Error("Node#Info#filters does not include the 'rotation' Filter (Node has it not enable)");
3037
- this.data.rotation.rotationHz = this.filters.rotation ? 0 : rotationHz;
3048
+ this.data = this.data ?? {};
3049
+ this.data.rotation = this.filters.rotation ? DEFAULT_FILTER_DATAS.rotation : { rotationHz };
3038
3050
  this.filters.rotation = !this.filters.rotation;
3039
3051
  await this.applyPlayerFilters();
3040
3052
  return this.filters.rotation;
@@ -3047,8 +3059,8 @@ var FilterManager = class {
3047
3059
  */
3048
3060
  async toggleVibrato(frequency = 10, depth = 1) {
3049
3061
  if (this.player.node.info && !this.player.node.info?.filters?.includes("vibrato")) throw new Error("Node#Info#filters does not include the 'vibrato' Filter (Node has it not enable)");
3050
- this.data.vibrato.frequency = this.filters.vibrato ? 0 : frequency;
3051
- this.data.vibrato.depth = this.filters.vibrato ? 0 : depth;
3062
+ this.data = this.data ?? {};
3063
+ this.data.vibrato = this.filters.vibrato ? DEFAULT_FILTER_DATAS.vibrato : { depth, frequency };
3052
3064
  this.filters.vibrato = !this.filters.vibrato;
3053
3065
  await this.applyPlayerFilters();
3054
3066
  return this.filters.vibrato;
@@ -3061,8 +3073,8 @@ var FilterManager = class {
3061
3073
  */
3062
3074
  async toggleTremolo(frequency = 4, depth = 0.8) {
3063
3075
  if (this.player.node.info && !this.player.node.info?.filters?.includes("tremolo")) throw new Error("Node#Info#filters does not include the 'tremolo' Filter (Node has it not enable)");
3064
- this.data.tremolo.frequency = this.filters.tremolo ? 0 : frequency;
3065
- this.data.tremolo.depth = this.filters.tremolo ? 0 : depth;
3076
+ this.data = this.data ?? {};
3077
+ this.data.tremolo = this.filters.tremolo ? DEFAULT_FILTER_DATAS.tremolo : { depth, frequency };
3066
3078
  this.filters.tremolo = !this.filters.tremolo;
3067
3079
  await this.applyPlayerFilters();
3068
3080
  return this.filters.tremolo;
@@ -3074,7 +3086,8 @@ var FilterManager = class {
3074
3086
  */
3075
3087
  async toggleLowPass(smoothing = 20) {
3076
3088
  if (this.player.node.info && !this.player.node.info?.filters?.includes("lowPass")) throw new Error("Node#Info#filters does not include the 'lowPass' Filter (Node has it not enable)");
3077
- this.data.lowPass.smoothing = this.filters.lowPass ? 0 : smoothing;
3089
+ this.data = this.data ?? {};
3090
+ this.data.lowPass = this.filters.lowPass ? DEFAULT_FILTER_DATAS.lowPass : { smoothing };
3078
3091
  this.filters.lowPass = !this.filters.lowPass;
3079
3092
  await this.applyPlayerFilters();
3080
3093
  return this.filters.lowPass;
@@ -3089,17 +3102,10 @@ var FilterManager = class {
3089
3102
  toggleLowPass: async (boostFactor = 1, cutoffFrequency = 80) => {
3090
3103
  if (this.player.node.info && !this.player.node.info?.plugins?.find((v) => v.name === "lavadspx-plugin")) throw new Error("Node#Info#plugins does not include the lavadspx plugin");
3091
3104
  if (this.player.node.info && !this.player.node.info?.filters?.includes("low-pass")) throw new Error("Node#Info#filters does not include the 'low-pass' Filter (Node has it not enable)");
3092
- if (!this.data) this.data = {};
3093
- if (!this.data.pluginFilters) this.data.pluginFilters = {};
3094
- if (!this.data.pluginFilters["low-pass"]) this.data.pluginFilters["low-pass"] = {};
3095
- if (this.filters.lavalinkLavaDspxPlugin.lowPass) {
3096
- delete this.data.pluginFilters["low-pass"];
3097
- } else {
3098
- this.data.pluginFilters["low-pass"] = {
3099
- boostFactor,
3100
- cutoffFrequency
3101
- };
3102
- }
3105
+ this.data = this.data ?? {};
3106
+ this.data.pluginFilters = this.data.pluginFilters ?? {};
3107
+ if (this.filters.lavalinkLavaDspxPlugin.lowPass) delete this.data.pluginFilters["low-pass"];
3108
+ else this.data.pluginFilters["low-pass"] = { boostFactor, cutoffFrequency };
3103
3109
  this.filters.lavalinkLavaDspxPlugin.lowPass = !this.filters.lavalinkLavaDspxPlugin.lowPass;
3104
3110
  await this.applyPlayerFilters();
3105
3111
  return this.filters.lavalinkLavaDspxPlugin.lowPass;
@@ -3113,17 +3119,10 @@ var FilterManager = class {
3113
3119
  toggleHighPass: async (boostFactor = 1, cutoffFrequency = 80) => {
3114
3120
  if (this.player.node.info && !this.player.node.info?.plugins?.find((v) => v.name === "lavadspx-plugin")) throw new Error("Node#Info#plugins does not include the lavadspx plugin");
3115
3121
  if (this.player.node.info && !this.player.node.info?.filters?.includes("high-pass")) throw new Error("Node#Info#filters does not include the 'high-pass' Filter (Node has it not enable)");
3116
- if (!this.data) this.data = {};
3117
- if (!this.data.pluginFilters) this.data.pluginFilters = {};
3118
- if (!this.data.pluginFilters["high-pass"]) this.data.pluginFilters["high-pass"] = {};
3119
- if (this.filters.lavalinkLavaDspxPlugin.highPass) {
3120
- delete this.data.pluginFilters["high-pass"];
3121
- } else {
3122
- this.data.pluginFilters["high-pass"] = {
3123
- boostFactor,
3124
- cutoffFrequency
3125
- };
3126
- }
3122
+ this.data = this.data ?? {};
3123
+ this.data.pluginFilters = this.data.pluginFilters ?? {};
3124
+ if (this.filters.lavalinkLavaDspxPlugin.highPass) delete this.data.pluginFilters["high-pass"];
3125
+ else this.data.pluginFilters["high-pass"] = { boostFactor, cutoffFrequency };
3127
3126
  this.filters.lavalinkLavaDspxPlugin.highPass = !this.filters.lavalinkLavaDspxPlugin.highPass;
3128
3127
  await this.applyPlayerFilters();
3129
3128
  return this.filters.lavalinkLavaDspxPlugin.highPass;
@@ -3137,17 +3136,10 @@ var FilterManager = class {
3137
3136
  toggleNormalization: async (maxAmplitude = 0.75, adaptive = true) => {
3138
3137
  if (this.player.node.info && !this.player.node.info?.plugins?.find((v) => v.name === "lavadspx-plugin")) throw new Error("Node#Info#plugins does not include the lavadspx plugin");
3139
3138
  if (this.player.node.info && !this.player.node.info?.filters?.includes("normalization")) throw new Error("Node#Info#filters does not include the 'normalization' Filter (Node has it not enable)");
3140
- if (!this.data) this.data = {};
3141
- if (!this.data.pluginFilters) this.data.pluginFilters = {};
3142
- if (!this.data.pluginFilters.normalization) this.data.pluginFilters.normalization = {};
3143
- if (this.filters.lavalinkLavaDspxPlugin.normalization) {
3144
- delete this.data.pluginFilters.normalization;
3145
- } else {
3146
- this.data.pluginFilters.normalization = {
3147
- adaptive,
3148
- maxAmplitude
3149
- };
3150
- }
3139
+ this.data = this.data ?? {};
3140
+ this.data.pluginFilters = this.data.pluginFilters ?? {};
3141
+ if (this.filters.lavalinkLavaDspxPlugin.normalization) delete this.data.pluginFilters.normalization;
3142
+ else this.data.pluginFilters.normalization = { adaptive, maxAmplitude };
3151
3143
  this.filters.lavalinkLavaDspxPlugin.normalization = !this.filters.lavalinkLavaDspxPlugin.normalization;
3152
3144
  await this.applyPlayerFilters();
3153
3145
  return this.filters.lavalinkLavaDspxPlugin.normalization;
@@ -3161,17 +3153,10 @@ var FilterManager = class {
3161
3153
  toggleEcho: async (decay = 0.5, echoLength = 0.5) => {
3162
3154
  if (this.player.node.info && !this.player.node.info?.plugins?.find((v) => v.name === "lavadspx-plugin")) throw new Error("Node#Info#plugins does not include the lavadspx plugin");
3163
3155
  if (this.player.node.info && !this.player.node.info?.filters?.includes("echo")) throw new Error("Node#Info#filters does not include the 'echo' Filter (Node has it not enable)");
3164
- if (!this.data) this.data = {};
3165
- if (!this.data.pluginFilters) this.data.pluginFilters = {};
3166
- if (!this.data.pluginFilters.echo) this.data.pluginFilters.echo = {};
3167
- if (this.filters.lavalinkLavaDspxPlugin.echo) {
3168
- delete this.data.pluginFilters.echo;
3169
- } else {
3170
- this.data.pluginFilters.echo = {
3171
- decay,
3172
- echoLength
3173
- };
3174
- }
3156
+ this.data = this.data ?? {};
3157
+ this.data.pluginFilters = this.data.pluginFilters ?? {};
3158
+ if (this.filters.lavalinkLavaDspxPlugin.echo) delete this.data.pluginFilters.echo;
3159
+ else this.data.pluginFilters.echo = { decay, echoLength };
3175
3160
  this.filters.lavalinkLavaDspxPlugin.echo = !this.filters.lavalinkLavaDspxPlugin.echo;
3176
3161
  await this.applyPlayerFilters();
3177
3162
  return this.filters.lavalinkLavaDspxPlugin.echo;
@@ -3187,12 +3172,15 @@ var FilterManager = class {
3187
3172
  toggleEcho: async (delay = 4, decay = 0.8) => {
3188
3173
  if (this.player.node.info && !this.player.node.info?.plugins?.find((v) => v.name === "lavalink-filter-plugin")) throw new Error("Node#Info#plugins does not include the lavalink-filter-plugin plugin");
3189
3174
  if (this.player.node.info && !this.player.node.info?.filters?.includes("echo")) throw new Error("Node#Info#filters does not include the 'echo' Filter (Node has it not enable aka not installed!)");
3190
- if (!this.data) this.data = {};
3191
- if (!this.data.pluginFilters) this.data.pluginFilters = {};
3192
- if (!this.data.pluginFilters["lavalink-filter-plugin"]) this.data.pluginFilters["lavalink-filter-plugin"] = { echo: { decay: 0, delay: 0 }, reverb: { delays: [], gains: [] } };
3193
- if (!this.data.pluginFilters["lavalink-filter-plugin"].echo) this.data.pluginFilters["lavalink-filter-plugin"].echo = { decay: 0, delay: 0 };
3194
- this.data.pluginFilters["lavalink-filter-plugin"].echo.delay = this.filters.lavalinkFilterPlugin.echo ? 0 : delay;
3195
- this.data.pluginFilters["lavalink-filter-plugin"].echo.decay = this.filters.lavalinkFilterPlugin.echo ? 0 : decay;
3175
+ this.data = this.data ?? {};
3176
+ const { echo, reverb } = DEFAULT_FILTER_DATAS.pluginFilters["lavalink-filter-plugin"];
3177
+ this.data.pluginFilters = {
3178
+ ...this.data.pluginFilters,
3179
+ ["lavalink-filter-plugin"]: {
3180
+ reverb: this.data.pluginFilters?.["lavalink-filter-plugin"]?.reverb ?? reverb,
3181
+ echo: this.filters.lavalinkFilterPlugin.echo ? echo : { delay, decay }
3182
+ }
3183
+ };
3196
3184
  this.filters.lavalinkFilterPlugin.echo = !this.filters.lavalinkFilterPlugin.echo;
3197
3185
  await this.applyPlayerFilters();
3198
3186
  return this.filters.lavalinkFilterPlugin.echo;
@@ -3206,12 +3194,15 @@ var FilterManager = class {
3206
3194
  toggleReverb: async (delays = [0.037, 0.042, 0.048, 0.053], gains = [0.84, 0.83, 0.82, 0.81]) => {
3207
3195
  if (this.player.node.info && !this.player.node.info?.plugins?.find((v) => v.name === "lavalink-filter-plugin")) throw new Error("Node#Info#plugins does not include the lavalink-filter-plugin plugin");
3208
3196
  if (this.player.node.info && !this.player.node.info?.filters?.includes("reverb")) throw new Error("Node#Info#filters does not include the 'reverb' Filter (Node has it not enable aka not installed!)");
3209
- if (!this.data) this.data = {};
3210
- if (!this.data.pluginFilters) this.data.pluginFilters = {};
3211
- if (!this.data.pluginFilters["lavalink-filter-plugin"]) this.data.pluginFilters["lavalink-filter-plugin"] = { echo: { decay: 0, delay: 0 }, reverb: { delays: [], gains: [] } };
3212
- if (!this.data.pluginFilters["lavalink-filter-plugin"].reverb) this.data.pluginFilters["lavalink-filter-plugin"].reverb = { delays: [], gains: [] };
3213
- this.data.pluginFilters["lavalink-filter-plugin"].reverb.delays = this.filters.lavalinkFilterPlugin.reverb ? [] : delays;
3214
- this.data.pluginFilters["lavalink-filter-plugin"].reverb.gains = this.filters.lavalinkFilterPlugin.reverb ? [] : gains;
3197
+ this.data = this.data ?? {};
3198
+ const { echo, reverb } = DEFAULT_FILTER_DATAS.pluginFilters["lavalink-filter-plugin"];
3199
+ this.data.pluginFilters = {
3200
+ ...this.data.pluginFilters,
3201
+ ["lavalink-filter-plugin"]: {
3202
+ echo: this.data.pluginFilters?.["lavalink-filter-plugin"]?.echo ?? echo,
3203
+ reverb: this.filters.lavalinkFilterPlugin.reverb ? reverb : { delays, gains }
3204
+ }
3205
+ };
3215
3206
  this.filters.lavalinkFilterPlugin.reverb = !this.filters.lavalinkFilterPlugin.reverb;
3216
3207
  await this.applyPlayerFilters();
3217
3208
  return this.filters.lavalinkFilterPlugin.reverb;
@@ -3226,9 +3217,8 @@ var FilterManager = class {
3226
3217
  */
3227
3218
  async toggleNightcore(speed = 1.289999523162842, pitch = 1.289999523162842, rate = 0.9365999523162842) {
3228
3219
  if (this.player.node.info && !this.player.node.info?.filters?.includes("timescale")) throw new Error("Node#Info#filters does not include the 'timescale' Filter (Node has it not enable)");
3229
- this.data.timescale.speed = this.filters.nightcore ? 1 : speed;
3230
- this.data.timescale.pitch = this.filters.nightcore ? 1 : pitch;
3231
- this.data.timescale.rate = this.filters.nightcore ? 1 : rate;
3220
+ this.data = this.data ?? {};
3221
+ this.data.timescale = this.filters.nightcore ? DEFAULT_FILTER_DATAS.timescale : { speed, pitch, rate };
3232
3222
  this.filters.nightcore = !this.filters.nightcore;
3233
3223
  this.filters.vaporwave = false;
3234
3224
  this.filters.custom = false;
@@ -3244,9 +3234,8 @@ var FilterManager = class {
3244
3234
  */
3245
3235
  async toggleVaporwave(speed = 0.8500000238418579, pitch = 0.800000011920929, rate = 1) {
3246
3236
  if (this.player.node.info && !this.player.node.info?.filters?.includes("timescale")) throw new Error("Node#Info#filters does not include the 'timescale' Filter (Node has it not enable)");
3247
- this.data.timescale.speed = this.filters.vaporwave ? 1 : speed;
3248
- this.data.timescale.pitch = this.filters.vaporwave ? 1 : pitch;
3249
- this.data.timescale.rate = this.filters.vaporwave ? 1 : rate;
3237
+ this.data = this.data ?? {};
3238
+ this.data.timescale = this.filters.vaporwave ? DEFAULT_FILTER_DATAS.timescale : { speed, pitch, rate };
3250
3239
  this.filters.vaporwave = !this.filters.vaporwave;
3251
3240
  this.filters.nightcore = false;
3252
3241
  this.filters.custom = false;
@@ -3263,10 +3252,8 @@ var FilterManager = class {
3263
3252
  */
3264
3253
  async toggleKaraoke(level = 1, monoLevel = 1, filterBand = 220, filterWidth = 100) {
3265
3254
  if (this.player.node.info && !this.player.node.info?.filters?.includes("karaoke")) throw new Error("Node#Info#filters does not include the 'karaoke' Filter (Node has it not enable)");
3266
- this.data.karaoke.level = this.filters.karaoke ? 0 : level;
3267
- this.data.karaoke.monoLevel = this.filters.karaoke ? 0 : monoLevel;
3268
- this.data.karaoke.filterBand = this.filters.karaoke ? 0 : filterBand;
3269
- this.data.karaoke.filterWidth = this.filters.karaoke ? 0 : filterWidth;
3255
+ this.data = this.data ?? {};
3256
+ this.data.karaoke = this.filters.karaoke ? DEFAULT_FILTER_DATAS.karaoke : { level, monoLevel, filterBand, filterWidth };
3270
3257
  this.filters.karaoke = !this.filters.karaoke;
3271
3258
  await this.applyPlayerFilters();
3272
3259
  return this.filters.karaoke;
package/dist/index.mjs CHANGED
@@ -366,6 +366,14 @@ var DefaultSources = {
366
366
  "qobuz": "qbsearch",
367
367
  "qbisrc": "qbisrc",
368
368
  "qbrec": "qbrec",
369
+ // pandora (lavasrc)
370
+ "pandora": "pdsearch",
371
+ "pd": "pdsearch",
372
+ "pdsearch": "pdsearch",
373
+ "pdisrc": "pdisrc",
374
+ "pdrec": "pdrec",
375
+ "pandora music": "pdsearch",
376
+ "pandoramusic": "pdsearch",
369
377
  // speak PLUGIN
370
378
  "speak": "speak",
371
379
  "tts": "tts",
@@ -448,6 +456,12 @@ var SourceLinksRegexes = {
448
456
  tidal: /https?:\/\/?(?:www\.)?(?:tidal|listen)\.tidal\.com\/(?<type>track|album|playlist|artist)\/(?<identifier>[a-zA-Z0-9-_]+)/,
449
457
  /** From jiosaavn-plugin */
450
458
  jiosaavn: /(https?:\/\/)(www\.)?jiosaavn\.com\/(?<type>song|album|featured|artist)\/([a-zA-Z0-9-_/,]+)/,
459
+ /** From pandora */
460
+ PandoraTrackRegex: /^@?(?:https?:\/\/)?(?:www\.)?pandora\.com\/artist\/[\w\-]+(?:\/[\w\-]+)*\/(?<identifier>TR[A-Za-z0-9]+)(?:[?#].*)?$/,
461
+ PandoraAlbumRegex: /^@?(?:https?:\/\/)?(?:www\.)?pandora\.com\/artist\/[\w\-]+(?:\/[\w\-]+)*\/(?<identifier>AL[A-Za-z0-9]+)(?:[?#].*)?$/,
462
+ PandoraArtistRegex: /^@?(?:https?:\/\/)?(?:www\.)?pandora\.com\/artist\/[\w\-]+\/(?<identifier>AR[A-Za-z0-9]+)(?:[?#].*)?$/,
463
+ PandoraPlaylistRegex: /^@?(?:https?:\/\/)?(?:www\.)?pandora\.com\/playlist\/(?<identifier>PL:[\d:]+)(?:[?#].*)?$/,
464
+ AllPandoraRegex: /^@?(?:https?:\/\/)?(?:www\.)?pandora\.com\/(?:playlist\/(?<playlistId>PL:[\d:]+)|artist\/[\w\-]+(?:\/[\w\-]+)*\/(?<identifier>(?:TR|AL|AR)[A-Za-z0-9]+))(?:[?#].*)?$/,
451
465
  /** FROM DUNCTE BOT PLUGIN */
452
466
  tiktok: /https:\/\/www\.tiktok\.com\//,
453
467
  mixcloud: /https:\/\/www\.mixcloud\.com\//,
@@ -708,6 +722,9 @@ var ManagerUtils = class {
708
722
  if (SourceLinksRegexes.tidal.test(queryString) && !node.info?.sourceManagers?.includes("tidal")) {
709
723
  throw new Error("Query / Link Provided for this Source but Lavalink Node has not 'tidal' enabled");
710
724
  }
725
+ if (SourceLinksRegexes.AllPandoraRegex.test(queryString) && !node.info?.sourceManagers?.includes("pandora")) {
726
+ throw new Error("Query / Link Provided for this Source but Lavalink Node has not 'pandora' enabled");
727
+ }
711
728
  return;
712
729
  }
713
730
  transformQuery(query) {
@@ -809,6 +826,9 @@ var ManagerUtils = class {
809
826
  if (source === "qbrec" && !node.info?.sourceManagers?.includes("qobuz")) {
810
827
  throw new Error("Lavalink Node has not 'qobuz' enabled, which is required to have 'qbrec' work");
811
828
  }
829
+ if (["pdsearch", "pdisrc", "pdrec"].includes(source) && !node.info?.sourceManagers?.includes("pandora")) {
830
+ throw new Error("Lavalink Node has not 'pandora' enabled, which is required to have '" + source + "' work");
831
+ }
812
832
  return;
813
833
  }
814
834
  };
@@ -1571,7 +1591,6 @@ var LavalinkNode = class {
1571
1591
  subscribe: async (guildId) => {
1572
1592
  if (!this.sessionId) throw new Error("the Lavalink-Node is either not ready, or not up to date!");
1573
1593
  if (!this.info.plugins.find((v) => v.name === "lavalyrics-plugin")) throw new RangeError(`there is no lavalyrics-plugin available in the lavalink node (required for lyrics): ${this.id}`);
1574
- if (!this.info.plugins.find((v) => v.name === "lavasrc-plugin") && !this.info.plugins.find((v) => v.name === "java-lyrics-plugin")) throw new RangeError(`there is no lyrics source (via lavasrc-plugin / java-lyrics-plugin) available in the lavalink node (required for lyrics): ${this.id}`);
1575
1594
  return await this.request(`/sessions/${this.sessionId}/players/${guildId}/lyrics/subscribe`, (options) => {
1576
1595
  options.method = "POST";
1577
1596
  });
@@ -1591,7 +1610,6 @@ var LavalinkNode = class {
1591
1610
  unsubscribe: async (guildId) => {
1592
1611
  if (!this.sessionId) throw new Error("the Lavalink-Node is either not ready, or not up to date!");
1593
1612
  if (!this.info.plugins.find((v) => v.name === "lavalyrics-plugin")) throw new RangeError(`there is no lavalyrics-plugin available in the lavalink node (required for lyrics): ${this.id}`);
1594
- if (!this.info.plugins.find((v) => v.name === "lavasrc-plugin") && !this.info.plugins.find((v) => v.name === "java-lyrics-plugin")) throw new RangeError(`there is no lyrics source (via lavasrc-plugin / java-lyrics-plugin) available in the lavalink node (required for lyrics): ${this.id}`);
1595
1613
  return await this.request(`/sessions/${this.sessionId}/players/${guildId}/lyrics/subscribe`, (options) => {
1596
1614
  options.method = "DELETE";
1597
1615
  });
@@ -2611,6 +2629,88 @@ var bandCampSearch = async (player, query, requestUser) => {
2611
2629
  };
2612
2630
 
2613
2631
  // src/structures/Filters.ts
2632
+ var DEFAULT_FILTER_DATAS = {
2633
+ volume: 1,
2634
+ lowPass: {
2635
+ smoothing: 0
2636
+ },
2637
+ karaoke: {
2638
+ level: 0,
2639
+ monoLevel: 0,
2640
+ filterBand: 0,
2641
+ filterWidth: 0
2642
+ },
2643
+ timescale: {
2644
+ speed: 1,
2645
+ // 0 = x
2646
+ pitch: 1,
2647
+ // 0 = x
2648
+ rate: 1
2649
+ // 0 = x
2650
+ },
2651
+ rotation: {
2652
+ rotationHz: 0
2653
+ },
2654
+ tremolo: {
2655
+ frequency: 0,
2656
+ // 0 < x
2657
+ depth: 0
2658
+ // 0 < x = 1
2659
+ },
2660
+ vibrato: {
2661
+ frequency: 0,
2662
+ // 0 < x <= 14
2663
+ depth: 0
2664
+ // 0 < x <= 1
2665
+ },
2666
+ channelMix: audioOutputsData.stereo,
2667
+ pluginFilters: {
2668
+ "lavalink-filter-plugin": {
2669
+ echo: {
2670
+ delay: 0,
2671
+ // in seconds
2672
+ decay: 0
2673
+ // 0 < 1
2674
+ },
2675
+ reverb: {
2676
+ delays: [],
2677
+ // [0.037, 0.042, 0.048, 0.053]
2678
+ gains: []
2679
+ // [0.84, 0.83, 0.82, 0.81]
2680
+ }
2681
+ },
2682
+ "high-pass": {
2683
+ // Cuts off frequencies lower than the specified {cutoffFrequency}.
2684
+ // "cutoffFrequency": 1475, // Integer, higher than zero, in Hz.
2685
+ // "boostFactor": 1.0 // Float, higher than 0.0. This alters volume output. A value of 1.0 means no volume change.
2686
+ },
2687
+ "low-pass": {
2688
+ // Cuts off frequencies higher than the specified {cutoffFrequency}.
2689
+ // "cutoffFrequency": 284, // Integer, higher than zero, in Hz.
2690
+ // "boostFactor": 1.24389 // Float, higher than 0.0. This alters volume output. A value of 1.0 means no volume change.
2691
+ },
2692
+ "normalization": {
2693
+ // Attenuates peaking where peaks are defined as having a higher value than {maxAmplitude}.
2694
+ // "maxAmplitude": 0.6327, // Float, within the range of 0.0 - 1.0. A value of 0.0 mutes the output.
2695
+ // "adaptive": true // false
2696
+ },
2697
+ "echo": {
2698
+ // Self-explanatory; provides an echo effect.
2699
+ // "echoLength": 0.5649, // Float, higher than 0.0, in seconds (1.0 = 1 second).
2700
+ // "decay": 0.4649 // Float, within the range of 0.0 - 1.0. A value of 1.0 means no decay, and a value of 0.0 means
2701
+ }
2702
+ }
2703
+ /*distortion: {
2704
+ sinOffset: 0,
2705
+ sinScale: 1,
2706
+ cosOffset: 0,
2707
+ cosScale: 1,
2708
+ tanOffset: 0,
2709
+ tanScale: 1,
2710
+ offset: 0,
2711
+ scale: 1
2712
+ }*/
2713
+ };
2614
2714
  var FilterManager = class {
2615
2715
  /** The Equalizer bands currently applied to the Lavalink Server */
2616
2716
  equalizerBands = [];
@@ -2640,87 +2740,7 @@ var FilterManager = class {
2640
2740
  audioOutput: "stereo"
2641
2741
  };
2642
2742
  /** The Filter Data sent to Lavalink, only if the filter is enabled (ofc.) */
2643
- data = {
2644
- lowPass: {
2645
- smoothing: 0
2646
- },
2647
- karaoke: {
2648
- level: 0,
2649
- monoLevel: 0,
2650
- filterBand: 0,
2651
- filterWidth: 0
2652
- },
2653
- timescale: {
2654
- speed: 1,
2655
- // 0 = x
2656
- pitch: 1,
2657
- // 0 = x
2658
- rate: 1
2659
- // 0 = x
2660
- },
2661
- rotation: {
2662
- rotationHz: 0
2663
- },
2664
- tremolo: {
2665
- frequency: 0,
2666
- // 0 < x
2667
- depth: 0
2668
- // 0 < x = 1
2669
- },
2670
- vibrato: {
2671
- frequency: 0,
2672
- // 0 < x <= 14
2673
- depth: 0
2674
- // 0 < x <= 1
2675
- },
2676
- pluginFilters: {
2677
- "lavalink-filter-plugin": {
2678
- echo: {
2679
- delay: 0,
2680
- // in seconds
2681
- decay: 0
2682
- // 0 < 1
2683
- },
2684
- reverb: {
2685
- delays: [],
2686
- // [0.037, 0.042, 0.048, 0.053]
2687
- gains: []
2688
- // [0.84, 0.83, 0.82, 0.81]
2689
- }
2690
- },
2691
- "high-pass": {
2692
- // Cuts off frequencies lower than the specified {cutoffFrequency}.
2693
- // "cutoffFrequency": 1475, // Integer, higher than zero, in Hz.
2694
- // "boostFactor": 1.0 // Float, higher than 0.0. This alters volume output. A value of 1.0 means no volume change.
2695
- },
2696
- "low-pass": {
2697
- // Cuts off frequencies higher than the specified {cutoffFrequency}.
2698
- // "cutoffFrequency": 284, // Integer, higher than zero, in Hz.
2699
- // "boostFactor": 1.24389 // Float, higher than 0.0. This alters volume output. A value of 1.0 means no volume change.
2700
- },
2701
- "normalization": {
2702
- // Attenuates peaking where peaks are defined as having a higher value than {maxAmplitude}.
2703
- // "maxAmplitude": 0.6327, // Float, within the range of 0.0 - 1.0. A value of 0.0 mutes the output.
2704
- // "adaptive": true // false
2705
- },
2706
- "echo": {
2707
- // Self-explanatory; provides an echo effect.
2708
- // "echoLength": 0.5649, // Float, higher than 0.0, in seconds (1.0 = 1 second).
2709
- // "decay": 0.4649 // Float, within the range of 0.0 - 1.0. A value of 1.0 means no decay, and a value of 0.0 means
2710
- }
2711
- },
2712
- channelMix: audioOutputsData.stereo
2713
- /*distortion: {
2714
- sinOffset: 0,
2715
- sinScale: 1,
2716
- cosOffset: 0,
2717
- cosScale: 1,
2718
- tanOffset: 0,
2719
- tanScale: 1,
2720
- offset: 0,
2721
- scale: 1
2722
- }*/
2723
- };
2743
+ data = structuredClone(DEFAULT_FILTER_DATAS);
2724
2744
  /** The Player assigned to this Filter Manager */
2725
2745
  player;
2726
2746
  /** The Constructor for the FilterManager */
@@ -2893,7 +2913,9 @@ var FilterManager = class {
2893
2913
  */
2894
2914
  async setVolume(volume) {
2895
2915
  if (volume < 0 || volume > 5) throw new SyntaxError("Volume-Filter must be between 0 and 5");
2916
+ this.data = this.data ?? {};
2896
2917
  this.data.volume = volume;
2918
+ this.filters.volume = volume !== 1;
2897
2919
  await this.applyPlayerFilters();
2898
2920
  return this.filters.volume;
2899
2921
  }
@@ -2905,6 +2927,7 @@ var FilterManager = class {
2905
2927
  async setAudioOutput(type) {
2906
2928
  if (this.player.node.info && !this.player.node.info?.filters?.includes("channelMix")) throw new Error("Node#Info#filters does not include the 'channelMix' Filter (Node has it not enable)");
2907
2929
  if (!type || !audioOutputsData[type]) throw "Invalid audio type added, must be 'mono' / 'stereo' / 'left' / 'right'";
2930
+ this.data = this.data ?? {};
2908
2931
  this.data.channelMix = audioOutputsData[type];
2909
2932
  this.filters.audioOutput = type;
2910
2933
  await this.applyPlayerFilters();
@@ -2917,14 +2940,10 @@ var FilterManager = class {
2917
2940
  */
2918
2941
  async setSpeed(speed = 1) {
2919
2942
  if (this.player.node.info && !this.player.node.info?.filters?.includes("timescale")) throw new Error("Node#Info#filters does not include the 'timescale' Filter (Node has it not enable)");
2920
- if (this.filters.nightcore || this.filters.vaporwave) {
2921
- this.data.timescale.pitch = 1;
2922
- this.data.timescale.speed = 1;
2923
- this.data.timescale.rate = 1;
2924
- this.filters.nightcore = false;
2925
- this.filters.vaporwave = false;
2926
- }
2927
- this.data.timescale.speed = speed;
2943
+ this.data = this.data ?? {};
2944
+ this.filters.nightcore = false;
2945
+ this.filters.vaporwave = false;
2946
+ this.data.timescale = { ...DEFAULT_FILTER_DATAS.timescale, speed };
2928
2947
  this.isCustomFilterActive();
2929
2948
  await this.applyPlayerFilters();
2930
2949
  return this.filters.custom;
@@ -2936,14 +2955,10 @@ var FilterManager = class {
2936
2955
  */
2937
2956
  async setPitch(pitch = 1) {
2938
2957
  if (this.player.node.info && !this.player.node.info?.filters?.includes("timescale")) throw new Error("Node#Info#filters does not include the 'timescale' Filter (Node has it not enable)");
2939
- if (this.filters.nightcore || this.filters.vaporwave) {
2940
- this.data.timescale.pitch = 1;
2941
- this.data.timescale.speed = 1;
2942
- this.data.timescale.rate = 1;
2943
- this.filters.nightcore = false;
2944
- this.filters.vaporwave = false;
2945
- }
2946
- this.data.timescale.pitch = pitch;
2958
+ this.data = this.data ?? {};
2959
+ this.filters.nightcore = false;
2960
+ this.filters.vaporwave = false;
2961
+ this.data.timescale = { ...DEFAULT_FILTER_DATAS.timescale, pitch };
2947
2962
  this.isCustomFilterActive();
2948
2963
  await this.applyPlayerFilters();
2949
2964
  return this.filters.custom;
@@ -2955,14 +2970,10 @@ var FilterManager = class {
2955
2970
  */
2956
2971
  async setRate(rate = 1) {
2957
2972
  if (this.player.node.info && !this.player.node.info?.filters?.includes("timescale")) throw new Error("Node#Info#filters does not include the 'timescale' Filter (Node has it not enable)");
2958
- if (this.filters.nightcore || this.filters.vaporwave) {
2959
- this.data.timescale.pitch = 1;
2960
- this.data.timescale.speed = 1;
2961
- this.data.timescale.rate = 1;
2962
- this.filters.nightcore = false;
2963
- this.filters.vaporwave = false;
2964
- }
2965
- this.data.timescale.rate = rate;
2973
+ this.data = this.data ?? {};
2974
+ this.filters.nightcore = false;
2975
+ this.filters.vaporwave = false;
2976
+ this.data.timescale = { ...DEFAULT_FILTER_DATAS.timescale, rate };
2966
2977
  this.isCustomFilterActive();
2967
2978
  await this.applyPlayerFilters();
2968
2979
  return this.filters.custom;
@@ -2974,7 +2985,8 @@ var FilterManager = class {
2974
2985
  */
2975
2986
  async toggleRotation(rotationHz = 0.2) {
2976
2987
  if (this.player.node.info && !this.player.node.info?.filters?.includes("rotation")) throw new Error("Node#Info#filters does not include the 'rotation' Filter (Node has it not enable)");
2977
- this.data.rotation.rotationHz = this.filters.rotation ? 0 : rotationHz;
2988
+ this.data = this.data ?? {};
2989
+ this.data.rotation = this.filters.rotation ? DEFAULT_FILTER_DATAS.rotation : { rotationHz };
2978
2990
  this.filters.rotation = !this.filters.rotation;
2979
2991
  await this.applyPlayerFilters();
2980
2992
  return this.filters.rotation;
@@ -2987,8 +2999,8 @@ var FilterManager = class {
2987
2999
  */
2988
3000
  async toggleVibrato(frequency = 10, depth = 1) {
2989
3001
  if (this.player.node.info && !this.player.node.info?.filters?.includes("vibrato")) throw new Error("Node#Info#filters does not include the 'vibrato' Filter (Node has it not enable)");
2990
- this.data.vibrato.frequency = this.filters.vibrato ? 0 : frequency;
2991
- this.data.vibrato.depth = this.filters.vibrato ? 0 : depth;
3002
+ this.data = this.data ?? {};
3003
+ this.data.vibrato = this.filters.vibrato ? DEFAULT_FILTER_DATAS.vibrato : { depth, frequency };
2992
3004
  this.filters.vibrato = !this.filters.vibrato;
2993
3005
  await this.applyPlayerFilters();
2994
3006
  return this.filters.vibrato;
@@ -3001,8 +3013,8 @@ var FilterManager = class {
3001
3013
  */
3002
3014
  async toggleTremolo(frequency = 4, depth = 0.8) {
3003
3015
  if (this.player.node.info && !this.player.node.info?.filters?.includes("tremolo")) throw new Error("Node#Info#filters does not include the 'tremolo' Filter (Node has it not enable)");
3004
- this.data.tremolo.frequency = this.filters.tremolo ? 0 : frequency;
3005
- this.data.tremolo.depth = this.filters.tremolo ? 0 : depth;
3016
+ this.data = this.data ?? {};
3017
+ this.data.tremolo = this.filters.tremolo ? DEFAULT_FILTER_DATAS.tremolo : { depth, frequency };
3006
3018
  this.filters.tremolo = !this.filters.tremolo;
3007
3019
  await this.applyPlayerFilters();
3008
3020
  return this.filters.tremolo;
@@ -3014,7 +3026,8 @@ var FilterManager = class {
3014
3026
  */
3015
3027
  async toggleLowPass(smoothing = 20) {
3016
3028
  if (this.player.node.info && !this.player.node.info?.filters?.includes("lowPass")) throw new Error("Node#Info#filters does not include the 'lowPass' Filter (Node has it not enable)");
3017
- this.data.lowPass.smoothing = this.filters.lowPass ? 0 : smoothing;
3029
+ this.data = this.data ?? {};
3030
+ this.data.lowPass = this.filters.lowPass ? DEFAULT_FILTER_DATAS.lowPass : { smoothing };
3018
3031
  this.filters.lowPass = !this.filters.lowPass;
3019
3032
  await this.applyPlayerFilters();
3020
3033
  return this.filters.lowPass;
@@ -3029,17 +3042,10 @@ var FilterManager = class {
3029
3042
  toggleLowPass: async (boostFactor = 1, cutoffFrequency = 80) => {
3030
3043
  if (this.player.node.info && !this.player.node.info?.plugins?.find((v) => v.name === "lavadspx-plugin")) throw new Error("Node#Info#plugins does not include the lavadspx plugin");
3031
3044
  if (this.player.node.info && !this.player.node.info?.filters?.includes("low-pass")) throw new Error("Node#Info#filters does not include the 'low-pass' Filter (Node has it not enable)");
3032
- if (!this.data) this.data = {};
3033
- if (!this.data.pluginFilters) this.data.pluginFilters = {};
3034
- if (!this.data.pluginFilters["low-pass"]) this.data.pluginFilters["low-pass"] = {};
3035
- if (this.filters.lavalinkLavaDspxPlugin.lowPass) {
3036
- delete this.data.pluginFilters["low-pass"];
3037
- } else {
3038
- this.data.pluginFilters["low-pass"] = {
3039
- boostFactor,
3040
- cutoffFrequency
3041
- };
3042
- }
3045
+ this.data = this.data ?? {};
3046
+ this.data.pluginFilters = this.data.pluginFilters ?? {};
3047
+ if (this.filters.lavalinkLavaDspxPlugin.lowPass) delete this.data.pluginFilters["low-pass"];
3048
+ else this.data.pluginFilters["low-pass"] = { boostFactor, cutoffFrequency };
3043
3049
  this.filters.lavalinkLavaDspxPlugin.lowPass = !this.filters.lavalinkLavaDspxPlugin.lowPass;
3044
3050
  await this.applyPlayerFilters();
3045
3051
  return this.filters.lavalinkLavaDspxPlugin.lowPass;
@@ -3053,17 +3059,10 @@ var FilterManager = class {
3053
3059
  toggleHighPass: async (boostFactor = 1, cutoffFrequency = 80) => {
3054
3060
  if (this.player.node.info && !this.player.node.info?.plugins?.find((v) => v.name === "lavadspx-plugin")) throw new Error("Node#Info#plugins does not include the lavadspx plugin");
3055
3061
  if (this.player.node.info && !this.player.node.info?.filters?.includes("high-pass")) throw new Error("Node#Info#filters does not include the 'high-pass' Filter (Node has it not enable)");
3056
- if (!this.data) this.data = {};
3057
- if (!this.data.pluginFilters) this.data.pluginFilters = {};
3058
- if (!this.data.pluginFilters["high-pass"]) this.data.pluginFilters["high-pass"] = {};
3059
- if (this.filters.lavalinkLavaDspxPlugin.highPass) {
3060
- delete this.data.pluginFilters["high-pass"];
3061
- } else {
3062
- this.data.pluginFilters["high-pass"] = {
3063
- boostFactor,
3064
- cutoffFrequency
3065
- };
3066
- }
3062
+ this.data = this.data ?? {};
3063
+ this.data.pluginFilters = this.data.pluginFilters ?? {};
3064
+ if (this.filters.lavalinkLavaDspxPlugin.highPass) delete this.data.pluginFilters["high-pass"];
3065
+ else this.data.pluginFilters["high-pass"] = { boostFactor, cutoffFrequency };
3067
3066
  this.filters.lavalinkLavaDspxPlugin.highPass = !this.filters.lavalinkLavaDspxPlugin.highPass;
3068
3067
  await this.applyPlayerFilters();
3069
3068
  return this.filters.lavalinkLavaDspxPlugin.highPass;
@@ -3077,17 +3076,10 @@ var FilterManager = class {
3077
3076
  toggleNormalization: async (maxAmplitude = 0.75, adaptive = true) => {
3078
3077
  if (this.player.node.info && !this.player.node.info?.plugins?.find((v) => v.name === "lavadspx-plugin")) throw new Error("Node#Info#plugins does not include the lavadspx plugin");
3079
3078
  if (this.player.node.info && !this.player.node.info?.filters?.includes("normalization")) throw new Error("Node#Info#filters does not include the 'normalization' Filter (Node has it not enable)");
3080
- if (!this.data) this.data = {};
3081
- if (!this.data.pluginFilters) this.data.pluginFilters = {};
3082
- if (!this.data.pluginFilters.normalization) this.data.pluginFilters.normalization = {};
3083
- if (this.filters.lavalinkLavaDspxPlugin.normalization) {
3084
- delete this.data.pluginFilters.normalization;
3085
- } else {
3086
- this.data.pluginFilters.normalization = {
3087
- adaptive,
3088
- maxAmplitude
3089
- };
3090
- }
3079
+ this.data = this.data ?? {};
3080
+ this.data.pluginFilters = this.data.pluginFilters ?? {};
3081
+ if (this.filters.lavalinkLavaDspxPlugin.normalization) delete this.data.pluginFilters.normalization;
3082
+ else this.data.pluginFilters.normalization = { adaptive, maxAmplitude };
3091
3083
  this.filters.lavalinkLavaDspxPlugin.normalization = !this.filters.lavalinkLavaDspxPlugin.normalization;
3092
3084
  await this.applyPlayerFilters();
3093
3085
  return this.filters.lavalinkLavaDspxPlugin.normalization;
@@ -3101,17 +3093,10 @@ var FilterManager = class {
3101
3093
  toggleEcho: async (decay = 0.5, echoLength = 0.5) => {
3102
3094
  if (this.player.node.info && !this.player.node.info?.plugins?.find((v) => v.name === "lavadspx-plugin")) throw new Error("Node#Info#plugins does not include the lavadspx plugin");
3103
3095
  if (this.player.node.info && !this.player.node.info?.filters?.includes("echo")) throw new Error("Node#Info#filters does not include the 'echo' Filter (Node has it not enable)");
3104
- if (!this.data) this.data = {};
3105
- if (!this.data.pluginFilters) this.data.pluginFilters = {};
3106
- if (!this.data.pluginFilters.echo) this.data.pluginFilters.echo = {};
3107
- if (this.filters.lavalinkLavaDspxPlugin.echo) {
3108
- delete this.data.pluginFilters.echo;
3109
- } else {
3110
- this.data.pluginFilters.echo = {
3111
- decay,
3112
- echoLength
3113
- };
3114
- }
3096
+ this.data = this.data ?? {};
3097
+ this.data.pluginFilters = this.data.pluginFilters ?? {};
3098
+ if (this.filters.lavalinkLavaDspxPlugin.echo) delete this.data.pluginFilters.echo;
3099
+ else this.data.pluginFilters.echo = { decay, echoLength };
3115
3100
  this.filters.lavalinkLavaDspxPlugin.echo = !this.filters.lavalinkLavaDspxPlugin.echo;
3116
3101
  await this.applyPlayerFilters();
3117
3102
  return this.filters.lavalinkLavaDspxPlugin.echo;
@@ -3127,12 +3112,15 @@ var FilterManager = class {
3127
3112
  toggleEcho: async (delay = 4, decay = 0.8) => {
3128
3113
  if (this.player.node.info && !this.player.node.info?.plugins?.find((v) => v.name === "lavalink-filter-plugin")) throw new Error("Node#Info#plugins does not include the lavalink-filter-plugin plugin");
3129
3114
  if (this.player.node.info && !this.player.node.info?.filters?.includes("echo")) throw new Error("Node#Info#filters does not include the 'echo' Filter (Node has it not enable aka not installed!)");
3130
- if (!this.data) this.data = {};
3131
- if (!this.data.pluginFilters) this.data.pluginFilters = {};
3132
- if (!this.data.pluginFilters["lavalink-filter-plugin"]) this.data.pluginFilters["lavalink-filter-plugin"] = { echo: { decay: 0, delay: 0 }, reverb: { delays: [], gains: [] } };
3133
- if (!this.data.pluginFilters["lavalink-filter-plugin"].echo) this.data.pluginFilters["lavalink-filter-plugin"].echo = { decay: 0, delay: 0 };
3134
- this.data.pluginFilters["lavalink-filter-plugin"].echo.delay = this.filters.lavalinkFilterPlugin.echo ? 0 : delay;
3135
- this.data.pluginFilters["lavalink-filter-plugin"].echo.decay = this.filters.lavalinkFilterPlugin.echo ? 0 : decay;
3115
+ this.data = this.data ?? {};
3116
+ const { echo, reverb } = DEFAULT_FILTER_DATAS.pluginFilters["lavalink-filter-plugin"];
3117
+ this.data.pluginFilters = {
3118
+ ...this.data.pluginFilters,
3119
+ ["lavalink-filter-plugin"]: {
3120
+ reverb: this.data.pluginFilters?.["lavalink-filter-plugin"]?.reverb ?? reverb,
3121
+ echo: this.filters.lavalinkFilterPlugin.echo ? echo : { delay, decay }
3122
+ }
3123
+ };
3136
3124
  this.filters.lavalinkFilterPlugin.echo = !this.filters.lavalinkFilterPlugin.echo;
3137
3125
  await this.applyPlayerFilters();
3138
3126
  return this.filters.lavalinkFilterPlugin.echo;
@@ -3146,12 +3134,15 @@ var FilterManager = class {
3146
3134
  toggleReverb: async (delays = [0.037, 0.042, 0.048, 0.053], gains = [0.84, 0.83, 0.82, 0.81]) => {
3147
3135
  if (this.player.node.info && !this.player.node.info?.plugins?.find((v) => v.name === "lavalink-filter-plugin")) throw new Error("Node#Info#plugins does not include the lavalink-filter-plugin plugin");
3148
3136
  if (this.player.node.info && !this.player.node.info?.filters?.includes("reverb")) throw new Error("Node#Info#filters does not include the 'reverb' Filter (Node has it not enable aka not installed!)");
3149
- if (!this.data) this.data = {};
3150
- if (!this.data.pluginFilters) this.data.pluginFilters = {};
3151
- if (!this.data.pluginFilters["lavalink-filter-plugin"]) this.data.pluginFilters["lavalink-filter-plugin"] = { echo: { decay: 0, delay: 0 }, reverb: { delays: [], gains: [] } };
3152
- if (!this.data.pluginFilters["lavalink-filter-plugin"].reverb) this.data.pluginFilters["lavalink-filter-plugin"].reverb = { delays: [], gains: [] };
3153
- this.data.pluginFilters["lavalink-filter-plugin"].reverb.delays = this.filters.lavalinkFilterPlugin.reverb ? [] : delays;
3154
- this.data.pluginFilters["lavalink-filter-plugin"].reverb.gains = this.filters.lavalinkFilterPlugin.reverb ? [] : gains;
3137
+ this.data = this.data ?? {};
3138
+ const { echo, reverb } = DEFAULT_FILTER_DATAS.pluginFilters["lavalink-filter-plugin"];
3139
+ this.data.pluginFilters = {
3140
+ ...this.data.pluginFilters,
3141
+ ["lavalink-filter-plugin"]: {
3142
+ echo: this.data.pluginFilters?.["lavalink-filter-plugin"]?.echo ?? echo,
3143
+ reverb: this.filters.lavalinkFilterPlugin.reverb ? reverb : { delays, gains }
3144
+ }
3145
+ };
3155
3146
  this.filters.lavalinkFilterPlugin.reverb = !this.filters.lavalinkFilterPlugin.reverb;
3156
3147
  await this.applyPlayerFilters();
3157
3148
  return this.filters.lavalinkFilterPlugin.reverb;
@@ -3166,9 +3157,8 @@ var FilterManager = class {
3166
3157
  */
3167
3158
  async toggleNightcore(speed = 1.289999523162842, pitch = 1.289999523162842, rate = 0.9365999523162842) {
3168
3159
  if (this.player.node.info && !this.player.node.info?.filters?.includes("timescale")) throw new Error("Node#Info#filters does not include the 'timescale' Filter (Node has it not enable)");
3169
- this.data.timescale.speed = this.filters.nightcore ? 1 : speed;
3170
- this.data.timescale.pitch = this.filters.nightcore ? 1 : pitch;
3171
- this.data.timescale.rate = this.filters.nightcore ? 1 : rate;
3160
+ this.data = this.data ?? {};
3161
+ this.data.timescale = this.filters.nightcore ? DEFAULT_FILTER_DATAS.timescale : { speed, pitch, rate };
3172
3162
  this.filters.nightcore = !this.filters.nightcore;
3173
3163
  this.filters.vaporwave = false;
3174
3164
  this.filters.custom = false;
@@ -3184,9 +3174,8 @@ var FilterManager = class {
3184
3174
  */
3185
3175
  async toggleVaporwave(speed = 0.8500000238418579, pitch = 0.800000011920929, rate = 1) {
3186
3176
  if (this.player.node.info && !this.player.node.info?.filters?.includes("timescale")) throw new Error("Node#Info#filters does not include the 'timescale' Filter (Node has it not enable)");
3187
- this.data.timescale.speed = this.filters.vaporwave ? 1 : speed;
3188
- this.data.timescale.pitch = this.filters.vaporwave ? 1 : pitch;
3189
- this.data.timescale.rate = this.filters.vaporwave ? 1 : rate;
3177
+ this.data = this.data ?? {};
3178
+ this.data.timescale = this.filters.vaporwave ? DEFAULT_FILTER_DATAS.timescale : { speed, pitch, rate };
3190
3179
  this.filters.vaporwave = !this.filters.vaporwave;
3191
3180
  this.filters.nightcore = false;
3192
3181
  this.filters.custom = false;
@@ -3203,10 +3192,8 @@ var FilterManager = class {
3203
3192
  */
3204
3193
  async toggleKaraoke(level = 1, monoLevel = 1, filterBand = 220, filterWidth = 100) {
3205
3194
  if (this.player.node.info && !this.player.node.info?.filters?.includes("karaoke")) throw new Error("Node#Info#filters does not include the 'karaoke' Filter (Node has it not enable)");
3206
- this.data.karaoke.level = this.filters.karaoke ? 0 : level;
3207
- this.data.karaoke.monoLevel = this.filters.karaoke ? 0 : monoLevel;
3208
- this.data.karaoke.filterBand = this.filters.karaoke ? 0 : filterBand;
3209
- this.data.karaoke.filterWidth = this.filters.karaoke ? 0 : filterWidth;
3195
+ this.data = this.data ?? {};
3196
+ this.data.karaoke = this.filters.karaoke ? DEFAULT_FILTER_DATAS.karaoke : { level, monoLevel, filterBand, filterWidth };
3210
3197
  this.filters.karaoke = !this.filters.karaoke;
3211
3198
  await this.applyPlayerFilters();
3212
3199
  return this.filters.karaoke;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lavalink-client",
3
- "version": "2.6.1",
3
+ "version": "2.6.3",
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",
@@ -48,7 +48,7 @@
48
48
  "name": "Tomato6966",
49
49
  "url": "https://github.com/tomato6966/"
50
50
  },
51
- "contributers": [],
51
+ "contributors": [],
52
52
  "license": "MIT",
53
53
  "bugs": {
54
54
  "url": "https://github.com/tomato6966/lavalink-client/issues"
@@ -63,7 +63,7 @@
63
63
  "@typescript-eslint/parser": "^8.36.0",
64
64
  "eslint": "^9.30.1",
65
65
  "tsup": "^8.5.0",
66
- "typescript": "^5.8.3"
66
+ "typescript": "^5.9.3"
67
67
  },
68
68
  "dependencies": {
69
69
  "tslib": "^2.8.1",