lavalink-client 2.3.5 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/README.md +73 -6
  2. package/dist/cjs/structures/Constants.d.ts +4 -0
  3. package/dist/cjs/structures/Constants.js +7 -2
  4. package/dist/cjs/structures/Filters.d.ts +24 -0
  5. package/dist/cjs/structures/Filters.js +34 -10
  6. package/dist/cjs/structures/LavalinkManager.d.ts +4 -5
  7. package/dist/cjs/structures/LavalinkManager.js +36 -14
  8. package/dist/cjs/structures/LavalinkManagerStatics.d.ts +2 -0
  9. package/dist/cjs/structures/LavalinkManagerStatics.js +11 -2
  10. package/dist/cjs/structures/Node.d.ts +107 -13
  11. package/dist/cjs/structures/Node.js +294 -76
  12. package/dist/cjs/structures/NodeManager.d.ts +2 -2
  13. package/dist/cjs/structures/NodeManager.js +19 -19
  14. package/dist/cjs/structures/Player.d.ts +51 -1
  15. package/dist/cjs/structures/Player.js +62 -0
  16. package/dist/cjs/structures/Queue.d.ts +9 -10
  17. package/dist/cjs/structures/Queue.js +3 -3
  18. package/dist/cjs/structures/Types/Manager.d.ts +59 -1
  19. package/dist/cjs/structures/Types/Node.d.ts +23 -1
  20. package/dist/cjs/structures/Types/Player.d.ts +5 -1
  21. package/dist/cjs/structures/Types/Queue.d.ts +6 -6
  22. package/dist/cjs/structures/Types/Track.d.ts +3 -1
  23. package/dist/cjs/structures/Types/Utils.d.ts +81 -8
  24. package/dist/cjs/structures/Utils.js +11 -9
  25. package/dist/esm/structures/Constants.d.ts +4 -0
  26. package/dist/esm/structures/Constants.js +6 -1
  27. package/dist/esm/structures/Filters.d.ts +24 -0
  28. package/dist/esm/structures/Filters.js +34 -10
  29. package/dist/esm/structures/LavalinkManager.d.ts +4 -5
  30. package/dist/esm/structures/LavalinkManager.js +36 -14
  31. package/dist/esm/structures/LavalinkManagerStatics.d.ts +2 -0
  32. package/dist/esm/structures/LavalinkManagerStatics.js +11 -2
  33. package/dist/esm/structures/Node.d.ts +107 -13
  34. package/dist/esm/structures/Node.js +294 -76
  35. package/dist/esm/structures/NodeManager.d.ts +2 -2
  36. package/dist/esm/structures/NodeManager.js +20 -20
  37. package/dist/esm/structures/Player.d.ts +51 -1
  38. package/dist/esm/structures/Player.js +62 -0
  39. package/dist/esm/structures/Queue.d.ts +9 -10
  40. package/dist/esm/structures/Queue.js +3 -3
  41. package/dist/esm/structures/Types/Manager.d.ts +59 -1
  42. package/dist/esm/structures/Types/Node.d.ts +23 -1
  43. package/dist/esm/structures/Types/Player.d.ts +5 -1
  44. package/dist/esm/structures/Types/Queue.d.ts +6 -6
  45. package/dist/esm/structures/Types/Track.d.ts +3 -1
  46. package/dist/esm/structures/Types/Utils.d.ts +81 -8
  47. package/dist/esm/structures/Utils.js +8 -6
  48. package/dist/types/structures/Constants.d.ts +4 -0
  49. package/dist/types/structures/Filters.d.ts +24 -0
  50. package/dist/types/structures/LavalinkManager.d.ts +4 -5
  51. package/dist/types/structures/LavalinkManagerStatics.d.ts +2 -0
  52. package/dist/types/structures/Node.d.ts +107 -13
  53. package/dist/types/structures/NodeManager.d.ts +2 -2
  54. package/dist/types/structures/Player.d.ts +51 -1
  55. package/dist/types/structures/Queue.d.ts +9 -10
  56. package/dist/types/structures/Types/Manager.d.ts +59 -1
  57. package/dist/types/structures/Types/Node.d.ts +23 -1
  58. package/dist/types/structures/Types/Player.d.ts +5 -1
  59. package/dist/types/structures/Types/Queue.d.ts +6 -6
  60. package/dist/types/structures/Types/Track.d.ts +3 -1
  61. package/dist/types/structures/Types/Utils.d.ts +81 -8
  62. package/package.json +29 -18
@@ -1,6 +1,6 @@
1
1
  import type { MiniMap } from "../Utils.js";
2
2
  import type { LavalinkFilterData } from "./Filters.js";
3
- import type { NodeStats } from "./Node.js";
3
+ import type { LyricsLine, LyricsResult, NodeStats } from "./Node.js";
4
4
  import type { LavalinkPlayOptions } from "./Player.js";
