lavalink-client 2.2.2 → 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.
- package/README.md +95 -1
- package/dist/cjs/index.d.ts +7 -1
- package/dist/cjs/index.js +7 -1
- package/dist/cjs/structures/Constants.d.ts +40 -0
- package/dist/cjs/structures/Constants.js +244 -0
- package/dist/cjs/structures/CustomSearches/BandCampSearch.d.ts +2 -2
- package/dist/cjs/structures/Filters.d.ts +2 -217
- package/dist/cjs/structures/Filters.js +8 -232
- package/dist/cjs/structures/LavalinkManager.d.ts +31 -166
- package/dist/cjs/structures/LavalinkManager.js +59 -7
- package/dist/cjs/structures/LavalinkManagerStatics.d.ts +1 -1
- package/dist/cjs/structures/Node.d.ts +15 -156
- package/dist/cjs/structures/Node.js +131 -49
- package/dist/cjs/structures/NodeManager.d.ts +54 -52
- package/dist/cjs/structures/NodeManager.js +74 -4
- package/dist/cjs/structures/Player.d.ts +31 -124
- package/dist/cjs/structures/Player.js +77 -43
- package/dist/cjs/structures/Queue.d.ts +66 -42
- package/dist/cjs/structures/Queue.js +69 -11
- package/dist/cjs/structures/Types/Filters.d.ts +190 -0
- package/dist/cjs/structures/Types/Manager.d.ts +184 -0
- package/dist/cjs/structures/Types/Manager.js +2 -0
- package/dist/cjs/structures/Types/Node.d.ts +216 -0
- package/dist/cjs/structures/Types/Node.js +2 -0
- package/dist/cjs/structures/Types/Player.d.ts +108 -0
- package/dist/cjs/structures/Types/Player.js +2 -0
- package/dist/cjs/structures/Types/Queue.d.ts +34 -0
- package/dist/cjs/structures/Types/Queue.js +2 -0
- package/dist/cjs/structures/{Track.d.ts → Types/Track.d.ts} +3 -2
- package/dist/cjs/structures/Types/Track.js +2 -0
- package/dist/cjs/structures/Types/Utils.d.ts +367 -0
- package/dist/cjs/structures/Types/Utils.js +2 -0
- package/dist/cjs/structures/Utils.d.ts +13 -369
- package/dist/cjs/structures/Utils.js +35 -14
- package/dist/esm/index.d.ts +7 -1
- package/dist/esm/index.js +7 -1
- package/dist/esm/structures/Constants.d.ts +40 -0
- package/dist/esm/structures/Constants.js +241 -0
- package/dist/esm/structures/CustomSearches/BandCampSearch.d.ts +2 -2
- package/dist/esm/structures/Filters.d.ts +2 -217
- package/dist/esm/structures/Filters.js +3 -227
- package/dist/esm/structures/LavalinkManager.d.ts +31 -166
- package/dist/esm/structures/LavalinkManager.js +57 -5
- package/dist/esm/structures/LavalinkManagerStatics.d.ts +1 -1
- package/dist/esm/structures/Node.d.ts +15 -156
- package/dist/esm/structures/Node.js +122 -40
- package/dist/esm/structures/NodeManager.d.ts +54 -52
- package/dist/esm/structures/NodeManager.js +71 -1
- package/dist/esm/structures/Player.d.ts +31 -124
- package/dist/esm/structures/Player.js +76 -42
- package/dist/esm/structures/Queue.d.ts +66 -42
- package/dist/esm/structures/Queue.js +69 -11
- package/dist/esm/structures/Types/Filters.d.ts +190 -0
- package/dist/esm/structures/Types/Manager.d.ts +184 -0
- package/dist/esm/structures/Types/Manager.js +1 -0
- package/dist/esm/structures/Types/Node.d.ts +216 -0
- package/dist/esm/structures/Types/Node.js +1 -0
- package/dist/esm/structures/Types/Player.d.ts +108 -0
- package/dist/esm/structures/Types/Player.js +1 -0
- package/dist/esm/structures/Types/Queue.d.ts +34 -0
- package/dist/esm/structures/Types/Queue.js +1 -0
- package/dist/{types/structures → esm/structures/Types}/Track.d.ts +3 -2
- package/dist/esm/structures/Types/Track.js +1 -0
- package/dist/esm/structures/Types/Utils.d.ts +367 -0
- package/dist/esm/structures/Types/Utils.js +1 -0
- package/dist/esm/structures/Utils.d.ts +13 -369
- package/dist/esm/structures/Utils.js +35 -14
- package/dist/types/index.d.ts +7 -1
- package/dist/types/structures/Constants.d.ts +40 -0
- package/dist/types/structures/CustomSearches/BandCampSearch.d.ts +2 -2
- package/dist/types/structures/Filters.d.ts +2 -217
- package/dist/types/structures/LavalinkManager.d.ts +31 -166
- package/dist/types/structures/LavalinkManagerStatics.d.ts +1 -1
- package/dist/types/structures/Node.d.ts +15 -156
- package/dist/types/structures/NodeManager.d.ts +54 -52
- package/dist/types/structures/Player.d.ts +31 -124
- package/dist/types/structures/Queue.d.ts +66 -42
- package/dist/types/structures/Types/Filters.d.ts +190 -0
- package/dist/types/structures/Types/Manager.d.ts +184 -0
- package/dist/types/structures/Types/Node.d.ts +216 -0
- package/dist/types/structures/Types/Player.d.ts +108 -0
- package/dist/types/structures/Types/Queue.d.ts +34 -0
- package/dist/{esm/structures → types/structures/Types}/Track.d.ts +3 -2
- package/dist/types/structures/Types/Utils.d.ts +367 -0
- package/dist/types/structures/Utils.d.ts +13 -369
- package/package.json +1 -1
- /package/dist/cjs/structures/{Track.js → Types/Filters.js} +0 -0
- /package/dist/esm/structures/{Track.js → Types/Filters.js} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Player } from "./Player";
|
|
2
|
-
import {
|
|
1
|
+
import type { Player } from "./Player";
|
|
2
|
+
import type { AudioOutputs, EQBand, FilterData, PlayerFilters, TimescaleFilter } from "./Types/Filters";
|
|
3
3
|
/**
|
|
4
4
|
* The FilterManager for each player
|
|
5
5
|
*/
|
|
@@ -143,218 +143,3 @@ export declare class FilterManager {
|
|
|
143
143
|
/** Clears the equalizer bands. */
|
|
144
144
|
clearEQ(): Promise<this>;
|
|
145
145
|
}
|
|
146
|
-
/** The Audio Outputs type */
|
|
147
|
-
export type AudioOutputs = "mono" | "stereo" | "left" | "right";
|
|
148
|
-
/** The audio Outputs Data map declaration */
|
|
149
|
-
export declare const audioOutputsData: Record<AudioOutputs, ChannelMixFilter>;
|
|
150
|
-
/** The "active" / "disabled" Player Filters */
|
|
151
|
-
export interface PlayerFilters {
|
|
152
|
-
/** Sets nightcore to false, and vaporwave to false */
|
|
153
|
-
custom: boolean;
|
|
154
|
-
/** Sets custom to false, and vaporwave to false */
|
|
155
|
-
nightcore: boolean;
|
|
156
|
-
/** Sets custom to false, and nightcore to false */
|
|
157
|
-
vaporwave: boolean;
|
|
158
|
-
/** If rotation filter is enabled / not */
|
|
159
|
-
rotation: boolean;
|
|
160
|
-
/** if karaoke filter is enabled / not */
|
|
161
|
-
karaoke: boolean;
|
|
162
|
-
/** if tremolo filter is enabled / not */
|
|
163
|
-
tremolo: boolean;
|
|
164
|
-
/** if vibrato filter is enabled / not */
|
|
165
|
-
vibrato: boolean;
|
|
166
|
-
lowPass: boolean;
|
|
167
|
-
/** audio Output (default stereo, mono sounds the fullest and best for not-stereo tracks) */
|
|
168
|
-
audioOutput: AudioOutputs;
|
|
169
|
-
/** Lavalink Volume FILTER (not player Volume, think of it as a gain booster) */
|
|
170
|
-
volume: boolean;
|
|
171
|
-
/** Filters for the Lavalink Filter Plugin */
|
|
172
|
-
lavalinkFilterPlugin: {
|
|
173
|
-
/** if echo filter is enabled / not */
|
|
174
|
-
echo: boolean;
|
|
175
|
-
/** if reverb filter is enabled / not */
|
|
176
|
-
reverb: boolean;
|
|
177
|
-
};
|
|
178
|
-
lavalinkLavaDspxPlugin: {
|
|
179
|
-
/** if lowPass filter is enabled / not */
|
|
180
|
-
lowPass: boolean;
|
|
181
|
-
/** if highPass filter is enabled / not */
|
|
182
|
-
highPass: boolean;
|
|
183
|
-
/** if normalization filter is enabled / not */
|
|
184
|
-
normalization: boolean;
|
|
185
|
-
/** if echo filter is enabled / not */
|
|
186
|
-
echo: boolean;
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
|
-
/**
|
|
190
|
-
* There are 15 bands (0-14) that can be changed.
|
|
191
|
-
* "gain" is the multiplier for the given band.
|
|
192
|
-
* The default value is 0.
|
|
193
|
-
* 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.
|
|
194
|
-
* Modifying the gain could also change the volume of the output.
|
|
195
|
-
*/
|
|
196
|
-
export interface EQBand {
|
|
197
|
-
/** On what band position (0-14) it should work */
|
|
198
|
-
band: IntegerNumber | number;
|
|
199
|
-
/** The gain (-0.25 to 1.0) */
|
|
200
|
-
gain: FloatNumber | number;
|
|
201
|
-
}
|
|
202
|
-
/**
|
|
203
|
-
* Uses equalization to eliminate part of a band, usually targeting vocals.
|
|
204
|
-
*/
|
|
205
|
-
export interface KaraokeFilter {
|
|
206
|
-
/** The level (0 to 1.0 where 0.0 is no effect and 1.0 is full effect) */
|
|
207
|
-
level?: number;
|
|
208
|
-
/** The mono level (0 to 1.0 where 0.0 is no effect and 1.0 is full effect) */
|
|
209
|
-
monoLevel?: number;
|
|
210
|
-
/** The filter band (in Hz) */
|
|
211
|
-
filterBand?: number;
|
|
212
|
-
/** The filter width */
|
|
213
|
-
filterWidth?: number;
|
|
214
|
-
}
|
|
215
|
-
/**
|
|
216
|
-
* Changes the speed, pitch, and rate
|
|
217
|
-
*/
|
|
218
|
-
export interface TimescaleFilter {
|
|
219
|
-
/** The playback speed 0.0 ≤ x */
|
|
220
|
-
speed?: number;
|
|
221
|
-
/** The pitch 0.0 ≤ x */
|
|
222
|
-
pitch?: number;
|
|
223
|
-
/** The rate 0.0 ≤ x */
|
|
224
|
-
rate?: number;
|
|
225
|
-
}
|
|
226
|
-
/**
|
|
227
|
-
* Uses amplification to create a shuddering effect, where the volume quickly oscillates.
|
|
228
|
-
* Demo: https://en.wikipedia.org/wiki/File:Fuse_Electronics_Tremolo_MK-III_Quick_Demo.ogv
|
|
229
|
-
*/
|
|
230
|
-
export interface TremoloFilter {
|
|
231
|
-
/** The frequency 0.0 < x */
|
|
232
|
-
frequency?: number;
|
|
233
|
-
/** The tremolo depth 0.0 < x ≤ 1.0 */
|
|
234
|
-
depth?: number;
|
|
235
|
-
}
|
|
236
|
-
/**
|
|
237
|
-
* Similar to tremolo. While tremolo oscillates the volume, vibrato oscillates the pitch.
|
|
238
|
-
*/
|
|
239
|
-
export interface VibratoFilter {
|
|
240
|
-
/** The frequency 0.0 < x ≤ 14.0 */
|
|
241
|
-
frequency?: number;
|
|
242
|
-
/** The vibrato depth 0.0 < x ≤ 1.0 */
|
|
243
|
-
depth?: number;
|
|
244
|
-
}
|
|
245
|
-
/**
|
|
246
|
-
* Rotates the sound around the stereo channels/user headphones (aka Audio Panning).
|
|
247
|
-
* It can produce an effect similar to https://youtu.be/QB9EB8mTKcc (without the reverb).
|
|
248
|
-
*/
|
|
249
|
-
export interface RotationFilter {
|
|
250
|
-
/** The frequency of the audio rotating around the listener in Hz. 0.2 is similar to the example video above */
|
|
251
|
-
rotationHz?: number;
|
|
252
|
-
}
|
|
253
|
-
/**
|
|
254
|
-
* Distortion effect. It can generate some pretty unique audio effects.
|
|
255
|
-
*/
|
|
256
|
-
export interface DistortionFilter {
|
|
257
|
-
sinOffset?: number;
|
|
258
|
-
sinScale?: number;
|
|
259
|
-
cosOffset?: number;
|
|
260
|
-
cosScale?: number;
|
|
261
|
-
tanOffset?: number;
|
|
262
|
-
tanScale?: number;
|
|
263
|
-
offset?: number;
|
|
264
|
-
scale?: number;
|
|
265
|
-
}
|
|
266
|
-
/**
|
|
267
|
-
* Mixes both channels (left and right), with a configurable factor on how much each channel affects the other.
|
|
268
|
-
* With the defaults, both channels are kept independent of each other.
|
|
269
|
-
* Setting all factors to 0.5 means both channels get the same audio.
|
|
270
|
-
*/
|
|
271
|
-
export interface ChannelMixFilter {
|
|
272
|
-
/** The left to left channel mix factor (0.0 ≤ x ≤ 1.0) */
|
|
273
|
-
leftToLeft?: number;
|
|
274
|
-
/** The left to right channel mix factor (0.0 ≤ x ≤ 1.0) */
|
|
275
|
-
leftToRight?: number;
|
|
276
|
-
/** The right to left channel mix factor (0.0 ≤ x ≤ 1.0) */
|
|
277
|
-
rightToLeft?: number;
|
|
278
|
-
/** The right to right channel mix factor (0.0 ≤ x ≤ 1.0) */
|
|
279
|
-
rightToRight?: number;
|
|
280
|
-
}
|
|
281
|
-
/**
|
|
282
|
-
* Higher frequencies get suppressed, while lower frequencies pass through this filter, thus the name low pass.
|
|
283
|
-
* Any smoothing values equal to or less than 1.0 will disable the filter.
|
|
284
|
-
*/
|
|
285
|
-
export interface LowPassFilter {
|
|
286
|
-
/** The smoothing factor (1.0 < x) */
|
|
287
|
-
smoothing?: number;
|
|
288
|
-
}
|
|
289
|
-
/**
|
|
290
|
-
* Filter Data stored in the Client and partially sent to Lavalink
|
|
291
|
-
*/
|
|
292
|
-
export interface FilterData {
|
|
293
|
-
volume?: number;
|
|
294
|
-
karaoke?: KaraokeFilter;
|
|
295
|
-
timescale?: TimescaleFilter;
|
|
296
|
-
tremolo?: TremoloFilter;
|
|
297
|
-
vibrato?: VibratoFilter;
|
|
298
|
-
rotation?: RotationFilter;
|
|
299
|
-
distortion?: DistortionFilter;
|
|
300
|
-
channelMix?: ChannelMixFilter;
|
|
301
|
-
lowPass?: LowPassFilter;
|
|
302
|
-
pluginFilters?: {
|
|
303
|
-
"lavalink-filter-plugin"?: {
|
|
304
|
-
"echo"?: {
|
|
305
|
-
delay?: number;
|
|
306
|
-
decay?: number;
|
|
307
|
-
};
|
|
308
|
-
"reverb"?: {
|
|
309
|
-
delays?: number[];
|
|
310
|
-
gains?: number[];
|
|
311
|
-
};
|
|
312
|
-
};
|
|
313
|
-
"high-pass"?: {
|
|
314
|
-
cutoffFrequency?: number;
|
|
315
|
-
boostFactor?: number;
|
|
316
|
-
};
|
|
317
|
-
"low-pass"?: {
|
|
318
|
-
cutoffFrequency?: number;
|
|
319
|
-
boostFactor?: number;
|
|
320
|
-
};
|
|
321
|
-
normalization?: {
|
|
322
|
-
maxAmplitude?: number;
|
|
323
|
-
adaptive?: boolean;
|
|
324
|
-
};
|
|
325
|
-
echo?: {
|
|
326
|
-
echoLength?: number;
|
|
327
|
-
decay?: number;
|
|
328
|
-
};
|
|
329
|
-
};
|
|
330
|
-
}
|
|
331
|
-
/**
|
|
332
|
-
* Actual Filter Data sent to Lavalink
|
|
333
|
-
*/
|
|
334
|
-
export interface LavalinkFilterData extends FilterData {
|
|
335
|
-
equalizer?: EQBand[];
|
|
336
|
-
}
|
|
337
|
-
export declare const EQList: {
|
|
338
|
-
/** A Bassboost Equalizer, so high it distorts the audio */
|
|
339
|
-
BassboostEarrape: EQBand[];
|
|
340
|
-
/** A High and decent Bassboost Equalizer */
|
|
341
|
-
BassboostHigh: EQBand[];
|
|
342
|
-
/** A decent Bassboost Equalizer */
|
|
343
|
-
BassboostMedium: EQBand[];
|
|
344
|
-
/** A slight Bassboost Equalizer */
|
|
345
|
-
BassboostLow: EQBand[];
|
|
346
|
-
/** Makes the Music slightly "better" */
|
|
347
|
-
BetterMusic: EQBand[];
|
|
348
|
-
/** Makes the Music sound like rock music / sound rock music better */
|
|
349
|
-
Rock: EQBand[];
|
|
350
|
-
/** Makes the Music sound like Classic music / sound Classic music better */
|
|
351
|
-
Classic: EQBand[];
|
|
352
|
-
/** Makes the Music sound like Pop music / sound Pop music better */
|
|
353
|
-
Pop: EQBand[];
|
|
354
|
-
/** Makes the Music sound like Electronic music / sound Electronic music better */
|
|
355
|
-
Electronic: EQBand[];
|
|
356
|
-
/** Boosts all Bands slightly for louder and fuller sound */
|
|
357
|
-
FullSound: EQBand[];
|
|
358
|
-
/** Boosts basses + lower highs for a pro gaming sound */
|
|
359
|
-
Gaming: EQBand[];
|
|
360
|
-
};
|
|
@@ -1,182 +1,47 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { EventEmitter } from "events";
|
|
3
|
-
import { LavalinkNodeOptions } from "./Node";
|
|
4
3
|
import { NodeManager } from "./NodeManager";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
export
|
|
11
|
-
/** Bot Client Id */
|
|
12
|
-
id: string;
|
|
13
|
-
/** Bot Client Username */
|
|
14
|
-
username?: string;
|
|
15
|
-
/** So users can pass entire objects / classes */
|
|
16
|
-
[x: string | number | symbol]: unknown;
|
|
17
|
-
}
|
|
18
|
-
/** Sub Manager Options, for player specific things */
|
|
19
|
-
export interface ManagerPlayerOptions {
|
|
20
|
-
/** If the Lavalink Volume should be decremented by x number */
|
|
21
|
-
volumeDecrementer?: number;
|
|
22
|
-
/** How often it should update the the player Position */
|
|
23
|
-
clientBasedPositionUpdateInterval?: number;
|
|
24
|
-
/** What should be used as a searchPlatform, if no source was provided during the query */
|
|
25
|
-
defaultSearchPlatform?: SearchPlatform;
|
|
26
|
-
/** Applies the volume via a filter, not via the lavalink volume transformer */
|
|
27
|
-
applyVolumeAsFilter?: boolean;
|
|
28
|
-
/** Transforms the saved data of a requested user */
|
|
29
|
-
requesterTransformer?: (requester: unknown) => unknown;
|
|
30
|
-
/** What lavalink-client should do when the player reconnects */
|
|
31
|
-
onDisconnect?: {
|
|
32
|
-
/** Try to reconnect? -> If fails -> Destroy */
|
|
33
|
-
autoReconnect?: boolean;
|
|
34
|
-
/** Instantly destroy player (overrides autoReconnect) | Don't provide == disable feature*/
|
|
35
|
-
destroyPlayer?: boolean;
|
|
36
|
-
};
|
|
37
|
-
onEmptyQueue?: {
|
|
38
|
-
/** 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! */
|
|
39
|
-
autoPlayFunction?: (player: Player, lastPlayedTrack: Track) => Promise<void>;
|
|
40
|
-
destroyAfterMs?: number;
|
|
41
|
-
};
|
|
42
|
-
useUnresolvedData?: boolean;
|
|
43
|
-
}
|
|
44
|
-
/** Manager Options used to create the manager */
|
|
45
|
-
export interface ManagerOptions {
|
|
46
|
-
/** The Node Options, for all Nodes! (on init) */
|
|
47
|
-
nodes: LavalinkNodeOptions[];
|
|
48
|
-
/** @async The Function to send the voice connection changes from Lavalink to Discord */
|
|
49
|
-
sendToShard: (guildId: string, payload: GuildShardPayload) => void;
|
|
50
|
-
/** The Bot Client's Data for Authorization */
|
|
51
|
-
client?: BotClientOptions;
|
|
52
|
-
/** QueueOptions for all Queues */
|
|
53
|
-
queueOptions?: ManagerQueueOptions;
|
|
54
|
-
/** PlayerOptions for all Players */
|
|
55
|
-
playerOptions?: ManagerPlayerOptions;
|
|
56
|
-
/** If it should skip to the next Track on TrackEnd / TrackError etc. events */
|
|
57
|
-
autoSkip?: boolean;
|
|
58
|
-
/** If it should skip to the next Track if track.resolve errors while trying to play a track. */
|
|
59
|
-
autoSkipOnResolveError?: boolean;
|
|
60
|
-
/** If it should emit only new (unique) songs and not when a looping track (or similar) is plaid, default false */
|
|
61
|
-
emitNewSongsOnly?: boolean;
|
|
62
|
-
/** Only allow link requests with links either matching some of that regExp or including some of that string */
|
|
63
|
-
linksWhitelist?: (RegExp | string)[];
|
|
64
|
-
/** 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) */
|
|
65
|
-
linksBlacklist?: (RegExp | string)[];
|
|
66
|
-
/** If links should be allowed or not. If set to false, it will throw an error if a link was provided. */
|
|
67
|
-
linksAllowed?: boolean;
|
|
68
|
-
/** Advanced Options for the Library, which may or may not be "library breaking" */
|
|
69
|
-
advancedOptions?: {
|
|
70
|
-
/** Max duration for that the filter fix duration works (in ms) - default is 8mins */
|
|
71
|
-
maxFilterFixDuration?: number;
|
|
72
|
-
/** optional */
|
|
73
|
-
debugOptions?: {
|
|
74
|
-
/** For logging custom searches */
|
|
75
|
-
logCustomSearches?: boolean;
|
|
76
|
-
/** logs for debugging the "no-Audio" playing error */
|
|
77
|
-
noAudio?: boolean;
|
|
78
|
-
/** For Logging the Destroy function */
|
|
79
|
-
playerDestroy?: {
|
|
80
|
-
/** To show the debug reason at all times. */
|
|
81
|
-
debugLog?: boolean;
|
|
82
|
-
/** If you get 'Error: Use Player#destroy("reason") not LavalinkManager#deletePlayer() to stop the Player' put it on true */
|
|
83
|
-
dontThrowError?: boolean;
|
|
84
|
-
};
|
|
85
|
-
};
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
export interface LavalinkManagerEvents {
|
|
89
|
-
/**
|
|
90
|
-
* Emitted when a Track started playing.
|
|
91
|
-
* @event Manager#trackStart
|
|
92
|
-
*/
|
|
93
|
-
"trackStart": (player: Player, track: Track, payload: TrackStartEvent) => void;
|
|
94
|
-
/**
|
|
95
|
-
* Emitted when a Track finished.
|
|
96
|
-
* @event Manager#trackEnd
|
|
97
|
-
*/
|
|
98
|
-
"trackEnd": (player: Player, track: Track | null, payload: TrackEndEvent) => void;
|
|
99
|
-
/**
|
|
100
|
-
* Emitted when a Track got stuck while playing.
|
|
101
|
-
* @event Manager#trackStuck
|
|
102
|
-
*/
|
|
103
|
-
"trackStuck": (player: Player, track: Track | null, payload: TrackStuckEvent) => void;
|
|
104
|
-
/**
|
|
105
|
-
* Emitted when a Track errored.
|
|
106
|
-
* @event Manager#trackError
|
|
107
|
-
*/
|
|
108
|
-
"trackError": (player: Player, track: Track | UnresolvedTrack | null, payload: TrackExceptionEvent) => void;
|
|
109
|
-
/**
|
|
110
|
-
* Emitted when the Playing finished and no more tracks in the queue.
|
|
111
|
-
* @event Manager#queueEnd
|
|
112
|
-
*/
|
|
113
|
-
"queueEnd": (player: Player, track: Track | UnresolvedTrack | null, payload: TrackEndEvent | TrackStuckEvent | TrackExceptionEvent) => void;
|
|
114
|
-
/**
|
|
115
|
-
* Emitted when a Player is created.
|
|
116
|
-
* @event Manager#playerCreate
|
|
117
|
-
*/
|
|
118
|
-
"playerCreate": (player: Player) => void;
|
|
119
|
-
/**
|
|
120
|
-
* Emitted when a Player is moved within the channel.
|
|
121
|
-
* @event Manager#playerMove
|
|
122
|
-
*/
|
|
123
|
-
"playerMove": (player: Player, oldVoiceChannelId: string, newVoiceChannelId: string) => void;
|
|
124
|
-
/**
|
|
125
|
-
* Emitted when a Player is disconnected from a channel.
|
|
126
|
-
* @event Manager#playerDisconnect
|
|
127
|
-
*/
|
|
128
|
-
"playerDisconnect": (player: Player, voiceChannelId: string) => void;
|
|
129
|
-
/**
|
|
130
|
-
* Emitted when a Node-Socket got closed for a specific Player.
|
|
131
|
-
* @event Manager#playerSocketClosed
|
|
132
|
-
*/
|
|
133
|
-
"playerSocketClosed": (player: Player, payload: WebSocketClosedEvent) => void;
|
|
134
|
-
/**
|
|
135
|
-
* Emitted when a Player get's destroyed
|
|
136
|
-
* @event Manager#playerDestroy
|
|
137
|
-
*/
|
|
138
|
-
"playerDestroy": (player: Player, destroyReason?: DestroyReasonsType) => void;
|
|
4
|
+
import { Player } from "./Player";
|
|
5
|
+
import { ManagerUtils, MiniMap } from "./Utils";
|
|
6
|
+
import type { BotClientOptions, LavalinkManagerEvents, ManagerOptions } from "./Types/Manager";
|
|
7
|
+
import type { PlayerOptions } from "./Types/Player";
|
|
8
|
+
import type { ChannelDeletePacket, VoicePacket, VoiceServer, VoiceState } from "./Types/Utils";
|
|
9
|
+
export declare class LavalinkManager extends EventEmitter {
|
|
139
10
|
/**
|
|
140
|
-
*
|
|
141
|
-
* @event
|
|
11
|
+
* Emit an event
|
|
12
|
+
* @param event The event to emit
|
|
13
|
+
* @param args The arguments to pass to the event
|
|
14
|
+
* @returns
|
|
142
15
|
*/
|
|
143
|
-
|
|
16
|
+
emit<Event extends keyof LavalinkManagerEvents>(event: Event, ...args: Parameters<LavalinkManagerEvents[Event]>): boolean;
|
|
144
17
|
/**
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
* @
|
|
148
|
-
* @
|
|
18
|
+
* Add an event listener
|
|
19
|
+
* @param event The event to listen to
|
|
20
|
+
* @param listener The listener to add
|
|
21
|
+
* @returns
|
|
149
22
|
*/
|
|
150
|
-
|
|
23
|
+
on<Event extends keyof LavalinkManagerEvents>(event: Event, listener: LavalinkManagerEvents[Event]): this;
|
|
151
24
|
/**
|
|
152
|
-
*
|
|
153
|
-
*
|
|
154
|
-
* @
|
|
155
|
-
* @
|
|
25
|
+
* Add an event listener that only fires once
|
|
26
|
+
* @param event The event to listen to
|
|
27
|
+
* @param listener The listener to add
|
|
28
|
+
* @returns
|
|
156
29
|
*/
|
|
157
|
-
|
|
30
|
+
once<Event extends keyof LavalinkManagerEvents>(event: Event, listener: LavalinkManagerEvents[Event]): this;
|
|
158
31
|
/**
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
* @
|
|
162
|
-
* @
|
|
32
|
+
* Remove an event listener
|
|
33
|
+
* @param event The event to remove the listener from
|
|
34
|
+
* @param listener The listener to remove
|
|
35
|
+
* @returns
|
|
163
36
|
*/
|
|
164
|
-
|
|
37
|
+
off<Event extends keyof LavalinkManagerEvents>(event: Event, listener: LavalinkManagerEvents[Event]): this;
|
|
165
38
|
/**
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
* @
|
|
169
|
-
* @
|
|
39
|
+
* Remove an event listener
|
|
40
|
+
* @param event The event to remove the listener from
|
|
41
|
+
* @param listener The listener to remove
|
|
42
|
+
* @returns
|
|
170
43
|
*/
|
|
171
|
-
|
|
172
|
-
}
|
|
173
|
-
export interface LavalinkManager {
|
|
174
|
-
/** @private */
|
|
175
|
-
on<U extends keyof LavalinkManagerEvents>(event: U, listener: LavalinkManagerEvents[U]): this;
|
|
176
|
-
/** @private */
|
|
177
|
-
emit<U extends keyof LavalinkManagerEvents>(event: U, ...args: Parameters<LavalinkManagerEvents[U]>): boolean;
|
|
178
|
-
}
|
|
179
|
-
export declare class LavalinkManager extends EventEmitter {
|
|
44
|
+
removeListener<Event extends keyof LavalinkManagerEvents>(event: Event, listener: LavalinkManagerEvents[Event]): this;
|
|
180
45
|
/** The Options of LavalinkManager (changeable) */
|
|
181
46
|
options: ManagerOptions;
|
|
182
47
|
/** LavalinkManager's NodeManager to manage all Nodes */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ClientCustomSearchPlatformUtils, LavalinkSearchPlatform, SearchPlatform, SourcesRegex } from "./Utils";
|
|
1
|
+
import type { ClientCustomSearchPlatformUtils, LavalinkSearchPlatform, SearchPlatform, SourcesRegex } from "./Types/Utils";
|
|
2
2
|
/** Default Sources Record, to allow source parsing with multiple inputs. */
|
|
3
3
|
export declare const DefaultSources: Record<SearchPlatform, LavalinkSearchPlatform | ClientCustomSearchPlatformUtils>;
|
|
4
4
|
/** Lavalink Plugins definiton */
|
|
@@ -1,162 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
/** Ability to manipulate fetch requests */
|
|
8
|
-
export type ModifyRequest = (options: RequestInit & {
|
|
9
|
-
path: string;
|
|
10
|
-
extraQueryUrlParams?: URLSearchParams;
|
|
11
|
-
}) => void;
|
|
12
|
-
export declare const validSponsorBlocks: string[];
|
|
13
|
-
export type SponsorBlockSegment = "sponsor" | "selfpromo" | "interaction" | "intro" | "outro" | "preview" | "music_offtopic" | "filler";
|
|
14
|
-
/**
|
|
15
|
-
* Node Options for creating a lavalink node
|
|
16
|
-
*/
|
|
17
|
-
export interface LavalinkNodeOptions {
|
|
18
|
-
/** The Lavalink Server-Ip / Domain-URL */
|
|
19
|
-
host: string;
|
|
20
|
-
/** The Lavalink Connection Port */
|
|
21
|
-
port: number;
|
|
22
|
-
/** The Lavalink Password / Authorization-Key */
|
|
23
|
-
authorization: string;
|
|
24
|
-
/** Does the Server use ssl (https) */
|
|
25
|
-
secure?: boolean;
|
|
26
|
-
/** RESUME THE PLAYER? by providing a sessionid on the node-creation */
|
|
27
|
-
sessionId?: string;
|
|
28
|
-
/** Add a Custom ID to the node, for later use */
|
|
29
|
-
id?: string;
|
|
30
|
-
/** Voice Regions of this Node */
|
|
31
|
-
regions?: string[];
|
|
32
|
-
/** The retryAmount for the node. */
|
|
33
|
-
retryAmount?: number;
|
|
34
|
-
/** The retryDelay for the node. */
|
|
35
|
-
retryDelay?: number;
|
|
36
|
-
/** signal for cancelling requests - default: AbortSignal.timeout(options.requestSignalTimeoutMS || 10000) - put <= 0 to disable */
|
|
37
|
-
requestSignalTimeoutMS?: number;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Memory Stats object from lavalink
|
|
41
|
-
*/
|
|
42
|
-
export interface MemoryStats {
|
|
43
|
-
/** The free memory of the allocated amount. */
|
|
44
|
-
free: number;
|
|
45
|
-
/** The used memory of the allocated amount. */
|
|
46
|
-
used: number;
|
|
47
|
-
/** The total allocated memory. */
|
|
48
|
-
allocated: number;
|
|
49
|
-
/** The reservable memory. */
|
|
50
|
-
reservable: number;
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* CPU Stats object from lavalink
|
|
54
|
-
*/
|
|
55
|
-
export interface CPUStats {
|
|
56
|
-
/** The core amount the host machine has. */
|
|
57
|
-
cores: number;
|
|
58
|
-
/** The system load. */
|
|
59
|
-
systemLoad: number;
|
|
60
|
-
/** The lavalink load. */
|
|
61
|
-
lavalinkLoad: number;
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* FrameStats Object from lavalink
|
|
65
|
-
*/
|
|
66
|
-
export interface FrameStats {
|
|
67
|
-
/** The amount of sent frames. */
|
|
68
|
-
sent?: number;
|
|
69
|
-
/** The amount of nulled frames. */
|
|
70
|
-
nulled?: number;
|
|
71
|
-
/** The amount of deficit frames. */
|
|
72
|
-
deficit?: number;
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* BaseNodeStats object from Lavalink
|
|
76
|
-
*/
|
|
77
|
-
export interface BaseNodeStats {
|
|
78
|
-
/** The amount of players on the node. */
|
|
79
|
-
players: number;
|
|
80
|
-
/** The amount of playing players on the node. */
|
|
81
|
-
playingPlayers: number;
|
|
82
|
-
/** The uptime for the node. */
|
|
83
|
-
uptime: number;
|
|
84
|
-
/** The memory stats for the node. */
|
|
85
|
-
memory: MemoryStats;
|
|
86
|
-
/** The cpu stats for the node. */
|
|
87
|
-
cpu: CPUStats;
|
|
88
|
-
/** The frame stats for the node. */
|
|
89
|
-
frameStats: FrameStats;
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Interface for nodeStats from lavalink
|
|
93
|
-
*/
|
|
94
|
-
export interface NodeStats extends BaseNodeStats {
|
|
95
|
-
/** The frame stats for the node. */
|
|
96
|
-
frameStats: FrameStats;
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Entire lavalink information object from lavalink
|
|
100
|
-
*/
|
|
101
|
-
export interface LavalinkInfo {
|
|
102
|
-
/** The version of this Lavalink server */
|
|
103
|
-
version: VersionObject;
|
|
104
|
-
/** The millisecond unix timestamp when this Lavalink jar was built */
|
|
105
|
-
buildTime: number;
|
|
106
|
-
/** The git information of this Lavalink server */
|
|
107
|
-
git: GitObject;
|
|
108
|
-
/** The JVM version this Lavalink server runs on */
|
|
109
|
-
jvm: string;
|
|
110
|
-
/** The Lavaplayer version being used by this server */
|
|
111
|
-
lavaplayer: string;
|
|
112
|
-
/** The enabled source managers for this server */
|
|
113
|
-
sourceManagers: string[];
|
|
114
|
-
/** The enabled filters for this server */
|
|
115
|
-
filters: string[];
|
|
116
|
-
/** The enabled plugins for this server */
|
|
117
|
-
plugins: PluginObject[];
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Lavalink's version object from lavalink
|
|
121
|
-
*/
|
|
122
|
-
export interface VersionObject {
|
|
123
|
-
/** The full version string of this Lavalink server */
|
|
124
|
-
semver: string;
|
|
125
|
-
/** The major version of this Lavalink server */
|
|
126
|
-
major: number;
|
|
127
|
-
/** The minor version of this Lavalink server */
|
|
128
|
-
minor: number;
|
|
129
|
-
/** The patch version of this Lavalink server */
|
|
130
|
-
patch: internal;
|
|
131
|
-
/** The pre-release version according to semver as a . separated list of identifiers */
|
|
132
|
-
preRelease?: string;
|
|
133
|
-
/** The build metadata according to semver as a . separated list of identifiers */
|
|
134
|
-
build?: string;
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* Git information object from lavalink
|
|
138
|
-
*/
|
|
139
|
-
export interface GitObject {
|
|
140
|
-
/** The branch this Lavalink server was built on */
|
|
141
|
-
branch: string;
|
|
142
|
-
/** The commit this Lavalink server was built on */
|
|
143
|
-
commit: string;
|
|
144
|
-
/** The millisecond unix timestamp for when the commit was created */
|
|
145
|
-
commitTime: string;
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* Lavalink's plugins object from lavalink's plugin
|
|
149
|
-
*/
|
|
150
|
-
export interface PluginObject {
|
|
151
|
-
/** The name of the plugin */
|
|
152
|
-
name: string;
|
|
153
|
-
/** The version of the plugin */
|
|
154
|
-
version: string;
|
|
155
|
-
}
|
|
1
|
+
import type { Player } from "./Player";
|
|
2
|
+
import type { DestroyReasonsType } from "./Types/Player";
|
|
3
|
+
import type { Track } from "./Types/Track";
|
|
4
|
+
import type { Base64, InvalidLavalinkRestRequest, LavalinkPlayer, LavaSearchQuery, LavaSearchResponse, PlayerUpdateInfo, RoutePlanner, SearchQuery, SearchResult, Session } from "./Types/Utils";
|
|
5
|
+
import type { NodeManager } from "./NodeManager";
|
|
6
|
+
import type { BaseNodeStats, LavalinkInfo, LavalinkNodeOptions, ModifyRequest, NodeStats, SponsorBlockSegment } from "./Types/Node";
|
|
156
7
|
/**
|
|
157
8
|
* Lavalink Node creator class
|
|
158
9
|
*/
|
|
159
10
|
export declare class LavalinkNode {
|
|
11
|
+
private heartBeatPingTimestamp;
|
|
12
|
+
private heartBeatPongTimestamp;
|
|
13
|
+
get heartBeatPing(): number;
|
|
14
|
+
private heartBeatInterval?;
|
|
15
|
+
private pingTimeout?;
|
|
160
16
|
/** The provided Options of the Node */
|
|
161
17
|
options: LavalinkNodeOptions;
|
|
162
18
|
/** The amount of rest calls the node has made. */
|
|
@@ -300,6 +156,7 @@ export declare class LavalinkNode {
|
|
|
300
156
|
* ```
|
|
301
157
|
*/
|
|
302
158
|
connect(sessionId?: string): void;
|
|
159
|
+
private heartBeat;
|
|
303
160
|
/**
|
|
304
161
|
* Get the id of the node
|
|
305
162
|
*
|
|
@@ -332,6 +189,7 @@ export declare class LavalinkNode {
|
|
|
332
189
|
* ```
|
|
333
190
|
*/
|
|
334
191
|
get connected(): boolean;
|
|
192
|
+
isAlive: boolean;
|
|
335
193
|
/**
|
|
336
194
|
* Returns the current ConnectionStatus
|
|
337
195
|
*
|
|
@@ -356,7 +214,7 @@ export declare class LavalinkNode {
|
|
|
356
214
|
* const playersOfLavalink = await node?.fetchAllPlayers();
|
|
357
215
|
* ```
|
|
358
216
|
*/
|
|
359
|
-
fetchAllPlayers(): Promise<LavalinkPlayer[]>;
|
|
217
|
+
fetchAllPlayers(): Promise<LavalinkPlayer[] | InvalidLavalinkRestRequest>;
|
|
360
218
|
/**
|
|
361
219
|
* Gets specific Player Information
|
|
362
220
|
* @returns lavalink player object if player exists on lavalink
|
|
@@ -517,6 +375,7 @@ export declare class LavalinkNode {
|
|
|
517
375
|
private message;
|
|
518
376
|
/** @private middleware util function for handling all kind of events from websocket */
|
|
519
377
|
private handleEvent;
|
|
378
|
+
private getTrackOfPayload;
|
|
520
379
|
/** @private util function for handling trackStart event */
|
|
521
380
|
private trackStart;
|
|
522
381
|
/** @private util function for handling trackEnd event */
|