lavalink-client 2.2.1 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/README.md +140 -20
  2. package/dist/cjs/index.d.ts +7 -1
  3. package/dist/cjs/index.js +7 -1
  4. package/dist/cjs/structures/Constants.d.ts +40 -0
  5. package/dist/cjs/structures/Constants.js +244 -0
  6. package/dist/cjs/structures/CustomSearches/BandCampSearch.d.ts +2 -2
  7. package/dist/cjs/structures/Filters.d.ts +2 -217
  8. package/dist/cjs/structures/Filters.js +12 -236
  9. package/dist/cjs/structures/LavalinkManager.d.ts +31 -166
  10. package/dist/cjs/structures/LavalinkManager.js +60 -8
  11. package/dist/cjs/structures/LavalinkManagerStatics.d.ts +1 -1
  12. package/dist/cjs/structures/LavalinkManagerStatics.js +1 -1
  13. package/dist/cjs/structures/Node.d.ts +15 -156
  14. package/dist/cjs/structures/Node.js +140 -51
  15. package/dist/cjs/structures/NodeManager.d.ts +54 -52
  16. package/dist/cjs/structures/NodeManager.js +77 -5
  17. package/dist/cjs/structures/Player.d.ts +31 -124
  18. package/dist/cjs/structures/Player.js +78 -43
  19. package/dist/cjs/structures/Queue.d.ts +113 -42
  20. package/dist/cjs/structures/Queue.js +169 -8
  21. package/dist/cjs/structures/Types/Filters.d.ts +190 -0
  22. package/dist/cjs/structures/Types/Manager.d.ts +184 -0
  23. package/dist/cjs/structures/Types/Manager.js +2 -0
  24. package/dist/cjs/structures/Types/Node.d.ts +216 -0
  25. package/dist/cjs/structures/Types/Node.js +2 -0
  26. package/dist/cjs/structures/Types/Player.d.ts +108 -0
  27. package/dist/cjs/structures/Types/Player.js +2 -0
  28. package/dist/cjs/structures/Types/Queue.d.ts +34 -0
  29. package/dist/cjs/structures/Types/Queue.js +2 -0
  30. package/dist/cjs/structures/{Track.d.ts → Types/Track.d.ts} +4 -2
  31. package/dist/cjs/structures/Types/Track.js +2 -0
  32. package/dist/cjs/structures/Types/Utils.d.ts +367 -0
  33. package/dist/cjs/structures/Types/Utils.js +2 -0
  34. package/dist/cjs/structures/Utils.d.ts +13 -369
  35. package/dist/cjs/structures/Utils.js +40 -18
  36. package/dist/esm/index.d.ts +7 -1
  37. package/dist/esm/index.js +7 -1
  38. package/dist/esm/structures/Constants.d.ts +40 -0
  39. package/dist/esm/structures/Constants.js +241 -0
  40. package/dist/esm/structures/CustomSearches/BandCampSearch.d.ts +2 -2
  41. package/dist/esm/structures/Filters.d.ts +2 -217
  42. package/dist/esm/structures/Filters.js +7 -231
  43. package/dist/esm/structures/LavalinkManager.d.ts +31 -166
  44. package/dist/esm/structures/LavalinkManager.js +58 -6
  45. package/dist/esm/structures/LavalinkManagerStatics.d.ts +1 -1
  46. package/dist/esm/structures/LavalinkManagerStatics.js +1 -1
  47. package/dist/esm/structures/Node.d.ts +15 -156
  48. package/dist/esm/structures/Node.js +132 -43
  49. package/dist/esm/structures/NodeManager.d.ts +54 -52
  50. package/dist/esm/structures/NodeManager.js +74 -2
  51. package/dist/esm/structures/Player.d.ts +31 -124
  52. package/dist/esm/structures/Player.js +77 -42
  53. package/dist/esm/structures/Queue.d.ts +113 -42
  54. package/dist/esm/structures/Queue.js +169 -8
  55. package/dist/esm/structures/Types/Filters.d.ts +190 -0
  56. package/dist/esm/structures/Types/Manager.d.ts +184 -0
  57. package/dist/esm/structures/Types/Manager.js +1 -0
  58. package/dist/esm/structures/Types/Node.d.ts +216 -0
  59. package/dist/esm/structures/Types/Node.js +1 -0
  60. package/dist/esm/structures/Types/Player.d.ts +108 -0
  61. package/dist/esm/structures/Types/Player.js +1 -0
  62. package/dist/esm/structures/Types/Queue.d.ts +34 -0
  63. package/dist/esm/structures/Types/Queue.js +1 -0
  64. package/dist/{types/structures → esm/structures/Types}/Track.d.ts +4 -2
  65. package/dist/esm/structures/Types/Track.js +1 -0
  66. package/dist/esm/structures/Types/Utils.d.ts +367 -0
  67. package/dist/esm/structures/Types/Utils.js +1 -0
  68. package/dist/esm/structures/Utils.d.ts +13 -369
  69. package/dist/esm/structures/Utils.js +40 -18
  70. package/dist/types/index.d.ts +7 -1
  71. package/dist/types/structures/Constants.d.ts +40 -0
  72. package/dist/types/structures/CustomSearches/BandCampSearch.d.ts +2 -2
  73. package/dist/types/structures/Filters.d.ts +2 -217
  74. package/dist/types/structures/LavalinkManager.d.ts +31 -166
  75. package/dist/types/structures/LavalinkManagerStatics.d.ts +1 -1
  76. package/dist/types/structures/Node.d.ts +15 -156
  77. package/dist/types/structures/NodeManager.d.ts +54 -52
  78. package/dist/types/structures/Player.d.ts +31 -124
  79. package/dist/types/structures/Queue.d.ts +113 -42
  80. package/dist/types/structures/Types/Filters.d.ts +190 -0
  81. package/dist/types/structures/Types/Manager.d.ts +184 -0
  82. package/dist/types/structures/Types/Node.d.ts +216 -0
  83. package/dist/types/structures/Types/Player.d.ts +108 -0
  84. package/dist/types/structures/Types/Queue.d.ts +34 -0
  85. package/dist/{esm/structures → types/structures/Types}/Track.d.ts +4 -2
  86. package/dist/types/structures/Types/Utils.d.ts +367 -0
  87. package/dist/types/structures/Utils.d.ts +13 -369
  88. package/package.json +1 -1
  89. /package/dist/cjs/structures/{Track.js → Types/Filters.js} +0 -0
  90. /package/dist/esm/structures/{Track.js → Types/Filters.js} +0 -0
