lavalink-client 2.8.0 → 2.9.1

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 (6) hide show
  1. package/README.md +726 -518
  2. package/dist/index.d.mts +2427 -1893
  3. package/dist/index.d.ts +2427 -1893
  4. package/dist/index.js +1776 -566
  5. package/dist/index.mjs +1773 -566
  6. package/package.json +79 -81
package/dist/index.d.ts CHANGED
@@ -1,1209 +1,402 @@
1
1
  import { EventEmitter } from 'events';
2
+ import { ReadableStream } from 'stream/web';
2
3
 
3
- declare class FilterManager {
4
- static EQList: {
5
- BassboostEarrape: EQBand[];
6
- BassboostHigh: EQBand[];
7
- BassboostMedium: EQBand[];
8
- BassboostLow: EQBand[];
9
- BetterMusic: EQBand[];
10
- Rock: EQBand[];
11
- Classic: EQBand[];
12
- Pop: EQBand[];
13
- Electronic: EQBand[];
14
- FullSound: EQBand[];
15
- Gaming: EQBand[];
16
- };
17
- /** The Equalizer bands currently applied to the Lavalink Server */
18
- equalizerBands: EQBand[];
19
- /** Private Util for the instaFix Filters option */
20
- filterUpdatedState: boolean;
21
- /** All "Active" / "disabled" Player Filters */
22
- filters: PlayerFilters;
23
- /** The Filter Data sent to Lavalink, only if the filter is enabled (ofc.) */
24
- data: FilterData;
25
- /** The Player assigned to this Filter Manager */
26
- player: Player;
27
- private get _LManager();
28
- /**
29
- * Returns whether the plugin validations are enabled or not
30
- */
31
- private get _checkForPlugins();
32
- /**
33
- * Returns whether the source validations are enabled or not
34
- */
35
- private get _checkForSources();
36
- /** The Constructor for the FilterManager */
37
- constructor(player: Player);
38
- /**
39
- * Apply Player filters for lavalink filter sending data, if the filter is enabled / not
40
- *
41
- * @returns {Promise<void>}
42
- *
43
- * @example
44
- * ```ts
45
- * // Apply the filters after changing them manually:
46
- * player.filterManager.data.volume = 0.5;
47
- * // maybe you wanna manually set a distorition filter? then do it like this...
48
- * player.filterManager.data.distortion = { sinOffset: 0.5, sinScale: 2, cosOffset: 0.5, cosScale: 2, tanOffset: 0.5, tanScale: 2, offset: 0.5, scale: 2 };
49
- * await player.filterManager.applyPlayerFilters();
50
- * ```
51
- */
52
- applyPlayerFilters(): Promise<void>;
53
- private privateNot0;
54
- private getLavalinkFilterData;
55
- /**
56
- * Checks if the filters are correctly stated (active / not-active) - mostly used internally.
57
- * @param oldFilterTimescale
58
- * @returns {boolean} True, if the check was successfull
59
- *
60
- * @example
61
- * ```ts
62
- * // Check the filter states
63
- * player.filterManager.checkFiltersState();
64
- * // Apply the filters after checking
65
- * await player.filterManager.applyPlayerFilters();
66
- * ```
67
- */
68
- checkFiltersState(oldFilterTimescale?: Partial<TimescaleFilter>): boolean;
69
- /**
70
- * Reset all Filters
71
- * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
72
- *
73
- * @example
74
- * ```ts
75
- * // Reset all filters
76
- * await player.filterManager.resetFilters();
77
- * ```
78
- */
79
- resetFilters(): Promise<FilterManager>;
80
- /**
81
- * Set the Filter Volume
82
- * @param volume the volume (0.0 - 5.0)
83
- * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
84
- *
85
- * @example
86
- * ```ts
87
- * // Set Volume to 50%
88
- * await player.filterManager.setVolume(0.5);
89
- * // note this is a filter, so it will "jump" to the volume, i think it's like a "volume boost effect" so i marketed it as a filter
90
- * ```
91
- */
92
- setVolume(volume: number): Promise<this>;
93
- /**
94
- * Set the AudioOutput Filter
95
- * @param {AudioOutputs} type the audio output type
96
- * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
97
- *
98
- * @example
99
- * ```ts
100
- * // Set Audio Output to Mono
101
- * await player.filterManager.setAudioOutput("mono");
102
- *
103
- * // Set Audio Output to Stereo
104
- * await player.filterManager.setAudioOutput("stereo");
105
- *
106
- * // Set Audio Output to Left
107
- * await player.filterManager.setAudioOutput("left");
108
- *
109
- * // Set Audio Output to Right
110
- * await player.filterManager.setAudioOutput("right");
111
- * ```
112
- */
113
- setAudioOutput(type: AudioOutputs): Promise<FilterManager>;
114
- /**
115
- * Set custom filter.timescale#speed . This method disabled both: nightcore & vaporwave. use 1 to reset it to normal
116
- * @param {number} speed set the speed of the filter
117
- * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
118
- *
119
- * @example
120
- * ```ts
121
- * // Set Speed to 1.25 (disableds nightcore and vaporwave effect which are pre-made timescale settings of rate,pitch and speed)
122
- * await player.filterManager.setSpeed(1.25);
123
- * ```
124
- */
125
- setSpeed(speed?: number): Promise<FilterManager>;
126
- /**
127
- * Set custom filter.timescale#pitch . This method disabled both: nightcore & vaporwave. use 1 to reset it to normal
128
- * @param {number} pitch set the pitch of the filter
129
- * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
130
- *
131
- * @example
132
- * ```ts
133
- * // Set Pitch to 1.25 (disableds nightcore and vaporwave effect which are pre-made timescale settings of rate,pitch and speed)
134
- * await player.filterManager.setPitch(1.25);
135
- * ```
136
- */
137
- setPitch(pitch?: number): Promise<FilterManager>;
138
- /**
139
- * Set custom filter.timescale#rate . This method disabled both: nightcore & vaporwave. use 1 to reset it to normal
140
- * @param {number} rate set the rate of the filter
141
- * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
142
- *
143
- * @example
144
- * ```ts
145
- * // Set Rate to 1.25 (disableds nightcore and vaporwave effect which are pre-made timescale settings of rate,pitch and speed)
146
- * await player.filterManager.setRate(1.25);
147
- * ```
148
- */
149
- setRate(rate?: number): Promise<FilterManager>;
150
- /**
151
- * Enables / Disables the rotation effect, (Optional: provide your Own Data)
152
- * @param {number} rotationHz set the rotationHz of the filter
153
- * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
154
- *
155
- * @example
156
- * ```ts
157
- * // Toggle Rotation filter with custom settings
158
- * await player.filterManager.toggleRotation(0.4);
159
- * // or use the defaults
160
- * await player.filterManager.toggleRotation();
161
- * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
162
- * ```
163
- */
164
- toggleRotation(rotationHz?: number): Promise<FilterManager>;
165
- /**
166
- * Enables / Disables the Vibrato effect, (Optional: provide your Own Data)
167
- * @param {number} frequency set the frequency of the filter
168
- * @param {number} depth set the depth of the filter
169
- * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
170
- *
171
- * @example
172
- * ```ts
173
- * // Toggle Vibrato filter with custom settings
174
- * await player.filterManager.toggleVibrato(8, 0.5);
175
- * // or use the defaults
176
- * await player.filterManager.toggleVibrato();
177
- * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
178
- * ```
179
- */
180
- toggleVibrato(frequency?: number, depth?: number): Promise<FilterManager>;
181
- /**
182
- * Enables / Disables the Tremolo effect, (Optional: provide your Own Data)
183
- * @param {number} frequency set the frequency of the filter
184
- * @param {number} depth set the depth of the filter
185
- * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
186
- *
187
- * @example
188
- * ```ts
189
- * // Toggle Tremolo filter with custom settings
190
- * await player.filterManager.toggleTremolo(5, 0.7);
191
- * // or use the defaults
192
- * await player.filterManager.toggleTremolo();
193
- * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
194
- * ```
195
- */
196
- toggleTremolo(frequency?: number, depth?: number): Promise<FilterManager>;
197
- /**
198
- * Enables / Disables the LowPass effect, (Optional: provide your Own Data)
199
- * @param {number} smoothing set the smoothing of the filter
200
- * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
201
- *
202
- * @example
203
- * ```ts
204
- * // Toggle LowPass filter with custom settings
205
- * await player.filterManager.toggleLowPass(30);
206
- * // or use the defaults
207
- * await player.filterManager.toggleLowPass();
208
- * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
209
- * ```
210
- */
211
- toggleLowPass(smoothing?: number): Promise<FilterManager>;
212
- /**
213
- * Lavalink LavaDspx Plugin Filters
214
- */
215
- lavalinkLavaDspxPlugin: {
216
- /**
217
- * Enables / Disables the LowPass effect, (Optional: provide your Own Data)
218
- * @param {number} boostFactor set the boost factor of the filter
219
- * @param {number} cutoffFrequency set the cutoff frequency of the filter
220
- * @returns {Promise<boolean>} the state of the filter after execution.
221
- *
222
- * @example
223
- * ```ts
224
- * // Toggle LowPass filter with custom settings
225
- * await player.filterManager.lavalinkLavaDspxPlugin.toggleLowPass(1.2, 300);
226
- * // or use the defaults
227
- * await player.filterManager.lavalinkLavaDspxPlugin.toggleLowPass();
228
- * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
229
- * ```
230
- */
231
- toggleLowPass: (boostFactor?: number, cutoffFrequency?: number) => Promise<FilterManager>;
232
- /**
233
- * Enables / Disables the HighPass effect, (Optional: provide your Own Data)
234
- * @param {number} boostFactor [] set the boost factor of the filter
235
- * @param {number} cutoffFrequency set the cutoff frequency of the filter
236
- * @returns {Promise<boolean>} the state of the filter after execution.
237
- *
238
- * @example
239
- * ```ts
240
- * // Toggle HighPass filter with custom settings
241
- * await player.filterManager.lavalinkLavaDspxPlugin.toggleHighPass(1.2, 150); // custom values
242
- * // or use the defaults
243
- * await player.filterManager.lavalinkLavaDspxPlugin.toggleHighPass();
244
- * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
245
- * ```
246
- */
247
- toggleHighPass: (boostFactor?: number, cutoffFrequency?: number) => Promise<FilterManager>;
248
- /**
249
- * Enables / Disables the Normalization effect.
250
- * @param {number} [maxAmplitude=0.75] - The maximum amplitude of the audio.
251
- * @param {boolean} [adaptive=true] Whether to use adaptive normalization or not.
252
- * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
253
- *
254
- * @example
255
- * ```ts
256
- * // Toggle Normalization filter with custom settings
257
- * await player.filterManager.lavalinkLavaDspxPlugin.toggleNormalization(0.9, false); // custom values
258
- * // or use the defaults
259
- * await player.filterManager.lavalinkLavaDspxPlugin.toggleNormalization();
260
- * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
261
- * ```
262
- */
263
- toggleNormalization: (maxAmplitude?: number, adaptive?: boolean) => Promise<FilterManager>;
264
- /**
265
- * Enables / Disables the Echo effect, IMPORTANT! Only works with the correct Lavalink Plugin installed. (Optional: provide your Own Data)
266
- * @param {number} [decay=0.5] The decay of the echo effect.
267
- * @param {number} [echoLength=0.5] The length of the echo effect.
268
- * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
269
- *
270
- * @example
271
- * ```ts
272
- * // Toggle Echo filter with custom settings
273
- * await player.filterManager.lavalinkLavaDspxPlugin.toggleEcho(0.7, 0.6); // custom values
274
- * // or use the defaults
275
- * await player.filterManager.lavalinkLavaDspxPlugin.toggleEcho();
276
- * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
277
- * ```
278
- */
279
- toggleEcho: (decay?: number, echoLength?: number) => Promise<FilterManager>;
280
- };
281
- /**
282
- * LavalinkFilter Plugin specific Filters
283
- */
284
- lavalinkFilterPlugin: {
285
- /**
286
- * Enables / Disables the Echo effect, IMPORTANT! Only works with the correct Lavalink Plugin installed. (Optional: provide your Own Data)
287
- * @param {number} delay set the delay of the echo
288
- * @param {number} decay set the decay of the echo
289
- * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
290
- *
291
- * @example
292
- * ```ts
293
- * // Toggle Echo filter with custom settings
294
- * await player.filterManager.lavalinkFilterPlugin.toggleEcho(3, 0.7); // custom values
295
- * // or use the defaults
296
- * await player.filterManager.lavalinkFilterPlugin.toggleEcho();
297
- * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
298
- * ```
299
- */
300
- toggleEcho: (delay?: number, decay?: number) => Promise<FilterManager>;
301
- /**
302
- * Enables / Disables the Echo effect, IMPORTANT! Only works with the correct Lavalink Plugin installed. (Optional: provide your Own Data)
303
- * @param {number} delays set the delays of the reverb
304
- * @param {number} gains set the gains of the reverb
305
- * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
306
- *
307
- * @example
308
- * ```ts
309
- * // Toggle Reverb filter with custom settings
310
- * await player.filterManager.lavalinkFilterPlugin.toggleReverb([0.04, 0.045, 0.05, 0.055], [0.85, 0.84, 0.83, 0.82]);
311
- * // or use the defaults
312
- * await player.filterManager.lavalinkFilterPlugin.toggleReverb();
313
- * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
314
- * ```
315
- */
316
- toggleReverb: (delays?: number[], gains?: number[]) => Promise<FilterManager>;
317
- };
318
- /**
319
- * Enables / Disables a Nightcore-like filter Effect. Disables/Overrides both: custom and Vaporwave Filter
320
- * @param {number} speed set the speed of the filter
321
- * @param {number} pitch set the pitch of the filter
322
- * @param {number} rate set the rate of the filter
323
- * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
324
- *
325
- * @example
326
- * ```ts
327
- * // Toggle Nightcore filter with custom settings
328
- * await player.filterManager.toggleNightcore(1.3, 1.3, 0.9);
329
- * // or use the defaults
330
- * await player.filterManager.toggleNightcore();
331
- * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
332
- * ```
333
- */
334
- toggleNightcore(speed?: number, pitch?: number, rate?: number): Promise<FilterManager>;
335
- /**
336
- * Enables / Disables a Vaporwave-like filter Effect. Disables/Overrides both: custom and nightcore Filter
337
- * @param {number} speed set the speed of the filterq
338
- * @param {number} pitch set the pitch of the filter
339
- * @param {number} rate set the rate of the filter
340
- * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
341
- *
342
- * @example
343
- * ```ts
344
- * // Toggle Vaporwave filter with custom settings
345
- * await player.filterManager.toggleVaporwave(0.9, 0.7, 1);
346
- * // or use the defaults
347
- * await player.filterManager.toggleVaporwave();
348
- * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
349
- * ```
350
- */
351
- toggleVaporwave(speed?: number, pitch?: number, rate?: number): Promise<FilterManager>;
352
- /**
353
- * Enable / Disables a Karaoke like Filter Effect
354
- * @param {number} level set the level of the filter
355
- * @param {number} monoLevel set the mono level of the filter
356
- * @param {number} filterBand set the filter band of the filter
357
- * @param {number} filterWidth set the filter width of the filter
358
- * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
359
- *
360
- * @example
361
- * ```ts
362
- * // Toggle Karaoke filter with custom settings
363
- * await player.filterManager.toggleKaraoke(1.5, 1.0, 220, 100);
364
- * // or use the defaults
365
- * await player.filterManager.toggleKaraoke();
366
- * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
367
- * ```
368
- */
369
- toggleKaraoke(level?: number, monoLevel?: number, filterBand?: number, filterWidth?: number): Promise<FilterManager>;
370
- /**
371
- * Function to find out if currently there is a custom timescamle etc. filter applied
372
- * @returns {boolean} whether a custom filter is active
373
- *
374
- * @example
375
- * ```ts
376
- * // Check if a custom filter is active
377
- * const isCustom = player.filterManager.isCustomFilterActive();
378
- * console.log(`Is custom filter active? ${isCustom}`);
379
- * ```
380
- */
381
- isCustomFilterActive(): boolean;
382
- /**
383
- * Sets the players equalizer bands using one of the predefined presets.
384
- * @param {keyof typeof EQList} preset The preset to use.
385
- * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
386
- *
387
- * @example
388
- * ```ts
389
- * // Set EQ preset
390
- * await player.filterManager.setEQPreset('BassboostMedium');
391
- * ```
392
- */
393
- setEQPreset(preset: keyof typeof EQList): Promise<this>;
394
- /**
395
- * Sets the players equalizer band on-top of the existing ones.
396
- * @param {number} bands
397
- * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
398
- *
399
- * @example
400
- * ```ts
401
- * // Set EQ bands
402
- * await player.filterManager.setEQ([
403
- * { band: 0, gain: 0.3 },
404
- * { band: 1, gain: -0.2 },
405
- * { band: 2, gain: 0.1 }
406
- * ]);
407
- *
408
- * // or use one of the templates:
409
- * await player.filterManager.setEQ(player.filterManager.EQList.BassboostMedium); // you can also import EQList from somewhere package if wanted.
410
- * ```
411
- */
412
- setEQ(bands: EQBand | EQBand[]): Promise<this>;
413
- /**
414
- * Clears the equalizer bands.
415
- * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
416
- *
417
- * @example
418
- * ```ts
419
- * // Clear all EQ bands
420
- * await player.filterManager.clearEQ();
421
- * ```
422
- */
423
- clearEQ(): Promise<this>;
424
- }
425
-
426
- /** Sourcenames provided by lavalink server */
427
- type LavalinkSourceNames = "youtube" | "youtubemusic" | "soundcloud" | "bandcamp" | "twitch";
428
- /** Source Names provided by lava src plugin */
429
- type LavalinkPlugin_LavaSrc_SourceNames = "deezer" | "spotify" | "applemusic" | "yandexmusic" | "flowery-tts" | "vkmusic" | "tidal" | "qobuz" | "pandora";
430
- /** Source Names provided by jiosaavan plugin */
431
- type LavalinkPlugin_JioSaavn_SourceNames = "jiosaavn";
432
- /** The SourceNames provided by lavalink */
433
- type SourceNames = LavalinkSourceNames | LavalinkPlugin_LavaSrc_SourceNames | LavalinkPlugin_JioSaavn_SourceNames;
434
- interface LavalinkTrackInfo {
435
- /** The Identifier of the Track */
436
- identifier: string;
437
- /** The Track Title / Name */
438
- title: string;
439
- /** The Name of the Author */
440
- author: string;
441
- /** The duration of the Track */
442
- length: number;
443
- /** The URL of the artwork if available */
444
- artworkUrl: string | null;
445
- /** The URL (aka Link) of the Track called URI */
446
- uri: string;
447
- /** The Source name of the Track, e.g. soundcloud, youtube, spotify */
448
- sourceName: SourceNames;
449
- /** Whether the audio is seekable */
450
- isSeekable: boolean;
451
- /** Whether the audio is of a live stream */
452
- isStream: boolean;
453
- /** If isrc code is available, it's provided */
454
- isrc: string | null;
455
- }
456
- interface TrackInfo {
457
- /** The Identifier of the Track */
458
- identifier: string;
459
- /** The Track Title / Name */
460
- title: string;
461
- /** The Name of the Author */
462
- author: string;
463
- /** The duration of the Track */
464
- duration: number;
465
- /** The URL of the artwork if available */
466
- artworkUrl: string | null;
467
- /** The URL (aka Link) of the Track called URI */
468
- uri: string;
469
- /** The Source name of the Track, e.g. soundcloud, youtube, spotify */
470
- sourceName: SourceNames;
471
- /** Whether the audio is seekable */
472
- isSeekable: boolean;
473
- /** Whether the audio is of a live stream */
474
- isStream: boolean;
475
- /** If isrc code is available, it's provided */
476
- isrc: string | null;
477
- }
478
- interface PluginInfo {
479
- /** The Type provided by a plugin */
480
- type?: "album" | "playlist" | "artist" | "recommendations" | string;
481
- /** The Identifier provided by a plugin */
482
- albumName?: string;
483
- /** The url of the album */
484
- albumUrl?: string;
485
- /** The url of the album art */
486
- albumArtUrl?: string;
487
- /** The url of the artist */
488
- artistUrl?: string;
489
- /** The url of the artist artwork */
490
- artistArtworkUrl?: string;
491
- /** The url of the preview */
492
- previewUrl?: string;
493
- /** Whether the track is a preview */
494
- isPreview?: boolean;
495
- /** The total number of tracks in the playlist */
496
- totalTracks?: number;
497
- /** The Identifier provided by a plugin */
498
- identifier?: string;
499
- /** The ArtworkUrl provided by a plugin */
500
- artworkUrl?: string;
501
- /** The Author Information provided by a plugin */
502
- author?: string;
503
- /** The Url provided by a Plugin */
504
- url?: string;
505
- /** The Url provided by a Plugin */
506
- uri?: string;
507
- /** You can put specific track information here, to transform the tracks... */
508
- clientData?: {
509
- previousTrack?: boolean;
510
- [key: string]: any;
511
- };
512
- }
513
- interface LavalinkTrack {
514
- /** The Base 64 encoded String */
515
- encoded?: Base64;
516
- /** Track Information */
517
- info: LavalinkTrackInfo;
518
- /** Plugin Information from Lavalink */
519
- pluginInfo: Partial<PluginInfo>;
520
- /** The userData Object from when you provide to the lavalink request */
521
- userData?: anyObject;
522
- }
523
- interface TrackRequester {
524
- }
525
- interface Track {
526
- /** The Base 64 encoded String */
527
- encoded?: Base64;
528
- /** Track Information */
529
- info: TrackInfo;
530
- /** Plugin Information from Lavalink */
531
- pluginInfo: Partial<PluginInfo>;
532
- /** The Track's Requester */
533
- requester?: TrackRequester;
534
- /** The userData Object from when you provide to the lavalink request */
535
- userData?: anyObject;
536
- }
537
- interface UnresolvedTrackInfo extends Partial<TrackInfo> {
538
- /** Required */
539
- title: string;
540
- }
541
- interface UnresolvedQuery extends UnresolvedTrackInfo {
542
- /** The base64 of the unresolved track to "encode" */
543
- encoded?: Base64;
544
- }
545
- interface UnresolvedTrack {
546
- /** Required */
547
- resolve: (player: Player) => Promise<void>;
548
- /** The Base 64 encoded String */
549
- encoded?: Base64;
550
- /** Track Information */
551
- info: UnresolvedTrackInfo;
552
- /** Plugin Information from Lavalink */
553
- pluginInfo: Partial<PluginInfo>;
554
- /** The userData Object from when you provide to the lavalink request */
555
- userData?: anyObject;
556
- /** The Track's Requester */
557
- requester?: TrackRequester;
558
- }
559
-
560
- interface StoredQueue {
561
- current: Track | null;
562
- previous: Track[];
563
- tracks: (Track | UnresolvedTrack)[];
564
- }
565
- interface QueueStoreManager {
566
- /** @async get a Value (MUST RETURN UNPARSED!) */
567
- get: (guildId: string) => Awaitable<StoredQueue | string | undefined>;
568
- /** @async Set a value inside a guildId (MUST BE UNPARSED) */
569
- set: (guildId: string, value: StoredQueue | string) => Awaitable<void | boolean>;
570
- /** @async Delete a Database Value based of it's guildId */
571
- delete: (guildId: string) => Awaitable<void | boolean>;
572
- /** @async Transform the value(s) inside of the QueueStoreManager (IF YOU DON'T NEED PARSING/STRINGIFY, then just return the value) */
573
- stringify: (value: StoredQueue | string) => Awaitable<StoredQueue | string>;
574
- /** @async Parse the saved value back to the Queue (IF YOU DON'T NEED PARSING/STRINGIFY, then just return the value) */
575
- parse: (value: StoredQueue | string) => Awaitable<Partial<StoredQueue>>;
576
- }
577
- interface ManagerQueueOptions {
578
- /** Maximum Amount of tracks for the queue.previous array. Set to 0 to not save previous songs. Defaults to 25 Tracks */
579
- maxPreviousTracks?: number;
580
- /** Custom Queue Store option */
581
- queueStore?: QueueStoreManager;
582
- /** Custom Queue Watcher class */
583
- queueChangesWatcher?: QueueChangesWatcher;
584
- }
585
- interface QueueChangesWatcher {
586
- /** get a Value (MUST RETURN UNPARSED!) */
587
- tracksAdd: (guildId: string, tracks: (Track | UnresolvedTrack)[], position: number, oldStoredQueue: StoredQueue, newStoredQueue: StoredQueue) => void;
588
- /** Set a value inside a guildId (MUST BE UNPARSED) */
589
- tracksRemoved: (guildId: string, tracks: (Track | UnresolvedTrack)[], position: number | number[], oldStoredQueue: StoredQueue, newStoredQueue: StoredQueue) => void;
590
- /** Set a value inside a guildId (MUST BE UNPARSED) */
591
- shuffled: (guildId: string, oldStoredQueue: StoredQueue, newStoredQueue: StoredQueue) => void;
592
- }
593
-
594
- declare class QueueSaver {
595
- /**
596
- * The queue store manager
597
- */
598
- private _;
599
- /**
600
- * The options for the queue saver
601
- */
602
- options: {
603
- maxPreviousTracks: number;
604
- };
605
- constructor(options: ManagerQueueOptions);
606
- /**
607
- * Get the queue for a guild
608
- * @param guildId The guild ID
609
- * @returns The queue for the guild
610
- */
611
- get(guildId: string): Promise<Partial<StoredQueue>>;
612
- /**
613
- * Delete the queue for a guild
614
- * @param guildId The guild ID
615
- * @returns The queue for the guild
616
- */
617
- delete(guildId: string): Promise<boolean | void>;
618
- /**
619
- * Set the queue for a guild
620
- * @param guildId The guild ID
621
- * @param valueToStringify The queue to set
622
- * @returns The queue for the guild
623
- */
624
- set(guildId: string, valueToStringify: StoredQueue): Promise<boolean | void>;
625
- /**
626
- * Sync the queue for a guild
627
- * @param guildId The guild ID
628
- * @returns The queue for the guild
629
- */
630
- sync(guildId: string): Promise<Partial<StoredQueue>>;
631
- }
632
- declare class DefaultQueueStore implements QueueStoreManager {
633
- private data;
634
- constructor();
635
- /**
636
- * Get the queue for a guild
637
- * @param guildId The guild ID
638
- * @returns The queue for the guild
639
- */
640
- get(guildId: string): StoredQueue | undefined;
641
- /**
642
- * Set the queue for a guild
643
- * @param guildId The guild ID
644
- * @param valueToStringify The queue to set
645
- * @returns The queue for the guild
646
- */
647
- set(guildId: string, valueToStringify: any): boolean;
648
- /**
649
- * Delete the queue for a guild
650
- * @param guildId The guild ID
651
- * @returns The queue for the guild
652
- */
653
- delete(guildId: string): boolean;
654
- /**
655
- * Stringify the queue for a guild
656
- * @param value The queue to stringify
657
- * @returns The stringified queue
658
- */
659
- stringify(value: StoredQueue | string): StoredQueue | string;
660
- /**
661
- * Parse the queue for a guild
662
- * @param value The queue to parse
663
- * @returns The parsed queue
664
- */
665
- parse(value: StoredQueue | string): Partial<StoredQueue>;
666
- }
667
- declare class Queue {
668
- readonly tracks: (Track | UnresolvedTrack)[];
669
- readonly previous: Track[];
670
- current: Track | null;
671
- options: {
672
- maxPreviousTracks: number;
673
- };
674
- private readonly guildId;
675
- private readonly QueueSaver;
676
- private managerUtils;
677
- private queueChanges;
678
- /**
679
- * Create a new Queue
680
- * @param guildId The guild ID
681
- * @param data The data to initialize the queue with
682
- * @param QueueSaver The queue saver to use
683
- * @param queueOptions
684
- */
685
- constructor(guildId: string, data?: Partial<StoredQueue>, QueueSaver?: QueueSaver, queueOptions?: ManagerQueueOptions);
686
- /**
687
- * Utils for a Queue
688
- */
689
- utils: {
690
- /**
691
- * Save the current cached Queue on the database/server (overides the server)
692
- */
693
- save: () => Promise<boolean | void>;
694
- /**
695
- * Sync the current queue database/server with the cached one
696
- * @returns {void}
697
- */
698
- sync: (override?: boolean, dontSyncCurrent?: boolean) => Promise<void>;
699
- destroy: () => Promise<boolean | void>;
700
- /**
701
- * @returns {{current:Track|null, previous:Track[], tracks:Track[]}}The Queue, but in a raw State, which allows easier handling for the QueueStoreManager
702
- */
703
- toJSON: () => StoredQueue;
704
- /**
705
- * Get the Total Duration of the Queue-Songs summed up
706
- * @returns {number}
707
- */
708
- totalDuration: () => number;
709
- /**
710
- * Find tracks in the queue matching specific criteria.
711
- * **This method DOES NOT MUTATE the queue** - it returns a new array without modifying the original queue.
712
- * @param predicate Function to test each track, or an object with criteria to match
713
- * @returns Array of matching tracks with their indexes
714
- *
715
- * @example
716
- * ```ts
717
- * // Find by author
718
- * const artistTracks = player.queue.utils.filterTracks({ author: "Artist Name" });
719
- *
720
- * // Find by duration range (5-10 minutes)
721
- * const longTracks = player.queue.utils.filterTracks({ duration: { min: 300000, max: 600000 } });
722
- *
723
- * // Find by title (partial match)
724
- * const titleMatches = player.queue.utils.filterTracks({ title: "Never Gonna" });
725
- *
726
- * // Custom predicate
727
- * const customFilter = player.queue.utils.filterTracks(track => track.info.isStream);
728
- * ```
729
- */
730
- filterTracks: (predicate: ((track: Track | UnresolvedTrack, index: number) => boolean) | {
731
- title?: string;
732
- author?: string;
733
- duration?: number | {
734
- min?: number;
735
- max?: number;
736
- };
737
- uri?: string;
738
- identifier?: string;
739
- sourceName?: string;
740
- isStream?: boolean;
741
- isSeekable?: boolean;
742
- }) => Array<{
743
- track: Track | UnresolvedTrack;
744
- index: number;
745
- }>;
746
- /**
747
- * Find a single track in the queue matching specific criteria.
748
- * **This method DOES NOT MUTATE the queue** - it searches without modifying the original queue.
749
- * @param predicate Function to test each track, or an object with criteria to match
750
- * @returns First matching track with its index, or null if not found
751
- *
752
- * @example
753
- * ```ts
754
- * // Find first track by author
755
- * const track = player.queue.utils.findTrack({ author: "Artist Name" });
756
- * if (track) {
757
- * console.log(`Found at index ${track.index}: ${track.track.info.title}`);
758
- * }
759
- *
760
- * // Find with custom predicate
761
- * const liveStream = player.queue.utils.findTrack(track => track.info.isStream);
762
- * ```
763
- */
764
- findTrack: (predicate: ((track: Track | UnresolvedTrack, index: number) => boolean) | {
765
- title?: string;
766
- author?: string;
767
- duration?: number | {
768
- min?: number;
769
- max?: number;
770
- };
771
- uri?: string;
772
- identifier?: string;
773
- sourceName?: string;
774
- isStream?: boolean;
775
- isSeekable?: boolean;
776
- }) => {
777
- track: Track | UnresolvedTrack;
778
- index: number;
779
- } | null;
780
- };
781
- /**
782
- * Shuffles the current Queue, then saves it
783
- * @returns Amount of Tracks in the Queue
784
- */
785
- shuffle(): Promise<number>;
786
- /**
787
- * Add a Track to the Queue, and after saved in the "db" it returns the amount of the Tracks
788
- * @param {Track | Track[]} TrackOrTracks
789
- * @param {number} index At what position to add the Track
790
- * @returns {number} Queue-Size (for the next Tracks)
791
- */
792
- add(TrackOrTracks: Track | UnresolvedTrack | (Track | UnresolvedTrack)[], index?: number): any;
793
- /**
794
- * Splice the tracks in the Queue
795
- * @param {number} index Where to remove the Track
796
- * @param {number} amount How many Tracks to remove?
797
- * @param {Track | Track[]} TrackOrTracks Want to Add more Tracks?
798
- * @returns {Track} Spliced Track
799
- */
800
- splice(index: number, amount: number, TrackOrTracks?: Track | UnresolvedTrack | (Track | UnresolvedTrack)[]): any;
801
- /**
802
- * Remove stuff from the queue.tracks array
803
- * - single Track | UnresolvedTrack
804
- * - multiple Track | UnresovedTrack
805
- * - at the index or multiple indexes
806
- * - Since v2.7 the removed tracks get unshifted into the previous queue state instead of pushed (indexed at the start instead of end - as it should)
807
- * @param removeQueryTrack
808
- * @returns null (if nothing was removed) / { removed } where removed is an array with all removed elements
809
- *
810
- * @example
811
- * ```js
812
- * // remove single track
813
- *
814
- * const track = player.queue.tracks[4];
815
- * await player.queue.remove(track);
816
- *
817
- * // if you already have the index you can straight up pass it too
818
- * await player.queue.remove(4);
819
- *
820
- *
821
- * // if you want to remove multiple tracks, e.g. from position 4 to position 10 you can do smt like this
822
- * await player.queue.remove(player.queue.tracks.slice(4, 10)) // get's the tracks from 4 - 10, which then get's found in the remove function to be removed
823
- *
824
- * // I still highly suggest to use .splice!
825
- *
826
- * await player.queue.splice(4, 10); // removes at index 4, 10 tracks
827
- *
828
- * await player.queue.splice(1, 1); // removes at index 1, 1 track
829
- *
830
- * await player.queue.splice(4, 0, ...tracks) // removes 0 tracks at position 4, and then inserts all tracks after position 4.
831
- * ```
832
- */
833
- remove<T extends Track | UnresolvedTrack | number | Track[] | UnresolvedTrack[] | number[] | (number | Track | UnresolvedTrack)[]>(removeQueryTrack: T): Promise<{
834
- removed: (Track | UnresolvedTrack)[];
835
- } | null>;
836
- /**
837
- * Shifts the previous array, to return the last previous track & thus remove it from the previous queue
838
- * @returns
839
- *
840
- * @example
841
- * ```js
842
- * // example on how to play the previous track again
843
- * const previous = await player.queue.shiftPrevious(); // get the previous track and remove it from the previous queue array!!
844
- * if(!previous) return console.error("No previous track found");
845
- * await player.play({ clientTrack: previous }); // play it again
846
- * ```
847
- */
848
- shiftPrevious(): Promise<Track>;
849
- /**
850
- * Find tracks in the queue matching specific criteria.
851
- * **This method DOES NOT MUTATE the queue** - it returns a new array without modifying the original queue.
852
- * @deprecated Use `player.queue.utils.filterTracks()` instead.
853
- * @param predicate Function to test each track, or an object with criteria to match
854
- * @returns Array of matching tracks with their indexes
855
- *
856
- * @example
857
- * ```ts
858
- * // Use the new method instead:
859
- * const artistTracks = player.queue.utils.filterTracks({ author: "Artist Name" });
860
- * ```
861
- */
862
- filter(predicate: ((track: Track | UnresolvedTrack, index: number) => boolean) | {
863
- title?: string;
864
- author?: string;
865
- duration?: number | {
866
- min?: number;
867
- max?: number;
868
- };
869
- uri?: string;
870
- identifier?: string;
871
- sourceName?: string;
872
- isStream?: boolean;
873
- isSeekable?: boolean;
874
- }): Array<{
875
- track: Track | UnresolvedTrack;
876
- index: number;
877
- }>;
878
- /**
879
- * Find a single track in the queue matching specific criteria.
880
- * **This method DOES NOT MUTATE the queue** - it searches without modifying the original queue.
881
- * @deprecated Use `player.queue.utils.findTrack()` instead.
882
- * @param predicate Function to test each track, or an object with criteria to match
883
- * @returns First matching track with its index, or null if not found
884
- *
885
- * @example
886
- * ```ts
887
- * // Use the new method instead:
888
- * const track = player.queue.utils.findTrack({ author: "Artist Name" });
889
- * ```
890
- */
891
- find(predicate: ((track: Track | UnresolvedTrack, index: number) => boolean) | {
892
- title?: string;
893
- author?: string;
894
- duration?: number | {
895
- min?: number;
896
- max?: number;
897
- };
898
- uri?: string;
899
- identifier?: string;
900
- sourceName?: string;
901
- isStream?: boolean;
902
- isSeekable?: boolean;
903
- }): {
904
- track: Track | UnresolvedTrack;
905
- index: number;
906
- } | null;
907
- /**
908
- * Sort the queue tracks by a specific property.
909
- * **⚠️ This method MUTATES the queue** - it modifies the original queue in place.
910
- * @param sortBy Property to sort by or custom comparator function
911
- * @param order Sort order: 'asc' or 'desc' (default: 'asc')
912
- * @returns The queue instance for chaining
913
- *
914
- * @example
915
- * ```ts
916
- * // Sort by duration (shortest first)
917
- * await player.queue.sortBy("duration", "asc");
918
- *
919
- * // Sort by title alphabetically (Z-A)
920
- * await player.queue.sortBy("title", "desc");
921
- *
922
- * // Custom sorting
923
- * await player.queue.sortBy((a, b) => {
924
- * return a.info.title.localeCompare(b.info.title);
925
- * });
926
- * ```
927
- */
928
- sortBy(sortBy: "duration" | "title" | "author" | ((a: Track | UnresolvedTrack, b: Track | UnresolvedTrack) => number), order?: "asc" | "desc"): Promise<this>;
929
- /**
930
- * Get a sorted copy of the queue tracks without modifying the original queue.
931
- * **This method DOES NOT MUTATE the queue** - it returns a new sorted array, similar to `Array.toSorted()`.
932
- * @param sortBy Property to sort by or custom comparator function
933
- * @param order Sort order: 'asc' or 'desc' (default: 'asc')
934
- * @returns A new sorted array of tracks (does not modify the queue)
935
- *
936
- * @example
937
- * ```ts
938
- * // Get sorted copy by duration (shortest first)
939
- * const sortedTracks = player.queue.toSortedBy("duration", "asc");
940
- * // Original queue remains unchanged
941
- *
942
- * // Get sorted copy by title alphabetically (Z-A)
943
- * const sortedByTitle = player.queue.toSortedBy("title", "desc");
944
- *
945
- * // Custom sorting
946
- * const customSorted = player.queue.toSortedBy((a, b) => {
947
- * return a.info.title.localeCompare(b.info.title);
948
- * });
949
- * ```
950
- */
951
- toSortedBy(sortBy: "duration" | "title" | "author" | ((a: Track | UnresolvedTrack, b: Track | UnresolvedTrack) => number), order?: "asc" | "desc"): (Track | UnresolvedTrack)[];
952
- /**
953
- * Get a range of tracks from the queue.
954
- * **This method DOES NOT MUTATE the queue** - it returns a new array slice, similar to `Array.slice()`.
955
- * @param start Start index (inclusive)
956
- * @param end End index (exclusive)
957
- * @returns Array of tracks in the specified range
958
- *
959
- * @example
960
- * ```ts
961
- * // Get tracks 5-15
962
- * const tracks = player.queue.getTracks(5, 15);
963
- *
964
- * // Get first 10 tracks
965
- * const firstTen = player.queue.getTracks(0, 10);
966
- * ```
967
- */
968
- getTracks(start: number, end?: number): (Track | UnresolvedTrack)[];
4
+ /**
5
+ * Debug events for more detailed logging
6
+ */
7
+ declare enum DebugEvents {
8
+ SetSponsorBlock = "SetSponsorBlock",
9
+ DeleteSponsorBlock = "DeleteSponsorBlock",
10
+ TrackEndReplaced = "TrackEndReplaced",
11
+ AutoplayExecution = "AutoplayExecution",
12
+ AutoplayNoSongsAdded = "AutoplayNoSongsAdded",
13
+ AutoplayThresholdSpamLimiter = "AutoplayThresholdSpamLimiter",
14
+ TriggerQueueEmptyInterval = "TriggerQueueEmptyInterval",
15
+ QueueEnded = "QueueEnded",
16
+ TrackStartNewSongsOnly = "TrackStartNewSongsOnly",
17
+ TrackStartNoTrack = "TrackStartNoTrack",
18
+ ResumingFetchingError = "ResumingFetchingError",
19
+ PlayerUpdateNoPlayer = "PlayerUpdateNoPlayer",
20
+ PlayerUpdateFilterFixApply = "PlayerUpdateFilterFixApply",
21
+ PlayerUpdateSuccess = "PlayerUpdateSuccess",
22
+ HeartBeatTriggered = "HeartBeatTriggered",
23
+ NoSocketOnDestroy = "NoSocketOnDestroy",
24
+ SocketCleanupError = "SocketCleanupError",
25
+ SocketTerminateHeartBeatTimeout = "SocketTerminateHeartBeatTimeout",
26
+ TryingConnectWhileConnected = "TryingConnectWhileConnected",
27
+ LavaSearchNothingFound = "LavaSearchNothingFound",
28
+ SearchNothingFound = "SearchNothingFound",
29
+ ValidatingBlacklistLinks = "ValidatingBlacklistLinks",
30
+ ValidatingWhitelistLinks = "ValidatingWhitelistLinks",
31
+ TrackErrorMaxTracksErroredPerTime = "TrackErrorMaxTracksErroredPerTime",
32
+ TrackStuckMaxTracksErroredPerTime = "TrackStuckMaxTracksErroredPerTime",
33
+ PlayerDestroyingSomewhereElse = "PlayerDestroyingSomewhereElse",
34
+ PlayerCreateNodeNotFound = "PlayerCreateNodeNotFound",
35
+ PlayerPlayQueueEmptyTimeoutClear = "PlayerPlayQueueEmptyTimeoutClear",
36
+ PlayerPlayWithTrackReplace = "PlayerPlayWithTrackReplace",
37
+ PlayerPlayUnresolvedTrack = "PlayerPlayUnresolvedTrack",
38
+ PlayerPlayUnresolvedTrackFailed = "PlayerPlayUnresolvedTrackFailed",
39
+ PlayerVolumeAsFilter = "PlayerVolumeAsFilter",
40
+ BandcampSearchLokalEngine = "BandcampSearchLokalEngine",
41
+ PlayerChangeNode = "PlayerChangeNode",
42
+ BuildTrackError = "BuildTrackError",
43
+ TransformRequesterFunctionFailed = "TransformRequesterFunctionFailed",
44
+ GetClosestTrackFailed = "GetClosestTrackFailed",
45
+ PlayerDeleteInsteadOfDestroy = "PlayerDeleteInsteadOfDestroy",
46
+ FailedToConnectToNodes = "FailedToConnectToNodes",
47
+ NoAudioDebug = "NoAudioDebug",
48
+ PlayerAutoReconnect = "PlayerAutoReconnect",
49
+ PlayerDestroyFail = "PlayerDestroyFail",
50
+ PlayerChangeNodeFailNoEligibleNode = "PlayerChangeNodeFailNoEligibleNode",
51
+ PlayerChangeNodeFail = "PlayerChangeNodeFail"
52
+ }
53
+ /**
54
+ * Reasons why a player got destroyed
55
+ */
56
+ declare enum DestroyReasons {
57
+ QueueEmpty = "QueueEmpty",
58
+ NodeDestroy = "NodeDestroy",
59
+ NodeDeleted = "NodeDeleted",
60
+ LavalinkNoVoice = "LavalinkNoVoice",
61
+ NodeReconnectFail = "NodeReconnectFail",
62
+ Disconnected = "Disconnected",
63
+ PlayerReconnectFail = "PlayerReconnectFail",
64
+ PlayerChangeNodeFail = "PlayerChangeNodeFail",
65
+ PlayerChangeNodeFailNoEligibleNode = "PlayerChangeNodeFailNoEligibleNode",
66
+ ChannelDeleted = "ChannelDeleted",
67
+ DisconnectAllNodes = "DisconnectAllNodes",
68
+ ReconnectAllNodes = "ReconnectAllNodes",
69
+ TrackErrorMaxTracksErroredPerTime = "TrackErrorMaxTracksErroredPerTime",
70
+ TrackStuckMaxTracksErroredPerTime = "TrackStuckMaxTracksErroredPerTime"
71
+ }
72
+ /**
73
+ * Reasons why a player got disconnected
74
+ */
75
+ declare enum DisconnectReasons {
76
+ Disconnected = "Disconnected",
77
+ DisconnectAllNodes = "DisconnectAllNodes"
969
78
  }
79
+ /** The valid SponsorBlock categories */
80
+ declare const validSponsorBlocks: string[];
81
+ /** The audio Outputs Data map declaration */
82
+ declare const audioOutputsData: Record<AudioOutputs, ChannelMixFilter>;
83
+ /** Equalizer Presets */
84
+ declare const EQList: {
85
+ /** A Bassboost Equalizer, so high it distorts the audio */
86
+ BassboostEarrape: EQBand[];
87
+ /** A High and decent Bassboost Equalizer */
88
+ BassboostHigh: EQBand[];
89
+ /** A decent Bassboost Equalizer */
90
+ BassboostMedium: EQBand[];
91
+ /** A slight Bassboost Equalizer */
92
+ BassboostLow: EQBand[];
93
+ /** Makes the Music slightly "better" */
94
+ BetterMusic: EQBand[];
95
+ /** Makes the Music sound like rock music / sound rock music better */
96
+ Rock: EQBand[];
97
+ /** Makes the Music sound like Classic music / sound Classic music better */
98
+ Classic: EQBand[];
99
+ /** Makes the Music sound like Pop music / sound Pop music better */
100
+ Pop: EQBand[];
101
+ /** Makes the Music sound like Electronic music / sound Electronic music better */
102
+ Electronic: EQBand[];
103
+ /** Boosts all Bands slightly for louder and fuller sound */
104
+ FullSound: EQBand[];
105
+ /** Boosts basses + lower highs for a pro gaming sound */
106
+ Gaming: EQBand[];
107
+ };
108
+ declare const RecommendationsStrings: {
109
+ highCPULoad: (cpuLoad: number) => string;
110
+ highSystemLoad: (systemLoad: number) => string;
111
+ highMemoryUsage: (memoryUsagePercent: number) => string;
112
+ frameDeficit: (frameDeficit: number) => string;
113
+ highLatency: (ping: number) => string;
114
+ nodeRestart: string;
115
+ highPlayercount: (players: number) => string;
116
+ nodeOffline: string;
117
+ checkConnectivity: string;
118
+ };
119
+ declare const NodeLinkExclusiveEvents: NodeLinkEventTypes[];
970
120
 
971
- declare class Player {
972
- /** Filter Manager per player */
973
- filterManager: FilterManager;
974
- /** circular reference to the lavalink Manager from the Player for easier use */
975
- LavalinkManager: LavalinkManager;
976
- /** Player options currently used, mutation doesn't affect player's state */
977
- options: PlayerOptions;
978
- /** The lavalink node assigned the the player, don't change it manually */
979
- node: LavalinkNode;
980
- /** The queue from the player */
981
- queue: Queue;
982
- /** The Guild Id of the Player */
121
+ interface StoredQueue {
122
+ current: Track | null;
123
+ previous: Track[];
124
+ tracks: (Track | UnresolvedTrack)[];
125
+ }
126
+ interface QueueStoreManager {
127
+ /** @async get a Value (MUST RETURN UNPARSED!) */
128
+ get: (guildId: string) => Awaitable<StoredQueue | string | undefined>;
129
+ /** @async Set a value inside a guildId (MUST BE UNPARSED) */
130
+ set: (guildId: string, value: StoredQueue | string) => Awaitable<void | boolean>;
131
+ /** @async Delete a Database Value based of it's guildId */
132
+ delete: (guildId: string) => Awaitable<void | boolean>;
133
+ /** @async Transform the value(s) inside of the QueueStoreManager (IF YOU DON'T NEED PARSING/STRINGIFY, then just return the value) */
134
+ stringify: (value: StoredQueue | string) => Awaitable<StoredQueue | string>;
135
+ /** @async Parse the saved value back to the Queue (IF YOU DON'T NEED PARSING/STRINGIFY, then just return the value) */
136
+ parse: (value: StoredQueue | string) => Awaitable<Partial<StoredQueue>>;
137
+ }
138
+ interface ManagerQueueOptions {
139
+ /** Maximum Amount of tracks for the queue.previous array. Set to 0 to not save previous songs. Defaults to 25 Tracks */
140
+ maxPreviousTracks?: number;
141
+ /** Custom Queue Store option */
142
+ queueStore?: QueueStoreManager;
143
+ /** Custom Queue Watcher class */
144
+ queueChangesWatcher?: QueueChangesWatcher;
145
+ }
146
+ interface QueueChangesWatcher {
147
+ /** get a Value (MUST RETURN UNPARSED!) */
148
+ tracksAdd: (guildId: string, tracks: (Track | UnresolvedTrack)[], position: number, oldStoredQueue: StoredQueue, newStoredQueue: StoredQueue) => void;
149
+ /** Set a value inside a guildId (MUST BE UNPARSED) */
150
+ tracksRemoved: (guildId: string, tracks: (Track | UnresolvedTrack)[], position: number | number[], oldStoredQueue: StoredQueue, newStoredQueue: StoredQueue) => void;
151
+ /** Set a value inside a guildId (MUST BE UNPARSED) */
152
+ shuffled: (guildId: string, oldStoredQueue: StoredQueue, newStoredQueue: StoredQueue) => void;
153
+ }
154
+
155
+ type DestroyReasonsType = keyof typeof DestroyReasons | string;
156
+ type DisconnectReasonsType = keyof typeof DisconnectReasons | string;
157
+ interface PlayerJson {
158
+ /** Guild Id where the player was playing in */
983
159
  guildId: string;
984
- /** The Voice Channel Id of the Player */
985
- voiceChannelId: string | null;
986
- /** The Text Channel Id of the Player */
987
- textChannelId: string | null;
988
- /** States if the Bot is supposed to be outputting audio */
989
- playing: boolean;
990
- /** States if the Bot is paused or not */
991
- paused: boolean;
992
- /** Repeat Mode of the Player */
160
+ /** Options provided to the player */
161
+ options: PlayerOptions;
162
+ /** Voice Channel Id the player was playing in */
163
+ voiceChannelId: string;
164
+ /** Text Channel Id the player was synced to */
165
+ textChannelId?: string;
166
+ /** Position the player was at */
167
+ position: number;
168
+ /** Lavalink's position the player was at */
169
+ lastPosition: number;
170
+ /** Last time the position was sent from lavalink */
171
+ lastPositionChange: number | null;
172
+ /** Volume in % from the player (without volumeDecrementer) */
173
+ volume: number;
174
+ /** Real Volume used in lavalink (with the volumeDecrementer) */
175
+ lavalinkVolume: number;
176
+ /** The repeatmode from the player */
993
177
  repeatMode: RepeatMode;
994
- /** Player's ping */
178
+ /** Pause state */
179
+ paused: boolean;
180
+ /** Whether the player was playing or not */
181
+ playing: boolean;
182
+ /** When the player was created */
183
+ createdTimeStamp?: number;
184
+ /** All current used fitlers Data */
185
+ filters: FilterData;
186
+ /** The player's ping object */
995
187
  ping: {
996
- lavalink: number;
188
+ /** Ping to the voice websocket server */
997
189
  ws: number;
190
+ /** Avg. calc. Ping to the lavalink server */
191
+ lavalink: number;
998
192
  };
999
- /** The Display Volume */
1000
- volume: number;
1001
- /** The Volume Lavalink actually is outputting */
1002
- lavalinkVolume: number;
1003
- /** The current Positin of the player (Calculated) */
1004
- get position(): number;
1005
- /** The timestamp when the last position change update happened */
1006
- lastPositionChange: number | null;
1007
- /** The current Positin of the player (from Lavalink) */
1008
- lastPosition: number;
1009
- lastSavedPosition: number;
1010
- /** When the player was created [Timestamp in Ms] (from lavalink) */
1011
- createdTimeStamp: number;
1012
- /** The Player Connection's State (from Lavalink) */
1013
- connected: boolean | undefined;
1014
- /** Voice Server Data (from Lavalink) */
1015
- voice: LavalinkPlayerVoiceOptions;
1016
- voiceState: {
1017
- selfDeaf: boolean;
1018
- selfMute: boolean;
1019
- serverDeaf: boolean;
1020
- serverMute: boolean;
1021
- suppress: boolean;
193
+ /** Equalizer Bands used in lavalink */
194
+ equalizer: EQBand[];
195
+ /** The Id of the last used node */
196
+ nodeId?: string;
197
+ /** The SessionId of the node */
198
+ nodeSessionId?: string;
199
+ /** The stored queue */
200
+ queue?: StoredQueue;
201
+ }
202
+ type RepeatMode = "queue" | "track" | "off";
203
+ interface PlayerOptions {
204
+ /** Guild id of the player */
205
+ guildId: string;
206
+ /** The Voice Channel Id */
207
+ voiceChannelId: string;
208
+ /** The Text Channel Id of the Player */
209
+ textChannelId?: string;
210
+ /** instantly change volume with the one play request */
211
+ volume?: number;
212
+ /** VC Region for node selections */
213
+ vcRegion?: string;
214
+ /** if it should join deafened */
215
+ selfDeaf?: boolean;
216
+ /** If it should join muted */
217
+ selfMute?: boolean;
218
+ /** If it should use a specific lavalink node */
219
+ node?: LavalinkNode | string;
220
+ /** If when applying filters, it should use the insta apply filters fix */
221
+ instaUpdateFiltersFix?: boolean;
222
+ /** If a volume should be applied via filters instead of lavalink-volume */
223
+ applyVolumeAsFilter?: boolean;
224
+ /** Custom Data for the player get/set datastorage */
225
+ customData?: anyObject;
226
+ }
227
+ type anyObject = {
228
+ [key: string | number]: string | number | null | anyObject;
229
+ };
230
+ interface BasePlayOptions {
231
+ /** The position to start the track. */
232
+ position?: number;
233
+ /** The position to end the track. */
234
+ endTime?: number;
235
+ /** If to start "paused" */
236
+ paused?: boolean;
237
+ /** The Volume to start with */
238
+ volume?: number;
239
+ /** The Lavalink Filters to use | only with the new REST API */
240
+ filters?: Partial<LavalinkFilterData>;
241
+ /** Voice Update for Lavalink */
242
+ voice?: LavalinkPlayerVoiceOptions;
243
+ }
244
+ interface LavalinkPlayOptions extends BasePlayOptions {
245
+ /** Which Track to play | don't provide, if it should pick from the Queue */
246
+ track?: {
247
+ /** The track encoded base64 string to use instead of the one from the queue system */
248
+ encoded?: Base64 | null;
249
+ /** The identifier of the track to use */
250
+ identifier?: string;
251
+ /** Custom User Data for the track to provide, will then be on the userData object from the track */
252
+ userData?: anyObject;
253
+ /** The Track requester for when u provide encodedTrack / identifer */
254
+ requester?: unknown;
255
+ /** NodeLink Specific audioTrackId option */
256
+ audioTrackId?: string;
1022
257
  };
1023
- /** Custom data for the player */
1024
- private readonly data;
1025
- /**
1026
- * Emits a debug event to the LavalinkManager
1027
- * @param name name of the event
1028
- * @param eventData event data
1029
- */
1030
- private _emitDebugEvent;
1031
- /**
1032
- * Create a new Player
1033
- * @param options
1034
- * @param LavalinkManager
1035
- */
1036
- constructor(options: PlayerOptions, LavalinkManager: LavalinkManager, dontEmitPlayerCreateEvent?: boolean);
1037
- /**
1038
- * Set custom data.
1039
- * @param key
1040
- * @param value
1041
- */
1042
- set(key: string, value: unknown): this;
1043
- /**
1044
- * Get custom data.
1045
- * @param key
1046
- */
1047
- get<T>(key: string): T;
1048
- /**
1049
- * CLears all the custom data.
1050
- */
1051
- clearData(): this;
1052
- /**
1053
- * Get all custom Data
1054
- */
1055
- getAllData(): Record<string, unknown>;
1056
- /**
1057
- * Play the next track from the queue / a specific track, with playoptions for Lavalink
1058
- * @param options
1059
- */
1060
- play(options?: Partial<PlayOptions>): any;
1061
- /**
1062
- * Set the Volume for the Player
1063
- * @param volume The Volume in percent
1064
- * @param ignoreVolumeDecrementer If it should ignore the volumedecrementer option
1065
- */
1066
- setVolume(volume: number, ignoreVolumeDecrementer?: boolean): Promise<this>;
1067
- /**
1068
- * Search for a track
1069
- * @param query The query to search for
1070
- * @param requestUser The user that requested the track
1071
- * @param throwOnEmpty If an error should be thrown if no track is found
1072
- * @returns The search result
1073
- */
1074
- lavaSearch(query: LavaSearchQuery, requestUser: unknown, throwOnEmpty?: boolean): Promise<LavaSearchResponse | SearchResult>;
1075
- /**
1076
- * Set the SponsorBlock
1077
- * @param segments The segments to set
1078
- */
1079
- setSponsorBlock(segments?: SponsorBlockSegment[]): Promise<void>;
1080
- /**
1081
- * Get the SponsorBlock
1082
- */
1083
- getSponsorBlock(): Promise<SponsorBlockSegment[]>;
1084
- /**
1085
- * Delete the SponsorBlock
1086
- */
1087
- deleteSponsorBlock(): Promise<void>;
1088
- /**
1089
- *
1090
- * @param query Query for your data
1091
- * @param requestUser
1092
- */
1093
- search(query: SearchQuery, requestUser: unknown, throwOnEmpty?: boolean): Promise<UnresolvedSearchResult | SearchResult>;
1094
- /**
1095
- * Pause the player
1096
- */
1097
- pause(): Promise<this>;
1098
- /**
1099
- * Resume the Player
1100
- */
1101
- resume(): Promise<this>;
1102
- /**
1103
- * Seek to a specific Position
1104
- * @param position
1105
- */
1106
- seek(position: number): Promise<this>;
1107
- /**
1108
- * Set the Repeatmode of the Player
1109
- * @param repeatMode
1110
- */
1111
- setRepeatMode(repeatMode: RepeatMode): Promise<this>;
1112
- /**
1113
- * Skip the current song, or a specific amount of songs
1114
- * @param amount provide the index of the next track to skip to
1115
- */
1116
- skip(skipTo?: number, throwError?: boolean): Promise<this>;
1117
- /**
1118
- * Clears the queue and stops playing. Does not destroy the Player and not leave the channel
1119
- * @returns
1120
- */
1121
- stopPlaying(clearQueue?: boolean, executeAutoplay?: boolean): Promise<this>;
1122
- /**
1123
- * Connects the Player to the Voice Channel
1124
- * @returns
1125
- */
1126
- connect(): Promise<this>;
1127
- changeVoiceState(data: {
1128
- voiceChannelId?: string;
1129
- selfDeaf?: boolean;
1130
- selfMute?: boolean;
1131
- }): Promise<this>;
1132
- /**
1133
- * Disconnects the Player from the Voice Channel, but keeps the player in the cache
1134
- * @param force If false it throws an error, if player thinks it's already disconnected
1135
- * @returns
1136
- */
1137
- disconnect(force?: boolean): Promise<this>;
1138
- /**
1139
- * Destroy the player and disconnect from the voice channel
1140
- */
1141
- destroy(reason?: DestroyReasons | string, disconnect?: boolean): Promise<this>;
1142
- /**
1143
- * Get the current lyrics of the track currently playing on the guild
1144
- * @param guildId The guild id to get the current lyrics for
1145
- * @param skipTrackSource If true, it will not try to get the lyrics from the track source
1146
- * @returns The current lyrics
1147
- * @example
1148
- * ```ts
1149
- * const lyrics = await player.getCurrentLyrics();
1150
- * ```
1151
- */
1152
- getCurrentLyrics(skipTrackSource?: boolean): Promise<LyricsResult>;
1153
- /**
1154
- * Get the lyrics of a specific track
1155
- * @param track The track to get the lyrics for
1156
- * @param skipTrackSource If true, it will not try to get the lyrics from the track source
1157
- * @returns The lyrics of the track
1158
- * @example
1159
- * ```ts
1160
- * const lyrics = await player.getLyrics(player.queue.tracks[0], true);
1161
- * ```
1162
- */
1163
- getLyrics(track: Track, skipTrackSource?: boolean): Promise<LyricsResult>;
1164
- /**
1165
- * Subscribe to the lyrics event on a specific guild to active live lyrics events
1166
- * @returns The unsubscribe function
1167
- * @example
1168
- * ```ts
1169
- * const lyrics = await player.subscribeLyrics();
1170
- * ```
1171
- */
1172
- subscribeLyrics(): Promise<unknown>;
1173
- /**
1174
- * Unsubscribe from the lyrics event on a specific guild to disable live lyrics events
1175
- * @returns The unsubscribe function
1176
- * @example
1177
- * ```ts
1178
- * const lyrics = await player.unsubscribeLyrics();
1179
- * ```
1180
- */
1181
- unsubscribeLyrics(): Promise<void>;
1182
- /**
1183
- * Move the player on a different Audio-Node
1184
- * @param newNode New Node / New Node Id
1185
- * @param checkSources If it should check if the sources are supported by the new node @default true
1186
- * @return The new Node Id
1187
- * @example
1188
- * ```ts
1189
- * const changeNode = await player.changeNode(newNode, true);
1190
- * ```
1191
- */
1192
- changeNode(newNode: LavalinkNode | string, checkSources?: boolean): Promise<string>;
1193
- /**
1194
- * (Wrapper-FN for changeNode) Move the player to a different node. If no node is provided, it will find the least used node that is not the same as the current node.
1195
- * @param node the id of the node to move to
1196
- * @returns the player
1197
- * @throws RangeError if there is no available nodes.
1198
- * @throws Error if the node to move to is the same as the current node.
1199
- * @example
1200
- * ```ts
1201
- * const newNodeMovedTo = await player.moveNode(); // no need to specify the new node, it will find a least used node automatically, but you can ofc. use a custom node id.
1202
- * ```
1203
- */
1204
- moveNode(node?: string): Promise<string | this>;
1205
- /** Converts the Player including Queue to a Json state */
1206
- toJSON(): PlayerJson;
258
+ }
259
+ interface PlayOptions extends LavalinkPlayOptions {
260
+ /** Whether to not replace the track if a play payload is sent. */
261
+ noReplace?: boolean;
262
+ /** Adds track on queue and skips to it */
263
+ clientTrack?: (Track | UnresolvedTrack) & {
264
+ audioTrackId?: string;
265
+ };
266
+ }
267
+
268
+ /** Sourcenames provided by lavalink server */
269
+ type LavalinkSourceNames = "youtube" | "youtubemusic" | "soundcloud" | "bandcamp" | "twitch";
270
+ /** Source Names provided by lava src plugin */
271
+ type LavalinkPlugin_LavaSrc_SourceNames = "deezer" | "spotify" | "applemusic" | "yandexmusic" | "flowery-tts" | "vkmusic" | "tidal" | "qobuz" | "pandora";
272
+ /** Source Names provided by jiosaavan plugin */
273
+ type LavalinkPlugin_JioSaavn_SourceNames = "jiosaavn";
274
+ /** The SourceNames provided by lavalink */
275
+ type SourceNames = LavalinkSourceNames | LavalinkPlugin_LavaSrc_SourceNames | LavalinkPlugin_JioSaavn_SourceNames;
276
+ interface LavalinkTrackInfo {
277
+ /** The Identifier of the Track */
278
+ identifier: string;
279
+ /** The Track Title / Name */
280
+ title: string;
281
+ /** The Name of the Author */
282
+ author: string;
283
+ /** The duration of the Track */
284
+ length: number;
285
+ /** The URL of the artwork if available */
286
+ artworkUrl: string | null;
287
+ /** The URL (aka Link) of the Track called URI */
288
+ uri: string;
289
+ /** The Source name of the Track, e.g. soundcloud, youtube, spotify */
290
+ sourceName: SourceNames;
291
+ /** Whether the audio is seekable */
292
+ isSeekable: boolean;
293
+ /** Whether the audio is of a live stream */
294
+ isStream: boolean;
295
+ /** If isrc code is available, it's provided */
296
+ isrc: string | null;
297
+ }
298
+ interface TrackInfo {
299
+ /** The Identifier of the Track */
300
+ identifier: string;
301
+ /** The Track Title / Name */
302
+ title: string;
303
+ /** The Name of the Author */
304
+ author: string;
305
+ /** The duration of the Track */
306
+ duration: number;
307
+ /** The URL of the artwork if available */
308
+ artworkUrl: string | null;
309
+ /** The URL (aka Link) of the Track called URI */
310
+ uri: string;
311
+ /** The Source name of the Track, e.g. soundcloud, youtube, spotify */
312
+ sourceName: SourceNames;
313
+ /** Whether the audio is seekable */
314
+ isSeekable: boolean;
315
+ /** Whether the audio is of a live stream */
316
+ isStream: boolean;
317
+ /** If isrc code is available, it's provided */
318
+ isrc: string | null;
319
+ }
320
+ interface PluginInfo {
321
+ /** The Type provided by a plugin */
322
+ type?: "album" | "playlist" | "artist" | "recommendations" | string;
323
+ /** The Identifier provided by a plugin */
324
+ albumName?: string;
325
+ /** The url of the album */
326
+ albumUrl?: string;
327
+ /** The url of the album art */
328
+ albumArtUrl?: string;
329
+ /** The url of the artist */
330
+ artistUrl?: string;
331
+ /** The url of the artist artwork */
332
+ artistArtworkUrl?: string;
333
+ /** The url of the preview */
334
+ previewUrl?: string;
335
+ /** Whether the track is a preview */
336
+ isPreview?: boolean;
337
+ /** The total number of tracks in the playlist */
338
+ totalTracks?: number;
339
+ /** The Identifier provided by a plugin */
340
+ identifier?: string;
341
+ /** The ArtworkUrl provided by a plugin */
342
+ artworkUrl?: string;
343
+ /** The Author Information provided by a plugin */
344
+ author?: string;
345
+ /** The Url provided by a Plugin */
346
+ url?: string;
347
+ /** The Url provided by a Plugin */
348
+ uri?: string;
349
+ /** You can put specific track information here, to transform the tracks... */
350
+ clientData?: {
351
+ previousTrack?: boolean;
352
+ [key: string]: any;
353
+ };
354
+ }
355
+ interface LavalinkTrack {
356
+ /** The Base 64 encoded String */
357
+ encoded?: Base64;
358
+ /** Track Information */
359
+ info: LavalinkTrackInfo;
360
+ /** Plugin Information from Lavalink */
361
+ pluginInfo: Partial<PluginInfo>;
362
+ /** The userData Object from when you provide to the lavalink request */
363
+ userData?: anyObject;
364
+ }
365
+ interface TrackRequester {
366
+ }
367
+ interface Track {
368
+ /** The Base 64 encoded String */
369
+ encoded?: Base64;
370
+ /** Track Information */
371
+ info: TrackInfo;
372
+ /** Plugin Information from Lavalink */
373
+ pluginInfo: Partial<PluginInfo>;
374
+ /** The Track's Requester */
375
+ requester?: TrackRequester;
376
+ /** The userData Object from when you provide to the lavalink request */
377
+ userData?: anyObject;
378
+ }
379
+ interface UnresolvedTrackInfo extends Partial<TrackInfo> {
380
+ /** Required */
381
+ title: string;
382
+ }
383
+ interface UnresolvedQuery extends UnresolvedTrackInfo {
384
+ /** The base64 of the unresolved track to "encode" */
385
+ encoded?: Base64;
386
+ }
387
+ interface UnresolvedTrack {
388
+ /** Required */
389
+ resolve: (player: Player) => Promise<void>;
390
+ /** The Base 64 encoded String */
391
+ encoded?: Base64;
392
+ /** Track Information */
393
+ info: UnresolvedTrackInfo;
394
+ /** Plugin Information from Lavalink */
395
+ pluginInfo: Partial<PluginInfo>;
396
+ /** The userData Object from when you provide to the lavalink request */
397
+ userData?: anyObject;
398
+ /** The Track's Requester */
399
+ requester?: TrackRequester;
1207
400
  }
1208
401
 
1209
402
  declare const TrackSymbol: unique symbol;
@@ -1224,7 +417,19 @@ declare function parseLavalinkConnUrl(connectionUrl: string): {
1224
417
  declare class ManagerUtils {
1225
418
  LavalinkManager: LavalinkManager | undefined;
1226
419
  constructor(LavalinkManager?: LavalinkManager);
420
+ /**
421
+ * Builds a pluginInfo object based on the provided data, extracting relevant information from the data and clientData parameters. This function is used to construct the pluginInfo property for tracks, allowing for consistent handling of plugin-related information across different track sources and formats.
422
+ * @param data
423
+ * @param clientData
424
+ * @returns
425
+ */
1227
426
  buildPluginInfo(data: any, clientData?: any): any;
427
+ /**
428
+ * Builds a Track object from the provided data and requester information. It validates the presence of required properties in the data, transforms the requester using a custom transformer function if provided, and constructs a Track object with the appropriate properties and plugin information. The function also includes error handling to ensure that the input data is valid and provides debug information if track building fails.
429
+ * @param data
430
+ * @param requester
431
+ * @returns
432
+ */
1228
433
  buildTrack(data: LavalinkTrack | Track, requester: unknown): Track;
1229
434
  /**
1230
435
  * Builds a UnresolvedTrack to be resolved before being played .
@@ -1237,6 +442,11 @@ declare class ManagerUtils {
1237
442
  * @param data
1238
443
  */
1239
444
  isNode(data: LavalinkNode): boolean;
445
+ /**
446
+ * Gets the transformed requester based on the LavalinkManager options. If a custom requester transformer function is provided in the player options, it applies that function to the requester; otherwise, it returns the requester as is. The function also includes error handling to catch any exceptions that may occur during the transformation process and emits a debug event if the transformation fails.
447
+ * @param requester
448
+ * @returns
449
+ */
1240
450
  getTransformedRequester(requester: unknown): unknown;
1241
451
  /**
1242
452
  * Validate if a data is equal to node options
@@ -1277,18 +487,73 @@ declare class ManagerUtils {
1277
487
  * @param track
1278
488
  */
1279
489
  isUnresolvedTrackQuery(data: UnresolvedQuery): boolean;
490
+ /**
491
+ * Gets the closest track by resolving the provided UnresolvedTrack using the getClosestTrack function. It includes error handling to catch any exceptions that may occur during the resolution process and emits a debug event if the resolution fails. The function returns a Promise that resolves to a Track object if successful, or undefined if no closest track is found.
492
+ * @param data
493
+ * @param player
494
+ * @returns
495
+ */
1280
496
  getClosestTrack(data: UnresolvedTrack, player: Player): Promise<Track | undefined>;
1281
- validateQueryString(node: LavalinkNode, queryString: string, sourceString?: LavalinkSearchPlatform): void;
497
+ /**
498
+ * Validates the query string against various criteria, including checking for empty strings, length limits for specific sources, blacklisted links or words, and ensuring that the Lavalink node has the necessary source managers enabled for the provided query. The function also includes debug event emissions to assist with troubleshooting and understanding the validation process.
499
+ * @param node
500
+ * @param queryString
501
+ * @param sourceString
502
+ * @returns
503
+ */
504
+ validateQueryString(node: LavalinkNode, queryString: string, sourceString?: SearchPlatform): void;
505
+ /**
506
+ * Finds the source of a query string by checking if it starts with a valid source prefix defined in the DefaultSources object. If a valid source prefix is found, it returns the corresponding SearchPlatform; otherwise, it returns null. This function is useful for determining the intended search platform for a given query string, allowing for more accurate search results when the user specifies a source (e.g., "ytsearch:Never Gonna Give You Up" would indicate that the search should be performed on YouTube).
507
+ * @param queryString
508
+ * @returns
509
+ */
510
+ findSourceOfQuery(queryString: string): SearchPlatform;
511
+ /**
512
+ * Extracts the source from the query if it starts with a valid source prefix (e.g., "ytsearch:") and updates the searchQuery object accordingly.
513
+ * @param searchQuery
514
+ * @returns The updated searchQuery object with the extracted source and modified query string.
515
+ */
516
+ extractSourceOfQuery<T extends {
517
+ query: string;
518
+ source?: string;
519
+ }>(searchQuery: T): T;
520
+ /**
521
+ * Converts a string to lowercase if the input is a string, otherwise returns the input as is. This is useful for ensuring that search platform identifiers are case-insensitive while allowing other types of input to pass through unchanged.
522
+ * @param input
523
+ * @returns
524
+ */
525
+ typedLowerCase<T extends unknown>(input: T): T;
526
+ /**
527
+ * Transforms a search query by determining the appropriate search platform based on the query string and the default search platform specified in the LavalinkManager options. It checks if the query string starts with a valid source prefix and extracts it if present. The function returns an object containing the modified query string, any extra URL parameters, and the determined search platform to be used for the search operation.
528
+ * @param query
529
+ * @returns
530
+ */
1282
531
  transformQuery(query: SearchQuery): {
1283
532
  query: string;
1284
- extraQueryUrlParams: URLSearchParams;
1285
- source: any;
533
+ extraQueryUrlParams: any;
534
+ source: SearchPlatform;
1286
535
  };
536
+ /**
537
+ * Transforms a LavaSearchQuery by determining the appropriate search platform based on the query string and the default search platform specified in the LavalinkManager options. It checks if the query string starts with a valid source prefix and extracts it if present. The function returns an object containing the modified query string, any extra URL parameters, the determined search platform to be used for the search operation, and the types of search (track, playlist, artist, album, text) to be performed.
538
+ * @param query
539
+ * @returns
540
+ */
1287
541
  transformLavaSearchQuery(query: LavaSearchQuery): {
542
+ query: never;
543
+ types: any[];
544
+ extraQueryUrlParams: any;
545
+ source: SearchPlatform;
546
+ } | {
1288
547
  query: string;
1289
548
  types: string[];
1290
- source: any;
549
+ source: "ytsearch" | "ytmsearch" | "scsearch" | "bcsearch" | "spsearch" | "sprec" | "amsearch" | "dzsearch" | "dzisrc" | "dzrec" | "ymsearch" | "ymrec" | "vksearch" | "vkrec" | "tdsearch" | "tdrec" | "qbsearch" | "qbisrc" | "qbrec" | "pdsearch" | "pdisrc" | "pdrec" | "ftts" | "speak" | "phsearch" | "pornhub" | "porn" | "tts" | "jssearch" | "jsrec" | "local" | "http" | "https" | "link" | "uri" | "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" | "bandcamp" | "bc" | "js" | "jiosaavn" | "td";
1291
550
  };
551
+ /**
552
+ * Validates the provided source string against the capabilities of the Lavalink node. It checks if the source string is supported by the node's enabled source managers and plugins, throwing errors if any required sources or plugins are missing for the specified search platform. This ensures that search queries are only executed with compatible sources based on the node's configuration.
553
+ * @param node
554
+ * @param sourceString
555
+ * @returns
556
+ */
1292
557
  validateSourceString(node: LavalinkNode, sourceString: SearchPlatform): void;
1293
558
  }
1294
559
  /**
@@ -1340,9 +605,9 @@ type Opaque<T, K> = T & {
1340
605
  __opaque__: K;
1341
606
  };
1342
607
  /** Opqaue tyep for integernumber */
1343
- type IntegerNumber = Opaque<number, 'Int'>;
608
+ type IntegerNumber = Opaque<number, "Int">;
1344
609
  /** Opqaue tyep for floatnumber */
1345
- type FloatNumber = Opaque<number, 'Float'>;
610
+ type FloatNumber = Opaque<number, "Float">;
1346
611
  type LavaSrcSearchPlatformBase = "spsearch" | "sprec" | "amsearch" | "dzsearch" | "dzisrc" | "dzrec" | "ymsearch" | "ymrec" | "vksearch" | "vkrec" | "tdsearch" | "tdrec" | "qbsearch" | "qbisrc" | "qbrec" | "pdsearch" | "pdisrc" | "pdrec";
1347
612
  type LavaSrcSearchPlatform = LavaSrcSearchPlatformBase | "ftts";
1348
613
  type JioSaavnSearchPlatform = "jssearch" | "jsrec";
@@ -1351,8 +616,7 @@ type LavalinkClientSearchPlatform = "bcsearch";
1351
616
  type LavalinkClientSearchPlatformResolve = "bandcamp" | "bc";
1352
617
  type LavalinkSearchPlatform = "ytsearch" | "ytmsearch" | "scsearch" | "bcsearch" | LavaSrcSearchPlatform | DuncteSearchPlatform | JioSaavnSearchPlatform | LavalinkClientSearchPlatform;
1353
618
  type ClientCustomSearchPlatformUtils = "local" | "http" | "https" | "link" | "uri";
1354
- type ClientSearchPlatform = ClientCustomSearchPlatformUtils | // for file/link requests
1355
- "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";
619
+ type ClientSearchPlatform = ClientCustomSearchPlatformUtils | "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";
1356
620
  type SearchPlatform = LavalinkSearchPlatform | ClientSearchPlatform;
1357
621
  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";
1358
622
  interface PlaylistInfo {
@@ -1544,7 +808,7 @@ interface LavalinkPlayerVoice {
1544
808
  /** The Ping to the voice server */
1545
809
  ping?: number;
1546
810
  }
1547
- type LavalinkPlayerVoiceOptions = Omit<LavalinkPlayerVoice, 'connected' | 'ping'>;
811
+ type LavalinkPlayerVoiceOptions = Omit<LavalinkPlayerVoice, "connected" | "ping">;
1548
812
  interface FailingAddress {
1549
813
  /** The failing address */
1550
814
  failingAddress: string;
@@ -1769,6 +1033,18 @@ interface PlayerFilters {
1769
1033
  lowPass: boolean;
1770
1034
  /** audio Output (default stereo, mono sounds the fullest and best for not-stereo tracks) */
1771
1035
  audioOutput: AudioOutputs;
1036
+ /** if NodeLink echo filter is enabled / not */
1037
+ nodeLinkEcho: boolean;
1038
+ /** if NodeLink chorus filter is enabled / not */
1039
+ nodeLinkChorus: boolean;
1040
+ /** if NodeLink compressor filter is enabled / not */
1041
+ nodeLinkCompressor: boolean;
1042
+ /** if NodeLink highpass filter is enabled / not */
1043
+ nodeLinkHighPass: boolean;
1044
+ /** if NodeLink phaser filter is enabled / not */
1045
+ nodeLinkPhaser: boolean;
1046
+ /** if NodeLink spatial filter is enabled / not */
1047
+ nodeLinkSpatial: boolean;
1772
1048
  /** Lavalink Volume FILTER (not player Volume, think of it as a gain booster) */
1773
1049
  volume: boolean;
1774
1050
  /** Filters for the Lavalink Filter Plugin */
@@ -1803,705 +1079,1919 @@ interface EQBand {
1803
1079
  gain: FloatNumber | number;
1804
1080
  }
1805
1081
  /**
1806
- * Uses equalization to eliminate part of a band, usually targeting vocals.
1082
+ * Uses equalization to eliminate part of a band, usually targeting vocals.
1083
+ */
1084
+ interface KaraokeFilter {
1085
+ /** The level (0 to 1.0 where 0.0 is no effect and 1.0 is full effect) */
1086
+ level?: number;
1087
+ /** The mono level (0 to 1.0 where 0.0 is no effect and 1.0 is full effect) */
1088
+ monoLevel?: number;
1089
+ /** The filter band (in Hz) */
1090
+ filterBand?: number;
1091
+ /** The filter width */
1092
+ filterWidth?: number;
1093
+ }
1094
+ /**
1095
+ * Changes the speed, pitch, and rate
1096
+ */
1097
+ interface TimescaleFilter {
1098
+ /** The playback speed 0.0 ≤ x */
1099
+ speed?: number;
1100
+ /** The pitch 0.0 ≤ x */
1101
+ pitch?: number;
1102
+ /** The rate 0.0 ≤ x */
1103
+ rate?: number;
1104
+ }
1105
+ /**
1106
+ * Uses amplification to create a shuddering effect, where the volume quickly oscillates.
1107
+ * Demo: https://en.wikipedia.org/wiki/File:Fuse_Electronics_Tremolo_MK-III_Quick_Demo.ogv
1108
+ */
1109
+ interface TremoloFilter {
1110
+ /** The frequency 0.0 < x */
1111
+ frequency?: number;
1112
+ /** The tremolo depth 0.0 < x ≤ 1.0 */
1113
+ depth?: number;
1114
+ }
1115
+ /**
1116
+ * Similar to tremolo. While tremolo oscillates the volume, vibrato oscillates the pitch.
1117
+ */
1118
+ interface VibratoFilter {
1119
+ /** The frequency 0.0 < x ≤ 14.0 */
1120
+ frequency?: number;
1121
+ /** The vibrato depth 0.0 < x ≤ 1.0 */
1122
+ depth?: number;
1123
+ }
1124
+ /**
1125
+ * Rotates the sound around the stereo channels/user headphones (aka Audio Panning).
1126
+ * It can produce an effect similar to https://youtu.be/QB9EB8mTKcc (without the reverb).
1127
+ */
1128
+ interface RotationFilter {
1129
+ /** The frequency of the audio rotating around the listener in Hz. 0.2 is similar to the example video above */
1130
+ rotationHz?: number;
1131
+ }
1132
+ /**
1133
+ * Distortion effect. It can generate some pretty unique audio effects.
1134
+ */
1135
+ interface DistortionFilter {
1136
+ sinOffset?: number;
1137
+ sinScale?: number;
1138
+ cosOffset?: number;
1139
+ cosScale?: number;
1140
+ tanOffset?: number;
1141
+ tanScale?: number;
1142
+ offset?: number;
1143
+ scale?: number;
1144
+ }
1145
+ /**
1146
+ * Mixes both channels (left and right), with a configurable factor on how much each channel affects the other.
1147
+ * With the defaults, both channels are kept independent of each other.
1148
+ * Setting all factors to 0.5 means both channels get the same audio.
1149
+ */
1150
+ interface ChannelMixFilter {
1151
+ /** The left to left channel mix factor (0.0 ≤ x ≤ 1.0) */
1152
+ leftToLeft?: number;
1153
+ /** The left to right channel mix factor (0.0 ≤ x ≤ 1.0) */
1154
+ leftToRight?: number;
1155
+ /** The right to left channel mix factor (0.0 ≤ x ≤ 1.0) */
1156
+ rightToLeft?: number;
1157
+ /** The right to right channel mix factor (0.0 ≤ x ≤ 1.0) */
1158
+ rightToRight?: number;
1159
+ }
1160
+ /**
1161
+ * Creates delay-based echo with feedback control
1162
+ */
1163
+ interface NodeLink_EchoFilter {
1164
+ /** Delay time in milliseconds (0 to 5000ms) */
1165
+ delay?: number;
1166
+ /** Amount of signal fed back into the delay (0.0 to 1.0) */
1167
+ feedback?: number;
1168
+ /** Dry/wet mix ratio (0.0 = dry only, 1.0 = wet only) */
1169
+ mix?: number;
1170
+ }
1171
+ /**
1172
+ * Simulates multiple voices playing together with modulated delays
1173
+ */
1174
+ interface NodeLink_ChorusFilter {
1175
+ /** LFO modulation rate in Hz */
1176
+ rate?: number;
1177
+ /** Modulation depth (0.0 to 1.0) */
1178
+ depth?: number;
1179
+ /** Base delay time in milliseconds (1 to 45ms) */
1180
+ delay?: number;
1181
+ /** Dry/wet mix ratio (0.0 to 1.0) */
1182
+ mix?: number;
1183
+ /** Feedback amount (0.0 to 0.95) */
1184
+ feedback?: number;
1185
+ }
1186
+ /**
1187
+ * Dynamic range compression for balanced audio levels
1188
+ */
1189
+ interface NodeLink_CompressorFilter {
1190
+ /** Threshold level in dB (when compression starts) */
1191
+ threshold?: number;
1192
+ /** Compression ratio (1.0 = no compression, higher = more compression) */
1193
+ ratio?: number;
1194
+ /** Attack time in milliseconds (how fast compression engages) */
1195
+ attack?: number;
1196
+ /** Release time in milliseconds (how fast compression disengages) */
1197
+ release?: number;
1198
+ /** Makeup gain in dB (compensates for volume reduction) */
1199
+ gain?: number;
1200
+ }
1201
+ /**
1202
+ * Filters out low frequencies, letting high frequencies pass through
1203
+ */
1204
+ interface NodeLink_HighPassFilter {
1205
+ /** Smoothing factor (must be > 1.0 to enable) */
1206
+ smoothing?: number;
1207
+ }
1208
+ /**
1209
+ * Sweeps all-pass filters across the frequency spectrum for a swooshing effect
1210
+ */
1211
+ interface NodeLink_PhaserFilter {
1212
+ /** Number of filter stages (2 to 12, more = stronger effect) */
1213
+ stages?: number;
1214
+ /** LFO sweep rate in Hz */
1215
+ rate?: number;
1216
+ /** Modulation depth (0.0 to 1.0) */
1217
+ depth?: number;
1218
+ /** Feedback amount (0.0 to 0.9) */
1219
+ feedback?: number;
1220
+ /** Dry/wet mix ratio (0.0 to 1.0) */
1221
+ mix?: number;
1222
+ /** Minimum sweep frequency in Hz */
1223
+ minFrequency?: number;
1224
+ /** Maximum sweep frequency in Hz */
1225
+ maxFrequency?: number;
1226
+ }
1227
+ /**
1228
+ * Creates spatial audio using cross-channel delays and modulation
1229
+ */
1230
+ interface NodeLink_SpatialFilter {
1231
+ /** Effect depth (0.0 to 1.0) */
1232
+ depth?: number;
1233
+ /** Modulation rate in Hz */
1234
+ rate?: number;
1235
+ }
1236
+ /**
1237
+ * Higher frequencies get suppressed, while lower frequencies pass through this filter, thus the name low pass.
1238
+ * Any smoothing values equal to or less than 1.0 will disable the filter.
1239
+ */
1240
+ interface LowPassFilter {
1241
+ /** The smoothing factor (1.0 < x) */
1242
+ smoothing?: number;
1243
+ }
1244
+ /**
1245
+ * Filter Data stored in the Client and partially sent to Lavalink
1246
+ */
1247
+ interface FilterData {
1248
+ volume?: number;
1249
+ karaoke?: KaraokeFilter;
1250
+ timescale?: TimescaleFilter;
1251
+ tremolo?: TremoloFilter;
1252
+ vibrato?: VibratoFilter;
1253
+ rotation?: RotationFilter;
1254
+ distortion?: DistortionFilter;
1255
+ channelMix?: ChannelMixFilter;
1256
+ lowPass?: LowPassFilter;
1257
+ echo?: NodeLink_EchoFilter;
1258
+ chorus?: NodeLink_ChorusFilter;
1259
+ compressor?: NodeLink_CompressorFilter;
1260
+ highPass?: NodeLink_HighPassFilter;
1261
+ phaser?: NodeLink_PhaserFilter;
1262
+ spatial?: NodeLink_SpatialFilter;
1263
+ pluginFilters?: {
1264
+ "lavalink-filter-plugin"?: {
1265
+ echo?: {
1266
+ delay?: number;
1267
+ decay?: number;
1268
+ };
1269
+ reverb?: {
1270
+ delays?: number[];
1271
+ gains?: number[];
1272
+ };
1273
+ };
1274
+ "high-pass"?: {
1275
+ cutoffFrequency?: number;
1276
+ boostFactor?: number;
1277
+ };
1278
+ "low-pass"?: {
1279
+ cutoffFrequency?: number;
1280
+ boostFactor?: number;
1281
+ };
1282
+ normalization?: {
1283
+ maxAmplitude?: number;
1284
+ adaptive?: boolean;
1285
+ };
1286
+ echo?: {
1287
+ echoLength?: number;
1288
+ decay?: number;
1289
+ };
1290
+ };
1291
+ }
1292
+ /**
1293
+ * Actual Filter Data sent to Lavalink
1807
1294
  */
1808
- interface KaraokeFilter {
1809
- /** The level (0 to 1.0 where 0.0 is no effect and 1.0 is full effect) */
1810
- level?: number;
1811
- /** The mono level (0 to 1.0 where 0.0 is no effect and 1.0 is full effect) */
1812
- monoLevel?: number;
1813
- /** The filter band (in Hz) */
1814
- filterBand?: number;
1815
- /** The filter width */
1816
- filterWidth?: number;
1295
+ interface LavalinkFilterData extends FilterData {
1296
+ equalizer?: EQBand[];
1817
1297
  }
1818
- /**
1819
- * Changes the speed, pitch, and rate
1820
- */
1821
- interface TimescaleFilter {
1822
- /** The playback speed 0.0 ≤ x */
1823
- speed?: number;
1824
- /** The pitch 0.0 ≤ x */
1825
- pitch?: number;
1826
- /** The rate 0.0 ≤ x */
1827
- rate?: number;
1298
+
1299
+ type NodeLinkEventTypes = "PlayerCreatedEvent" | "PlayerDestroyedEvent" | "PlayerConnectedEvent" | "PlayerReconnectingEvent" | "VolumeChangedEvent" | "FiltersChangedEvent" | "SeekEvent" | "PauseEvent" | "ConnectionStatusEvent" | "MixStartedEvent" | "MixEndedEvent" | "LyricsFoundEvent" | "LyricsLineEvent" | "LyricsNotFoundEvent";
1300
+ interface NodeLinkBaseEvent {
1301
+ op: "event";
1302
+ type: NodeLinkEventTypes;
1303
+ guildId: string;
1828
1304
  }
1829
- /**
1830
- * Uses amplification to create a shuddering effect, where the volume quickly oscillates.
1831
- * Demo: https://en.wikipedia.org/wiki/File:Fuse_Electronics_Tremolo_MK-III_Quick_Demo.ogv
1832
- */
1833
- interface TremoloFilter {
1834
- /** The frequency 0.0 < x */
1835
- frequency?: number;
1836
- /** The tremolo depth 0.0 < x ≤ 1.0 */
1837
- depth?: number;
1305
+ interface PlayerCreatedEvent extends NodeLinkBaseEvent {
1306
+ type: "PlayerCreatedEvent";
1307
+ }
1308
+ interface PlayerDestroyedEvent extends NodeLinkBaseEvent {
1309
+ type: "PlayerDestroyedEvent";
1310
+ }
1311
+ interface PlayerConnectedEvent extends NodeLinkBaseEvent {
1312
+ type: "PlayerConnectedEvent";
1313
+ }
1314
+ interface PlayerReconnectingEvent extends NodeLinkBaseEvent {
1315
+ type: "PlayerReconnectingEvent";
1316
+ }
1317
+ interface VolumeChangedEvent extends NodeLinkBaseEvent {
1318
+ type: "VolumeChangedEvent";
1319
+ /** New volume level (0-1000) */
1320
+ volume: number;
1321
+ }
1322
+ interface FiltersChangedEvent extends NodeLinkBaseEvent {
1323
+ type: "FiltersChangedEvent";
1324
+ filters: LavalinkFilterData;
1325
+ }
1326
+ interface SeekEvent extends NodeLinkBaseEvent {
1327
+ type: "SeekEvent";
1328
+ /** New position in milliseconds */
1329
+ position: number;
1330
+ }
1331
+ interface PauseEvent extends NodeLinkBaseEvent {
1332
+ type: "PauseEvent";
1333
+ /** Whether playback is now paused (true) or resumed (false) */
1334
+ paused: boolean;
1335
+ }
1336
+ interface ConnectionStatusEvent extends NodeLinkBaseEvent {
1337
+ type: "ConnectionStatusEvent";
1338
+ /** Current connection status */
1339
+ connected: boolean;
1340
+ }
1341
+ interface MixStartedEvent extends NodeLinkBaseEvent {
1342
+ type: "MixStartedEvent";
1343
+ /** Unique identifier for the mix layer */
1344
+ mixId: string;
1345
+ /** Full track information of the mixed layer */
1346
+ track: LavalinkTrack;
1347
+ /** Volume of the mixed layer (0.0 to 1.0) */
1348
+ volume: number;
1349
+ }
1350
+ interface MixEndedEvent extends NodeLinkBaseEvent {
1351
+ type: "MixEndedEvent";
1352
+ /** Unique identifier for the mix layer */
1353
+ mixId: string;
1354
+ /** Reason the mix layer ended (FINISHED, REMOVED, ERROR, MAIN_ENDED) */
1355
+ reason: "FINISHED" | "REMOVED" | "ERROR" | "MAIN_ENDED" | string;
1838
1356
  }
1357
+ type NodeLinkEventPayload<T extends NodeLinkEventTypes> = T extends "PlayerCreatedEvent" ? PlayerCreatedEvent : T extends "PlayerDestroyedEvent" ? PlayerDestroyedEvent : T extends "PlayerConnectedEvent" ? PlayerConnectedEvent : T extends "PlayerReconnectingEvent" ? PlayerReconnectingEvent : T extends "VolumeChangedEvent" ? VolumeChangedEvent : T extends "FiltersChangedEvent" ? FiltersChangedEvent : T extends "SeekEvent" ? SeekEvent : T extends "PauseEvent" ? PauseEvent : T extends "ConnectionStatusEvent" ? ConnectionStatusEvent : T extends "MixStartedEvent" ? MixStartedEvent : T extends "MixEndedEvent" ? MixEndedEvent : never;
1358
+ type HealthStatusThreshold = {
1359
+ excellent: number;
1360
+ good: number;
1361
+ fair: number;
1362
+ poor: number;
1363
+ };
1364
+ type HealthStatusThresholdOptions = {
1365
+ cpu: Partial<HealthStatusThreshold>;
1366
+ memory: Partial<HealthStatusThreshold>;
1367
+ ping: Partial<HealthStatusThreshold>;
1368
+ };
1369
+ type NodeMetricSummary = {
1370
+ cpuLoad: number;
1371
+ systemLoad: number;
1372
+ memoryUsage: number;
1373
+ players: number;
1374
+ playingPlayers: number;
1375
+ uptime: number;
1376
+ ping: number;
1377
+ frameDeficit: number;
1378
+ };
1379
+ type HealthStatusObject = {
1380
+ status: HealthStatusKeys;
1381
+ performance: HealthPerformanceKeys;
1382
+ isOverloaded: boolean;
1383
+ needsRestart: boolean;
1384
+ penaltyScore: number;
1385
+ estimatedRemainingCapacity: number;
1386
+ recommendations: string[];
1387
+ metrics: {
1388
+ cpuLoad: number;
1389
+ memoryUsage: number;
1390
+ players: number;
1391
+ playingPlayers: number;
1392
+ uptime: number;
1393
+ ping: number;
1394
+ frameDeficit: number;
1395
+ };
1396
+ };
1397
+ type HealthPerformanceKeys = "excellent" | "good" | "fair" | "poor";
1398
+ type HealthStatusKeys = "healthy" | "degraded" | "critical" | "offline";
1399
+ type AddMixerLayerResponse = {
1400
+ id: string;
1401
+ track: LavalinkTrack;
1402
+ volume: number;
1403
+ };
1404
+ type ListMixerLayersResponse = {
1405
+ mixes: {
1406
+ id: string;
1407
+ track: LavalinkTrack;
1408
+ volume: number;
1409
+ position: number;
1410
+ startTime: number;
1411
+ }[];
1412
+ };
1413
+ type ConnectionMetricsResponse = {
1414
+ status: string;
1415
+ metrics: {
1416
+ speed: {
1417
+ bps: number;
1418
+ kbps: number;
1419
+ mbps: number;
1420
+ };
1421
+ downloadedBytes: number;
1422
+ durationSeconds: number;
1423
+ timestamp: number;
1424
+ };
1425
+ };
1426
+ type NodeLinkLyricsSynced = {
1427
+ loadType: string;
1428
+ data: {
1429
+ synced: true;
1430
+ lang: string;
1431
+ source: string;
1432
+ lines: [
1433
+ {
1434
+ text: string;
1435
+ time: number;
1436
+ duration: number;
1437
+ },
1438
+ {
1439
+ text: string;
1440
+ time: number;
1441
+ duration: number;
1442
+ },
1443
+ {
1444
+ text: string;
1445
+ time: number;
1446
+ duration: number;
1447
+ }
1448
+ ];
1449
+ };
1450
+ };
1451
+ type NodeLinkLyricsPlain = {
1452
+ loadType: string;
1453
+ data: {
1454
+ synced: false;
1455
+ lang: string;
1456
+ source: string;
1457
+ lines: [
1458
+ {
1459
+ text: string;
1460
+ time: null;
1461
+ duration: null;
1462
+ },
1463
+ {
1464
+ text: string;
1465
+ time: null;
1466
+ duration: null;
1467
+ },
1468
+ {
1469
+ text: string;
1470
+ time: null;
1471
+ duration: null;
1472
+ }
1473
+ ];
1474
+ };
1475
+ };
1476
+ type NodeLinkLyrics = NodeLinkLyricsSynced | NodeLinkLyricsPlain;
1477
+ type NodeLinkNoLyrics = {
1478
+ loadType: string;
1479
+ data: {};
1480
+ };
1481
+ type NodeLinkChapter = {
1482
+ title: string;
1483
+ startTime: number;
1484
+ thumbnails: [
1485
+ {
1486
+ url: string;
1487
+ width: number;
1488
+ height: number;
1489
+ }
1490
+ ];
1491
+ duration: number;
1492
+ endTime: number;
1493
+ };
1494
+ type DirectStreamResponse = {
1495
+ url: string;
1496
+ protocol: string;
1497
+ format: string;
1498
+ hlsUrl: string | null;
1499
+ formats: {
1500
+ itag: number;
1501
+ mimeType: string;
1502
+ qualityLabel: string;
1503
+ bitrate: number;
1504
+ }[];
1505
+ };
1506
+ type YoutubeOAuthResponse = {
1507
+ access_token: string;
1508
+ expires_in: number;
1509
+ scope: string;
1510
+ token_type: string;
1511
+ };
1512
+
1513
+ /** Ability to manipulate fetch requests */
1514
+ type ModifyRequest = (options: RequestInit & {
1515
+ path: string;
1516
+ extraQueryUrlParams?: URLSearchParams;
1517
+ }) => void;
1518
+ type SponsorBlockSegment = "sponsor" | "selfpromo" | "interaction" | "intro" | "outro" | "preview" | "music_offtopic" | "filler";
1839
1519
  /**
1840
- * Similar to tremolo. While tremolo oscillates the volume, vibrato oscillates the pitch.
1520
+ * Node Options for creating a lavalink node
1841
1521
  */
1842
- interface VibratoFilter {
1843
- /** The frequency 0.0 < x ≤ 14.0 */
1844
- frequency?: number;
1845
- /** The vibrato depth 0.0 < x ≤ 1.0 */
1846
- depth?: number;
1522
+ interface LavalinkNodeOptions {
1523
+ /** Specify the Node-Type of this node. Default: Lavalink */
1524
+ nodeType?: NodeTypes;
1525
+ /** The Lavalink Server-Ip / Domain-URL */
1526
+ host: string;
1527
+ /** The Lavalink Connection Port */
1528
+ port: number;
1529
+ /** The Lavalink Password / Authorization-Key */
1530
+ authorization: string;
1531
+ /** Does the Server use ssl (https) */
1532
+ secure?: boolean;
1533
+ /** RESUME THE PLAYER? by providing a sessionid on the node-creation */
1534
+ sessionId?: string;
1535
+ /** Add a Custom ID to the node, for later use */
1536
+ id?: string;
1537
+ /** Voice Regions of this Node */
1538
+ regions?: string[];
1539
+ /** The max amount of retries for this node. */
1540
+ retryAmount?: number;
1541
+ /** The delay of how often to retry a reconnection. */
1542
+ retryDelay?: number;
1543
+ /** How long a retry is a valid retry, it should be at least retryAmount*retryDelay. if <= 0 (default) then this won't be accounted. */
1544
+ retryTimespan?: number;
1545
+ /** signal for cancelling requests - default: AbortSignal.timeout(options.requestSignalTimeoutMS || 10000) - put <= 0 to disable */
1546
+ requestSignalTimeoutMS?: number;
1547
+ /** Close on error */
1548
+ closeOnError?: boolean;
1549
+ /** Heartbeat interval , set to <= 0 to disable heartbeat system */
1550
+ heartBeatInterval?: number;
1551
+ /** Recommended, to check whether the client is still connected or not on the stats endpoint */
1552
+ enablePingOnStatsCheck?: boolean;
1553
+ /** Per Node Options */
1554
+ autoChecks?: {
1555
+ /** Wether to check for every node to check for plugin validations or not. (ignored for NodeType NodeLink) */
1556
+ pluginValidations?: boolean;
1557
+ /** Wether to check for every node to check for source validations or not. */
1558
+ sourcesValidations?: boolean;
1559
+ };
1847
1560
  }
1848
1561
  /**
1849
- * Rotates the sound around the stereo channels/user headphones (aka Audio Panning).
1850
- * It can produce an effect similar to https://youtu.be/QB9EB8mTKcc (without the reverb).
1562
+ * Memory Stats object from lavalink
1851
1563
  */
1852
- interface RotationFilter {
1853
- /** The frequency of the audio rotating around the listener in Hz. 0.2 is similar to the example video above */
1854
- rotationHz?: number;
1564
+ interface MemoryStats {
1565
+ /** The free memory of the allocated amount. */
1566
+ free: number;
1567
+ /** The used memory of the allocated amount. */
1568
+ used: number;
1569
+ /** The total allocated memory. */
1570
+ allocated: number;
1571
+ /** The reservable memory. */
1572
+ reservable: number;
1855
1573
  }
1856
1574
  /**
1857
- * Distortion effect. It can generate some pretty unique audio effects.
1575
+ * CPU Stats object from lavalink
1858
1576
  */
1859
- interface DistortionFilter {
1860
- sinOffset?: number;
1861
- sinScale?: number;
1862
- cosOffset?: number;
1863
- cosScale?: number;
1864
- tanOffset?: number;
1865
- tanScale?: number;
1866
- offset?: number;
1867
- scale?: number;
1577
+ interface CPUStats {
1578
+ /** The core amount the host machine has. */
1579
+ cores: number;
1580
+ /** The system load. */
1581
+ systemLoad: number;
1582
+ /** The lavalink load. */
1583
+ lavalinkLoad: number;
1868
1584
  }
1869
1585
  /**
1870
- * Mixes both channels (left and right), with a configurable factor on how much each channel affects the other.
1871
- * With the defaults, both channels are kept independent of each other.
1872
- * Setting all factors to 0.5 means both channels get the same audio.
1586
+ * FrameStats Object from lavalink
1873
1587
  */
1874
- interface ChannelMixFilter {
1875
- /** The left to left channel mix factor (0.0 ≤ x ≤ 1.0) */
1876
- leftToLeft?: number;
1877
- /** The left to right channel mix factor (0.0 ≤ x ≤ 1.0) */
1878
- leftToRight?: number;
1879
- /** The right to left channel mix factor (0.0 ≤ x ≤ 1.0) */
1880
- rightToLeft?: number;
1881
- /** The right to right channel mix factor (0.0 ≤ x ≤ 1.0) */
1882
- rightToRight?: number;
1588
+ interface FrameStats {
1589
+ /** The amount of sent frames. */
1590
+ sent?: number;
1591
+ /** The amount of nulled frames. */
1592
+ nulled?: number;
1593
+ /** The amount of deficit frames. */
1594
+ deficit?: number;
1883
1595
  }
1884
1596
  /**
1885
- * Higher frequencies get suppressed, while lower frequencies pass through this filter, thus the name low pass.
1886
- * Any smoothing values equal to or less than 1.0 will disable the filter.
1597
+ * BaseNodeStats object from Lavalink
1887
1598
  */
1888
- interface LowPassFilter {
1889
- /** The smoothing factor (1.0 < x) */
1890
- smoothing?: number;
1599
+ interface BaseNodeStats {
1600
+ /** The amount of players on the node. */
1601
+ players: number;
1602
+ /** The amount of playing players on the node. */
1603
+ playingPlayers: number;
1604
+ /** The uptime for the node. */
1605
+ uptime: number;
1606
+ /** The memory stats for the node. */
1607
+ memory: MemoryStats;
1608
+ /** The cpu stats for the node. */
1609
+ cpu: CPUStats;
1610
+ /** The frame stats for the node. */
1611
+ frameStats: FrameStats;
1612
+ }
1613
+ interface NodeLinkConnectionMetrics {
1614
+ status: string;
1615
+ metrics: {
1616
+ speed: {
1617
+ bps: number;
1618
+ kbps: number;
1619
+ mbps: number;
1620
+ };
1621
+ downloadedBytes: number;
1622
+ durationSeconds: number;
1623
+ timestamp: number;
1624
+ };
1891
1625
  }
1892
1626
  /**
1893
- * Filter Data stored in the Client and partially sent to Lavalink
1627
+ * Interface for nodeStats from lavalink
1894
1628
  */
1895
- interface FilterData {
1896
- volume?: number;
1897
- karaoke?: KaraokeFilter;
1898
- timescale?: TimescaleFilter;
1899
- tremolo?: TremoloFilter;
1900
- vibrato?: VibratoFilter;
1901
- rotation?: RotationFilter;
1902
- distortion?: DistortionFilter;
1903
- channelMix?: ChannelMixFilter;
1904
- lowPass?: LowPassFilter;
1905
- pluginFilters?: {
1906
- "lavalink-filter-plugin"?: {
1907
- "echo"?: {
1908
- delay?: number;
1909
- decay?: number;
1910
- };
1911
- "reverb"?: {
1912
- delays?: number[];
1913
- gains?: number[];
1914
- };
1915
- };
1916
- "high-pass"?: {
1917
- cutoffFrequency?: number;
1918
- boostFactor?: number;
1919
- };
1920
- "low-pass"?: {
1921
- cutoffFrequency?: number;
1922
- boostFactor?: number;
1923
- };
1924
- normalization?: {
1925
- maxAmplitude?: number;
1926
- adaptive?: boolean;
1629
+ interface NodeStats extends BaseNodeStats {
1630
+ /** The frame stats for the node. */
1631
+ frameStats: FrameStats;
1632
+ /** something from nodeLink https://nodelink.js.org/docs/differences#detailed-statistics */
1633
+ detailedStats?: {
1634
+ api: {
1635
+ /** e.g. { "/v4/loadtracks": 150, "/v4/info": 5 } */
1636
+ requests: Record<string, number>;
1637
+ errors: unknown;
1927
1638
  };
1928
- echo?: {
1929
- echoLength?: number;
1930
- decay?: number;
1639
+ /** e.g. { "youtube": 150, "soundcloud": 5 } */
1640
+ sources: Record<string, number>;
1641
+ playback: {
1642
+ /** e.g. { "TrackStartEvent": 150, "TrackEndEvent": 5 } */
1643
+ events: Record<string, number>;
1931
1644
  };
1645
+ /** and potential others */
1646
+ [key: string]: unknown;
1932
1647
  };
1933
1648
  }
1934
1649
  /**
1935
- * Actual Filter Data sent to Lavalink
1650
+ * Entire lavalink information object from lavalink
1936
1651
  */
1937
- interface LavalinkFilterData extends FilterData {
1938
- equalizer?: EQBand[];
1652
+ interface LavalinkInfo {
1653
+ /** The version of this Lavalink server */
1654
+ version: VersionObject;
1655
+ /** The millisecond unix timestamp when this Lavalink jar was built */
1656
+ buildTime: number;
1657
+ /** The git information of this Lavalink server */
1658
+ git: GitObject;
1659
+ /** The JVM version this Lavalink server runs on */
1660
+ jvm: string;
1661
+ /** The Lavaplayer version being used by this server */
1662
+ lavaplayer: string;
1663
+ /** The enabled source managers for this server */
1664
+ sourceManagers: string[];
1665
+ /** The enabled filters for this server */
1666
+ filters: string[];
1667
+ /** The enabled plugins for this server */
1668
+ plugins: PluginObject[];
1669
+ /** Something from NodeLink: https://nodelink.js.org/docs/differences#server-info */
1670
+ isNodelink?: boolean;
1939
1671
  }
1940
-
1941
1672
  /**
1942
- * Debug events for more detailed logging
1673
+ * Lavalink's version object from lavalink
1943
1674
  */
1944
- declare enum DebugEvents {
1945
- SetSponsorBlock = "SetSponsorBlock",
1946
- DeleteSponsorBlock = "DeleteSponsorBlock",
1947
- TrackEndReplaced = "TrackEndReplaced",
1948
- AutoplayExecution = "AutoplayExecution",
1949
- AutoplayNoSongsAdded = "AutoplayNoSongsAdded",
1950
- AutoplayThresholdSpamLimiter = "AutoplayThresholdSpamLimiter",
1951
- TriggerQueueEmptyInterval = "TriggerQueueEmptyInterval",
1952
- QueueEnded = "QueueEnded",
1953
- TrackStartNewSongsOnly = "TrackStartNewSongsOnly",
1954
- TrackStartNoTrack = "TrackStartNoTrack",
1955
- ResumingFetchingError = "ResumingFetchingError",
1956
- PlayerUpdateNoPlayer = "PlayerUpdateNoPlayer",
1957
- PlayerUpdateFilterFixApply = "PlayerUpdateFilterFixApply",
1958
- PlayerUpdateSuccess = "PlayerUpdateSuccess",
1959
- HeartBeatTriggered = "HeartBeatTriggered",
1960
- NoSocketOnDestroy = "NoSocketOnDestroy",
1961
- SocketCleanupError = "SocketCleanupError",
1962
- SocketTerminateHeartBeatTimeout = "SocketTerminateHeartBeatTimeout",
1963
- TryingConnectWhileConnected = "TryingConnectWhileConnected",
1964
- LavaSearchNothingFound = "LavaSearchNothingFound",
1965
- SearchNothingFound = "SearchNothingFound",
1966
- ValidatingBlacklistLinks = "ValidatingBlacklistLinks",
1967
- ValidatingWhitelistLinks = "ValidatingWhitelistLinks",
1968
- TrackErrorMaxTracksErroredPerTime = "TrackErrorMaxTracksErroredPerTime",
1969
- TrackStuckMaxTracksErroredPerTime = "TrackStuckMaxTracksErroredPerTime",
1970
- PlayerDestroyingSomewhereElse = "PlayerDestroyingSomewhereElse",
1971
- PlayerCreateNodeNotFound = "PlayerCreateNodeNotFound",
1972
- PlayerPlayQueueEmptyTimeoutClear = "PlayerPlayQueueEmptyTimeoutClear",
1973
- PlayerPlayWithTrackReplace = "PlayerPlayWithTrackReplace",
1974
- PlayerPlayUnresolvedTrack = "PlayerPlayUnresolvedTrack",
1975
- PlayerPlayUnresolvedTrackFailed = "PlayerPlayUnresolvedTrackFailed",
1976
- PlayerVolumeAsFilter = "PlayerVolumeAsFilter",
1977
- BandcampSearchLokalEngine = "BandcampSearchLokalEngine",
1978
- PlayerChangeNode = "PlayerChangeNode",
1979
- BuildTrackError = "BuildTrackError",
1980
- TransformRequesterFunctionFailed = "TransformRequesterFunctionFailed",
1981
- GetClosestTrackFailed = "GetClosestTrackFailed",
1982
- PlayerDeleteInsteadOfDestroy = "PlayerDeleteInsteadOfDestroy",
1983
- FailedToConnectToNodes = "FailedToConnectToNodes",
1984
- NoAudioDebug = "NoAudioDebug",
1985
- PlayerAutoReconnect = "PlayerAutoReconnect",
1986
- PlayerDestroyFail = "PlayerDestroyFail",
1987
- PlayerChangeNodeFailNoEligibleNode = "PlayerChangeNodeFailNoEligibleNode",
1988
- PlayerChangeNodeFail = "PlayerChangeNodeFail"
1675
+ interface VersionObject {
1676
+ /** The full version string of this Lavalink server */
1677
+ semver: string;
1678
+ /** The major version of this Lavalink server */
1679
+ major: number;
1680
+ /** The minor version of this Lavalink server */
1681
+ minor: number;
1682
+ /** The patch version of this Lavalink server */
1683
+ patch: number;
1684
+ /** The pre-release version according to semver as a . separated list of identifiers */
1685
+ preRelease?: string;
1686
+ /** The build metadata according to semver as a . separated list of identifiers */
1687
+ build?: string;
1989
1688
  }
1990
1689
  /**
1991
- * Reasons why a player got destroyed
1690
+ * Git information object from lavalink
1992
1691
  */
1993
- declare enum DestroyReasons {
1994
- QueueEmpty = "QueueEmpty",
1995
- NodeDestroy = "NodeDestroy",
1996
- NodeDeleted = "NodeDeleted",
1997
- LavalinkNoVoice = "LavalinkNoVoice",
1998
- NodeReconnectFail = "NodeReconnectFail",
1999
- Disconnected = "Disconnected",
2000
- PlayerReconnectFail = "PlayerReconnectFail",
2001
- PlayerChangeNodeFail = "PlayerChangeNodeFail",
2002
- PlayerChangeNodeFailNoEligibleNode = "PlayerChangeNodeFailNoEligibleNode",
2003
- ChannelDeleted = "ChannelDeleted",
2004
- DisconnectAllNodes = "DisconnectAllNodes",
2005
- ReconnectAllNodes = "ReconnectAllNodes",
2006
- TrackErrorMaxTracksErroredPerTime = "TrackErrorMaxTracksErroredPerTime",
2007
- TrackStuckMaxTracksErroredPerTime = "TrackStuckMaxTracksErroredPerTime"
1692
+ interface GitObject {
1693
+ /** The branch this Lavalink server was built on */
1694
+ branch: string;
1695
+ /** The commit this Lavalink server was built on */
1696
+ commit: string;
1697
+ /** The millisecond unix timestamp for when the commit was created */
1698
+ commitTime: string;
1699
+ }
1700
+ /**
1701
+ * Lavalink's plugins object from lavalink's plugin
1702
+ */
1703
+ interface PluginObject {
1704
+ /** The name of the plugin */
1705
+ name: string;
1706
+ /** The version of the plugin */
1707
+ version: string;
1708
+ }
1709
+ interface LyricsResult {
1710
+ /**The name of the source */
1711
+ sourceName: string;
1712
+ /**The name of the provider */
1713
+ provider: string;
1714
+ /**The result text */
1715
+ text: string | null;
1716
+ /**The lyrics lines */
1717
+ lines: LyricsLine[];
1718
+ /**Information about the plugin */
1719
+ plugin: PluginInfo;
1720
+ }
1721
+ interface LyricsLine {
1722
+ /**The millisecond timestamp */
1723
+ timestamp: number;
1724
+ /**The line duration in milliseconds */
1725
+ duration: number | null;
1726
+ /**The line text */
1727
+ line: string;
1728
+ /**Information about the plugin */
1729
+ plugin: PluginInfo;
1730
+ }
1731
+ type LavalinkNodeIdentifier = string;
1732
+ interface NodeManagerEvents {
1733
+ /**
1734
+ * Emitted when a Node is created.
1735
+ * @event Manager.nodeManager#create
1736
+ */
1737
+ create: (node: LavalinkNode) => void;
1738
+ /**
1739
+ * Emitted when a Node is destroyed.
1740
+ * @event Manager.nodeManager#destroy
1741
+ */
1742
+ destroy: (node: LavalinkNode, destroyReason?: DestroyReasonsType) => void;
1743
+ /**
1744
+ * Emitted when a Node is connected.
1745
+ * @event Manager.nodeManager#connect
1746
+ */
1747
+ connect: (node: LavalinkNode) => void;
1748
+ /**
1749
+ * Emitted when a Node is reconnecting.
1750
+ * @event Manager.nodeManager#reconnecting
1751
+ */
1752
+ reconnecting: (node: LavalinkNode) => void;
1753
+ /**
1754
+ * Emitted When a node starts to reconnect (if you have a reconnection delay, the reconnecting event will be emitted after the retryDelay.)
1755
+ * Useful to check whether the internal node reconnect system works or not
1756
+ * @event Manager.nodeManager#reconnectinprogress
1757
+ */
1758
+ reconnectinprogress: (node: LavalinkNode) => void;
1759
+ /**
1760
+ * Emitted when a Node is disconnects.
1761
+ * @event Manager.nodeManager#disconnect
1762
+ */
1763
+ disconnect: (node: LavalinkNode, reason: {
1764
+ code?: number;
1765
+ reason?: string;
1766
+ }) => void;
1767
+ /**
1768
+ * Emitted when a Node is error.
1769
+ * @event Manager.nodeManager#error
1770
+ */
1771
+ error: (node: LavalinkNode, error: Error, payload?: unknown) => void;
1772
+ /**
1773
+ * Emits every single Node event.
1774
+ * @event Manager.nodeManager#raw
1775
+ */
1776
+ raw: (node: LavalinkNode, payload: unknown) => void;
1777
+ /**
1778
+ * Emits when the node connects resumed. You then need to create all players within this event for your usecase.
1779
+ * Aka for that you need to be able to save player data like vc channel + text channel in a db and then sync it again
1780
+ * @event Manager.nodeManager#nodeResumed
1781
+ */
1782
+ resumed: (node: LavalinkNode, payload: {
1783
+ resumed: true;
1784
+ sessionId: string;
1785
+ op: "ready";
1786
+ }, players: LavalinkPlayer[] | InvalidLavalinkRestRequest) => void;
1787
+ /**
1788
+ * Event Handler for Nodelink specific events https://nodelink.js.org/docs/api/websocket Fully typed and generic based on the eventName.
1789
+ * @event Manager.nodeManager#nodeLinkEvent
1790
+ * @example
1791
+ *
1792
+ * ```ts
1793
+ * this.nodeManager.on("nodeLinkEvent", (node, event, player, track, payload) => {
1794
+ * if (event === "SeekEvent") {
1795
+ * console.log("new position:", payload.position);
1796
+ * }
1797
+ * if (event === "FiltersChangedEvent") {
1798
+ * console.log("new filters state", payload.filters);
1799
+ * }
1800
+ * });
1801
+ * ```
1802
+ */
1803
+ nodeLinkEvent: (...args: {
1804
+ [K in NodeLinkEventTypes]: [
1805
+ node: LavalinkNode,
1806
+ event: K,
1807
+ player: Player,
1808
+ track: Track | null,
1809
+ payload: NodeLinkEventPayload<K>
1810
+ ];
1811
+ }[NodeLinkEventTypes]) => void;
2008
1812
  }
2009
- /**
2010
- * Reasons why a player got disconnected
2011
- */
2012
- declare enum DisconnectReasons {
2013
- Disconnected = "Disconnected",
2014
- DisconnectAllNodes = "DisconnectAllNodes"
1813
+ declare enum ReconnectionState {
1814
+ IDLE = "IDLE",
1815
+ RECONNECTING = "RECONNECTING",
1816
+ PENDING = "PENDING",
1817
+ DESTROYING = "DESTROYING"
2015
1818
  }
2016
- /** The valid SponsorBlock categories */
2017
- declare const validSponsorBlocks: string[];
2018
- /** The audio Outputs Data map declaration */
2019
- declare const audioOutputsData: Record<AudioOutputs, ChannelMixFilter>;
2020
- /** Equalizer Presets */
2021
- declare const EQList: {
2022
- /** A Bassboost Equalizer, so high it distorts the audio */
2023
- BassboostEarrape: EQBand[];
2024
- /** A High and decent Bassboost Equalizer */
2025
- BassboostHigh: EQBand[];
2026
- /** A decent Bassboost Equalizer */
2027
- BassboostMedium: EQBand[];
2028
- /** A slight Bassboost Equalizer */
2029
- BassboostLow: EQBand[];
2030
- /** Makes the Music slightly "better" */
2031
- BetterMusic: EQBand[];
2032
- /** Makes the Music sound like rock music / sound rock music better */
2033
- Rock: EQBand[];
2034
- /** Makes the Music sound like Classic music / sound Classic music better */
2035
- Classic: EQBand[];
2036
- /** Makes the Music sound like Pop music / sound Pop music better */
2037
- Pop: EQBand[];
2038
- /** Makes the Music sound like Electronic music / sound Electronic music better */
2039
- Electronic: EQBand[];
2040
- /** Boosts all Bands slightly for louder and fuller sound */
2041
- FullSound: EQBand[];
2042
- /** Boosts basses + lower highs for a pro gaming sound */
2043
- Gaming: EQBand[];
2044
- };
1819
+ type NodeTypes = "Lavalink" | "NodeLink";
2045
1820
 
2046
- type DestroyReasonsType = keyof typeof DestroyReasons | string;
2047
- type DisconnectReasonsType = keyof typeof DisconnectReasons | string;
2048
- interface PlayerJson {
2049
- /** Guild Id where the player was playing in */
2050
- guildId: string;
2051
- /** Options provided to the player */
2052
- options: PlayerOptions;
2053
- /** Voice Channel Id the player was playing in */
2054
- voiceChannelId: string;
2055
- /** Text Channel Id the player was synced to */
2056
- textChannelId?: string;
2057
- /** Position the player was at */
2058
- position: number;
2059
- /** Lavalink's position the player was at */
2060
- lastPosition: number;
2061
- /** Last time the position was sent from lavalink */
2062
- lastPositionChange: number | null;
2063
- /** Volume in % from the player (without volumeDecrementer) */
2064
- volume: number;
2065
- /** Real Volume used in lavalink (with the volumeDecrementer) */
2066
- lavalinkVolume: number;
2067
- /** The repeatmode from the player */
2068
- repeatMode: RepeatMode;
2069
- /** Pause state */
2070
- paused: boolean;
2071
- /** Whether the player was playing or not */
2072
- playing: boolean;
2073
- /** When the player was created */
2074
- createdTimeStamp?: number;
2075
- /** All current used fitlers Data */
2076
- filters: FilterData;
2077
- /** The player's ping object */
2078
- ping: {
2079
- /** Ping to the voice websocket server */
2080
- ws: number;
2081
- /** Avg. calc. Ping to the lavalink server */
2082
- lavalink: number;
1821
+ declare class FilterManager {
1822
+ static EQList: {
1823
+ BassboostEarrape: EQBand[];
1824
+ BassboostHigh: EQBand[];
1825
+ BassboostMedium: EQBand[];
1826
+ BassboostLow: EQBand[];
1827
+ BetterMusic: EQBand[];
1828
+ Rock: EQBand[];
1829
+ Classic: EQBand[];
1830
+ Pop: EQBand[];
1831
+ Electronic: EQBand[];
1832
+ FullSound: EQBand[];
1833
+ Gaming: EQBand[];
2083
1834
  };
2084
- /** Equalizer Bands used in lavalink */
2085
- equalizer: EQBand[];
2086
- /** The Id of the last used node */
2087
- nodeId?: string;
2088
- /** The SessionId of the node */
2089
- nodeSessionId?: string;
2090
- /** The stored queue */
2091
- queue?: StoredQueue;
2092
- }
2093
- type RepeatMode = "queue" | "track" | "off";
2094
- interface PlayerOptions {
2095
- /** Guild id of the player */
2096
- guildId: string;
2097
- /** The Voice Channel Id */
2098
- voiceChannelId: string;
2099
- /** The Text Channel Id of the Player */
2100
- textChannelId?: string;
2101
- /** instantly change volume with the one play request */
2102
- volume?: number;
2103
- /** VC Region for node selections */
2104
- vcRegion?: string;
2105
- /** if it should join deafened */
2106
- selfDeaf?: boolean;
2107
- /** If it should join muted */
2108
- selfMute?: boolean;
2109
- /** If it should use a specific lavalink node */
2110
- node?: LavalinkNode | string;
2111
- /** If when applying filters, it should use the insta apply filters fix */
2112
- instaUpdateFiltersFix?: boolean;
2113
- /** If a volume should be applied via filters instead of lavalink-volume */
2114
- applyVolumeAsFilter?: boolean;
2115
- /** Custom Data for the player get/set datastorage */
2116
- customData?: anyObject;
2117
- }
2118
- type anyObject = {
2119
- [key: string | number]: string | number | null | anyObject;
2120
- };
2121
- interface BasePlayOptions {
2122
- /** The position to start the track. */
2123
- position?: number;
2124
- /** The position to end the track. */
2125
- endTime?: number;
2126
- /** If to start "paused" */
2127
- paused?: boolean;
2128
- /** The Volume to start with */
2129
- volume?: number;
2130
- /** The Lavalink Filters to use | only with the new REST API */
2131
- filters?: Partial<LavalinkFilterData>;
2132
- /** Voice Update for Lavalink */
2133
- voice?: LavalinkPlayerVoiceOptions;
2134
- }
2135
- interface LavalinkPlayOptions extends BasePlayOptions {
2136
- /** Which Track to play | don't provide, if it should pick from the Queue */
2137
- track?: {
2138
- /** The track encoded base64 string to use instead of the one from the queue system */
2139
- encoded?: Base64 | null;
2140
- /** The identifier of the track to use */
2141
- identifier?: string;
2142
- /** Custom User Data for the track to provide, will then be on the userData object from the track */
2143
- userData?: anyObject;
2144
- /** The Track requester for when u provide encodedTrack / identifer */
2145
- requester?: unknown;
1835
+ /** The Equalizer bands currently applied to the Lavalink Server */
1836
+ equalizerBands: EQBand[];
1837
+ /** Private Util for the instaFix Filters option */
1838
+ filterUpdatedState: boolean;
1839
+ /** All "Active" / "disabled" Player Filters */
1840
+ filters: PlayerFilters;
1841
+ /** The Filter Data sent to Lavalink, only if the filter is enabled (ofc.) */
1842
+ data: FilterData;
1843
+ /** The Player assigned to this Filter Manager */
1844
+ player: Player;
1845
+ /** The Constructor for the FilterManager */
1846
+ constructor(player: Player);
1847
+ /**
1848
+ * Apply Player filters for lavalink filter sending data, if the filter is enabled / not
1849
+ *
1850
+ * @returns {Promise<void>}
1851
+ *
1852
+ * @example
1853
+ * ```ts
1854
+ * // Apply the filters after changing them manually:
1855
+ * player.filterManager.data.volume = 0.5;
1856
+ * // maybe you wanna manually set a distorition filter? then do it like this...
1857
+ * player.filterManager.data.distortion = { sinOffset: 0.5, sinScale: 2, cosOffset: 0.5, cosScale: 2, tanOffset: 0.5, tanScale: 2, offset: 0.5, scale: 2 };
1858
+ * await player.filterManager.applyPlayerFilters();
1859
+ * ```
1860
+ */
1861
+ applyPlayerFilters(): Promise<void>;
1862
+ private privateNot0;
1863
+ private getLavalinkFilterData;
1864
+ /**
1865
+ * Checks if the filters are correctly stated (active / not-active) - mostly used internally.
1866
+ * @param oldFilterTimescale
1867
+ * @returns {boolean} True, if the check was successfull
1868
+ *
1869
+ * @example
1870
+ * ```ts
1871
+ * // Check the filter states
1872
+ * player.filterManager.checkFiltersState();
1873
+ * // Apply the filters after checking
1874
+ * await player.filterManager.applyPlayerFilters();
1875
+ * ```
1876
+ */
1877
+ checkFiltersState(oldFilterTimescale?: Partial<TimescaleFilter>): boolean;
1878
+ /**
1879
+ * Reset all Filters
1880
+ * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
1881
+ *
1882
+ * @example
1883
+ * ```ts
1884
+ * // Reset all filters
1885
+ * await player.filterManager.resetFilters();
1886
+ * ```
1887
+ */
1888
+ resetFilters(): Promise<FilterManager>;
1889
+ /**
1890
+ * Set the Filter Volume
1891
+ * @param volume the volume (0.0 - 5.0)
1892
+ * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
1893
+ *
1894
+ * @example
1895
+ * ```ts
1896
+ * // Set Volume to 50%
1897
+ * await player.filterManager.setVolume(0.5);
1898
+ * // note this is a filter, so it will "jump" to the volume, i think it's like a "volume boost effect" so i marketed it as a filter
1899
+ * ```
1900
+ */
1901
+ setVolume(volume: number): Promise<this>;
1902
+ /**
1903
+ * Set the AudioOutput Filter
1904
+ * @param {AudioOutputs} type the audio output type
1905
+ * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
1906
+ *
1907
+ * @example
1908
+ * ```ts
1909
+ * // Set Audio Output to Mono
1910
+ * await player.filterManager.setAudioOutput("mono");
1911
+ *
1912
+ * // Set Audio Output to Stereo
1913
+ * await player.filterManager.setAudioOutput("stereo");
1914
+ *
1915
+ * // Set Audio Output to Left
1916
+ * await player.filterManager.setAudioOutput("left");
1917
+ *
1918
+ * // Set Audio Output to Right
1919
+ * await player.filterManager.setAudioOutput("right");
1920
+ * ```
1921
+ */
1922
+ setAudioOutput(type: AudioOutputs): Promise<FilterManager>;
1923
+ /**
1924
+ * Set custom filter.timescale#speed . This method disabled both: nightcore & vaporwave. use 1 to reset it to normal
1925
+ * @param {number} speed set the speed of the filter
1926
+ * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
1927
+ *
1928
+ * @example
1929
+ * ```ts
1930
+ * // Set Speed to 1.25 (disableds nightcore and vaporwave effect which are pre-made timescale settings of rate,pitch and speed)
1931
+ * await player.filterManager.setSpeed(1.25);
1932
+ * ```
1933
+ */
1934
+ setSpeed(speed?: number): Promise<FilterManager>;
1935
+ /**
1936
+ * Set custom filter.timescale#pitch . This method disabled both: nightcore & vaporwave. use 1 to reset it to normal
1937
+ * @param {number} pitch set the pitch of the filter
1938
+ * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
1939
+ *
1940
+ * @example
1941
+ * ```ts
1942
+ * // Set Pitch to 1.25 (disableds nightcore and vaporwave effect which are pre-made timescale settings of rate,pitch and speed)
1943
+ * await player.filterManager.setPitch(1.25);
1944
+ * ```
1945
+ */
1946
+ setPitch(pitch?: number): Promise<FilterManager>;
1947
+ /**
1948
+ * Set custom filter.timescale#rate . This method disabled both: nightcore & vaporwave. use 1 to reset it to normal
1949
+ * @param {number} rate set the rate of the filter
1950
+ * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
1951
+ *
1952
+ * @example
1953
+ * ```ts
1954
+ * // Set Rate to 1.25 (disableds nightcore and vaporwave effect which are pre-made timescale settings of rate,pitch and speed)
1955
+ * await player.filterManager.setRate(1.25);
1956
+ * ```
1957
+ */
1958
+ setRate(rate?: number): Promise<FilterManager>;
1959
+ /**
1960
+ * Enables / Disables the rotation effect, (Optional: provide your Own Data)
1961
+ * @param {number} rotationHz set the rotationHz of the filter
1962
+ * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
1963
+ *
1964
+ * @example
1965
+ * ```ts
1966
+ * // Toggle Rotation filter with custom settings
1967
+ * await player.filterManager.toggleRotation(0.4);
1968
+ * // or use the defaults
1969
+ * await player.filterManager.toggleRotation();
1970
+ * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
1971
+ * ```
1972
+ */
1973
+ toggleRotation(rotationHz?: number): Promise<FilterManager>;
1974
+ /**
1975
+ * Enables / Disables the Vibrato effect, (Optional: provide your Own Data)
1976
+ * @param {number} frequency set the frequency of the filter
1977
+ * @param {number} depth set the depth of the filter
1978
+ * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
1979
+ *
1980
+ * @example
1981
+ * ```ts
1982
+ * // Toggle Vibrato filter with custom settings
1983
+ * await player.filterManager.toggleVibrato(8, 0.5);
1984
+ * // or use the defaults
1985
+ * await player.filterManager.toggleVibrato();
1986
+ * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
1987
+ * ```
1988
+ */
1989
+ toggleVibrato(frequency?: number, depth?: number): Promise<FilterManager>;
1990
+ /**
1991
+ * Enables / Disables the Tremolo effect, (Optional: provide your Own Data)
1992
+ * @param {number} frequency set the frequency of the filter
1993
+ * @param {number} depth set the depth of the filter
1994
+ * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
1995
+ *
1996
+ * @example
1997
+ * ```ts
1998
+ * // Toggle Tremolo filter with custom settings
1999
+ * await player.filterManager.toggleTremolo(5, 0.7);
2000
+ * // or use the defaults
2001
+ * await player.filterManager.toggleTremolo();
2002
+ * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
2003
+ * ```
2004
+ */
2005
+ toggleTremolo(frequency?: number, depth?: number): Promise<FilterManager>;
2006
+ /**
2007
+ * Enables / Disables the LowPass effect, (Optional: provide your Own Data)
2008
+ * @param {number} smoothing set the smoothing of the filter
2009
+ * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
2010
+ *
2011
+ * @example
2012
+ * ```ts
2013
+ * // Toggle LowPass filter with custom settings
2014
+ * await player.filterManager.toggleLowPass(30);
2015
+ * // or use the defaults
2016
+ * await player.filterManager.toggleLowPass();
2017
+ * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
2018
+ * ```
2019
+ */
2020
+ toggleLowPass(smoothing?: number): Promise<FilterManager>;
2021
+ /**
2022
+ * Lavalink LavaDspx Plugin Filters
2023
+ */
2024
+ lavalinkLavaDspxPlugin: {
2025
+ /**
2026
+ * Enables / Disables the LowPass effect, (Optional: provide your Own Data)
2027
+ * @param {number} boostFactor set the boost factor of the filter
2028
+ * @param {number} cutoffFrequency set the cutoff frequency of the filter
2029
+ * @returns {Promise<boolean>} the state of the filter after execution.
2030
+ *
2031
+ * @example
2032
+ * ```ts
2033
+ * // Toggle LowPass filter with custom settings
2034
+ * await player.filterManager.lavalinkLavaDspxPlugin.toggleLowPass(1.2, 300);
2035
+ * // or use the defaults
2036
+ * await player.filterManager.lavalinkLavaDspxPlugin.toggleLowPass();
2037
+ * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
2038
+ * ```
2039
+ */
2040
+ toggleLowPass: (boostFactor?: number, cutoffFrequency?: number) => Promise<FilterManager>;
2041
+ /**
2042
+ * Enables / Disables the HighPass effect, (Optional: provide your Own Data)
2043
+ * @param {number} boostFactor [] set the boost factor of the filter
2044
+ * @param {number} cutoffFrequency set the cutoff frequency of the filter
2045
+ * @returns {Promise<boolean>} the state of the filter after execution.
2046
+ *
2047
+ * @example
2048
+ * ```ts
2049
+ * // Toggle HighPass filter with custom settings
2050
+ * await player.filterManager.lavalinkLavaDspxPlugin.toggleHighPass(1.2, 150); // custom values
2051
+ * // or use the defaults
2052
+ * await player.filterManager.lavalinkLavaDspxPlugin.toggleHighPass();
2053
+ * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
2054
+ * ```
2055
+ */
2056
+ toggleHighPass: (boostFactor?: number, cutoffFrequency?: number) => Promise<FilterManager>;
2057
+ /**
2058
+ * Enables / Disables the Normalization effect.
2059
+ * @param {number} [maxAmplitude=0.75] - The maximum amplitude of the audio.
2060
+ * @param {boolean} [adaptive=true] Whether to use adaptive normalization or not.
2061
+ * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
2062
+ *
2063
+ * @example
2064
+ * ```ts
2065
+ * // Toggle Normalization filter with custom settings
2066
+ * await player.filterManager.lavalinkLavaDspxPlugin.toggleNormalization(0.9, false); // custom values
2067
+ * // or use the defaults
2068
+ * await player.filterManager.lavalinkLavaDspxPlugin.toggleNormalization();
2069
+ * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
2070
+ * ```
2071
+ */
2072
+ toggleNormalization: (maxAmplitude?: number, adaptive?: boolean) => Promise<FilterManager>;
2073
+ /**
2074
+ * Enables / Disables the Echo effect, IMPORTANT! Only works with the correct Lavalink Plugin installed. (Optional: provide your Own Data)
2075
+ * @param {number} [decay=0.5] The decay of the echo effect.
2076
+ * @param {number} [echoLength=0.5] The length of the echo effect.
2077
+ * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
2078
+ *
2079
+ * @example
2080
+ * ```ts
2081
+ * // Toggle Echo filter with custom settings
2082
+ * await player.filterManager.lavalinkLavaDspxPlugin.toggleEcho(0.7, 0.6); // custom values
2083
+ * // or use the defaults
2084
+ * await player.filterManager.lavalinkLavaDspxPlugin.toggleEcho();
2085
+ * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
2086
+ * ```
2087
+ */
2088
+ toggleEcho: (decay?: number, echoLength?: number) => Promise<FilterManager>;
2146
2089
  };
2090
+ /**
2091
+ * LavalinkFilter Plugin specific Filters
2092
+ */
2093
+ lavalinkFilterPlugin: {
2094
+ /**
2095
+ * Enables / Disables the Echo effect, IMPORTANT! Only works with the correct Lavalink Plugin installed. (Optional: provide your Own Data)
2096
+ * @param {number} delay set the delay of the echo
2097
+ * @param {number} decay set the decay of the echo
2098
+ * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
2099
+ *
2100
+ * @example
2101
+ * ```ts
2102
+ * // Toggle Echo filter with custom settings
2103
+ * await player.filterManager.lavalinkFilterPlugin.toggleEcho(3, 0.7); // custom values
2104
+ * // or use the defaults
2105
+ * await player.filterManager.lavalinkFilterPlugin.toggleEcho();
2106
+ * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
2107
+ * ```
2108
+ */
2109
+ toggleEcho: (delay?: number, decay?: number) => Promise<FilterManager>;
2110
+ /**
2111
+ * Enables / Disables the Echo effect, IMPORTANT! Only works with the correct Lavalink Plugin installed. (Optional: provide your Own Data)
2112
+ * @param {number} delays set the delays of the reverb
2113
+ * @param {number} gains set the gains of the reverb
2114
+ * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
2115
+ *
2116
+ * @example
2117
+ * ```ts
2118
+ * // Toggle Reverb filter with custom settings
2119
+ * await player.filterManager.lavalinkFilterPlugin.toggleReverb([0.04, 0.045, 0.05, 0.055], [0.85, 0.84, 0.83, 0.82]);
2120
+ * // or use the defaults
2121
+ * await player.filterManager.lavalinkFilterPlugin.toggleReverb();
2122
+ * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
2123
+ * ```
2124
+ */
2125
+ toggleReverb: (delays?: number[], gains?: number[]) => Promise<FilterManager>;
2126
+ };
2127
+ /**
2128
+ * Enables / Disables a Nightcore-like filter Effect. Disables/Overrides both: custom and Vaporwave Filter
2129
+ * @param {number} speed set the speed of the filter
2130
+ * @param {number} pitch set the pitch of the filter
2131
+ * @param {number} rate set the rate of the filter
2132
+ * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
2133
+ *
2134
+ * @example
2135
+ * ```ts
2136
+ * // Toggle Nightcore filter with custom settings
2137
+ * await player.filterManager.toggleNightcore(1.3, 1.3, 0.9);
2138
+ * // or use the defaults
2139
+ * await player.filterManager.toggleNightcore();
2140
+ * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
2141
+ * ```
2142
+ */
2143
+ toggleNightcore(speed?: number, pitch?: number, rate?: number): Promise<FilterManager>;
2144
+ /**
2145
+ * Enables / Disables a Vaporwave-like filter Effect. Disables/Overrides both: custom and nightcore Filter
2146
+ * @param {number} speed set the speed of the filterq
2147
+ * @param {number} pitch set the pitch of the filter
2148
+ * @param {number} rate set the rate of the filter
2149
+ * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
2150
+ *
2151
+ * @example
2152
+ * ```ts
2153
+ * // Toggle Vaporwave filter with custom settings
2154
+ * await player.filterManager.toggleVaporwave(0.9, 0.7, 1);
2155
+ * // or use the defaults
2156
+ * await player.filterManager.toggleVaporwave();
2157
+ * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
2158
+ * ```
2159
+ */
2160
+ toggleVaporwave(speed?: number, pitch?: number, rate?: number): Promise<FilterManager>;
2161
+ /**
2162
+ * Enable / Disables a Karaoke like Filter Effect
2163
+ * @param {number} level set the level of the filter
2164
+ * @param {number} monoLevel set the mono level of the filter
2165
+ * @param {number} filterBand set the filter band of the filter
2166
+ * @param {number} filterWidth set the filter width of the filter
2167
+ * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
2168
+ *
2169
+ * @example
2170
+ * ```ts
2171
+ * // Toggle Karaoke filter with custom settings
2172
+ * await player.filterManager.toggleKaraoke(1.5, 1.0, 220, 100);
2173
+ * // or use the defaults
2174
+ * await player.filterManager.toggleKaraoke();
2175
+ * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
2176
+ * ```
2177
+ */
2178
+ toggleKaraoke(level?: number, monoLevel?: number, filterBand?: number, filterWidth?: number): Promise<FilterManager>;
2179
+ /**
2180
+ * Function to find out if currently there is a custom timescamle etc. filter applied
2181
+ * @returns {boolean} whether a custom filter is active
2182
+ *
2183
+ * @example
2184
+ * ```ts
2185
+ * // Check if a custom filter is active
2186
+ * const isCustom = player.filterManager.isCustomFilterActive();
2187
+ * console.log(`Is custom filter active? ${isCustom}`);
2188
+ * ```
2189
+ */
2190
+ isCustomFilterActive(): boolean;
2191
+ /**
2192
+ * Sets the players equalizer bands using one of the predefined presets.
2193
+ * @param {keyof typeof EQList} preset The preset to use.
2194
+ * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
2195
+ *
2196
+ * @example
2197
+ * ```ts
2198
+ * // Set EQ preset
2199
+ * await player.filterManager.setEQPreset('BassboostMedium');
2200
+ * ```
2201
+ */
2202
+ setEQPreset(preset: keyof typeof EQList): Promise<this>;
2203
+ /**
2204
+ * Sets the players equalizer band on-top of the existing ones.
2205
+ * @param {number} bands
2206
+ * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
2207
+ *
2208
+ * @example
2209
+ * ```ts
2210
+ * // Set EQ bands
2211
+ * await player.filterManager.setEQ([
2212
+ * { band: 0, gain: 0.3 },
2213
+ * { band: 1, gain: -0.2 },
2214
+ * { band: 2, gain: 0.1 }
2215
+ * ]);
2216
+ *
2217
+ * // or use one of the templates:
2218
+ * await player.filterManager.setEQ(player.filterManager.EQList.BassboostMedium); // you can also import EQList from somewhere package if wanted.
2219
+ * ```
2220
+ */
2221
+ setEQ(bands: EQBand | EQBand[]): Promise<this>;
2222
+ /**
2223
+ * Clears the equalizer bands.
2224
+ * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
2225
+ *
2226
+ * @example
2227
+ * ```ts
2228
+ * // Clear all EQ bands
2229
+ * await player.filterManager.clearEQ();
2230
+ * ```
2231
+ */
2232
+ clearEQ(): Promise<this>;
2147
2233
  }
2148
- interface PlayOptions extends LavalinkPlayOptions {
2149
- /** Whether to not replace the track if a play payload is sent. */
2150
- noReplace?: boolean;
2151
- /** Adds track on queue and skips to it */
2152
- clientTrack?: Track | UnresolvedTrack;
2153
- }
2154
-
2155
- type NodeLinkEventTypes = "PlayerCreatedEvent" | "PlayerDestroyedEvent" | "PlayerConnectedEvent" | "PlayerReconnectingEvent" | "VolumeChangedEvent" | "FiltersChangedEvent" | "SeekEvent" | "PauseEvent" | "ConnectionStatusEvent" | "MixStartedEvent" | "MixEndedEvent";
2156
- interface NodeLinkBaseEvent {
2157
- op: "event";
2158
- type: NodeLinkEventTypes;
2159
- guildId: string;
2160
- }
2161
- interface PlayerCreatedEvent extends NodeLinkBaseEvent {
2162
- type: "PlayerCreatedEvent";
2163
- }
2164
- interface PlayerDestroyedEvent extends NodeLinkBaseEvent {
2165
- type: "PlayerDestroyedEvent";
2166
- }
2167
- interface PlayerConnectedEvent extends NodeLinkBaseEvent {
2168
- type: "PlayerConnectedEvent";
2169
- }
2170
- interface PlayerReconnectingEvent extends NodeLinkBaseEvent {
2171
- type: "PlayerReconnectingEvent";
2172
- }
2173
- interface VolumeChangedEvent extends NodeLinkBaseEvent {
2174
- type: "VolumeChangedEvent";
2175
- /** New volume level (0-1000) */
2176
- volume: number;
2177
- }
2178
- interface FiltersChangedEvent extends NodeLinkBaseEvent {
2179
- type: "FiltersChangedEvent";
2180
- filters: LavalinkFilterData;
2181
- }
2182
- interface SeekEvent extends NodeLinkBaseEvent {
2183
- type: "SeekEvent";
2184
- /** New position in milliseconds */
2185
- position: number;
2186
- }
2187
- interface PauseEvent extends NodeLinkBaseEvent {
2188
- type: "PauseEvent";
2189
- /** Whether playback is now paused (true) or resumed (false) */
2190
- paused: boolean;
2191
- }
2192
- interface ConnectionStatusEvent extends NodeLinkBaseEvent {
2193
- type: "ConnectionStatusEvent";
2194
- /** Current connection status */
2195
- connected: boolean;
2196
- }
2197
- interface MixStartedEvent extends NodeLinkBaseEvent {
2198
- type: "MixStartedEvent";
2199
- /** Unique identifier for the mix layer */
2200
- mixId: string;
2201
- /** Full track information of the mixed layer */
2202
- track: LavalinkTrack;
2203
- /** Volume of the mixed layer (0.0 to 1.0) */
2204
- volume: number;
2205
- }
2206
- interface MixEndedEvent extends NodeLinkBaseEvent {
2207
- type: "MixEndedEvent";
2208
- /** Unique identifier for the mix layer */
2209
- mixId: string;
2210
- /** Reason the mix layer ended (FINISHED, REMOVED, ERROR, MAIN_ENDED) */
2211
- reason: "FINISHED" | "REMOVED" | "ERROR" | "MAIN_ENDED" | string;
2212
- }
2213
- type NodeLinkEventPayload<T extends NodeLinkEventTypes> = T extends "PlayerCreatedEvent" ? PlayerCreatedEvent : T extends "PlayerDestroyedEvent" ? PlayerDestroyedEvent : T extends "PlayerConnectedEvent" ? PlayerConnectedEvent : T extends "PlayerReconnectingEvent" ? PlayerReconnectingEvent : T extends "VolumeChangedEvent" ? VolumeChangedEvent : T extends "FiltersChangedEvent" ? FiltersChangedEvent : T extends "SeekEvent" ? SeekEvent : T extends "PauseEvent" ? PauseEvent : T extends "ConnectionStatusEvent" ? ConnectionStatusEvent : T extends "MixStartedEvent" ? MixStartedEvent : T extends "MixEndedEvent" ? MixEndedEvent : never;
2214
2234
 
2215
- /** Ability to manipulate fetch requests */
2216
- type ModifyRequest = (options: RequestInit & {
2217
- path: string;
2218
- extraQueryUrlParams?: URLSearchParams;
2219
- }) => void;
2220
- type SponsorBlockSegment = "sponsor" | "selfpromo" | "interaction" | "intro" | "outro" | "preview" | "music_offtopic" | "filler";
2221
- /**
2222
- * Node Options for creating a lavalink node
2223
- */
2224
- interface LavalinkNodeOptions {
2225
- /** The Lavalink Server-Ip / Domain-URL */
2226
- host: string;
2227
- /** The Lavalink Connection Port */
2228
- port: number;
2229
- /** The Lavalink Password / Authorization-Key */
2230
- authorization: string;
2231
- /** Does the Server use ssl (https) */
2232
- secure?: boolean;
2233
- /** RESUME THE PLAYER? by providing a sessionid on the node-creation */
2234
- sessionId?: string;
2235
- /** Add a Custom ID to the node, for later use */
2236
- id?: string;
2237
- /** Voice Regions of this Node */
2238
- regions?: string[];
2239
- /** The max amount of retries for this node. */
2240
- retryAmount?: number;
2241
- /** The delay of how often to retry a reconnection. */
2242
- retryDelay?: number;
2243
- /** How long a retry is a valid retry, it should be at least retryAmount*retryDelay. if <= 0 (default) then this won't be accounted. */
2244
- retryTimespan?: number;
2245
- /** signal for cancelling requests - default: AbortSignal.timeout(options.requestSignalTimeoutMS || 10000) - put <= 0 to disable */
2246
- requestSignalTimeoutMS?: number;
2247
- /** Close on error */
2248
- closeOnError?: boolean;
2249
- /** Heartbeat interval , set to <= 0 to disable heartbeat system */
2250
- heartBeatInterval?: number;
2251
- /** Recommended, to check whether the client is still connected or not on the stats endpoint */
2252
- enablePingOnStatsCheck?: boolean;
2253
- }
2254
- /**
2255
- * Memory Stats object from lavalink
2256
- */
2257
- interface MemoryStats {
2258
- /** The free memory of the allocated amount. */
2259
- free: number;
2260
- /** The used memory of the allocated amount. */
2261
- used: number;
2262
- /** The total allocated memory. */
2263
- allocated: number;
2264
- /** The reservable memory. */
2265
- reservable: number;
2266
- }
2267
- /**
2268
- * CPU Stats object from lavalink
2269
- */
2270
- interface CPUStats {
2271
- /** The core amount the host machine has. */
2272
- cores: number;
2273
- /** The system load. */
2274
- systemLoad: number;
2275
- /** The lavalink load. */
2276
- lavalinkLoad: number;
2277
- }
2278
- /**
2279
- * FrameStats Object from lavalink
2280
- */
2281
- interface FrameStats {
2282
- /** The amount of sent frames. */
2283
- sent?: number;
2284
- /** The amount of nulled frames. */
2285
- nulled?: number;
2286
- /** The amount of deficit frames. */
2287
- deficit?: number;
2235
+ declare class QueueSaver {
2236
+ /**
2237
+ * The queue store manager
2238
+ */
2239
+ private _;
2240
+ /**
2241
+ * The options for the queue saver
2242
+ */
2243
+ options: {
2244
+ maxPreviousTracks: number;
2245
+ };
2246
+ constructor(options: ManagerQueueOptions);
2247
+ /**
2248
+ * Get the queue for a guild
2249
+ * @param guildId The guild ID
2250
+ * @returns The queue for the guild
2251
+ */
2252
+ get(guildId: string): Promise<Partial<StoredQueue>>;
2253
+ /**
2254
+ * Delete the queue for a guild
2255
+ * @param guildId The guild ID
2256
+ * @returns The queue for the guild
2257
+ */
2258
+ delete(guildId: string): Promise<boolean | void>;
2259
+ /**
2260
+ * Set the queue for a guild
2261
+ * @param guildId The guild ID
2262
+ * @param valueToStringify The queue to set
2263
+ * @returns The queue for the guild
2264
+ */
2265
+ set(guildId: string, valueToStringify: StoredQueue): Promise<boolean | void>;
2266
+ /**
2267
+ * Sync the queue for a guild
2268
+ * @param guildId The guild ID
2269
+ * @returns The queue for the guild
2270
+ */
2271
+ sync(guildId: string): Promise<Partial<StoredQueue>>;
2288
2272
  }
2289
- /**
2290
- * BaseNodeStats object from Lavalink
2291
- */
2292
- interface BaseNodeStats {
2293
- /** The amount of players on the node. */
2294
- players: number;
2295
- /** The amount of playing players on the node. */
2296
- playingPlayers: number;
2297
- /** The uptime for the node. */
2298
- uptime: number;
2299
- /** The memory stats for the node. */
2300
- memory: MemoryStats;
2301
- /** The cpu stats for the node. */
2302
- cpu: CPUStats;
2303
- /** The frame stats for the node. */
2304
- frameStats: FrameStats;
2273
+ declare class DefaultQueueStore implements QueueStoreManager {
2274
+ private data;
2275
+ constructor();
2276
+ /**
2277
+ * Get the queue for a guild
2278
+ * @param guildId The guild ID
2279
+ * @returns The queue for the guild
2280
+ */
2281
+ get(guildId: string): StoredQueue | undefined;
2282
+ /**
2283
+ * Set the queue for a guild
2284
+ * @param guildId The guild ID
2285
+ * @param valueToStringify The queue to set
2286
+ * @returns The queue for the guild
2287
+ */
2288
+ set(guildId: string, valueToStringify: any): boolean;
2289
+ /**
2290
+ * Delete the queue for a guild
2291
+ * @param guildId The guild ID
2292
+ * @returns The queue for the guild
2293
+ */
2294
+ delete(guildId: string): boolean;
2295
+ /**
2296
+ * Stringify the queue for a guild
2297
+ * @param value The queue to stringify
2298
+ * @returns The stringified queue
2299
+ */
2300
+ stringify(value: StoredQueue | string): StoredQueue | string;
2301
+ /**
2302
+ * Parse the queue for a guild
2303
+ * @param value The queue to parse
2304
+ * @returns The parsed queue
2305
+ */
2306
+ parse(value: StoredQueue | string): Partial<StoredQueue>;
2305
2307
  }
2306
- interface NodeLinkConnectionMetrics {
2307
- status: string;
2308
- metrics: {
2309
- speed: {
2310
- bps: number;
2311
- kbps: number;
2312
- mbps: number;
2308
+ declare class Queue {
2309
+ readonly tracks: (Track | UnresolvedTrack)[];
2310
+ readonly previous: Track[];
2311
+ current: Track | null;
2312
+ options: {
2313
+ maxPreviousTracks: number;
2314
+ };
2315
+ private readonly guildId;
2316
+ private readonly QueueSaver;
2317
+ private managerUtils;
2318
+ private queueChanges;
2319
+ /**
2320
+ * Create a new Queue
2321
+ * @param guildId The guild ID
2322
+ * @param data The data to initialize the queue with
2323
+ * @param QueueSaver The queue saver to use
2324
+ * @param queueOptions
2325
+ */
2326
+ constructor(guildId: string, data?: Partial<StoredQueue>, QueueSaver?: QueueSaver, queueOptions?: ManagerQueueOptions);
2327
+ /**
2328
+ * Utils for a Queue
2329
+ */
2330
+ utils: {
2331
+ /**
2332
+ * Save the current cached Queue on the database/server (overides the server)
2333
+ */
2334
+ save: () => Promise<boolean | void>;
2335
+ /**
2336
+ * Sync the current queue database/server with the cached one
2337
+ * @returns {void}
2338
+ */
2339
+ sync: (override?: boolean, dontSyncCurrent?: boolean) => Promise<void>;
2340
+ destroy: () => Promise<boolean | void>;
2341
+ /**
2342
+ * @returns {{current:Track|null, previous:Track[], tracks:Track[]}}The Queue, but in a raw State, which allows easier handling for the QueueStoreManager
2343
+ */
2344
+ toJSON: () => StoredQueue;
2345
+ /**
2346
+ * Get the Total Duration of the Queue-Songs summed up
2347
+ * @returns {number}
2348
+ */
2349
+ totalDuration: () => number;
2350
+ /**
2351
+ * Find tracks in the queue matching specific criteria.
2352
+ * **This method DOES NOT MUTATE the queue** - it returns a new array without modifying the original queue.
2353
+ * @param predicate Function to test each track, or an object with criteria to match
2354
+ * @returns Array of matching tracks with their indexes
2355
+ *
2356
+ * @example
2357
+ * ```ts
2358
+ * // Find by author
2359
+ * const artistTracks = player.queue.utils.filterTracks({ author: "Artist Name" });
2360
+ *
2361
+ * // Find by duration range (5-10 minutes)
2362
+ * const longTracks = player.queue.utils.filterTracks({ duration: { min: 300000, max: 600000 } });
2363
+ *
2364
+ * // Find by title (partial match)
2365
+ * const titleMatches = player.queue.utils.filterTracks({ title: "Never Gonna" });
2366
+ *
2367
+ * // Custom predicate
2368
+ * const customFilter = player.queue.utils.filterTracks(track => track.info.isStream);
2369
+ * ```
2370
+ */
2371
+ filterTracks: (predicate: ((track: Track | UnresolvedTrack, index: number) => boolean) | {
2372
+ title?: string;
2373
+ author?: string;
2374
+ duration?: number | {
2375
+ min?: number;
2376
+ max?: number;
2377
+ };
2378
+ uri?: string;
2379
+ identifier?: string;
2380
+ sourceName?: string;
2381
+ isStream?: boolean;
2382
+ isSeekable?: boolean;
2383
+ }) => Array<{
2384
+ track: Track | UnresolvedTrack;
2385
+ index: number;
2386
+ }>;
2387
+ /**
2388
+ * Find a single track in the queue matching specific criteria.
2389
+ * **This method DOES NOT MUTATE the queue** - it searches without modifying the original queue.
2390
+ * @param predicate Function to test each track, or an object with criteria to match
2391
+ * @returns First matching track with its index, or null if not found
2392
+ *
2393
+ * @example
2394
+ * ```ts
2395
+ * // Find first track by author
2396
+ * const track = player.queue.utils.findTrack({ author: "Artist Name" });
2397
+ * if (track) {
2398
+ * console.log(`Found at index ${track.index}: ${track.track.info.title}`);
2399
+ * }
2400
+ *
2401
+ * // Find with custom predicate
2402
+ * const liveStream = player.queue.utils.findTrack(track => track.info.isStream);
2403
+ * ```
2404
+ */
2405
+ findTrack: (predicate: ((track: Track | UnresolvedTrack, index: number) => boolean) | {
2406
+ title?: string;
2407
+ author?: string;
2408
+ duration?: number | {
2409
+ min?: number;
2410
+ max?: number;
2411
+ };
2412
+ uri?: string;
2413
+ identifier?: string;
2414
+ sourceName?: string;
2415
+ isStream?: boolean;
2416
+ isSeekable?: boolean;
2417
+ }) => {
2418
+ track: Track | UnresolvedTrack;
2419
+ index: number;
2420
+ } | null;
2421
+ };
2422
+ /**
2423
+ * Shuffles the current Queue, then saves it
2424
+ * @returns Amount of Tracks in the Queue
2425
+ */
2426
+ shuffle(): Promise<number>;
2427
+ /**
2428
+ * Add a Track to the Queue, and after saved in the "db" it returns the amount of the Tracks
2429
+ * @param {Track | Track[]} TrackOrTracks
2430
+ * @param {number} index At what position to add the Track
2431
+ * @returns {number} Queue-Size (for the next Tracks)
2432
+ */
2433
+ add(TrackOrTracks: Track | UnresolvedTrack | (Track | UnresolvedTrack)[], index?: number): any;
2434
+ /**
2435
+ * Splice the tracks in the Queue
2436
+ * @param {number} index Where to remove the Track
2437
+ * @param {number} amount How many Tracks to remove?
2438
+ * @param {Track | Track[]} TrackOrTracks Want to Add more Tracks?
2439
+ * @returns {Track} Spliced Track
2440
+ */
2441
+ splice(index: number, amount: number, TrackOrTracks?: Track | UnresolvedTrack | (Track | UnresolvedTrack)[]): any;
2442
+ /**
2443
+ * Remove stuff from the queue.tracks array
2444
+ * - single Track | UnresolvedTrack
2445
+ * - multiple Track | UnresovedTrack
2446
+ * - at the index or multiple indexes
2447
+ * - Since v2.7 the removed tracks get unshifted into the previous queue state instead of pushed (indexed at the start instead of end - as it should)
2448
+ * @param removeQueryTrack
2449
+ * @returns null (if nothing was removed) / { removed } where removed is an array with all removed elements
2450
+ *
2451
+ * @example
2452
+ * ```js
2453
+ * // remove single track
2454
+ *
2455
+ * const track = player.queue.tracks[4];
2456
+ * await player.queue.remove(track);
2457
+ *
2458
+ * // if you already have the index you can straight up pass it too
2459
+ * await player.queue.remove(4);
2460
+ *
2461
+ *
2462
+ * // if you want to remove multiple tracks, e.g. from position 4 to position 10 you can do smt like this
2463
+ * await player.queue.remove(player.queue.tracks.slice(4, 10)) // get's the tracks from 4 - 10, which then get's found in the remove function to be removed
2464
+ *
2465
+ * // I still highly suggest to use .splice!
2466
+ *
2467
+ * await player.queue.splice(4, 10); // removes at index 4, 10 tracks
2468
+ *
2469
+ * await player.queue.splice(1, 1); // removes at index 1, 1 track
2470
+ *
2471
+ * await player.queue.splice(4, 0, ...tracks) // removes 0 tracks at position 4, and then inserts all tracks after position 4.
2472
+ * ```
2473
+ */
2474
+ remove<T extends Track | UnresolvedTrack | number | Track[] | UnresolvedTrack[] | number[] | (number | Track | UnresolvedTrack)[]>(removeQueryTrack: T): Promise<{
2475
+ removed: (Track | UnresolvedTrack)[];
2476
+ } | null>;
2477
+ /**
2478
+ * Shifts the previous array, to return the last previous track & thus remove it from the previous queue
2479
+ * @returns
2480
+ *
2481
+ * @example
2482
+ * ```js
2483
+ * // example on how to play the previous track again
2484
+ * const previous = await player.queue.shiftPrevious(); // get the previous track and remove it from the previous queue array!!
2485
+ * if(!previous) return console.error("No previous track found");
2486
+ * await player.play({ clientTrack: previous }); // play it again
2487
+ * ```
2488
+ */
2489
+ shiftPrevious(): Promise<Track>;
2490
+ /**
2491
+ * Find tracks in the queue matching specific criteria.
2492
+ * **This method DOES NOT MUTATE the queue** - it returns a new array without modifying the original queue.
2493
+ * @deprecated Use `player.queue.utils.filterTracks()` instead.
2494
+ * @param predicate Function to test each track, or an object with criteria to match
2495
+ * @returns Array of matching tracks with their indexes
2496
+ *
2497
+ * @example
2498
+ * ```ts
2499
+ * // Use the new method instead:
2500
+ * const artistTracks = player.queue.utils.filterTracks({ author: "Artist Name" });
2501
+ * ```
2502
+ */
2503
+ filter(predicate: ((track: Track | UnresolvedTrack, index: number) => boolean) | {
2504
+ title?: string;
2505
+ author?: string;
2506
+ duration?: number | {
2507
+ min?: number;
2508
+ max?: number;
2509
+ };
2510
+ uri?: string;
2511
+ identifier?: string;
2512
+ sourceName?: string;
2513
+ isStream?: boolean;
2514
+ isSeekable?: boolean;
2515
+ }): Array<{
2516
+ track: Track | UnresolvedTrack;
2517
+ index: number;
2518
+ }>;
2519
+ /**
2520
+ * Find a single track in the queue matching specific criteria.
2521
+ * **This method DOES NOT MUTATE the queue** - it searches without modifying the original queue.
2522
+ * @deprecated Use `player.queue.utils.findTrack()` instead.
2523
+ * @param predicate Function to test each track, or an object with criteria to match
2524
+ * @returns First matching track with its index, or null if not found
2525
+ *
2526
+ * @example
2527
+ * ```ts
2528
+ * // Use the new method instead:
2529
+ * const track = player.queue.utils.findTrack({ author: "Artist Name" });
2530
+ * ```
2531
+ */
2532
+ find(predicate: ((track: Track | UnresolvedTrack, index: number) => boolean) | {
2533
+ title?: string;
2534
+ author?: string;
2535
+ duration?: number | {
2536
+ min?: number;
2537
+ max?: number;
2313
2538
  };
2314
- downloadedBytes: number;
2315
- durationSeconds: number;
2316
- timestamp: number;
2317
- };
2539
+ uri?: string;
2540
+ identifier?: string;
2541
+ sourceName?: string;
2542
+ isStream?: boolean;
2543
+ isSeekable?: boolean;
2544
+ }): {
2545
+ track: Track | UnresolvedTrack;
2546
+ index: number;
2547
+ } | null;
2548
+ /**
2549
+ * Sort the queue tracks by a specific property.
2550
+ * **⚠️ This method MUTATES the queue** - it modifies the original queue in place.
2551
+ * @param sortBy Property to sort by or custom comparator function
2552
+ * @param order Sort order: 'asc' or 'desc' (default: 'asc')
2553
+ * @returns The queue instance for chaining
2554
+ *
2555
+ * @example
2556
+ * ```ts
2557
+ * // Sort by duration (shortest first)
2558
+ * await player.queue.sortBy("duration", "asc");
2559
+ *
2560
+ * // Sort by title alphabetically (Z-A)
2561
+ * await player.queue.sortBy("title", "desc");
2562
+ *
2563
+ * // Custom sorting
2564
+ * await player.queue.sortBy((a, b) => {
2565
+ * return a.info.title.localeCompare(b.info.title);
2566
+ * });
2567
+ * ```
2568
+ */
2569
+ sortBy(sortBy: "duration" | "title" | "author" | ((a: Track | UnresolvedTrack, b: Track | UnresolvedTrack) => number), order?: "asc" | "desc"): Promise<this>;
2570
+ /**
2571
+ * Get a sorted copy of the queue tracks without modifying the original queue.
2572
+ * **This method DOES NOT MUTATE the queue** - it returns a new sorted array, similar to `Array.toSorted()`.
2573
+ * @param sortBy Property to sort by or custom comparator function
2574
+ * @param order Sort order: 'asc' or 'desc' (default: 'asc')
2575
+ * @returns A new sorted array of tracks (does not modify the queue)
2576
+ *
2577
+ * @example
2578
+ * ```ts
2579
+ * // Get sorted copy by duration (shortest first)
2580
+ * const sortedTracks = player.queue.toSortedBy("duration", "asc");
2581
+ * // Original queue remains unchanged
2582
+ *
2583
+ * // Get sorted copy by title alphabetically (Z-A)
2584
+ * const sortedByTitle = player.queue.toSortedBy("title", "desc");
2585
+ *
2586
+ * // Custom sorting
2587
+ * const customSorted = player.queue.toSortedBy((a, b) => {
2588
+ * return a.info.title.localeCompare(b.info.title);
2589
+ * });
2590
+ * ```
2591
+ */
2592
+ toSortedBy(sortBy: "duration" | "title" | "author" | ((a: Track | UnresolvedTrack, b: Track | UnresolvedTrack) => number), order?: "asc" | "desc"): (Track | UnresolvedTrack)[];
2593
+ /**
2594
+ * Get a range of tracks from the queue.
2595
+ * **This method DOES NOT MUTATE the queue** - it returns a new array slice, similar to `Array.slice()`.
2596
+ * @param start Start index (inclusive)
2597
+ * @param end End index (exclusive)
2598
+ * @returns Array of tracks in the specified range
2599
+ *
2600
+ * @example
2601
+ * ```ts
2602
+ * // Get tracks 5-15
2603
+ * const tracks = player.queue.getTracks(5, 15);
2604
+ *
2605
+ * // Get first 10 tracks
2606
+ * const firstTen = player.queue.getTracks(0, 10);
2607
+ * ```
2608
+ */
2609
+ getTracks(start: number, end?: number): (Track | UnresolvedTrack)[];
2318
2610
  }
2319
- /**
2320
- * Interface for nodeStats from lavalink
2321
- */
2322
- interface NodeStats extends BaseNodeStats {
2323
- /** The frame stats for the node. */
2324
- frameStats: FrameStats;
2325
- /** something from nodeLink https://nodelink.js.org/docs/differences#detailed-statistics */
2326
- detailedStats?: {
2327
- api: {
2328
- /** e.g. { "/v4/loadtracks": 150, "/v4/info": 5 } */
2329
- requests: Record<string, number>;
2330
- errors: unknown;
2331
- };
2332
- /** e.g. { "youtube": 150, "soundcloud": 5 } */
2333
- sources: Record<string, number>;
2334
- playback: {
2335
- /** e.g. { "TrackStartEvent": 150, "TrackEndEvent": 5 } */
2336
- events: Record<string, number>;
2337
- };
2338
- /** and potential others */
2339
- [key: string]: unknown;
2611
+
2612
+ declare class Player {
2613
+ /** Filter Manager per player */
2614
+ filterManager: FilterManager;
2615
+ /** circular reference to the lavalink Manager from the Player for easier use */
2616
+ LavalinkManager: LavalinkManager;
2617
+ /** Player options currently used, mutation doesn't affect player's state */
2618
+ options: PlayerOptions;
2619
+ /** The lavalink node assigned the the player, don't change it manually */
2620
+ node: LavalinkNode | NodeLinkNode;
2621
+ /** The queue from the player */
2622
+ queue: Queue;
2623
+ /** The Guild Id of the Player */
2624
+ guildId: string;
2625
+ /** The Voice Channel Id of the Player */
2626
+ voiceChannelId: string | null;
2627
+ /** The Text Channel Id of the Player */
2628
+ textChannelId: string | null;
2629
+ /** States if the Bot is supposed to be outputting audio */
2630
+ playing: boolean;
2631
+ /** States if the Bot is paused or not */
2632
+ paused: boolean;
2633
+ /** Repeat Mode of the Player */
2634
+ repeatMode: RepeatMode;
2635
+ /** Player's ping */
2636
+ ping: {
2637
+ lavalink: number;
2638
+ ws: number;
2340
2639
  };
2341
- }
2342
- /**
2343
- * Entire lavalink information object from lavalink
2344
- */
2345
- interface LavalinkInfo {
2346
- /** The version of this Lavalink server */
2347
- version: VersionObject;
2348
- /** The millisecond unix timestamp when this Lavalink jar was built */
2349
- buildTime: number;
2350
- /** The git information of this Lavalink server */
2351
- git: GitObject;
2352
- /** The JVM version this Lavalink server runs on */
2353
- jvm: string;
2354
- /** The Lavaplayer version being used by this server */
2355
- lavaplayer: string;
2356
- /** The enabled source managers for this server */
2357
- sourceManagers: string[];
2358
- /** The enabled filters for this server */
2359
- filters: string[];
2360
- /** The enabled plugins for this server */
2361
- plugins: PluginObject[];
2362
- /** Something from NodeLink: https://nodelink.js.org/docs/differences#server-info */
2363
- isNodelink?: boolean;
2364
- }
2365
- /**
2366
- * Lavalink's version object from lavalink
2367
- */
2368
- interface VersionObject {
2369
- /** The full version string of this Lavalink server */
2370
- semver: string;
2371
- /** The major version of this Lavalink server */
2372
- major: number;
2373
- /** The minor version of this Lavalink server */
2374
- minor: number;
2375
- /** The patch version of this Lavalink server */
2376
- patch: number;
2377
- /** The pre-release version according to semver as a . separated list of identifiers */
2378
- preRelease?: string;
2379
- /** The build metadata according to semver as a . separated list of identifiers */
2380
- build?: string;
2381
- }
2382
- /**
2383
- * Git information object from lavalink
2384
- */
2385
- interface GitObject {
2386
- /** The branch this Lavalink server was built on */
2387
- branch: string;
2388
- /** The commit this Lavalink server was built on */
2389
- commit: string;
2390
- /** The millisecond unix timestamp for when the commit was created */
2391
- commitTime: string;
2392
- }
2393
- /**
2394
- * Lavalink's plugins object from lavalink's plugin
2395
- */
2396
- interface PluginObject {
2397
- /** The name of the plugin */
2398
- name: string;
2399
- /** The version of the plugin */
2400
- version: string;
2401
- }
2402
- interface LyricsResult {
2403
- /**The name of the source */
2404
- sourceName: string;
2405
- /**The name of the provider */
2406
- provider: string;
2407
- /**The result text */
2408
- text: string | null;
2409
- /**The lyrics lines */
2410
- lines: LyricsLine[];
2411
- /**Information about the plugin */
2412
- plugin: PluginInfo;
2413
- }
2414
- interface LyricsLine {
2415
- /**The millisecond timestamp */
2416
- timestamp: number;
2417
- /**The line duration in milliseconds */
2418
- duration: number | null;
2419
- /**The line text */
2420
- line: string;
2421
- /**Information about the plugin */
2422
- plugin: PluginInfo;
2423
- }
2424
- type LavalinkNodeIdentifier = string;
2425
- interface NodeManagerEvents {
2640
+ /** The Display Volume */
2641
+ volume: number;
2642
+ /** The Volume Lavalink actually is outputting */
2643
+ lavalinkVolume: number;
2644
+ /** The current Positin of the player (Calculated) */
2645
+ get position(): number;
2646
+ /** The timestamp when the last position change update happened */
2647
+ lastPositionChange: number | null;
2648
+ /** The current Positin of the player (from Lavalink) */
2649
+ lastPosition: number;
2650
+ lastSavedPosition: number;
2651
+ /** When the player was created [Timestamp in Ms] (from lavalink) */
2652
+ createdTimeStamp: number;
2653
+ /** The Player Connection's State (from Lavalink) */
2654
+ connected: boolean | undefined;
2655
+ /** Voice Server Data (from Lavalink) */
2656
+ voice: LavalinkPlayerVoiceOptions;
2657
+ voiceState: {
2658
+ selfDeaf: boolean;
2659
+ selfMute: boolean;
2660
+ serverDeaf: boolean;
2661
+ serverMute: boolean;
2662
+ suppress: boolean;
2663
+ };
2664
+ /** Custom data for the player */
2665
+ private readonly data;
2666
+ /**
2667
+ * Emits a debug event to the LavalinkManager
2668
+ * @param name name of the event
2669
+ * @param eventData event data
2670
+ */
2671
+ private _emitDebugEvent;
2672
+ /**
2673
+ * Create a new Player
2674
+ * @param options
2675
+ * @param LavalinkManager
2676
+ */
2677
+ constructor(options: PlayerOptions, LavalinkManager: LavalinkManager, dontEmitPlayerCreateEvent?: boolean);
2678
+ /**
2679
+ * Set custom data.
2680
+ * @param key
2681
+ * @param value
2682
+ */
2683
+ set(key: string, value: unknown): this;
2684
+ /**
2685
+ * Get custom data.
2686
+ * @param key
2687
+ */
2688
+ get<T>(key: string): T;
2426
2689
  /**
2427
- * Emitted when a Node is created.
2428
- * @event Manager.nodeManager#create
2690
+ * CLears all the custom data.
2429
2691
  */
2430
- "create": (node: LavalinkNode) => void;
2692
+ clearData(): this;
2431
2693
  /**
2432
- * Emitted when a Node is destroyed.
2433
- * @event Manager.nodeManager#destroy
2694
+ * Get all custom Data
2434
2695
  */
2435
- "destroy": (node: LavalinkNode, destroyReason?: DestroyReasonsType) => void;
2696
+ getAllData(): Record<string, unknown>;
2436
2697
  /**
2437
- * Emitted when a Node is connected.
2438
- * @event Manager.nodeManager#connect
2698
+ * Play the next track from the queue / a specific track, with playoptions for Lavalink
2699
+ * @param options
2439
2700
  */
2440
- "connect": (node: LavalinkNode) => void;
2701
+ play(options?: Partial<PlayOptions>): any;
2441
2702
  /**
2442
- * Emitted when a Node is reconnecting.
2443
- * @event Manager.nodeManager#reconnecting
2444
- */
2445
- "reconnecting": (node: LavalinkNode) => void;
2703
+ * Set the Volume for the Player
2704
+ * @param volume The Volume in percent
2705
+ * @param ignoreVolumeDecrementer If it should ignore the volumedecrementer option
2706
+ */
2707
+ setVolume(volume: number, ignoreVolumeDecrementer?: boolean): Promise<this>;
2446
2708
  /**
2447
- * Emitted When a node starts to reconnect (if you have a reconnection delay, the reconnecting event will be emitted after the retryDelay.)
2448
- * Useful to check whether the internal node reconnect system works or not
2449
- * @event Manager.nodeManager#reconnectinprogress
2709
+ * Search for a track
2710
+ * @param query The query to search for
2711
+ * @param requestUser The user that requested the track
2712
+ * @param throwOnEmpty If an error should be thrown if no track is found
2713
+ * @returns The search result
2450
2714
  */
2451
- "reconnectinprogress": (node: LavalinkNode) => void;
2715
+ lavaSearch(query: LavaSearchQuery, requestUser: unknown, throwOnEmpty?: boolean): Promise<LavaSearchResponse | SearchResult>;
2452
2716
  /**
2453
- * Emitted when a Node is disconnects.
2454
- * @event Manager.nodeManager#disconnect
2455
- */
2456
- "disconnect": (node: LavalinkNode, reason: {
2457
- code?: number;
2458
- reason?: string;
2459
- }) => void;
2717
+ * Set the SponsorBlock
2718
+ * @param segments The segments to set
2719
+ */
2720
+ setSponsorBlock(segments?: SponsorBlockSegment[]): Promise<void>;
2460
2721
  /**
2461
- * Emitted when a Node is error.
2462
- * @event Manager.nodeManager#error
2463
- */
2464
- "error": (node: LavalinkNode, error: Error, payload?: unknown) => void;
2722
+ * Get the SponsorBlock
2723
+ */
2724
+ getSponsorBlock(): Promise<SponsorBlockSegment[]>;
2465
2725
  /**
2466
- * Emits every single Node event.
2467
- * @event Manager.nodeManager#raw
2468
- */
2469
- "raw": (node: LavalinkNode, payload: unknown) => void;
2726
+ * Delete the SponsorBlock
2727
+ */
2728
+ deleteSponsorBlock(): Promise<void>;
2470
2729
  /**
2471
- * Emits when the node connects resumed. You then need to create all players within this event for your usecase.
2472
- * Aka for that you need to be able to save player data like vc channel + text channel in a db and then sync it again
2473
- * @event Manager.nodeManager#nodeResumed
2730
+ *
2731
+ * @param query Query for your data
2732
+ * @param requestUser
2474
2733
  */
2475
- "resumed": (node: LavalinkNode, payload: {
2476
- resumed: true;
2477
- sessionId: string;
2478
- op: "ready";
2479
- }, players: LavalinkPlayer[] | InvalidLavalinkRestRequest) => void;
2734
+ search(query: SearchQuery, requestUser: unknown, throwOnEmpty?: boolean): Promise<UnresolvedSearchResult | SearchResult>;
2480
2735
  /**
2481
- * Event Handler for Nodelink specific events https://nodelink.js.org/docs/api/websocket Fully typed and generic based on the eventName.
2482
- * @event Manager.nodeManager#nodeLinkEvent
2736
+ * Pause the player
2737
+ */
2738
+ pause(): Promise<this>;
2739
+ /**
2740
+ * Resume the Player
2741
+ */
2742
+ resume(): Promise<this>;
2743
+ /**
2744
+ * Seek to a specific Position
2745
+ * @param position
2746
+ */
2747
+ seek(position: number): Promise<this>;
2748
+ /**
2749
+ * Set the Repeatmode of the Player
2750
+ * @param repeatMode
2751
+ */
2752
+ setRepeatMode(repeatMode: RepeatMode): Promise<this>;
2753
+ /**
2754
+ * Skip the current song, or a specific amount of songs
2755
+ * @param amount provide the index of the next track to skip to
2756
+ */
2757
+ skip(skipTo?: number, throwError?: boolean): Promise<this>;
2758
+ /**
2759
+ * Clears the queue and stops playing. Does not destroy the Player and not leave the channel
2760
+ * @returns
2761
+ */
2762
+ stopPlaying(clearQueue?: boolean, executeAutoplay?: boolean): Promise<this>;
2763
+ /**
2764
+ * Connects the Player to the Voice Channel
2765
+ * @returns
2766
+ */
2767
+ connect(): Promise<this>;
2768
+ changeVoiceState(data: {
2769
+ voiceChannelId?: string;
2770
+ selfDeaf?: boolean;
2771
+ selfMute?: boolean;
2772
+ }): Promise<this>;
2773
+ /**
2774
+ * Disconnects the Player from the Voice Channel, but keeps the player in the cache
2775
+ * @param force If false it throws an error, if player thinks it's already disconnected
2776
+ * @returns
2777
+ */
2778
+ disconnect(force?: boolean): Promise<this>;
2779
+ /**
2780
+ * Destroy the player and disconnect from the voice channel
2781
+ */
2782
+ destroy(reason?: DestroyReasons | string, disconnect?: boolean): Promise<this>;
2783
+ /**
2784
+ * Get the current lyrics of the track currently playing on the guild
2785
+ * @param guildId The guild id to get the current lyrics for
2786
+ * @param skipTrackSource If true, it will not try to get the lyrics from the track source
2787
+ * @returns The current lyrics
2483
2788
  * @example
2484
- *
2485
2789
  * ```ts
2486
- * this.nodeManager.on("nodeLinkEvent", (node, event, player, track, payload) => {
2487
- * if (event === "SeekEvent") {
2488
- * console.log("new position:", payload.position);
2489
- * }
2490
- * if (event === "FiltersChangedEvent") {
2491
- * console.log("new filters state", payload.filters);
2492
- * }
2493
- * });
2790
+ * const lyrics = await player.getCurrentLyrics();
2494
2791
  * ```
2495
2792
  */
2496
- "nodeLinkEvent": (...args: {
2497
- [K in NodeLinkEventTypes]: [node: LavalinkNode, event: K, player: Player, track: Track | null, payload: NodeLinkEventPayload<K>];
2498
- }[NodeLinkEventTypes]) => void;
2793
+ getCurrentLyrics(skipTrackSource?: boolean): Promise<LyricsResult>;
2794
+ /**
2795
+ * Get the lyrics of a specific track
2796
+ * @param track The track to get the lyrics for
2797
+ * @param skipTrackSource If true, it will not try to get the lyrics from the track source
2798
+ * @returns The lyrics of the track
2799
+ * @example
2800
+ * ```ts
2801
+ * const lyrics = await player.getLyrics(player.queue.tracks[0], true);
2802
+ * ```
2803
+ */
2804
+ getLyrics(track: Track, skipTrackSource?: boolean): Promise<LyricsResult>;
2805
+ /**
2806
+ * Subscribe to the lyrics event on a specific guild to active live lyrics events
2807
+ * @returns The unsubscribe function
2808
+ * @example
2809
+ * ```ts
2810
+ * const lyrics = await player.subscribeLyrics();
2811
+ * ```
2812
+ */
2813
+ subscribeLyrics(): Promise<unknown>;
2814
+ /**
2815
+ * Unsubscribe from the lyrics event on a specific guild to disable live lyrics events
2816
+ * @returns The unsubscribe function
2817
+ * @example
2818
+ * ```ts
2819
+ * const lyrics = await player.unsubscribeLyrics();
2820
+ * ```
2821
+ */
2822
+ unsubscribeLyrics(): Promise<void>;
2823
+ /**
2824
+ * Move the player on a different Audio-Node
2825
+ * @param newNode New Node / New Node Id
2826
+ * @param checkSources If it should check if the sources are supported by the new node @default true
2827
+ * @return The new Node Id
2828
+ * @example
2829
+ * ```ts
2830
+ * const changeNode = await player.changeNode(newNode, true);
2831
+ * ```
2832
+ */
2833
+ changeNode(newNode: LavalinkNode | string, checkSources?: boolean): Promise<string>;
2834
+ /**
2835
+ * (Wrapper-FN for changeNode) Move the player to a different node. If no node is provided, it will find the least used node that is not the same as the current node.
2836
+ * @param node the id of the node to move to
2837
+ * @returns the player
2838
+ * @throws RangeError if there is no available nodes.
2839
+ * @throws Error if the node to move to is the same as the current node.
2840
+ * @example
2841
+ * ```ts
2842
+ * const newNodeMovedTo = await player.moveNode(); // no need to specify the new node, it will find a least used node automatically, but you can ofc. use a custom node id.
2843
+ * ```
2844
+ */
2845
+ moveNode(node?: string): Promise<string | this>;
2846
+ /** Converts the Player including Queue to a Json state */
2847
+ toJSON(): PlayerJson;
2499
2848
  }
2500
- declare enum ReconnectionState {
2501
- IDLE = "IDLE",
2502
- RECONNECTING = "RECONNECTING",
2503
- PENDING = "PENDING",
2504
- DESTROYING = "DESTROYING"
2849
+
2850
+ declare class NodeLinkNode extends LavalinkNode {
2851
+ nodeType: "NodeLink";
2852
+ constructor(options: LavalinkNodeOptions, manager: NodeManager);
2853
+ /**
2854
+ * Adds a new audio track to be mixed over the current playback.
2855
+ * @param player The player to add the mixer layer to.
2856
+ * @param trackToAdd The track to add to the mixer layer.
2857
+ * @param volume The volume of the track to add to the mixer layer. (0 - 100)
2858
+ * @link {https://nodelink.js.org/docs/api/rest#add-mix-layer} documentiation
2859
+ */
2860
+ addMixerLayer(player: Player, trackToAdd: Track, volume: number): Promise<AddMixerLayerResponse>;
2861
+ /**
2862
+ * Retrieves a list of currently active mix layers.
2863
+ * @param player The player to list the mixer layers for.
2864
+ * @link {https://nodelink.js.org/docs/api/rest#get-active-mixes} documentiation
2865
+ */
2866
+ listMixerLayers(player: Player): Promise<ListMixerLayersResponse>;
2867
+ /**
2868
+ * Updates the volume of a specific mix layer.
2869
+ * @param player The player to update the mixer layer volume for.
2870
+ * @param mixId The ID of the mix layer to update.
2871
+ * @param volume The volume of the mix layer to update. (0 - 100)
2872
+ * @link {https://nodelink.js.org/docs/api/rest#update-mix-volume} documentiation
2873
+ */
2874
+ updateMixerLayerVolume(player: Player, mixId: string, volume: number): Promise<boolean>;
2875
+ /**
2876
+ * Removes a specific mix layer.
2877
+ * @param player The player to remove the mix layer from.
2878
+ * @param mixId The ID of the mix layer to remove.
2879
+ * @link {https://nodelink.js.org/docs/api/rest#remove-mix-layer} documentiation
2880
+ */
2881
+ removeMixerLayer(player: Player, mixId: string): Promise<boolean>;
2882
+ /**
2883
+ * @description
2884
+ * NodeLink has a lot of filters SPECIFICALLY for NodeLink, check the documentation for more information.
2885
+ * @link {https://nodelink.js.org/docs/api/nodelink-features#additional-filters} documentiation
2886
+ */
2887
+ specificFilters: {
2888
+ /**
2889
+ * Creates delay-based echo with feedback control
2890
+ * @param player The player to apply the filter to
2891
+ * @param options The echo filter options
2892
+ */
2893
+ echo: (player: Player, options: NodeLink_EchoFilter, disableFilter?: boolean) => Promise<boolean>;
2894
+ /**
2895
+ * Simulates multiple voices playing together with modulated delays
2896
+ * @param player The player to apply the filter to
2897
+ * @param options The chorus filter options
2898
+ */
2899
+ chorus: (player: Player, options: NodeLink_ChorusFilter, disableFilter?: boolean) => Promise<boolean>;
2900
+ /**
2901
+ * Dynamic range compression for balanced audio levels
2902
+ * @param player The player to apply the filter to
2903
+ * @param options The compressor filter options
2904
+ */
2905
+ compressor: (player: Player, options: NodeLink_CompressorFilter, disableFilter?: boolean) => Promise<boolean>;
2906
+ /**
2907
+ * Filters out low frequencies, letting high frequencies pass through
2908
+ * @param player The player to apply the filter to
2909
+ * @param options The highpass filter options
2910
+ */
2911
+ highPass: (player: Player, options: NodeLink_HighPassFilter, disableFilter?: boolean) => Promise<boolean>;
2912
+ /**
2913
+ * Sweeps all-pass filters across the frequency spectrum for a swooshing effect
2914
+ * @param player The player to apply the filter to
2915
+ * @param options The phaser filter options
2916
+ */
2917
+ phaser: (player: Player, options: NodeLink_PhaserFilter, disableFilter?: boolean) => Promise<boolean>;
2918
+ /**
2919
+ * Creates spatial audio using cross-channel delays and modulation
2920
+ * @param player The player to apply the filter to
2921
+ * @param options The spatial filter options
2922
+ */
2923
+ spatial: (player: Player, options: NodeLink_SpatialFilter, disableFilter?: boolean) => Promise<boolean>;
2924
+ /**
2925
+ * Resets all NodeLink filters
2926
+ * @param player The player to reset the filters for
2927
+ */
2928
+ resetNodeLinkFilters: (player: Player) => Promise<boolean>;
2929
+ };
2930
+ /**
2931
+ * Retrieve Lyrics of Youtube Videos.
2932
+ * @param player The Player you use with that node.
2933
+ * @param track if not provided, it will use the current track
2934
+ * @param language if not provided, it will use the default language (en)
2935
+ * @link {https://nodelink.js.org/docs/api/nodelink-features#lyrics--chapters}
2936
+ * @returns NodeLinkLyrics either synced/unsynced or NodeLinkNoLyrics
2937
+ */
2938
+ nodeLinkLyrics(player: Player, track?: Track | UnresolvedTrack, language?: string): Promise<NodeLinkLyrics | NodeLinkNoLyrics>;
2939
+ /**
2940
+ * Retrieve Chapters of Youtube Videos.
2941
+ * @link {https://nodelink.js.org/docs/api/nodelink-features#loadchapters}
2942
+ * @param player The Player you use with that node.
2943
+ * @param track if not provided, it will use the current track
2944
+ * @returns Array of NodeLinkChapter objects (if empty than there are no chapters available)
2945
+ */
2946
+ getChapters(player: Player, track?: Track | UnresolvedTrack): Promise<NodeLinkChapter[]>;
2947
+ /**
2948
+ * @link {https://nodelink.js.org/docs/api/rest#node-information}
2949
+ * @returns
2950
+ */
2951
+ getConnectionMetrics(): Promise<ConnectionMetricsResponse>;
2952
+ /**
2953
+ * Stream audio directly from NodeLink without Discord voice connection. | Note this must be enabled by NodeLink...
2954
+ * @link {https://nodelink.js.org/docs/api/nodelink-features#direct-streaming}
2955
+ */
2956
+ getDirectStream(track: Track | UnresolvedTrack): Promise<DirectStreamResponse>;
2957
+ /**
2958
+ * Stream raw PCM audio for custom processing or recording.
2959
+ * @link {https://nodelink.js.org/docs/api/nodelink-features#loadstream}
2960
+ * @param track The track to stream
2961
+ * @param volume The volume to stream at
2962
+ * @param position The position to stream from
2963
+ * @param filters The filters to apply to the stream
2964
+ * @returns Returns a raw PCM stream with Content-Type: audio/l16;rate=48000;channels=2.
2965
+ */
2966
+ loadDirectStream(track: Track | UnresolvedTrack, volume: number, position: number, filters: object | string): Promise<ReadableStream>;
2967
+ /**
2968
+ * NodeLink supports selecting specific audio tracks for videos that contain multiple audio streams (e.g., Netflixstyle dubs, multi-language YouTube videos).
2969
+ * This function changes the current language of the audio, in place at the same position of the current track.
2970
+ * You can always do it manually by providing extra field in the track object "audioTrackId"
2971
+ * @link {https://nodelink.js.org/docs/api/nodelink-features#additional-filters}
2972
+ * @param player The player to apply the filter to
2973
+ * @param language_audioTrackId The language of the audio track to select, see it in the pluginInfo.audioTracks
2974
+ */
2975
+ changeAudioTrackLanguage(player: Player, language_audioTrackId: string): Promise<any>;
2976
+ /**
2977
+ * Updates the YouTube configuration (RefreshToken or VisitorData) in real-time.
2978
+ * @link {https://nodelink.js.org/docs/api/nodelink-features#update-config}
2979
+ */
2980
+ updateYoutubeConfig(refreshToken?: string, visitorData?: string): Promise<any>;
2981
+ getYoutubeConfig(validate?: boolean): Promise<{
2982
+ refreshToken: string;
2983
+ visitorData: string | null;
2984
+ isConfigured: boolean;
2985
+ isValid: boolean | null;
2986
+ }>;
2987
+ /**
2988
+ * @link {https://nodelink.js.org/docs/api/nodelink-features#oauth}
2989
+ */
2990
+ getYoutubeOAUTH(refreshToken: string): Promise<YoutubeOAuthResponse>;
2991
+ /**
2992
+ * @link {https://nodelink.js.org/docs/api/nodelink-features#oauth}
2993
+ */
2994
+ updateYoutubeOAUTH(refreshToken: string): Promise<YoutubeOAuthResponse>;
2505
2995
  }
2506
2996
 
2507
2997
  /**
@@ -2512,7 +3002,9 @@ declare class LavalinkNode {
2512
3002
  private heartBeatPongTimestamp;
2513
3003
  private heartBeatInterval?;
2514
3004
  private pingTimeout?;
3005
+ nodeType: NodeTypes;
2515
3006
  isAlive: boolean;
3007
+ static _NodeLinkClass: unknown;
2516
3008
  /** The provided Options of the Node */
2517
3009
  options: LavalinkNodeOptions;
2518
3010
  /** The amount of rest calls the node has made. */
@@ -2521,7 +3013,7 @@ declare class LavalinkNode {
2521
3013
  stats: NodeStats;
2522
3014
  /** The current sessionId, only present when connected */
2523
3015
  sessionId?: string | null;
2524
- /** Whether the node resuming is enabled or not */
3016
+ /** Wether the node resuming is enabled or not */
2525
3017
  resuming: {
2526
3018
  enabled: boolean;
2527
3019
  timeout: number | null;
@@ -2549,13 +3041,13 @@ declare class LavalinkNode {
2549
3041
  */
2550
3042
  get heartBeatPing(): number;
2551
3043
  /**
2552
- * Returns whether the plugin validations are enabled or not
3044
+ * Returns wether the plugin validations are enabled or not
2553
3045
  */
2554
- private get _checkForPlugins();
3046
+ get _checkForPlugins(): boolean;
2555
3047
  /**
2556
- * Returns whether the source validations are enabled or not
3048
+ * Returns wether the source validations are enabled or not
2557
3049
  */
2558
- private get _checkForSources();
3050
+ get _checkForSources(): boolean;
2559
3051
  /**
2560
3052
  * Emits a debug event to the LavalinkManager
2561
3053
  * @param name name of the event
@@ -2612,7 +3104,13 @@ declare class LavalinkNode {
2612
3104
  * player.node.rawRequest(`/loadtracks?identifier=Never gonna give you up`, (options) => options.method = "GET");
2613
3105
  * ```
2614
3106
  */
2615
- private rawRequest;
3107
+ rawRequest(endpoint: string, modify?: ModifyRequest): Promise<{
3108
+ response: Response;
3109
+ options: RequestInit & {
3110
+ path: string;
3111
+ extraQueryUrlParams?: URLSearchParams;
3112
+ };
3113
+ }>;
2616
3114
  /**
2617
3115
  * Makes an API call to the Node. Should only be used for manual parsing like for not supported plugins
2618
3116
  * @param endpoint The endpoint that we will make the call to
@@ -2630,7 +3128,7 @@ declare class LavalinkNode {
2630
3128
  * Search something raw on the node, please note only add tracks to players of that node
2631
3129
  * @param query SearchQuery Object
2632
3130
  * @param requestUser Request User for creating the player(s)
2633
- * @param throwOnEmpty Whether to throw on an empty result or not
3131
+ * @param throwOnEmpty Wether to throw on an empty result or not
2634
3132
  * @returns Searchresult
2635
3133
  *
2636
3134
  * @example
@@ -2645,7 +3143,7 @@ declare class LavalinkNode {
2645
3143
  * Search something using the lavaSearchPlugin (filtered searches by types)
2646
3144
  * @param query LavaSearchQuery Object
2647
3145
  * @param requestUser Request User for creating the player(s)
2648
- * @param throwOnEmpty Whether to throw on an empty result or not
3146
+ * @param throwOnEmpty Wether to throw on an empty result or not
2649
3147
  * @returns LavaSearchresult (SearchResult if link is provided)
2650
3148
  *
2651
3149
  * @example
@@ -2707,7 +3205,7 @@ declare class LavalinkNode {
2707
3205
  /**
2708
3206
  * Destroys the Node-Connection (Websocket) and all player's of the node
2709
3207
  * @param destroyReason Destroy Reason to use when destroying the players
2710
- * @param deleteNode whether to delete the nodte from the nodes list too, if false it will emit a disconnect. @default true
3208
+ * @param deleteNode wether to delete the nodte from the nodes list too, if false it will emit a disconnect. @default true
2711
3209
  * @param movePlayers whether to movePlayers to different eligible connected node. If false players won't be moved @default false
2712
3210
  * @returns void
2713
3211
  *
@@ -2806,7 +3304,7 @@ declare class LavalinkNode {
2806
3304
  /**
2807
3305
  * Get the lyrics of a track
2808
3306
  * @param track the track to get the lyrics for
2809
- * @param skipTrackSource whether to skip the track source or not
3307
+ * @param skipTrackSource wether to skip the track source or not
2810
3308
  * @returns the lyrics of the track
2811
3309
  * @example
2812
3310
  *
@@ -2821,7 +3319,7 @@ declare class LavalinkNode {
2821
3319
  * Get the lyrics of the current playing track
2822
3320
  *
2823
3321
  * @param guildId the guild id of the player
2824
- * @param skipTrackSource whether to skip the track source or not
3322
+ * @param skipTrackSource wether to skip the track source or not
2825
3323
  * @returns the lyrics of the current playing track
2826
3324
  * @example
2827
3325
  * ```ts
@@ -2900,6 +3398,30 @@ declare class LavalinkNode {
2900
3398
  * ```
2901
3399
  */
2902
3400
  fetchInfo(): Promise<LavalinkInfo>;
3401
+ /**
3402
+ * Returns the metric summary of the node
3403
+ * @returns the metric summary of the node
3404
+ */
3405
+ nodeMetricSummary(): NodeMetricSummary;
3406
+ /**
3407
+ * Get the node's health status with performance assessment.
3408
+ * @returns Object containing health status, performance rating, load balancing info, and recommendations
3409
+ *
3410
+ * @example
3411
+ * ```ts
3412
+ * const health = node.getHealthStatus();
3413
+ * console.log(`Node Status: ${health.status}`); // "healthy" | "degraded" | "critical" | "offline"
3414
+ * console.log(`Performance: ${health.performance}`); // "excellent" | "good" | "fair" | "poor"
3415
+ * console.log(`Penalty Score: ${health.penaltyScore}`); // Lower is better for load balancing
3416
+ * console.log(`Estimated Capacity: ${health.estimatedRemainingCapacity} more players`);
3417
+ * console.log(`Overloaded: ${health.isOverloaded}`);
3418
+ * console.log(`Needs Restart: ${health.needsRestart}`);
3419
+ * if (health.recommendations.length) {
3420
+ * console.log("Recommendations:", health.recommendations);
3421
+ * }
3422
+ * ```
3423
+ */
3424
+ getHealthStatus(thresholds?: HealthStatusThresholdOptions): HealthStatusObject;
2903
3425
  /**
2904
3426
  * Lavalink's Route Planner Api
2905
3427
  */
@@ -2940,6 +3462,16 @@ declare class LavalinkNode {
2940
3462
  };
2941
3463
  /** @private Utils for validating the */
2942
3464
  private validate;
3465
+ /**
3466
+ * Checks if the node is a NodeLink node
3467
+ * @returns true if the node is a NodeLink node
3468
+ */
3469
+ isNodeLink(): this is NodeLinkNode;
3470
+ /**
3471
+ * Checks if the node is a Lavalink node
3472
+ * @returns true if the node is a Lavalink node
3473
+ */
3474
+ isLavalinkNode(): this is LavalinkNode;
2943
3475
  /**
2944
3476
  * Sync the data of the player you make an action to lavalink to
2945
3477
  * @param data data to use to update the player
@@ -2957,7 +3489,7 @@ declare class LavalinkNode {
2957
3489
  get isNodeReconnecting(): boolean;
2958
3490
  /**
2959
3491
  * Reconnect to the lavalink node
2960
- * @param force @default false Whether to instantly try to reconnect (force it)
3492
+ * @param force @default false Wether to instantly try to reconnect (force it)
2961
3493
  * @returns void
2962
3494
  *
2963
3495
  * @example
@@ -2969,7 +3501,7 @@ declare class LavalinkNode {
2969
3501
  get reconnectionAttemptCount(): number;
2970
3502
  /**
2971
3503
  * Private Utility function to execute the reconnection
2972
- */
3504
+ */
2973
3505
  private executeReconnect;
2974
3506
  /**
2975
3507
  * Private function to reset the reconnection attempts
@@ -3127,7 +3659,7 @@ declare class NodeManager extends EventEmitter {
3127
3659
  /**
3128
3660
  * A map of all nodes in the nodeManager
3129
3661
  */
3130
- nodes: MiniMap<string, LavalinkNode>;
3662
+ nodes: MiniMap<string, LavalinkNode | NodeLinkNode>;
3131
3663
  /**
3132
3664
  * @param LavalinkManager The LavalinkManager that created this NodeManager
3133
3665
  */
@@ -3154,7 +3686,7 @@ declare class NodeManager extends EventEmitter {
3154
3686
  * @param options The options for the node
3155
3687
  * @returns The node that was created
3156
3688
  */
3157
- createNode(options: LavalinkNodeOptions): LavalinkNode;
3689
+ createNode<T extends LavalinkNode | NodeLinkNode>(options: LavalinkNodeOptions): T;
3158
3690
  /**
3159
3691
  * Get the nodes sorted for the least usage, by a sorttype
3160
3692
  * @param sortType The type of sorting to use
@@ -3177,7 +3709,13 @@ declare class NodeManager extends EventEmitter {
3177
3709
  * client.lavalink.nodeManager.deleteNode("nodeId to delete", true);
3178
3710
  * ```
3179
3711
  */
3180
- deleteNode(node: LavalinkNodeIdentifier | LavalinkNode, movePlayers?: boolean): void;
3712
+ deleteNode(node: LavalinkNodeIdentifier | LavalinkNode | NodeLinkNode, movePlayers?: boolean): void;
3713
+ /**
3714
+ * Get a node from the nodeManager
3715
+ * @param node The node to get
3716
+ * @returns The node that was retrieved
3717
+ */
3718
+ getNode(node: LavalinkNodeIdentifier | LavalinkNode | NodeLinkNode): LavalinkNode | NodeLinkNode | undefined;
3181
3719
  }
3182
3720
 
3183
3721
  /**
@@ -3188,49 +3726,49 @@ interface LavalinkManagerEvents<CustomPlayerT extends Player = Player> {
3188
3726
  * Emitted when a Track started playing.
3189
3727
  * @event Manager#trackStart
3190
3728
  */
3191
- "trackStart": (player: CustomPlayerT, track: Track | null, payload: TrackStartEvent) => void;
3729
+ trackStart: (player: CustomPlayerT, track: Track | null, payload: TrackStartEvent) => void;
3192
3730
  /**
3193
3731
  * Emitted when a Track finished.
3194
3732
  * @event Manager#trackEnd
3195
3733
  */
3196
- "trackEnd": (player: CustomPlayerT, track: Track | null, payload: TrackEndEvent) => void;
3734
+ trackEnd: (player: CustomPlayerT, track: Track | null, payload: TrackEndEvent) => void;
3197
3735
  /**
3198
3736
  * Emitted when a Track got stuck while playing.
3199
3737
  * @event Manager#trackStuck
3200
3738
  */
3201
- "trackStuck": (player: CustomPlayerT, track: Track | null, payload: TrackStuckEvent) => void;
3739
+ trackStuck: (player: CustomPlayerT, track: Track | null, payload: TrackStuckEvent) => void;
3202
3740
  /**
3203
3741
  * Emitted when a Track errored.
3204
3742
  * @event Manager#trackError
3205
3743
  */
3206
- "trackError": (player: CustomPlayerT, track: Track | UnresolvedTrack | null, payload: TrackExceptionEvent) => void;
3744
+ trackError: (player: CustomPlayerT, track: Track | UnresolvedTrack | null, payload: TrackExceptionEvent) => void;
3207
3745
  /**
3208
3746
  * Emitted when the Playing finished and no more tracks in the queue.
3209
3747
  * @event Manager#queueEnd
3210
3748
  */
3211
- "queueEnd": (player: CustomPlayerT, track: Track | UnresolvedTrack | null, payload: TrackEndEvent | TrackStuckEvent | TrackExceptionEvent) => void;
3749
+ queueEnd: (player: CustomPlayerT, track: Track | UnresolvedTrack | null, payload: TrackEndEvent | TrackStuckEvent | TrackExceptionEvent) => void;
3212
3750
  /**
3213
3751
  * Emitted when a Player is created.
3214
3752
  * @event Manager#playerCreate
3215
3753
  */
3216
- "playerCreate": (player: CustomPlayerT) => void;
3754
+ playerCreate: (player: CustomPlayerT) => void;
3217
3755
  /**
3218
3756
  * Emitted when a Player is moved within the channel.
3219
3757
  * @event Manager#playerMove
3220
3758
  */
3221
- "playerMove": (player: CustomPlayerT, oldVoiceChannelId: string, newVoiceChannelId: string) => void;
3759
+ playerMove: (player: CustomPlayerT, oldVoiceChannelId: string, newVoiceChannelId: string) => void;
3222
3760
  /**
3223
3761
  * Emitted when a Player is disconnected from a channel.
3224
3762
  * @event Manager#playerDisconnect
3225
3763
  */
3226
- "playerDisconnect": (player: CustomPlayerT, voiceChannelId: string) => void;
3764
+ playerDisconnect: (player: CustomPlayerT, voiceChannelId: string) => void;
3227
3765
  /**
3228
3766
  * Emitted when a Player automatically reconnects after a disconnect.
3229
3767
  * This event is triggered when the player successfully reconnects to the voice channel
3230
3768
  * and resumes playback after being disconnected (requires onDisconnect.autoReconnect to be enabled).
3231
3769
  * @event Manager#playerReconnect
3232
3770
  */
3233
- "playerReconnect": (player: CustomPlayerT, voiceChannelId: string) => void;
3771
+ playerReconnect: (player: CustomPlayerT, voiceChannelId: string) => void;
3234
3772
  /**
3235
3773
  * Emitted when a Node-Socket got closed for a specific Player.
3236
3774
  * Usually emits when the audio websocket to discord is closed, This can happen for various reasons (normal and abnormal), e.g. when using an expired voice server update. 4xxx codes are usually bad.
@@ -3244,85 +3782,85 @@ interface LavalinkManagerEvents<CustomPlayerT extends Player = Player> {
3244
3782
  * @link https://lavalink.dev/api/websocket.html#websocketclosedevent
3245
3783
  * @event Manager#playerSocketClosed
3246
3784
  */
3247
- "playerSocketClosed": (player: CustomPlayerT, payload: WebSocketClosedEvent) => void;
3785
+ playerSocketClosed: (player: CustomPlayerT, payload: WebSocketClosedEvent) => void;
3248
3786
  /**
3249
3787
  * Emitted when a Player get's destroyed
3250
3788
  * @event Manager#playerDestroy
3251
3789
  */
3252
- "playerDestroy": (player: CustomPlayerT, destroyReason?: DestroyReasonsType) => void;
3790
+ playerDestroy: (player: CustomPlayerT, destroyReason?: DestroyReasonsType) => void;
3253
3791
  /**
3254
3792
  * Always emits when the player (on lavalink side) got updated
3255
3793
  * @event Manager#playerUpdate
3256
3794
  */
3257
- "playerUpdate": (oldPlayerJson: PlayerJson, newPlayer: CustomPlayerT) => void;
3795
+ playerUpdate: (oldPlayerJson: PlayerJson, newPlayer: CustomPlayerT) => void;
3258
3796
  /**
3259
3797
  * Emitted when the player's selfMuted or serverMuted state changed (true -> false | false -> true)
3260
3798
  * @event Manager#playerMuteChange
3261
3799
  */
3262
- "playerMuteChange": (player: CustomPlayerT, selfMuted: boolean, serverMuted: boolean) => void;
3800
+ playerMuteChange: (player: CustomPlayerT, selfMuted: boolean, serverMuted: boolean) => void;
3263
3801
  /**
3264
3802
  * Emitted when the player's selfDeafed or serverDeafed state changed (true -> false | false -> true)
3265
3803
  * @event Manager#playerDeafChange
3266
3804
  */
3267
- "playerDeafChange": (player: CustomPlayerT, selfDeafed: boolean, serverDeafed: boolean) => void;
3805
+ playerDeafChange: (player: CustomPlayerT, selfDeafed: boolean, serverDeafed: boolean) => void;
3268
3806
  /**
3269
3807
  * Emitted when the player's suppressed (true -> false | false -> true)
3270
3808
  * @event Manager#playerSuppressChange
3271
3809
  */
3272
- "playerSuppressChange": (player: CustomPlayerT, suppress: boolean) => void;
3810
+ playerSuppressChange: (player: CustomPlayerT, suppress: boolean) => void;
3273
3811
  /**
3274
3812
  * Emitted when the player's queue got empty, and the timeout started
3275
3813
  * @event Manager#playerQueueEmptyStart
3276
3814
  */
3277
- "playerQueueEmptyStart": (player: CustomPlayerT, timeoutMs: number) => void;
3815
+ playerQueueEmptyStart: (player: CustomPlayerT, timeoutMs: number) => void;
3278
3816
  /**
3279
3817
  * Emitted when the player's queue got empty, and the timeout finished leading to destroying the player
3280
3818
  * @event Manager#playerQueueEmptyEnd
3281
3819
  */
3282
- "playerQueueEmptyEnd": (player: CustomPlayerT) => void;
3820
+ playerQueueEmptyEnd: (player: CustomPlayerT) => void;
3283
3821
  /**
3284
3822
  * Emitted when the player's queue got empty, and the timeout got cancelled becuase a track got re-added to it.
3285
3823
  * @event Manager#playerQueueEmptyEnd
3286
3824
  */
3287
- "playerQueueEmptyCancel": (player: CustomPlayerT) => void;
3825
+ playerQueueEmptyCancel: (player: CustomPlayerT) => void;
3288
3826
  /**
3289
3827
  * Emitted, when a user joins the voice channel, while there is a player existing
3290
3828
  * @event Manager#playerQueueEmptyStart
3291
3829
  */
3292
- "playerVoiceJoin": (player: CustomPlayerT, userId: string) => void;
3830
+ playerVoiceJoin: (player: CustomPlayerT, userId: string) => void;
3293
3831
  /**
3294
3832
  * Emitted, when a user leaves the voice channel, while there is a player existing
3295
3833
  * @event Manager#playerQueueEmptyEnd
3296
3834
  */
3297
- "playerVoiceLeave": (player: CustomPlayerT, userId: string) => void;
3835
+ playerVoiceLeave: (player: CustomPlayerT, userId: string) => void;
3298
3836
  /**
3299
3837
  * SPONSORBLOCK-PLUGIN EVENT
3300
3838
  * Emitted when Segments are loaded
3301
3839
  * @link https://github.com/topi314/Sponsorblock-Plugin#segmentsloaded
3302
3840
  * @event Manager#trackError
3303
3841
  */
3304
- "SegmentsLoaded": (player: CustomPlayerT, track: Track | UnresolvedTrack | null, payload: SponsorBlockSegmentsLoaded) => void;
3842
+ SegmentsLoaded: (player: CustomPlayerT, track: Track | UnresolvedTrack | null, payload: SponsorBlockSegmentsLoaded) => void;
3305
3843
  /**
3306
3844
  * SPONSORBLOCK-PLUGIN EVENT
3307
3845
  * Emitted when a specific Segment was skipped
3308
3846
  * @link https://github.com/topi314/Sponsorblock-Plugin#segmentskipped
3309
3847
  * @event Manager#trackError
3310
3848
  */
3311
- "SegmentSkipped": (player: CustomPlayerT, track: Track | UnresolvedTrack | null, payload: SponsorBlockSegmentSkipped) => void;
3849
+ SegmentSkipped: (player: CustomPlayerT, track: Track | UnresolvedTrack | null, payload: SponsorBlockSegmentSkipped) => void;
3312
3850
  /**
3313
3851
  * SPONSORBLOCK-PLUGIN EVENT
3314
3852
  * Emitted when a specific Chapter starts playing
3315
3853
  * @link https://github.com/topi314/Sponsorblock-Plugin#chapterstarted
3316
3854
  * @event Manager#trackError
3317
3855
  */
3318
- "ChapterStarted": (player: CustomPlayerT, track: Track | UnresolvedTrack | null, payload: SponsorBlockChapterStarted) => void;
3856
+ ChapterStarted: (player: CustomPlayerT, track: Track | UnresolvedTrack | null, payload: SponsorBlockChapterStarted) => void;
3319
3857
  /**
3320
3858
  * SPONSORBLOCK-PLUGIN EVENT
3321
3859
  * Emitted when Chapters are loaded
3322
3860
  * @link https://github.com/topi314/Sponsorblock-Plugin#chaptersloaded
3323
3861
  * @event Manager#trackError
3324
3862
  */
3325
- "ChaptersLoaded": (player: CustomPlayerT, track: Track | UnresolvedTrack | null, payload: SponsorBlockChaptersLoaded) => void;
3863
+ ChaptersLoaded: (player: CustomPlayerT, track: Track | UnresolvedTrack | null, payload: SponsorBlockChaptersLoaded) => void;
3326
3864
  /**
3327
3865
  * Lavalink-Client Debug Event
3328
3866
  * Emitted for several erros, and logs within lavalink-client, if managerOptions.advancedOptions.enableDebugEvents is true
@@ -3330,7 +3868,7 @@ interface LavalinkManagerEvents<CustomPlayerT extends Player = Player> {
3330
3868
  *
3331
3869
  * @event Manager#debug
3332
3870
  */
3333
- "debug": (eventKey: DebugEvents, eventData: {
3871
+ debug: (eventKey: DebugEvents, eventData: {
3334
3872
  message: string;
3335
3873
  state: "log" | "warn" | "error";
3336
3874
  error?: Error | string;
@@ -3341,21 +3879,21 @@ interface LavalinkManagerEvents<CustomPlayerT extends Player = Player> {
3341
3879
  * @link https://github.com/topi314/LavaLyrics
3342
3880
  * @event Manager#LyricsLine
3343
3881
  */
3344
- "LyricsLine": (player: CustomPlayerT, track: Track | UnresolvedTrack | null, payload: LyricsLineEvent) => void;
3882
+ LyricsLine: (player: CustomPlayerT, track: Track | UnresolvedTrack | null, payload: LyricsLineEvent) => void;
3345
3883
  /**
3346
3884
  * Emitted when a Lyrics is found
3347
3885
  * @link https://github.com/topi314/LavaLyrics
3348
3886
  * @event Manager#LyricsFound
3349
3887
  */
3350
- "LyricsFound": (player: CustomPlayerT, track: Track | UnresolvedTrack | null, payload: LyricsFoundEvent) => void;
3888
+ LyricsFound: (player: CustomPlayerT, track: Track | UnresolvedTrack | null, payload: LyricsFoundEvent) => void;
3351
3889
  /**
3352
3890
  * Emitted when a Lyrics is not found
3353
3891
  * @link https://github.com/topi314/LavaLyrics
3354
3892
  * @event Manager#LyricsNotFound
3355
3893
  */
3356
- "LyricsNotFound": (player: CustomPlayerT, track: Track | UnresolvedTrack | null, payload: LyricsNotFoundEvent) => void;
3357
- "playerResumed": (player: CustomPlayerT, track: Track | UnresolvedTrack | null) => void;
3358
- "playerPaused": (player: CustomPlayerT, track: Track | UnresolvedTrack | null) => void;
3894
+ LyricsNotFound: (player: CustomPlayerT, track: Track | UnresolvedTrack | null, payload: LyricsNotFoundEvent) => void;
3895
+ playerResumed: (player: CustomPlayerT, track: Track | UnresolvedTrack | null) => void;
3896
+ playerPaused: (player: CustomPlayerT, track: Track | UnresolvedTrack | null) => void;
3359
3897
  }
3360
3898
  /**
3361
3899
  * The Bot client Options needed for the manager
@@ -3376,6 +3914,8 @@ interface ManagerPlayerOptions<CustomPlayerT extends Player = Player> {
3376
3914
  clientBasedPositionUpdateInterval?: number;
3377
3915
  /** What should be used as a searchPlatform, if no source was provided during the query */
3378
3916
  defaultSearchPlatform?: SearchPlatform;
3917
+ /** Allow custom sources which lavalink-client does not support (yet) */
3918
+ allowCustomSources?: boolean;
3379
3919
  /** Applies the volume via a filter, not via the lavalink volume transformer */
3380
3920
  applyVolumeAsFilter?: boolean;
3381
3921
  /** Transforms the saved data of a requested user */
@@ -3438,13 +3978,6 @@ interface ManagerOptions<CustomPlayerT extends Player = Player> {
3438
3978
  linksBlacklist?: (RegExp | string)[];
3439
3979
  /** If links should be allowed or not. If set to false, it will throw an error if a link was provided. */
3440
3980
  linksAllowed?: boolean;
3441
- /** If the library should automatically check something, on default everything is enabled */
3442
- autoChecks?: {
3443
- /** Whether or not the client should check if the requested source's plugin is available on the node. */
3444
- pluginValidations?: boolean;
3445
- /** Whether or not the client should check if the requested source is available on the node */
3446
- sourcesValidations?: boolean;
3447
- };
3448
3981
  /** Advanced Options for the Library, which may or may not be "library breaking" */
3449
3982
  advancedOptions?: {
3450
3983
  /** Max duration for that the filter fix duration works (in ms) - default is 8mins */
@@ -3557,6 +4090,7 @@ declare class LavalinkManager<CustomPlayerT extends Player = Player> extends Eve
3557
4090
  * applyVolumeAsFilter: false,
3558
4091
  * clientBasedPositionUpdateInterval: 150,
3559
4092
  * defaultSearchPlatform: "ytmsearch",
4093
+ * allowCustomSources: false,
3560
4094
  * volumeDecrementer: 0.75,
3561
4095
  * //requesterTransformer: YourRequesterTransformerFunction,
3562
4096
  * onDisconnect: {
@@ -3715,4 +4249,4 @@ declare const LavalinkPlugins: {
3715
4249
  /** Lavalink Sources regexes for url validations */
3716
4250
  declare const SourceLinksRegexes: Record<SourcesRegex, RegExp>;
3717
4251
 
3718
- export { type AudioOutputs, type Awaitable, type Base64, type BaseNodeStats, type BasePlayOptions, type BotClientOptions, type CPUStats, type ChannelDeletePacket, type ChannelMixFilter, type ClientCustomSearchPlatformUtils, type ClientSearchPlatform, DebugEvents, type DeepRequired, DefaultQueueStore, DefaultSources, DestroyReasons, type DestroyReasonsType, DisconnectReasons, type DisconnectReasonsType, type DistortionFilter, type DuncteSearchPlatform, type EQBand, EQList, type Exception, type FailingAddress, type FilterData, FilterManager, type FloatNumber, type FrameStats, type GitObject, type GuildShardPayload, type IntegerNumber, type InvalidLavalinkRestRequest, type JioSaavnSearchPlatform, type KaraokeFilter, type LavaSearchFilteredResponse, type LavaSearchQuery, type LavaSearchResponse, type LavaSearchType, type LavaSrcSearchPlatform, type LavaSrcSearchPlatformBase, type LavalinkClientSearchPlatform, type LavalinkClientSearchPlatformResolve, type LavalinkFilterData, type LavalinkInfo, LavalinkManager, type LavalinkManagerEvents, LavalinkNode, type LavalinkNodeIdentifier, type LavalinkNodeOptions, type LavalinkPlayOptions, type LavalinkPlayer, type LavalinkPlayerVoice, type LavalinkPlayerVoiceOptions, type LavalinkPlugin_JioSaavn_SourceNames, type LavalinkPlugin_LavaSrc_SourceNames, LavalinkPlugins, type LavalinkSearchPlatform, type LavalinkSourceNames, type LavalinkTrack, type LavalinkTrackInfo, type LoadTypes, type LowPassFilter, type LyricsEvent, type LyricsEventType, type LyricsFoundEvent, type LyricsLine, type LyricsLineEvent, type LyricsNotFoundEvent, type LyricsResult, type ManagerOptions, type ManagerPlayerOptions, type ManagerQueueOptions, ManagerUtils, type MemoryStats, MiniMap, type MiniMapConstructor, type ModifyRequest, type NodeLinkConnectionMetrics, NodeManager, type NodeManagerEvents, type NodeMessage, type NodeStats, NodeSymbol, type Opaque, type PlayOptions, Player, type PlayerEvent, type PlayerEventType, type PlayerEvents, type PlayerFilters, type PlayerJson, type PlayerOptions, type PlayerUpdateInfo, type PlaylistInfo, type PluginInfo, type PluginObject, Queue, type QueueChangesWatcher, QueueSaver, type QueueStoreManager, QueueSymbol, ReconnectionState, type RepeatMode, type RequiredManagerOptions, type RotationFilter, type RoutePlanner, type RoutePlannerTypes, type SearchPlatform, type SearchQuery, type SearchResult, type Session, type Severity, SourceLinksRegexes, type SourceNames, type SourcesRegex, type SponsorBlockChapterStarted, type SponsorBlockChaptersLoaded, type SponsorBlockSegment, type SponsorBlockSegmentEventType, type SponsorBlockSegmentEvents, type SponsorBlockSegmentSkipped, type SponsorBlockSegmentsLoaded, type State, type StoredQueue, type TimescaleFilter, type Track, type TrackEndEvent, type TrackEndReason, type TrackExceptionEvent, type TrackInfo, type TrackRequester, type TrackStartEvent, type TrackStuckEvent, TrackSymbol, type TremoloFilter, type UnresolvedQuery, type UnresolvedSearchResult, type UnresolvedTrack, type UnresolvedTrackInfo, UnresolvedTrackSymbol, type VersionObject, type VibratoFilter, type VoicePacket, type VoiceServer, type VoiceState, type WebSocketClosedEvent, type anyObject, audioOutputsData, parseLavalinkConnUrl, queueTrackEnd, safeStringify, validSponsorBlocks };
4252
+ export { type AudioOutputs, type Awaitable, type Base64, type BaseNodeStats, type BasePlayOptions, type BotClientOptions, type CPUStats, type ChannelDeletePacket, type ChannelMixFilter, type ClientCustomSearchPlatformUtils, type ClientSearchPlatform, DebugEvents, type DeepRequired, DefaultQueueStore, DefaultSources, DestroyReasons, type DestroyReasonsType, DisconnectReasons, type DisconnectReasonsType, type DistortionFilter, type DuncteSearchPlatform, type EQBand, EQList, type Exception, type FailingAddress, type FilterData, FilterManager, type FloatNumber, type FrameStats, type GitObject, type GuildShardPayload, type IntegerNumber, type InvalidLavalinkRestRequest, type JioSaavnSearchPlatform, type KaraokeFilter, type LavaSearchFilteredResponse, type LavaSearchQuery, type LavaSearchResponse, type LavaSearchType, type LavaSrcSearchPlatform, type LavaSrcSearchPlatformBase, type LavalinkClientSearchPlatform, type LavalinkClientSearchPlatformResolve, type LavalinkFilterData, type LavalinkInfo, LavalinkManager, type LavalinkManagerEvents, LavalinkNode, type LavalinkNodeIdentifier, type LavalinkNodeOptions, type LavalinkPlayOptions, type LavalinkPlayer, type LavalinkPlayerVoice, type LavalinkPlayerVoiceOptions, type LavalinkPlugin_JioSaavn_SourceNames, type LavalinkPlugin_LavaSrc_SourceNames, LavalinkPlugins, type LavalinkSearchPlatform, type LavalinkSourceNames, type LavalinkTrack, type LavalinkTrackInfo, type LoadTypes, type LowPassFilter, type LyricsEvent, type LyricsEventType, type LyricsFoundEvent, type LyricsLine, type LyricsLineEvent, type LyricsNotFoundEvent, type LyricsResult, type ManagerOptions, type ManagerPlayerOptions, type ManagerQueueOptions, ManagerUtils, type MemoryStats, MiniMap, type MiniMapConstructor, type ModifyRequest, type NodeLinkConnectionMetrics, NodeLinkExclusiveEvents, NodeLinkNode, type NodeLink_ChorusFilter, type NodeLink_CompressorFilter, type NodeLink_EchoFilter, type NodeLink_HighPassFilter, type NodeLink_PhaserFilter, type NodeLink_SpatialFilter, NodeManager, type NodeManagerEvents, type NodeMessage, type NodeStats, NodeSymbol, type NodeTypes, type Opaque, type PlayOptions, Player, type PlayerEvent, type PlayerEventType, type PlayerEvents, type PlayerFilters, type PlayerJson, type PlayerOptions, type PlayerUpdateInfo, type PlaylistInfo, type PluginInfo, type PluginObject, Queue, type QueueChangesWatcher, QueueSaver, type QueueStoreManager, QueueSymbol, RecommendationsStrings, ReconnectionState, type RepeatMode, type RequiredManagerOptions, type RotationFilter, type RoutePlanner, type RoutePlannerTypes, type SearchPlatform, type SearchQuery, type SearchResult, type Session, type Severity, SourceLinksRegexes, type SourceNames, type SourcesRegex, type SponsorBlockChapterStarted, type SponsorBlockChaptersLoaded, type SponsorBlockSegment, type SponsorBlockSegmentEventType, type SponsorBlockSegmentEvents, type SponsorBlockSegmentSkipped, type SponsorBlockSegmentsLoaded, type State, type StoredQueue, type TimescaleFilter, type Track, type TrackEndEvent, type TrackEndReason, type TrackExceptionEvent, type TrackInfo, type TrackRequester, type TrackStartEvent, type TrackStuckEvent, TrackSymbol, type TremoloFilter, type UnresolvedQuery, type UnresolvedSearchResult, type UnresolvedTrack, type UnresolvedTrackInfo, UnresolvedTrackSymbol, type VersionObject, type VibratoFilter, type VoicePacket, type VoiceServer, type VoiceState, type WebSocketClosedEvent, type anyObject, audioOutputsData, parseLavalinkConnUrl, queueTrackEnd, safeStringify, validSponsorBlocks };