lavalink-client 2.3.4 → 2.3.6

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 (65) hide show
  1. package/README.md +225 -2
  2. package/dist/cjs/index.d.ts +16 -16
  3. package/dist/cjs/index.js +16 -16
  4. package/dist/cjs/structures/Constants.d.ts +2 -1
  5. package/dist/cjs/structures/Constants.js +1 -0
  6. package/dist/cjs/structures/CustomSearches/BandCampSearch.d.ts +2 -2
  7. package/dist/cjs/structures/Filters.d.ts +2 -2
  8. package/dist/cjs/structures/Filters.js +1 -1
  9. package/dist/cjs/structures/LavalinkManager.d.ts +6 -6
  10. package/dist/cjs/structures/LavalinkManager.js +5 -5
  11. package/dist/cjs/structures/LavalinkManagerStatics.d.ts +3 -1
  12. package/dist/cjs/structures/LavalinkManagerStatics.js +11 -2
  13. package/dist/cjs/structures/Node.d.ts +86 -6
  14. package/dist/cjs/structures/Node.js +147 -3
  15. package/dist/cjs/structures/NodeManager.d.ts +4 -4
  16. package/dist/cjs/structures/NodeManager.js +3 -3
  17. package/dist/cjs/structures/Player.d.ts +53 -10
  18. package/dist/cjs/structures/Player.js +55 -5
  19. package/dist/cjs/structures/Queue.d.ts +3 -3
  20. package/dist/cjs/structures/Queue.js +1 -1
  21. package/dist/cjs/structures/Types/Filters.d.ts +1 -1
  22. package/dist/cjs/structures/Types/Manager.d.ts +25 -7
  23. package/dist/cjs/structures/Types/Node.d.ts +26 -3
  24. package/dist/cjs/structures/Types/Player.d.ts +5 -5
  25. package/dist/cjs/structures/Types/Queue.d.ts +1 -1
  26. package/dist/cjs/structures/Types/Track.d.ts +3 -3
  27. package/dist/cjs/structures/Types/Utils.d.ts +68 -10
  28. package/dist/cjs/structures/Utils.d.ts +6 -6
  29. package/dist/cjs/structures/Utils.js +11 -2
  30. package/dist/esm/index.d.ts +16 -16
  31. package/dist/esm/index.js +16 -16
  32. package/dist/esm/structures/Constants.d.ts +2 -1
  33. package/dist/esm/structures/Constants.js +1 -0
  34. package/dist/esm/structures/CustomSearches/BandCampSearch.d.ts +2 -2
  35. package/dist/esm/structures/Filters.d.ts +2 -2
  36. package/dist/esm/structures/Filters.js +1 -1
  37. package/dist/esm/structures/LavalinkManager.d.ts +6 -6
  38. package/dist/esm/structures/LavalinkManager.js +5 -5
  39. package/dist/esm/structures/LavalinkManagerStatics.d.ts +3 -1
  40. package/dist/esm/structures/LavalinkManagerStatics.js +11 -2
  41. package/dist/esm/structures/Node.d.ts +86 -6
  42. package/dist/esm/structures/Node.js +147 -3
  43. package/dist/esm/structures/NodeManager.d.ts +4 -4
  44. package/dist/esm/structures/NodeManager.js +3 -3
  45. package/dist/esm/structures/Player.d.ts +53 -10
  46. package/dist/esm/structures/Player.js +55 -5
  47. package/dist/esm/structures/Queue.d.ts +3 -3
  48. package/dist/esm/structures/Queue.js +1 -1
  49. package/dist/esm/structures/Types/Filters.d.ts +1 -1
  50. package/dist/esm/structures/Types/Manager.d.ts +25 -7
  51. package/dist/esm/structures/Types/Node.d.ts +26 -3
  52. package/dist/esm/structures/Types/Player.d.ts +5 -5
  53. package/dist/esm/structures/Types/Queue.d.ts +1 -1
  54. package/dist/esm/structures/Types/Track.d.ts +3 -3
  55. package/dist/esm/structures/Types/Utils.d.ts +68 -10
  56. package/dist/esm/structures/Utils.d.ts +6 -6
  57. package/dist/esm/structures/Utils.js +11 -2
  58. package/dist/types/structures/Constants.d.ts +1 -0
  59. package/dist/types/structures/LavalinkManagerStatics.d.ts +2 -0
  60. package/dist/types/structures/Node.d.ts +81 -1
  61. package/dist/types/structures/Player.d.ts +43 -0
  62. package/dist/types/structures/Types/Manager.d.ts +19 -1
  63. package/dist/types/structures/Types/Node.d.ts +23 -0
  64. package/dist/types/structures/Types/Utils.d.ts +64 -6
  65. package/package.json +1 -1
