lavalink-client 1.1.5 → 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,6 +1,12 @@
1
+ /**
2
+ * The FilterManager for each player
3
+ */
1
4
  export class FilterManager {
5
+ /** The Equalizer bands currently applied to the Lavalink Server */
2
6
  equalizerBands = [];
7
+ /** Private Util for the instaFix Filters option */
3
8
  filterUpdatedState = 0;
9
+ /** All "Active" / "disabled" Player Filters */
4
10
  filters = {
5
11
  volume: false,
6
12
  vaporwave: false,
@@ -15,6 +21,7 @@ export class FilterManager {
15
21
  lowPass: false,
16
22
  audioOutput: "stereo",
17
23
  };
24
+ /** The Filter Data sent to Lavalink, only if the filter is enabled (ofc.) */
18
25
  data = {
19
26
  lowPass: {
20
27
  smoothing: 0
@@ -61,10 +68,16 @@ export class FilterManager {
61
68
  scale: 1
62
69
  }*/
63
70
  };
71
+ /** The Player assigned to this Filter Manager */
72
+ player;
73
+ /** The Constructor for the FilterManager */
64
74
  constructor(player) {
75
+ /** Assign the player to the filter manager */
65
76
  this.player = player;
66
77
  }
67
- // function to update all filters at ONCE (and eqs)
78
+ /**
79
+ * Apply Player filters for lavalink filter sending data, if the filter is enabled / not
80
+ */
68
81
  async applyPlayerFilters() {
69
82
  const sendData = { ...this.data };
70
83
  if (!this.filters.volume)
@@ -185,6 +198,11 @@ export class FilterManager {
185
198
  await this.applyPlayerFilters();
186
199
  return this.filters;
187
200
  }
201
+ /**
202
+ * Set the Filter Volume
203
+ * @param volume
204
+ * @returns
205
+ */
188
206
  async setVolume(volume) {
189
207
  if (volume < 0 || volume > 5)
190
208
  throw new SyntaxError("Volume-Filter must be between 0 and 5");
@@ -195,6 +213,7 @@ export class FilterManager {
195
213
  /**
196
214
  * Set the AudioOutput Filter
197
215
  * @param type
216
+ * @returns
198
217
  */
199
218
  async setAudioOutput(type) {
200
219
  if (this.player.node.info && !this.player.node.info?.filters?.includes("channelMix"))
@@ -449,6 +468,7 @@ export class FilterManager {
449
468
  return this.setEQ(new Array(15).fill(0.0).map((gain, band) => ({ band, gain })));
450
469
  }
451
470
  }
471
+ /** The audio Outputs Data map declaration */
452
472
  export const audioOutputsData = {
453
473
  mono: {
454
474
  leftToLeft: 0.5,
@@ -475,3 +495,202 @@ export const audioOutputsData = {
475
495
  rightToRight: 1,
476
496
  },
477
497
  };
498
+ export const EQList = {
499
+ /** A Bassboost Equalizer, so high it distorts the audio */
500
+ BassboostEarrape: [
501
+ { band: 0, gain: 0.6 * 0.375 },
502
+ { band: 1, gain: 0.67 * 0.375 },
503
+ { band: 2, gain: 0.67 * 0.375 },
504
+ { band: 3, gain: 0.4 * 0.375 },
505
+ { band: 4, gain: -0.5 * 0.375 },
506
+ { band: 5, gain: 0.15 * 0.375 },
507
+ { band: 6, gain: -0.45 * 0.375 },
508
+ { band: 7, gain: 0.23 * 0.375 },
509
+ { band: 8, gain: 0.35 * 0.375 },
510
+ { band: 9, gain: 0.45 * 0.375 },
511
+ { band: 10, gain: 0.55 * 0.375 },
512
+ { band: 11, gain: -0.6 * 0.375 },
513
+ { band: 12, gain: 0.55 * 0.375 },
514
+ { band: 13, gain: -0.5 * 0.375 },
515
+ { band: 14, gain: -0.75 * 0.375 },
516
+ ],
517
+ /** A High and decent Bassboost Equalizer */
518
+ BassboostHigh: [
519
+ { band: 0, gain: 0.6 * 0.25 },
520
+ { band: 1, gain: 0.67 * 0.25 },
521
+ { band: 2, gain: 0.67 * 0.25 },
522
+ { band: 3, gain: 0.4 * 0.25 },
523
+ { band: 4, gain: -0.5 * 0.25 },
524
+ { band: 5, gain: 0.15 * 0.25 },
525
+ { band: 6, gain: -0.45 * 0.25 },
526
+ { band: 7, gain: 0.23 * 0.25 },
527
+ { band: 8, gain: 0.35 * 0.25 },
528
+ { band: 9, gain: 0.45 * 0.25 },
529
+ { band: 10, gain: 0.55 * 0.25 },
530
+ { band: 11, gain: -0.6 * 0.25 },
531
+ { band: 12, gain: 0.55 * 0.25 },
532
+ { band: 13, gain: -0.5 * 0.25 },
533
+ { band: 14, gain: -0.75 * 0.25 },
534
+ ],
535
+ /** A decent Bassboost Equalizer */
536
+ BassboostMedium: [
537
+ { band: 0, gain: 0.6 * 0.1875 },
538
+ { band: 1, gain: 0.67 * 0.1875 },
539
+ { band: 2, gain: 0.67 * 0.1875 },
540
+ { band: 3, gain: 0.4 * 0.1875 },
541
+ { band: 4, gain: -0.5 * 0.1875 },
542
+ { band: 5, gain: 0.15 * 0.1875 },
543
+ { band: 6, gain: -0.45 * 0.1875 },
544
+ { band: 7, gain: 0.23 * 0.1875 },
545
+ { band: 8, gain: 0.35 * 0.1875 },
546
+ { band: 9, gain: 0.45 * 0.1875 },
547
+ { band: 10, gain: 0.55 * 0.1875 },
548
+ { band: 11, gain: -0.6 * 0.1875 },
549
+ { band: 12, gain: 0.55 * 0.1875 },
550
+ { band: 13, gain: -0.5 * 0.1875 },
551
+ { band: 14, gain: -0.75 * 0.1875 },
552
+ ],
553
+ /** A slight Bassboost Equalizer */
554
+ BassboostLow: [
555
+ { band: 0, gain: 0.6 * 0.125 },
556
+ { band: 1, gain: 0.67 * 0.125 },
557
+ { band: 2, gain: 0.67 * 0.125 },
558
+ { band: 3, gain: 0.4 * 0.125 },
559
+ { band: 4, gain: -0.5 * 0.125 },
560
+ { band: 5, gain: 0.15 * 0.125 },
561
+ { band: 6, gain: -0.45 * 0.125 },
562
+ { band: 7, gain: 0.23 * 0.125 },
563
+ { band: 8, gain: 0.35 * 0.125 },
564
+ { band: 9, gain: 0.45 * 0.125 },
565
+ { band: 10, gain: 0.55 * 0.125 },
566
+ { band: 11, gain: -0.6 * 0.125 },
567
+ { band: 12, gain: 0.55 * 0.125 },
568
+ { band: 13, gain: -0.5 * 0.125 },
569
+ { band: 14, gain: -0.75 * 0.125 },
570
+ ],
571
+ /** Makes the Music slightly "better" */
572
+ BetterMusic: [
573
+ { band: 0, gain: 0.25 },
574
+ { band: 1, gain: 0.025 },
575
+ { band: 2, gain: 0.0125 },
576
+ { band: 3, gain: 0 },
577
+ { band: 4, gain: 0 },
578
+ { band: 5, gain: -0.0125 },
579
+ { band: 6, gain: -0.025 },
580
+ { band: 7, gain: -0.0175 },
581
+ { band: 8, gain: 0 },
582
+ { band: 9, gain: 0 },
583
+ { band: 10, gain: 0.0125 },
584
+ { band: 11, gain: 0.025 },
585
+ { band: 12, gain: 0.25 },
586
+ { band: 13, gain: 0.125 },
587
+ { band: 14, gain: 0.125 },
588
+ ],
589
+ /** Makes the Music sound like rock music / sound rock music better */
590
+ Rock: [
591
+ { band: 0, gain: 0.300 },
592
+ { band: 1, gain: 0.250 },
593
+ { band: 2, gain: 0.200 },
594
+ { band: 3, gain: 0.100 },
595
+ { band: 4, gain: 0.050 },
596
+ { band: 5, gain: -0.050 },
597
+ { band: 6, gain: -0.150 },
598
+ { band: 7, gain: -0.200 },
599
+ { band: 8, gain: -0.100 },
600
+ { band: 9, gain: -0.050 },
601
+ { band: 10, gain: 0.050 },
602
+ { band: 11, gain: 0.100 },
603
+ { band: 12, gain: 0.200 },
604
+ { band: 13, gain: 0.250 },
605
+ { band: 14, gain: 0.300 },
606
+ ],
607
+ /** Makes the Music sound like Classic music / sound Classic music better */
608
+ Classic: [
609
+ { band: 0, gain: 0.375 },
610
+ { band: 1, gain: 0.350 },
611
+ { band: 2, gain: 0.125 },
612
+ { band: 3, gain: 0 },
613
+ { band: 4, gain: 0 },
614
+ { band: 5, gain: 0.125 },
615
+ { band: 6, gain: 0.550 },
616
+ { band: 7, gain: 0.050 },
617
+ { band: 8, gain: 0.125 },
618
+ { band: 9, gain: 0.250 },
619
+ { band: 10, gain: 0.200 },
620
+ { band: 11, gain: 0.250 },
621
+ { band: 12, gain: 0.300 },
622
+ { band: 13, gain: 0.250 },
623
+ { band: 14, gain: 0.300 },
624
+ ],
625
+ /** Makes the Music sound like Pop music / sound Pop music better */
626
+ Pop: [
627
+ { band: 0, gain: 0.2635 },
628
+ { band: 1, gain: 0.22141 },
629
+ { band: 2, gain: -0.21141 },
630
+ { band: 3, gain: -0.1851 },
631
+ { band: 4, gain: -0.155 },
632
+ { band: 5, gain: 0.21141 },
633
+ { band: 6, gain: 0.22456 },
634
+ { band: 7, gain: 0.237 },
635
+ { band: 8, gain: 0.237 },
636
+ { band: 9, gain: 0.237 },
637
+ { band: 10, gain: -0.05 },
638
+ { band: 11, gain: -0.116 },
639
+ { band: 12, gain: 0.192 },
640
+ { band: 13, gain: 0 },
641
+ ],
642
+ /** Makes the Music sound like Electronic music / sound Electronic music better */
643
+ Electronic: [
644
+ { band: 0, gain: 0.375 },
645
+ { band: 1, gain: 0.350 },
646
+ { band: 2, gain: 0.125 },
647
+ { band: 3, gain: 0 },
648
+ { band: 4, gain: 0 },
649
+ { band: 5, gain: -0.125 },
650
+ { band: 6, gain: -0.125 },
651
+ { band: 7, gain: 0 },
652
+ { band: 8, gain: 0.25 },
653
+ { band: 9, gain: 0.125 },
654
+ { band: 10, gain: 0.15 },
655
+ { band: 11, gain: 0.2 },
656
+ { band: 12, gain: 0.250 },
657
+ { band: 13, gain: 0.350 },
658
+ { band: 14, gain: 0.400 },
659
+ ],
660
+ /** Boosts all Bands slightly for louder and fuller sound */
661
+ FullSound: [
662
+ { band: 0, gain: 0.25 + 0.375 },
663
+ { band: 1, gain: 0.25 + 0.025 },
664
+ { band: 2, gain: 0.25 + 0.0125 },
665
+ { band: 3, gain: 0.25 + 0 },
666
+ { band: 4, gain: 0.25 + 0 },
667
+ { band: 5, gain: 0.25 + -0.0125 },
668
+ { band: 6, gain: 0.25 + -0.025 },
669
+ { band: 7, gain: 0.25 + -0.0175 },
670
+ { band: 8, gain: 0.25 + 0 },
671
+ { band: 9, gain: 0.25 + 0 },
672
+ { band: 10, gain: 0.25 + 0.0125 },
673
+ { band: 11, gain: 0.25 + 0.025 },
674
+ { band: 12, gain: 0.25 + 0.375 },
675
+ { band: 13, gain: 0.25 + 0.125 },
676
+ { band: 14, gain: 0.25 + 0.125 },
677
+ ],
678
+ /** Boosts basses + lower highs for a pro gaming sound */
679
+ Gaming: [
680
+ { band: 0, gain: 0.350 },
681
+ { band: 1, gain: 0.300 },
682
+ { band: 2, gain: 0.250 },
683
+ { band: 3, gain: 0.200 },
684
+ { band: 4, gain: 0.150 },
685
+ { band: 5, gain: 0.100 },
686
+ { band: 6, gain: 0.050 },
687
+ { band: 7, gain: -0.0 },
688
+ { band: 8, gain: -0.050 },
689
+ { band: 9, gain: -0.100 },
690
+ { band: 10, gain: -0.150 },
691
+ { band: 11, gain: -0.200 },
692
+ { band: 12, gain: -0.250 },
693
+ { band: 13, gain: -0.300 },
694
+ { band: 14, gain: -0.350 },
695
+ ],
696
+ };
@@ -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 */
@@ -1,6 +1,6 @@
1
1
  import WebSocket from "ws";
2
2
  import { Pool } from "undici";
3
- import { queueTrackEnd } from "./Utils";
3
+ import { queueTrackEnd, NodeSymbol } from "./Utils";
4
4
  import { DestroyReasons } from "./Player";
5
5
  import { isAbsolute } from "path";
6
6
  export class LavalinkNode {
@@ -63,6 +63,7 @@ export class LavalinkNode {
63
63
  throw new SyntaxError("If secure is true, then the port must be 443");
64
64
  this.rest = new Pool(this.poolAddress, this.options.poolOptions);
65
65
  this.options.regions = (this.options.regions || []).map(a => a.toLowerCase());
66
+ Object.defineProperty(this, NodeSymbol, { configurable: true, value: true });
66
67
  }
67
68
  /**
68
69
  * Makes an API call to the Node
@@ -128,10 +128,10 @@ export class Player {
128
128
  }
129
129
  if (!this.queue.current && this.queue.tracks.length)
130
130
  await queueTrackEnd(this);
131
- // @ts-ignore
132
131
  if (this.queue.current && this.LavalinkManager.utils.isUnresolvedTrack(this.queue.current)) {
133
- try { // @ts-ignore
134
- this.queue.current = await this.queue.current.resolve(this);
132
+ try {
133
+ // resolve the unresolved track
134
+ await this.queue.current.resolve(this);
135
135
  }
136
136
  catch (error) {
137
137
  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
  */
@@ -1,4 +1,4 @@
1
- import { ManagerUtils, MiniMap } from "./Utils";
1
+ import { ManagerUtils, MiniMap, QueueSymbol } from "./Utils";
2
2
  export class QueueSaver {
3
3
  constructor(options) {
4
4
  this._ = options?.queueStore || new DefaultQueueStore();
@@ -55,8 +55,7 @@ export class Queue {
55
55
  this.current = this.managerUtils.isTrack(data.current) ? data.current : null;
56
56
  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)) : [];
57
57
  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)) : [];
58
- }
59
- applyData(data) {
58
+ Object.defineProperty(this, QueueSymbol, { configurable: true, value: true });
60
59
  }
61
60
  /**
62
61
  * Utils for a Queue
@@ -7,6 +7,11 @@ export declare const TrackSymbol: unique symbol;
7
7
  export declare const UnresolvedTrackSymbol: unique symbol;
8
8
  export declare const QueueSymbol: unique symbol;
9
9
  export declare const NodeSymbol: unique symbol;
10
+ type Opaque<T, K> = T & {
11
+ __opaque__: K;
12
+ };
13
+ export type IntegerNumber = Opaque<number, 'Int'>;
14
+ export type FloatNumber = Opaque<number, 'Float'>;
10
15
  export type LavaSrcSearchPlatformBase = "spsearch" | "sprec" | "amsearch" | "dzsearch" | "dzisrc" | "ymsearch";
11
16
  export type LavaSrcSearchPlatform = LavaSrcSearchPlatformBase | "ftts";
12
17
  export type DuncteSearchPlatform = "speak" | "tts";