lavalink-client 2.7.1 → 2.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,1122 +1,417 @@
1
1
  import { EventEmitter } from 'events';
2
2
 
3
- /** The Audio Outputs type */
4
- type AudioOutputs = "mono" | "stereo" | "left" | "right";
5
- /** The "active" / "disabled" Player Filters */
6
- interface PlayerFilters {
7
- /** Sets nightcore to false, and vaporwave to false */
8
- custom: boolean;
9
- /** Sets custom to false, and vaporwave to false */
10
- nightcore: boolean;
11
- /** Sets custom to false, and nightcore to false */
12
- vaporwave: boolean;
13
- /** If rotation filter is enabled / not */
14
- rotation: boolean;
15
- /** if karaoke filter is enabled / not */
16
- karaoke: boolean;
17
- /** if tremolo filter is enabled / not */
18
- tremolo: boolean;
19
- /** if vibrato filter is enabled / not */
20
- vibrato: boolean;
21
- lowPass: boolean;
22
- /** audio Output (default stereo, mono sounds the fullest and best for not-stereo tracks) */
23
- audioOutput: AudioOutputs;
24
- /** Lavalink Volume FILTER (not player Volume, think of it as a gain booster) */
25
- volume: boolean;
26
- /** Filters for the Lavalink Filter Plugin */
27
- lavalinkFilterPlugin: {
28
- /** if echo filter is enabled / not */
29
- echo: boolean;
30
- /** if reverb filter is enabled / not */
31
- reverb: boolean;
32
- };
33
- lavalinkLavaDspxPlugin: {
34
- /** if lowPass filter is enabled / not */
35
- lowPass: boolean;
36
- /** if highPass filter is enabled / not */
37
- highPass: boolean;
38
- /** if normalization filter is enabled / not */
39
- normalization: boolean;
40
- /** if echo filter is enabled / not */
41
- echo: boolean;
42
- };
43
- }
44
- /**
45
- * There are 15 bands (0-14) that can be changed.
46
- * "gain" is the multiplier for the given band.
47
- * The default value is 0.
48
- * Valid values range from -0.25 to 1.0, where -0.25 means the given band is completely muted, and 0.25 means it is doubled.
49
- * Modifying the gain could also change the volume of the output.
50
- */
51
- interface EQBand {
52
- /** On what band position (0-14) it should work */
53
- band: IntegerNumber | number;
54
- /** The gain (-0.25 to 1.0) */
55
- gain: FloatNumber | number;
56
- }
57
- /**
58
- * Uses equalization to eliminate part of a band, usually targeting vocals.
59
- */
60
- interface KaraokeFilter {
61
- /** The level (0 to 1.0 where 0.0 is no effect and 1.0 is full effect) */
62
- level?: number;
63
- /** The mono level (0 to 1.0 where 0.0 is no effect and 1.0 is full effect) */
64
- monoLevel?: number;
65
- /** The filter band (in Hz) */
66
- filterBand?: number;
67
- /** The filter width */
68
- filterWidth?: number;
69
- }
70
- /**
71
- * Changes the speed, pitch, and rate
72
- */
73
- interface TimescaleFilter {
74
- /** The playback speed 0.0 ≤ x */
75
- speed?: number;
76
- /** The pitch 0.0 ≤ x */
77
- pitch?: number;
78
- /** The rate 0.0 ≤ x */
79
- rate?: number;
80
- }
81
- /**
82
- * Uses amplification to create a shuddering effect, where the volume quickly oscillates.
83
- * Demo: https://en.wikipedia.org/wiki/File:Fuse_Electronics_Tremolo_MK-III_Quick_Demo.ogv
84
- */
85
- interface TremoloFilter {
86
- /** The frequency 0.0 < x */
87
- frequency?: number;
88
- /** The tremolo depth 0.0 < x ≤ 1.0 */
89
- depth?: number;
90
- }
91
- /**
92
- * Similar to tremolo. While tremolo oscillates the volume, vibrato oscillates the pitch.
93
- */
94
- interface VibratoFilter {
95
- /** The frequency 0.0 < x ≤ 14.0 */
96
- frequency?: number;
97
- /** The vibrato depth 0.0 < x ≤ 1.0 */
98
- depth?: number;
99
- }
100
- /**
101
- * Rotates the sound around the stereo channels/user headphones (aka Audio Panning).
102
- * It can produce an effect similar to https://youtu.be/QB9EB8mTKcc (without the reverb).
103
- */
104
- interface RotationFilter {
105
- /** The frequency of the audio rotating around the listener in Hz. 0.2 is similar to the example video above */
106
- rotationHz?: number;
107
- }
108
- /**
109
- * Distortion effect. It can generate some pretty unique audio effects.
110
- */
111
- interface DistortionFilter {
112
- sinOffset?: number;
113
- sinScale?: number;
114
- cosOffset?: number;
115
- cosScale?: number;
116
- tanOffset?: number;
117
- tanScale?: number;
118
- offset?: number;
119
- scale?: number;
120
- }
121
- /**
122
- * Mixes both channels (left and right), with a configurable factor on how much each channel affects the other.
123
- * With the defaults, both channels are kept independent of each other.
124
- * Setting all factors to 0.5 means both channels get the same audio.
125
- */
126
- interface ChannelMixFilter {
127
- /** The left to left channel mix factor (0.0 ≤ x ≤ 1.0) */
128
- leftToLeft?: number;
129
- /** The left to right channel mix factor (0.0 ≤ x ≤ 1.0) */
130
- leftToRight?: number;
131
- /** The right to left channel mix factor (0.0 ≤ x ≤ 1.0) */
132
- rightToLeft?: number;
133
- /** The right to right channel mix factor (0.0 ≤ x ≤ 1.0) */
134
- rightToRight?: number;
135
- }
136
- /**
137
- * Higher frequencies get suppressed, while lower frequencies pass through this filter, thus the name low pass.
138
- * Any smoothing values equal to or less than 1.0 will disable the filter.
139
- */
140
- interface LowPassFilter {
141
- /** The smoothing factor (1.0 < x) */
142
- smoothing?: number;
143
- }
144
- /**
145
- * Filter Data stored in the Client and partially sent to Lavalink
146
- */
147
- interface FilterData {
148
- volume?: number;
149
- karaoke?: KaraokeFilter;
150
- timescale?: TimescaleFilter;
151
- tremolo?: TremoloFilter;
152
- vibrato?: VibratoFilter;
153
- rotation?: RotationFilter;
154
- distortion?: DistortionFilter;
155
- channelMix?: ChannelMixFilter;
156
- lowPass?: LowPassFilter;
157
- pluginFilters?: {
158
- "lavalink-filter-plugin"?: {
159
- "echo"?: {
160
- delay?: number;
161
- decay?: number;
162
- };
163
- "reverb"?: {
164
- delays?: number[];
165
- gains?: number[];
166
- };
167
- };
168
- "high-pass"?: {
169
- cutoffFrequency?: number;
170
- boostFactor?: number;
171
- };
172
- "low-pass"?: {
173
- cutoffFrequency?: number;
174
- boostFactor?: number;
175
- };
176
- normalization?: {
177
- maxAmplitude?: number;
178
- adaptive?: boolean;
179
- };
180
- echo?: {
181
- echoLength?: number;
182
- decay?: number;
183
- };
184
- };
185
- }
186
- /**
187
- * Actual Filter Data sent to Lavalink
188
- */
189
- interface LavalinkFilterData extends FilterData {
190
- equalizer?: EQBand[];
191
- }
192
-
193
- /**
194
- * Debug events for more detailed logging
195
- */
196
- declare enum DebugEvents {
197
- SetSponsorBlock = "SetSponsorBlock",
198
- DeleteSponsorBlock = "DeleteSponsorBlock",
199
- TrackEndReplaced = "TrackEndReplaced",
200
- AutoplayExecution = "AutoplayExecution",
201
- AutoplayNoSongsAdded = "AutoplayNoSongsAdded",
202
- AutoplayThresholdSpamLimiter = "AutoplayThresholdSpamLimiter",
203
- TriggerQueueEmptyInterval = "TriggerQueueEmptyInterval",
204
- QueueEnded = "QueueEnded",
205
- TrackStartNewSongsOnly = "TrackStartNewSongsOnly",
206
- TrackStartNoTrack = "TrackStartNoTrack",
207
- ResumingFetchingError = "ResumingFetchingError",
208
- PlayerUpdateNoPlayer = "PlayerUpdateNoPlayer",
209
- PlayerUpdateFilterFixApply = "PlayerUpdateFilterFixApply",
210
- PlayerUpdateSuccess = "PlayerUpdateSuccess",
211
- HeartBeatTriggered = "HeartBeatTriggered",
212
- NoSocketOnDestroy = "NoSocketOnDestroy",
213
- SocketCleanupError = "SocketCleanupError",
214
- SocketTerminateHeartBeatTimeout = "SocketTerminateHeartBeatTimeout",
215
- TryingConnectWhileConnected = "TryingConnectWhileConnected",
216
- LavaSearchNothingFound = "LavaSearchNothingFound",
217
- SearchNothingFound = "SearchNothingFound",
218
- ValidatingBlacklistLinks = "ValidatingBlacklistLinks",
219
- ValidatingWhitelistLinks = "ValidatingWhitelistLinks",
220
- TrackErrorMaxTracksErroredPerTime = "TrackErrorMaxTracksErroredPerTime",
221
- TrackStuckMaxTracksErroredPerTime = "TrackStuckMaxTracksErroredPerTime",
222
- PlayerDestroyingSomewhereElse = "PlayerDestroyingSomewhereElse",
223
- PlayerCreateNodeNotFound = "PlayerCreateNodeNotFound",
224
- PlayerPlayQueueEmptyTimeoutClear = "PlayerPlayQueueEmptyTimeoutClear",
225
- PlayerPlayWithTrackReplace = "PlayerPlayWithTrackReplace",
226
- PlayerPlayUnresolvedTrack = "PlayerPlayUnresolvedTrack",
227
- PlayerPlayUnresolvedTrackFailed = "PlayerPlayUnresolvedTrackFailed",
228
- PlayerVolumeAsFilter = "PlayerVolumeAsFilter",
229
- BandcampSearchLokalEngine = "BandcampSearchLokalEngine",
230
- PlayerChangeNode = "PlayerChangeNode",
231
- BuildTrackError = "BuildTrackError",
232
- TransformRequesterFunctionFailed = "TransformRequesterFunctionFailed",
233
- GetClosestTrackFailed = "GetClosestTrackFailed",
234
- PlayerDeleteInsteadOfDestroy = "PlayerDeleteInsteadOfDestroy",
235
- FailedToConnectToNodes = "FailedToConnectToNodes",
236
- NoAudioDebug = "NoAudioDebug",
237
- PlayerAutoReconnect = "PlayerAutoReconnect"
238
- }
239
- /**
240
- * Reasons why a player got destroyed
241
- */
242
- declare enum DestroyReasons {
243
- QueueEmpty = "QueueEmpty",
244
- NodeDestroy = "NodeDestroy",
245
- NodeDeleted = "NodeDeleted",
246
- LavalinkNoVoice = "LavalinkNoVoice",
247
- NodeReconnectFail = "NodeReconnectFail",
248
- Disconnected = "Disconnected",
249
- PlayerReconnectFail = "PlayerReconnectFail",
250
- PlayerChangeNodeFail = "PlayerChangeNodeFail",
251
- PlayerChangeNodeFailNoEligibleNode = "PlayerChangeNodeFailNoEligibleNode",
252
- ChannelDeleted = "ChannelDeleted",
253
- DisconnectAllNodes = "DisconnectAllNodes",
254
- ReconnectAllNodes = "ReconnectAllNodes",
255
- TrackErrorMaxTracksErroredPerTime = "TrackErrorMaxTracksErroredPerTime",
256
- TrackStuckMaxTracksErroredPerTime = "TrackStuckMaxTracksErroredPerTime"
257
- }
258
- /**
259
- * Reasons why a player got disconnected
260
- */
261
- declare enum DisconnectReasons {
262
- Disconnected = "Disconnected",
263
- DisconnectAllNodes = "DisconnectAllNodes"
264
- }
265
- /** The valid SponsorBlock categories */
266
- declare const validSponsorBlocks: string[];
267
- /** The audio Outputs Data map declaration */
268
- declare const audioOutputsData: Record<AudioOutputs, ChannelMixFilter>;
269
- /** Equalizer Presets */
270
- declare const EQList: {
271
- /** A Bassboost Equalizer, so high it distorts the audio */
272
- BassboostEarrape: EQBand[];
273
- /** A High and decent Bassboost Equalizer */
274
- BassboostHigh: EQBand[];
275
- /** A decent Bassboost Equalizer */
276
- BassboostMedium: EQBand[];
277
- /** A slight Bassboost Equalizer */
278
- BassboostLow: EQBand[];
279
- /** Makes the Music slightly "better" */
280
- BetterMusic: EQBand[];
281
- /** Makes the Music sound like rock music / sound rock music better */
282
- Rock: EQBand[];
283
- /** Makes the Music sound like Classic music / sound Classic music better */
284
- Classic: EQBand[];
285
- /** Makes the Music sound like Pop music / sound Pop music better */
286
- Pop: EQBand[];
287
- /** Makes the Music sound like Electronic music / sound Electronic music better */
288
- Electronic: EQBand[];
289
- /** Boosts all Bands slightly for louder and fuller sound */
290
- FullSound: EQBand[];
291
- /** Boosts basses + lower highs for a pro gaming sound */
292
- Gaming: EQBand[];
293
- };
294
-
295
- declare class FilterManager {
296
- static EQList: {
297
- BassboostEarrape: EQBand[];
298
- BassboostHigh: EQBand[];
299
- BassboostMedium: EQBand[];
300
- BassboostLow: EQBand[];
301
- BetterMusic: EQBand[];
302
- Rock: EQBand[];
303
- Classic: EQBand[];
304
- Pop: EQBand[];
305
- Electronic: EQBand[];
306
- FullSound: EQBand[];
307
- Gaming: EQBand[];
308
- };
309
- /** The Equalizer bands currently applied to the Lavalink Server */
310
- equalizerBands: EQBand[];
311
- /** Private Util for the instaFix Filters option */
312
- filterUpdatedState: boolean;
313
- /** All "Active" / "disabled" Player Filters */
314
- filters: PlayerFilters;
315
- /** The Filter Data sent to Lavalink, only if the filter is enabled (ofc.) */
316
- data: FilterData;
317
- /** The Player assigned to this Filter Manager */
318
- player: Player;
319
- /** The Constructor for the FilterManager */
320
- constructor(player: Player);
321
- /**
322
- * Apply Player filters for lavalink filter sending data, if the filter is enabled / not
323
- *
324
- * @returns {Promise<void>}
325
- *
326
- * @example
327
- * ```ts
328
- * // Apply the filters after changing them manually:
329
- * player.filterManager.data.volume = 0.5;
330
- * // maybe you wanna manually set a distorition filter? then do it like this...
331
- * player.filterManager.data.distortion = { sinOffset: 0.5, sinScale: 2, cosOffset: 0.5, cosScale: 2, tanOffset: 0.5, tanScale: 2, offset: 0.5, scale: 2 };
332
- * await player.filterManager.applyPlayerFilters();
333
- * ```
334
- */
335
- applyPlayerFilters(): Promise<void>;
336
- privateNot0(value: number | undefined): boolean;
337
- /**
338
- * Checks if the filters are correctly stated (active / not-active) - mostly used internally.
339
- * @param oldFilterTimescale
340
- * @returns {boolean} True, if the check was successfull
341
- *
342
- * @example
343
- * ```ts
344
- * // Check the filter states
345
- * player.filterManager.checkFiltersState();
346
- * // Apply the filters after checking
347
- * await player.filterManager.applyPlayerFilters();
348
- * ```
349
- */
350
- checkFiltersState(oldFilterTimescale?: Partial<TimescaleFilter>): boolean;
351
- /**
352
- * Reset all Filters
353
- * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
354
- *
355
- * @example
356
- * ```ts
357
- * // Reset all filters
358
- * await player.filterManager.resetFilters();
359
- * ```
360
- */
361
- resetFilters(): Promise<FilterManager>;
362
- /**
363
- * Set the Filter Volume
364
- * @param volume the volume (0.0 - 5.0)
365
- * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
366
- *
367
- * @example
368
- * ```ts
369
- * // Set Volume to 50%
370
- * await player.filterManager.setVolume(0.5);
371
- * // 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
372
- * ```
373
- */
374
- setVolume(volume: number): Promise<this>;
375
- /**
376
- * Set the AudioOutput Filter
377
- * @param {AudioOutputs} type the audio output type
378
- * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
379
- *
380
- * @example
381
- * ```ts
382
- * // Set Audio Output to Mono
383
- * await player.filterManager.setAudioOutput("mono");
384
- *
385
- * // Set Audio Output to Stereo
386
- * await player.filterManager.setAudioOutput("stereo");
387
- *
388
- * // Set Audio Output to Left
389
- * await player.filterManager.setAudioOutput("left");
390
- *
391
- * // Set Audio Output to Right
392
- * await player.filterManager.setAudioOutput("right");
393
- * ```
394
- */
395
- setAudioOutput(type: AudioOutputs): Promise<FilterManager>;
396
- /**
397
- * Set custom filter.timescale#speed . This method disabled both: nightcore & vaporwave. use 1 to reset it to normal
398
- * @param {number} speed set the speed of the filter
399
- * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
400
- *
401
- * @example
402
- * ```ts
403
- * // Set Speed to 1.25 (disableds nightcore and vaporwave effect which are pre-made timescale settings of rate,pitch and speed)
404
- * await player.filterManager.setSpeed(1.25);
405
- * ```
406
- */
407
- setSpeed(speed?: number): Promise<FilterManager>;
408
- /**
409
- * Set custom filter.timescale#pitch . This method disabled both: nightcore & vaporwave. use 1 to reset it to normal
410
- * @param {number} pitch set the pitch of the filter
411
- * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
412
- *
413
- * @example
414
- * ```ts
415
- * // Set Pitch to 1.25 (disableds nightcore and vaporwave effect which are pre-made timescale settings of rate,pitch and speed)
416
- * await player.filterManager.setPitch(1.25);
417
- * ```
418
- */
419
- setPitch(pitch?: number): Promise<FilterManager>;
420
- /**
421
- * Set custom filter.timescale#rate . This method disabled both: nightcore & vaporwave. use 1 to reset it to normal
422
- * @param {number} rate set the rate of the filter
423
- * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
424
- *
425
- * @example
426
- * ```ts
427
- * // Set Rate to 1.25 (disableds nightcore and vaporwave effect which are pre-made timescale settings of rate,pitch and speed)
428
- * await player.filterManager.setRate(1.25);
429
- * ```
430
- */
431
- setRate(rate?: number): Promise<FilterManager>;
432
- /**
433
- * Enables / Disables the rotation effect, (Optional: provide your Own Data)
434
- * @param {number} rotationHz set the rotationHz of the filter
435
- * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
436
- *
437
- * @example
438
- * ```ts
439
- * // Toggle Rotation filter with custom settings
440
- * await player.filterManager.toggleRotation(0.4);
441
- * // or use the defaults
442
- * await player.filterManager.toggleRotation();
443
- * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
444
- * ```
445
- */
446
- toggleRotation(rotationHz?: number): Promise<FilterManager>;
447
- /**
448
- * Enables / Disables the Vibrato effect, (Optional: provide your Own Data)
449
- * @param {number} frequency set the frequency of the filter
450
- * @param {number} depth set the depth of the filter
451
- * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
452
- *
453
- * @example
454
- * ```ts
455
- * // Toggle Vibrato filter with custom settings
456
- * await player.filterManager.toggleVibrato(8, 0.5);
457
- * // or use the defaults
458
- * await player.filterManager.toggleVibrato();
459
- * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
460
- * ```
461
- */
462
- toggleVibrato(frequency?: number, depth?: number): Promise<FilterManager>;
463
- /**
464
- * Enables / Disables the Tremolo effect, (Optional: provide your Own Data)
465
- * @param {number} frequency set the frequency of the filter
466
- * @param {number} depth set the depth of the filter
467
- * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
468
- *
469
- * @example
470
- * ```ts
471
- * // Toggle Tremolo filter with custom settings
472
- * await player.filterManager.toggleTremolo(5, 0.7);
473
- * // or use the defaults
474
- * await player.filterManager.toggleTremolo();
475
- * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
476
- * ```
477
- */
478
- toggleTremolo(frequency?: number, depth?: number): Promise<FilterManager>;
479
- /**
480
- * Enables / Disables the LowPass effect, (Optional: provide your Own Data)
481
- * @param {number} smoothing set the smoothing of the filter
482
- * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
483
- *
484
- * @example
485
- * ```ts
486
- * // Toggle LowPass filter with custom settings
487
- * await player.filterManager.toggleLowPass(30);
488
- * // or use the defaults
489
- * await player.filterManager.toggleLowPass();
490
- * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
491
- * ```
492
- */
493
- toggleLowPass(smoothing?: number): Promise<FilterManager>;
494
- /**
495
- * Lavalink LavaDspx Plugin Filters
496
- */
497
- lavalinkLavaDspxPlugin: {
498
- /**
499
- * Enables / Disables the LowPass effect, (Optional: provide your Own Data)
500
- * @param {number} boostFactor set the boost factor of the filter
501
- * @param {number} cutoffFrequency set the cutoff frequency of the filter
502
- * @returns {Promise<boolean>} the state of the filter after execution.
503
- *
504
- * @example
505
- * ```ts
506
- * // Toggle LowPass filter with custom settings
507
- * await player.filterManager.lavalinkLavaDspxPlugin.toggleLowPass(1.2, 300);
508
- * // or use the defaults
509
- * await player.filterManager.lavalinkLavaDspxPlugin.toggleLowPass();
510
- * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
511
- * ```
512
- */
513
- toggleLowPass: (boostFactor?: number, cutoffFrequency?: number) => Promise<FilterManager>;
514
- /**
515
- * Enables / Disables the HighPass effect, (Optional: provide your Own Data)
516
- * @param {number} boostFactor [] set the boost factor of the filter
517
- * @param {number} cutoffFrequency set the cutoff frequency of the filter
518
- * @returns {Promise<boolean>} the state of the filter after execution.
519
- *
520
- * @example
521
- * ```ts
522
- * // Toggle HighPass filter with custom settings
523
- * await player.filterManager.lavalinkLavaDspxPlugin.toggleHighPass(1.2, 150); // custom values
524
- * // or use the defaults
525
- * await player.filterManager.lavalinkLavaDspxPlugin.toggleHighPass();
526
- * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
527
- * ```
528
- */
529
- toggleHighPass: (boostFactor?: number, cutoffFrequency?: number) => Promise<FilterManager>;
530
- /**
531
- * Enables / Disables the Normalization effect.
532
- * @param {number} [maxAmplitude=0.75] - The maximum amplitude of the audio.
533
- * @param {boolean} [adaptive=true] Whether to use adaptive normalization or not.
534
- * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
535
- *
536
- * @example
537
- * ```ts
538
- * // Toggle Normalization filter with custom settings
539
- * await player.filterManager.lavalinkLavaDspxPlugin.toggleNormalization(0.9, false); // custom values
540
- * // or use the defaults
541
- * await player.filterManager.lavalinkLavaDspxPlugin.toggleNormalization();
542
- * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
543
- * ```
544
- */
545
- toggleNormalization: (maxAmplitude?: number, adaptive?: boolean) => Promise<FilterManager>;
546
- /**
547
- * Enables / Disables the Echo effect, IMPORTANT! Only works with the correct Lavalink Plugin installed. (Optional: provide your Own Data)
548
- * @param {number} [decay=0.5] The decay of the echo effect.
549
- * @param {number} [echoLength=0.5] The length of the echo effect.
550
- * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
551
- *
552
- * @example
553
- * ```ts
554
- * // Toggle Echo filter with custom settings
555
- * await player.filterManager.lavalinkLavaDspxPlugin.toggleEcho(0.7, 0.6); // custom values
556
- * // or use the defaults
557
- * await player.filterManager.lavalinkLavaDspxPlugin.toggleEcho();
558
- * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
559
- * ```
560
- */
561
- toggleEcho: (decay?: number, echoLength?: number) => Promise<FilterManager>;
562
- };
563
- /**
564
- * LavalinkFilter Plugin specific Filters
565
- */
566
- lavalinkFilterPlugin: {
567
- /**
568
- * Enables / Disables the Echo effect, IMPORTANT! Only works with the correct Lavalink Plugin installed. (Optional: provide your Own Data)
569
- * @param {number} delay set the delay of the echo
570
- * @param {number} decay set the decay of the echo
571
- * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
572
- *
573
- * @example
574
- * ```ts
575
- * // Toggle Echo filter with custom settings
576
- * await player.filterManager.lavalinkFilterPlugin.toggleEcho(3, 0.7); // custom values
577
- * // or use the defaults
578
- * await player.filterManager.lavalinkFilterPlugin.toggleEcho();
579
- * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
580
- * ```
581
- */
582
- toggleEcho: (delay?: number, decay?: number) => Promise<FilterManager>;
583
- /**
584
- * Enables / Disables the Echo effect, IMPORTANT! Only works with the correct Lavalink Plugin installed. (Optional: provide your Own Data)
585
- * @param {number} delays set the delays of the reverb
586
- * @param {number} gains set the gains of the reverb
587
- * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
588
- *
589
- * @example
590
- * ```ts
591
- * // Toggle Reverb filter with custom settings
592
- * await player.filterManager.lavalinkFilterPlugin.toggleReverb([0.04, 0.045, 0.05, 0.055], [0.85, 0.84, 0.83, 0.82]);
593
- * // or use the defaults
594
- * await player.filterManager.lavalinkFilterPlugin.toggleReverb();
595
- * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
596
- * ```
597
- */
598
- toggleReverb: (delays?: number[], gains?: number[]) => Promise<FilterManager>;
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[];
599
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
+ /** The Constructor for the FilterManager */
28
+ constructor(player: Player);
600
29
  /**
601
- * Enables / Disables a Nightcore-like filter Effect. Disables/Overrides both: custom and Vaporwave Filter
602
- * @param {number} speed set the speed of the filter
603
- * @param {number} pitch set the pitch of the filter
604
- * @param {number} rate set the rate of the filter
605
- * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
606
- *
607
- * @example
608
- * ```ts
609
- * // Toggle Nightcore filter with custom settings
610
- * await player.filterManager.toggleNightcore(1.3, 1.3, 0.9);
611
- * // or use the defaults
612
- * await player.filterManager.toggleNightcore();
613
- * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
614
- * ```
615
- */
616
- toggleNightcore(speed?: number, pitch?: number, rate?: number): Promise<FilterManager>;
617
- /**
618
- * Enables / Disables a Vaporwave-like filter Effect. Disables/Overrides both: custom and nightcore Filter
619
- * @param {number} speed set the speed of the filterq
620
- * @param {number} pitch set the pitch of the filter
621
- * @param {number} rate set the rate of the filter
622
- * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
623
- *
624
- * @example
625
- * ```ts
626
- * // Toggle Vaporwave filter with custom settings
627
- * await player.filterManager.toggleVaporwave(0.9, 0.7, 1);
628
- * // or use the defaults
629
- * await player.filterManager.toggleVaporwave();
630
- * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
631
- * ```
632
- */
633
- toggleVaporwave(speed?: number, pitch?: number, rate?: number): Promise<FilterManager>;
634
- /**
635
- * Enable / Disables a Karaoke like Filter Effect
636
- * @param {number} level set the level of the filter
637
- * @param {number} monoLevel set the mono level of the filter
638
- * @param {number} filterBand set the filter band of the filter
639
- * @param {number} filterWidth set the filter width of the filter
640
- * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
641
- *
642
- * @example
643
- * ```ts
644
- * // Toggle Karaoke filter with custom settings
645
- * await player.filterManager.toggleKaraoke(1.5, 1.0, 220, 100);
646
- * // or use the defaults
647
- * await player.filterManager.toggleKaraoke();
648
- * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
649
- * ```
650
- */
651
- toggleKaraoke(level?: number, monoLevel?: number, filterBand?: number, filterWidth?: number): Promise<FilterManager>;
652
- /**
653
- * Function to find out if currently there is a custom timescamle etc. filter applied
654
- * @returns {boolean} whether a custom filter is active
655
- *
656
- * @example
657
- * ```ts
658
- * // Check if a custom filter is active
659
- * const isCustom = player.filterManager.isCustomFilterActive();
660
- * console.log(`Is custom filter active? ${isCustom}`);
661
- * ```
662
- */
663
- isCustomFilterActive(): boolean;
664
- /**
665
- * Sets the players equalizer bands using one of the predefined presets.
666
- * @param {keyof typeof EQList} preset The preset to use.
667
- * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
668
- *
669
- * @example
670
- * ```ts
671
- * // Set EQ preset
672
- * await player.filterManager.setEQPreset('BassboostMedium');
673
- * ```
674
- */
675
- setEQPreset(preset: keyof typeof EQList): Promise<this>;
676
- /**
677
- * Sets the players equalizer band on-top of the existing ones.
678
- * @param {number} bands
679
- * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
680
- *
681
- * @example
682
- * ```ts
683
- * // Set EQ bands
684
- * await player.filterManager.setEQ([
685
- * { band: 0, gain: 0.3 },
686
- * { band: 1, gain: -0.2 },
687
- * { band: 2, gain: 0.1 }
688
- * ]);
30
+ * Apply Player filters for lavalink filter sending data, if the filter is enabled / not
689
31
  *
690
- * // or use one of the templates:
691
- * await player.filterManager.setEQ(player.filterManager.EQList.BassboostMedium); // you can also import EQList from somewhere package if wanted.
692
- * ```
693
- */
694
- setEQ(bands: EQBand | EQBand[]): Promise<this>;
695
- /**
696
- * Clears the equalizer bands.
697
- * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
32
+ * @returns {Promise<void>}
698
33
  *
699
34
  * @example
700
35
  * ```ts
701
- * // Clear all EQ bands
702
- * await player.filterManager.clearEQ();
36
+ * // Apply the filters after changing them manually:
37
+ * player.filterManager.data.volume = 0.5;
38
+ * // maybe you wanna manually set a distorition filter? then do it like this...
39
+ * player.filterManager.data.distortion = { sinOffset: 0.5, sinScale: 2, cosOffset: 0.5, cosScale: 2, tanOffset: 0.5, tanScale: 2, offset: 0.5, scale: 2 };
40
+ * await player.filterManager.applyPlayerFilters();
703
41
  * ```
704
42
  */
705
- clearEQ(): Promise<this>;
706
- }
707
-
708
- declare class QueueSaver {
709
- /**
710
- * The queue store manager
711
- */
712
- private _;
713
- /**
714
- * The options for the queue saver
715
- */
716
- options: {
717
- maxPreviousTracks: number;
718
- };
719
- constructor(options: ManagerQueueOptions);
720
- /**
721
- * Get the queue for a guild
722
- * @param guildId The guild ID
723
- * @returns The queue for the guild
724
- */
725
- get(guildId: string): Promise<Partial<StoredQueue>>;
726
- /**
727
- * Delete the queue for a guild
728
- * @param guildId The guild ID
729
- * @returns The queue for the guild
730
- */
731
- delete(guildId: string): Promise<boolean | void>;
732
- /**
733
- * Set the queue for a guild
734
- * @param guildId The guild ID
735
- * @param valueToStringify The queue to set
736
- * @returns The queue for the guild
737
- */
738
- set(guildId: string, valueToStringify: StoredQueue): Promise<boolean | void>;
739
- /**
740
- * Sync the queue for a guild
741
- * @param guildId The guild ID
742
- * @returns The queue for the guild
743
- */
744
- sync(guildId: string): Promise<Partial<StoredQueue>>;
745
- }
746
- declare class DefaultQueueStore implements QueueStoreManager {
747
- private data;
748
- constructor();
749
- /**
750
- * Get the queue for a guild
751
- * @param guildId The guild ID
752
- * @returns The queue for the guild
753
- */
754
- get(guildId: string): StoredQueue | undefined;
755
- /**
756
- * Set the queue for a guild
757
- * @param guildId The guild ID
758
- * @param valueToStringify The queue to set
759
- * @returns The queue for the guild
760
- */
761
- set(guildId: string, valueToStringify: any): boolean;
762
- /**
763
- * Delete the queue for a guild
764
- * @param guildId The guild ID
765
- * @returns The queue for the guild
766
- */
767
- delete(guildId: string): boolean;
768
- /**
769
- * Stringify the queue for a guild
770
- * @param value The queue to stringify
771
- * @returns The stringified queue
772
- */
773
- stringify(value: StoredQueue | string): StoredQueue | string;
774
- /**
775
- * Parse the queue for a guild
776
- * @param value The queue to parse
777
- * @returns The parsed queue
778
- */
779
- parse(value: StoredQueue | string): Partial<StoredQueue>;
780
- }
781
- declare class Queue {
782
- readonly tracks: (Track | UnresolvedTrack)[];
783
- readonly previous: Track[];
784
- current: Track | null;
785
- options: {
786
- maxPreviousTracks: number;
787
- };
788
- private readonly guildId;
789
- private readonly QueueSaver;
790
- private managerUtils;
791
- private queueChanges;
792
- /**
793
- * Create a new Queue
794
- * @param guildId The guild ID
795
- * @param data The data to initialize the queue with
796
- * @param QueueSaver The queue saver to use
797
- * @param queueOptions
798
- */
799
- constructor(guildId: string, data?: Partial<StoredQueue>, QueueSaver?: QueueSaver, queueOptions?: ManagerQueueOptions);
800
- /**
801
- * Utils for a Queue
802
- */
803
- utils: {
804
- /**
805
- * Save the current cached Queue on the database/server (overides the server)
806
- */
807
- save: () => Promise<boolean | void>;
808
- /**
809
- * Sync the current queue database/server with the cached one
810
- * @returns {void}
811
- */
812
- sync: (override?: boolean, dontSyncCurrent?: boolean) => Promise<void>;
813
- destroy: () => Promise<boolean | void>;
814
- /**
815
- * @returns {{current:Track|null, previous:Track[], tracks:Track[]}}The Queue, but in a raw State, which allows easier handling for the QueueStoreManager
816
- */
817
- toJSON: () => StoredQueue;
818
- /**
819
- * Get the Total Duration of the Queue-Songs summed up
820
- * @returns {number}
821
- */
822
- totalDuration: () => number;
823
- };
824
- /**
825
- * Shuffles the current Queue, then saves it
826
- * @returns Amount of Tracks in the Queue
827
- */
828
- shuffle(): Promise<number>;
829
- /**
830
- * Add a Track to the Queue, and after saved in the "db" it returns the amount of the Tracks
831
- * @param {Track | Track[]} TrackOrTracks
832
- * @param {number} index At what position to add the Track
833
- * @returns {number} Queue-Size (for the next Tracks)
834
- */
835
- add(TrackOrTracks: Track | UnresolvedTrack | (Track | UnresolvedTrack)[], index?: number): any;
43
+ applyPlayerFilters(): Promise<void>;
44
+ private privateNot0;
45
+ private getLavalinkFilterData;
836
46
  /**
837
- * Splice the tracks in the Queue
838
- * @param {number} index Where to remove the Track
839
- * @param {number} amount How many Tracks to remove?
840
- * @param {Track | Track[]} TrackOrTracks Want to Add more Tracks?
841
- * @returns {Track} Spliced Track
47
+ * Checks if the filters are correctly stated (active / not-active) - mostly used internally.
48
+ * @param oldFilterTimescale
49
+ * @returns {boolean} True, if the check was successfull
50
+ *
51
+ * @example
52
+ * ```ts
53
+ * // Check the filter states
54
+ * player.filterManager.checkFiltersState();
55
+ * // Apply the filters after checking
56
+ * await player.filterManager.applyPlayerFilters();
57
+ * ```
842
58
  */
843
- splice(index: number, amount: number, TrackOrTracks?: Track | UnresolvedTrack | (Track | UnresolvedTrack)[]): any;
59
+ checkFiltersState(oldFilterTimescale?: Partial<TimescaleFilter>): boolean;
844
60
  /**
845
- * Remove stuff from the queue.tracks array
846
- * - single Track | UnresolvedTrack
847
- * - multiple Track | UnresovedTrack
848
- * - at the index or multiple indexes
849
- * - 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)
850
- * @param removeQueryTrack
851
- * @returns null (if nothing was removed) / { removed } where removed is an array with all removed elements
61
+ * Reset all Filters
62
+ * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
852
63
  *
853
64
  * @example
854
- * ```js
855
- * // remove single track
856
- *
857
- * const track = player.queue.tracks[4];
858
- * await player.queue.remove(track);
859
- *
860
- * // if you already have the index you can straight up pass it too
861
- * await player.queue.remove(4);
862
- *
65
+ * ```ts
66
+ * // Reset all filters
67
+ * await player.filterManager.resetFilters();
68
+ * ```
69
+ */
70
+ resetFilters(): Promise<FilterManager>;
71
+ /**
72
+ * Set the Filter Volume
73
+ * @param volume the volume (0.0 - 5.0)
74
+ * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
863
75
  *
864
- * // if you want to remove multiple tracks, e.g. from position 4 to position 10 you can do smt like this
865
- * 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
76
+ * @example
77
+ * ```ts
78
+ * // Set Volume to 50%
79
+ * await player.filterManager.setVolume(0.5);
80
+ * // 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
81
+ * ```
82
+ */
83
+ setVolume(volume: number): Promise<this>;
84
+ /**
85
+ * Set the AudioOutput Filter
86
+ * @param {AudioOutputs} type the audio output type
87
+ * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
866
88
  *
867
- * // I still highly suggest to use .splice!
89
+ * @example
90
+ * ```ts
91
+ * // Set Audio Output to Mono
92
+ * await player.filterManager.setAudioOutput("mono");
868
93
  *
869
- * await player.queue.splice(4, 10); // removes at index 4, 10 tracks
94
+ * // Set Audio Output to Stereo
95
+ * await player.filterManager.setAudioOutput("stereo");
870
96
  *
871
- * await player.queue.splice(1, 1); // removes at index 1, 1 track
97
+ * // Set Audio Output to Left
98
+ * await player.filterManager.setAudioOutput("left");
872
99
  *
873
- * await player.queue.splice(4, 0, ...tracks) // removes 0 tracks at position 4, and then inserts all tracks after position 4.
100
+ * // Set Audio Output to Right
101
+ * await player.filterManager.setAudioOutput("right");
874
102
  * ```
875
103
  */
876
- remove<T extends Track | UnresolvedTrack | number | Track[] | UnresolvedTrack[] | number[] | (number | Track | UnresolvedTrack)[]>(removeQueryTrack: T): Promise<{
877
- removed: (Track | UnresolvedTrack)[];
878
- } | null>;
104
+ setAudioOutput(type: AudioOutputs): Promise<FilterManager>;
879
105
  /**
880
- * Shifts the previous array, to return the last previous track & thus remove it from the previous queue
881
- * @returns
106
+ * Set custom filter.timescale#speed . This method disabled both: nightcore & vaporwave. use 1 to reset it to normal
107
+ * @param {number} speed set the speed of the filter
108
+ * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
882
109
  *
883
110
  * @example
884
- * ```js
885
- * // example on how to play the previous track again
886
- * const previous = await player.queue.shiftPrevious(); // get the previous track and remove it from the previous queue array!!
887
- * if(!previous) return console.error("No previous track found");
888
- * await player.play({ clientTrack: previous }); // play it again
111
+ * ```ts
112
+ * // Set Speed to 1.25 (disableds nightcore and vaporwave effect which are pre-made timescale settings of rate,pitch and speed)
113
+ * await player.filterManager.setSpeed(1.25);
889
114
  * ```
890
115
  */
891
- shiftPrevious(): Promise<Track>;
892
- }
893
-
894
- declare class Player {
895
- /** Filter Manager per player */
896
- filterManager: FilterManager;
897
- /** circular reference to the lavalink Manager from the Player for easier use */
898
- LavalinkManager: LavalinkManager;
899
- /** Player options currently used, mutation doesn't affect player's state */
900
- options: PlayerOptions;
901
- /** The lavalink node assigned the the player, don't change it manually */
902
- node: LavalinkNode;
903
- /** The queue from the player */
904
- queue: Queue;
905
- /** The Guild Id of the Player */
906
- guildId: string;
907
- /** The Voice Channel Id of the Player */
908
- voiceChannelId: string | null;
909
- /** The Text Channel Id of the Player */
910
- textChannelId: string | null;
911
- /** States if the Bot is supposed to be outputting audio */
912
- playing: boolean;
913
- /** States if the Bot is paused or not */
914
- paused: boolean;
915
- /** Repeat Mode of the Player */
916
- repeatMode: RepeatMode;
917
- /** Player's ping */
918
- ping: {
919
- lavalink: number;
920
- ws: number;
921
- };
922
- /** The Display Volume */
923
- volume: number;
924
- /** The Volume Lavalink actually is outputting */
925
- lavalinkVolume: number;
926
- /** The current Positin of the player (Calculated) */
927
- get position(): number;
928
- /** The timestamp when the last position change update happened */
929
- lastPositionChange: number | null;
930
- /** The current Positin of the player (from Lavalink) */
931
- lastPosition: number;
932
- lastSavedPosition: number;
933
- /** When the player was created [Timestamp in Ms] (from lavalink) */
934
- createdTimeStamp: number;
935
- /** The Player Connection's State (from Lavalink) */
936
- connected: boolean | undefined;
937
- /** Voice Server Data (from Lavalink) */
938
- voice: LavalinkPlayerVoiceOptions;
939
- voiceState: {
940
- selfDeaf: boolean;
941
- selfMute: boolean;
942
- serverDeaf: boolean;
943
- serverMute: boolean;
944
- suppress: boolean;
945
- };
946
- /** Custom data for the player */
947
- private readonly data;
948
- /**
949
- * Create a new Player
950
- * @param options
951
- * @param LavalinkManager
952
- */
953
- constructor(options: PlayerOptions, LavalinkManager: LavalinkManager, dontEmitPlayerCreateEvent?: boolean);
954
- /**
955
- * Set custom data.
956
- * @param key
957
- * @param value
958
- */
959
- set(key: string, value: unknown): this;
960
- /**
961
- * Get custom data.
962
- * @param key
963
- */
964
- get<T>(key: string): T;
965
- /**
966
- * CLears all the custom data.
967
- */
968
- clearData(): this;
969
- /**
970
- * Get all custom Data
971
- */
972
- getAllData(): Record<string, unknown>;
973
- /**
974
- * Play the next track from the queue / a specific track, with playoptions for Lavalink
975
- * @param options
976
- */
977
- play(options?: Partial<PlayOptions>): any;
978
- /**
979
- * Set the Volume for the Player
980
- * @param volume The Volume in percent
981
- * @param ignoreVolumeDecrementer If it should ignore the volumedecrementer option
982
- */
983
- setVolume(volume: number, ignoreVolumeDecrementer?: boolean): Promise<this>;
984
- /**
985
- * Search for a track
986
- * @param query The query to search for
987
- * @param requestUser The user that requested the track
988
- * @param throwOnEmpty If an error should be thrown if no track is found
989
- * @returns The search result
990
- */
991
- lavaSearch(query: LavaSearchQuery, requestUser: unknown, throwOnEmpty?: boolean): Promise<LavaSearchResponse | SearchResult>;
992
- /**
993
- * Set the SponsorBlock
994
- * @param segments The segments to set
995
- */
996
- setSponsorBlock(segments?: SponsorBlockSegment[]): Promise<void>;
997
- /**
998
- * Get the SponsorBlock
999
- */
1000
- getSponsorBlock(): Promise<SponsorBlockSegment[]>;
1001
- /**
1002
- * Delete the SponsorBlock
1003
- */
1004
- deleteSponsorBlock(): Promise<void>;
116
+ setSpeed(speed?: number): Promise<FilterManager>;
1005
117
  /**
118
+ * Set custom filter.timescale#pitch . This method disabled both: nightcore & vaporwave. use 1 to reset it to normal
119
+ * @param {number} pitch set the pitch of the filter
120
+ * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
1006
121
  *
1007
- * @param query Query for your data
1008
- * @param requestUser
122
+ * @example
123
+ * ```ts
124
+ * // Set Pitch to 1.25 (disableds nightcore and vaporwave effect which are pre-made timescale settings of rate,pitch and speed)
125
+ * await player.filterManager.setPitch(1.25);
126
+ * ```
1009
127
  */
1010
- search(query: SearchQuery, requestUser: unknown, throwOnEmpty?: boolean): Promise<UnresolvedSearchResult | SearchResult>;
128
+ setPitch(pitch?: number): Promise<FilterManager>;
1011
129
  /**
1012
- * Pause the player
130
+ * Set custom filter.timescale#rate . This method disabled both: nightcore & vaporwave. use 1 to reset it to normal
131
+ * @param {number} rate set the rate of the filter
132
+ * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
133
+ *
134
+ * @example
135
+ * ```ts
136
+ * // Set Rate to 1.25 (disableds nightcore and vaporwave effect which are pre-made timescale settings of rate,pitch and speed)
137
+ * await player.filterManager.setRate(1.25);
138
+ * ```
1013
139
  */
1014
- pause(): Promise<this>;
140
+ setRate(rate?: number): Promise<FilterManager>;
1015
141
  /**
1016
- * Resume the Player
142
+ * Enables / Disables the rotation effect, (Optional: provide your Own Data)
143
+ * @param {number} rotationHz set the rotationHz of the filter
144
+ * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
145
+ *
146
+ * @example
147
+ * ```ts
148
+ * // Toggle Rotation filter with custom settings
149
+ * await player.filterManager.toggleRotation(0.4);
150
+ * // or use the defaults
151
+ * await player.filterManager.toggleRotation();
152
+ * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
153
+ * ```
1017
154
  */
1018
- resume(): Promise<this>;
155
+ toggleRotation(rotationHz?: number): Promise<FilterManager>;
1019
156
  /**
1020
- * Seek to a specific Position
1021
- * @param position
157
+ * Enables / Disables the Vibrato effect, (Optional: provide your Own Data)
158
+ * @param {number} frequency set the frequency of the filter
159
+ * @param {number} depth set the depth of the filter
160
+ * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
161
+ *
162
+ * @example
163
+ * ```ts
164
+ * // Toggle Vibrato filter with custom settings
165
+ * await player.filterManager.toggleVibrato(8, 0.5);
166
+ * // or use the defaults
167
+ * await player.filterManager.toggleVibrato();
168
+ * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
169
+ * ```
1022
170
  */
1023
- seek(position: number): Promise<this>;
171
+ toggleVibrato(frequency?: number, depth?: number): Promise<FilterManager>;
1024
172
  /**
1025
- * Set the Repeatmode of the Player
1026
- * @param repeatMode
173
+ * Enables / Disables the Tremolo effect, (Optional: provide your Own Data)
174
+ * @param {number} frequency set the frequency of the filter
175
+ * @param {number} depth set the depth of the filter
176
+ * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
177
+ *
178
+ * @example
179
+ * ```ts
180
+ * // Toggle Tremolo filter with custom settings
181
+ * await player.filterManager.toggleTremolo(5, 0.7);
182
+ * // or use the defaults
183
+ * await player.filterManager.toggleTremolo();
184
+ * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
185
+ * ```
1027
186
  */
1028
- setRepeatMode(repeatMode: RepeatMode): Promise<this>;
187
+ toggleTremolo(frequency?: number, depth?: number): Promise<FilterManager>;
1029
188
  /**
1030
- * Skip the current song, or a specific amount of songs
1031
- * @param amount provide the index of the next track to skip to
189
+ * Enables / Disables the LowPass effect, (Optional: provide your Own Data)
190
+ * @param {number} smoothing set the smoothing of the filter
191
+ * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
192
+ *
193
+ * @example
194
+ * ```ts
195
+ * // Toggle LowPass filter with custom settings
196
+ * await player.filterManager.toggleLowPass(30);
197
+ * // or use the defaults
198
+ * await player.filterManager.toggleLowPass();
199
+ * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
200
+ * ```
1032
201
  */
1033
- skip(skipTo?: number, throwError?: boolean): Promise<this>;
202
+ toggleLowPass(smoothing?: number): Promise<FilterManager>;
1034
203
  /**
1035
- * Clears the queue and stops playing. Does not destroy the Player and not leave the channel
1036
- * @returns
204
+ * Lavalink LavaDspx Plugin Filters
1037
205
  */
1038
- stopPlaying(clearQueue?: boolean, executeAutoplay?: boolean): Promise<this>;
206
+ lavalinkLavaDspxPlugin: {
207
+ /**
208
+ * Enables / Disables the LowPass effect, (Optional: provide your Own Data)
209
+ * @param {number} boostFactor set the boost factor of the filter
210
+ * @param {number} cutoffFrequency set the cutoff frequency of the filter
211
+ * @returns {Promise<boolean>} the state of the filter after execution.
212
+ *
213
+ * @example
214
+ * ```ts
215
+ * // Toggle LowPass filter with custom settings
216
+ * await player.filterManager.lavalinkLavaDspxPlugin.toggleLowPass(1.2, 300);
217
+ * // or use the defaults
218
+ * await player.filterManager.lavalinkLavaDspxPlugin.toggleLowPass();
219
+ * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
220
+ * ```
221
+ */
222
+ toggleLowPass: (boostFactor?: number, cutoffFrequency?: number) => Promise<FilterManager>;
223
+ /**
224
+ * Enables / Disables the HighPass effect, (Optional: provide your Own Data)
225
+ * @param {number} boostFactor [] set the boost factor of the filter
226
+ * @param {number} cutoffFrequency set the cutoff frequency of the filter
227
+ * @returns {Promise<boolean>} the state of the filter after execution.
228
+ *
229
+ * @example
230
+ * ```ts
231
+ * // Toggle HighPass filter with custom settings
232
+ * await player.filterManager.lavalinkLavaDspxPlugin.toggleHighPass(1.2, 150); // custom values
233
+ * // or use the defaults
234
+ * await player.filterManager.lavalinkLavaDspxPlugin.toggleHighPass();
235
+ * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
236
+ * ```
237
+ */
238
+ toggleHighPass: (boostFactor?: number, cutoffFrequency?: number) => Promise<FilterManager>;
239
+ /**
240
+ * Enables / Disables the Normalization effect.
241
+ * @param {number} [maxAmplitude=0.75] - The maximum amplitude of the audio.
242
+ * @param {boolean} [adaptive=true] Whether to use adaptive normalization or not.
243
+ * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
244
+ *
245
+ * @example
246
+ * ```ts
247
+ * // Toggle Normalization filter with custom settings
248
+ * await player.filterManager.lavalinkLavaDspxPlugin.toggleNormalization(0.9, false); // custom values
249
+ * // or use the defaults
250
+ * await player.filterManager.lavalinkLavaDspxPlugin.toggleNormalization();
251
+ * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
252
+ * ```
253
+ */
254
+ toggleNormalization: (maxAmplitude?: number, adaptive?: boolean) => Promise<FilterManager>;
255
+ /**
256
+ * Enables / Disables the Echo effect, IMPORTANT! Only works with the correct Lavalink Plugin installed. (Optional: provide your Own Data)
257
+ * @param {number} [decay=0.5] The decay of the echo effect.
258
+ * @param {number} [echoLength=0.5] The length of the echo effect.
259
+ * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
260
+ *
261
+ * @example
262
+ * ```ts
263
+ * // Toggle Echo filter with custom settings
264
+ * await player.filterManager.lavalinkLavaDspxPlugin.toggleEcho(0.7, 0.6); // custom values
265
+ * // or use the defaults
266
+ * await player.filterManager.lavalinkLavaDspxPlugin.toggleEcho();
267
+ * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
268
+ * ```
269
+ */
270
+ toggleEcho: (decay?: number, echoLength?: number) => Promise<FilterManager>;
271
+ };
1039
272
  /**
1040
- * Connects the Player to the Voice Channel
1041
- * @returns
273
+ * LavalinkFilter Plugin specific Filters
1042
274
  */
1043
- connect(): Promise<this>;
1044
- changeVoiceState(data: {
1045
- voiceChannelId?: string;
1046
- selfDeaf?: boolean;
1047
- selfMute?: boolean;
1048
- }): Promise<this>;
275
+ lavalinkFilterPlugin: {
276
+ /**
277
+ * Enables / Disables the Echo effect, IMPORTANT! Only works with the correct Lavalink Plugin installed. (Optional: provide your Own Data)
278
+ * @param {number} delay set the delay of the echo
279
+ * @param {number} decay set the decay of the echo
280
+ * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
281
+ *
282
+ * @example
283
+ * ```ts
284
+ * // Toggle Echo filter with custom settings
285
+ * await player.filterManager.lavalinkFilterPlugin.toggleEcho(3, 0.7); // custom values
286
+ * // or use the defaults
287
+ * await player.filterManager.lavalinkFilterPlugin.toggleEcho();
288
+ * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
289
+ * ```
290
+ */
291
+ toggleEcho: (delay?: number, decay?: number) => Promise<FilterManager>;
292
+ /**
293
+ * Enables / Disables the Echo effect, IMPORTANT! Only works with the correct Lavalink Plugin installed. (Optional: provide your Own Data)
294
+ * @param {number} delays set the delays of the reverb
295
+ * @param {number} gains set the gains of the reverb
296
+ * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
297
+ *
298
+ * @example
299
+ * ```ts
300
+ * // Toggle Reverb filter with custom settings
301
+ * await player.filterManager.lavalinkFilterPlugin.toggleReverb([0.04, 0.045, 0.05, 0.055], [0.85, 0.84, 0.83, 0.82]);
302
+ * // or use the defaults
303
+ * await player.filterManager.lavalinkFilterPlugin.toggleReverb();
304
+ * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
305
+ * ```
306
+ */
307
+ toggleReverb: (delays?: number[], gains?: number[]) => Promise<FilterManager>;
308
+ };
1049
309
  /**
1050
- * Disconnects the Player from the Voice Channel, but keeps the player in the cache
1051
- * @param force If false it throws an error, if player thinks it's already disconnected
1052
- * @returns
310
+ * Enables / Disables a Nightcore-like filter Effect. Disables/Overrides both: custom and Vaporwave Filter
311
+ * @param {number} speed set the speed of the filter
312
+ * @param {number} pitch set the pitch of the filter
313
+ * @param {number} rate set the rate of the filter
314
+ * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
315
+ *
316
+ * @example
317
+ * ```ts
318
+ * // Toggle Nightcore filter with custom settings
319
+ * await player.filterManager.toggleNightcore(1.3, 1.3, 0.9);
320
+ * // or use the defaults
321
+ * await player.filterManager.toggleNightcore();
322
+ * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
323
+ * ```
1053
324
  */
1054
- disconnect(force?: boolean): Promise<this>;
325
+ toggleNightcore(speed?: number, pitch?: number, rate?: number): Promise<FilterManager>;
1055
326
  /**
1056
- * Destroy the player and disconnect from the voice channel
327
+ * Enables / Disables a Vaporwave-like filter Effect. Disables/Overrides both: custom and nightcore Filter
328
+ * @param {number} speed set the speed of the filterq
329
+ * @param {number} pitch set the pitch of the filter
330
+ * @param {number} rate set the rate of the filter
331
+ * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
332
+ *
333
+ * @example
334
+ * ```ts
335
+ * // Toggle Vaporwave filter with custom settings
336
+ * await player.filterManager.toggleVaporwave(0.9, 0.7, 1);
337
+ * // or use the defaults
338
+ * await player.filterManager.toggleVaporwave();
339
+ * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
340
+ * ```
1057
341
  */
1058
- destroy(reason?: DestroyReasons | string, disconnect?: boolean): Promise<this>;
342
+ toggleVaporwave(speed?: number, pitch?: number, rate?: number): Promise<FilterManager>;
1059
343
  /**
1060
- * Get the current lyrics of the track currently playing on the guild
1061
- * @param guildId The guild id to get the current lyrics for
1062
- * @param skipTrackSource If true, it will not try to get the lyrics from the track source
1063
- * @returns The current lyrics
344
+ * Enable / Disables a Karaoke like Filter Effect
345
+ * @param {number} level set the level of the filter
346
+ * @param {number} monoLevel set the mono level of the filter
347
+ * @param {number} filterBand set the filter band of the filter
348
+ * @param {number} filterWidth set the filter width of the filter
349
+ * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
350
+ *
1064
351
  * @example
1065
352
  * ```ts
1066
- * const lyrics = await player.getCurrentLyrics();
353
+ * // Toggle Karaoke filter with custom settings
354
+ * await player.filterManager.toggleKaraoke(1.5, 1.0, 220, 100);
355
+ * // or use the defaults
356
+ * await player.filterManager.toggleKaraoke();
357
+ * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
1067
358
  * ```
1068
359
  */
1069
- getCurrentLyrics(skipTrackSource?: boolean): Promise<LyricsResult>;
360
+ toggleKaraoke(level?: number, monoLevel?: number, filterBand?: number, filterWidth?: number): Promise<FilterManager>;
1070
361
  /**
1071
- * Get the lyrics of a specific track
1072
- * @param track The track to get the lyrics for
1073
- * @param skipTrackSource If true, it will not try to get the lyrics from the track source
1074
- * @returns The lyrics of the track
362
+ * Function to find out if currently there is a custom timescamle etc. filter applied
363
+ * @returns {boolean} whether a custom filter is active
364
+ *
1075
365
  * @example
1076
366
  * ```ts
1077
- * const lyrics = await player.getLyrics(player.queue.tracks[0], true);
367
+ * // Check if a custom filter is active
368
+ * const isCustom = player.filterManager.isCustomFilterActive();
369
+ * console.log(`Is custom filter active? ${isCustom}`);
1078
370
  * ```
1079
371
  */
1080
- getLyrics(track: Track, skipTrackSource?: boolean): Promise<LyricsResult>;
372
+ isCustomFilterActive(): boolean;
1081
373
  /**
1082
- * Subscribe to the lyrics event on a specific guild to active live lyrics events
1083
- * @returns The unsubscribe function
374
+ * Sets the players equalizer bands using one of the predefined presets.
375
+ * @param {keyof typeof EQList} preset The preset to use.
376
+ * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
377
+ *
1084
378
  * @example
1085
379
  * ```ts
1086
- * const lyrics = await player.subscribeLyrics();
380
+ * // Set EQ preset
381
+ * await player.filterManager.setEQPreset('BassboostMedium');
1087
382
  * ```
1088
383
  */
1089
- subscribeLyrics(): Promise<unknown>;
384
+ setEQPreset(preset: keyof typeof EQList): Promise<this>;
1090
385
  /**
1091
- * Unsubscribe from the lyrics event on a specific guild to disable live lyrics events
1092
- * @returns The unsubscribe function
386
+ * Sets the players equalizer band on-top of the existing ones.
387
+ * @param {number} bands
388
+ * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
389
+ *
1093
390
  * @example
1094
391
  * ```ts
1095
- * const lyrics = await player.unsubscribeLyrics();
392
+ * // Set EQ bands
393
+ * await player.filterManager.setEQ([
394
+ * { band: 0, gain: 0.3 },
395
+ * { band: 1, gain: -0.2 },
396
+ * { band: 2, gain: 0.1 }
397
+ * ]);
398
+ *
399
+ * // or use one of the templates:
400
+ * await player.filterManager.setEQ(player.filterManager.EQList.BassboostMedium); // you can also import EQList from somewhere package if wanted.
1096
401
  * ```
1097
402
  */
1098
- unsubscribeLyrics(): Promise<void>;
403
+ setEQ(bands: EQBand | EQBand[]): Promise<this>;
1099
404
  /**
1100
- * Move the player on a different Audio-Node
1101
- * @param newNode New Node / New Node Id
1102
- * @param checkSources If it should check if the sources are supported by the new node @default true
1103
- * @return The new Node Id
405
+ * Clears the equalizer bands.
406
+ * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
407
+ *
1104
408
  * @example
1105
409
  * ```ts
1106
- * const changeNode = await player.changeNode(newNode, true);
410
+ * // Clear all EQ bands
411
+ * await player.filterManager.clearEQ();
1107
412
  * ```
1108
413
  */
1109
- changeNode(newNode: LavalinkNode | string, checkSources?: boolean): Promise<string>;
1110
- /**
1111
- * 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.
1112
- * @param node the id of the node to move to
1113
- * @returns the player
1114
- * @throws RangeError if there is no available nodes.
1115
- * @throws Error if the node to move to is the same as the current node.
1116
- */
1117
- moveNode(node?: string): Promise<string | this>;
1118
- /** Converts the Player including Queue to a Json state */
1119
- toJSON(): PlayerJson;
414
+ clearEQ(): Promise<this>;
1120
415
  }
1121
416
 
1122
417
  /** Sourcenames provided by lavalink server */
@@ -1224,408 +519,479 @@ interface Track {
1224
519
  /** Plugin Information from Lavalink */
1225
520
  pluginInfo: Partial<PluginInfo>;
1226
521
  /** The Track's Requester */
1227
- requester?: unknown;
1228
- /** The userData Object from when you provide to the lavalink request */
1229
- userData?: anyObject;
1230
- }
1231
- interface UnresolvedTrackInfo extends Partial<TrackInfo> {
1232
- /** Required */
1233
- title: string;
1234
- }
1235
- interface UnresolvedQuery extends UnresolvedTrackInfo {
1236
- /** The base64 of the unresolved track to "encode" */
1237
- encoded?: Base64;
1238
- }
1239
- interface UnresolvedTrack {
1240
- /** Required */
1241
- resolve: (player: Player) => Promise<void>;
1242
- /** The Base 64 encoded String */
1243
- encoded?: Base64;
1244
- /** Track Information */
1245
- info: UnresolvedTrackInfo;
1246
- /** Plugin Information from Lavalink */
1247
- pluginInfo: Partial<PluginInfo>;
1248
- /** The userData Object from when you provide to the lavalink request */
1249
- userData?: anyObject;
1250
- /** The Track's Requester */
1251
- requester?: unknown;
1252
- }
1253
-
1254
- interface StoredQueue {
1255
- current: Track | null;
1256
- previous: Track[];
1257
- tracks: (Track | UnresolvedTrack)[];
1258
- }
1259
- interface QueueStoreManager {
1260
- /** @async get a Value (MUST RETURN UNPARSED!) */
1261
- get: (guildId: string) => Awaitable<StoredQueue | string | undefined>;
1262
- /** @async Set a value inside a guildId (MUST BE UNPARSED) */
1263
- set: (guildId: string, value: StoredQueue | string) => Awaitable<void | boolean>;
1264
- /** @async Delete a Database Value based of it's guildId */
1265
- delete: (guildId: string) => Awaitable<void | boolean>;
1266
- /** @async Transform the value(s) inside of the QueueStoreManager (IF YOU DON'T NEED PARSING/STRINGIFY, then just return the value) */
1267
- stringify: (value: StoredQueue | string) => Awaitable<StoredQueue | string>;
1268
- /** @async Parse the saved value back to the Queue (IF YOU DON'T NEED PARSING/STRINGIFY, then just return the value) */
1269
- parse: (value: StoredQueue | string) => Awaitable<Partial<StoredQueue>>;
1270
- }
1271
- interface ManagerQueueOptions {
1272
- /** Maximum Amount of tracks for the queue.previous array. Set to 0 to not save previous songs. Defaults to 25 Tracks */
1273
- maxPreviousTracks?: number;
1274
- /** Custom Queue Store option */
1275
- queueStore?: QueueStoreManager;
1276
- /** Custom Queue Watcher class */
1277
- queueChangesWatcher?: QueueChangesWatcher;
1278
- }
1279
- interface QueueChangesWatcher {
1280
- /** get a Value (MUST RETURN UNPARSED!) */
1281
- tracksAdd: (guildId: string, tracks: (Track | UnresolvedTrack)[], position: number, oldStoredQueue: StoredQueue, newStoredQueue: StoredQueue) => void;
1282
- /** Set a value inside a guildId (MUST BE UNPARSED) */
1283
- tracksRemoved: (guildId: string, tracks: (Track | UnresolvedTrack)[], position: number | number[], oldStoredQueue: StoredQueue, newStoredQueue: StoredQueue) => void;
1284
- /** Set a value inside a guildId (MUST BE UNPARSED) */
1285
- shuffled: (guildId: string, oldStoredQueue: StoredQueue, newStoredQueue: StoredQueue) => void;
1286
- }
1287
-
1288
- type DestroyReasonsType = keyof typeof DestroyReasons | string;
1289
- type DisconnectReasonsType = keyof typeof DisconnectReasons | string;
1290
- interface PlayerJson {
1291
- /** Guild Id where the player was playing in */
1292
- guildId: string;
1293
- /** Options provided to the player */
1294
- options: PlayerOptions;
1295
- /** Voice Channel Id the player was playing in */
1296
- voiceChannelId: string;
1297
- /** Text Channel Id the player was synced to */
1298
- textChannelId?: string;
1299
- /** Position the player was at */
1300
- position: number;
1301
- /** Lavalink's position the player was at */
1302
- lastPosition: number;
1303
- /** Last time the position was sent from lavalink */
1304
- lastPositionChange: number | null;
1305
- /** Volume in % from the player (without volumeDecrementer) */
1306
- volume: number;
1307
- /** Real Volume used in lavalink (with the volumeDecrementer) */
1308
- lavalinkVolume: number;
1309
- /** The repeatmode from the player */
1310
- repeatMode: RepeatMode;
1311
- /** Pause state */
1312
- paused: boolean;
1313
- /** Wether the player was playing or not */
1314
- playing: boolean;
1315
- /** When the player was created */
1316
- createdTimeStamp?: number;
1317
- /** All current used fitlers Data */
1318
- filters: FilterData;
1319
- /** The player's ping object */
1320
- ping: {
1321
- /** Ping to the voice websocket server */
1322
- ws: number;
1323
- /** Avg. calc. Ping to the lavalink server */
1324
- lavalink: number;
1325
- };
1326
- /** Equalizer Bands used in lavalink */
1327
- equalizer: EQBand[];
1328
- /** The Id of the last used node */
1329
- nodeId?: string;
1330
- /** The SessionId of the node */
1331
- nodeSessionId?: string;
1332
- /** The stored queue */
1333
- queue?: StoredQueue;
1334
- }
1335
- type RepeatMode = "queue" | "track" | "off";
1336
- interface PlayerOptions {
1337
- /** Guild id of the player */
1338
- guildId: string;
1339
- /** The Voice Channel Id */
1340
- voiceChannelId: string;
1341
- /** The Text Channel Id of the Player */
1342
- textChannelId?: string;
1343
- /** instantly change volume with the one play request */
1344
- volume?: number;
1345
- /** VC Region for node selections */
1346
- vcRegion?: string;
1347
- /** if it should join deafened */
1348
- selfDeaf?: boolean;
1349
- /** If it should join muted */
1350
- selfMute?: boolean;
1351
- /** If it should use a specific lavalink node */
1352
- node?: LavalinkNode | string;
1353
- /** If when applying filters, it should use the insta apply filters fix */
1354
- instaUpdateFiltersFix?: boolean;
1355
- /** If a volume should be applied via filters instead of lavalink-volume */
1356
- applyVolumeAsFilter?: boolean;
1357
- /** Custom Data for the player get/set datastorage */
1358
- customData?: anyObject;
1359
- }
1360
- type anyObject = {
1361
- [key: string | number]: string | number | null | anyObject;
1362
- };
1363
- interface BasePlayOptions {
1364
- /** The position to start the track. */
1365
- position?: number;
1366
- /** The position to end the track. */
1367
- endTime?: number;
1368
- /** If to start "paused" */
1369
- paused?: boolean;
1370
- /** The Volume to start with */
1371
- volume?: number;
1372
- /** The Lavalink Filters to use | only with the new REST API */
1373
- filters?: Partial<LavalinkFilterData>;
1374
- /** Voice Update for Lavalink */
1375
- voice?: LavalinkPlayerVoiceOptions;
1376
- }
1377
- interface LavalinkPlayOptions extends BasePlayOptions {
1378
- /** Which Track to play | don't provide, if it should pick from the Queue */
1379
- track?: {
1380
- /** The track encoded base64 string to use instead of the one from the queue system */
1381
- encoded?: Base64 | null;
1382
- /** The identifier of the track to use */
1383
- identifier?: string;
1384
- /** Custom User Data for the track to provide, will then be on the userData object from the track */
1385
- userData?: anyObject;
1386
- /** The Track requester for when u provide encodedTrack / identifer */
1387
- requester?: unknown;
1388
- };
1389
- }
1390
- interface PlayOptions extends LavalinkPlayOptions {
1391
- /** Whether to not replace the track if a play payload is sent. */
1392
- noReplace?: boolean;
1393
- /** Adds track on queue and skips to it */
1394
- clientTrack?: Track | UnresolvedTrack;
1395
- }
1396
-
1397
- /** Ability to manipulate fetch requests */
1398
- type ModifyRequest = (options: RequestInit & {
1399
- path: string;
1400
- extraQueryUrlParams?: URLSearchParams;
1401
- }) => void;
1402
- type SponsorBlockSegment = "sponsor" | "selfpromo" | "interaction" | "intro" | "outro" | "preview" | "music_offtopic" | "filler";
1403
- /**
1404
- * Node Options for creating a lavalink node
1405
- */
1406
- interface LavalinkNodeOptions {
1407
- /** The Lavalink Server-Ip / Domain-URL */
1408
- host: string;
1409
- /** The Lavalink Connection Port */
1410
- port: number;
1411
- /** The Lavalink Password / Authorization-Key */
1412
- authorization: string;
1413
- /** Does the Server use ssl (https) */
1414
- secure?: boolean;
1415
- /** RESUME THE PLAYER? by providing a sessionid on the node-creation */
1416
- sessionId?: string;
1417
- /** Add a Custom ID to the node, for later use */
1418
- id?: string;
1419
- /** Voice Regions of this Node */
1420
- regions?: string[];
1421
- /** The retryAmount for the node. */
1422
- retryAmount?: number;
1423
- /** The retryDelay for the node. */
1424
- retryDelay?: number;
1425
- /** signal for cancelling requests - default: AbortSignal.timeout(options.requestSignalTimeoutMS || 10000) - put <= 0 to disable */
1426
- requestSignalTimeoutMS?: number;
1427
- /** Close on error */
1428
- closeOnError?: boolean;
1429
- /** Heartbeat interval , set to <= 0 to disable heartbeat system */
1430
- heartBeatInterval?: number;
1431
- /** Recommended, to check wether the client is still connected or not on the stats endpoint */
1432
- enablePingOnStatsCheck?: boolean;
1433
- }
1434
- /**
1435
- * Memory Stats object from lavalink
1436
- */
1437
- interface MemoryStats {
1438
- /** The free memory of the allocated amount. */
1439
- free: number;
1440
- /** The used memory of the allocated amount. */
1441
- used: number;
1442
- /** The total allocated memory. */
1443
- allocated: number;
1444
- /** The reservable memory. */
1445
- reservable: number;
1446
- }
1447
- /**
1448
- * CPU Stats object from lavalink
1449
- */
1450
- interface CPUStats {
1451
- /** The core amount the host machine has. */
1452
- cores: number;
1453
- /** The system load. */
1454
- systemLoad: number;
1455
- /** The lavalink load. */
1456
- lavalinkLoad: number;
1457
- }
1458
- /**
1459
- * FrameStats Object from lavalink
1460
- */
1461
- interface FrameStats {
1462
- /** The amount of sent frames. */
1463
- sent?: number;
1464
- /** The amount of nulled frames. */
1465
- nulled?: number;
1466
- /** The amount of deficit frames. */
1467
- deficit?: number;
522
+ requester?: unknown;
523
+ /** The userData Object from when you provide to the lavalink request */
524
+ userData?: anyObject;
1468
525
  }
1469
- /**
1470
- * BaseNodeStats object from Lavalink
1471
- */
1472
- interface BaseNodeStats {
1473
- /** The amount of players on the node. */
1474
- players: number;
1475
- /** The amount of playing players on the node. */
1476
- playingPlayers: number;
1477
- /** The uptime for the node. */
1478
- uptime: number;
1479
- /** The memory stats for the node. */
1480
- memory: MemoryStats;
1481
- /** The cpu stats for the node. */
1482
- cpu: CPUStats;
1483
- /** The frame stats for the node. */
1484
- frameStats: FrameStats;
526
+ interface UnresolvedTrackInfo extends Partial<TrackInfo> {
527
+ /** Required */
528
+ title: string;
1485
529
  }
1486
- /**
1487
- * Interface for nodeStats from lavalink
1488
- */
1489
- interface NodeStats extends BaseNodeStats {
1490
- /** The frame stats for the node. */
1491
- frameStats: FrameStats;
530
+ interface UnresolvedQuery extends UnresolvedTrackInfo {
531
+ /** The base64 of the unresolved track to "encode" */
532
+ encoded?: Base64;
1492
533
  }
1493
- /**
1494
- * Entire lavalink information object from lavalink
1495
- */
1496
- interface LavalinkInfo {
1497
- /** The version of this Lavalink server */
1498
- version: VersionObject;
1499
- /** The millisecond unix timestamp when this Lavalink jar was built */
1500
- buildTime: number;
1501
- /** The git information of this Lavalink server */
1502
- git: GitObject;
1503
- /** The JVM version this Lavalink server runs on */
1504
- jvm: string;
1505
- /** The Lavaplayer version being used by this server */
1506
- lavaplayer: string;
1507
- /** The enabled source managers for this server */
1508
- sourceManagers: string[];
1509
- /** The enabled filters for this server */
1510
- filters: string[];
1511
- /** The enabled plugins for this server */
1512
- plugins: PluginObject[];
534
+ interface UnresolvedTrack {
535
+ /** Required */
536
+ resolve: (player: Player) => Promise<void>;
537
+ /** The Base 64 encoded String */
538
+ encoded?: Base64;
539
+ /** Track Information */
540
+ info: UnresolvedTrackInfo;
541
+ /** Plugin Information from Lavalink */
542
+ pluginInfo: Partial<PluginInfo>;
543
+ /** The userData Object from when you provide to the lavalink request */
544
+ userData?: anyObject;
545
+ /** The Track's Requester */
546
+ requester?: unknown;
1513
547
  }
1514
- /**
1515
- * Lavalink's version object from lavalink
1516
- */
1517
- interface VersionObject {
1518
- /** The full version string of this Lavalink server */
1519
- semver: string;
1520
- /** The major version of this Lavalink server */
1521
- major: number;
1522
- /** The minor version of this Lavalink server */
1523
- minor: number;
1524
- /** The patch version of this Lavalink server */
1525
- patch: number;
1526
- /** The pre-release version according to semver as a . separated list of identifiers */
1527
- preRelease?: string;
1528
- /** The build metadata according to semver as a . separated list of identifiers */
1529
- build?: string;
548
+
549
+ interface StoredQueue {
550
+ current: Track | null;
551
+ previous: Track[];
552
+ tracks: (Track | UnresolvedTrack)[];
1530
553
  }
1531
- /**
1532
- * Git information object from lavalink
1533
- */
1534
- interface GitObject {
1535
- /** The branch this Lavalink server was built on */
1536
- branch: string;
1537
- /** The commit this Lavalink server was built on */
1538
- commit: string;
1539
- /** The millisecond unix timestamp for when the commit was created */
1540
- commitTime: string;
554
+ interface QueueStoreManager {
555
+ /** @async get a Value (MUST RETURN UNPARSED!) */
556
+ get: (guildId: string) => Awaitable<StoredQueue | string | undefined>;
557
+ /** @async Set a value inside a guildId (MUST BE UNPARSED) */
558
+ set: (guildId: string, value: StoredQueue | string) => Awaitable<void | boolean>;
559
+ /** @async Delete a Database Value based of it's guildId */
560
+ delete: (guildId: string) => Awaitable<void | boolean>;
561
+ /** @async Transform the value(s) inside of the QueueStoreManager (IF YOU DON'T NEED PARSING/STRINGIFY, then just return the value) */
562
+ stringify: (value: StoredQueue | string) => Awaitable<StoredQueue | string>;
563
+ /** @async Parse the saved value back to the Queue (IF YOU DON'T NEED PARSING/STRINGIFY, then just return the value) */
564
+ parse: (value: StoredQueue | string) => Awaitable<Partial<StoredQueue>>;
1541
565
  }
1542
- /**
1543
- * Lavalink's plugins object from lavalink's plugin
1544
- */
1545
- interface PluginObject {
1546
- /** The name of the plugin */
1547
- name: string;
1548
- /** The version of the plugin */
1549
- version: string;
566
+ interface ManagerQueueOptions {
567
+ /** Maximum Amount of tracks for the queue.previous array. Set to 0 to not save previous songs. Defaults to 25 Tracks */
568
+ maxPreviousTracks?: number;
569
+ /** Custom Queue Store option */
570
+ queueStore?: QueueStoreManager;
571
+ /** Custom Queue Watcher class */
572
+ queueChangesWatcher?: QueueChangesWatcher;
1550
573
  }
1551
- interface LyricsResult {
1552
- /**The name of the source */
1553
- sourceName: string;
1554
- /**The name of the provider */
1555
- provider: string;
1556
- /**The result text */
1557
- text: string | null;
1558
- /**The lyrics lines */
1559
- lines: LyricsLine[];
1560
- /**Information about the plugin */
1561
- plugin: PluginInfo;
574
+ interface QueueChangesWatcher {
575
+ /** get a Value (MUST RETURN UNPARSED!) */
576
+ tracksAdd: (guildId: string, tracks: (Track | UnresolvedTrack)[], position: number, oldStoredQueue: StoredQueue, newStoredQueue: StoredQueue) => void;
577
+ /** Set a value inside a guildId (MUST BE UNPARSED) */
578
+ tracksRemoved: (guildId: string, tracks: (Track | UnresolvedTrack)[], position: number | number[], oldStoredQueue: StoredQueue, newStoredQueue: StoredQueue) => void;
579
+ /** Set a value inside a guildId (MUST BE UNPARSED) */
580
+ shuffled: (guildId: string, oldStoredQueue: StoredQueue, newStoredQueue: StoredQueue) => void;
1562
581
  }
1563
- interface LyricsLine {
1564
- /**The millisecond timestamp */
1565
- timestamp: number;
1566
- /**The line duration in milliseconds */
1567
- duration: number | null;
1568
- /**The line text */
1569
- line: string;
1570
- /**Information about the plugin */
1571
- plugin: PluginInfo;
582
+
583
+ declare class QueueSaver {
584
+ /**
585
+ * The queue store manager
586
+ */
587
+ private _;
588
+ /**
589
+ * The options for the queue saver
590
+ */
591
+ options: {
592
+ maxPreviousTracks: number;
593
+ };
594
+ constructor(options: ManagerQueueOptions);
595
+ /**
596
+ * Get the queue for a guild
597
+ * @param guildId The guild ID
598
+ * @returns The queue for the guild
599
+ */
600
+ get(guildId: string): Promise<Partial<StoredQueue>>;
601
+ /**
602
+ * Delete the queue for a guild
603
+ * @param guildId The guild ID
604
+ * @returns The queue for the guild
605
+ */
606
+ delete(guildId: string): Promise<boolean | void>;
607
+ /**
608
+ * Set the queue for a guild
609
+ * @param guildId The guild ID
610
+ * @param valueToStringify The queue to set
611
+ * @returns The queue for the guild
612
+ */
613
+ set(guildId: string, valueToStringify: StoredQueue): Promise<boolean | void>;
614
+ /**
615
+ * Sync the queue for a guild
616
+ * @param guildId The guild ID
617
+ * @returns The queue for the guild
618
+ */
619
+ sync(guildId: string): Promise<Partial<StoredQueue>>;
620
+ }
621
+ declare class DefaultQueueStore implements QueueStoreManager {
622
+ private data;
623
+ constructor();
624
+ /**
625
+ * Get the queue for a guild
626
+ * @param guildId The guild ID
627
+ * @returns The queue for the guild
628
+ */
629
+ get(guildId: string): StoredQueue | undefined;
630
+ /**
631
+ * Set the queue for a guild
632
+ * @param guildId The guild ID
633
+ * @param valueToStringify The queue to set
634
+ * @returns The queue for the guild
635
+ */
636
+ set(guildId: string, valueToStringify: any): boolean;
637
+ /**
638
+ * Delete the queue for a guild
639
+ * @param guildId The guild ID
640
+ * @returns The queue for the guild
641
+ */
642
+ delete(guildId: string): boolean;
643
+ /**
644
+ * Stringify the queue for a guild
645
+ * @param value The queue to stringify
646
+ * @returns The stringified queue
647
+ */
648
+ stringify(value: StoredQueue | string): StoredQueue | string;
649
+ /**
650
+ * Parse the queue for a guild
651
+ * @param value The queue to parse
652
+ * @returns The parsed queue
653
+ */
654
+ parse(value: StoredQueue | string): Partial<StoredQueue>;
655
+ }
656
+ declare class Queue {
657
+ readonly tracks: (Track | UnresolvedTrack)[];
658
+ readonly previous: Track[];
659
+ current: Track | null;
660
+ options: {
661
+ maxPreviousTracks: number;
662
+ };
663
+ private readonly guildId;
664
+ private readonly QueueSaver;
665
+ private managerUtils;
666
+ private queueChanges;
667
+ /**
668
+ * Create a new Queue
669
+ * @param guildId The guild ID
670
+ * @param data The data to initialize the queue with
671
+ * @param QueueSaver The queue saver to use
672
+ * @param queueOptions
673
+ */
674
+ constructor(guildId: string, data?: Partial<StoredQueue>, QueueSaver?: QueueSaver, queueOptions?: ManagerQueueOptions);
675
+ /**
676
+ * Utils for a Queue
677
+ */
678
+ utils: {
679
+ /**
680
+ * Save the current cached Queue on the database/server (overides the server)
681
+ */
682
+ save: () => Promise<boolean | void>;
683
+ /**
684
+ * Sync the current queue database/server with the cached one
685
+ * @returns {void}
686
+ */
687
+ sync: (override?: boolean, dontSyncCurrent?: boolean) => Promise<void>;
688
+ destroy: () => Promise<boolean | void>;
689
+ /**
690
+ * @returns {{current:Track|null, previous:Track[], tracks:Track[]}}The Queue, but in a raw State, which allows easier handling for the QueueStoreManager
691
+ */
692
+ toJSON: () => StoredQueue;
693
+ /**
694
+ * Get the Total Duration of the Queue-Songs summed up
695
+ * @returns {number}
696
+ */
697
+ totalDuration: () => number;
698
+ };
699
+ /**
700
+ * Shuffles the current Queue, then saves it
701
+ * @returns Amount of Tracks in the Queue
702
+ */
703
+ shuffle(): Promise<number>;
704
+ /**
705
+ * Add a Track to the Queue, and after saved in the "db" it returns the amount of the Tracks
706
+ * @param {Track | Track[]} TrackOrTracks
707
+ * @param {number} index At what position to add the Track
708
+ * @returns {number} Queue-Size (for the next Tracks)
709
+ */
710
+ add(TrackOrTracks: Track | UnresolvedTrack | (Track | UnresolvedTrack)[], index?: number): any;
711
+ /**
712
+ * Splice the tracks in the Queue
713
+ * @param {number} index Where to remove the Track
714
+ * @param {number} amount How many Tracks to remove?
715
+ * @param {Track | Track[]} TrackOrTracks Want to Add more Tracks?
716
+ * @returns {Track} Spliced Track
717
+ */
718
+ splice(index: number, amount: number, TrackOrTracks?: Track | UnresolvedTrack | (Track | UnresolvedTrack)[]): any;
719
+ /**
720
+ * Remove stuff from the queue.tracks array
721
+ * - single Track | UnresolvedTrack
722
+ * - multiple Track | UnresovedTrack
723
+ * - at the index or multiple indexes
724
+ * - 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)
725
+ * @param removeQueryTrack
726
+ * @returns null (if nothing was removed) / { removed } where removed is an array with all removed elements
727
+ *
728
+ * @example
729
+ * ```js
730
+ * // remove single track
731
+ *
732
+ * const track = player.queue.tracks[4];
733
+ * await player.queue.remove(track);
734
+ *
735
+ * // if you already have the index you can straight up pass it too
736
+ * await player.queue.remove(4);
737
+ *
738
+ *
739
+ * // if you want to remove multiple tracks, e.g. from position 4 to position 10 you can do smt like this
740
+ * 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
741
+ *
742
+ * // I still highly suggest to use .splice!
743
+ *
744
+ * await player.queue.splice(4, 10); // removes at index 4, 10 tracks
745
+ *
746
+ * await player.queue.splice(1, 1); // removes at index 1, 1 track
747
+ *
748
+ * await player.queue.splice(4, 0, ...tracks) // removes 0 tracks at position 4, and then inserts all tracks after position 4.
749
+ * ```
750
+ */
751
+ remove<T extends Track | UnresolvedTrack | number | Track[] | UnresolvedTrack[] | number[] | (number | Track | UnresolvedTrack)[]>(removeQueryTrack: T): Promise<{
752
+ removed: (Track | UnresolvedTrack)[];
753
+ } | null>;
754
+ /**
755
+ * Shifts the previous array, to return the last previous track & thus remove it from the previous queue
756
+ * @returns
757
+ *
758
+ * @example
759
+ * ```js
760
+ * // example on how to play the previous track again
761
+ * const previous = await player.queue.shiftPrevious(); // get the previous track and remove it from the previous queue array!!
762
+ * if(!previous) return console.error("No previous track found");
763
+ * await player.play({ clientTrack: previous }); // play it again
764
+ * ```
765
+ */
766
+ shiftPrevious(): Promise<Track>;
1572
767
  }
1573
- type LavalinkNodeIdentifier = string;
1574
- interface NodeManagerEvents {
768
+
769
+ declare class Player {
770
+ /** Filter Manager per player */
771
+ filterManager: FilterManager;
772
+ /** circular reference to the lavalink Manager from the Player for easier use */
773
+ LavalinkManager: LavalinkManager;
774
+ /** Player options currently used, mutation doesn't affect player's state */
775
+ options: PlayerOptions;
776
+ /** The lavalink node assigned the the player, don't change it manually */
777
+ node: LavalinkNode;
778
+ /** The queue from the player */
779
+ queue: Queue;
780
+ /** The Guild Id of the Player */
781
+ guildId: string;
782
+ /** The Voice Channel Id of the Player */
783
+ voiceChannelId: string | null;
784
+ /** The Text Channel Id of the Player */
785
+ textChannelId: string | null;
786
+ /** States if the Bot is supposed to be outputting audio */
787
+ playing: boolean;
788
+ /** States if the Bot is paused or not */
789
+ paused: boolean;
790
+ /** Repeat Mode of the Player */
791
+ repeatMode: RepeatMode;
792
+ /** Player's ping */
793
+ ping: {
794
+ lavalink: number;
795
+ ws: number;
796
+ };
797
+ /** The Display Volume */
798
+ volume: number;
799
+ /** The Volume Lavalink actually is outputting */
800
+ lavalinkVolume: number;
801
+ /** The current Positin of the player (Calculated) */
802
+ get position(): number;
803
+ /** The timestamp when the last position change update happened */
804
+ lastPositionChange: number | null;
805
+ /** The current Positin of the player (from Lavalink) */
806
+ lastPosition: number;
807
+ lastSavedPosition: number;
808
+ /** When the player was created [Timestamp in Ms] (from lavalink) */
809
+ createdTimeStamp: number;
810
+ /** The Player Connection's State (from Lavalink) */
811
+ connected: boolean | undefined;
812
+ /** Voice Server Data (from Lavalink) */
813
+ voice: LavalinkPlayerVoiceOptions;
814
+ voiceState: {
815
+ selfDeaf: boolean;
816
+ selfMute: boolean;
817
+ serverDeaf: boolean;
818
+ serverMute: boolean;
819
+ suppress: boolean;
820
+ };
821
+ /** Custom data for the player */
822
+ private readonly data;
1575
823
  /**
1576
- * Emitted when a Node is created.
1577
- * @event Manager.nodeManager#create
824
+ * Create a new Player
825
+ * @param options
826
+ * @param LavalinkManager
1578
827
  */
1579
- "create": (node: LavalinkNode) => void;
828
+ constructor(options: PlayerOptions, LavalinkManager: LavalinkManager, dontEmitPlayerCreateEvent?: boolean);
1580
829
  /**
1581
- * Emitted when a Node is destroyed.
1582
- * @event Manager.nodeManager#destroy
830
+ * Set custom data.
831
+ * @param key
832
+ * @param value
833
+ */
834
+ set(key: string, value: unknown): this;
835
+ /**
836
+ * Get custom data.
837
+ * @param key
838
+ */
839
+ get<T>(key: string): T;
840
+ /**
841
+ * CLears all the custom data.
842
+ */
843
+ clearData(): this;
844
+ /**
845
+ * Get all custom Data
846
+ */
847
+ getAllData(): Record<string, unknown>;
848
+ /**
849
+ * Play the next track from the queue / a specific track, with playoptions for Lavalink
850
+ * @param options
851
+ */
852
+ play(options?: Partial<PlayOptions>): any;
853
+ /**
854
+ * Set the Volume for the Player
855
+ * @param volume The Volume in percent
856
+ * @param ignoreVolumeDecrementer If it should ignore the volumedecrementer option
857
+ */
858
+ setVolume(volume: number, ignoreVolumeDecrementer?: boolean): Promise<this>;
859
+ /**
860
+ * Search for a track
861
+ * @param query The query to search for
862
+ * @param requestUser The user that requested the track
863
+ * @param throwOnEmpty If an error should be thrown if no track is found
864
+ * @returns The search result
865
+ */
866
+ lavaSearch(query: LavaSearchQuery, requestUser: unknown, throwOnEmpty?: boolean): Promise<LavaSearchResponse | SearchResult>;
867
+ /**
868
+ * Set the SponsorBlock
869
+ * @param segments The segments to set
870
+ */
871
+ setSponsorBlock(segments?: SponsorBlockSegment[]): Promise<void>;
872
+ /**
873
+ * Get the SponsorBlock
874
+ */
875
+ getSponsorBlock(): Promise<SponsorBlockSegment[]>;
876
+ /**
877
+ * Delete the SponsorBlock
878
+ */
879
+ deleteSponsorBlock(): Promise<void>;
880
+ /**
881
+ *
882
+ * @param query Query for your data
883
+ * @param requestUser
884
+ */
885
+ search(query: SearchQuery, requestUser: unknown, throwOnEmpty?: boolean): Promise<UnresolvedSearchResult | SearchResult>;
886
+ /**
887
+ * Pause the player
888
+ */
889
+ pause(): Promise<this>;
890
+ /**
891
+ * Resume the Player
892
+ */
893
+ resume(): Promise<this>;
894
+ /**
895
+ * Seek to a specific Position
896
+ * @param position
897
+ */
898
+ seek(position: number): Promise<this>;
899
+ /**
900
+ * Set the Repeatmode of the Player
901
+ * @param repeatMode
902
+ */
903
+ setRepeatMode(repeatMode: RepeatMode): Promise<this>;
904
+ /**
905
+ * Skip the current song, or a specific amount of songs
906
+ * @param amount provide the index of the next track to skip to
907
+ */
908
+ skip(skipTo?: number, throwError?: boolean): Promise<this>;
909
+ /**
910
+ * Clears the queue and stops playing. Does not destroy the Player and not leave the channel
911
+ * @returns
912
+ */
913
+ stopPlaying(clearQueue?: boolean, executeAutoplay?: boolean): Promise<this>;
914
+ /**
915
+ * Connects the Player to the Voice Channel
916
+ * @returns
917
+ */
918
+ connect(): Promise<this>;
919
+ changeVoiceState(data: {
920
+ voiceChannelId?: string;
921
+ selfDeaf?: boolean;
922
+ selfMute?: boolean;
923
+ }): Promise<this>;
924
+ /**
925
+ * Disconnects the Player from the Voice Channel, but keeps the player in the cache
926
+ * @param force If false it throws an error, if player thinks it's already disconnected
927
+ * @returns
928
+ */
929
+ disconnect(force?: boolean): Promise<this>;
930
+ /**
931
+ * Destroy the player and disconnect from the voice channel
932
+ */
933
+ destroy(reason?: DestroyReasons | string, disconnect?: boolean): Promise<this>;
934
+ /**
935
+ * Get the current lyrics of the track currently playing on the guild
936
+ * @param guildId The guild id to get the current lyrics for
937
+ * @param skipTrackSource If true, it will not try to get the lyrics from the track source
938
+ * @returns The current lyrics
939
+ * @example
940
+ * ```ts
941
+ * const lyrics = await player.getCurrentLyrics();
942
+ * ```
1583
943
  */
1584
- "destroy": (node: LavalinkNode, destroyReason?: DestroyReasonsType) => void;
944
+ getCurrentLyrics(skipTrackSource?: boolean): Promise<LyricsResult>;
1585
945
  /**
1586
- * Emitted when a Node is connected.
1587
- * @event Manager.nodeManager#connect
946
+ * Get the lyrics of a specific track
947
+ * @param track The track to get the lyrics for
948
+ * @param skipTrackSource If true, it will not try to get the lyrics from the track source
949
+ * @returns The lyrics of the track
950
+ * @example
951
+ * ```ts
952
+ * const lyrics = await player.getLyrics(player.queue.tracks[0], true);
953
+ * ```
1588
954
  */
1589
- "connect": (node: LavalinkNode) => void;
1590
- /**
1591
- * Emitted when a Node is reconnecting.
1592
- * @event Manager.nodeManager#reconnecting
1593
- */
1594
- "reconnecting": (node: LavalinkNode) => void;
955
+ getLyrics(track: Track, skipTrackSource?: boolean): Promise<LyricsResult>;
1595
956
  /**
1596
- * Emitted When a node starts to reconnect (if you have a reconnection delay, the reconnecting event will be emitted after the retryDelay.)
1597
- * Useful to check wether the internal node reconnect system works or not
1598
- * @event Manager.nodeManager#reconnectinprogress
957
+ * Subscribe to the lyrics event on a specific guild to active live lyrics events
958
+ * @returns The unsubscribe function
959
+ * @example
960
+ * ```ts
961
+ * const lyrics = await player.subscribeLyrics();
962
+ * ```
1599
963
  */
1600
- "reconnectinprogress": (node: LavalinkNode) => void;
1601
- /**
1602
- * Emitted when a Node is disconnects.
1603
- * @event Manager.nodeManager#disconnect
1604
- */
1605
- "disconnect": (node: LavalinkNode, reason: {
1606
- code?: number;
1607
- reason?: string;
1608
- }) => void;
964
+ subscribeLyrics(): Promise<unknown>;
1609
965
  /**
1610
- * Emitted when a Node is error.
1611
- * @event Manager.nodeManager#error
1612
- */
1613
- "error": (node: LavalinkNode, error: Error, payload?: unknown) => void;
966
+ * Unsubscribe from the lyrics event on a specific guild to disable live lyrics events
967
+ * @returns The unsubscribe function
968
+ * @example
969
+ * ```ts
970
+ * const lyrics = await player.unsubscribeLyrics();
971
+ * ```
972
+ */
973
+ unsubscribeLyrics(): Promise<void>;
1614
974
  /**
1615
- * Emits every single Node event.
1616
- * @event Manager.nodeManager#raw
1617
- */
1618
- "raw": (node: LavalinkNode, payload: unknown) => void;
975
+ * Move the player on a different Audio-Node
976
+ * @param newNode New Node / New Node Id
977
+ * @param checkSources If it should check if the sources are supported by the new node @default true
978
+ * @return The new Node Id
979
+ * @example
980
+ * ```ts
981
+ * const changeNode = await player.changeNode(newNode, true);
982
+ * ```
983
+ */
984
+ changeNode(newNode: LavalinkNode | string, checkSources?: boolean): Promise<string>;
1619
985
  /**
1620
- * Emits when the node connects resumed. You then need to create all players within this event for your usecase.
1621
- * 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
1622
- * @event Manager.nodeManager#nodeResumed
986
+ * 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.
987
+ * @param node the id of the node to move to
988
+ * @returns the player
989
+ * @throws RangeError if there is no available nodes.
990
+ * @throws Error if the node to move to is the same as the current node.
1623
991
  */
1624
- "resumed": (node: LavalinkNode, payload: {
1625
- resumed: true;
1626
- sessionId: string;
1627
- op: "ready";
1628
- }, players: LavalinkPlayer[] | InvalidLavalinkRestRequest) => void;
992
+ moveNode(node?: string): Promise<string | this>;
993
+ /** Converts the Player including Queue to a Json state */
994
+ toJSON(): PlayerJson;
1629
995
  }
1630
996
 
1631
997
  declare const TrackSymbol: unique symbol;
@@ -1711,464 +1077,1107 @@ declare class ManagerUtils {
1711
1077
  types: string[];
1712
1078
  source: any;
1713
1079
  };
1714
- validateSourceString(node: LavalinkNode, sourceString: SearchPlatform): void;
1080
+ validateSourceString(node: LavalinkNode, sourceString: SearchPlatform): void;
1081
+ }
1082
+ /**
1083
+ * Separate interface for the constructor so that emitted js does not have a constructor that overwrites itself
1084
+ *
1085
+ * @internal
1086
+ */
1087
+ interface MiniMap<K, V> extends Map<K, V> {
1088
+ constructor: MiniMapConstructor;
1089
+ }
1090
+ declare class MiniMap<K, V> extends Map<K, V> {
1091
+ constructor(data?: [K, V][]);
1092
+ /**
1093
+ * Identical to
1094
+ * [Array.filter()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter),
1095
+ * but returns a MiniMap instead of an Array.
1096
+ *
1097
+ * @param fn The function to test with (should return boolean)
1098
+ * @param thisArg Value to use as `this` when executing function
1099
+ *
1100
+ * @example
1101
+ * miniMap.filter(user => user.username === 'Bob');
1102
+ */
1103
+ filter<K2 extends K>(fn: (value: V, key: K, miniMap: this) => key is K2): MiniMap<K2, V>;
1104
+ filter<V2 extends V>(fn: (value: V, key: K, miniMap: this) => value is V2): MiniMap<K, V2>;
1105
+ filter(fn: (value: V, key: K, miniMap: this) => boolean): MiniMap<K, V>;
1106
+ filter<This, K2 extends K>(fn: (this: This, value: V, key: K, miniMap: this) => key is K2, thisArg: This): MiniMap<K2, V>;
1107
+ filter<This, V2 extends V>(fn: (this: This, value: V, key: K, miniMap: this) => value is V2, thisArg: This): MiniMap<K, V2>;
1108
+ filter<This>(fn: (this: This, value: V, key: K, miniMap: this) => boolean, thisArg: This): MiniMap<K, V>;
1109
+ toJSON(): [K, V][];
1110
+ /**
1111
+ * Maps each item to another value into an array. Identical in behavior to
1112
+ * [Array.map()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map).
1113
+ *
1114
+ * @param fn Function that produces an element of the new array, taking three arguments
1115
+ * @param thisArg Value to use as `this` when executing function
1116
+ *
1117
+ * @example
1118
+ * miniMap.map(user => user.tag);
1119
+ */
1120
+ map<T>(fn: (value: V, key: K, miniMap: this) => T): T[];
1121
+ map<This, T>(fn: (this: This, value: V, key: K, miniMap: this) => T, thisArg: This): T[];
1122
+ }
1123
+ declare function queueTrackEnd(player: Player, dontShiftQueue?: boolean): Promise<Track>;
1124
+ declare function safeStringify(obj: any, padding?: number): string;
1125
+
1126
+ /** Helper for generating Opaque types. */
1127
+ type Opaque<T, K> = T & {
1128
+ __opaque__: K;
1129
+ };
1130
+ /** Opqaue tyep for integernumber */
1131
+ type IntegerNumber = Opaque<number, 'Int'>;
1132
+ /** Opqaue tyep for floatnumber */
1133
+ type FloatNumber = Opaque<number, 'Float'>;
1134
+ type LavaSrcSearchPlatformBase = "spsearch" | "sprec" | "amsearch" | "dzsearch" | "dzisrc" | "dzrec" | "ymsearch" | "ymrec" | "vksearch" | "vkrec" | "tdsearch" | "tdrec" | "qbsearch" | "qbisrc" | "qbrec" | "pdsearch" | "pdisrc" | "pdrec";
1135
+ type LavaSrcSearchPlatform = LavaSrcSearchPlatformBase | "ftts";
1136
+ type JioSaavnSearchPlatform = "jssearch" | "jsrec";
1137
+ type DuncteSearchPlatform = "speak" | "phsearch" | "pornhub" | "porn" | "tts";
1138
+ type LavalinkClientSearchPlatform = "bcsearch";
1139
+ type LavalinkClientSearchPlatformResolve = "bandcamp" | "bc";
1140
+ type LavalinkSearchPlatform = "ytsearch" | "ytmsearch" | "scsearch" | "bcsearch" | LavaSrcSearchPlatform | DuncteSearchPlatform | JioSaavnSearchPlatform | LavalinkClientSearchPlatform;
1141
+ type ClientCustomSearchPlatformUtils = "local" | "http" | "https" | "link" | "uri";
1142
+ type ClientSearchPlatform = ClientCustomSearchPlatformUtils | // for file/link requests
1143
+ "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";
1144
+ type SearchPlatform = LavalinkSearchPlatform | ClientSearchPlatform;
1145
+ 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";
1146
+ interface PlaylistInfo {
1147
+ /** The playlist name */
1148
+ name: string;
1149
+ /** The playlist title (same as name) */
1150
+ title: string;
1151
+ /** The playlist Author */
1152
+ author?: string;
1153
+ /** The playlist Thumbnail */
1154
+ thumbnail?: string;
1155
+ /** A Uri to the playlist */
1156
+ uri?: string;
1157
+ /** The playlist selected track. */
1158
+ selectedTrack: Track | null;
1159
+ /** The duration of the entire playlist. (calcualted) */
1160
+ duration: number;
1161
+ }
1162
+ interface SearchResult {
1163
+ loadType: LoadTypes;
1164
+ exception: Exception | null;
1165
+ pluginInfo: PluginInfo;
1166
+ playlist: PlaylistInfo | null;
1167
+ tracks: Track[];
1168
+ }
1169
+ interface UnresolvedSearchResult {
1170
+ loadType: LoadTypes;
1171
+ exception: Exception | null;
1172
+ pluginInfo: PluginInfo;
1173
+ playlist: PlaylistInfo | null;
1174
+ tracks: UnresolvedTrack[];
1175
+ }
1176
+ /**
1177
+ * @internal
1178
+ */
1179
+ interface MiniMapConstructor {
1180
+ new (): MiniMap<unknown, unknown>;
1181
+ new <K, V>(entries?: ReadonlyArray<readonly [K, V]> | null): MiniMap<K, V>;
1182
+ new <K, V>(iterable: Iterable<readonly [K, V]>): MiniMap<K, V>;
1183
+ readonly prototype: MiniMap<unknown, unknown>;
1184
+ readonly [Symbol.species]: MiniMapConstructor;
1185
+ }
1186
+ type PlayerEvents = TrackStartEvent | TrackEndEvent | TrackStuckEvent | TrackExceptionEvent | WebSocketClosedEvent | SponsorBlockSegmentEvents | LyricsEvent;
1187
+ type Severity = "COMMON" | "SUSPICIOUS" | "FAULT";
1188
+ interface Exception {
1189
+ /** Severity of the error */
1190
+ severity: Severity;
1191
+ /** Nodejs Error */
1192
+ error?: Error;
1193
+ /** Message by lavalink */
1194
+ message: string;
1195
+ /** Cause by lavalink */
1196
+ cause: string;
1197
+ /** causeStackTrace by lavalink */
1198
+ causeStackTrace: string;
1199
+ }
1200
+ interface PlayerEvent {
1201
+ op: "event";
1202
+ type: PlayerEventType;
1203
+ guildId: string;
1204
+ }
1205
+ interface TrackStartEvent extends PlayerEvent {
1206
+ type: "TrackStartEvent";
1207
+ track: LavalinkTrack;
1208
+ }
1209
+ interface TrackEndEvent extends PlayerEvent {
1210
+ type: "TrackEndEvent";
1211
+ track: LavalinkTrack;
1212
+ reason: TrackEndReason;
1213
+ }
1214
+ interface TrackExceptionEvent extends PlayerEvent {
1215
+ type: "TrackExceptionEvent";
1216
+ exception?: Exception;
1217
+ track: LavalinkTrack;
1218
+ error: string;
1219
+ }
1220
+ interface TrackStuckEvent extends PlayerEvent {
1221
+ type: "TrackStuckEvent";
1222
+ thresholdMs: number;
1223
+ track: LavalinkTrack;
1224
+ }
1225
+ interface WebSocketClosedEvent extends PlayerEvent {
1226
+ type: "WebSocketClosedEvent";
1227
+ code: number;
1228
+ byRemote: boolean;
1229
+ reason: string;
1230
+ }
1231
+ /**
1232
+ * Types & Events for Sponsorblock-plugin from Lavalink: https://github.com/topi314/Sponsorblock-Plugin#segmentsloaded
1233
+ */
1234
+ type SponsorBlockSegmentEvents = SponsorBlockSegmentSkipped | SponsorBlockSegmentsLoaded | SponsorBlockChapterStarted | SponsorBlockChaptersLoaded;
1235
+ type SponsorBlockSegmentEventType = "SegmentSkipped" | "SegmentsLoaded" | "ChaptersLoaded" | "ChapterStarted";
1236
+ interface SponsorBlockSegmentsLoaded extends PlayerEvent {
1237
+ type: "SegmentsLoaded";
1238
+ segments: {
1239
+ category: string;
1240
+ start: number;
1241
+ end: number;
1242
+ }[];
1243
+ }
1244
+ interface SponsorBlockSegmentSkipped extends PlayerEvent {
1245
+ type: "SegmentSkipped";
1246
+ segment: {
1247
+ category: string;
1248
+ start: number;
1249
+ end: number;
1250
+ };
1251
+ }
1252
+ interface SponsorBlockChapterStarted extends PlayerEvent {
1253
+ type: "ChapterStarted";
1254
+ /** The Chapter which started */
1255
+ chapter: {
1256
+ /** The Name of the Chapter */
1257
+ name: string;
1258
+ start: number;
1259
+ end: number;
1260
+ duration: number;
1261
+ };
1262
+ }
1263
+ interface SponsorBlockChaptersLoaded extends PlayerEvent {
1264
+ type: "ChaptersLoaded";
1265
+ /** All Chapters loaded */
1266
+ chapters: {
1267
+ /** The Name of the Chapter */
1268
+ name: string;
1269
+ start: number;
1270
+ end: number;
1271
+ duration: number;
1272
+ }[];
1715
1273
  }
1716
1274
  /**
1717
- * Separate interface for the constructor so that emitted js does not have a constructor that overwrites itself
1718
- *
1719
- * @internal
1275
+ * Types & Events for Lyrics plugin from Lavalink: https://github.com/topi314/LavaLyrics
1720
1276
  */
1721
- interface MiniMap<K, V> extends Map<K, V> {
1722
- constructor: MiniMapConstructor;
1277
+ type LyricsEvent = LyricsFoundEvent | LyricsNotFoundEvent | LyricsLineEvent;
1278
+ type LyricsEventType = "LyricsFoundEvent" | "LyricsNotFoundEvent" | "LyricsLineEvent";
1279
+ interface LyricsFoundEvent extends PlayerEvent {
1280
+ /** The lyricsfound event */
1281
+ type: "LyricsFoundEvent";
1282
+ /** The guildId */
1283
+ guildId: string;
1284
+ /** The lyrics */
1285
+ lyrics: LyricsResult;
1723
1286
  }
1724
- declare class MiniMap<K, V> extends Map<K, V> {
1725
- constructor(data?: [K, V][]);
1726
- /**
1727
- * Identical to
1728
- * [Array.filter()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter),
1729
- * but returns a MiniMap instead of an Array.
1730
- *
1731
- * @param fn The function to test with (should return boolean)
1732
- * @param thisArg Value to use as `this` when executing function
1733
- *
1734
- * @example
1735
- * miniMap.filter(user => user.username === 'Bob');
1736
- */
1737
- filter<K2 extends K>(fn: (value: V, key: K, miniMap: this) => key is K2): MiniMap<K2, V>;
1738
- filter<V2 extends V>(fn: (value: V, key: K, miniMap: this) => value is V2): MiniMap<K, V2>;
1739
- filter(fn: (value: V, key: K, miniMap: this) => boolean): MiniMap<K, V>;
1740
- filter<This, K2 extends K>(fn: (this: This, value: V, key: K, miniMap: this) => key is K2, thisArg: This): MiniMap<K2, V>;
1741
- filter<This, V2 extends V>(fn: (this: This, value: V, key: K, miniMap: this) => value is V2, thisArg: This): MiniMap<K, V2>;
1742
- filter<This>(fn: (this: This, value: V, key: K, miniMap: this) => boolean, thisArg: This): MiniMap<K, V>;
1743
- toJSON(): [K, V][];
1744
- /**
1745
- * Maps each item to another value into an array. Identical in behavior to
1746
- * [Array.map()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map).
1747
- *
1748
- * @param fn Function that produces an element of the new array, taking three arguments
1749
- * @param thisArg Value to use as `this` when executing function
1750
- *
1751
- * @example
1752
- * miniMap.map(user => user.tag);
1753
- */
1754
- map<T>(fn: (value: V, key: K, miniMap: this) => T): T[];
1755
- map<This, T>(fn: (this: This, value: V, key: K, miniMap: this) => T, thisArg: This): T[];
1287
+ interface LyricsNotFoundEvent extends PlayerEvent {
1288
+ /**The lyricsnotfound event*/
1289
+ type: "LyricsNotFoundEvent";
1290
+ /**The guildId*/
1291
+ guildId: string;
1292
+ }
1293
+ interface LyricsLineEvent extends PlayerEvent {
1294
+ /**The lyricsline event*/
1295
+ type: "LyricsLineEvent";
1296
+ /** The guildId */
1297
+ guildId: string;
1298
+ /** The line number */
1299
+ lineIndex: number;
1300
+ /** The line */
1301
+ line: LyricsLine;
1302
+ /**skipped is true if the line was skipped */
1303
+ skipped: boolean;
1304
+ }
1305
+ type LoadTypes = "track" | "playlist" | "search" | "error" | "empty";
1306
+ type State = "CONNECTED" | "CONNECTING" | "DISCONNECTED" | "DISCONNECTING" | "DESTROYING";
1307
+ type PlayerEventType = "TrackStartEvent" | "TrackEndEvent" | "TrackExceptionEvent" | "TrackStuckEvent" | "WebSocketClosedEvent" | SponsorBlockSegmentEventType | LyricsEventType;
1308
+ type TrackEndReason = "finished" | "loadFailed" | "stopped" | "replaced" | "cleanup";
1309
+ interface InvalidLavalinkRestRequest {
1310
+ /** Rest Request Data for when it was made */
1311
+ timestamp: number;
1312
+ /** Status of the request */
1313
+ status: number;
1314
+ /** Specific Errro which was sent */
1315
+ error: string;
1316
+ /** Specific Message which was created */
1317
+ message?: string;
1318
+ /** The specific error trace from the request */
1319
+ trace?: unknown;
1320
+ /** Path of where it's from */
1321
+ path: string;
1322
+ }
1323
+ interface LavalinkPlayerVoice {
1324
+ /** The Voice Token */
1325
+ token: string;
1326
+ /** The Voice Server Endpoint */
1327
+ endpoint: string;
1328
+ /** The Voice SessionId */
1329
+ sessionId: string;
1330
+ /** Wether or not the player is connected */
1331
+ connected?: boolean;
1332
+ /** The Ping to the voice server */
1333
+ ping?: number;
1334
+ }
1335
+ type LavalinkPlayerVoiceOptions = Omit<LavalinkPlayerVoice, 'connected' | 'ping'>;
1336
+ interface FailingAddress {
1337
+ /** The failing address */
1338
+ failingAddress: string;
1339
+ /** The timestamp when the address failed */
1340
+ failingTimestamp: number;
1341
+ /** The timestamp when the address failed as a pretty string */
1342
+ failingTime: string;
1343
+ }
1344
+ type RoutePlannerTypes = "RotatingIpRoutePlanner" | "NanoIpRoutePlanner" | "RotatingNanoIpRoutePlanner" | "BalancingIpRoutePlanner";
1345
+ interface RoutePlanner {
1346
+ class?: RoutePlannerTypes;
1347
+ details?: {
1348
+ /** The ip block being used */
1349
+ ipBlock: {
1350
+ /** The type of the ip block */
1351
+ type: "Inet4Address" | "Inet6Address";
1352
+ /** The size of the ip block */
1353
+ size: string;
1354
+ };
1355
+ /** The failing addresses */
1356
+ failingAddresses: FailingAddress[];
1357
+ /** The number of rotations */
1358
+ rotateIndex?: string;
1359
+ /** The current offset in the block */
1360
+ ipIndex?: string;
1361
+ /** The current address being used */
1362
+ currentAddress?: string;
1363
+ /** The current offset in the ip block */
1364
+ currentAddressIndex?: string;
1365
+ /** The information in which /64 block ips are chosen. This number increases on each ban. */
1366
+ blockIndex?: string;
1367
+ };
1368
+ }
1369
+ interface Session {
1370
+ /** Wether or not session is resuming or not */
1371
+ resuming: boolean;
1372
+ /** For how long a session is lasting while not connected */
1373
+ timeout: number;
1374
+ }
1375
+ interface GuildShardPayload {
1376
+ /** The OP code */
1377
+ op: number;
1378
+ /** Data to send */
1379
+ d: {
1380
+ /** Guild id to apply voice settings */
1381
+ guild_id: string;
1382
+ /** channel to move/connect to, or null to leave it */
1383
+ channel_id: string | null;
1384
+ /** wether or not mute yourself */
1385
+ self_mute: boolean;
1386
+ /** wether or not deafen yourself */
1387
+ self_deaf: boolean;
1388
+ };
1389
+ }
1390
+ interface PlayerUpdateInfo {
1391
+ /** guild id of the player */
1392
+ guildId: string;
1393
+ /** Player options to provide to lavalink */
1394
+ playerOptions: LavalinkPlayOptions;
1395
+ /** Whether or not replace the current track with the new one (true is recommended) */
1396
+ noReplace?: boolean;
1397
+ }
1398
+ interface LavalinkPlayer {
1399
+ /** Guild Id of the player */
1400
+ guildId: string;
1401
+ /** IF playing a track, all of the track information */
1402
+ track?: LavalinkTrack;
1403
+ /** Lavalink volume (mind volumedecrementer) */
1404
+ volume: number;
1405
+ /** Wether it's paused or not */
1406
+ paused: boolean;
1407
+ /** Voice Endpoint data */
1408
+ voice: LavalinkPlayerVoice;
1409
+ /** All Audio Filters */
1410
+ filters: Partial<LavalinkFilterData>;
1411
+ /** Lavalink-Voice-State Variables */
1412
+ state: {
1413
+ /** Time since connection established */
1414
+ time: number;
1415
+ /** Position of the track */
1416
+ position: number;
1417
+ /** COnnected or not */
1418
+ connected: boolean;
1419
+ /** Ping to voice server */
1420
+ ping: number;
1421
+ };
1422
+ }
1423
+ interface ChannelDeletePacket {
1424
+ /** Packet key for channel delete */
1425
+ t: "CHANNEL_DELETE";
1426
+ /** data which is sent and relevant */
1427
+ d: {
1428
+ /** guild id */
1429
+ guild_id: string;
1430
+ /** Channel id */
1431
+ id: string;
1432
+ };
1433
+ }
1434
+ interface VoiceState {
1435
+ /** OP key from lavalink */
1436
+ op: "voiceUpdate";
1437
+ /** GuildId provided by lavalink */
1438
+ guildId: string;
1439
+ /** Event data */
1440
+ event: VoiceServer;
1441
+ /** Session Id of the voice connection */
1442
+ sessionId?: string;
1443
+ /** guild id of the voice channel */
1444
+ guild_id: string;
1445
+ /** user id from the voice connection */
1446
+ user_id: string;
1447
+ /** Session Id of the voice connection */
1448
+ session_id: string;
1449
+ /** Voice Channel Id */
1450
+ channel_id: string;
1451
+ /** Server Mute status */
1452
+ mute: boolean;
1453
+ /** Server Deaf status */
1454
+ deaf: boolean;
1455
+ /** Self Deaf status */
1456
+ self_deaf: boolean;
1457
+ /** Self Mute status */
1458
+ self_mute: boolean;
1459
+ /** Self Video (Camera) status */
1460
+ self_video: boolean;
1461
+ /** Self Stream status */
1462
+ self_stream: boolean;
1463
+ /** Wether the user requests to speak (stage channel) */
1464
+ request_to_speak_timestamp: boolean;
1465
+ /** Self suppressed status (stage channel) */
1466
+ suppress: boolean;
1467
+ }
1468
+ /** The Base64 decodes tring by lavalink */
1469
+ type Base64 = string;
1470
+ interface VoiceServer {
1471
+ /** Voice Token */
1472
+ token: string;
1473
+ /** Guild Id of the voice server connection */
1474
+ guild_id: string;
1475
+ /** Server Endpoint */
1476
+ endpoint: string;
1477
+ }
1478
+ interface VoicePacket {
1479
+ /** Voice Packet Keys to send */
1480
+ t?: "VOICE_SERVER_UPDATE" | "VOICE_STATE_UPDATE";
1481
+ /** Voice Packets to send */
1482
+ d: VoiceState | VoiceServer;
1756
1483
  }
1757
- declare function queueTrackEnd(player: Player, dontShiftQueue?: boolean): Promise<Track>;
1758
- declare function safeStringify(obj: any, padding?: number): string;
1759
-
1760
- /** Helper for generating Opaque types. */
1761
- type Opaque<T, K> = T & {
1762
- __opaque__: K;
1763
- };
1764
- /** Opqaue tyep for integernumber */
1765
- type IntegerNumber = Opaque<number, 'Int'>;
1766
- /** Opqaue tyep for floatnumber */
1767
- type FloatNumber = Opaque<number, 'Float'>;
1768
- type LavaSrcSearchPlatformBase = "spsearch" | "sprec" | "amsearch" | "dzsearch" | "dzisrc" | "dzrec" | "ymsearch" | "ymrec" | "vksearch" | "vkrec" | "tdsearch" | "tdrec" | "qbsearch" | "qbisrc" | "qbrec" | "pdsearch" | "pdisrc" | "pdrec";
1769
- type LavaSrcSearchPlatform = LavaSrcSearchPlatformBase | "ftts";
1770
- type JioSaavnSearchPlatform = "jssearch" | "jsrec";
1771
- type DuncteSearchPlatform = "speak" | "phsearch" | "pornhub" | "porn" | "tts";
1772
- type LavalinkClientSearchPlatform = "bcsearch";
1773
- type LavalinkClientSearchPlatformResolve = "bandcamp" | "bc";
1774
- type LavalinkSearchPlatform = "ytsearch" | "ytmsearch" | "scsearch" | "bcsearch" | LavaSrcSearchPlatform | DuncteSearchPlatform | JioSaavnSearchPlatform | LavalinkClientSearchPlatform;
1775
- type ClientCustomSearchPlatformUtils = "local" | "http" | "https" | "link" | "uri";
1776
- type ClientSearchPlatform = ClientCustomSearchPlatformUtils | // for file/link requests
1777
- "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";
1778
- type SearchPlatform = LavalinkSearchPlatform | ClientSearchPlatform;
1779
- 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";
1780
- interface PlaylistInfo {
1781
- /** The playlist name */
1782
- name: string;
1783
- /** The playlist title (same as name) */
1784
- title: string;
1785
- /** The playlist Author */
1786
- author?: string;
1787
- /** The playlist Thumbnail */
1788
- thumbnail?: string;
1789
- /** A Uri to the playlist */
1790
- uri?: string;
1791
- /** The playlist selected track. */
1792
- selectedTrack: Track | null;
1793
- /** The duration of the entire playlist. (calcualted) */
1794
- duration: number;
1484
+ interface NodeMessage extends NodeStats {
1485
+ /** The type of the event */
1486
+ type: PlayerEventType;
1487
+ /** what ops are applying to that event */
1488
+ op: "stats" | "playerUpdate" | "event";
1489
+ /** The specific guild id for that message */
1490
+ guildId: string;
1795
1491
  }
1796
- interface SearchResult {
1797
- loadType: LoadTypes;
1798
- exception: Exception | null;
1492
+ /** Specific types to filter for lavasearch, will be filtered to correct types */
1493
+ type LavaSearchType = "track" | "album" | "artist" | "playlist" | "text" | "tracks" | "albums" | "artists" | "playlists" | "texts";
1494
+ interface LavaSearchFilteredResponse {
1495
+ /** The Information of a playlist provided by lavasearch */
1496
+ info: PlaylistInfo;
1497
+ /** additional plugin information */
1799
1498
  pluginInfo: PluginInfo;
1800
- playlist: PlaylistInfo | null;
1499
+ /** List of tracks */
1801
1500
  tracks: Track[];
1802
1501
  }
1803
- interface UnresolvedSearchResult {
1804
- loadType: LoadTypes;
1805
- exception: Exception | null;
1502
+ interface LavaSearchResponse {
1503
+ /** An array of tracks, only present if track is in types */
1504
+ tracks: Track[];
1505
+ /** An array of albums, only present if album is in types */
1506
+ albums: LavaSearchFilteredResponse[];
1507
+ /** An array of artists, only present if artist is in types */
1508
+ artists: LavaSearchFilteredResponse[];
1509
+ /** An array of playlists, only present if playlist is in types */
1510
+ playlists: LavaSearchFilteredResponse[];
1511
+ /** An array of text results, only present if text is in types */
1512
+ texts: {
1513
+ text: string;
1514
+ pluginInfo: PluginInfo;
1515
+ }[];
1516
+ /** Addition result data provided by plugins */
1806
1517
  pluginInfo: PluginInfo;
1807
- playlist: PlaylistInfo | null;
1808
- tracks: UnresolvedTrack[];
1518
+ }
1519
+ /** SearchQuery Object for raw lavalink requests */
1520
+ type SearchQuery = {
1521
+ /** lavalink search Query / identifier string */
1522
+ query: string;
1523
+ /** Extra url query params to use, e.g. for flowertts */
1524
+ extraQueryUrlParams?: URLSearchParams;
1525
+ /** Source to append to the search query string */
1526
+ source?: SearchPlatform;
1527
+ } | /** Our just the search query / identifier string */ string;
1528
+ /** SearchQuery Object for Lavalink LavaSearch Plugin requests */
1529
+ type LavaSearchQuery = {
1530
+ /** lavalink search Query / identifier string */
1531
+ query: string;
1532
+ /** Source to append to the search query string */
1533
+ source: LavaSrcSearchPlatformBase;
1534
+ /** The Types to filter the search to */
1535
+ types?: LavaSearchType[];
1536
+ };
1537
+ type Awaitable<T> = Promise<T> | T;
1538
+
1539
+ /** The Audio Outputs type */
1540
+ type AudioOutputs = "mono" | "stereo" | "left" | "right";
1541
+ /** The "active" / "disabled" Player Filters */
1542
+ interface PlayerFilters {
1543
+ /** Sets nightcore to false, and vaporwave to false */
1544
+ custom: boolean;
1545
+ /** Sets custom to false, and vaporwave to false */
1546
+ nightcore: boolean;
1547
+ /** Sets custom to false, and nightcore to false */
1548
+ vaporwave: boolean;
1549
+ /** If rotation filter is enabled / not */
1550
+ rotation: boolean;
1551
+ /** if karaoke filter is enabled / not */
1552
+ karaoke: boolean;
1553
+ /** if tremolo filter is enabled / not */
1554
+ tremolo: boolean;
1555
+ /** if vibrato filter is enabled / not */
1556
+ vibrato: boolean;
1557
+ lowPass: boolean;
1558
+ /** audio Output (default stereo, mono sounds the fullest and best for not-stereo tracks) */
1559
+ audioOutput: AudioOutputs;
1560
+ /** Lavalink Volume FILTER (not player Volume, think of it as a gain booster) */
1561
+ volume: boolean;
1562
+ /** Filters for the Lavalink Filter Plugin */
1563
+ lavalinkFilterPlugin: {
1564
+ /** if echo filter is enabled / not */
1565
+ echo: boolean;
1566
+ /** if reverb filter is enabled / not */
1567
+ reverb: boolean;
1568
+ };
1569
+ lavalinkLavaDspxPlugin: {
1570
+ /** if lowPass filter is enabled / not */
1571
+ lowPass: boolean;
1572
+ /** if highPass filter is enabled / not */
1573
+ highPass: boolean;
1574
+ /** if normalization filter is enabled / not */
1575
+ normalization: boolean;
1576
+ /** if echo filter is enabled / not */
1577
+ echo: boolean;
1578
+ };
1809
1579
  }
1810
1580
  /**
1811
- * @internal
1581
+ * There are 15 bands (0-14) that can be changed.
1582
+ * "gain" is the multiplier for the given band.
1583
+ * The default value is 0.
1584
+ * Valid values range from -0.25 to 1.0, where -0.25 means the given band is completely muted, and 0.25 means it is doubled.
1585
+ * Modifying the gain could also change the volume of the output.
1812
1586
  */
1813
- interface MiniMapConstructor {
1814
- new (): MiniMap<unknown, unknown>;
1815
- new <K, V>(entries?: ReadonlyArray<readonly [K, V]> | null): MiniMap<K, V>;
1816
- new <K, V>(iterable: Iterable<readonly [K, V]>): MiniMap<K, V>;
1817
- readonly prototype: MiniMap<unknown, unknown>;
1818
- readonly [Symbol.species]: MiniMapConstructor;
1819
- }
1820
- type PlayerEvents = TrackStartEvent | TrackEndEvent | TrackStuckEvent | TrackExceptionEvent | WebSocketClosedEvent | SponsorBlockSegmentEvents | LyricsEvent;
1821
- type Severity = "COMMON" | "SUSPICIOUS" | "FAULT";
1822
- interface Exception {
1823
- /** Severity of the error */
1824
- severity: Severity;
1825
- /** Nodejs Error */
1826
- error?: Error;
1827
- /** Message by lavalink */
1828
- message: string;
1829
- /** Cause by lavalink */
1830
- cause: string;
1831
- /** causeStackTrace by lavalink */
1832
- causeStackTrace: string;
1587
+ interface EQBand {
1588
+ /** On what band position (0-14) it should work */
1589
+ band: IntegerNumber | number;
1590
+ /** The gain (-0.25 to 1.0) */
1591
+ gain: FloatNumber | number;
1833
1592
  }
1834
- interface PlayerEvent {
1835
- op: "event";
1836
- type: PlayerEventType;
1837
- guildId: string;
1593
+ /**
1594
+ * Uses equalization to eliminate part of a band, usually targeting vocals.
1595
+ */
1596
+ interface KaraokeFilter {
1597
+ /** The level (0 to 1.0 where 0.0 is no effect and 1.0 is full effect) */
1598
+ level?: number;
1599
+ /** The mono level (0 to 1.0 where 0.0 is no effect and 1.0 is full effect) */
1600
+ monoLevel?: number;
1601
+ /** The filter band (in Hz) */
1602
+ filterBand?: number;
1603
+ /** The filter width */
1604
+ filterWidth?: number;
1838
1605
  }
1839
- interface TrackStartEvent extends PlayerEvent {
1840
- type: "TrackStartEvent";
1841
- track: LavalinkTrack;
1606
+ /**
1607
+ * Changes the speed, pitch, and rate
1608
+ */
1609
+ interface TimescaleFilter {
1610
+ /** The playback speed 0.0 ≤ x */
1611
+ speed?: number;
1612
+ /** The pitch 0.0 ≤ x */
1613
+ pitch?: number;
1614
+ /** The rate 0.0 ≤ x */
1615
+ rate?: number;
1842
1616
  }
1843
- interface TrackEndEvent extends PlayerEvent {
1844
- type: "TrackEndEvent";
1845
- track: LavalinkTrack;
1846
- reason: TrackEndReason;
1617
+ /**
1618
+ * Uses amplification to create a shuddering effect, where the volume quickly oscillates.
1619
+ * Demo: https://en.wikipedia.org/wiki/File:Fuse_Electronics_Tremolo_MK-III_Quick_Demo.ogv
1620
+ */
1621
+ interface TremoloFilter {
1622
+ /** The frequency 0.0 < x */
1623
+ frequency?: number;
1624
+ /** The tremolo depth 0.0 < x ≤ 1.0 */
1625
+ depth?: number;
1847
1626
  }
1848
- interface TrackExceptionEvent extends PlayerEvent {
1849
- type: "TrackExceptionEvent";
1850
- exception?: Exception;
1851
- track: LavalinkTrack;
1852
- error: string;
1627
+ /**
1628
+ * Similar to tremolo. While tremolo oscillates the volume, vibrato oscillates the pitch.
1629
+ */
1630
+ interface VibratoFilter {
1631
+ /** The frequency 0.0 < x ≤ 14.0 */
1632
+ frequency?: number;
1633
+ /** The vibrato depth 0.0 < x ≤ 1.0 */
1634
+ depth?: number;
1853
1635
  }
1854
- interface TrackStuckEvent extends PlayerEvent {
1855
- type: "TrackStuckEvent";
1856
- thresholdMs: number;
1857
- track: LavalinkTrack;
1636
+ /**
1637
+ * Rotates the sound around the stereo channels/user headphones (aka Audio Panning).
1638
+ * It can produce an effect similar to https://youtu.be/QB9EB8mTKcc (without the reverb).
1639
+ */
1640
+ interface RotationFilter {
1641
+ /** The frequency of the audio rotating around the listener in Hz. 0.2 is similar to the example video above */
1642
+ rotationHz?: number;
1858
1643
  }
1859
- interface WebSocketClosedEvent extends PlayerEvent {
1860
- type: "WebSocketClosedEvent";
1861
- code: number;
1862
- byRemote: boolean;
1863
- reason: string;
1644
+ /**
1645
+ * Distortion effect. It can generate some pretty unique audio effects.
1646
+ */
1647
+ interface DistortionFilter {
1648
+ sinOffset?: number;
1649
+ sinScale?: number;
1650
+ cosOffset?: number;
1651
+ cosScale?: number;
1652
+ tanOffset?: number;
1653
+ tanScale?: number;
1654
+ offset?: number;
1655
+ scale?: number;
1864
1656
  }
1865
1657
  /**
1866
- * Types & Events for Sponsorblock-plugin from Lavalink: https://github.com/topi314/Sponsorblock-Plugin#segmentsloaded
1658
+ * Mixes both channels (left and right), with a configurable factor on how much each channel affects the other.
1659
+ * With the defaults, both channels are kept independent of each other.
1660
+ * Setting all factors to 0.5 means both channels get the same audio.
1867
1661
  */
1868
- type SponsorBlockSegmentEvents = SponsorBlockSegmentSkipped | SponsorBlockSegmentsLoaded | SponsorBlockChapterStarted | SponsorBlockChaptersLoaded;
1869
- type SponsorBlockSegmentEventType = "SegmentSkipped" | "SegmentsLoaded" | "ChaptersLoaded" | "ChapterStarted";
1870
- interface SponsorBlockSegmentsLoaded extends PlayerEvent {
1871
- type: "SegmentsLoaded";
1872
- segments: {
1873
- category: string;
1874
- start: number;
1875
- end: number;
1876
- }[];
1662
+ interface ChannelMixFilter {
1663
+ /** The left to left channel mix factor (0.0 ≤ x ≤ 1.0) */
1664
+ leftToLeft?: number;
1665
+ /** The left to right channel mix factor (0.0 ≤ x ≤ 1.0) */
1666
+ leftToRight?: number;
1667
+ /** The right to left channel mix factor (0.0 ≤ x ≤ 1.0) */
1668
+ rightToLeft?: number;
1669
+ /** The right to right channel mix factor (0.0 ≤ x ≤ 1.0) */
1670
+ rightToRight?: number;
1877
1671
  }
1878
- interface SponsorBlockSegmentSkipped extends PlayerEvent {
1879
- type: "SegmentSkipped";
1880
- segment: {
1881
- category: string;
1882
- start: number;
1883
- end: number;
1884
- };
1672
+ /**
1673
+ * Higher frequencies get suppressed, while lower frequencies pass through this filter, thus the name low pass.
1674
+ * Any smoothing values equal to or less than 1.0 will disable the filter.
1675
+ */
1676
+ interface LowPassFilter {
1677
+ /** The smoothing factor (1.0 < x) */
1678
+ smoothing?: number;
1885
1679
  }
1886
- interface SponsorBlockChapterStarted extends PlayerEvent {
1887
- type: "ChapterStarted";
1888
- /** The Chapter which started */
1889
- chapter: {
1890
- /** The Name of the Chapter */
1891
- name: string;
1892
- start: number;
1893
- end: number;
1894
- duration: number;
1680
+ /**
1681
+ * Filter Data stored in the Client and partially sent to Lavalink
1682
+ */
1683
+ interface FilterData {
1684
+ volume?: number;
1685
+ karaoke?: KaraokeFilter;
1686
+ timescale?: TimescaleFilter;
1687
+ tremolo?: TremoloFilter;
1688
+ vibrato?: VibratoFilter;
1689
+ rotation?: RotationFilter;
1690
+ distortion?: DistortionFilter;
1691
+ channelMix?: ChannelMixFilter;
1692
+ lowPass?: LowPassFilter;
1693
+ pluginFilters?: {
1694
+ "lavalink-filter-plugin"?: {
1695
+ "echo"?: {
1696
+ delay?: number;
1697
+ decay?: number;
1698
+ };
1699
+ "reverb"?: {
1700
+ delays?: number[];
1701
+ gains?: number[];
1702
+ };
1703
+ };
1704
+ "high-pass"?: {
1705
+ cutoffFrequency?: number;
1706
+ boostFactor?: number;
1707
+ };
1708
+ "low-pass"?: {
1709
+ cutoffFrequency?: number;
1710
+ boostFactor?: number;
1711
+ };
1712
+ normalization?: {
1713
+ maxAmplitude?: number;
1714
+ adaptive?: boolean;
1715
+ };
1716
+ echo?: {
1717
+ echoLength?: number;
1718
+ decay?: number;
1719
+ };
1895
1720
  };
1896
1721
  }
1897
- interface SponsorBlockChaptersLoaded extends PlayerEvent {
1898
- type: "ChaptersLoaded";
1899
- /** All Chapters loaded */
1900
- chapters: {
1901
- /** The Name of the Chapter */
1902
- name: string;
1903
- start: number;
1904
- end: number;
1905
- duration: number;
1906
- }[];
1722
+ /**
1723
+ * Actual Filter Data sent to Lavalink
1724
+ */
1725
+ interface LavalinkFilterData extends FilterData {
1726
+ equalizer?: EQBand[];
1907
1727
  }
1728
+
1908
1729
  /**
1909
- * Types & Events for Lyrics plugin from Lavalink: https://github.com/topi314/LavaLyrics
1730
+ * Debug events for more detailed logging
1910
1731
  */
1911
- type LyricsEvent = LyricsFoundEvent | LyricsNotFoundEvent | LyricsLineEvent;
1912
- type LyricsEventType = "LyricsFoundEvent" | "LyricsNotFoundEvent" | "LyricsLineEvent";
1913
- interface LyricsFoundEvent extends PlayerEvent {
1914
- /** The lyricsfound event */
1915
- type: "LyricsFoundEvent";
1916
- /** The guildId */
1917
- guildId: string;
1918
- /** The lyrics */
1919
- lyrics: LyricsResult;
1732
+ declare enum DebugEvents {
1733
+ SetSponsorBlock = "SetSponsorBlock",
1734
+ DeleteSponsorBlock = "DeleteSponsorBlock",
1735
+ TrackEndReplaced = "TrackEndReplaced",
1736
+ AutoplayExecution = "AutoplayExecution",
1737
+ AutoplayNoSongsAdded = "AutoplayNoSongsAdded",
1738
+ AutoplayThresholdSpamLimiter = "AutoplayThresholdSpamLimiter",
1739
+ TriggerQueueEmptyInterval = "TriggerQueueEmptyInterval",
1740
+ QueueEnded = "QueueEnded",
1741
+ TrackStartNewSongsOnly = "TrackStartNewSongsOnly",
1742
+ TrackStartNoTrack = "TrackStartNoTrack",
1743
+ ResumingFetchingError = "ResumingFetchingError",
1744
+ PlayerUpdateNoPlayer = "PlayerUpdateNoPlayer",
1745
+ PlayerUpdateFilterFixApply = "PlayerUpdateFilterFixApply",
1746
+ PlayerUpdateSuccess = "PlayerUpdateSuccess",
1747
+ HeartBeatTriggered = "HeartBeatTriggered",
1748
+ NoSocketOnDestroy = "NoSocketOnDestroy",
1749
+ SocketCleanupError = "SocketCleanupError",
1750
+ SocketTerminateHeartBeatTimeout = "SocketTerminateHeartBeatTimeout",
1751
+ TryingConnectWhileConnected = "TryingConnectWhileConnected",
1752
+ LavaSearchNothingFound = "LavaSearchNothingFound",
1753
+ SearchNothingFound = "SearchNothingFound",
1754
+ ValidatingBlacklistLinks = "ValidatingBlacklistLinks",
1755
+ ValidatingWhitelistLinks = "ValidatingWhitelistLinks",
1756
+ TrackErrorMaxTracksErroredPerTime = "TrackErrorMaxTracksErroredPerTime",
1757
+ TrackStuckMaxTracksErroredPerTime = "TrackStuckMaxTracksErroredPerTime",
1758
+ PlayerDestroyingSomewhereElse = "PlayerDestroyingSomewhereElse",
1759
+ PlayerCreateNodeNotFound = "PlayerCreateNodeNotFound",
1760
+ PlayerPlayQueueEmptyTimeoutClear = "PlayerPlayQueueEmptyTimeoutClear",
1761
+ PlayerPlayWithTrackReplace = "PlayerPlayWithTrackReplace",
1762
+ PlayerPlayUnresolvedTrack = "PlayerPlayUnresolvedTrack",
1763
+ PlayerPlayUnresolvedTrackFailed = "PlayerPlayUnresolvedTrackFailed",
1764
+ PlayerVolumeAsFilter = "PlayerVolumeAsFilter",
1765
+ BandcampSearchLokalEngine = "BandcampSearchLokalEngine",
1766
+ PlayerChangeNode = "PlayerChangeNode",
1767
+ BuildTrackError = "BuildTrackError",
1768
+ TransformRequesterFunctionFailed = "TransformRequesterFunctionFailed",
1769
+ GetClosestTrackFailed = "GetClosestTrackFailed",
1770
+ PlayerDeleteInsteadOfDestroy = "PlayerDeleteInsteadOfDestroy",
1771
+ FailedToConnectToNodes = "FailedToConnectToNodes",
1772
+ NoAudioDebug = "NoAudioDebug",
1773
+ PlayerAutoReconnect = "PlayerAutoReconnect"
1920
1774
  }
1921
- interface LyricsNotFoundEvent extends PlayerEvent {
1922
- /**The lyricsnotfound event*/
1923
- type: "LyricsNotFoundEvent";
1924
- /**The guildId*/
1775
+ /**
1776
+ * Reasons why a player got destroyed
1777
+ */
1778
+ declare enum DestroyReasons {
1779
+ QueueEmpty = "QueueEmpty",
1780
+ NodeDestroy = "NodeDestroy",
1781
+ NodeDeleted = "NodeDeleted",
1782
+ LavalinkNoVoice = "LavalinkNoVoice",
1783
+ NodeReconnectFail = "NodeReconnectFail",
1784
+ Disconnected = "Disconnected",
1785
+ PlayerReconnectFail = "PlayerReconnectFail",
1786
+ PlayerChangeNodeFail = "PlayerChangeNodeFail",
1787
+ PlayerChangeNodeFailNoEligibleNode = "PlayerChangeNodeFailNoEligibleNode",
1788
+ ChannelDeleted = "ChannelDeleted",
1789
+ DisconnectAllNodes = "DisconnectAllNodes",
1790
+ ReconnectAllNodes = "ReconnectAllNodes",
1791
+ TrackErrorMaxTracksErroredPerTime = "TrackErrorMaxTracksErroredPerTime",
1792
+ TrackStuckMaxTracksErroredPerTime = "TrackStuckMaxTracksErroredPerTime"
1793
+ }
1794
+ /**
1795
+ * Reasons why a player got disconnected
1796
+ */
1797
+ declare enum DisconnectReasons {
1798
+ Disconnected = "Disconnected",
1799
+ DisconnectAllNodes = "DisconnectAllNodes"
1800
+ }
1801
+ /** The valid SponsorBlock categories */
1802
+ declare const validSponsorBlocks: string[];
1803
+ /** The audio Outputs Data map declaration */
1804
+ declare const audioOutputsData: Record<AudioOutputs, ChannelMixFilter>;
1805
+ /** Equalizer Presets */
1806
+ declare const EQList: {
1807
+ /** A Bassboost Equalizer, so high it distorts the audio */
1808
+ BassboostEarrape: EQBand[];
1809
+ /** A High and decent Bassboost Equalizer */
1810
+ BassboostHigh: EQBand[];
1811
+ /** A decent Bassboost Equalizer */
1812
+ BassboostMedium: EQBand[];
1813
+ /** A slight Bassboost Equalizer */
1814
+ BassboostLow: EQBand[];
1815
+ /** Makes the Music slightly "better" */
1816
+ BetterMusic: EQBand[];
1817
+ /** Makes the Music sound like rock music / sound rock music better */
1818
+ Rock: EQBand[];
1819
+ /** Makes the Music sound like Classic music / sound Classic music better */
1820
+ Classic: EQBand[];
1821
+ /** Makes the Music sound like Pop music / sound Pop music better */
1822
+ Pop: EQBand[];
1823
+ /** Makes the Music sound like Electronic music / sound Electronic music better */
1824
+ Electronic: EQBand[];
1825
+ /** Boosts all Bands slightly for louder and fuller sound */
1826
+ FullSound: EQBand[];
1827
+ /** Boosts basses + lower highs for a pro gaming sound */
1828
+ Gaming: EQBand[];
1829
+ };
1830
+
1831
+ type DestroyReasonsType = keyof typeof DestroyReasons | string;
1832
+ type DisconnectReasonsType = keyof typeof DisconnectReasons | string;
1833
+ interface PlayerJson {
1834
+ /** Guild Id where the player was playing in */
1925
1835
  guildId: string;
1836
+ /** Options provided to the player */
1837
+ options: PlayerOptions;
1838
+ /** Voice Channel Id the player was playing in */
1839
+ voiceChannelId: string;
1840
+ /** Text Channel Id the player was synced to */
1841
+ textChannelId?: string;
1842
+ /** Position the player was at */
1843
+ position: number;
1844
+ /** Lavalink's position the player was at */
1845
+ lastPosition: number;
1846
+ /** Last time the position was sent from lavalink */
1847
+ lastPositionChange: number | null;
1848
+ /** Volume in % from the player (without volumeDecrementer) */
1849
+ volume: number;
1850
+ /** Real Volume used in lavalink (with the volumeDecrementer) */
1851
+ lavalinkVolume: number;
1852
+ /** The repeatmode from the player */
1853
+ repeatMode: RepeatMode;
1854
+ /** Pause state */
1855
+ paused: boolean;
1856
+ /** Wether the player was playing or not */
1857
+ playing: boolean;
1858
+ /** When the player was created */
1859
+ createdTimeStamp?: number;
1860
+ /** All current used fitlers Data */
1861
+ filters: FilterData;
1862
+ /** The player's ping object */
1863
+ ping: {
1864
+ /** Ping to the voice websocket server */
1865
+ ws: number;
1866
+ /** Avg. calc. Ping to the lavalink server */
1867
+ lavalink: number;
1868
+ };
1869
+ /** Equalizer Bands used in lavalink */
1870
+ equalizer: EQBand[];
1871
+ /** The Id of the last used node */
1872
+ nodeId?: string;
1873
+ /** The SessionId of the node */
1874
+ nodeSessionId?: string;
1875
+ /** The stored queue */
1876
+ queue?: StoredQueue;
1926
1877
  }
1927
- interface LyricsLineEvent extends PlayerEvent {
1928
- /**The lyricsline event*/
1929
- type: "LyricsLineEvent";
1930
- /** The guildId */
1878
+ type RepeatMode = "queue" | "track" | "off";
1879
+ interface PlayerOptions {
1880
+ /** Guild id of the player */
1931
1881
  guildId: string;
1932
- /** The line number */
1933
- lineIndex: number;
1934
- /** The line */
1935
- line: LyricsLine;
1936
- /**skipped is true if the line was skipped */
1937
- skipped: boolean;
1882
+ /** The Voice Channel Id */
1883
+ voiceChannelId: string;
1884
+ /** The Text Channel Id of the Player */
1885
+ textChannelId?: string;
1886
+ /** instantly change volume with the one play request */
1887
+ volume?: number;
1888
+ /** VC Region for node selections */
1889
+ vcRegion?: string;
1890
+ /** if it should join deafened */
1891
+ selfDeaf?: boolean;
1892
+ /** If it should join muted */
1893
+ selfMute?: boolean;
1894
+ /** If it should use a specific lavalink node */
1895
+ node?: LavalinkNode | string;
1896
+ /** If when applying filters, it should use the insta apply filters fix */
1897
+ instaUpdateFiltersFix?: boolean;
1898
+ /** If a volume should be applied via filters instead of lavalink-volume */
1899
+ applyVolumeAsFilter?: boolean;
1900
+ /** Custom Data for the player get/set datastorage */
1901
+ customData?: anyObject;
1938
1902
  }
1939
- type LoadTypes = "track" | "playlist" | "search" | "error" | "empty";
1940
- type State = "CONNECTED" | "CONNECTING" | "DISCONNECTED" | "DISCONNECTING" | "DESTROYING";
1941
- type PlayerEventType = "TrackStartEvent" | "TrackEndEvent" | "TrackExceptionEvent" | "TrackStuckEvent" | "WebSocketClosedEvent" | SponsorBlockSegmentEventType | LyricsEventType;
1942
- type TrackEndReason = "finished" | "loadFailed" | "stopped" | "replaced" | "cleanup";
1943
- interface InvalidLavalinkRestRequest {
1944
- /** Rest Request Data for when it was made */
1945
- timestamp: number;
1946
- /** Status of the request */
1947
- status: number;
1948
- /** Specific Errro which was sent */
1949
- error: string;
1950
- /** Specific Message which was created */
1951
- message?: string;
1952
- /** The specific error trace from the request */
1953
- trace?: unknown;
1954
- /** Path of where it's from */
1955
- path: string;
1903
+ type anyObject = {
1904
+ [key: string | number]: string | number | null | anyObject;
1905
+ };
1906
+ interface BasePlayOptions {
1907
+ /** The position to start the track. */
1908
+ position?: number;
1909
+ /** The position to end the track. */
1910
+ endTime?: number;
1911
+ /** If to start "paused" */
1912
+ paused?: boolean;
1913
+ /** The Volume to start with */
1914
+ volume?: number;
1915
+ /** The Lavalink Filters to use | only with the new REST API */
1916
+ filters?: Partial<LavalinkFilterData>;
1917
+ /** Voice Update for Lavalink */
1918
+ voice?: LavalinkPlayerVoiceOptions;
1956
1919
  }
1957
- interface LavalinkPlayerVoice {
1958
- /** The Voice Token */
1959
- token: string;
1960
- /** The Voice Server Endpoint */
1961
- endpoint: string;
1962
- /** The Voice SessionId */
1963
- sessionId: string;
1964
- /** Wether or not the player is connected */
1965
- connected?: boolean;
1966
- /** The Ping to the voice server */
1967
- ping?: number;
1920
+ interface LavalinkPlayOptions extends BasePlayOptions {
1921
+ /** Which Track to play | don't provide, if it should pick from the Queue */
1922
+ track?: {
1923
+ /** The track encoded base64 string to use instead of the one from the queue system */
1924
+ encoded?: Base64 | null;
1925
+ /** The identifier of the track to use */
1926
+ identifier?: string;
1927
+ /** Custom User Data for the track to provide, will then be on the userData object from the track */
1928
+ userData?: anyObject;
1929
+ /** The Track requester for when u provide encodedTrack / identifer */
1930
+ requester?: unknown;
1931
+ };
1968
1932
  }
1969
- type LavalinkPlayerVoiceOptions = Omit<LavalinkPlayerVoice, 'connected' | 'ping'>;
1970
- interface FailingAddress {
1971
- /** The failing address */
1972
- failingAddress: string;
1973
- /** The timestamp when the address failed */
1974
- failingTimestamp: number;
1975
- /** The timestamp when the address failed as a pretty string */
1976
- failingTime: string;
1933
+ interface PlayOptions extends LavalinkPlayOptions {
1934
+ /** Whether to not replace the track if a play payload is sent. */
1935
+ noReplace?: boolean;
1936
+ /** Adds track on queue and skips to it */
1937
+ clientTrack?: Track | UnresolvedTrack;
1977
1938
  }
1978
- type RoutePlannerTypes = "RotatingIpRoutePlanner" | "NanoIpRoutePlanner" | "RotatingNanoIpRoutePlanner" | "BalancingIpRoutePlanner";
1979
- interface RoutePlanner {
1980
- class?: RoutePlannerTypes;
1981
- details?: {
1982
- /** The ip block being used */
1983
- ipBlock: {
1984
- /** The type of the ip block */
1985
- type: "Inet4Address" | "Inet6Address";
1986
- /** The size of the ip block */
1987
- size: string;
1988
- };
1989
- /** The failing addresses */
1990
- failingAddresses: FailingAddress[];
1991
- /** The number of rotations */
1992
- rotateIndex?: string;
1993
- /** The current offset in the block */
1994
- ipIndex?: string;
1995
- /** The current address being used */
1996
- currentAddress?: string;
1997
- /** The current offset in the ip block */
1998
- currentAddressIndex?: string;
1999
- /** The information in which /64 block ips are chosen. This number increases on each ban. */
2000
- blockIndex?: string;
2001
- };
1939
+
1940
+ /** Ability to manipulate fetch requests */
1941
+ type ModifyRequest = (options: RequestInit & {
1942
+ path: string;
1943
+ extraQueryUrlParams?: URLSearchParams;
1944
+ }) => void;
1945
+ type SponsorBlockSegment = "sponsor" | "selfpromo" | "interaction" | "intro" | "outro" | "preview" | "music_offtopic" | "filler";
1946
+ /**
1947
+ * Node Options for creating a lavalink node
1948
+ */
1949
+ interface LavalinkNodeOptions {
1950
+ /** The Lavalink Server-Ip / Domain-URL */
1951
+ host: string;
1952
+ /** The Lavalink Connection Port */
1953
+ port: number;
1954
+ /** The Lavalink Password / Authorization-Key */
1955
+ authorization: string;
1956
+ /** Does the Server use ssl (https) */
1957
+ secure?: boolean;
1958
+ /** RESUME THE PLAYER? by providing a sessionid on the node-creation */
1959
+ sessionId?: string;
1960
+ /** Add a Custom ID to the node, for later use */
1961
+ id?: string;
1962
+ /** Voice Regions of this Node */
1963
+ regions?: string[];
1964
+ /** The max amount of retries for this node. */
1965
+ retryAmount?: number;
1966
+ /** The delay of how often to retry a reconnection. */
1967
+ retryDelay?: number;
1968
+ /** How long a retry is a valid retry, it should be at least retryAmount*retryDelay. if <= 0 (default) then this won't be accounted. */
1969
+ retryTimespan?: number;
1970
+ /** signal for cancelling requests - default: AbortSignal.timeout(options.requestSignalTimeoutMS || 10000) - put <= 0 to disable */
1971
+ requestSignalTimeoutMS?: number;
1972
+ /** Close on error */
1973
+ closeOnError?: boolean;
1974
+ /** Heartbeat interval , set to <= 0 to disable heartbeat system */
1975
+ heartBeatInterval?: number;
1976
+ /** Recommended, to check wether the client is still connected or not on the stats endpoint */
1977
+ enablePingOnStatsCheck?: boolean;
2002
1978
  }
2003
- interface Session {
2004
- /** Wether or not session is resuming or not */
2005
- resuming: boolean;
2006
- /** For how long a session is lasting while not connected */
2007
- timeout: number;
1979
+ /**
1980
+ * Memory Stats object from lavalink
1981
+ */
1982
+ interface MemoryStats {
1983
+ /** The free memory of the allocated amount. */
1984
+ free: number;
1985
+ /** The used memory of the allocated amount. */
1986
+ used: number;
1987
+ /** The total allocated memory. */
1988
+ allocated: number;
1989
+ /** The reservable memory. */
1990
+ reservable: number;
2008
1991
  }
2009
- interface GuildShardPayload {
2010
- /** The OP code */
2011
- op: number;
2012
- /** Data to send */
2013
- d: {
2014
- /** Guild id to apply voice settings */
2015
- guild_id: string;
2016
- /** channel to move/connect to, or null to leave it */
2017
- channel_id: string | null;
2018
- /** wether or not mute yourself */
2019
- self_mute: boolean;
2020
- /** wether or not deafen yourself */
2021
- self_deaf: boolean;
2022
- };
1992
+ /**
1993
+ * CPU Stats object from lavalink
1994
+ */
1995
+ interface CPUStats {
1996
+ /** The core amount the host machine has. */
1997
+ cores: number;
1998
+ /** The system load. */
1999
+ systemLoad: number;
2000
+ /** The lavalink load. */
2001
+ lavalinkLoad: number;
2023
2002
  }
2024
- interface PlayerUpdateInfo {
2025
- /** guild id of the player */
2026
- guildId: string;
2027
- /** Player options to provide to lavalink */
2028
- playerOptions: LavalinkPlayOptions;
2029
- /** Whether or not replace the current track with the new one (true is recommended) */
2030
- noReplace?: boolean;
2003
+ /**
2004
+ * FrameStats Object from lavalink
2005
+ */
2006
+ interface FrameStats {
2007
+ /** The amount of sent frames. */
2008
+ sent?: number;
2009
+ /** The amount of nulled frames. */
2010
+ nulled?: number;
2011
+ /** The amount of deficit frames. */
2012
+ deficit?: number;
2031
2013
  }
2032
- interface LavalinkPlayer {
2033
- /** Guild Id of the player */
2034
- guildId: string;
2035
- /** IF playing a track, all of the track information */
2036
- track?: LavalinkTrack;
2037
- /** Lavalink volume (mind volumedecrementer) */
2038
- volume: number;
2039
- /** Wether it's paused or not */
2040
- paused: boolean;
2041
- /** Voice Endpoint data */
2042
- voice: LavalinkPlayerVoice;
2043
- /** All Audio Filters */
2044
- filters: Partial<LavalinkFilterData>;
2045
- /** Lavalink-Voice-State Variables */
2046
- state: {
2047
- /** Time since connection established */
2048
- time: number;
2049
- /** Position of the track */
2050
- position: number;
2051
- /** COnnected or not */
2052
- connected: boolean;
2053
- /** Ping to voice server */
2054
- ping: number;
2055
- };
2014
+ /**
2015
+ * BaseNodeStats object from Lavalink
2016
+ */
2017
+ interface BaseNodeStats {
2018
+ /** The amount of players on the node. */
2019
+ players: number;
2020
+ /** The amount of playing players on the node. */
2021
+ playingPlayers: number;
2022
+ /** The uptime for the node. */
2023
+ uptime: number;
2024
+ /** The memory stats for the node. */
2025
+ memory: MemoryStats;
2026
+ /** The cpu stats for the node. */
2027
+ cpu: CPUStats;
2028
+ /** The frame stats for the node. */
2029
+ frameStats: FrameStats;
2056
2030
  }
2057
- interface ChannelDeletePacket {
2058
- /** Packet key for channel delete */
2059
- t: "CHANNEL_DELETE";
2060
- /** data which is sent and relevant */
2061
- d: {
2062
- /** guild id */
2063
- guild_id: string;
2064
- /** Channel id */
2065
- id: string;
2066
- };
2031
+ /**
2032
+ * Interface for nodeStats from lavalink
2033
+ */
2034
+ interface NodeStats extends BaseNodeStats {
2035
+ /** The frame stats for the node. */
2036
+ frameStats: FrameStats;
2067
2037
  }
2068
- interface VoiceState {
2069
- /** OP key from lavalink */
2070
- op: "voiceUpdate";
2071
- /** GuildId provided by lavalink */
2072
- guildId: string;
2073
- /** Event data */
2074
- event: VoiceServer;
2075
- /** Session Id of the voice connection */
2076
- sessionId?: string;
2077
- /** guild id of the voice channel */
2078
- guild_id: string;
2079
- /** user id from the voice connection */
2080
- user_id: string;
2081
- /** Session Id of the voice connection */
2082
- session_id: string;
2083
- /** Voice Channel Id */
2084
- channel_id: string;
2085
- /** Server Mute status */
2086
- mute: boolean;
2087
- /** Server Deaf status */
2088
- deaf: boolean;
2089
- /** Self Deaf status */
2090
- self_deaf: boolean;
2091
- /** Self Mute status */
2092
- self_mute: boolean;
2093
- /** Self Video (Camera) status */
2094
- self_video: boolean;
2095
- /** Self Stream status */
2096
- self_stream: boolean;
2097
- /** Wether the user requests to speak (stage channel) */
2098
- request_to_speak_timestamp: boolean;
2099
- /** Self suppressed status (stage channel) */
2100
- suppress: boolean;
2038
+ /**
2039
+ * Entire lavalink information object from lavalink
2040
+ */
2041
+ interface LavalinkInfo {
2042
+ /** The version of this Lavalink server */
2043
+ version: VersionObject;
2044
+ /** The millisecond unix timestamp when this Lavalink jar was built */
2045
+ buildTime: number;
2046
+ /** The git information of this Lavalink server */
2047
+ git: GitObject;
2048
+ /** The JVM version this Lavalink server runs on */
2049
+ jvm: string;
2050
+ /** The Lavaplayer version being used by this server */
2051
+ lavaplayer: string;
2052
+ /** The enabled source managers for this server */
2053
+ sourceManagers: string[];
2054
+ /** The enabled filters for this server */
2055
+ filters: string[];
2056
+ /** The enabled plugins for this server */
2057
+ plugins: PluginObject[];
2101
2058
  }
2102
- /** The Base64 decodes tring by lavalink */
2103
- type Base64 = string;
2104
- interface VoiceServer {
2105
- /** Voice Token */
2106
- token: string;
2107
- /** Guild Id of the voice server connection */
2108
- guild_id: string;
2109
- /** Server Endpoint */
2110
- endpoint: string;
2059
+ /**
2060
+ * Lavalink's version object from lavalink
2061
+ */
2062
+ interface VersionObject {
2063
+ /** The full version string of this Lavalink server */
2064
+ semver: string;
2065
+ /** The major version of this Lavalink server */
2066
+ major: number;
2067
+ /** The minor version of this Lavalink server */
2068
+ minor: number;
2069
+ /** The patch version of this Lavalink server */
2070
+ patch: number;
2071
+ /** The pre-release version according to semver as a . separated list of identifiers */
2072
+ preRelease?: string;
2073
+ /** The build metadata according to semver as a . separated list of identifiers */
2074
+ build?: string;
2111
2075
  }
2112
- interface VoicePacket {
2113
- /** Voice Packet Keys to send */
2114
- t?: "VOICE_SERVER_UPDATE" | "VOICE_STATE_UPDATE";
2115
- /** Voice Packets to send */
2116
- d: VoiceState | VoiceServer;
2076
+ /**
2077
+ * Git information object from lavalink
2078
+ */
2079
+ interface GitObject {
2080
+ /** The branch this Lavalink server was built on */
2081
+ branch: string;
2082
+ /** The commit this Lavalink server was built on */
2083
+ commit: string;
2084
+ /** The millisecond unix timestamp for when the commit was created */
2085
+ commitTime: string;
2117
2086
  }
2118
- interface NodeMessage extends NodeStats {
2119
- /** The type of the event */
2120
- type: PlayerEventType;
2121
- /** what ops are applying to that event */
2122
- op: "stats" | "playerUpdate" | "event";
2123
- /** The specific guild id for that message */
2124
- guildId: string;
2087
+ /**
2088
+ * Lavalink's plugins object from lavalink's plugin
2089
+ */
2090
+ interface PluginObject {
2091
+ /** The name of the plugin */
2092
+ name: string;
2093
+ /** The version of the plugin */
2094
+ version: string;
2125
2095
  }
2126
- /** Specific types to filter for lavasearch, will be filtered to correct types */
2127
- type LavaSearchType = "track" | "album" | "artist" | "playlist" | "text" | "tracks" | "albums" | "artists" | "playlists" | "texts";
2128
- interface LavaSearchFilteredResponse {
2129
- /** The Information of a playlist provided by lavasearch */
2130
- info: PlaylistInfo;
2131
- /** additional plugin information */
2132
- pluginInfo: PluginInfo;
2133
- /** List of tracks */
2134
- tracks: Track[];
2096
+ interface LyricsResult {
2097
+ /**The name of the source */
2098
+ sourceName: string;
2099
+ /**The name of the provider */
2100
+ provider: string;
2101
+ /**The result text */
2102
+ text: string | null;
2103
+ /**The lyrics lines */
2104
+ lines: LyricsLine[];
2105
+ /**Information about the plugin */
2106
+ plugin: PluginInfo;
2135
2107
  }
2136
- interface LavaSearchResponse {
2137
- /** An array of tracks, only present if track is in types */
2138
- tracks: Track[];
2139
- /** An array of albums, only present if album is in types */
2140
- albums: LavaSearchFilteredResponse[];
2141
- /** An array of artists, only present if artist is in types */
2142
- artists: LavaSearchFilteredResponse[];
2143
- /** An array of playlists, only present if playlist is in types */
2144
- playlists: LavaSearchFilteredResponse[];
2145
- /** An array of text results, only present if text is in types */
2146
- texts: {
2147
- text: string;
2148
- pluginInfo: PluginInfo;
2149
- }[];
2150
- /** Addition result data provided by plugins */
2151
- pluginInfo: PluginInfo;
2108
+ interface LyricsLine {
2109
+ /**The millisecond timestamp */
2110
+ timestamp: number;
2111
+ /**The line duration in milliseconds */
2112
+ duration: number | null;
2113
+ /**The line text */
2114
+ line: string;
2115
+ /**Information about the plugin */
2116
+ plugin: PluginInfo;
2117
+ }
2118
+ type LavalinkNodeIdentifier = string;
2119
+ interface NodeManagerEvents {
2120
+ /**
2121
+ * Emitted when a Node is created.
2122
+ * @event Manager.nodeManager#create
2123
+ */
2124
+ "create": (node: LavalinkNode) => void;
2125
+ /**
2126
+ * Emitted when a Node is destroyed.
2127
+ * @event Manager.nodeManager#destroy
2128
+ */
2129
+ "destroy": (node: LavalinkNode, destroyReason?: DestroyReasonsType) => void;
2130
+ /**
2131
+ * Emitted when a Node is connected.
2132
+ * @event Manager.nodeManager#connect
2133
+ */
2134
+ "connect": (node: LavalinkNode) => void;
2135
+ /**
2136
+ * Emitted when a Node is reconnecting.
2137
+ * @event Manager.nodeManager#reconnecting
2138
+ */
2139
+ "reconnecting": (node: LavalinkNode) => void;
2140
+ /**
2141
+ * Emitted When a node starts to reconnect (if you have a reconnection delay, the reconnecting event will be emitted after the retryDelay.)
2142
+ * Useful to check wether the internal node reconnect system works or not
2143
+ * @event Manager.nodeManager#reconnectinprogress
2144
+ */
2145
+ "reconnectinprogress": (node: LavalinkNode) => void;
2146
+ /**
2147
+ * Emitted when a Node is disconnects.
2148
+ * @event Manager.nodeManager#disconnect
2149
+ */
2150
+ "disconnect": (node: LavalinkNode, reason: {
2151
+ code?: number;
2152
+ reason?: string;
2153
+ }) => void;
2154
+ /**
2155
+ * Emitted when a Node is error.
2156
+ * @event Manager.nodeManager#error
2157
+ */
2158
+ "error": (node: LavalinkNode, error: Error, payload?: unknown) => void;
2159
+ /**
2160
+ * Emits every single Node event.
2161
+ * @event Manager.nodeManager#raw
2162
+ */
2163
+ "raw": (node: LavalinkNode, payload: unknown) => void;
2164
+ /**
2165
+ * Emits when the node connects resumed. You then need to create all players within this event for your usecase.
2166
+ * 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
2167
+ * @event Manager.nodeManager#nodeResumed
2168
+ */
2169
+ "resumed": (node: LavalinkNode, payload: {
2170
+ resumed: true;
2171
+ sessionId: string;
2172
+ op: "ready";
2173
+ }, players: LavalinkPlayer[] | InvalidLavalinkRestRequest) => void;
2174
+ }
2175
+ declare enum ReconnectionState {
2176
+ IDLE = "IDLE",
2177
+ RECONNECTING = "RECONNECTING",
2178
+ PENDING = "PENDING",
2179
+ DESTROYING = "DESTROYING"
2152
2180
  }
2153
- /** SearchQuery Object for raw lavalink requests */
2154
- type SearchQuery = {
2155
- /** lavalink search Query / identifier string */
2156
- query: string;
2157
- /** Extra url query params to use, e.g. for flowertts */
2158
- extraQueryUrlParams?: URLSearchParams;
2159
- /** Source to append to the search query string */
2160
- source?: SearchPlatform;
2161
- } | /** Our just the search query / identifier string */ string;
2162
- /** SearchQuery Object for Lavalink LavaSearch Plugin requests */
2163
- type LavaSearchQuery = {
2164
- /** lavalink search Query / identifier string */
2165
- query: string;
2166
- /** Source to append to the search query string */
2167
- source: LavaSrcSearchPlatformBase;
2168
- /** The Types to filter the search to */
2169
- types?: LavaSearchType[];
2170
- };
2171
- type Awaitable<T> = Promise<T> | T;
2172
2181
 
2173
2182
  /**
2174
2183
  * Lavalink Node creator class
@@ -2195,11 +2204,13 @@ declare class LavalinkNode {
2195
2204
  };
2196
2205
  /** Actual Lavalink Information of the Node */
2197
2206
  info: LavalinkInfo | null;
2207
+ /** current state of the Reconnections */
2208
+ reconnectionState: ReconnectionState;
2198
2209
  /** The Node Manager of this Node */
2199
2210
  private NodeManager;
2200
2211
  /** The Reconnection Timeout */
2201
2212
  private reconnectTimeout?;
2202
- /** The Reconnection Attempt counter */
2213
+ /** The Reconnection Attempt counter (array of datetimes when it tried it.) */
2203
2214
  private reconnectAttempts;
2204
2215
  /** The Socket of the Lavalink */
2205
2216
  private socket;
@@ -2584,17 +2595,26 @@ declare class LavalinkNode {
2584
2595
  * Get the rest Adress for making requests
2585
2596
  */
2586
2597
  private get restAddress();
2598
+ /**
2599
+ * If already trying to reconnect or pending, return
2600
+ */
2601
+ get isNodeReconnecting(): boolean;
2587
2602
  /**
2588
2603
  * Reconnect to the lavalink node
2589
- * @param instaReconnect @default false wether to instantly try to reconnect
2604
+ * @param force @default false Wether to instantly try to reconnect (force it)
2590
2605
  * @returns void
2591
2606
  *
2592
2607
  * @example
2593
2608
  * ```ts
2594
- * await player.node.reconnect();
2609
+ * await player.node.reconnect(true); //true forcefully trys the reconnect
2595
2610
  * ```
2596
2611
  */
2597
2612
  private reconnect;
2613
+ get reconnectionAttemptCount(): number;
2614
+ /**
2615
+ * Private Utility function to execute the reconnection
2616
+ */
2617
+ private executeReconnect;
2598
2618
  /**
2599
2619
  * Private function to reset the reconnection attempts
2600
2620
  * @returns
@@ -3311,4 +3331,4 @@ declare const LavalinkPlugins: {
3311
3331
  /** Lavalink Sources regexes for url validations */
3312
3332
  declare const SourceLinksRegexes: Record<SourcesRegex, RegExp>;
3313
3333
 
3314
- 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, 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, 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 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 };
3334
+ 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, 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 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 };