@@ -1,11 +1,12 @@
1
- import { FilterManager } from "./Filters";
2
- import { Queue } from "./Queue";
3
- import type { DestroyReasons } from "./Constants";
4
- import type { LavalinkNode } from "./Node";
5
- import type { SponsorBlockSegment } from "./Types/Node";
6
- import type { PlayerJson, PlayerOptions, PlayOptions, RepeatMode } from "./Types/Player";
7
- import type { LavalinkManager } from "./LavalinkManager";
8
- import type { LavalinkPlayerVoiceOptions, LavaSearchQuery, SearchQuery } from "./Types/Utils";
1
+ import { FilterManager } from "./Filters.js";
2
+ import { Queue } from "./Queue.js";
3
+ import type { DestroyReasons } from "./Constants.js";
4
+ import type { Track } from "./Types/Track.js";
5
+ import type { LavalinkNode } from "./Node.js";
6
+ import type { SponsorBlockSegment } from "./Types/Node.js";
7
+ import type { PlayerJson, PlayerOptions, PlayOptions, RepeatMode } from "./Types/Player.js";
8
+ import type { LavalinkManager } from "./LavalinkManager.js";
9
+ import type { LavalinkPlayerVoiceOptions, LavaSearchQuery, SearchQuery } from "./Types/Utils.js";
9
10
  export declare class Player {
10
11
  /** Filter Manager per player */
11
12
  filterManager: FilterManager;
@@ -96,7 +97,7 @@ export declare class Player {
96
97
  * @param throwOnEmpty If an error should be thrown if no track is found
97
98
  * @returns The search result
98
99
  */
99
- lavaSearch(query: LavaSearchQuery, requestUser: unknown, throwOnEmpty?: boolean): Promise<import("./Types/Utils").SearchResult | import("./Types/Utils").LavaSearchResponse>;
100
+ lavaSearch(query: LavaSearchQuery, requestUser: unknown, throwOnEmpty?: boolean): Promise<import("./Types/Utils.js").SearchResult | import("./Types/Utils.js").LavaSearchResponse>;
100
101
  /**
101
102
  * Set the SponsorBlock
102
103
  * @param segments The segments to set
@@ -115,7 +116,7 @@ export declare class Player {
115
116
  * @param query Query for your data
116
117
  * @param requestUser
117
118
  */
118
- search(query: SearchQuery, requestUser: unknown, throwOnEmpty?: boolean): Promise<import("./Types/Utils").UnresolvedSearchResult | import("./Types/Utils").SearchResult>;
119
+ search(query: SearchQuery, requestUser: unknown, throwOnEmpty?: boolean): Promise<import("./Types/Utils.js").UnresolvedSearchResult | import("./Types/Utils.js").SearchResult>;
119
120
  /**
120
121
  * Pause the player
121
122
  */
@@ -164,6 +165,48 @@ export declare class Player {
164
165
  * Destroy the player and disconnect from the voice channel
165
166
  */
166
167
  destroy(reason?: DestroyReasons | string, disconnect?: boolean): Promise<this>;
168
+ /**
169
+ * Get the current lyrics of the track currently playing on the guild
170
+ * @param guildId The guild id to get the current lyrics for
171
+ * @param skipTrackSource If true, it will not try to get the lyrics from the track source
172
+ * @returns The current lyrics
173
+ * @example
174
+ * ```ts
175
+ * const lyrics = await player.getCurrentLyrics();
176
+ * ```
177
+ */
178
+ getCurrentLyrics(skipTrackSource?: boolean): Promise<import("./Types/Node.js").LyricsResult>;
179
+ /**
180
+ * Get the lyrics of a specific track
181
+ * @param track The track to get the lyrics for
182
+ * @param skipTrackSource If true, it will not try to get the lyrics from the track source
183
+ * @returns The lyrics of the track
184
+ * @example
185
+ * ```ts
186
+ * const lyrics = await player.getLyrics(player.queue.tracks[0], true);
187
+ * ```
188
+ */
189
+ getLyrics(track: Track, skipTrackSource?: boolean): Promise<import("./Types/Node.js").LyricsResult>;
190
+ /**
191
+ * Subscribe to the lyrics event on a specific guild to active live lyrics events
192
+ * @param guildId The guild id to subscribe to
193
+ * @returns The unsubscribe function
194
+ * @example
195
+ * ```ts
196
+ * const lyrics = await player.subscribeLyrics();
197
+ * ```
198
+ */
199
+ subscribeLyrics(): Promise<any>;
200
+ /**
201
+ * Unsubscribe from the lyrics event on a specific guild to disable live lyrics events
202
+ * @param guildId The guild id to unsubscribe from
203
+ * @returns The unsubscribe function
204
+ * @example
205
+ * ```ts
206
+ * const lyrics = await player.unsubscribeLyrics();
207
+ * ```
208
+ */
209
+ unsubscribeLyrics(guildId: string): Promise<any>;
167
210
  /**
168
211
  * Move the player on a different Audio-Node
169
212
  * @param newNode New Node / New Node Id
@@ -1,8 +1,8 @@
1
- import { DebugEvents } from "./Constants";
2
- import { bandCampSearch } from "./CustomSearches/BandCampSearch";
3
- import { FilterManager } from "./Filters";
4
- import { Queue, QueueSaver } from "./Queue";
5
- import { queueTrackEnd } from "./Utils";
1
+ import { DebugEvents } from "./Constants.js";
2
+ import { bandCampSearch } from "./CustomSearches/BandCampSearch.js";
3
+ import { FilterManager } from "./Filters.js";
4
+ import { Queue, QueueSaver } from "./Queue.js";
5
+ import { queueTrackEnd } from "./Utils.js";
6
6
  export class Player {
7
7
  /** Filter Manager per player */
8
8
  filterManager;
@@ -571,6 +571,56 @@ export class Player {
571
571
  // return smt
572
572
  return this;
573
573
  }
574
+ /**
575
+ * Get the current lyrics of the track currently playing on the guild
576
+ * @param guildId The guild id to get the current lyrics for
577
+ * @param skipTrackSource If true, it will not try to get the lyrics from the track source
578
+ * @returns The current lyrics
579
+ * @example
580
+ * ```ts
581
+ * const lyrics = await player.getCurrentLyrics();
582
+ * ```
583
+ */
584
+ async getCurrentLyrics(skipTrackSource) {
585
+ return await this.node.lyrics.getCurrent(this.guildId, skipTrackSource);
586
+ }
587
+ /**
588
+ * Get the lyrics of a specific track
589
+ * @param track The track to get the lyrics for
590
+ * @param skipTrackSource If true, it will not try to get the lyrics from the track source
591
+ * @returns The lyrics of the track
592
+ * @example
593
+ * ```ts
594
+ * const lyrics = await player.getLyrics(player.queue.tracks[0], true);
595
+ * ```
596
+ */
597
+ async getLyrics(track, skipTrackSource) {
598
+ return await this.node.lyrics.get(track, skipTrackSource);
599
+ }
600
+ /**
601
+ * Subscribe to the lyrics event on a specific guild to active live lyrics events
602
+ * @param guildId The guild id to subscribe to
603
+ * @returns The unsubscribe function
604
+ * @example
605
+ * ```ts
606
+ * const lyrics = await player.subscribeLyrics();
607
+ * ```
608
+ */
609
+ subscribeLyrics() {
610
+ return this.node.lyrics.subscribe(this.guildId);
611
+ }
612
+ /**
613
+ * Unsubscribe from the lyrics event on a specific guild to disable live lyrics events
614
+ * @param guildId The guild id to unsubscribe from
615
+ * @returns The unsubscribe function
616
+ * @example
617
+ * ```ts
618
+ * const lyrics = await player.unsubscribeLyrics();
619
+ * ```
620
+ */
621
+ unsubscribeLyrics(guildId) {
622
+ return this.node.lyrics.unsubscribe(guildId);
623
+ }
574
624
  /**
575
625
  * Move the player on a different Audio-Node
576
626
  * @param newNode New Node / New Node Id
@@ -1,6 +1,6 @@
1
- import { MiniMap } from "./Utils";
2
- import type { Track, UnresolvedTrack } from "./Types/Track";
3
- import type { ManagerQueueOptions, QueueStoreManager, StoredQueue } from "./Types/Queue";
1
+ import { MiniMap } from "./Utils.js";
2
+ import type { Track, UnresolvedTrack } from "./Types/Track.js";
3
+ import type { ManagerQueueOptions, QueueStoreManager, StoredQueue } from "./Types/Queue.js";
4
4
  export declare class QueueSaver {
5
5
  /**
6
6
  * The queue store manager
@@ -1,4 +1,4 @@
1
- import { ManagerUtils, MiniMap, QueueSymbol } from "./Utils";
1
+ import { ManagerUtils, MiniMap, QueueSymbol } from "./Utils.js";
2
2
  export class QueueSaver {
3
3
  /**
4
4
  * The queue store manager
@@ -1,4 +1,4 @@
1
- import type { FloatNumber, IntegerNumber } from "./Utils";
1
+ import type { FloatNumber, IntegerNumber } from "./Utils.js";
2
2
  /** The Audio Outputs type */
3
3
  export type AudioOutputs = "mono" | "stereo" | "left" | "right";
4
4
  /** The "active" / "disabled" Player Filters */
@@ -1,10 +1,10 @@
1
- import type { DebugEvents } from "../Constants";
2
- import type { Player } from "../Player";
3
- import type { LavalinkNodeOptions } from "./Node";
4
- import type { DestroyReasonsType, PlayerJson } from "./Player";
5
- import type { ManagerQueueOptions } from "./Queue";
6
- import type { Track, UnresolvedTrack } from "./Track";
7
- import type { GuildShardPayload, SearchPlatform, SponsorBlockChaptersLoaded, SponsorBlockChapterStarted, SponsorBlockSegmentSkipped, SponsorBlockSegmentsLoaded, TrackExceptionEvent, TrackEndEvent, TrackStuckEvent, WebSocketClosedEvent, TrackStartEvent } from "./Utils";
1
+ import type { DebugEvents } from "../Constants.js";
2
+ import type { Player } from "../Player.js";
3
+ import type { LavalinkNodeOptions } from "./Node.js";
4
+ import type { DestroyReasonsType, PlayerJson } from "./Player.js";
5
+ import type { ManagerQueueOptions } from "./Queue.js";
6
+ import type { Track, UnresolvedTrack } from "./Track.js";
7
+ import type { GuildShardPayload, SearchPlatform, SponsorBlockChaptersLoaded, SponsorBlockChapterStarted, SponsorBlockSegmentSkipped, SponsorBlockSegmentsLoaded, TrackExceptionEvent, TrackEndEvent, TrackStuckEvent, WebSocketClosedEvent, TrackStartEvent, LyricsFoundEvent, LyricsNotFoundEvent, LyricsLineEvent } from "./Utils.js";
8
8
  /**
9
9
  * The events from the lavalink Manager
10
10
  */
@@ -114,6 +114,24 @@ export interface LavalinkManagerEvents {
114
114
  error?: Error | string;
115
115
  functionLayer: string;
116
116
  }) => void;
117
+ /**
118
+ * Emitted when a Lyrics line is received
119
+ * @link https://github.com/topi314/LavaLyrics
120
+ * @event Manager#LyricsLine
121
+ */
122
+ "LyricsLine": (player: Player, track: Track | UnresolvedTrack | null, payload: LyricsLineEvent) => void;
123
+ /**
124
+ * Emitted when a Lyrics is found
125
+ * @link https://github.com/topi314/LavaLyrics
126
+ * @event Manager#LyricsFound
127
+ */
128
+ "LyricsFound": (player: Player, track: Track | UnresolvedTrack | null, payload: LyricsFoundEvent) => void;
129
+ /**
130
+ * Emitted when a Lyrics is not found
131
+ * @link https://github.com/topi314/LavaLyrics
132
+ * @event Manager#LyricsNotFound
133
+ */
134
+ "LyricsNotFound": (player: Player, track: Track | UnresolvedTrack | null, payload: LyricsNotFoundEvent) => void;
117
135
  }
118
136
  /**
119
137
  * The Bot client Options needed for the manager
@@ -1,8 +1,9 @@
1
1
  /// <reference types="node" />
2
2
  import type internal from "stream";
3
- import type { LavalinkNode } from "../Node";
4
- import type { DestroyReasonsType } from "./Player";
5
- import type { InvalidLavalinkRestRequest, LavalinkPlayer } from "./Utils";
3
+ import type { LavalinkNode } from "../Node.js";
4
+ import type { DestroyReasonsType } from "./Player.js";
5
+ import type { InvalidLavalinkRestRequest, LavalinkPlayer } from "./Utils.js";
6
+ import type { PluginInfo } from "./Track.js";
6
7
  /** Ability to manipulate fetch requests */
7
8
  export type ModifyRequest = (options: RequestInit & {
8
9
  path: string;
@@ -157,6 +158,28 @@ export interface PluginObject {
157
158
  /** The version of the plugin */
158
159
  version: string;
159
160
  }
161
+ export interface LyricsResult {
162
+ /**The name of the source */
163
+ sourceName: string;
164
+ /**The name of the provider */
165
+ provider: string;
166
+ /**The result text */
167
+ text: string | null;
168
+ /**The lyrics lines */
169
+ lines: LyricsLine[];
170
+ /**Information about the plugin */
171
+ plugin: PluginInfo;
172
+ }
173
+ export interface LyricsLine {
174
+ /**The millisecond timestamp */
175
+ timestamp: number;
176
+ /**The line duration in milliseconds */
177
+ duration: number | null;
178
+ /**The line text */
179
+ line: string;
180
+ /**Information about the plugin */
181
+ plugin: PluginInfo;
182
+ }
160
183
  export type LavalinkNodeIdentifier = string;
161
184
  export interface NodeManagerEvents {
162
185
  /**
@@ -1,8 +1,8 @@
1
- import type { DestroyReasons } from "../Constants";
2
- import type { LavalinkNode } from "../Node";
3
- import type { EQBand, FilterData, LavalinkFilterData } from "./Filters";
4
- import type { Track, UnresolvedTrack } from "./Track";
5
- import type { Base64, LavalinkPlayerVoiceOptions } from "./Utils";
1
+ import type { DestroyReasons } from "../Constants.js";
2
+ import type { LavalinkNode } from "../Node.js";
3
+ import type { EQBand, FilterData, LavalinkFilterData } from "./Filters.js";
4
+ import type { Track, UnresolvedTrack } from "./Track.js";
5
+ import type { Base64, LavalinkPlayerVoiceOptions } from "./Utils.js";
6
6
  export type DestroyReasonsType = keyof typeof DestroyReasons | string;
7
7
  export interface PlayerJson {
8
8
  /** Guild Id where the player was playing in */
@@ -1,4 +1,4 @@
1
- import type { Track, UnresolvedTrack } from "./Track";
1
+ import type { Track, UnresolvedTrack } from "./Track.js";
2
2
  export interface StoredQueue {
3
3
  current: Track | null;
4
4
  previous: Track[];
@@ -1,6 +1,6 @@
1
- import type { Player } from "../Player";
2
- import type { anyObject } from "./Player";
3
- import type { Base64 } from "./Utils";
1
+ import type { Player } from "../Player.js";
2
+ import type { anyObject } from "./Player.js";
3
+ import type { Base64 } from "./Utils.js";
4
4
  /** Sourcenames provided by lavalink server */
5
5
  export type LavalinkSourceNames = "youtube" | "youtubemusic" | "soundcloud" | "bandcamp" | "twitch";
6
6
  /** Source Names provided by lava src plugin */
@@ -1,8 +1,8 @@
1
- import type { MiniMap } from "../Utils";
2
- import type { LavalinkFilterData } from "./Filters";
3
- import type { NodeStats } from "./Node";
4
- import type { LavalinkPlayOptions } from "./Player";
5
- import type { LavalinkTrack, PluginInfo, Track, UnresolvedTrack } from "./Track";
1
+ import type { MiniMap } from "../Utils.js";
2
+ import type { LavalinkFilterData } from "./Filters.js";
3
+ import type { LyricsLine, LyricsResult, NodeStats } from "./Node.js";
4
+ import type { LavalinkPlayOptions } from "./Player.js";
5
+ import type { LavalinkTrack, PluginInfo, Track, UnresolvedTrack } from "./Track.js";
6
6
  /** Helper for generating Opaque types. */
7
7
  export type Opaque<T, K> = T & {
8
8
  __opaque__: K;
@@ -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 */
@@ -1,9 +1,9 @@
1
- import type { LavalinkNodeOptions } from "./Types/Node";
2
- import type { LavalinkSearchPlatform, LavaSearchQuery, MiniMapConstructor, SearchPlatform, SearchQuery } from "./Types/Utils";
3
- import type { LavalinkManager } from "./LavalinkManager";
4
- import type { LavalinkNode } from "./Node";
5
- import type { Player } from "./Player";
6
- import type { LavalinkTrack, Track, UnresolvedQuery, UnresolvedTrack } from "./Types/Track";
1
+ import type { LavalinkNodeOptions } from "./Types/Node.js";
2
+ import type { LavalinkSearchPlatform, LavaSearchQuery, MiniMapConstructor, SearchPlatform, SearchQuery } from "./Types/Utils.js";
3
+ import type { LavalinkManager } from "./LavalinkManager.js";
4
+ import type { LavalinkNode } from "./Node.js";
5
+ import type { Player } from "./Player.js";
6
+ import type { LavalinkTrack, Track, UnresolvedQuery, UnresolvedTrack } from "./Types/Track.js";
7
7
  export declare const TrackSymbol: unique symbol;
8
8
  export declare const UnresolvedTrackSymbol: unique symbol;
9
9
  export declare const QueueSymbol: unique symbol;
@@ -1,7 +1,7 @@
1
1
  import { URL } from "node:url";
2
2
  import { isRegExp } from "node:util/types";
3
- import { DebugEvents } from "./Constants";
4
- import { DefaultSources, LavalinkPlugins, SourceLinksRegexes } from "./LavalinkManagerStatics";
3
+ import { DebugEvents } from "./Constants.js";
4
+ import { DefaultSources, LavalinkPlugins, SourceLinksRegexes } from "./LavalinkManagerStatics.js";
5
5
  export const TrackSymbol = Symbol("LC-Track");
6
6
  export const UnresolvedTrackSymbol = Symbol("LC-Track-Unresolved");
7
7
  export const QueueSymbol = Symbol("LC-Queue");
@@ -302,6 +302,9 @@ export class ManagerUtils {
302
302
  if (SourceLinksRegexes.musicYandex.test(queryString) && !node.info?.sourceManagers?.includes("yandexmusic")) {
303
303
  throw new Error("Query / Link Provided for this Source but Lavalink Node has not 'yandexmusic' enabled");
304
304
  }
305
+ if (SourceLinksRegexes.jiosaavn.test(queryString) && !node.info?.sourceManagers?.includes("jiosaavn")) {
306
+ throw new Error("Query / Link Provided for this Source but Lavalink Node has not 'jiosaavn' (via jiosaavn-plugin) enabled");
307
+ }
305
308
  return;
306
309
  }
307
310
  transformQuery(query) {
@@ -357,6 +360,12 @@ export class ManagerUtils {
357
360
  if (source === "dzsearch" && node.info?.sourceManagers?.includes("deezer") && !node.info?.sourceManagers?.includes("http")) {
358
361
  throw new Error("Lavalink Node has not 'http' enabled, which is required to have 'dzsearch' to work");
359
362
  }
363
+ if (source === "jsrec" && !node.info?.sourceManagers?.includes("jiosaavn")) {
364
+ throw new Error("Lavalink Node has not 'jiosaavn' (via jiosaavn-plugin) enabled, which is required to have 'jsrec' to work");
365
+ }
366
+ if (source === "jssearch" && !node.info?.sourceManagers?.includes("jiosaavn")) {
367
+ throw new Error("Lavalink Node has not 'jiosaavn' (via jiosaavn-plugin) enabled, which is required to have 'jssearch' to work");
368
+ }
360
369
  if (source === "scsearch" && !node.info?.sourceManagers?.includes("soundcloud")) {
361
370
  throw new Error("Lavalink Node has not 'soundcloud' enabled, which is required to have 'scsearch' work");
362
371
  }
@@ -3,6 +3,7 @@ export declare enum DebugEvents {
3
3
  SetSponsorBlock = "SetSponsorBlock",
4
4
  DeleteSponsorBlock = "DeleteSponsorBlock",
5
5
  TrackEndReplaced = "TrackEndReplaced",
6
+ AutoplayExecution = "AutoplayExecution",
6
7
  AutoplayNoSongsAdded = "AutoplayNoSongsAdded",
7
8
  AutoplayThresholdSpamLimiter = "AutoplayThresholdSpamLimiter",
8
9
  TriggerQueueEmptyInterval = "TriggerQueueEmptyInterval",
@@ -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>;
@@ -3,7 +3,7 @@ import type { DestroyReasonsType } from "./Types/Player";
3
3
  import type { Track } from "./Types/Track";
4
4
  import type { Base64, InvalidLavalinkRestRequest, LavalinkPlayer, LavaSearchQuery, LavaSearchResponse, PlayerUpdateInfo, RoutePlanner, SearchQuery, SearchResult, Session } from "./Types/Utils";
5
5
  import type { NodeManager } from "./NodeManager";
6
- import type { BaseNodeStats, LavalinkInfo, LavalinkNodeOptions, ModifyRequest, NodeStats, SponsorBlockSegment } from "./Types/Node";
6
+ import type { BaseNodeStats, LavalinkInfo, LavalinkNodeOptions, LyricsResult, ModifyRequest, NodeStats, SponsorBlockSegment } from "./Types/Node";
7
7
  /**
8
8
  * Lavalink Node creator class
9
9
  */
@@ -271,6 +271,62 @@ export declare class LavalinkNode {
271
271
  */
272
272
  multipleTracks: (encodeds: Base64[], requester: unknown) => Promise<Track[]>;
273
273
  };
274
+ lyrics: {
275
+ /**
276
+ * Get the lyrics of a track
277
+ * @param track the track to get the lyrics for
278
+ * @param skipTrackSource wether to skip the track source or not
279
+ * @returns the lyrics of the track
280
+ * @example
281
+ *
282
+ * ```ts
283
+ * const lyrics = await player.node.lyrics.get(track, true);
284
+ * // use it of player instead:
285
+ * // const lyrics = await player.getLyrics(track, true);
286
+ * ```
287
+ */
288
+ get: (track: Track, skipTrackSource?: boolean) => Promise<LyricsResult>;
289
+ /**
290
+ * Get the lyrics of the current playing track
291
+ *
292
+ * @param guildId the guild id of the player
293
+ * @param skipTrackSource wether to skip the track source or not
294
+ * @returns the lyrics of the current playing track
295
+ * @example
296
+ * ```ts
297
+ * const lyrics = await player.node.lyrics.getCurrent(guildId);
298
+ * // use it of player instead:
299
+ * // const lyrics = await player.getCurrentLyrics();
300
+ * ```
301
+ */
302
+ getCurrent: (guildId: string, skipTrackSource?: boolean) => Promise<LyricsResult>;
303
+ /**
304
+ * subscribe to lyrics updates for a guild
305
+ * @param guildId the guild id of the player
306
+ * @returns request data of the request
307
+ *
308
+ * @example
309
+ * ```ts
310
+ * await player.node.lyrics.subscribe(guildId);
311
+ * // use it of player instead:
312
+ * // const lyrics = await player.subscribeLyrics();
313
+ * ```
314
+ */
315
+ subscribe: (guildId: string) => Promise<any>;
316
+ /**
317
+ * unsubscribe from lyrics updates for a guild
318
+ * @param guildId the guild id of the player
319
+ * @returns request data of the request
320
+ *
321
+ * @example
322
+ * ```ts
323
+ * await player.node.lyrics.unsubscribe(guildId);
324
+ * // use it of player instead:
325
+ * // const lyrics = await player.unsubscribeLyrics();
326
+ * ```
327
+ */
328
+ unsubscribe: (guildId: string) => Promise<any>;
329
+ };
274
330
  /**
275
331
  * Request Lavalink statistics.
276
332
  * @returns the lavalink node stats
@@ -432,4 +488,28 @@ export declare class LavalinkNode {
432
488
  deleteSponsorBlock(player: Player): Promise<void>;
433
489
  /** private util function for handling the queue end event */
434
490
  private queueEnd;
491
+ /**
492
+ * Emitted whenever a line of lyrics gets emitted
493
+ * @event
494
+ * @param {Player} player The player that emitted the event
495
+ * @param {Track} track The track that emitted the event
496
+ * @param {LyricsLineEvent} payload The payload of the event
497
+ */
498
+ private LyricsLine;
499
+ /**
500
+ * Emitted whenever the lyrics for a track got found
501
+ * @event
502
+ * @param {Player} player The player that emitted the event
503
+ * @param {Track} track The track that emitted the event
504
+ * @param {LyricsFoundEvent} payload The payload of the event
505
+ */
506
+ private LyricsFound;
507
+ /**
508
+ * Emitted whenever the lyrics for a track got not found
509
+ * @event
510
+ * @param {Player} player The player that emitted the event
511
+ * @param {Track} track The track that emitted the event
512
+ * @param {LyricsNotFoundEvent} payload The payload of the event
513
+ */
514
+ private LyricsNotFound;
435
515
  }
@@ -1,6 +1,7 @@
1
1
  import { FilterManager } from "./Filters";
2
2
  import { Queue } from "./Queue";
3
3
  import type { DestroyReasons } from "./Constants";
4
+ import type { Track } from "./Types/Track";
4
5
  import type { LavalinkNode } from "./Node";
5
6
  import type { SponsorBlockSegment } from "./Types/Node";
6
7
  import type { PlayerJson, PlayerOptions, PlayOptions, RepeatMode } from "./Types/Player";
@@ -164,6 +165,48 @@ export declare class Player {
164
165
  * Destroy the player and disconnect from the voice channel
165
166
  */
166
167
  destroy(reason?: DestroyReasons | string, disconnect?: boolean): Promise<this>;
168
+ /**
169
+ * Get the current lyrics of the track currently playing on the guild
170
+ * @param guildId The guild id to get the current lyrics for
171
+ * @param skipTrackSource If true, it will not try to get the lyrics from the track source
172
+ * @returns The current lyrics
173
+ * @example
174
+ * ```ts
175
+ * const lyrics = await player.getCurrentLyrics();
176
+ * ```
177
+ */
178
+ getCurrentLyrics(skipTrackSource?: boolean): Promise<import("./Types/Node").LyricsResult>;
179
+ /**
180
+ * Get the lyrics of a specific track
181
+ * @param track The track to get the lyrics for
182
+ * @param skipTrackSource If true, it will not try to get the lyrics from the track source
183
+ * @returns The lyrics of the track
184
+ * @example
185
+ * ```ts
186
+ * const lyrics = await player.getLyrics(player.queue.tracks[0], true);
187
+ * ```
188
+ */
189
+ getLyrics(track: Track, skipTrackSource?: boolean): Promise<import("./Types/Node").LyricsResult>;
190
+ /**
191
+ * Subscribe to the lyrics event on a specific guild to active live lyrics events
192
+ * @param guildId The guild id to subscribe to
193
+ * @returns The unsubscribe function
194
+ * @example
195
+ * ```ts
196
+ * const lyrics = await player.subscribeLyrics();
197
+ * ```
198
+ */
199
+ subscribeLyrics(): Promise<any>;
200
+ /**
201
+ * Unsubscribe from the lyrics event on a specific guild to disable live lyrics events
202
+ * @param guildId The guild id to unsubscribe from
203
+ * @returns The unsubscribe function
204
+ * @example
205
+ * ```ts
206
+ * const lyrics = await player.unsubscribeLyrics();
207
+ * ```
208
+ */
209
+ unsubscribeLyrics(guildId: string): Promise<any>;
167
210
  /**
168
211
  * Move the player on a different Audio-Node
169
212
  * @param newNode New Node / New Node Id