5
5
  import type { LavalinkTrack, PluginInfo, Track, UnresolvedTrack } from "./Track.js";
6
6
  /** Helper for generating Opaque types. */
@@ -13,15 +13,16 @@ export type IntegerNumber = Opaque<number, 'Int'>;
13
13
  export type FloatNumber = Opaque<number, 'Float'>;
14
14
  export type LavaSrcSearchPlatformBase = "spsearch" | "sprec" | "amsearch" | "dzsearch" | "dzisrc" | "ymsearch";
15
15
  export type LavaSrcSearchPlatform = LavaSrcSearchPlatformBase | "ftts";
16
+ export type JioSaavnSearchPlatform = "jssearch" | "jsrec";
16
17
  export type DuncteSearchPlatform = "speak" | "phsearch" | "pornhub" | "porn" | "tts";
17
18
  export type LavalinkClientSearchPlatform = "bcsearch";
18
19
  export type LavalinkClientSearchPlatformResolve = "bandcamp" | "bc";
19
- export type LavalinkSearchPlatform = "ytsearch" | "ytmsearch" | "scsearch" | "bcsearch" | LavaSrcSearchPlatform | DuncteSearchPlatform | LavalinkClientSearchPlatform;
20
+ export type LavalinkSearchPlatform = "ytsearch" | "ytmsearch" | "scsearch" | "bcsearch" | LavaSrcSearchPlatform | DuncteSearchPlatform | JioSaavnSearchPlatform | LavalinkClientSearchPlatform;
20
21
  export type ClientCustomSearchPlatformUtils = "local" | "http" | "https" | "link" | "uri";
21
22
  export type ClientSearchPlatform = ClientCustomSearchPlatformUtils | // for file/link requests
22
- "youtube" | "yt" | "youtube music" | "youtubemusic" | "ytm" | "musicyoutube" | "music youtube" | "soundcloud" | "sc" | "am" | "apple music" | "applemusic" | "apple" | "musicapple" | "music apple" | "sp" | "spsuggestion" | "spotify" | "spotify.com" | "spotifycom" | "dz" | "deezer" | "yandex" | "yandex music" | "yandexmusic" | "flowerytts" | "flowery" | "flowery.tts" | LavalinkClientSearchPlatformResolve | LavalinkClientSearchPlatform;
23
+ "youtube" | "yt" | "youtube music" | "youtubemusic" | "ytm" | "musicyoutube" | "music youtube" | "soundcloud" | "sc" | "am" | "apple music" | "applemusic" | "apple" | "musicapple" | "music apple" | "sp" | "spsuggestion" | "spotify" | "spotify.com" | "spotifycom" | "dz" | "deezer" | "yandex" | "yandex music" | "yandexmusic" | "flowerytts" | "flowery" | "flowery.tts" | LavalinkClientSearchPlatformResolve | LavalinkClientSearchPlatform | "js" | "jiosaavn";
23
24
  export type SearchPlatform = LavalinkSearchPlatform | ClientSearchPlatform;
