lavalink-client 2.2.2 → 2.3.1

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 (111) hide show
  1. package/README.md +95 -1
  2. package/dist/cjs/index.d.ts +8 -1
  3. package/dist/cjs/index.js +8 -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 +8 -232
  9. package/dist/cjs/structures/LavalinkManager.d.ts +31 -166
  10. package/dist/cjs/structures/LavalinkManager.js +59 -7
  11. package/dist/cjs/structures/LavalinkManagerStatics.d.ts +1 -1
  12. package/dist/cjs/structures/Node.d.ts +15 -156
  13. package/dist/cjs/structures/Node.js +131 -49
  14. package/dist/cjs/structures/NodeManager.d.ts +54 -52
  15. package/dist/cjs/structures/NodeManager.js +74 -4
  16. package/dist/cjs/structures/Player.d.ts +31 -124
  17. package/dist/cjs/structures/Player.js +77 -43
  18. package/dist/cjs/structures/Queue.d.ts +66 -42
  19. package/dist/cjs/structures/Queue.js +69 -11
  20. package/dist/cjs/structures/Types/Filters.d.ts +190 -0
  21. package/dist/cjs/structures/Types/Manager.d.ts +184 -0
  22. package/dist/cjs/structures/Types/Manager.js +2 -0
  23. package/dist/cjs/structures/Types/Node.d.ts +216 -0
  24. package/dist/cjs/structures/Types/Node.js +2 -0
  25. package/dist/cjs/structures/Types/Player.d.ts +108 -0
  26. package/dist/cjs/structures/Types/Player.js +2 -0
  27. package/dist/cjs/structures/Types/Queue.d.ts +34 -0
  28. package/dist/cjs/structures/Types/Queue.js +2 -0
  29. package/dist/cjs/structures/{Track.d.ts → Types/Track.d.ts} +3 -2
  30. package/dist/{structures → cjs/structures/Types}/Track.js +2 -2
  31. package/dist/cjs/structures/Types/Utils.d.ts +367 -0
  32. package/dist/cjs/structures/Types/Utils.js +2 -0
  33. package/dist/cjs/structures/Utils.d.ts +13 -369
  34. package/dist/cjs/structures/Utils.js +35 -14
  35. package/dist/esm/index.d.ts +8 -1
  36. package/dist/esm/index.js +8 -1
  37. package/dist/esm/structures/Constants.d.ts +40 -0
  38. package/dist/esm/structures/Constants.js +241 -0
  39. package/dist/esm/structures/CustomSearches/BandCampSearch.d.ts +2 -2
  40. package/dist/esm/structures/Filters.d.ts +2 -217
  41. package/dist/esm/structures/Filters.js +3 -227
  42. package/dist/esm/structures/LavalinkManager.d.ts +31 -166
  43. package/dist/esm/structures/LavalinkManager.js +57 -5
  44. package/dist/esm/structures/LavalinkManagerStatics.d.ts +1 -1
  45. package/dist/esm/structures/Node.d.ts +15 -156
  46. package/dist/esm/structures/Node.js +122 -40
  47. package/dist/esm/structures/NodeManager.d.ts +54 -52
  48. package/dist/esm/structures/NodeManager.js +71 -1
  49. package/dist/esm/structures/Player.d.ts +31 -124
  50. package/dist/esm/structures/Player.js +76 -42
  51. package/dist/esm/structures/Queue.d.ts +66 -42
  52. package/dist/esm/structures/Queue.js +69 -11
  53. package/dist/esm/structures/Types/Filters.d.ts +190 -0
  54. package/dist/esm/structures/Types/Manager.d.ts +184 -0
  55. package/dist/esm/structures/Types/Manager.js +1 -0
  56. package/dist/esm/structures/Types/Node.d.ts +216 -0
  57. package/dist/esm/structures/Types/Node.js +1 -0
  58. package/dist/esm/structures/Types/Player.d.ts +108 -0
  59. package/dist/esm/structures/Types/Player.js +1 -0
  60. package/dist/esm/structures/Types/Queue.d.ts +34 -0
  61. package/dist/esm/structures/Types/Queue.js +1 -0
  62. package/dist/esm/structures/{Track.d.ts → Types/Track.d.ts} +3 -2
  63. package/dist/esm/structures/Types/Track.js +1 -0
  64. package/dist/esm/structures/Types/Utils.d.ts +367 -0
  65. package/dist/esm/structures/Types/Utils.js +1 -0
  66. package/dist/esm/structures/Utils.d.ts +13 -369
  67. package/dist/esm/structures/Utils.js +35 -14
  68. package/dist/types/index.d.ts +8 -1
  69. package/dist/types/structures/Constants.d.ts +40 -0
  70. package/dist/types/structures/CustomSearches/BandCampSearch.d.ts +2 -2
  71. package/dist/types/structures/Filters.d.ts +2 -217
  72. package/dist/types/structures/LavalinkManager.d.ts +31 -166
  73. package/dist/types/structures/LavalinkManagerStatics.d.ts +1 -1
  74. package/dist/types/structures/Node.d.ts +15 -156
  75. package/dist/types/structures/NodeManager.d.ts +54 -52
  76. package/dist/types/structures/Player.d.ts +31 -124
  77. package/dist/types/structures/Queue.d.ts +66 -42
  78. package/dist/types/structures/Types/Filters.d.ts +190 -0
  79. package/dist/types/structures/Types/Manager.d.ts +184 -0
  80. package/dist/types/structures/Types/Node.d.ts +216 -0
  81. package/dist/types/structures/Types/Player.d.ts +108 -0
  82. package/dist/types/structures/Types/Queue.d.ts +34 -0
  83. package/dist/types/structures/{Track.d.ts → Types/Track.d.ts} +3 -2
  84. package/dist/types/structures/Types/Utils.d.ts +367 -0
  85. package/dist/types/structures/Utils.d.ts +13 -369
  86. package/package.json +1 -1
  87. package/dist/index.d.ts +0 -10
  88. package/dist/index.js +0 -13
  89. package/dist/structures/Filters.d.ts +0 -230
  90. package/dist/structures/Filters.js +0 -472
  91. package/dist/structures/LavalinkManager.d.ts +0 -47
  92. package/dist/structures/LavalinkManager.js +0 -36
  93. package/dist/structures/LavalinkManagerStatics.d.ts +0 -3
  94. package/dist/structures/LavalinkManagerStatics.js +0 -76
  95. package/dist/structures/Node.d.ts +0 -171
  96. package/dist/structures/Node.js +0 -462
  97. package/dist/structures/NodeManager.d.ts +0 -58
  98. package/dist/structures/NodeManager.js +0 -25
  99. package/dist/structures/Player.d.ts +0 -101
  100. package/dist/structures/Player.js +0 -232
  101. package/dist/structures/PlayerManager.d.ts +0 -62
  102. package/dist/structures/PlayerManager.js +0 -26
  103. package/dist/structures/Queue.d.ts +0 -93
  104. package/dist/structures/Queue.js +0 -160
  105. package/dist/structures/QueueManager.d.ts +0 -77
  106. package/dist/structures/QueueManager.js +0 -74
  107. package/dist/structures/Track.d.ts +0 -27
  108. package/dist/structures/Utils.d.ts +0 -183
  109. package/dist/structures/Utils.js +0 -43
  110. /package/dist/cjs/structures/{Track.js → Types/Filters.js} +0 -0
  111. /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
