lavalink-client 1.1.4 → 1.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,14 +1,24 @@
1
1
  import { Player } from "./Player";
2
- export type AudioOutputs = "mono" | "stereo" | "left" | "right";
3
- export interface FilterManager {
4
- player: Player;
5
- }
2
+ import { FloatNumber, IntegerNumber } from "./Utils";
3
+ /**
4
+ * The FilterManager for each player
5
+ */
6
6
  export declare class FilterManager {
7
+ /** The Equalizer bands currently applied to the Lavalink Server */
7
8
  equalizerBands: EQBand[];
9
+ /** Private Util for the instaFix Filters option */
8
10
  filterUpdatedState: number;
11
+ /** All "Active" / "disabled" Player Filters */
9
12
  filters: PlayerFilters;
13
+ /** The Filter Data sent to Lavalink, only if the filter is enabled (ofc.) */
10
14
  data: FilterData;
15
+ /** The Player assigned to this Filter Manager */
16
+ player: Player;
17
+ /** The Constructor for the FilterManager */
11
18
  constructor(player: Player);
19
+ /**
20
+ * Apply Player filters for lavalink filter sending data, if the filter is enabled / not
21
+ */
12
22
  applyPlayerFilters(): Promise<void>;
13
23
  /**
14
24
  * Checks if the filters are correctly stated (active / not-active)
@@ -20,10 +30,16 @@ export declare class FilterManager {
20
30
  * Reset all Filters
21
31
  */
22
32
  resetFilters(): Promise<PlayerFilters>;
33
+ /**
34
+ * Set the Filter Volume
35
+ * @param volume
36
+ * @returns
37
+ */
23
38
  setVolume(volume: number): Promise<boolean>;
24
39
  /**
25
40
  * Set the AudioOutput Filter
26
41
  * @param type
42
+ * @returns
27
43
  */
28
44
  setAudioOutput(type: AudioOutputs): Promise<AudioOutputs>;
29
45
  /**
@@ -119,32 +135,11 @@ export declare class FilterManager {
119
135
  /** Clears the equalizer bands. */
120
136
  clearEQ(): Promise<this>;
121
137
  }