@@ -1,62 +1,79 @@
1
- import { Track, UnresolvedTrack } from "./Track";
2
1
  import { MiniMap } from "./Utils";
3
- export interface StoredQueue {
4
- current: Track | null;
5
- previous: Track[];
6
- tracks: Track[];
7
- }
8
- export interface QueueStoreManager extends Record<string, any> {
9
- /** @async get a Value (MUST RETURN UNPARSED!) */
10
- get: (guildId: unknown) => Promise<unknown>;
11
- /** @async Set a value inside a guildId (MUST BE UNPARSED) */
12
- set: (guildId: unknown, value: unknown) => Promise<unknown>;
13
- /** @async Delete a Database Value based of it's guildId */
14
- delete: (guildId: unknown) => Promise<unknown>;
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<unknown>;
17
- /** @async Parse the saved value back to the Queue (IF YOU DON'T NEED PARSING/STRINGIFY, then just return the value) */
18
- parse: (value: unknown) => Promise<Partial<StoredQueue>>;
19
- }
20
- export interface ManagerQueueOptions {
21
- /** Maximum Amount of tracks for the queue.previous array. Set to 0 to not save previous songs. Defaults to 25 Tracks */
22
- maxPreviousTracks?: number;
23
- /** Custom Queue Store option */
24
- queueStore?: QueueStoreManager;
25
- /** Custom Queue Watcher class */
26
- queueChangesWatcher?: QueueChangesWatcher;
27
- }
28
- export interface QueueSaver {
29
- /** @private */
30
- _: QueueStoreManager;
31
- /** @private */
2
+ import type { Track, UnresolvedTrack } from "./Types/Track";
3
+ import type { ManagerQueueOptions, QueueStoreManager, StoredQueue } from "./Types/Queue";
4
+ export declare class QueueSaver {
5
+ /**
6
+ * The queue store manager
7
+ */
8
+ private _;
9
+ /**
10
+ * The options for the queue saver
11
+ */
32
12
  options: {
33
13
  maxPreviousTracks: number;
34
14
  };
35
- }
36
- export declare class QueueSaver {
37
15
  constructor(options: ManagerQueueOptions);
16
+ /**
17
+ * Get the queue for a guild
18
+ * @param guildId The guild ID
19
+ * @returns The queue for the guild
20
+ */
38
21
  get(guildId: string): Promise<Partial<StoredQueue>>;
22
+ /**
23
+ * Delete the queue for a guild
24
+ * @param guildId The guild ID
25
+ * @returns The queue for the guild
26
+ */
39
27
  delete(guildId: string): Promise<unknown>;
40
- set(guildId: string, value: any): Promise<unknown>;
28
+ /**
29
+ * Set the queue for a guild
30
+ * @param guildId The guild ID
31
+ * @param valueToStringify The queue to set
32
+ * @returns The queue for the guild
33
+ */
34
+ set(guildId: string, valueToStringify: StoredQueue): Promise<unknown>;
35
+ /**
36
+ * Sync the queue for a guild
37
+ * @param guildId The guild ID
38
+ * @returns The queue for the guild
39
+ */
41
40
  sync(guildId: string): Promise<Partial<StoredQueue>>;
42
41
  }
43
42
  export declare class DefaultQueueStore implements QueueStoreManager {
44
43
  private data;
45
44
  constructor();
45
+ /**
46
+ * Get the queue for a guild
47
+ * @param guildId The guild ID
48
+ * @returns The queue for the guild
49
+ */
46
50
  get(guildId: any): Promise<unknown>;
47
- set(guildId: any, stringifiedValue: any): Promise<MiniMap<unknown, unknown>>;
51
+ /**
52
+ * Set the queue for a guild
53
+ * @param guildId The guild ID
54
+ * @param valueToStringify The queue to set
55
+ * @returns The queue for the guild
56
+ */
57
+ set(guildId: any, valueToStringify: any): Promise<MiniMap<unknown, unknown>>;
58
+ /**
59
+ * Delete the queue for a guild
60
+ * @param guildId The guild ID
61
+ * @returns The queue for the guild
62
+ */
48
63
  delete(guildId: any): Promise<boolean>;
64
+ /**
65
+ * Stringify the queue for a guild
66
+ * @param value The queue to stringify
67
+ * @returns The stringified queue
68
+ */
49
69
  stringify(value: any): Promise<any>;
70
+ /**
71
+ * Parse the queue for a guild
72
+ * @param value The queue to parse
73
+ * @returns The parsed queue
74
+ */
50
75
  parse(value: any): Promise<Partial<StoredQueue>>;
51
76
  }
52
- export interface QueueChangesWatcher {
53
- /** get a Value (MUST RETURN UNPARSED!) */
54
- tracksAdd: (guildId: string, tracks: (Track | UnresolvedTrack)[], position: number, oldStoredQueue: StoredQueue, newStoredQueue: StoredQueue) => any;
55
- /** Set a value inside a guildId (MUST BE UNPARSED) */
56
- tracksRemoved: (guildId: string, tracks: (Track | UnresolvedTrack)[], position: number, oldStoredQueue: StoredQueue, newStoredQueue: StoredQueue) => any;
57
- /** Set a value inside a guildId (MUST BE UNPARSED) */
58
- shuffled: (guildId: string, oldStoredQueue: StoredQueue, newStoredQueue: StoredQueue) => any;
59
- }
60
77
  export declare class Queue {
61
78
  readonly tracks: (Track | UnresolvedTrack)[];
62
79
  readonly previous: Track[];
@@ -68,6 +85,13 @@ export declare class Queue {
68
85
  private readonly QueueSaver;
69
86
  private managerUtils;
70
87
  private queueChanges;
88
+ /**
89
+ * Create a new Queue
90
+ * @param guildId The guild ID
91
+ * @param data The data to initialize the queue with
92
+ * @param QueueSaver The queue saver to use
93
+ * @param queueOptions
94
+ */
71
95
  constructor(guildId: string, data?: Partial<StoredQueue>, QueueSaver?: QueueSaver, queueOptions?: ManagerQueueOptions);
72
96
  /**
73
97
  * Utils for a Queue
@@ -113,4 +137,51 @@ export declare class Queue {
113
137
  * @returns {Track} Spliced Track
114
138
  */
115
139
  splice(index: number, amount: number, TrackOrTracks?: Track | UnresolvedTrack | (Track | UnresolvedTrack)[]): any;
140
+ /**
141
+ * Remove stuff from the queue.tracks array
142
+ * - single Track | UnresolvedTrack
143
+ * - multiple Track | UnresovedTrack
144
+ * - at the index or multiple indexes
145
+ * @param removeQueryTrack
146
+ * @returns null (if nothing was removed) / { removed } where removed is an array with all removed elements
147
+ *
148
+ * @example
149
+ * ```js
150
+ * // remove single track
151
+ *
152
+ * const track = player.queue.tracks[4];
153
+ * await player.queue.remove(track);
154
+ *
155
+ * // if you already have the index you can straight up pass it too
156
+ * await player.queue.remove(4);
157
+ *
158
+ *
159
+ * // if you want to remove multiple tracks, e.g. from position 4 to position 10 you can do smt like this
160
+ * 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
161
+ *
162
+ * // I still highly suggest to use .splice!
163
+ *
164
+ * await player.queue.splice(4, 10); // removes at index 4, 10 tracks
165
+ *
166
+ * await player.queue.splice(1, 1); // removes at index 1, 1 track
167
+ *
168
+ * await player.queue.splice(4, 0, ...tracks) // removes 0 tracks at position 4, and then inserts all tracks after position 4.
169
+ * ```
170
+ */
171
+ remove<T extends Track | UnresolvedTrack | number | Track[] | UnresolvedTrack[] | number[] | (number | Track | UnresolvedTrack)[]>(removeQueryTrack: T): Promise<{
172
+ removed: (Track | UnresolvedTrack)[];
173
+ } | null>;
174
+ /**
175
+ * Shifts the previous array, to return the last previous track & thus remove it from the previous queue
176
+ * @returns
177
+ *
178
+ * @example
179
+ * ```js
180
+ * // example on how to play the previous track again
181
+ * const previous = await player.queue.shiftPrevious(); // get the previous track and remove it from the previous queue array!!
182
+ * if(!previous) return console.error("No previous track found");
183
+ * await player.play({ clientTrack: previous }); // play it again
184
+ * ```
185
+ */
186
+ shiftPrevious(): Promise<Track>;
116
187
  }
@@ -1,39 +1,94 @@
1
1
  import { ManagerUtils, MiniMap, QueueSymbol } from "./Utils";
2
2
  export class QueueSaver {
3
+ /**
4
+ * The queue store manager
5
+ */
6
+ _;
7
+ /**
8
+ * The options for the queue saver
9
+ */
10
+ options;
3
11
  constructor(options) {
4
12
  this._ = options?.queueStore || new DefaultQueueStore();
5
13
  this.options = {
6
14
  maxPreviousTracks: options?.maxPreviousTracks || 25,
7
15
  };
8
16
  }
17
+ /**
18
+ * Get the queue for a guild
19
+ * @param guildId The guild ID
20
+ * @returns The queue for the guild
21
+ */
9
22
  async get(guildId) {
10
- return await this._.parse(await this._.get(guildId));
23
+ return this._.parse(await this._.get(guildId));
11
24
  }
25
+ /**
26
+ * Delete the queue for a guild
27
+ * @param guildId The guild ID
28
+ * @returns The queue for the guild
29
+ */
12
30
  async delete(guildId) {
13
- return await this._.delete(guildId);
31
+ return this._.delete(guildId);
14
32
  }
15
- async set(guildId, value) {
16
- return await this._.set(guildId, await this._.stringify(value));
33
+ /**
34
+ * Set the queue for a guild
35
+ * @param guildId The guild ID
36
+ * @param valueToStringify The queue to set
37
+ * @returns The queue for the guild
38
+ */
39
+ async set(guildId, valueToStringify) {
40
+ return this._.set(guildId, await this._.stringify(valueToStringify));
17
41
  }
42
+ /**
43
+ * Sync the queue for a guild
44
+ * @param guildId The guild ID
45
+ * @returns The queue for the guild
46
+ */
18
47
  async sync(guildId) {
19
- return await this.get(guildId);
48
+ return this.get(guildId);
20
49
  }
21
50
  }
22
51
  export class DefaultQueueStore {
23
52
  data = new MiniMap();
24
53
  constructor() { }
54
+ /**
55
+ * Get the queue for a guild
56
+ * @param guildId The guild ID
57
+ * @returns The queue for the guild
58
+ */
25
59
  async get(guildId) {
26
60
  return await this.data.get(guildId);
27
61
  }
28
- async set(guildId, stringifiedValue) {
29
- return await this.data.set(guildId, stringifiedValue);
62
+ /**
63
+ * Set the queue for a guild
64
+ * @param guildId The guild ID
65
+ * @param valueToStringify The queue to set
66
+ * @returns The queue for the guild
67
+ */
68
+ async set(guildId, valueToStringify) {
69
+ return await this.data.set(guildId, valueToStringify);
30
70
  }
71
+ /**
72
+ * Delete the queue for a guild
73
+ * @param guildId The guild ID
74
+ * @returns The queue for the guild
75
+ */
31
76
  async delete(guildId) {
32
77
  return await this.data.delete(guildId);
33
78
  }
79
+ /**
80
+ * Stringify the queue for a guild
81
+ * @param value The queue to stringify
82
+ * @returns The stringified queue
83
+ */
34
84
  async stringify(value) {
35
85
  return value; // JSON.stringify(value);
36
86
  }
87
+ /**
88
+ * Parse the queue for a guild
89
+ * @param value The queue to parse
90
+ * @returns The parsed queue
91
+ */
37
92
  async parse(value) {
38
93
  return value; // JSON.parse(value)
39
94
  }
@@ -47,6 +102,13 @@ export class Queue {
47
102
  QueueSaver = null;
48
103
  managerUtils = new ManagerUtils();
49
104
  queueChanges;
105
+ /**
106
+ * Create a new Queue
107
+ * @param guildId The guild ID
108
+ * @param data The data to initialize the queue with
109
+ * @param QueueSaver The queue saver to use
110
+ * @param queueOptions
111
+ */
50
112
  constructor(guildId, data = {}, QueueSaver, queueOptions) {
51
113
  this.queueChanges = queueOptions.queueChangesWatcher || null;
52
114
  this.guildId = guildId;
@@ -118,7 +180,7 @@ export class Queue {
118
180
  if (this.tracks.length <= 1)
119
181
  return this.tracks.length;
120
182
  // swap #1 and #2 if only 2 tracks.
121
- if (this.tracks.length == 2) {
183
+ if (this.tracks.length === 2) {
122
184
  [this.tracks[0], this.tracks[1]] = [this.tracks[1], this.tracks[0]];
123
185
  }
124
186
  else { // randomly swap places.
@@ -192,4 +254,103 @@ export class Queue {
192
254
  // return the things
193
255
  return spliced.length === 1 ? spliced[0] : spliced;
194
256
  }
257
+ /**
258
+ * Remove stuff from the queue.tracks array
259
+ * - single Track | UnresolvedTrack
260
+ * - multiple Track | UnresovedTrack
261
+ * - at the index or multiple indexes
262
+ * @param removeQueryTrack
263
+ * @returns null (if nothing was removed) / { removed } where removed is an array with all removed elements
264
+ *
265
+ * @example
266
+ * ```js
267
+ * // remove single track
268
+ *
269
+ * const track = player.queue.tracks[4];
270
+ * await player.queue.remove(track);
271
+ *
272
+ * // if you already have the index you can straight up pass it too
273
+ * await player.queue.remove(4);
274
+ *
275
+ *
276
+ * // if you want to remove multiple tracks, e.g. from position 4 to position 10 you can do smt like this
277
+ * 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
278
+ *
279
+ * // I still highly suggest to use .splice!
280
+ *
281
+ * await player.queue.splice(4, 10); // removes at index 4, 10 tracks
282
+ *
283
+ * await player.queue.splice(1, 1); // removes at index 1, 1 track
284
+ *
285
+ * await player.queue.splice(4, 0, ...tracks) // removes 0 tracks at position 4, and then inserts all tracks after position 4.
286
+ * ```
287
+ */
288
+ async remove(removeQueryTrack) {
289
+ if (typeof removeQueryTrack === "number") {
290
+ const toRemove = this.tracks[removeQueryTrack];
291
+ if (!toRemove)
292
+ return null;
293
+ const removed = this.tracks.splice(removeQueryTrack, 1);
294
+ await this.utils.save();
295
+ return { removed };
296
+ }
297
+ if (Array.isArray(removeQueryTrack)) {
298
+ if (removeQueryTrack.every(v => typeof v === "number")) {
299
+ const removed = [];
300
+ for (const i of removeQueryTrack) {
301
+ if (this.tracks[i])
302
+ removed.push(...this.tracks.splice(i, 1));
303
+ }
304
+ if (!removed.length)
305
+ return null;
306
+ await this.utils.save();
307
+ return { removed };
308
+ }
309
+ const tracksToRemove = this.tracks.map((v, i) => ({ v, i })).filter(({ v, i }) => removeQueryTrack.find(t => typeof t === "number" && (t === i) ||
310
+ typeof t === "object" && (t.encoded && t.encoded === v.encoded ||
311
+ t.info?.identifier && t.info.identifier === v.info?.identifier ||
312
+ t.info?.uri && t.info.uri === v.info?.uri ||
313
+ t.info?.title && t.info.title === v.info?.title ||
314
+ t.info?.isrc && t.info.isrc === v.info?.isrc ||
315
+ t.info?.artworkUrl && t.info.artworkUrl === v.info?.artworkUrl)));
316
+ if (!tracksToRemove.length)
317
+ return null;
318
+ const removed = [];
319
+ for (const { i } of tracksToRemove) {
320
+ if (this.tracks[i])
321
+ removed.push(...this.tracks.splice(i, 1));
322
+ }
323
+ await this.utils.save();
324
+ return { removed };
325
+ }
326
+ const toRemove = this.tracks.findIndex((v) => removeQueryTrack.encoded && removeQueryTrack.encoded === v.encoded ||
327
+ removeQueryTrack.info?.identifier && removeQueryTrack.info.identifier === v.info?.identifier ||
328
+ removeQueryTrack.info?.uri && removeQueryTrack.info.uri === v.info?.uri ||
329
+ removeQueryTrack.info?.title && removeQueryTrack.info.title === v.info?.title ||
330
+ removeQueryTrack.info?.isrc && removeQueryTrack.info.isrc === v.info?.isrc ||
331
+ removeQueryTrack.info?.artworkUrl && removeQueryTrack.info.artworkUrl === v.info?.artworkUrl);
332
+ if (toRemove < 0)
333
+ return null;
334
+ const removed = this.tracks.splice(toRemove, 1);
335
+ await this.utils.save();
336
+ return { removed };
337
+ }
338
+ /**
339
+ * Shifts the previous array, to return the last previous track & thus remove it from the previous queue
340
+ * @returns
341
+ *
342
+ * @example
343
+ * ```js
344
+ * // example on how to play the previous track again
345
+ * const previous = await player.queue.shiftPrevious(); // get the previous track and remove it from the previous queue array!!
346
+ * if(!previous) return console.error("No previous track found");
347
+ * await player.play({ clientTrack: previous }); // play it again
348
+ * ```
349
+ */
350
+ async shiftPrevious() {
351
+ const removed = this.previous.shift();
352
+ if (removed)
353
+ await this.utils.save();
354
+ return removed ?? null;
355
+ }
195
356
  }
@@ -0,0 +1,190 @@
1
+ import type { FloatNumber, IntegerNumber } from "./Utils";
2
+ /** The Audio Outputs type */
3
+ export type AudioOutputs = "mono" | "stereo" | "left" | "right";
4
+ /** The "active" / "disabled" Player Filters */
5
+ export interface PlayerFilters {
6
+ /** Sets nightcore to false, and vaporwave to false */
7
+ custom: boolean;
8
+ /** Sets custom to false, and vaporwave to false */
9
+ nightcore: boolean;
10
+ /** Sets custom to false, and nightcore to false */
11
+ vaporwave: boolean;
12
+ /** If rotation filter is enabled / not */
13
+ rotation: boolean;
14
+ /** if karaoke filter is enabled / not */
15
+ karaoke: boolean;
16
+ /** if tremolo filter is enabled / not */
17
+ tremolo: boolean;
18
+ /** if vibrato filter is enabled / not */
19
+ vibrato: boolean;
20
+ lowPass: boolean;
21
+ /** audio Output (default stereo, mono sounds the fullest and best for not-stereo tracks) */
22
+ audioOutput: AudioOutputs;
23
+ /** Lavalink Volume FILTER (not player Volume, think of it as a gain booster) */
24
+ volume: boolean;
25
+ /** Filters for the Lavalink Filter Plugin */
26
+ lavalinkFilterPlugin: {
27
+ /** if echo filter is enabled / not */
28
+ echo: boolean;
29
+ /** if reverb filter is enabled / not */
30
+ reverb: boolean;
31
+ };
32
+ lavalinkLavaDspxPlugin: {
33
+ /** if lowPass filter is enabled / not */
34
+ lowPass: boolean;
35
+ /** if highPass filter is enabled / not */
36
+ highPass: boolean;
37
+ /** if normalization filter is enabled / not */
38
+ normalization: boolean;
39
+ /** if echo filter is enabled / not */
40
+ echo: boolean;
41
+ };
42
+ }
43
+ /**
44
+ * There are 15 bands (0-14) that can be changed.
45
+ * "gain" is the multiplier for the given band.
46
+ * The default value is 0.
47
+ * 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.
48
+ * Modifying the gain could also change the volume of the output.
49
+ */
50
+ export interface EQBand {
51
+ /** On what band position (0-14) it should work */
52
+ band: IntegerNumber | number;
53
+ /** The gain (-0.25 to 1.0) */
54
+ gain: FloatNumber | number;
55
+ }
56
+ /**
57
+ * Uses equalization to eliminate part of a band, usually targeting vocals.
58
+ */
59
+ export interface KaraokeFilter {
60
+ /** The level (0 to 1.0 where 0.0 is no effect and 1.0 is full effect) */
61
+ level?: number;
62
+ /** The mono level (0 to 1.0 where 0.0 is no effect and 1.0 is full effect) */
63
+ monoLevel?: number;
64
+ /** The filter band (in Hz) */
65
+ filterBand?: number;
66
+ /** The filter width */
67
+ filterWidth?: number;
68
+ }
69
+ /**
70
+ * Changes the speed, pitch, and rate
71
+ */
72
+ export interface TimescaleFilter {
73
+ /** The playback speed 0.0 ≤ x */
74
+ speed?: number;
75
+ /** The pitch 0.0 ≤ x */
76
+ pitch?: number;
77
+ /** The rate 0.0 ≤ x */
78
+ rate?: number;
79
+ }
80
+ /**
81
+ * Uses amplification to create a shuddering effect, where the volume quickly oscillates.
82
+ * Demo: https://en.wikipedia.org/wiki/File:Fuse_Electronics_Tremolo_MK-III_Quick_Demo.ogv
83
+ */
84
+ export interface TremoloFilter {
85
+ /** The frequency 0.0 < x */
86
+ frequency?: number;
87
+ /** The tremolo depth 0.0 < x ≤ 1.0 */
88
+ depth?: number;
89
+ }
90
+ /**
91
+ * Similar to tremolo. While tremolo oscillates the volume, vibrato oscillates the pitch.
92
+ */
93
+ export interface VibratoFilter {
94
+ /** The frequency 0.0 < x ≤ 14.0 */
95
+ frequency?: number;
96
+ /** The vibrato depth 0.0 < x ≤ 1.0 */
97
+ depth?: number;
98
+ }
99
+ /**
100
+ * Rotates the sound around the stereo channels/user headphones (aka Audio Panning).
101
+ * It can produce an effect similar to https://youtu.be/QB9EB8mTKcc (without the reverb).
102
+ */
103
+ export interface RotationFilter {
104
+ /** The frequency of the audio rotating around the listener in Hz. 0.2 is similar to the example video above */
105
+ rotationHz?: number;
106
+ }
107
+ /**
108
+ * Distortion effect. It can generate some pretty unique audio effects.
109
+ */
110
+ export interface DistortionFilter {
111
+ sinOffset?: number;
112
+ sinScale?: number;
113
+ cosOffset?: number;
114
+ cosScale?: number;
115
+ tanOffset?: number;
116
+ tanScale?: number;
117
+ offset?: number;
118
+ scale?: number;
119
+ }
120
+ /**
121
+ * Mixes both channels (left and right), with a configurable factor on how much each channel affects the other.
122
+ * With the defaults, both channels are kept independent of each other.
123
+ * Setting all factors to 0.5 means both channels get the same audio.
124
+ */
125
+ export interface ChannelMixFilter {
126
+ /** The left to left channel mix factor (0.0 ≤ x ≤ 1.0) */
127
+ leftToLeft?: number;
128
+ /** The left to right channel mix factor (0.0 ≤ x ≤ 1.0) */
129
+ leftToRight?: number;
130
+ /** The right to left channel mix factor (0.0 ≤ x ≤ 1.0) */
131
+ rightToLeft?: number;
132
+ /** The right to right channel mix factor (0.0 ≤ x ≤ 1.0) */
133
+ rightToRight?: number;
134
+ }
135
+ /**
136
+ * Higher frequencies get suppressed, while lower frequencies pass through this filter, thus the name low pass.
137
+ * Any smoothing values equal to or less than 1.0 will disable the filter.
138
+ */
139
+ export interface LowPassFilter {
140
+ /** The smoothing factor (1.0 < x) */
141
+ smoothing?: number;
142
+ }
143
+ /**
144
+ * Filter Data stored in the Client and partially sent to Lavalink
145
+ */
146
+ export interface FilterData {
147
+ volume?: number;
148
+ karaoke?: KaraokeFilter;
149
+ timescale?: TimescaleFilter;
150
+ tremolo?: TremoloFilter;
151
+ vibrato?: VibratoFilter;
152
+ rotation?: RotationFilter;
153
+ distortion?: DistortionFilter;
154
+ channelMix?: ChannelMixFilter;
155
+ lowPass?: LowPassFilter;
156
+ pluginFilters?: {
157
+ "lavalink-filter-plugin"?: {
158
+ "echo"?: {
159
+ delay?: number;
160
+ decay?: number;
161
+ };
162
+ "reverb"?: {
163
+ delays?: number[];
164
+ gains?: number[];
165
+ };
166
+ };
167
+ "high-pass"?: {
168
+ cutoffFrequency?: number;
169
+ boostFactor?: number;
170
+ };
171
+ "low-pass"?: {
172
+ cutoffFrequency?: number;
173
+ boostFactor?: number;
174
+ };
175
+ normalization?: {
176
+ maxAmplitude?: number;
177
+ adaptive?: boolean;
178
+ };
179
+ echo?: {
180
+ echoLength?: number;
181
+ decay?: number;
182
+ };
183
+ };
184
+ }
185
+ /**
186
+ * Actual Filter Data sent to Lavalink
187
+ */
188
+ export interface LavalinkFilterData extends FilterData {
189
+ equalizer?: EQBand[];
190
+ }