24
- export type SourcesRegex = "YoutubeRegex" | "YoutubeMusicRegex" | "SoundCloudRegex" | "SoundCloudMobileRegex" | "DeezerTrackRegex" | "DeezerArtistRegex" | "DeezerEpisodeRegex" | "DeezerMixesRegex" | "DeezerPageLinkRegex" | "DeezerPlaylistRegex" | "DeezerAlbumRegex" | "AllDeezerRegex" | "AllDeezerRegexWithoutPageLink" | "SpotifySongRegex" | "SpotifyPlaylistRegex" | "SpotifyArtistRegex" | "SpotifyEpisodeRegex" | "SpotifyShowRegex" | "SpotifyAlbumRegex" | "AllSpotifyRegex" | "mp3Url" | "m3uUrl" | "m3u8Url" | "mp4Url" | "m4aUrl" | "wavUrl" | "aacpUrl" | "tiktok" | "mixcloud" | "musicYandex" | "radiohost" | "bandcamp" | "appleMusic" | "TwitchTv" | "vimeo";
25
+ export type SourcesRegex = "YoutubeRegex" | "YoutubeMusicRegex" | "SoundCloudRegex" | "SoundCloudMobileRegex" | "DeezerTrackRegex" | "DeezerArtistRegex" | "DeezerEpisodeRegex" | "DeezerMixesRegex" | "DeezerPageLinkRegex" | "DeezerPlaylistRegex" | "DeezerAlbumRegex" | "AllDeezerRegex" | "AllDeezerRegexWithoutPageLink" | "SpotifySongRegex" | "SpotifyPlaylistRegex" | "SpotifyArtistRegex" | "SpotifyEpisodeRegex" | "SpotifyShowRegex" | "SpotifyAlbumRegex" | "AllSpotifyRegex" | "mp3Url" | "m3uUrl" | "m3u8Url" | "mp4Url" | "m4aUrl" | "wavUrl" | "aacpUrl" | "tiktok" | "mixcloud" | "musicYandex" | "radiohost" | "bandcamp" | "jiosaavn" | "appleMusic" | "TwitchTv" | "vimeo";
25
26
  export interface PlaylistInfo {
26
27
  /** The playlist name */
27
28
  name: string;
@@ -62,7 +63,7 @@ export interface MiniMapConstructor {
62
63
  readonly prototype: MiniMap<unknown, unknown>;
63
64
  readonly [Symbol.species]: MiniMapConstructor;
64
65
  }
65
- export type PlayerEvents = TrackStartEvent | TrackEndEvent | TrackStuckEvent | TrackExceptionEvent | WebSocketClosedEvent | SponsorBlockSegmentEvents;
66
+ export type PlayerEvents = TrackStartEvent | TrackEndEvent | TrackStuckEvent | TrackExceptionEvent | WebSocketClosedEvent | SponsorBlockSegmentEvents | LyricsEvent;
66
67
  export type Severity = "COMMON" | "SUSPICIOUS" | "FAULT";
67
68
  export interface Exception {
68
69
  /** Severity of the error */
@@ -148,9 +149,66 @@ export interface SponsorBlockChaptersLoaded extends PlayerEvent {
148
149
  duration: number;
149
150
  }[];
150
151
  }
152
+ /**
153
+ * Types & Events for Lyrics plugin from Lavalink: https://github.com/topi314/LavaLyrics
154
+ */
155
+ export type LyricsEvent = LyricsFoundEvent | LyricsNotFoundEvent | LyricsLineEvent;
156
+ export type LyricsEventType = "LyricsFoundEvent" | "LyricsNotFoundEvent" | "LyricsLineEvent";
157
+ export interface LyricsFoundEvent extends PlayerEvent {
158
+ /** The lyricsfound event */
159
+ type: "LyricsFoundEvent";
160
+ /** The guildId */
161
+ guildId: string;
162
+ /** The lyrics */
163
+ lyrics: LyricsResult;
164
+ }
165
+ export interface LyricsNotFoundEvent extends PlayerEvent {
166
+ /**The lyricsnotfound event*/
167
+ type: "LyricsNotFoundEvent";
168
+ /**The guildId*/
169
+ guildId: string;
170
+ }
171
+ export interface LyricsLineEvent extends PlayerEvent {
172
+ /**The lyricsline event*/
173
+ type: "LyricsLineEvent";
174
+ /** The guildId */
175
+ guildId: string;
176
+ /** The line number */
177
+ lineIndex: number;
178
+ /** The line */
179
+ line: LyricsLine;
180
+ /**skipped is true if the line was skipped */
181
+ skipped: boolean;
182
+ }
183
+ export interface LyricsFoundEvent extends PlayerEvent {
184
+ /** The lyricsfound event */
185
+ type: "LyricsFoundEvent";
186
+ /** The guildId */
187
+ guildId: string;
188
+ /** The lyrics */
189
+ lyrics: LyricsResult;
190
+ }
191
+ export interface LyricsNotFoundEvent extends PlayerEvent {
192
+ /**The lyricsnotfound event*/
193
+ type: "LyricsNotFoundEvent";
194
+ /**The guildId*/
195
+ guildId: string;
196
+ }
197
+ export interface LyricsLineEvent extends PlayerEvent {
198
+ /**The lyricsline event*/
199
+ type: "LyricsLineEvent";
200
+ /** The guildId */
201
+ guildId: string;
202
+ /** The line number */
203
+ lineIndex: number;
204
+ /** The line */
205
+ line: LyricsLine;
206
+ /**skipped is true if the line was skipped */
207
+ skipped: boolean;
208
+ }
151
209
  export type LoadTypes = "track" | "playlist" | "search" | "error" | "empty";
152
210
  export type State = "CONNECTED" | "CONNECTING" | "DISCONNECTED" | "DISCONNECTING" | "DESTROYING";
153
- export type PlayerEventType = "TrackStartEvent" | "TrackEndEvent" | "TrackExceptionEvent" | "TrackStuckEvent" | "WebSocketClosedEvent" | SponsorBlockSegmentEventType;
211
+ export type PlayerEventType = "TrackStartEvent" | "TrackEndEvent" | "TrackExceptionEvent" | "TrackStuckEvent" | "WebSocketClosedEvent" | SponsorBlockSegmentEventType | LyricsEventType;
154
212
  export type TrackEndReason = "finished" | "loadFailed" | "stopped" | "replaced" | "cleanup";
155
213
  export interface InvalidLavalinkRestRequest {
156
214
  /** Rest Request Data for when it was made */
@@ -178,8 +236,7 @@ export interface LavalinkPlayerVoice {
178
236
  /** The Ping to the voice server */
179
237
  ping?: number;
180
238
  }
181
- export interface LavalinkPlayerVoiceOptions extends Omit<LavalinkPlayerVoice, 'connected' | 'ping'> {
182
- }
239
+ export type LavalinkPlayerVoiceOptions = Omit<LavalinkPlayerVoice, 'connected' | 'ping'>;
183
240
  export interface FailingAddress {
184
241
  /** The failing address */
185
242
  failingAddress: string;
@@ -295,6 +352,22 @@ export interface VoiceState {
295
352
  session_id: string;
296
353
  /** Voice Channel Id */
297
354
  channel_id: string;
355
+ /** Server Mute status */
356
+ mute: boolean;
357
+ /** Server Deaf status */
358
+ deaf: boolean;
359
+ /** Self Deaf status */
360
+ self_deaf: boolean;
361
+ /** Self Mute status */
362
+ self_mute: boolean;
363
+ /** Self Video (Camera) status */
364
+ self_video: boolean;
365
+ /** Self Stream status */
366
+ self_stream: boolean;
367
+ /** Wether the user requests to speak (stage channel) */
368
+ request_to_speak_timestamp: boolean;
369
+ /** Self suppressed status (stage channel) */
370
+ suppress: boolean;
298
371
  }
299
372
  /** The Base64 decodes tring by lavalink */
300
373
  export type Base64 = string;
@@ -296,12 +296,12 @@ export class ManagerUtils {
296
296
  if (SourceLinksRegexes.AllDeezerRegex.test(queryString) && !node.info?.sourceManagers?.includes("deezer")) {
297
297
  throw new Error("Query / Link Provided for this Source but Lavalink Node has not 'deezer' enabled");
298
298
  }
299
- if (SourceLinksRegexes.AllDeezerRegex.test(queryString) && node.info?.sourceManagers?.includes("deezer") && !node.info?.sourceManagers?.includes("http")) {
300
- throw new Error("Query / Link Provided for this Source but Lavalink Node has not 'http' enabled, which is required to have 'deezer' to work");
301
- }
302
299
  if (SourceLinksRegexes.musicYandex.test(queryString) && !node.info?.sourceManagers?.includes("yandexmusic")) {
303
300
  throw new Error("Query / Link Provided for this Source but Lavalink Node has not 'yandexmusic' enabled");
304
301
  }
302
+ if (SourceLinksRegexes.jiosaavn.test(queryString) && !node.info?.sourceManagers?.includes("jiosaavn")) {
303
+ throw new Error("Query / Link Provided for this Source but Lavalink Node has not 'jiosaavn' (via jiosaavn-plugin) enabled");
304
+ }
305
305
  return;
306
306
  }
307
307
  transformQuery(query) {
@@ -354,8 +354,11 @@ export class ManagerUtils {
354
354
  if (source === "dzisrc" && node.info?.sourceManagers?.includes("deezer") && !node.info?.sourceManagers?.includes("http")) {
355
355
  throw new Error("Lavalink Node has not 'http' enabled, which is required to have 'dzisrc' to work");
356
356
  }
357
- if (source === "dzsearch" && node.info?.sourceManagers?.includes("deezer") && !node.info?.sourceManagers?.includes("http")) {
358
- throw new Error("Lavalink Node has not 'http' enabled, which is required to have 'dzsearch' to work");
357
+ if (source === "jsrec" && !node.info?.sourceManagers?.includes("jiosaavn")) {
358
+ throw new Error("Lavalink Node has not 'jiosaavn' (via jiosaavn-plugin) enabled, which is required to have 'jsrec' to work");
359
+ }
360
+ if (source === "jssearch" && !node.info?.sourceManagers?.includes("jiosaavn")) {
361
+ throw new Error("Lavalink Node has not 'jiosaavn' (via jiosaavn-plugin) enabled, which is required to have 'jssearch' to work");
359
362
  }
360
363
  if (source === "scsearch" && !node.info?.sourceManagers?.includes("soundcloud")) {
361
364
  throw new Error("Lavalink Node has not 'soundcloud' enabled, which is required to have 'scsearch' work");
@@ -404,7 +407,6 @@ export class MiniMap extends Map {
404
407
  const iter = this.entries();
405
408
  return Array.from({ length: this.size }, () => {
406
409
  const [key, value] = iter.next().value;
407
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
408
410
  return fn(value, key, this);
409
411
  });
410
412
  }
@@ -55,6 +55,10 @@ export declare enum DestroyReasons {
55
55
  TrackErrorMaxTracksErroredPerTime = "TrackErrorMaxTracksErroredPerTime",
56
56
  TrackStuckMaxTracksErroredPerTime = "TrackStuckMaxTracksErroredPerTime"
57
57
  }
58
+ export declare enum DisconnectReasons {
59
+ Disconnected = "Disconnected",
60
+ DisconnectAllNodes = "DisconnectAllNodes"
61
+ }
58
62
  export declare const validSponsorBlocks: string[];
59
63
  /** The audio Outputs Data map declaration */
60
64
  export declare const audioOutputsData: Record<AudioOutputs, ChannelMixFilter>;
@@ -87,9 +87,33 @@ export declare class FilterManager {
87
87
  */
88
88
  toggleLowPass(smoothing?: number): Promise<boolean>;
89
89
  lavalinkLavaDspxPlugin: {
90
+ /**
91
+ * Enables / Disables the LowPass effect, (Optional: provide your Own Data)
92
+ * @param boostFactor
93
+ * @param cutoffFrequency
94
+ * @returns
95
+ */
90
96
  toggleLowPass: (boostFactor?: number, cutoffFrequency?: number) => Promise<boolean>;
97
+ /**
98
+ * Enables / Disables the HighPass effect, (Optional: provide your Own Data)
99
+ * @param boostFactor
100
+ * @param cutoffFrequency
101
+ * @returns
102
+ */
91
103
  toggleHighPass: (boostFactor?: number, cutoffFrequency?: number) => Promise<boolean>;
104
+ /**
105
+ * Enables / Disables the Normalization effect.
106
+ * @param {number} [maxAmplitude=0.75] - The maximum amplitude of the audio.
107
+ * @param {boolean} [adaptive=true] - Whether to use adaptive normalization or not.
108
+ * @returns {Promise<boolean>} - The state of the filter after execution.
109
+ */
92
110
  toggleNormalization: (maxAmplitude?: number, adaptive?: boolean) => Promise<boolean>;
111
+ /**
112
+ * Enables / Disables the Echo effect, IMPORTANT! Only works with the correct Lavalink Plugin installed. (Optional: provide your Own Data)
113
+ * @param {number} [decay=0.5] - The decay of the echo effect.
114
+ * @param {number} [echoLength=0.5] - The length of the echo effect.
115
+ * @returns {Promise<boolean>} - The state of the filter after execution.
116
+ */
93
117
  toggleEcho: (decay?: number, echoLength?: number) => Promise<boolean>;
94
118
  };
95
119
  lavalinkFilterPlugin: {
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { EventEmitter } from "events";
3
2
  import { NodeManager } from "./NodeManager";
4
3
  import { Player } from "./Player";
@@ -137,7 +136,7 @@ export declare class LavalinkManager extends EventEmitter {
137
136
  * ```
138
137
  * @returns
139
138
  */
140
- getPlayer(guildId: string): Player;
139
+ getPlayer(guildId: string): Player | undefined;
141
140
  /**
142
141
  * Create a Music-Player. If a player exists, then it returns it before creating a new one
143
142
  * @param options
@@ -175,7 +174,7 @@ export declare class LavalinkManager extends EventEmitter {
175
174
  * // recommend to do it on the player tho: player.destroy("forcefully destroyed the player");
176
175
  * ```
177
176
  */
178
- destroyPlayer(guildId: string, destroyReason?: string): Promise<Player>;
177
+ destroyPlayer(guildId: string, destroyReason?: string): Promise<void | Player>;
179
178
  /**
180
179
  * Delete's a player from the cache without destroying it on lavalink (only works when it's disconnected)
181
180
  * @param guildId
@@ -187,7 +186,7 @@ export declare class LavalinkManager extends EventEmitter {
187
186
  * // shouldn't be used except you know what you are doing.
188
187
  * ```
189
188
  */
190
- deletePlayer(guildId: string): boolean;
189
+ deletePlayer(guildId: string): boolean | void;
191
190
  /**
192
191
  * Checks wether the the lib is useable based on if any node is connected
193
192
  *
@@ -213,7 +212,7 @@ export declare class LavalinkManager extends EventEmitter {
213
212
  * });
214
213
  * ```
215
214
  */
216
- init(clientData: BotClientOptions): Promise<this>;
215
+ init(clientData: BotClientOptions): Promise<LavalinkManager>;
217
216
  /**
218
217
  * Sends voice data to the Lavalink server.
219
218
  * ! Without this the library won't work
@@ -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>;
@@ -1,9 +1,9 @@
1
1
  import type { Player } from "./Player";
2
- import type { DestroyReasonsType } from "./Types/Player";
2
+ import type { DestroyReasonsType, DisconnectReasonsType } 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
  */
@@ -13,6 +13,7 @@ export declare class LavalinkNode {
13
13
  get heartBeatPing(): number;
14
14
  private heartBeatInterval?;
15
15
  private pingTimeout?;
16
+ isAlive: boolean;
16
17
  /** The provided Options of the Node */
17
18
  options: LavalinkNodeOptions;
18
19
  /** The amount of rest calls the node has made. */
@@ -88,7 +89,8 @@ export declare class LavalinkNode {
88
89
  * player.node.request(`/loadtracks?identifier=Never gonna give you up`, (options) => options.method = "GET", false);
89
90
  * ```
90
91
  */
91
- request(endpoint: string, modify?: ModifyRequest, parseAsText?: boolean): Promise<any>;
92
+ request(endpoint: string, modify: ModifyRequest | undefined, parseAsText: true): Promise<string>;
93
+ request(endpoint: string, modify?: ModifyRequest, parseAsText?: false): Promise<any>;
92
94
  /**
93
95
  * Search something raw on the node, please note only add tracks to players of that node
94
96
  * @param query SearchQuery Object
@@ -109,7 +111,7 @@ export declare class LavalinkNode {
109
111
  * @param query LavaSearchQuery Object
110
112
  * @param requestUser Request User for creating the player(s)
111
113
  * @param throwOnEmpty Wether to throw on an empty result or not
112
- * @returns LavaSearchresult
114
+ * @returns LavaSearchresult (SearchResult if link is provided)
113
115
  *
114
116
  * @example
115
117
  * ```ts
@@ -117,7 +119,7 @@ export declare class LavalinkNode {
117
119
  * player.node.lavaSearch({ types: ["playlist", "album"], query: "Rick Astley", source: "spotify" }, interaction.user);
118
120
  * ```
119
121
  */
120
- lavaSearch(query: LavaSearchQuery, requestUser: unknown, throwOnEmpty?: boolean): Promise<SearchResult | LavaSearchResponse>;
122
+ lavaSearch(query: LavaSearchQuery, requestUser: unknown, throwOnEmpty?: boolean): Promise<LavaSearchResponse | SearchResult>;
121
123
  /**
122
124
  * Update the Player State on the Lavalink Server
123
125
  * @param data data to send to lavalink and sync locally
@@ -141,7 +143,7 @@ export declare class LavalinkNode {
141
143
  * player.node.destroyPlayer(player.guildId);
142
144
  * ```
143
145
  */
144
- destroyPlayer(guildId: any): Promise<any>;
146
+ destroyPlayer(guildId: any): Promise<void>;
145
147
  /**
146
148
  * Connect to the Lavalink Node
147
149
  * @param sessionId Provide the Session Id of the previous connection, to resume the node and it's player(s)
@@ -169,7 +171,7 @@ export declare class LavalinkNode {
169
171
  get id(): string;
170
172
  /**
171
173
  * Destroys the Node-Connection (Websocket) and all player's of the node
172
- * @param destroyReason Destroyreason to use when destroying the players
174
+ * @param destroyReason Destroy Reason to use when destroying the players
173
175
  * @param deleteNode wether to delete the nodte from the nodes list too, if false it will emit a disconnect. @default true
174
176
  * @returns void
175
177
  *
@@ -179,6 +181,19 @@ export declare class LavalinkNode {
179
181
  * ```
180
182
  */
181
183
  destroy(destroyReason?: DestroyReasonsType, deleteNode?: boolean): void;
184
+ /**
185
+ * Disconnects the Node-Connection (Websocket)
186
+ * @param disconnectReason Disconnect Reason to use when disconnecting Node
187
+ * @returns void
188
+ *
189
+ * Also the node will not get re-connected again.
190
+ *
191
+ * @example
192
+ * ```ts
193
+ * player.node.destroy("custom Player Destroy Reason", true);
194
+ * ```
195
+ */
196
+ disconnect(disconnectReason?: DisconnectReasonsType): void;
182
197
  /**
183
198
  * Returns if connected to the Node.
184
199
  *
@@ -189,7 +204,6 @@ export declare class LavalinkNode {
189
204
  * ```
190
205
  */
191
206
  get connected(): boolean;
192
- isAlive: boolean;
193
207
  /**
194
208
  * Returns the current ConnectionStatus
195
209
  *
@@ -214,7 +228,7 @@ export declare class LavalinkNode {
214
228
  * const playersOfLavalink = await node?.fetchAllPlayers();
215
229
  * ```
216
230
  */
217
- fetchAllPlayers(): Promise<LavalinkPlayer[] | InvalidLavalinkRestRequest>;
231
+ fetchAllPlayers(): Promise<LavalinkPlayer[] | InvalidLavalinkRestRequest | null>;
218
232
  /**
219
233
  * Gets specific Player Information
220
234
  * @returns lavalink player object if player exists on lavalink
@@ -225,7 +239,7 @@ export declare class LavalinkNode {
225
239
  * const playerInformation = await node?.fetchPlayer("guildId");
226
240
  * ```
227
241
  */
228
- fetchPlayer(guildId: string): Promise<LavalinkPlayer | InvalidLavalinkRestRequest>;
242
+ fetchPlayer(guildId: string): Promise<LavalinkPlayer | InvalidLavalinkRestRequest | null>;
229
243
  /**
230
244
  * Updates the session with and enables/disables resuming and timeout
231
245
  * @param resuming Whether resuming is enabled for this session or not
@@ -238,7 +252,7 @@ export declare class LavalinkNode {
238
252
  * await node?.updateSession(true, 180e3); // will enable resuming for 180seconds
239
253
  * ```
240
254
  */
241
- updateSession(resuming?: boolean, timeout?: number): Promise<InvalidLavalinkRestRequest | Session>;
255
+ updateSession(resuming?: boolean, timeout?: number): Promise<Session | InvalidLavalinkRestRequest | null>;
242
256
  /**
243
257
  * Decode Track or Tracks
244
258
  */
@@ -271,6 +285,62 @@ export declare class LavalinkNode {
271
285
  */
272
286
  multipleTracks: (encodeds: Base64[], requester: unknown) => Promise<Track[]>;
273
287
  };
288
+ lyrics: {
289
+ /**
290
+ * Get the lyrics of a track
291
+ * @param track the track to get the lyrics for
292
+ * @param skipTrackSource wether to skip the track source or not
293
+ * @returns the lyrics of the track
294
+ * @example
295
+ *
296
+ * ```ts
297
+ * const lyrics = await player.node.lyrics.get(track, true);
298
+ * // use it of player instead:
299
+ * // const lyrics = await player.getLyrics(track, true);
300
+ * ```
301
+ */
302
+ get: (track: Track, skipTrackSource?: boolean) => Promise<LyricsResult | null>;
303
+ /**
304
+ * Get the lyrics of the current playing track
305
+ *
306
+ * @param guildId the guild id of the player
307
+ * @param skipTrackSource wether to skip the track source or not
308
+ * @returns the lyrics of the current playing track
309
+ * @example
310
+ * ```ts
311
+ * const lyrics = await player.node.lyrics.getCurrent(guildId);
312
+ * // use it of player instead:
313
+ * // const lyrics = await player.getCurrentLyrics();
314
+ * ```
315
+ */
316
+ getCurrent: (guildId: string, skipTrackSource?: boolean) => Promise<LyricsResult | null>;
317
+ /**
318
+ * subscribe to lyrics updates for a guild
319
+ * @param guildId the guild id of the player
320
+ * @returns request data of the request
321
+ *
322
+ * @example
323
+ * ```ts
324
+ * await player.node.lyrics.subscribe(guildId);
325
+ * // use it of player instead:
326
+ * // const lyrics = await player.subscribeLyrics();
327
+ * ```
328
+ */
329
+ subscribe: (guildId: string) => Promise<unknown>;
330
+ /**
331
+ * unsubscribe from lyrics updates for a guild
332
+ * @param guildId the guild id of the player
333
+ * @returns request data of the request
334
+ *
335
+ * @example
336
+ * ```ts
337
+ * await player.node.lyrics.unsubscribe(guildId);
338
+ * // use it of player instead:
339
+ * // const lyrics = await player.unsubscribeLyrics();
340
+ * ```
341
+ */
342
+ unsubscribe: (guildId: string) => Promise<void>;
343
+ };
274
344
  /**
275
345
  * Request Lavalink statistics.
276
346
  * @returns the lavalink node stats
@@ -329,7 +399,7 @@ export declare class LavalinkNode {
329
399
  * await player.node.routePlannerApi.unmarkFailedAddress("ipv6address");
330
400
  * ```
331
401
  */
332
- unmarkFailedAddress: (address: string) => Promise<void>;
402
+ unmarkFailedAddress: (address: string) => Promise<unknown>;
333
403
  /**
334
404
  * Release all blacklisted IP addresses into pool of IPs
335
405
  * @returns request data of the request
@@ -339,7 +409,7 @@ export declare class LavalinkNode {
339
409
  * await player.node.routePlannerApi.unmarkAllFailedAddresses();
340
410
  * ```
341
411
  */
342
- unmarkAllFailedAddresses: () => Promise<any>;
412
+ unmarkAllFailedAddresses: () => Promise<unknown>;
343
413
  };
344
414
  /** @private Utils for validating the */
345
415
  private validate;
@@ -432,4 +502,28 @@ export declare class LavalinkNode {
432
502
  deleteSponsorBlock(player: Player): Promise<void>;
433
503
  /** private util function for handling the queue end event */
434
504
  private queueEnd;
505
+ /**
506
+ * Emitted whenever a line of lyrics gets emitted
507
+ * @event
508
+ * @param {Player} player The player that emitted the event
509
+ * @param {Track} track The track that emitted the event
510
+ * @param {LyricsLineEvent} payload The payload of the event
511
+ */
512
+ private LyricsLine;
513
+ /**
514
+ * Emitted whenever the lyrics for a track got found
515
+ * @event
516
+ * @param {Player} player The player that emitted the event
517
+ * @param {Track} track The track that emitted the event
518
+ * @param {LyricsFoundEvent} payload The payload of the event
519
+ */
520
+ private LyricsFound;
521
+ /**
522
+ * Emitted whenever the lyrics for a track got not found
523
+ * @event
524
+ * @param {Player} player The player that emitted the event
525
+ * @param {Track} track The track that emitted the event
526
+ * @param {LyricsNotFoundEvent} payload The payload of the event
527
+ */
528
+ private LyricsNotFound;
435
529
  }
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { EventEmitter } from "events";
3
2
  import { LavalinkNode } from "./Node";
4
3
  import { MiniMap } from "./Utils";
@@ -55,9 +54,10 @@ export declare class NodeManager extends EventEmitter {
55
54
  /**
56
55
  * Disconnects all Nodes from lavalink ws sockets
57
56
  * @param deleteAllNodes if the nodes should also be deleted from nodeManager.nodes
57
+ * @param destroyPlayers if the players should be destroyed
58
58
  * @returns amount of disconnected Nodes
59
59
  */
60
- disconnectAll(deleteAllNodes?: boolean): Promise<number>;
60
+ disconnectAll(deleteAllNodes?: boolean, destroyPlayers?: boolean): Promise<number>;
61
61
  /**
62
62
  * Connects all not connected nodes
63
63
  * @returns Amount of connected Nodes
@@ -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";
@@ -51,6 +52,13 @@ export declare class Player {
51
52
  connected: boolean | undefined;
52
53
  /** Voice Server Data (from Lavalink) */
53
54
  voice: LavalinkPlayerVoiceOptions;
55
+ voiceState: {
56
+ selfDeaf: boolean;
57
+ selfMute: boolean;
58
+ serverDeaf: boolean;
59
+ serverMute: boolean;
60
+ suppress: boolean;
61
+ };
54
62
  /** Custom data for the player */
55
63
  private readonly data;
56
64
  /**
@@ -96,7 +104,7 @@ export declare class Player {
96
104
  * @param throwOnEmpty If an error should be thrown if no track is found
97
105
  * @returns The search result
98
106
  */
99
- lavaSearch(query: LavaSearchQuery, requestUser: unknown, throwOnEmpty?: boolean): Promise<import("./Types/Utils").SearchResult | import("./Types/Utils").LavaSearchResponse>;
107
+ lavaSearch(query: LavaSearchQuery, requestUser: unknown, throwOnEmpty?: boolean): Promise<import("./Types/Utils").LavaSearchResponse | import("./Types/Utils").SearchResult>;
100
108
  /**
101
109
  * Set the SponsorBlock
102
110
  * @param segments The segments to set
@@ -164,6 +172,48 @@ export declare class Player {
164
172
  * Destroy the player and disconnect from the voice channel
165
173
  */
166
174
  destroy(reason?: DestroyReasons | string, disconnect?: boolean): Promise<this>;
175
+ /**
176
+ * Get the current lyrics of the track currently playing on the guild
177
+ * @param guildId The guild id to get the current lyrics for
178
+ * @param skipTrackSource If true, it will not try to get the lyrics from the track source
179
+ * @returns The current lyrics
180
+ * @example
181
+ * ```ts
182
+ * const lyrics = await player.getCurrentLyrics();
183
+ * ```
184
+ */
185
+ getCurrentLyrics(skipTrackSource?: boolean): Promise<import("./Types/Node").LyricsResult>;
186
+ /**
187
+ * Get the lyrics of a specific track
188
+ * @param track The track to get the lyrics for
189
+ * @param skipTrackSource If true, it will not try to get the lyrics from the track source
190
+ * @returns The lyrics of the track
191
+ * @example
192
+ * ```ts
193
+ * const lyrics = await player.getLyrics(player.queue.tracks[0], true);
194
+ * ```
195
+ */
196
+ getLyrics(track: Track, skipTrackSource?: boolean): Promise<import("./Types/Node").LyricsResult>;
197
+ /**
198
+ * Subscribe to the lyrics event on a specific guild to active live lyrics events
199
+ * @param guildId The guild id to subscribe to
200
+ * @returns The unsubscribe function
201
+ * @example
202
+ * ```ts
203
+ * const lyrics = await player.subscribeLyrics();
204
+ * ```
205
+ */
206
+ subscribeLyrics(): Promise<unknown>;
207
+ /**
208
+ * Unsubscribe from the lyrics event on a specific guild to disable live lyrics events
209
+ * @param guildId The guild id to unsubscribe from
210
+ * @returns The unsubscribe function
211
+ * @example
212
+ * ```ts
213
+ * const lyrics = await player.unsubscribeLyrics();
214
+ * ```
215
+ */
216
+ unsubscribeLyrics(guildId: string): Promise<void>;
167
217
  /**
168
218
  * Move the player on a different Audio-Node
169
219
  * @param newNode New Node / New Node Id