122
- export declare const audioOutputsData: {
123
- mono: {
124
- leftToLeft: number;
125
- leftToRight: number;
126
- rightToLeft: number;
127
- rightToRight: number;
128
- };
129
- stereo: {
130
- leftToLeft: number;
131
- leftToRight: number;
132
- rightToLeft: number;
133
- rightToRight: number;
134
- };
135
- left: {
136
- leftToLeft: number;
137
- leftToRight: number;
138
- rightToLeft: number;
139
- rightToRight: number;
140
- };
141
- right: {
142
- leftToLeft: number;
143
- leftToRight: number;
144
- rightToLeft: number;
145
- rightToRight: number;
146
- };
147
- };
138
+ /** The Audio Outputs type */
139
+ export type AudioOutputs = "mono" | "stereo" | "left" | "right";
140
+ /** The audio Outputs Data map declaration */
141
+ export declare const audioOutputsData: Record<AudioOutputs, ChannelMixFilter>;
142
+ /** The "active" / "disabled" Player Filters */
148
143
  export interface PlayerFilters {
149
144
  /** Sets nightcore to false, and vaporwave to false */
150
145
  custom: boolean;
@@ -152,42 +147,91 @@ export interface PlayerFilters {
152
147
  nightcore: boolean;
153
148
  /** Sets custom to false, and nightcore to false */
154
149
  vaporwave: boolean;
155
- /** only with the custom lavalink filter plugin */
156
- echo: boolean;
157
- /** only with the custom lavalink filter plugin */
158
- reverb: boolean;
150
+ /** If rotation filter is enabled / not */
159
151
  rotation: boolean;
152
+ /** if karaoke filter is enabled / not */
160
153
  karaoke: boolean;
154
+ /** if tremolo filter is enabled / not */
161
155
  tremolo: boolean;
156
+ /** if vibrato filter is enabled / not */
162
157
  vibrato: boolean;
163
158
  lowPass: boolean;
164
159
  /** audio Output (default stereo, mono sounds the fullest and best for not-stereo tracks) */
165
160
  audioOutput: AudioOutputs;
166
161
  /** Lavalink Volume FILTER (not player Volume, think of it as a gain booster) */
167
162
  volume: boolean;
163
+ /** only with the custom lavalink filter plugin */
164
+ echo: boolean;
165
+ /** only with the custom lavalink filter plugin */
166
+ reverb: boolean;
168
167
  }
168
+ /**
169
+ * There are 15 bands (0-14) that can be changed.
170
+ * "gain" is the multiplier for the given band.
171
+ * The default value is 0.
172
+ * 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.
173
+ * Modifying the gain could also change the volume of the output.
174
+ */
169
175
  export interface EQBand {
170
- band: number;
171
- gain: number;
176
+ /** On what band position (0-14) it should work */
177
+ band: IntegerNumber;
178
+ /** The gain (-0.25 to 1.0) */
179
+ gain: FloatNumber;
172
180
  }
181
+ /**
182
+ * Uses equalization to eliminate part of a band, usually targeting vocals.
183
+ */
173
184
  export interface KaraokeFilter {
185
+ /** The level (0 to 1.0 where 0.0 is no effect and 1.0 is full effect) */
174
186
  level?: number;
187
+ /** The mono level (0 to 1.0 where 0.0 is no effect and 1.0 is full effect) */
175
188
  monoLevel?: number;
189
+ /** The filter band (in Hz) */
176
190
  filterBand?: number;
191
+ /** The filter width */
177
192
  filterWidth?: number;
178
193
  }
194
+ /**
195
+ * Changes the speed, pitch, and rate
196
+ */
179
197
  export interface TimescaleFilter {
198
+ /** The playback speed 0.0 ≤ x */
180
199
  speed?: number;
200
+ /** The pitch 0.0 ≤ x */
181
201
  pitch?: number;
202
+ /** The rate 0.0 ≤ x */
182
203
  rate?: number;
183
204
  }
184
- export interface FreqFilter {
205
+ /**
206
+ * Uses amplification to create a shuddering effect, where the volume quickly oscillates.
207
+ * Demo: https://en.wikipedia.org/wiki/File:Fuse_Electronics_Tremolo_MK-III_Quick_Demo.ogv
208
+ */
209
+ export interface TremoloFilter {
210
+ /** The frequency 0.0 < x */
211
+ frequency?: number;
212
+ /** The tremolo depth 0.0 < x ≤ 1.0 */
213
+ depth?: number;
214
+ }
215
+ /**
216
+ * Similar to tremolo. While tremolo oscillates the volume, vibrato oscillates the pitch.
217
+ */
218
+ export interface VibratoFilter {
219
+ /** The frequency 0.0 < x ≤ 14.0 */
185
220
  frequency?: number;
221
+ /** The vibrato depth 0.0 < x ≤ 1.0 */
186
222
  depth?: number;
187
223
  }
224
+ /**
225
+ * Rotates the sound around the stereo channels/user headphones (aka Audio Panning).
226
+ * It can produce an effect similar to https://youtu.be/QB9EB8mTKcc (without the reverb).
227
+ */
188
228
  export interface RotationFilter {
229
+ /** The frequency of the audio rotating around the listener in Hz. 0.2 is similar to the example video above */
189
230
  rotationHz?: number;
190
231
  }
232
+ /**
233
+ * Distortion effect. It can generate some pretty unique audio effects.
234
+ */
191
235
  export interface DistortionFilter {
192
236
  sinOffset?: number;
193
237
  sinScale?: number;
@@ -198,29 +242,52 @@ export interface DistortionFilter {
198
242
  offset?: number;
199
243
  scale?: number;
200
244
  }
245
+ /**
246
+ * Mixes both channels (left and right), with a configurable factor on how much each channel affects the other.
247
+ * With the defaults, both channels are kept independent of each other.
248
+ * Setting all factors to 0.5 means both channels get the same audio.
249
+ */
201
250
  export interface ChannelMixFilter {
251
+ /** The left to left channel mix factor (0.0 ≤ x ≤ 1.0) */
202
252
  leftToLeft?: number;
253
+ /** The left to right channel mix factor (0.0 ≤ x ≤ 1.0) */
203
254
  leftToRight?: number;
255
+ /** The right to left channel mix factor (0.0 ≤ x ≤ 1.0) */
204
256
  rightToLeft?: number;
257
+ /** The right to right channel mix factor (0.0 ≤ x ≤ 1.0) */
205
258
  rightToRight?: number;
206
259
  }
260
+ /**
261
+ * Higher frequencies get suppressed, while lower frequencies pass through this filter, thus the name low pass.
262
+ * Any smoothing values equal to or less than 1.0 will disable the filter.
263
+ */
207
264
  export interface LowPassFilter {
265
+ /** The smoothing factor (1.0 < x) */
208
266
  smoothing?: number;
209
267
  }
268
+ /**
269
+ * A Plugin Filter
270
+ */
210
271
  export interface EchoFilter {
211
272
  delay: number;
212
273
  decay: number;
213
274
  }
275
+ /**
276
+ * A Plugin Filter
277
+ */
214
278
  export interface ReverbFilter {
215
279
  delay: number;
216
280
  decay: number;
217
281
  }
282
+ /**
283
+ * Filter Data stored in the Client and partially sent to Lavalink
284
+ */
218
285
  export interface FilterData {
219
286
  volume?: number;
220
287
  karaoke?: KaraokeFilter;
221
288
  timescale?: TimescaleFilter;
222
- tremolo?: FreqFilter;
223
- vibrato?: FreqFilter;
289
+ tremolo?: TremoloFilter;
290
+ vibrato?: VibratoFilter;
224
291
  rotation?: RotationFilter;
225
292
  distortion?: DistortionFilter;
226
293
  channelMix?: ChannelMixFilter;
@@ -228,6 +295,33 @@ export interface FilterData {
228
295
  echo: EchoFilter;
229
296
  reverb: ReverbFilter;
230
297
  }
298
+ /**
299
+ * Actual Filter Data sent to Lavalink
300
+ */
231
301
  export interface LavalinkFilterData extends FilterData {
232
302
  equalizer?: EQBand[];
233
303
  }
304
+ export declare const EQList: {
305
+ /** A Bassboost Equalizer, so high it distorts the audio */
306
+ BassboostEarrape: EQBand[];
307
+ /** A High and decent Bassboost Equalizer */
308
+ BassboostHigh: EQBand[];
309
+ /** A decent Bassboost Equalizer */
310
+ BassboostMedium: EQBand[];
311
+ /** A slight Bassboost Equalizer */
312
+ BassboostLow: EQBand[];
313
+ /** Makes the Music slightly "better" */
314
+ BetterMusic: EQBand[];
315
+ /** Makes the Music sound like rock music / sound rock music better */
316
+ Rock: EQBand[];
317
+ /** Makes the Music sound like Classic music / sound Classic music better */
318
+ Classic: EQBand[];
319
+ /** Makes the Music sound like Pop music / sound Pop music better */
320
+ Pop: EQBand[];
321
+ /** Makes the Music sound like Electronic music / sound Electronic music better */
322
+ Electronic: EQBand[];
323
+ /** Boosts all Bands slightly for louder and fuller sound */
324
+ FullSound: EQBand[];
325
+ /** Boosts basses + lower highs for a pro gaming sound */
326
+ Gaming: EQBand[];
327
+ };
@@ -1,9 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.audioOutputsData = exports.FilterManager = void 0;
3
+ exports.EQList = exports.audioOutputsData = exports.FilterManager = void 0;
4
+ /**
5
+ * The FilterManager for each player
6
+ */
4
7
  class FilterManager {
8
+ /** The Equalizer bands currently applied to the Lavalink Server */
5
9
  equalizerBands = [];
10
+ /** Private Util for the instaFix Filters option */
6
11
  filterUpdatedState = 0;
12
+ /** All "Active" / "disabled" Player Filters */
7
13
  filters = {
8
14
  volume: false,
9
15
  vaporwave: false,
@@ -18,6 +24,7 @@ class FilterManager {
18
24
  lowPass: false,
19
25
  audioOutput: "stereo",
20
26
  };
27
+ /** The Filter Data sent to Lavalink, only if the filter is enabled (ofc.) */
21
28
  data = {
22
29
  lowPass: {
23
30
  smoothing: 0
@@ -64,10 +71,16 @@ class FilterManager {
64
71
  scale: 1
65
72
  }*/
66
73
  };
74
+ /** The Player assigned to this Filter Manager */
75
+ player;
76
+ /** The Constructor for the FilterManager */
67
77
  constructor(player) {
78
+ /** Assign the player to the filter manager */
68
79
  this.player = player;
69
80
  }
70
- // function to update all filters at ONCE (and eqs)
81
+ /**
82
+ * Apply Player filters for lavalink filter sending data, if the filter is enabled / not
83
+ */
71
84
  async applyPlayerFilters() {
72
85
  const sendData = { ...this.data };
73
86
  if (!this.filters.volume)
@@ -188,6 +201,11 @@ class FilterManager {
188
201
  await this.applyPlayerFilters();
189
202
  return this.filters;
190
203
  }
204
+ /**
205
+ * Set the Filter Volume
206
+ * @param volume
207
+ * @returns
208
+ */
191
209
  async setVolume(volume) {
192
210
  if (volume < 0 || volume > 5)
193
211
  throw new SyntaxError("Volume-Filter must be between 0 and 5");
@@ -198,6 +216,7 @@ class FilterManager {
198
216
  /**
199
217
  * Set the AudioOutput Filter
200
218
  * @param type
219
+ * @returns
201
220
  */
202
221
  async setAudioOutput(type) {
203
222
  if (this.player.node.info && !this.player.node.info?.filters?.includes("channelMix"))
@@ -453,6 +472,7 @@ class FilterManager {
453
472
  }
454
473
  }
455
474
  exports.FilterManager = FilterManager;
475
+ /** The audio Outputs Data map declaration */
456
476
  exports.audioOutputsData = {
457
477
  mono: {
458
478
  leftToLeft: 0.5,
@@ -479,3 +499,202 @@ exports.audioOutputsData = {
479
499
  rightToRight: 1,
480
500
  },
481
501
  };
502
+ exports.EQList = {
503
+ /** A Bassboost Equalizer, so high it distorts the audio */
504
+ BassboostEarrape: [
505
+ { band: 0, gain: 0.6 * 0.375 },
506
+ { band: 1, gain: 0.67 * 0.375 },
507
+ { band: 2, gain: 0.67 * 0.375 },
508
+ { band: 3, gain: 0.4 * 0.375 },
509
+ { band: 4, gain: -0.5 * 0.375 },
510
+ { band: 5, gain: 0.15 * 0.375 },
511
+ { band: 6, gain: -0.45 * 0.375 },
512
+ { band: 7, gain: 0.23 * 0.375 },
513
+ { band: 8, gain: 0.35 * 0.375 },
514
+ { band: 9, gain: 0.45 * 0.375 },
515
+ { band: 10, gain: 0.55 * 0.375 },
516
+ { band: 11, gain: -0.6 * 0.375 },
517
+ { band: 12, gain: 0.55 * 0.375 },
518
+ { band: 13, gain: -0.5 * 0.375 },
519
+ { band: 14, gain: -0.75 * 0.375 },
520
+ ],
521
+ /** A High and decent Bassboost Equalizer */
522
+ BassboostHigh: [
523
+ { band: 0, gain: 0.6 * 0.25 },
524
+ { band: 1, gain: 0.67 * 0.25 },
525
+ { band: 2, gain: 0.67 * 0.25 },
526
+ { band: 3, gain: 0.4 * 0.25 },
527
+ { band: 4, gain: -0.5 * 0.25 },
528
+ { band: 5, gain: 0.15 * 0.25 },
529
+ { band: 6, gain: -0.45 * 0.25 },
530
+ { band: 7, gain: 0.23 * 0.25 },
531
+ { band: 8, gain: 0.35 * 0.25 },
532
+ { band: 9, gain: 0.45 * 0.25 },
533
+ { band: 10, gain: 0.55 * 0.25 },
534
+ { band: 11, gain: -0.6 * 0.25 },
535
+ { band: 12, gain: 0.55 * 0.25 },
536
+ { band: 13, gain: -0.5 * 0.25 },
537
+ { band: 14, gain: -0.75 * 0.25 },
538
+ ],
539
+ /** A decent Bassboost Equalizer */
540
+ BassboostMedium: [
541
+ { band: 0, gain: 0.6 * 0.1875 },
542
+ { band: 1, gain: 0.67 * 0.1875 },
543
+ { band: 2, gain: 0.67 * 0.1875 },
544
+ { band: 3, gain: 0.4 * 0.1875 },
545
+ { band: 4, gain: -0.5 * 0.1875 },
546
+ { band: 5, gain: 0.15 * 0.1875 },
547
+ { band: 6, gain: -0.45 * 0.1875 },
548
+ { band: 7, gain: 0.23 * 0.1875 },
549
+ { band: 8, gain: 0.35 * 0.1875 },
550
+ { band: 9, gain: 0.45 * 0.1875 },
551
+ { band: 10, gain: 0.55 * 0.1875 },
552
+ { band: 11, gain: -0.6 * 0.1875 },
553
+ { band: 12, gain: 0.55 * 0.1875 },
554
+ { band: 13, gain: -0.5 * 0.1875 },
555
+ { band: 14, gain: -0.75 * 0.1875 },
556
+ ],
557
+ /** A slight Bassboost Equalizer */
558
+ BassboostLow: [
559
+ { band: 0, gain: 0.6 * 0.125 },
560
+ { band: 1, gain: 0.67 * 0.125 },
561
+ { band: 2, gain: 0.67 * 0.125 },
562
+ { band: 3, gain: 0.4 * 0.125 },
563
+ { band: 4, gain: -0.5 * 0.125 },
564
+ { band: 5, gain: 0.15 * 0.125 },
565
+ { band: 6, gain: -0.45 * 0.125 },
566
+ { band: 7, gain: 0.23 * 0.125 },
567
+ { band: 8, gain: 0.35 * 0.125 },
568
+ { band: 9, gain: 0.45 * 0.125 },
569
+ { band: 10, gain: 0.55 * 0.125 },
570
+ { band: 11, gain: -0.6 * 0.125 },
571
+ { band: 12, gain: 0.55 * 0.125 },
572
+ { band: 13, gain: -0.5 * 0.125 },
573
+ { band: 14, gain: -0.75 * 0.125 },
574
+ ],
575
+ /** Makes the Music slightly "better" */
576
+ BetterMusic: [
577
+ { band: 0, gain: 0.25 },
578
+ { band: 1, gain: 0.025 },
579
+ { band: 2, gain: 0.0125 },
580
+ { band: 3, gain: 0 },
581
+ { band: 4, gain: 0 },
582
+ { band: 5, gain: -0.0125 },
583
+ { band: 6, gain: -0.025 },
584
+ { band: 7, gain: -0.0175 },
585
+ { band: 8, gain: 0 },
586
+ { band: 9, gain: 0 },
587
+ { band: 10, gain: 0.0125 },
588
+ { band: 11, gain: 0.025 },
589
+ { band: 12, gain: 0.25 },
590
+ { band: 13, gain: 0.125 },
591
+ { band: 14, gain: 0.125 },
592
+ ],
593
+ /** Makes the Music sound like rock music / sound rock music better */
594
+ Rock: [
595
+ { band: 0, gain: 0.300 },
596
+ { band: 1, gain: 0.250 },
597
+ { band: 2, gain: 0.200 },
598
+ { band: 3, gain: 0.100 },
599
+ { band: 4, gain: 0.050 },
600
+ { band: 5, gain: -0.050 },
601
+ { band: 6, gain: -0.150 },
602
+ { band: 7, gain: -0.200 },
603
+ { band: 8, gain: -0.100 },
604
+ { band: 9, gain: -0.050 },
605
+ { band: 10, gain: 0.050 },
606
+ { band: 11, gain: 0.100 },
607
+ { band: 12, gain: 0.200 },
608
+ { band: 13, gain: 0.250 },
609
+ { band: 14, gain: 0.300 },
610
+ ],
611
+ /** Makes the Music sound like Classic music / sound Classic music better */
612
+ Classic: [
613
+ { band: 0, gain: 0.375 },
614
+ { band: 1, gain: 0.350 },
615
+ { band: 2, gain: 0.125 },
616
+ { band: 3, gain: 0 },
617
+ { band: 4, gain: 0 },
618
+ { band: 5, gain: 0.125 },
619
+ { band: 6, gain: 0.550 },
620
+ { band: 7, gain: 0.050 },
621
+ { band: 8, gain: 0.125 },
622
+ { band: 9, gain: 0.250 },
623
+ { band: 10, gain: 0.200 },
624
+ { band: 11, gain: 0.250 },
625
+ { band: 12, gain: 0.300 },
626
+ { band: 13, gain: 0.250 },
627
+ { band: 14, gain: 0.300 },
628
+ ],
629
+ /** Makes the Music sound like Pop music / sound Pop music better */
630
+ Pop: [
631
+ { band: 0, gain: 0.2635 },
632
+ { band: 1, gain: 0.22141 },
633
+ { band: 2, gain: -0.21141 },
634
+ { band: 3, gain: -0.1851 },
635
+ { band: 4, gain: -0.155 },
636
+ { band: 5, gain: 0.21141 },
637
+ { band: 6, gain: 0.22456 },
638
+ { band: 7, gain: 0.237 },
639
+ { band: 8, gain: 0.237 },
640
+ { band: 9, gain: 0.237 },
641
+ { band: 10, gain: -0.05 },
642
+ { band: 11, gain: -0.116 },
643
+ { band: 12, gain: 0.192 },
644
+ { band: 13, gain: 0 },
645
+ ],
646
+ /** Makes the Music sound like Electronic music / sound Electronic music better */
647
+ Electronic: [
648
+ { band: 0, gain: 0.375 },
649
+ { band: 1, gain: 0.350 },
650
+ { band: 2, gain: 0.125 },
651
+ { band: 3, gain: 0 },
652
+ { band: 4, gain: 0 },
653
+ { band: 5, gain: -0.125 },
654
+ { band: 6, gain: -0.125 },
655
+ { band: 7, gain: 0 },
656
+ { band: 8, gain: 0.25 },
657
+ { band: 9, gain: 0.125 },
658
+ { band: 10, gain: 0.15 },
659
+ { band: 11, gain: 0.2 },
660
+ { band: 12, gain: 0.250 },
661
+ { band: 13, gain: 0.350 },
662
+ { band: 14, gain: 0.400 },
663
+ ],
664
+ /** Boosts all Bands slightly for louder and fuller sound */
665
+ FullSound: [
666
+ { band: 0, gain: 0.25 + 0.375 },
667
+ { band: 1, gain: 0.25 + 0.025 },
668
+ { band: 2, gain: 0.25 + 0.0125 },
669
+ { band: 3, gain: 0.25 + 0 },
670
+ { band: 4, gain: 0.25 + 0 },
671
+ { band: 5, gain: 0.25 + -0.0125 },
672
+ { band: 6, gain: 0.25 + -0.025 },
673
+ { band: 7, gain: 0.25 + -0.0175 },
674
+ { band: 8, gain: 0.25 + 0 },
675
+ { band: 9, gain: 0.25 + 0 },
676
+ { band: 10, gain: 0.25 + 0.0125 },
677
+ { band: 11, gain: 0.25 + 0.025 },
678
+ { band: 12, gain: 0.25 + 0.375 },
679
+ { band: 13, gain: 0.25 + 0.125 },
680
+ { band: 14, gain: 0.25 + 0.125 },
681
+ ],
682
+ /** Boosts basses + lower highs for a pro gaming sound */
683
+ Gaming: [
684
+ { band: 0, gain: 0.350 },
685
+ { band: 1, gain: 0.300 },
686
+ { band: 2, gain: 0.250 },
687
+ { band: 3, gain: 0.200 },
688
+ { band: 4, gain: 0.150 },
689
+ { band: 5, gain: 0.100 },
690
+ { band: 6, gain: 0.050 },
691
+ { band: 7, gain: -0.0 },
692
+ { band: 8, gain: -0.050 },
693
+ { band: 9, gain: -0.100 },
694
+ { band: 10, gain: -0.150 },
695
+ { band: 11, gain: -0.200 },
696
+ { band: 12, gain: -0.250 },
697
+ { band: 13, gain: -0.300 },
698
+ { band: 14, gain: -0.350 },
699
+ ],
700
+ };
@@ -2,13 +2,13 @@
2
2
  import { EventEmitter } from "events";
3
3
  import { NodeManager } from "./NodeManager";
4
4
  import { ManagerQueueOptions } from "./Queue";
5
- import { GuildShardPayload, ManagerUitls, MiniMap, SearchPlatform, TrackEndEvent, TrackExceptionEvent, TrackStartEvent, TrackStuckEvent, VoicePacket, VoiceServer, VoiceState, WebSocketClosedEvent } from "./Utils";
5
+ import { GuildShardPayload, ManagerUtils, MiniMap, SearchPlatform, TrackEndEvent, TrackExceptionEvent, TrackStartEvent, TrackStuckEvent, VoicePacket, VoiceServer, VoiceState, WebSocketClosedEvent } from "./Utils";
6
6
  import { LavalinkNodeOptions } from "./Node";
7
7
  import { DestroyReasonsType, Player, PlayerJson, PlayerOptions } from "./Player";
8
8
  import { Track, UnresolvedTrack } from "./Track";
9
9
  export interface LavalinkManager {
10
10
  nodeManager: NodeManager;
11
- utils: ManagerUitls;
11
+ utils: ManagerUtils;
12
12
  }
13
13
  export interface BotClientOptions {
14
14
  /** Bot Client Id */
@@ -16,7 +16,7 @@ export interface BotClientOptions {
16
16
  /** Bot Client Username */
17
17
  username?: string;
18
18
  /** So users can pass entire objects / classes */
19
- [x: string | number | symbol | undefined]: any;
19
+ [x: string | number | symbol | undefined]: unknown;
20
20
  }
21
21
  export interface ManagerPlayerOptions {
22
22
  /** If the Lavalink Volume should be decremented by x number */
@@ -90,7 +90,7 @@ class LavalinkManager extends events_1.EventEmitter {
90
90
  throw new SyntaxError("No Manager Options Provided");
91
91
  // create options
92
92
  this.options = options;
93
- this.utils = new Utils_1.ManagerUitls(this);
93
+ this.utils = new Utils_1.ManagerUtils(this);
94
94
  // use the validators
95
95
  this.validateAndApply(options);
96
96
  this.applyDefaultOptions();
@@ -67,6 +67,7 @@ class LavalinkNode {
67
67
  throw new SyntaxError("If secure is true, then the port must be 443");
68
68
  this.rest = new undici_1.Pool(this.poolAddress, this.options.poolOptions);
69
69
  this.options.regions = (this.options.regions || []).map(a => a.toLowerCase());
70
+ Object.defineProperty(this, Utils_1.NodeSymbol, { configurable: true, value: true });
70
71
  }
71
72
  /**
72
73
  * Makes an API call to the Node
@@ -131,10 +131,10 @@ class Player {
131
131
  }
132
132
  if (!this.queue.current && this.queue.tracks.length)
133
133
  await (0, Utils_1.queueTrackEnd)(this);
134
- // @ts-ignore
135
134
  if (this.queue.current && this.LavalinkManager.utils.isUnresolvedTrack(this.queue.current)) {
136
- try { // @ts-ignore
137
- this.queue.current = await this.queue.current.resolve(this);
135
+ try {
136
+ // resolve the unresolved track
137
+ await this.queue.current.resolve(this);
138
138
  }
139
139
  catch (error) {
140
140
  this.LavalinkManager.emit("trackError", this, this.queue.current, error);
@@ -7,13 +7,13 @@ export interface StoredQueue {
7
7
  }
8
8
  export interface QueueStoreManager extends Record<string, any> {
9
9
  /** @async get a Value (MUST RETURN UNPARSED!) */
10
- get: (guildId: unknown) => Promise<any>;
10
+ get: (guildId: unknown) => Promise<unknown>;
11
11
  /** @async Set a value inside a guildId (MUST BE UNPARSED) */
12
- set: (guildId: unknown, value: unknown) => Promise<any>;
12
+ set: (guildId: unknown, value: unknown) => Promise<unknown>;
13
13
  /** @async Delete a Database Value based of it's guildId */
14
- delete: (guildId: unknown) => Promise<any>;
14
+ delete: (guildId: unknown) => Promise<unknown>;
15
15
  /** @async Transform the value(s) inside of the QueueStoreManager (IF YOU DON'T NEED PARSING/STRINGIFY, then just return the value) */
16
- stringify: (value: unknown) => Promise<any>;
16
+ stringify: (value: unknown) => Promise<unknown>;
17
17
  /** @async Parse the saved value back to the Queue (IF YOU DON'T NEED PARSING/STRINGIFY, then just return the value) */
18
18
  parse: (value: unknown) => Promise<Partial<StoredQueue>>;
19
19
  }
@@ -33,8 +33,8 @@ export interface QueueSaver {
33
33
  export declare class QueueSaver {
34
34
  constructor(options: ManagerQueueOptions);
35
35
  get(guildId: string): Promise<Partial<StoredQueue>>;
36
- delete(guildId: string): Promise<any>;
37
- set(guildId: string, value: any): Promise<any>;
36
+ delete(guildId: string): Promise<unknown>;
37
+ set(guildId: string, value: any): Promise<unknown>;
38
38
  sync(guildId: string): Promise<Partial<StoredQueue>>;
39
39
  }
40
40
  export declare class DefaultQueueStore implements QueueStoreManager {
@@ -66,7 +66,6 @@ export declare class Queue {
66
66
  private managerUtils;
67
67
  private queueChanges;
68
68
  constructor(guildId: string, data?: Partial<StoredQueue>, QueueSaver?: QueueSaver, queueOptions?: ManagerQueueOptions);
69
- private applyData;
70
69
  /**
71
70
  * Utils for a Queue
72
71
  */
@@ -74,13 +73,13 @@ export declare class Queue {
74
73
  /**
75
74
  * Save the current cached Queue on the database/server (overides the server)
76
75
  */
77
- save: () => Promise<any>;
76
+ save: () => Promise<unknown>;
78
77
  /**
79
78
  * Sync the current queue database/server with the cached one
80
79
  * @returns {void}
81
80
  */
82
81
  sync: (override?: boolean, dontSyncCurrent?: boolean) => Promise<void>;
83
- destroy: () => Promise<any>;
82
+ destroy: () => Promise<unknown>;
84
83
  /**
85
84
  * @returns {{current:Track|null, previous:Track[], tracks:Track[]}}The Queue, but in a raw State, which allows easier handling for the QueueStoreManager
86
85
  */
@@ -50,7 +50,7 @@ class Queue {
50
50
  options = { maxPreviousTracks: 25 };
51
51
  guildId = "";
52
52
  QueueSaver = null;
53
- managerUtils = new Utils_1.ManagerUitls();
53
+ managerUtils = new Utils_1.ManagerUtils();
54
54
  queueChanges;
55
55
  constructor(guildId, data = {}, QueueSaver, queueOptions) {
56
56
  this.queueChanges = queueOptions.queueChangesWatcher || null;
@@ -60,8 +60,7 @@ class Queue {
60
60
  this.current = this.managerUtils.isTrack(data.current) ? data.current : null;
61
61
  this.previous = Array.isArray(data.previous) && data.previous.some(track => this.managerUtils.isTrack(track) || this.managerUtils.isUnresolvedTrack(track)) ? data.previous.filter(track => this.managerUtils.isTrack(track) || this.managerUtils.isUnresolvedTrack(track)) : [];
62
62
  this.tracks = Array.isArray(data.tracks) && data.tracks.some(track => this.managerUtils.isTrack(track) || this.managerUtils.isUnresolvedTrack(track)) ? data.tracks.filter(track => this.managerUtils.isTrack(track) || this.managerUtils.isUnresolvedTrack(track)) : [];
63
- }
64
- applyData(data) {
63
+ Object.defineProperty(this, Utils_1.QueueSymbol, { configurable: true, value: true });
65
64
  }
66
65
  /**
67
66
  * Utils for a Queue