lavalink-client 1.1.5 → 1.1.7

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.
@@ -7,19 +7,22 @@ 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
  }
20
20
  export interface ManagerQueueOptions {
21
+ /** Maximum Amount of tracks for the queue.previous array */
21
22
  maxPreviousTracks?: number;
23
+ /** Custom Queue Store option */
22
24
  queueStore?: QueueStoreManager;
25
+ /** Custom Queue Watcher class */
23
26
  queueChangesWatcher?: QueueChangesWatcher;
24
27
  }
25
28
  export interface QueueSaver {
@@ -33,8 +36,8 @@ export interface QueueSaver {
33
36
  export declare class QueueSaver {
34
37
  constructor(options: ManagerQueueOptions);
35
38
  get(guildId: string): Promise<Partial<StoredQueue>>;
36
- delete(guildId: string): Promise<any>;
37
- set(guildId: string, value: any): Promise<any>;
39
+ delete(guildId: string): Promise<unknown>;
40
+ set(guildId: string, value: any): Promise<unknown>;
38
41
  sync(guildId: string): Promise<Partial<StoredQueue>>;
39
42
  }
40
43
  export declare class DefaultQueueStore implements QueueStoreManager {
@@ -66,7 +69,6 @@ export declare class Queue {
66
69
  private managerUtils;
67
70
  private queueChanges;
68
71
  constructor(guildId: string, data?: Partial<StoredQueue>, QueueSaver?: QueueSaver, queueOptions?: ManagerQueueOptions);
69
- private applyData;
70
72
  /**
71
73
  * Utils for a Queue
72
74
  */
@@ -74,13 +76,13 @@ export declare class Queue {
74
76
  /**
75
77
  * Save the current cached Queue on the database/server (overides the server)
76
78
  */
77
- save: () => Promise<any>;
79
+ save: () => Promise<unknown>;
78
80
  /**
79
81
  * Sync the current queue database/server with the cached one
80
82
  * @returns {void}
81
83
  */
82
84
  sync: (override?: boolean, dontSyncCurrent?: boolean) => Promise<void>;
83
- destroy: () => Promise<any>;
85
+ destroy: () => Promise<unknown>;
84
86
  /**
85
87
  * @returns {{current:Track|null, previous:Track[], tracks:Track[]}}The Queue, but in a raw State, which allows easier handling for the QueueStoreManager
86
88
  */
@@ -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
@@ -1,30 +1,53 @@
1
1
  import { Player } from "./Player";
2
2
  import { Base64 } from "./Utils";
3
- type LavalinkSourceNames = "youtube" | "youtubemusic" | "soundcloud" | "bandcamp" | "twitch";
4
- type LavalinkPlugin_LavaSrc_SourceNames = "deezer" | "spotify" | "applemusic" | "yandexmusic" | "flowery-tts";
5
- type SourceNames = LavalinkSourceNames | LavalinkPlugin_LavaSrc_SourceNames;
3
+ /** Sourcenames provided by lavalink server */
4
+ export type LavalinkSourceNames = "youtube" | "youtubemusic" | "soundcloud" | "bandcamp" | "twitch";
5
+ /** Source Names provided by lava src plugin */
6
+ export type LavalinkPlugin_LavaSrc_SourceNames = "deezer" | "spotify" | "applemusic" | "yandexmusic" | "flowery-tts";
7
+ /** The SourceNames provided by lavalink */
8
+ export type SourceNames = LavalinkSourceNames | LavalinkPlugin_LavaSrc_SourceNames;
6
9
  export interface LavalinkTrackInfo {
10
+ /** The Identifier of the Track */
7
11
  identifier: string;
12
+ /** The Track Title / Name */
8
13
  title: string;
14
+ /** The Name of the Author */
9
15
  author: string;
16
+ /** The duration of the Track */
10
17
  length: number;
18
+ /** The URL of the artwork if available */
11
19
  artworkUrl: string | null;
20
+ /** The URL (aka Link) of the Track called URI */
12
21
  uri: string;
22
+ /** The Source name of the Track, e.g. soundcloud, youtube, spotify */
13
23
  sourceName: SourceNames;
24
+ /** Wether the audio is seekable */
14
25
  isSeekable: boolean;
26
+ /** Wether the audio is of a live stream */
15
27
  isStream: boolean;
28
+ /** If isrc code is available, it's provided */
16
29
  isrc: string | null;
17
30
  }
18
31
  export interface TrackInfo {
32
+ /** The Identifier of the Track */
19
33
  identifier: string;
34
+ /** The Track Title / Name */
20
35
  title: string;
36
+ /** The Name of the Author */
21
37
  author: string;
38
+ /** The duration of the Track */
22
39
  duration: number;
40
+ /** The URL of the artwork if available */
23
41
  artworkUrl: string | null;
42
+ /** The URL (aka Link) of the Track called URI */
24
43
  uri: string;
44
+ /** The Source name of the Track, e.g. soundcloud, youtube, spotify */
25
45
  sourceName: SourceNames;
46
+ /** Wether the audio is seekable */
26
47
  isSeekable: boolean;
48
+ /** Wether the audio is of a live stream */
27
49
  isStream: boolean;
50
+ /** If isrc code is available, it's provided */
28
51
  isrc: string | null;
29
52
  }
30
53
  export interface PluginInfo {
@@ -95,4 +118,3 @@ export interface UnresolvedTrack {
95
118
  /** The Track's Requester */
96
119
  requester?: unknown;
97
120
  }
98
- export {};
@@ -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";
@@ -114,7 +119,7 @@ export declare class MiniMap<K, V> extends Map<K, V> {
114
119
  filter<This, K2 extends K>(fn: (this: This, value: V, key: K, miniMap: this) => key is K2, thisArg: This): MiniMap<K2, V>;
115
120
  filter<This, V2 extends V>(fn: (this: This, value: V, key: K, miniMap: this) => value is V2, thisArg: This): MiniMap<K, V2>;
116
121
  filter<This>(fn: (this: This, value: V, key: K, miniMap: this) => boolean, thisArg: This): MiniMap<K, V>;
117
- toJSON(): V[];
122
+ toJSON(): [K, V][];
118
123
  /**
119
124
  * Maps each item to another value into an array. Identical in behavior to
120
125
  * [Array.map()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map).
@@ -252,8 +252,7 @@ export class MiniMap extends Map {
252
252
  return results;
253
253
  }
254
254
  toJSON() {
255
- // toJSON is called recursively by JSON.stringify.
256
- return [...this.values()];
255
+ return [...this.entries()];
257
256
  }
258
257
  map(fn, thisArg) {
259
258
  if (typeof thisArg !== 'undefined')
@@ -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
+ };
@@ -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 */
@@ -7,19 +7,22 @@ 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
  }
20
20
  export interface ManagerQueueOptions {
21
+ /** Maximum Amount of tracks for the queue.previous array */
21
22
  maxPreviousTracks?: number;
23
+ /** Custom Queue Store option */
22
24
  queueStore?: QueueStoreManager;
25
+ /** Custom Queue Watcher class */
23
26
  queueChangesWatcher?: QueueChangesWatcher;
24
27
  }
25
28
  export interface QueueSaver {
@@ -33,8 +36,8 @@ export interface QueueSaver {
33
36
  export declare class QueueSaver {
34
37
  constructor(options: ManagerQueueOptions);
35
38
  get(guildId: string): Promise<Partial<StoredQueue>>;
36
- delete(guildId: string): Promise<any>;
37
- set(guildId: string, value: any): Promise<any>;
39
+ delete(guildId: string): Promise<unknown>;
40
+ set(guildId: string, value: any): Promise<unknown>;
38
41
  sync(guildId: string): Promise<Partial<StoredQueue>>;
39
42
  }
40
43
  export declare class DefaultQueueStore implements QueueStoreManager {
@@ -66,7 +69,6 @@ export declare class Queue {
66
69
  private managerUtils;
67
70
  private queueChanges;
68
71
  constructor(guildId: string, data?: Partial<StoredQueue>, QueueSaver?: QueueSaver, queueOptions?: ManagerQueueOptions);
69
- private applyData;
70
72
  /**
71
73
  * Utils for a Queue
72
74
  */
@@ -74,13 +76,13 @@ export declare class Queue {
74
76
  /**
75
77
  * Save the current cached Queue on the database/server (overides the server)
76
78
  */
77
- save: () => Promise<any>;
79
+ save: () => Promise<unknown>;
78
80
  /**
79
81
  * Sync the current queue database/server with the cached one
80
82
  * @returns {void}
81
83
  */
82
84
  sync: (override?: boolean, dontSyncCurrent?: boolean) => Promise<void>;
83
- destroy: () => Promise<any>;
85
+ destroy: () => Promise<unknown>;
84
86
  /**
85
87
  * @returns {{current:Track|null, previous:Track[], tracks:Track[]}}The Queue, but in a raw State, which allows easier handling for the QueueStoreManager
86
88
  */
@@ -1,30 +1,53 @@
1
1
  import { Player } from "./Player";
2
2
  import { Base64 } from "./Utils";
3
- type LavalinkSourceNames = "youtube" | "youtubemusic" | "soundcloud" | "bandcamp" | "twitch";
4
- type LavalinkPlugin_LavaSrc_SourceNames = "deezer" | "spotify" | "applemusic" | "yandexmusic" | "flowery-tts";
5
- type SourceNames = LavalinkSourceNames | LavalinkPlugin_LavaSrc_SourceNames;
3
+ /** Sourcenames provided by lavalink server */
4
+ export type LavalinkSourceNames = "youtube" | "youtubemusic" | "soundcloud" | "bandcamp" | "twitch";
5
+ /** Source Names provided by lava src plugin */
6
+ export type LavalinkPlugin_LavaSrc_SourceNames = "deezer" | "spotify" | "applemusic" | "yandexmusic" | "flowery-tts";
7
+ /** The SourceNames provided by lavalink */
8
+ export type SourceNames = LavalinkSourceNames | LavalinkPlugin_LavaSrc_SourceNames;
6
9
  export interface LavalinkTrackInfo {
10
+ /** The Identifier of the Track */
7
11
  identifier: string;
12
+ /** The Track Title / Name */
8
13
  title: string;
14
+ /** The Name of the Author */
9
15
  author: string;
16
+ /** The duration of the Track */
10
17
  length: number;
18
+ /** The URL of the artwork if available */
11
19
  artworkUrl: string | null;
20
+ /** The URL (aka Link) of the Track called URI */
12
21
  uri: string;
22
+ /** The Source name of the Track, e.g. soundcloud, youtube, spotify */
13
23
  sourceName: SourceNames;
24
+ /** Wether the audio is seekable */
14
25
  isSeekable: boolean;
26
+ /** Wether the audio is of a live stream */
15
27
  isStream: boolean;
28
+ /** If isrc code is available, it's provided */
16
29
  isrc: string | null;
17
30
  }
18
31
  export interface TrackInfo {
32
+ /** The Identifier of the Track */
19
33
  identifier: string;
34
+ /** The Track Title / Name */
20
35
  title: string;
36
+ /** The Name of the Author */
21
37
  author: string;
38
+ /** The duration of the Track */
22
39
  duration: number;
40
+ /** The URL of the artwork if available */
23
41
  artworkUrl: string | null;
42
+ /** The URL (aka Link) of the Track called URI */
24
43
  uri: string;
44
+ /** The Source name of the Track, e.g. soundcloud, youtube, spotify */
25
45
  sourceName: SourceNames;
46
+ /** Wether the audio is seekable */
26
47
  isSeekable: boolean;
48
+ /** Wether the audio is of a live stream */
27
49
  isStream: boolean;
50
+ /** If isrc code is available, it's provided */
28
51
  isrc: string | null;
29
52
  }
30
53
  export interface PluginInfo {
@@ -95,4 +118,3 @@ export interface UnresolvedTrack {
95
118
  /** The Track's Requester */
96
119
  requester?: unknown;
97
120
  }
98
- export {};
@@ -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";
@@ -114,7 +119,7 @@ export declare class MiniMap<K, V> extends Map<K, V> {
114
119
  filter<This, K2 extends K>(fn: (this: This, value: V, key: K, miniMap: this) => key is K2, thisArg: This): MiniMap<K2, V>;
115
120
  filter<This, V2 extends V>(fn: (this: This, value: V, key: K, miniMap: this) => value is V2, thisArg: This): MiniMap<K, V2>;
116
121
  filter<This>(fn: (this: This, value: V, key: K, miniMap: this) => boolean, thisArg: This): MiniMap<K, V>;
117
- toJSON(): V[];
122
+ toJSON(): [K, V][];
118
123
  /**
119
124
  * Maps each item to another value into an array. Identical in behavior to
120
125
  * [Array.map()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map).
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "lavalink-client",
3
- "version": "1.1.5",
4
- "description": "Easy and advanced lavalink client. Use it with lavalink plugins as well as latest lavalink versions",
3
+ "version": "1.1.7",
4
+ "description": "Easy, flexible and feature-rich lavalink@v4 Client. Both for Beginners and Proficients.",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
7
7
  "types": "dist/types/index.d.js",
@@ -11,6 +11,9 @@
11
11
  "build:esm": "node tools/cleanup esm && tsc -p config/tsconfig.esm.json",
12
12
  "build:types": "node tools/cleanup types && tsc -p config/tsconfig.types.json",
13
13
  "clean": "node tools/cleanup",
14
+ "lint": "eslint .",
15
+ "lint:fix": "eslint --fix 'src/**/*.{ts}'",
16
+ "format": "prettier --write src/**/*.ts --config ./.prettierrc.js",
14
17
  "test": "node -v"
15
18
  },
16
19
  "publishConfig": {
@@ -46,12 +49,9 @@
46
49
  "devDependencies": {
47
50
  "@types/node": "^20.4.8",
48
51
  "@types/ws": "^8.5.5",
49
- "@typescript-eslint/eslint-plugin": "^6.2.1",
50
- "@typescript-eslint/parser": "^6.2.1",
51
- "eslint": "^8.46.0",
52
- "eslint-config-prettier": "^9.0.0",
53
- "eslint-plugin-prettier": "^5.0.0",
54
- "prettier": "^3.0.1",
52
+ "@typescript-eslint/eslint-plugin": "^6.4.0",
53
+ "@typescript-eslint/parser": "^6.4.0",
54
+ "eslint": "^8.47.0",
55
55
  "ts-loader": "^9.4.4",
56
56
  "tslib": "^2.6.1",
57
57
  "typescript": "^5.1.6"