@@ -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;
@@ -235,7 +297,6 @@ class Queue {
235
297
  return null;
236
298
  const removed = this.tracks.splice(removeQueryTrack, 1);
237
299
  await this.utils.save();
238
- console.log("0st", removed, toRemove);
239
300
  return { removed };
240
301
  }
241
302
  if (Array.isArray(removeQueryTrack)) {
@@ -245,7 +306,6 @@ class Queue {
245
306
  if (this.tracks[i])
246
307
  removed.push(...this.tracks.splice(i, 1));
247
308
  }
248
- console.log("1st", removed, removeQueryTrack);
249
309
  if (!removed.length)
250
310
  return null;
251
311
  await this.utils.save();
@@ -266,7 +326,6 @@ class Queue {
266
326
  removed.push(...this.tracks.splice(i, 1));
267
327
  }
268
328
  await this.utils.save();
269
- console.log("2nd", removed, tracksToRemove);
270
329
  return { removed };
271
330
  }
272
331
  const toRemove = this.tracks.findIndex((v) => removeQueryTrack.encoded && removeQueryTrack.encoded === v.encoded ||
@@ -279,7 +338,6 @@ class Queue {
279
338
  return null;
280
339
  const removed = this.tracks.splice(toRemove, 1);
281
340
  await this.utils.save();
282
- console.log("3rd", removed, toRemove);
283
341
  return { removed };
284
342
  }
285
343
  /**
@@ -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
+ }
@@ -0,0 +1,184 @@
1
+ import type { Player } from "../Player";
2
+ import type { LavalinkNodeOptions } from "./Node";
3
+ import type { DestroyReasonsType, PlayerJson } from "./Player";
4
+ import type { ManagerQueueOptions } from "./Queue";
5
+ import type { Track, UnresolvedTrack } from "./Track";
6
+ import type { GuildShardPayload, SearchPlatform, SponsorBlockChaptersLoaded, SponsorBlockChapterStarted, SponsorBlockSegmentSkipped, SponsorBlockSegmentsLoaded, TrackExceptionEvent, TrackEndEvent, TrackStuckEvent, WebSocketClosedEvent, TrackStartEvent } from "./Utils";
7
+ /**
8
+ * The events from the lavalink Manager
9
+ */
10
+ export interface LavalinkManagerEvents {
11
+ /**
12
+ * Emitted when a Track started playing.
13
+ * @event Manager#trackStart
14
+ */
15
+ "trackStart": (player: Player, track: Track | null, payload: TrackStartEvent) => void;
16
+ /**
17
+ * Emitted when a Track finished.
18
+ * @event Manager#trackEnd
19
+ */
20
+ "trackEnd": (player: Player, track: Track | null, payload: TrackEndEvent) => void;
21
+ /**
22
+ * Emitted when a Track got stuck while playing.
23
+ * @event Manager#trackStuck
24
+ */
25
+ "trackStuck": (player: Player, track: Track | null, payload: TrackStuckEvent) => void;
26
+ /**
27
+ * Emitted when a Track errored.
28
+ * @event Manager#trackError
29
+ */
30
+ "trackError": (player: Player, track: Track | UnresolvedTrack | null, payload: TrackExceptionEvent) => void;
31
+ /**
32
+ * Emitted when the Playing finished and no more tracks in the queue.
33
+ * @event Manager#queueEnd
34
+ */
35
+ "queueEnd": (player: Player, track: Track | UnresolvedTrack | null, payload: TrackEndEvent | TrackStuckEvent | TrackExceptionEvent) => void;
36
+ /**
37
+ * Emitted when a Player is created.
38
+ * @event Manager#playerCreate
39
+ */
40
+ "playerCreate": (player: Player) => void;
41
+ /**
42
+ * Emitted when a Player is moved within the channel.
43
+ * @event Manager#playerMove
44
+ */
45
+ "playerMove": (player: Player, oldVoiceChannelId: string, newVoiceChannelId: string) => void;
46
+ /**
47
+ * Emitted when a Player is disconnected from a channel.
48
+ * @event Manager#playerDisconnect
49
+ */
50
+ "playerDisconnect": (player: Player, voiceChannelId: string) => void;
51
+ /**
52
+ * Emitted when a Node-Socket got closed for a specific Player.
53
+ * Usually emits when the audio websocket to discord is closed, This can happen for various reasons (normal and abnormal), e.g. when using an expired voice server update. 4xxx codes are usually bad.
54
+ *
55
+ * So this is just information, normally lavalink should handle disconnections
56
+ *
57
+ * Discord Docs:
58
+ * @link https://discord.com/developers/docs/topics/opcodes-and-status-codes#voice-voice-close-event-codes
59
+ *
60
+ * Lavalink Docs:
61
+ * @link https://lavalink.dev/api/websocket.html#websocketclosedevent
62
+ * @event Manager#playerSocketClosed
63
+ */
64
+ "playerSocketClosed": (player: Player, payload: WebSocketClosedEvent) => void;
65
+ /**
66
+ * Emitted when a Player get's destroyed
67
+ * @event Manager#playerDestroy
68
+ */
69
+ "playerDestroy": (player: Player, destroyReason?: DestroyReasonsType) => void;
70
+ /**
71
+ * Always emits when the player (on lavalink side) got updated
72
+ * @event Manager#playerUpdate
73
+ */
74
+ "playerUpdate": (oldPlayerJson: PlayerJson, newPlayer: Player) => void;
75
+ /**
76
+ * SPONSORBLOCK-PLUGIN EVENT
77
+ * Emitted when Segments are loaded
78
+ * @link https://github.com/topi314/Sponsorblock-Plugin#segmentsloaded
79
+ * @event Manager#trackError
80
+ */
81
+ "SegmentsLoaded": (player: Player, track: Track | UnresolvedTrack | null, payload: SponsorBlockSegmentsLoaded) => void;
82
+ /**
83
+ * SPONSORBLOCK-PLUGIN EVENT
84
+ * Emitted when a specific Segment was skipped
85
+ * @link https://github.com/topi314/Sponsorblock-Plugin#segmentskipped
86
+ * @event Manager#trackError
87
+ */
88
+ "SegmentSkipped": (player: Player, track: Track | UnresolvedTrack | null, payload: SponsorBlockSegmentSkipped) => void;
89
+ /**
90
+ * SPONSORBLOCK-PLUGIN EVENT
91
+ * Emitted when a specific Chapter starts playing
92
+ * @link https://github.com/topi314/Sponsorblock-Plugin#chapterstarted
93
+ * @event Manager#trackError
94
+ */
95
+ "ChapterStarted": (player: Player, track: Track | UnresolvedTrack | null, payload: SponsorBlockChapterStarted) => void;
96
+ /**
97
+ * SPONSORBLOCK-PLUGIN EVENT
98
+ * Emitted when Chapters are loaded
99
+ * @link https://github.com/topi314/Sponsorblock-Plugin#chaptersloaded
100
+ * @event Manager#trackError
101
+ */
102
+ "ChaptersLoaded": (player: Player, track: Track | UnresolvedTrack | null, payload: SponsorBlockChaptersLoaded) => void;
103
+ }
104
+ /**
105
+ * The Bot client Options needed for the manager
106
+ */
107
+ export interface BotClientOptions {
108
+ /** Bot Client Id */
109
+ id: string;
110
+ /** Bot Client Username */
111
+ username?: string;
112
+ /** So users can pass entire objects / classes */
113
+ [x: string | number | symbol]: unknown;
114
+ }
115
+ /** Sub Manager Options, for player specific things */
116
+ export interface ManagerPlayerOptions {
117
+ /** If the Lavalink Volume should be decremented by x number */
118
+ volumeDecrementer?: number;
119
+ /** How often it should update the the player Position */
120
+ clientBasedPositionUpdateInterval?: number;
121
+ /** What should be used as a searchPlatform, if no source was provided during the query */
122
+ defaultSearchPlatform?: SearchPlatform;
123
+ /** Applies the volume via a filter, not via the lavalink volume transformer */
124
+ applyVolumeAsFilter?: boolean;
125
+ /** Transforms the saved data of a requested user */
126
+ requesterTransformer?: (requester: unknown) => unknown;
127
+ /** What lavalink-client should do when the player reconnects */
128
+ onDisconnect?: {
129
+ /** Try to reconnect? -> If fails -> Destroy */
130
+ autoReconnect?: boolean;
131
+ /** Instantly destroy player (overrides autoReconnect) | Don't provide == disable feature*/
132
+ destroyPlayer?: boolean;
133
+ };
134
+ onEmptyQueue?: {
135
+ /** Get's executed onEmptyQueue -> You can do any track queue previous transformations, if you add a track to the queue -> it will play it, if not queueEnd will execute! */
136
+ autoPlayFunction?: (player: Player, lastPlayedTrack: Track) => Promise<void>;
137
+ destroyAfterMs?: number;
138
+ };
139
+ useUnresolvedData?: boolean;
140
+ }
141
+ /** Manager Options used to create the manager */
142
+ export interface ManagerOptions {
143
+ /** The Node Options, for all Nodes! (on init) */
144
+ nodes: LavalinkNodeOptions[];
145
+ /** @async The Function to send the voice connection changes from Lavalink to Discord */
146
+ sendToShard: (guildId: string, payload: GuildShardPayload) => void;
147
+ /** The Bot Client's Data for Authorization */
148
+ client?: BotClientOptions;
149
+ /** QueueOptions for all Queues */
150
+ queueOptions?: ManagerQueueOptions;
151
+ /** PlayerOptions for all Players */
152
+ playerOptions?: ManagerPlayerOptions;
153
+ /** If it should skip to the next Track on TrackEnd / TrackError etc. events */
154
+ autoSkip?: boolean;
155
+ /** If it should skip to the next Track if track.resolve errors while trying to play a track. */
156
+ autoSkipOnResolveError?: boolean;
157
+ /** If it should emit only new (unique) songs and not when a looping track (or similar) is plaid, default false */
158
+ emitNewSongsOnly?: boolean;
159
+ /** Only allow link requests with links either matching some of that regExp or including some of that string */
160
+ linksWhitelist?: (RegExp | string)[];
161
+ /** Never allow link requests with links either matching some of that regExp or including some of that string (doesn't even allow if it's whitelisted) */
162
+ linksBlacklist?: (RegExp | string)[];
163
+ /** If links should be allowed or not. If set to false, it will throw an error if a link was provided. */
164
+ linksAllowed?: boolean;
165
+ /** Advanced Options for the Library, which may or may not be "library breaking" */
166
+ advancedOptions?: {
167
+ /** Max duration for that the filter fix duration works (in ms) - default is 8mins */
168
+ maxFilterFixDuration?: number;
169
+ /** optional */
170
+ debugOptions?: {
171
+ /** For logging custom searches */
172
+ logCustomSearches?: boolean;
173
+ /** logs for debugging the "no-Audio" playing error */
174
+ noAudio?: boolean;
175
+ /** For Logging the Destroy function */
176
+ playerDestroy?: {
177
+ /** To show the debug reason at all times. */
178
+ debugLog?: boolean;
179
+ /** If you get 'Error: Use Player#destroy("reason") not LavalinkManager#deletePlayer() to stop the Player' put it on true */
180
+ dontThrowError?: boolean;
181
+ };
182
+ };
183
+ };
184
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });