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
  }
@@ -3,41 +3,96 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Queue = exports.DefaultQueueStore = exports.QueueSaver = void 0;
4
4
  const Utils_1 = require("./Utils");
5
5
  class QueueSaver {
6
+ /**
7
+ * The queue store manager
8
+ */
9
+ _;
10
+ /**
11
+ * The options for the queue saver
12
+ */
13
+ options;
6
14
  constructor(options) {
7
15
  this._ = options?.queueStore || new DefaultQueueStore();
8
16
  this.options = {
9
17
  maxPreviousTracks: options?.maxPreviousTracks || 25,
10
18
  };
11
19
  }
20
+ /**
21
+ * Get the queue for a guild
22
+ * @param guildId The guild ID
23
+ * @returns The queue for the guild
24
+ */
12
25
  async get(guildId) {
13
- return await this._.parse(await this._.get(guildId));
26
+ return this._.parse(await this._.get(guildId));
14
27
  }
28
+ /**
29
+ * Delete the queue for a guild
30
+ * @param guildId The guild ID
31
+ * @returns The queue for the guild
32
+ */
15
33
  async delete(guildId) {
16
- return await this._.delete(guildId);
34
+ return this._.delete(guildId);
17
35
  }
18
- async set(guildId, value) {
19
- return await this._.set(guildId, await this._.stringify(value));
36
+ /**
37
+ * Set the queue for a guild
38
+ * @param guildId The guild ID
39
+ * @param valueToStringify The queue to set
40
+ * @returns The queue for the guild
41
+ */
42
+ async set(guildId, valueToStringify) {
43
+ return this._.set(guildId, await this._.stringify(valueToStringify));
20
44
  }
45
+ /**
46
+ * Sync the queue for a guild
47
+ * @param guildId The guild ID
48
+ * @returns The queue for the guild
49
+ */
21
50
  async sync(guildId) {
22
- return await this.get(guildId);
51
+ return this.get(guildId);
23
52
  }
24
53
  }
25
54
  exports.QueueSaver = QueueSaver;
26
55
  class DefaultQueueStore {
27
56
  data = new Utils_1.MiniMap();
28
57
  constructor() { }
58
+ /**
59
+ * Get the queue for a guild
60
+ * @param guildId The guild ID
61
+ * @returns The queue for the guild
62
+ */
29
63
  async get(guildId) {
30
64
  return await this.data.get(guildId);
31
65
  }
32
- async set(guildId, stringifiedValue) {
33
- return await this.data.set(guildId, stringifiedValue);
66
+ /**
67
+ * Set the queue for a guild
68
+ * @param guildId The guild ID
69
+ * @param valueToStringify The queue to set
70
+ * @returns The queue for the guild
71
+ */
72
+ async set(guildId, valueToStringify) {
73
+ return await this.data.set(guildId, valueToStringify);
34
74
  }
75
+ /**
76
+ * Delete the queue for a guild
77
+ * @param guildId The guild ID
78
+ * @returns The queue for the guild
79
+ */
35
80
  async delete(guildId) {
36
81
  return await this.data.delete(guildId);
37
82
  }
83
+ /**
84
+ * Stringify the queue for a guild
85
+ * @param value The queue to stringify
86
+ * @returns The stringified queue
87
+ */
38
88
  async stringify(value) {
39
89
  return value; // JSON.stringify(value);
40
90
  }
91
+ /**
92
+ * Parse the queue for a guild
93
+ * @param value The queue to parse
94
+ * @returns The parsed queue
95
+ */
41
96
  async parse(value) {
42
97
  return value; // JSON.parse(value)
43
98
  }
@@ -52,6 +107,13 @@ class Queue {
52
107
  QueueSaver = null;
53
108
  managerUtils = new Utils_1.ManagerUtils();
54
109
  queueChanges;
110
+ /**
111
+ * Create a new Queue
112
+ * @param guildId The guild ID
113
+ * @param data The data to initialize the queue with
114
+ * @param QueueSaver The queue saver to use
115
+ * @param queueOptions
116
+ */
55
117
  constructor(guildId, data = {}, QueueSaver, queueOptions) {
56
118
  this.queueChanges = queueOptions.queueChangesWatcher || null;
57
119
  this.guildId = guildId;
@@ -123,7 +185,7 @@ class Queue {
123
185
  if (this.tracks.length <= 1)
124
186
  return this.tracks.length;
125
187
  // swap #1 and #2 if only 2 tracks.
126
- if (this.tracks.length == 2) {
188
+ if (this.tracks.length === 2) {
127
189
  [this.tracks[0], this.tracks[1]] = [this.tracks[1], this.tracks[0]];
128
190
  }
129
191
  else { // randomly swap places.
@@ -197,5 +259,104 @@ class Queue {
197
259
  // return the things
198
260
  return spliced.length === 1 ? spliced[0] : spliced;
199
261
  }
262
+ /**
263
+ * Remove stuff from the queue.tracks array
264
+ * - single Track | UnresolvedTrack
265
+ * - multiple Track | UnresovedTrack
266
+ * - at the index or multiple indexes
267
+ * @param removeQueryTrack
268
+ * @returns null (if nothing was removed) / { removed } where removed is an array with all removed elements
269
+ *
270
+ * @example
271
+ * ```js
272
+ * // remove single track
273
+ *
274
+ * const track = player.queue.tracks[4];
275
+ * await player.queue.remove(track);
276
+ *
277
+ * // if you already have the index you can straight up pass it too
278
+ * await player.queue.remove(4);
279
+ *
280
+ *
281
+ * // if you want to remove multiple tracks, e.g. from position 4 to position 10 you can do smt like this
282
+ * 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
283
+ *
284
+ * // I still highly suggest to use .splice!
285
+ *
286
+ * await player.queue.splice(4, 10); // removes at index 4, 10 tracks
287
+ *
288
+ * await player.queue.splice(1, 1); // removes at index 1, 1 track
289
+ *
290
+ * await player.queue.splice(4, 0, ...tracks) // removes 0 tracks at position 4, and then inserts all tracks after position 4.
291
+ * ```
292
+ */
293
+ async remove(removeQueryTrack) {
294
+ if (typeof removeQueryTrack === "number") {
295
+ const toRemove = this.tracks[removeQueryTrack];
296
+ if (!toRemove)
297
+ return null;
298
+ const removed = this.tracks.splice(removeQueryTrack, 1);
299
+ await this.utils.save();
300
+ return { removed };
301
+ }
302
+ if (Array.isArray(removeQueryTrack)) {
303
+ if (removeQueryTrack.every(v => typeof v === "number")) {
304
+ const removed = [];
305
+ for (const i of removeQueryTrack) {
306
+ if (this.tracks[i])
307
+ removed.push(...this.tracks.splice(i, 1));
308
+ }
309
+ if (!removed.length)
310
+ return null;
311
+ await this.utils.save();
312
+ return { removed };
313
+ }
314
+ const tracksToRemove = this.tracks.map((v, i) => ({ v, i })).filter(({ v, i }) => removeQueryTrack.find(t => typeof t === "number" && (t === i) ||
315
+ typeof t === "object" && (t.encoded && t.encoded === v.encoded ||
316
+ t.info?.identifier && t.info.identifier === v.info?.identifier ||
317
+ t.info?.uri && t.info.uri === v.info?.uri ||
318
+ t.info?.title && t.info.title === v.info?.title ||
319
+ t.info?.isrc && t.info.isrc === v.info?.isrc ||
320
+ t.info?.artworkUrl && t.info.artworkUrl === v.info?.artworkUrl)));
321
+ if (!tracksToRemove.length)
322
+ return null;
323
+ const removed = [];
324
+ for (const { i } of tracksToRemove) {
325
+ if (this.tracks[i])
326
+ removed.push(...this.tracks.splice(i, 1));
327
+ }
328
+ await this.utils.save();
329
+ return { removed };
330
+ }
331
+ const toRemove = this.tracks.findIndex((v) => removeQueryTrack.encoded && removeQueryTrack.encoded === v.encoded ||
332
+ removeQueryTrack.info?.identifier && removeQueryTrack.info.identifier === v.info?.identifier ||
333
+ removeQueryTrack.info?.uri && removeQueryTrack.info.uri === v.info?.uri ||
334
+ removeQueryTrack.info?.title && removeQueryTrack.info.title === v.info?.title ||
335
+ removeQueryTrack.info?.isrc && removeQueryTrack.info.isrc === v.info?.isrc ||
336
+ removeQueryTrack.info?.artworkUrl && removeQueryTrack.info.artworkUrl === v.info?.artworkUrl);
337
+ if (toRemove < 0)
338
+ return null;
339
+ const removed = this.tracks.splice(toRemove, 1);
340
+ await this.utils.save();
341
+ return { removed };
342
+ }
343
+ /**
344
+ * Shifts the previous array, to return the last previous track & thus remove it from the previous queue
345
+ * @returns
346
+ *
347
+ * @example
348
+ * ```js
349
+ * // example on how to play the previous track again
350
+ * const previous = await player.queue.shiftPrevious(); // get the previous track and remove it from the previous queue array!!
351
+ * if(!previous) return console.error("No previous track found");
352
+ * await player.play({ clientTrack: previous }); // play it again
353
+ * ```
354
+ */
355
+ async shiftPrevious() {
356
+ const removed = this.previous.shift();
357
+ if (removed)
358
+ await this.utils.save();
359
+ return removed ?? null;
360
+ }
200
361
  }
201
362
  exports.Queue = Queue;
@@ -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
+ }