lavalink-client 2.10.3 → 2.11.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.
@@ -0,0 +1,4392 @@
1
+ import { EventEmitter } from "node:events";
2
+ import { ReadableStream } from "node:stream/web";
3
+ //#region src/structures/Types/Track.d.ts
4
+ /** Sourcenames provided by lavalink server */
5
+ type LavalinkSourceNames = "youtube" | "youtubemusic" | "soundcloud" | "bandcamp" | "twitch";
6
+ /** Source Names provided by lava src plugin */
7
+ type LavalinkPlugin_LavaSrc_SourceNames = "deezer" | "spotify" | "applemusic" | "yandexmusic" | "flowery-tts" | "vkmusic" | "tidal" | "qobuz" | "pandora";
8
+ /** Source Names provided by jiosaavan plugin */
9
+ type LavalinkPlugin_JioSaavn_SourceNames = "jiosaavn";
10
+ /** The SourceNames provided by lavalink */
11
+ type SourceNames = LavalinkSourceNames | LavalinkPlugin_LavaSrc_SourceNames | LavalinkPlugin_JioSaavn_SourceNames;
12
+ interface LavalinkTrackInfo {
13
+ /** The Identifier of the Track */
14
+ identifier: string;
15
+ /** The Track Title / Name */
16
+ title: string;
17
+ /** The Name of the Author */
18
+ author: string;
19
+ /** The duration of the Track */
20
+ length: number;
21
+ /** The URL of the artwork if available */
22
+ artworkUrl: string | null;
23
+ /** The URL (aka Link) of the Track called URI */
24
+ uri: string;
25
+ /** The Source name of the Track, e.g. soundcloud, youtube, spotify */
26
+ sourceName: SourceNames;
27
+ /** Whether the audio is seekable */
28
+ isSeekable: boolean;
29
+ /** Whether the audio is of a live stream */
30
+ isStream: boolean;
31
+ /** If isrc code is available, it's provided */
32
+ isrc: string | null;
33
+ }
34
+ interface TrackInfo {
35
+ /** The Identifier of the Track */
36
+ identifier: string;
37
+ /** The Track Title / Name */
38
+ title: string;
39
+ /** The Name of the Author */
40
+ author: string;
41
+ /** The duration of the Track */
42
+ duration: number;
43
+ /** The URL of the artwork if available */
44
+ artworkUrl: string | null;
45
+ /** The URL (aka Link) of the Track called URI */
46
+ uri: string;
47
+ /** The Source name of the Track, e.g. soundcloud, youtube, spotify */
48
+ sourceName: SourceNames;
49
+ /** Whether the audio is seekable */
50
+ isSeekable: boolean;
51
+ /** Whether the audio is of a live stream */
52
+ isStream: boolean;
53
+ /** If isrc code is available, it's provided */
54
+ isrc: string | null;
55
+ }
56
+ interface PluginInfo {
57
+ /** The Type provided by a plugin */
58
+ type?: "album" | "playlist" | "artist" | "recommendations" | string;
59
+ /** The Identifier provided by a plugin */
60
+ albumName?: string;
61
+ /** The url of the album */
62
+ albumUrl?: string;
63
+ /** The url of the album art */
64
+ albumArtUrl?: string;
65
+ /** The url of the artist */
66
+ artistUrl?: string;
67
+ /** The url of the artist artwork */
68
+ artistArtworkUrl?: string;
69
+ /** The url of the preview */
70
+ previewUrl?: string;
71
+ /** Whether the track is a preview */
72
+ isPreview?: boolean;
73
+ /** The total number of tracks in the playlist */
74
+ totalTracks?: number;
75
+ /** The Identifier provided by a plugin */
76
+ identifier?: string;
77
+ /** The ArtworkUrl provided by a plugin */
78
+ artworkUrl?: string;
79
+ /** The Author Information provided by a plugin */
80
+ author?: string;
81
+ /** The Url provided by a Plugin */
82
+ url?: string;
83
+ /** The Url provided by a Plugin */
84
+ uri?: string;
85
+ /** You can put specific track information here, to transform the tracks... */
86
+ clientData?: {
87
+ previousTrack?: boolean;
88
+ [key: string]: any;
89
+ };
90
+ }
91
+ interface LavalinkTrack {
92
+ /** The Base 64 encoded String */
93
+ encoded?: Base64;
94
+ /** Track Information */
95
+ info: LavalinkTrackInfo;
96
+ /** Plugin Information from Lavalink */
97
+ pluginInfo: Partial<PluginInfo>;
98
+ /** The userData Object from when you provide to the lavalink request */
99
+ userData?: anyObject;
100
+ }
101
+ interface TrackRequester {}
102
+ interface Track {
103
+ /** The Base 64 encoded String */
104
+ encoded?: Base64;
105
+ /** Track Information */
106
+ info: TrackInfo;
107
+ /** Plugin Information from Lavalink */
108
+ pluginInfo: Partial<PluginInfo>;
109
+ /** The Track's Requester */
110
+ requester?: TrackRequester;
111
+ /** The userData Object from when you provide to the lavalink request */
112
+ userData?: anyObject;
113
+ }
114
+ interface UnresolvedTrackInfo extends Partial<TrackInfo> {
115
+ /** Required */
116
+ title: string;
117
+ }
118
+ interface UnresolvedQuery extends UnresolvedTrackInfo {
119
+ /** The base64 of the unresolved track to "encode" */
120
+ encoded?: Base64;
121
+ }
122
+ interface UnresolvedTrack {
123
+ /** Required */
124
+ resolve: (player: Player) => Promise<void>;
125
+ /** The Base 64 encoded String */
126
+ encoded?: Base64;
127
+ /** Track Information */
128
+ info: UnresolvedTrackInfo;
129
+ /** Plugin Information from Lavalink */
130
+ pluginInfo: Partial<PluginInfo>;
131
+ /** The userData Object from when you provide to the lavalink request */
132
+ userData?: anyObject;
133
+ /** The Track's Requester */
134
+ requester?: TrackRequester;
135
+ }
136
+ //#endregion
137
+ //#region src/structures/Types/Queue.d.ts
138
+ interface StoredQueue {
139
+ current: Track | null;
140
+ previous: Track[];
141
+ tracks: (Track | UnresolvedTrack)[];
142
+ }
143
+ interface QueueStoreManager {
144
+ /** @async get a Value (MUST RETURN UNPARSED!) */
145
+ get: (guildId: string) => Awaitable<StoredQueue | string | undefined>;
146
+ /** @async Set a value inside a guildId (MUST BE UNPARSED) */
147
+ set: (guildId: string, value: StoredQueue | string) => Awaitable<void | boolean>;
148
+ /** @async Delete a Database Value based of it's guildId */
149
+ delete: (guildId: string) => Awaitable<void | boolean>;
150
+ /** @async Transform the value(s) inside of the QueueStoreManager (IF YOU DON'T NEED PARSING/STRINGIFY, then just return the value) */
151
+ stringify: (value: StoredQueue | string) => Awaitable<StoredQueue | string>;
152
+ /** @async Parse the saved value back to the Queue (IF YOU DON'T NEED PARSING/STRINGIFY, then just return the value) */
153
+ parse: (value: StoredQueue | string) => Awaitable<Partial<StoredQueue>>;
154
+ }
155
+ interface ManagerQueueOptions {
156
+ /** Maximum Amount of tracks for the queue.previous array. Set to 0 to not save previous songs. Defaults to 25 Tracks */
157
+ maxPreviousTracks?: number;
158
+ /** Custom Queue Store option */
159
+ queueStore?: QueueStoreManager;
160
+ /** Custom Queue Watcher class */
161
+ queueChangesWatcher?: QueueChangesWatcher;
162
+ }
163
+ interface QueueChangesWatcher {
164
+ /** get a Value (MUST RETURN UNPARSED!) */
165
+ tracksAdd: (guildId: string, tracks: (Track | UnresolvedTrack)[], position: number, oldStoredQueue: StoredQueue, newStoredQueue: StoredQueue) => void;
166
+ /** Set a value inside a guildId (MUST BE UNPARSED) */
167
+ tracksRemoved: (guildId: string, tracks: (Track | UnresolvedTrack)[], position: number | number[], oldStoredQueue: StoredQueue, newStoredQueue: StoredQueue) => void;
168
+ /** Set a value inside a guildId (MUST BE UNPARSED) */
169
+ shuffled: (guildId: string, oldStoredQueue: StoredQueue, newStoredQueue: StoredQueue) => void;
170
+ }
171
+ //#endregion
172
+ //#region src/structures/Types/Player.d.ts
173
+ type DestroyReasonsType = keyof typeof DestroyReasons | string;
174
+ type DisconnectReasonsType = keyof typeof DisconnectReasons | string;
175
+ interface PlayerJson {
176
+ /** Guild Id where the player was playing in */
177
+ guildId: string;
178
+ /** Options provided to the player */
179
+ options: PlayerOptions;
180
+ /** Voice Channel Id the player was playing in */
181
+ voiceChannelId: string;
182
+ /** Text Channel Id the player was synced to */
183
+ textChannelId?: string;
184
+ /** Position the player was at */
185
+ position: number;
186
+ /** Lavalink's position the player was at */
187
+ lastPosition: number;
188
+ /** Last time the position was sent from lavalink */
189
+ lastPositionChange: number | null;
190
+ /** Volume in % from the player (without volumeDecrementer) */
191
+ volume: number;
192
+ /** Real Volume used in lavalink (with the volumeDecrementer) */
193
+ lavalinkVolume: number;
194
+ /** The repeatmode from the player */
195
+ repeatMode: RepeatMode;
196
+ /** Pause state */
197
+ paused: boolean;
198
+ /** Whether the player was playing or not */
199
+ playing: boolean;
200
+ /** When the player was created */
201
+ createdTimeStamp?: number;
202
+ /** All current used fitlers Data */
203
+ filters: FilterData;
204
+ /** The player's ping object */
205
+ ping: {
206
+ /** Ping to the voice websocket server */
207
+ ws: number;
208
+ /** Avg. calc. Ping to the lavalink server */
209
+ lavalink: number;
210
+ };
211
+ /** Equalizer Bands used in lavalink */
212
+ equalizer: EQBand[];
213
+ /** The Id of the last used node */
214
+ nodeId?: string;
215
+ /** The SessionId of the node */
216
+ nodeSessionId?: string;
217
+ /** The stored queue */
218
+ queue?: StoredQueue;
219
+ }
220
+ type RepeatMode = "queue" | "track" | "off";
221
+ interface PlayerOptions {
222
+ /** Guild id of the player */
223
+ guildId: string;
224
+ /** The Voice Channel Id */
225
+ voiceChannelId: string;
226
+ /** The Text Channel Id of the Player */
227
+ textChannelId?: string;
228
+ /** instantly change volume with the one play request */
229
+ volume?: number;
230
+ /** VC Region for node selections */
231
+ vcRegion?: string;
232
+ /** if it should join deafened */
233
+ selfDeaf?: boolean;
234
+ /** If it should join muted */
235
+ selfMute?: boolean;
236
+ /** If it should use a specific lavalink node */
237
+ node?: LavalinkNode | string;
238
+ /** If when applying filters, it should use the insta apply filters fix */
239
+ instaUpdateFiltersFix?: boolean;
240
+ /** If a volume should be applied via filters instead of lavalink-volume */
241
+ applyVolumeAsFilter?: boolean;
242
+ /** Custom Data for the player get/set datastorage */
243
+ customData?: anyObject;
244
+ }
245
+ type anyObject = {
246
+ [key: string | number]: string | number | null | anyObject;
247
+ };
248
+ interface BasePlayOptions {
249
+ /** The position to start the track. */
250
+ position?: number;
251
+ /** The position to end the track. */
252
+ endTime?: number;
253
+ /** If to start "paused" */
254
+ paused?: boolean;
255
+ /** The Volume to start with */
256
+ volume?: number;
257
+ /** The Lavalink Filters to use | only with the new REST API */
258
+ filters?: Partial<LavalinkFilterData>;
259
+ /** Voice Update for Lavalink */
260
+ voice?: LavalinkPlayerVoiceOptions;
261
+ }
262
+ interface LavalinkPlayOptions extends BasePlayOptions {
263
+ /** Which Track to play | don't provide, if it should pick from the Queue */
264
+ track?: {
265
+ /** The track encoded base64 string to use instead of the one from the queue system */
266
+ encoded?: Base64 | null;
267
+ /** The identifier of the track to use */
268
+ identifier?: string;
269
+ /** Custom User Data for the track to provide, will then be on the userData object from the track */
270
+ userData?: anyObject;
271
+ /** The Track requester for when u provide encodedTrack / identifer */
272
+ requester?: unknown;
273
+ /** NodeLink Specific audioTrackId option */
274
+ audioTrackId?: string;
275
+ };
276
+ }
277
+ interface PlayOptions extends LavalinkPlayOptions {
278
+ /** Whether to not replace the track if a play payload is sent. */
279
+ noReplace?: boolean;
280
+ /** Adds track on queue and skips to it */
281
+ clientTrack?: (Track | UnresolvedTrack) & {
282
+ audioTrackId?: string;
283
+ };
284
+ }
285
+ //#endregion
286
+ //#region src/structures/Types/Node.d.ts
287
+ /** Ability to manipulate fetch requests */
288
+ type ModifyRequest = (options: RequestInit & {
289
+ path: string;
290
+ extraQueryUrlParams?: URLSearchParams;
291
+ }) => void;
292
+ type SponsorBlockSegment = "sponsor" | "selfpromo" | "interaction" | "intro" | "outro" | "preview" | "music_offtopic" | "filler";
293
+ /**
294
+ * Node Options for creating a lavalink node
295
+ */
296
+ interface LavalinkNodeOptions {
297
+ /** Specify the Node-Type of this node. Default: Lavalink */
298
+ nodeType?: NodeType;
299
+ /** The Lavalink Server-Ip / Domain-URL */
300
+ host: string;
301
+ /** The Lavalink Connection Port */
302
+ port: number;
303
+ /** The Lavalink Password / Authorization-Key */
304
+ authorization: string;
305
+ /** Does the Server use ssl (https) */
306
+ secure?: boolean;
307
+ /** RESUME THE PLAYER? by providing a sessionid on the node-creation */
308
+ sessionId?: string;
309
+ /** Add a Custom ID to the node, for later use */
310
+ id?: string;
311
+ /** Voice Regions of this Node */
312
+ regions?: string[];
313
+ /** The max amount of retries for this node. */
314
+ retryAmount?: number;
315
+ /** The delay of how often to retry a reconnection. */
316
+ retryDelay?: number;
317
+ /** How long a retry is a valid retry, it should be at least retryAmount*retryDelay. if <= 0 (default) then this won't be accounted. */
318
+ retryTimespan?: number;
319
+ /** signal for cancelling requests - default: AbortSignal.timeout(options.requestSignalTimeoutMS || 10000) - put <= 0 to disable */
320
+ requestSignalTimeoutMS?: number;
321
+ /** Close on error */
322
+ closeOnError?: boolean;
323
+ /** Heartbeat interval , set to <= 0 to disable heartbeat system */
324
+ heartBeatInterval?: number;
325
+ /** Recommended, to check whether the client is still connected or not on the stats endpoint */
326
+ enablePingOnStatsCheck?: boolean;
327
+ /** Per Node Options */
328
+ autoChecks?: {
329
+ /** Wether to check for every node to check for plugin validations or not. (ignored for NodeType NodeLink) */
330
+ pluginValidations?: boolean;
331
+ /** Wether to check for every node to check for source validations or not. */
332
+ sourcesValidations?: boolean;
333
+ };
334
+ }
335
+ /**
336
+ * Memory Stats object from lavalink
337
+ */
338
+ interface MemoryStats {
339
+ /** The free memory of the allocated amount. */
340
+ free: number;
341
+ /** The used memory of the allocated amount. */
342
+ used: number;
343
+ /** The total allocated memory. */
344
+ allocated: number;
345
+ /** The reservable memory. */
346
+ reservable: number;
347
+ }
348
+ /**
349
+ * CPU Stats object from lavalink
350
+ */
351
+ interface CPUStats {
352
+ /** The core amount the host machine has. */
353
+ cores: number;
354
+ /** The system load. */
355
+ systemLoad: number;
356
+ /** The lavalink load. */
357
+ lavalinkLoad: number;
358
+ }
359
+ /**
360
+ * FrameStats Object from lavalink
361
+ */
362
+ interface FrameStats {
363
+ /** The amount of sent frames. */
364
+ sent?: number;
365
+ /** The amount of nulled frames. */
366
+ nulled?: number;
367
+ /** The amount of deficit frames. */
368
+ deficit?: number;
369
+ }
370
+ /**
371
+ * BaseNodeStats object from Lavalink
372
+ */
373
+ interface BaseNodeStats {
374
+ /** The amount of players on the node. */
375
+ players: number;
376
+ /** The amount of playing players on the node. */
377
+ playingPlayers: number;
378
+ /** The uptime for the node. */
379
+ uptime: number;
380
+ /** The memory stats for the node. */
381
+ memory: MemoryStats;
382
+ /** The cpu stats for the node. */
383
+ cpu: CPUStats;
384
+ /** The frame stats for the node. */
385
+ frameStats: FrameStats;
386
+ }
387
+ interface NodeLinkConnectionMetrics {
388
+ status: string;
389
+ metrics: {
390
+ speed: {
391
+ bps: number;
392
+ kbps: number;
393
+ mbps: number;
394
+ };
395
+ downloadedBytes: number;
396
+ durationSeconds: number;
397
+ timestamp: number;
398
+ };
399
+ }
400
+ /**
401
+ * Interface for nodeStats from lavalink
402
+ */
403
+ interface NodeStats extends BaseNodeStats {
404
+ /** The frame stats for the node. */
405
+ frameStats: FrameStats;
406
+ /** something from nodeLink https://nodelink.js.org/docs/differences#detailed-statistics */
407
+ detailedStats?: {
408
+ api: {
409
+ /** e.g. { "/v4/loadtracks": 150, "/v4/info": 5 } */
410
+ requests: Record<string, number>;
411
+ errors: unknown;
412
+ };
413
+ /** e.g. { "youtube": 150, "soundcloud": 5 } */
414
+ sources: Record<string, number>;
415
+ playback: {
416
+ /** e.g. { "TrackStartEvent": 150, "TrackEndEvent": 5 } */
417
+ events: Record<string, number>;
418
+ };
419
+ /** and potential others */
420
+ [key: string]: unknown;
421
+ };
422
+ }
423
+ /**
424
+ * Entire lavalink information object from lavalink
425
+ */
426
+ interface LavalinkInfo {
427
+ /** The version of this Lavalink server */
428
+ version: VersionObject;
429
+ /** The millisecond unix timestamp when this Lavalink jar was built */
430
+ buildTime: number;
431
+ /** The git information of this Lavalink server */
432
+ git: GitObject;
433
+ /** The JVM version this Lavalink server runs on */
434
+ jvm: string;
435
+ /** The Lavaplayer version being used by this server */
436
+ lavaplayer: string;
437
+ /** The enabled source managers for this server */
438
+ sourceManagers: string[];
439
+ /** The enabled filters for this server */
440
+ filters: string[];
441
+ /** The enabled plugins for this server */
442
+ plugins: PluginObject[];
443
+ /** Something from NodeLink: https://nodelink.js.org/docs/differences#server-info */
444
+ isNodelink?: boolean;
445
+ }
446
+ /**
447
+ * Lavalink's version object from lavalink
448
+ */
449
+ interface VersionObject {
450
+ /** The full version string of this Lavalink server */
451
+ semver: string;
452
+ /** The major version of this Lavalink server */
453
+ major: number;
454
+ /** The minor version of this Lavalink server */
455
+ minor: number;
456
+ /** The patch version of this Lavalink server */
457
+ patch: number;
458
+ /** The pre-release version according to semver as a . separated list of identifiers */
459
+ preRelease?: string;
460
+ /** The build metadata according to semver as a . separated list of identifiers */
461
+ build?: string;
462
+ }
463
+ /**
464
+ * Git information object from lavalink
465
+ */
466
+ interface GitObject {
467
+ /** The branch this Lavalink server was built on */
468
+ branch: string;
469
+ /** The commit this Lavalink server was built on */
470
+ commit: string;
471
+ /** The millisecond unix timestamp for when the commit was created */
472
+ commitTime: string;
473
+ }
474
+ /**
475
+ * Lavalink's plugins object from lavalink's plugin
476
+ */
477
+ interface PluginObject {
478
+ /** The name of the plugin */
479
+ name: string;
480
+ /** The version of the plugin */
481
+ version: string;
482
+ }
483
+ interface LyricsResult {
484
+ /**The name of the source */
485
+ sourceName: string;
486
+ /**The name of the provider */
487
+ provider: string;
488
+ /**The result text */
489
+ text: string | null;
490
+ /**The lyrics lines */
491
+ lines: LyricsLine[];
492
+ /**Information about the plugin */
493
+ plugin: PluginInfo;
494
+ }
495
+ interface LyricsLine {
496
+ /**The millisecond timestamp */
497
+ timestamp: number;
498
+ /**The line duration in milliseconds */
499
+ duration: number | null;
500
+ /**The line text */
501
+ line: string;
502
+ /**Information about the plugin */
503
+ plugin: PluginInfo;
504
+ }
505
+ type LavalinkNodeIdentifier = string;
506
+ interface NodeManagerEvents {
507
+ /**
508
+ * Emitted when a Node is created.
509
+ * @event Manager.nodeManager#create
510
+ */
511
+ create: (node: LavalinkNode) => void;
512
+ /**
513
+ * Emitted when a Node is destroyed.
514
+ * @event Manager.nodeManager#destroy
515
+ */
516
+ destroy: (node: LavalinkNode, destroyReason?: DestroyReasonsType) => void;
517
+ /**
518
+ * Emitted when a Node is connected.
519
+ * @event Manager.nodeManager#connect
520
+ */
521
+ connect: (node: LavalinkNode) => void;
522
+ /**
523
+ * Emitted when a Node is reconnecting.
524
+ * @event Manager.nodeManager#reconnecting
525
+ */
526
+ reconnecting: (node: LavalinkNode) => void;
527
+ /**
528
+ * Emitted When a node starts to reconnect (if you have a reconnection delay, the reconnecting event will be emitted after the retryDelay.)
529
+ * Useful to check whether the internal node reconnect system works or not
530
+ * @event Manager.nodeManager#reconnectinprogress
531
+ */
532
+ reconnectinprogress: (node: LavalinkNode) => void;
533
+ /**
534
+ * Emitted when a Node is disconnects.
535
+ * @event Manager.nodeManager#disconnect
536
+ */
537
+ disconnect: (node: LavalinkNode, reason: {
538
+ code?: number;
539
+ reason?: string;
540
+ }) => void;
541
+ /**
542
+ * Emitted when a Node is error.
543
+ * @event Manager.nodeManager#error
544
+ */
545
+ error: (node: LavalinkNode, error: Error, payload?: unknown) => void;
546
+ /**
547
+ * Emits every single Node event.
548
+ * @event Manager.nodeManager#raw
549
+ */
550
+ raw: (node: LavalinkNode, payload: unknown) => void;
551
+ /**
552
+ * Emits when the node connects resumed. You then need to create all players within this event for your usecase.
553
+ * Aka for that you need to be able to save player data like vc channel + text channel in a db and then sync it again
554
+ * @event Manager.nodeManager#nodeResumed
555
+ */
556
+ resumed: (node: LavalinkNode, payload: {
557
+ resumed: true;
558
+ sessionId: string;
559
+ op: "ready";
560
+ }, players: LavalinkPlayer[] | InvalidLavalinkRestRequest) => void;
561
+ /**
562
+ * Event Handler for Nodelink specific events https://nodelink.js.org/docs/api/websocket Fully typed and generic based on the eventName.
563
+ * @event Manager.nodeManager#nodeLinkEvent
564
+ * @example
565
+ *
566
+ * ```ts
567
+ * this.nodeManager.on("nodeLinkEvent", (node, event, player, track, payload) => {
568
+ * if (event === "SeekEvent") {
569
+ * console.log("new position:", payload.position);
570
+ * }
571
+ * if (event === "FiltersChangedEvent") {
572
+ * console.log("new filters state", payload.filters);
573
+ * }
574
+ * });
575
+ * ```
576
+ */
577
+ nodeLinkEvent: (...args: { [K in NodeLinkEventTypes]: [node: LavalinkNode, event: K, player: Player, track: Track | null, payload: NodeLinkEventPayload<K>]; }[NodeLinkEventTypes]) => void;
578
+ }
579
+ declare enum ReconnectionState {
580
+ IDLE = "IDLE",
581
+ RECONNECTING = "RECONNECTING",
582
+ PENDING = "PENDING",
583
+ DESTROYING = "DESTROYING"
584
+ }
585
+ declare enum NodeType {
586
+ Lavalink = "Lavalink",
587
+ NodeLink = "NodeLink"
588
+ }
589
+ //#endregion
590
+ //#region src/structures/Utils.d.ts
591
+ declare const TrackSymbol: unique symbol;
592
+ declare const UnresolvedTrackSymbol: unique symbol;
593
+ declare const QueueSymbol: unique symbol;
594
+ declare const NodeSymbol: unique symbol;
595
+ /**
596
+ * Parses Node Connection Url: "lavalink://<nodeId>:<nodeAuthorization(Password)>@<NodeHost>:<NodePort>" or "nodelink://<nodeId>:<nodeAuthorization(Password)>@<NodeHost>:<NodePort>"
597
+ * @param connectionUrl
598
+ * @returns
599
+ */
600
+ declare function parseLavalinkConnUrl(connectionUrl: string): {
601
+ authorization: string;
602
+ nodeType: NodeType;
603
+ id: string;
604
+ host: string;
605
+ port: number;
606
+ };
607
+ declare class ManagerUtils {
608
+ LavalinkManager: LavalinkManager | undefined;
609
+ /** Override this with your custom sources record if you want to use custom sources for your node */
610
+ SourcesRecord: Record<SearchPlatform, ClientCustomSearchPlatformUtils | LavalinkSearchPlatform>;
611
+ constructor(LavalinkManager?: LavalinkManager);
612
+ /**
613
+ * Builds a pluginInfo object based on the provided data, extracting relevant information from the data and clientData parameters. This function is used to construct the pluginInfo property for tracks, allowing for consistent handling of plugin-related information across different track sources and formats.
614
+ * @param data
615
+ * @param clientData
616
+ * @returns
617
+ */
618
+ buildPluginInfo(data: any, clientData?: any): any;
619
+ /**
620
+ * Builds a Track object from the provided data and requester information. It validates the presence of required properties in the data, transforms the requester using a custom transformer function if provided, and constructs a Track object with the appropriate properties and plugin information. The function also includes error handling to ensure that the input data is valid and provides debug information if track building fails.
621
+ * @param data
622
+ * @param requester
623
+ * @returns
624
+ */
625
+ buildTrack(data: LavalinkTrack | Track, requester: unknown): Track;
626
+ /**
627
+ * Builds a UnresolvedTrack to be resolved before being played .
628
+ * @param query
629
+ * @param requester
630
+ */
631
+ buildUnresolvedTrack(query: UnresolvedQuery | UnresolvedTrack, requester: unknown): UnresolvedTrack;
632
+ /**
633
+ * Validate if a data is equal to a node
634
+ * @param data
635
+ */
636
+ isNode(data: LavalinkNode): boolean;
637
+ /**
638
+ * Gets the transformed requester based on the LavalinkManager options. If a custom requester transformer function is provided in the player options, it applies that function to the requester; otherwise, it returns the requester as is. The function also includes error handling to catch any exceptions that may occur during the transformation process and emits a debug event if the transformation fails.
639
+ * @param requester
640
+ * @returns
641
+ */
642
+ getTransformedRequester(requester: unknown): unknown;
643
+ /**
644
+ * Validate if a data is equal to node options
645
+ * @param data
646
+ */
647
+ isNodeOptions(data: LavalinkNodeOptions): boolean;
648
+ /**
649
+ * Validate tracks based on duration whether they are playble or broken tracks.
650
+ * most tracks should be longer than 30s, so you can put a minDuration of 29e3 (cause preview tracks are exactly 30s) or put 0.
651
+ * This check is not done automatically, you need to check it yourself by doing:
652
+ * @example
653
+ * ```ts
654
+ * const res = await player.search("Adele");
655
+ *
656
+ * // short hand:
657
+ * const validTracks = res.tracks.filter(client.lavalink.utils.isNotBrokenTrack)
658
+ * // or with options:
659
+ * const validTracks = res.tracks.filter(t => client.lavalink.utils.isNotBrokenTrack(t, 29e3));
660
+ *
661
+ * // then you can add it to the queue.
662
+ * await player.queue.add(validTracks);
663
+ * ```
664
+ */
665
+ isNotBrokenTrack(data: Track | UnresolvedTrack, minDuration?: number): data is Track;
666
+ /**
667
+ * Validate if a data is equal to a track
668
+ * @param data the Track to validate
669
+ * @returns
670
+ */
671
+ isTrack(data: Track | UnresolvedTrack): data is Track;
672
+ /**
673
+ * Checks if the provided argument is a valid UnresolvedTrack.
674
+ * @param track
675
+ */
676
+ isUnresolvedTrack(data: UnresolvedTrack | Track): data is UnresolvedTrack;
677
+ /**
678
+ * Checks if the provided argument is a valid UnresolvedTrack.
679
+ * @param track
680
+ */
681
+ isUnresolvedTrackQuery(data: UnresolvedQuery): boolean;
682
+ /**
683
+ * Gets the closest track by resolving the provided UnresolvedTrack using the getClosestTrack function. It includes error handling to catch any exceptions that may occur during the resolution process and emits a debug event if the resolution fails. The function returns a Promise that resolves to a Track object if successful, or undefined if no closest track is found.
684
+ * @param data
685
+ * @param player
686
+ * @returns
687
+ */
688
+ getClosestTrack(data: UnresolvedTrack, player: Player): Promise<Track | undefined>;
689
+ /**
690
+ * Validates the query string against various criteria, including checking for empty strings, length limits for specific sources, blacklisted links or words, and ensuring that the Lavalink node has the necessary source managers enabled for the provided query. The function also includes debug event emissions to assist with troubleshooting and understanding the validation process.
691
+ * @param node
692
+ * @param queryString
693
+ * @param sourceString
694
+ * @returns
695
+ */
696
+ validateQueryString(node: LavalinkNode, queryString: string, sourceString?: SearchPlatform): void;
697
+ /**
698
+ * Finds the source of a query string by checking if it starts with a valid source prefix defined in the Default Sources object. If a valid source prefix is found, it returns the corresponding SearchPlatform; otherwise, it returns null. This function is useful for determining the intended search platform for a given query string, allowing for more accurate search results when the user specifies a source (e.g., "ytsearch:Never Gonna Give You Up" would indicate that the search should be performed on YouTube).
699
+ * @param queryString
700
+ * @returns
701
+ */
702
+ findSourceOfQuery(queryString: string): SearchPlatform | null;
703
+ /**
704
+ * Extracts the source from the query if it starts with a valid source prefix (e.g., "ytsearch:") and updates the searchQuery object accordingly.
705
+ * @param searchQuery
706
+ * @returns The updated searchQuery object with the extracted source and modified query string.
707
+ */
708
+ extractSourceOfQuery<T extends {
709
+ query: string;
710
+ source?: string;
711
+ }>(searchQuery: T): T;
712
+ /**
713
+ * Converts a string to lowercase if the input is a string, otherwise returns the input as is. This is useful for ensuring that search platform identifiers are case-insensitive while allowing other types of input to pass through unchanged.
714
+ * @param input
715
+ * @returns
716
+ */
717
+ typedLowerCase<T extends unknown>(input: T): T;
718
+ /**
719
+ * Transforms a search query by determining the appropriate search platform based on the query string and the default search platform specified in the LavalinkManager options. It checks if the query string starts with a valid source prefix and extracts it if present. The function returns an object containing the modified query string, any extra URL parameters, and the determined search platform to be used for the search operation.
720
+ * @param query
721
+ * @returns
722
+ */
723
+ transformQuery(query: SearchQuery): {
724
+ query: string;
725
+ extraQueryUrlParams: URLSearchParams | undefined;
726
+ source: any;
727
+ };
728
+ /**
729
+ * Transforms a LavaSearchQuery by determining the appropriate search platform based on the query string and the default search platform specified in the LavalinkManager options. It checks if the query string starts with a valid source prefix and extracts it if present. The function returns an object containing the modified query string, any extra URL parameters, the determined search platform to be used for the search operation, and the types of search (track, playlist, artist, album, text) to be performed.
730
+ * @param query
731
+ * @returns
732
+ */
733
+ transformLavaSearchQuery(query: LavaSearchQuery): {
734
+ query: string;
735
+ types: string[];
736
+ source: any;
737
+ };
738
+ /**
739
+ * Validates the provided source string against the capabilities of the Lavalink node. It checks if the source string is supported by the node's enabled source managers and plugins, throwing errors if any required sources or plugins are missing for the specified search platform. This ensures that search queries are only executed with compatible sources based on the node's configuration.
740
+ * @param node
741
+ * @param sourceString
742
+ * @returns
743
+ */
744
+ validateSourceString(node: LavalinkNode, sourceString: SearchPlatform): void;
745
+ }
746
+ /**
747
+ * Separate interface for the constructor so that emitted js does not have a constructor that overwrites itself
748
+ *
749
+ * @internal
750
+ */
751
+ interface MiniMap<K, V> extends Map<K, V> {
752
+ constructor: MiniMapConstructor;
753
+ }
754
+ declare class MiniMap<K, V> extends Map<K, V> {
755
+ constructor(data?: [K, V][]);
756
+ /**
757
+ * Identical to
758
+ * [Array.filter()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter),
759
+ * but returns a MiniMap instead of an Array.
760
+ *
761
+ * @param fn The function to test with (should return boolean)
762
+ * @param thisArg Value to use as `this` when executing function
763
+ *
764
+ * @example
765
+ * miniMap.filter(user => user.username === 'Bob');
766
+ */
767
+ filter<K2 extends K>(fn: (value: V, key: K, miniMap: this) => key is K2): MiniMap<K2, V>;
768
+ filter<V2 extends V>(fn: (value: V, key: K, miniMap: this) => value is V2): MiniMap<K, V2>;
769
+ filter(fn: (value: V, key: K, miniMap: this) => boolean): MiniMap<K, V>;
770
+ filter<This, K2 extends K>(fn: (this: This, value: V, key: K, miniMap: this) => key is K2, thisArg: This): MiniMap<K2, V>;
771
+ filter<This, V2 extends V>(fn: (this: This, value: V, key: K, miniMap: this) => value is V2, thisArg: This): MiniMap<K, V2>;
772
+ filter<This>(fn: (this: This, value: V, key: K, miniMap: this) => boolean, thisArg: This): MiniMap<K, V>;
773
+ toJSON(): [K, V][];
774
+ /**
775
+ * Maps each item to another value into an array. Identical in behavior to
776
+ * [Array.map()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map).
777
+ *
778
+ * @param fn Function that produces an element of the new array, taking three arguments
779
+ * @param thisArg Value to use as `this` when executing function
780
+ *
781
+ * @example
782
+ * miniMap.map(user => user.tag);
783
+ */
784
+ map<T>(fn: (value: V, key: K, miniMap: this) => T): T[];
785
+ map<This, T>(fn: (this: This, value: V, key: K, miniMap: this) => T, thisArg: This): T[];
786
+ }
787
+ declare function queueTrackEnd(player: Player, dontShiftQueue?: boolean): Promise<Track | null>;
788
+ declare function safeStringify(obj: any, padding?: number): string;
789
+ //#endregion
790
+ //#region src/structures/Types/Utils.d.ts
791
+ /** Helper for generating Opaque types. */
792
+ type Opaque<T, K> = T & {
793
+ __opaque__: K;
794
+ };
795
+ /** Opqaue tyep for integernumber */
796
+ type IntegerNumber = Opaque<number, "Int">;
797
+ /** Opqaue tyep for floatnumber */
798
+ type FloatNumber = Opaque<number, "Float">;
799
+ type LavaSrcSearchPlatformBase = "spsearch" | "sprec" | "amsearch" | "dzsearch" | "dzisrc" | "dzrec" | "ymsearch" | "ymrec" | "vksearch" | "vkrec" | "tdsearch" | "tdrec" | "qbsearch" | "qbisrc" | "qbrec" | "ytsearch" | "jssearch" | "jsrec";
800
+ type LavaSrcSearchPlatform = LavaSrcSearchPlatformBase | "ftts";
801
+ type JioSaavnSearchPlatform = "jssearch" | "jsrec";
802
+ type DuncteSearchPlatform = "speak" | "phsearch" | "pornhub" | "porn" | "tts";
803
+ type PulseLinkSearchPlatform = "spsearch" | "amzsearch" | "amsearch" | "dzsearch" | "ymsearch" | "vksearch" | "tdsearch" | "qbsearch" | "jssearch" | "admsearch" | "gnsearch" | "szsearch" | "pdsearch" | "ytsearch" | "ytmsearch";
804
+ type LavalinkClientSearchPlatform = "bcsearch";
805
+ type LavalinkClientSearchPlatformResolve = "bandcamp" | "bc";
806
+ type LavalinkSearchPlatform = "ytsearch" | "ytmsearch" | "scsearch" | "bcsearch" | LavaSrcSearchPlatform | DuncteSearchPlatform | PulseLinkSearchPlatform | JioSaavnSearchPlatform | LavalinkClientSearchPlatform;
807
+ type NodeLinkSearchPlatformBase = "ytsearch" | "ytmsearch" | "scsearch" | "search" | "spsearch" | "amsearch" | "dzsearch" | "tdsearch" | "bcsearch" | "admsearch" | "audiomack" | "gaanasearch" | "jssearch" | "lfsearch" | "pdsearch" | "vksearch" | "mcsearch" | "ncsearch" | "nicovideo" | "bilibili" | "shsearch" | "szsearch" | "ebox" | "jukebox" | "slsearch" | "qbsearch" | "ymsearch" | "ausearch" | "azsearch" | "agsearch" | "bksearch" | "lmsearch" | "pipertts" | "gtts" | "speak" | "ftts" | "flowery" | "gdsearch";
808
+ type NodeLinkRecommendationPlatform = "ytrec" | "sprec" | "dzrec" | "tdrec" | "jsrec" | "vkrec";
809
+ type NodeLinkSearchPlatform = NodeLinkSearchPlatformBase | NodeLinkRecommendationPlatform;
810
+ type ClientCustomSearchPlatformUtils = "local" | "http" | "https" | "link" | "uri";
811
+ type ClientSearchPlatform = ClientCustomSearchPlatformUtils | "youtube" | "yt" | "youtube music" | "youtubemusic" | "ytm" | "musicyoutube" | "music youtube" | "soundcloud" | "sc" | "am" | "apple music" | "applemusic" | "apple" | "musicapple" | "music apple" | "sp" | "spsuggestion" | "spotify" | "spotify.com" | "spotifycom" | "dz" | "deezer" | "yandex" | "yandex music" | "yandexmusic" | "vk" | "vk music" | "vkmusic" | "tidal" | "tidal music" | "qobuz" | "pandora" | "pd" | "pandora music" | "pandoramusic" | "flowerytts" | "flowery" | "flowery.tts" | LavalinkClientSearchPlatformResolve | LavalinkClientSearchPlatform | "js" | "jiosaavn" | "td" | "tidal" | "tdrec";
812
+ type SearchPlatform = LavalinkSearchPlatform | ClientSearchPlatform;
813
+ type SourcesRegex = "YoutubeRegex" | "YoutubeMusicRegex" | "SoundCloudRegex" | "SoundCloudMobileRegex" | "DeezerTrackRegex" | "DeezerArtistRegex" | "DeezerEpisodeRegex" | "DeezerMixesRegex" | "DeezerPageLinkRegex" | "DeezerPlaylistRegex" | "DeezerAlbumRegex" | "AllDeezerRegex" | "AllDeezerRegexWithoutPageLink" | "SpotifySongRegex" | "SpotifyPlaylistRegex" | "SpotifyArtistRegex" | "SpotifyEpisodeRegex" | "SpotifyShowRegex" | "SpotifyAlbumRegex" | "AllSpotifyRegex" | "mp3Url" | "m3uUrl" | "m3u8Url" | "mp4Url" | "m4aUrl" | "wavUrl" | "aacpUrl" | "tiktok" | "mixcloud" | "musicYandex" | "radiohost" | "bandcamp" | "jiosaavn" | "appleMusic" | "tidal" | "PandoraTrackRegex" | "PandoraAlbumRegex" | "PandoraArtistRegex" | "PandoraPlaylistRegex" | "AllPandoraRegex" | "TwitchTv" | "vimeo";
814
+ interface PlaylistInfo {
815
+ /** The playlist name */
816
+ name: string;
817
+ /** The playlist title (same as name) */
818
+ title: string;
819
+ /** The playlist Author */
820
+ author?: string;
821
+ /** The playlist Thumbnail */
822
+ thumbnail?: string;
823
+ /** A Uri to the playlist */
824
+ uri?: string;
825
+ /** The playlist selected track. */
826
+ selectedTrack: Track | null;
827
+ /** The duration of the entire playlist. (calcualted) */
828
+ duration: number;
829
+ }
830
+ interface SearchResult {
831
+ loadType: LoadTypes;
832
+ exception: Exception | null;
833
+ pluginInfo: PluginInfo;
834
+ playlist: PlaylistInfo | null;
835
+ tracks: Track[];
836
+ }
837
+ interface UnresolvedSearchResult {
838
+ loadType: LoadTypes;
839
+ exception: Exception | null;
840
+ pluginInfo: PluginInfo;
841
+ playlist: PlaylistInfo | null;
842
+ tracks: UnresolvedTrack[];
843
+ }
844
+ /**
845
+ * @internal
846
+ */
847
+ interface MiniMapConstructor {
848
+ new (): MiniMap<unknown, unknown>;
849
+ new <K, V>(entries?: ReadonlyArray<readonly [K, V]> | null): MiniMap<K, V>;
850
+ new <K, V>(iterable: Iterable<readonly [K, V]>): MiniMap<K, V>;
851
+ readonly prototype: MiniMap<unknown, unknown>;
852
+ readonly [Symbol.species]: MiniMapConstructor;
853
+ }
854
+ type PlayerEvents = TrackStartEvent | TrackEndEvent | TrackStuckEvent | TrackExceptionEvent | WebSocketClosedEvent | SponsorBlockSegmentEvents | LyricsEvent;
855
+ type Severity = "COMMON" | "SUSPICIOUS" | "FAULT";
856
+ interface Exception {
857
+ /** Severity of the error */
858
+ severity: Severity;
859
+ /** Nodejs Error */
860
+ error?: Error;
861
+ /** Message by lavalink */
862
+ message: string;
863
+ /** Cause by lavalink */
864
+ cause: string;
865
+ /** causeStackTrace by lavalink */
866
+ causeStackTrace: string;
867
+ }
868
+ interface PlayerEvent {
869
+ op: "event";
870
+ type: PlayerEventType;
871
+ guildId: string;
872
+ }
873
+ interface TrackStartEvent extends PlayerEvent {
874
+ type: "TrackStartEvent";
875
+ track: LavalinkTrack;
876
+ }
877
+ interface TrackEndEvent extends PlayerEvent {
878
+ type: "TrackEndEvent";
879
+ track: LavalinkTrack;
880
+ reason: TrackEndReason;
881
+ }
882
+ interface TrackExceptionEvent extends PlayerEvent {
883
+ type: "TrackExceptionEvent";
884
+ exception?: Exception;
885
+ track: LavalinkTrack;
886
+ error: string;
887
+ }
888
+ interface TrackStuckEvent extends PlayerEvent {
889
+ type: "TrackStuckEvent";
890
+ thresholdMs: number;
891
+ track: LavalinkTrack;
892
+ }
893
+ interface WebSocketClosedEvent extends PlayerEvent {
894
+ type: "WebSocketClosedEvent";
895
+ code: number;
896
+ byRemote: boolean;
897
+ reason: string;
898
+ }
899
+ /**
900
+ * Types & Events for Sponsorblock-plugin from Lavalink: https://github.com/topi314/Sponsorblock-Plugin#segmentsloaded
901
+ */
902
+ type SponsorBlockSegmentEvents = SponsorBlockSegmentSkipped | SponsorBlockSegmentsLoaded | SponsorBlockChapterStarted | SponsorBlockChaptersLoaded;
903
+ type SponsorBlockSegmentEventType = "SegmentSkipped" | "SegmentsLoaded" | "ChaptersLoaded" | "ChapterStarted";
904
+ interface SponsorBlockSegmentsLoaded extends PlayerEvent {
905
+ type: "SegmentsLoaded";
906
+ segments: {
907
+ category: string;
908
+ start: number;
909
+ end: number;
910
+ }[];
911
+ }
912
+ interface SponsorBlockSegmentSkipped extends PlayerEvent {
913
+ type: "SegmentSkipped";
914
+ segment: {
915
+ category: string;
916
+ start: number;
917
+ end: number;
918
+ };
919
+ }
920
+ interface SponsorBlockChapterStarted extends PlayerEvent {
921
+ type: "ChapterStarted";
922
+ /** The Chapter which started */
923
+ chapter: {
924
+ /** The Name of the Chapter */
925
+ name: string;
926
+ start: number;
927
+ end: number;
928
+ duration: number;
929
+ };
930
+ }
931
+ interface SponsorBlockChaptersLoaded extends PlayerEvent {
932
+ type: "ChaptersLoaded";
933
+ /** All Chapters loaded */
934
+ chapters: {
935
+ /** The Name of the Chapter */
936
+ name: string;
937
+ start: number;
938
+ end: number;
939
+ duration: number;
940
+ }[];
941
+ }
942
+ /**
943
+ * Types & Events for Lyrics plugin from Lavalink: https://github.com/topi314/LavaLyrics
944
+ */
945
+ type LyricsEvent = LyricsFoundEvent | LyricsNotFoundEvent | LyricsLineEvent;
946
+ type LyricsEventType = "LyricsFoundEvent" | "LyricsNotFoundEvent" | "LyricsLineEvent";
947
+ interface LyricsFoundEvent extends PlayerEvent {
948
+ /** The lyricsfound event */
949
+ type: "LyricsFoundEvent";
950
+ /** The guildId */
951
+ guildId: string;
952
+ /** The lyrics */
953
+ lyrics: LyricsResult;
954
+ }
955
+ interface LyricsNotFoundEvent extends PlayerEvent {
956
+ /**The lyricsnotfound event*/
957
+ type: "LyricsNotFoundEvent";
958
+ /**The guildId*/
959
+ guildId: string;
960
+ }
961
+ interface LyricsLineEvent extends PlayerEvent {
962
+ /**The lyricsline event*/
963
+ type: "LyricsLineEvent";
964
+ /** The guildId */
965
+ guildId: string;
966
+ /** The line number */
967
+ lineIndex: number;
968
+ /** The line */
969
+ line: LyricsLine;
970
+ /**skipped is true if the line was skipped */
971
+ skipped: boolean;
972
+ }
973
+ type LoadTypes = "track" | "playlist" | "search" | "error" | "empty";
974
+ type State = "CONNECTED" | "CONNECTING" | "DISCONNECTED" | "DISCONNECTING" | "DESTROYING";
975
+ type PlayerEventType = "TrackStartEvent" | "TrackEndEvent" | "TrackExceptionEvent" | "TrackStuckEvent" | "WebSocketClosedEvent" | SponsorBlockSegmentEventType | LyricsEventType;
976
+ type TrackEndReason = "finished" | "loadFailed" | "stopped" | "replaced" | "cleanup";
977
+ interface InvalidLavalinkRestRequest {
978
+ /** Rest Request Data for when it was made */
979
+ timestamp: number;
980
+ /** Status of the request */
981
+ status: number;
982
+ /** Specific Errro which was sent */
983
+ error: string;
984
+ /** Specific Message which was created */
985
+ message?: string;
986
+ /** The specific error trace from the request */
987
+ trace?: unknown;
988
+ /** Path of where it's from */
989
+ path: string;
990
+ }
991
+ interface LavalinkPlayerVoice {
992
+ /** The Voice Token */
993
+ token: string;
994
+ /** The Voice Server Endpoint */
995
+ endpoint: string;
996
+ /** The Voice SessionId */
997
+ sessionId: string;
998
+ /** The Voice Channel Id */
999
+ channelId?: string;
1000
+ /** Whether or not the player is connected */
1001
+ connected?: boolean;
1002
+ /** The Ping to the voice server */
1003
+ ping?: number;
1004
+ }
1005
+ type LavalinkPlayerVoiceOptions = Omit<LavalinkPlayerVoice, "connected" | "ping">;
1006
+ interface FailingAddress {
1007
+ /** The failing address */
1008
+ failingAddress: string;
1009
+ /** The timestamp when the address failed */
1010
+ failingTimestamp: number;
1011
+ /** The timestamp when the address failed as a pretty string */
1012
+ failingTime: string;
1013
+ }
1014
+ type RoutePlannerTypes = "RotatingIpRoutePlanner" | "NanoIpRoutePlanner" | "RotatingNanoIpRoutePlanner" | "BalancingIpRoutePlanner";
1015
+ interface RoutePlanner {
1016
+ class?: RoutePlannerTypes;
1017
+ details?: {
1018
+ /** The ip block being used */
1019
+ ipBlock: {
1020
+ /** The type of the ip block */
1021
+ type: "Inet4Address" | "Inet6Address";
1022
+ /** The size of the ip block */
1023
+ size: string;
1024
+ };
1025
+ /** The failing addresses */
1026
+ failingAddresses: FailingAddress[];
1027
+ /** The number of rotations */
1028
+ rotateIndex?: string;
1029
+ /** The current offset in the block */
1030
+ ipIndex?: string;
1031
+ /** The current address being used */
1032
+ currentAddress?: string;
1033
+ /** The current offset in the ip block */
1034
+ currentAddressIndex?: string;
1035
+ /** The information in which /64 block ips are chosen. This number increases on each ban. */
1036
+ blockIndex?: string;
1037
+ };
1038
+ }
1039
+ interface Session {
1040
+ /** Whether or not session is resuming or not */
1041
+ resuming: boolean;
1042
+ /** For how long a session is lasting while not connected */
1043
+ timeout: number;
1044
+ }
1045
+ interface GuildShardPayload {
1046
+ /** The OP code */
1047
+ op: number;
1048
+ /** Data to send */
1049
+ d: {
1050
+ /** Guild id to apply voice settings */
1051
+ guild_id: string;
1052
+ /** channel to move/connect to, or null to leave it */
1053
+ channel_id: string | null;
1054
+ /** whether or not mute yourself */
1055
+ self_mute: boolean;
1056
+ /** whether or not deafen yourself */
1057
+ self_deaf: boolean;
1058
+ };
1059
+ }
1060
+ interface PlayerUpdateInfo {
1061
+ /** guild id of the player */
1062
+ guildId: string;
1063
+ /** Player options to provide to lavalink */
1064
+ playerOptions: LavalinkPlayOptions;
1065
+ /** Whether or not replace the current track with the new one (true is recommended) */
1066
+ noReplace?: boolean;
1067
+ }
1068
+ interface LavalinkPlayer {
1069
+ /** Guild Id of the player */
1070
+ guildId: string;
1071
+ /** IF playing a track, all of the track information */
1072
+ track?: LavalinkTrack;
1073
+ /** Lavalink volume (mind volumedecrementer) */
1074
+ volume: number;
1075
+ /** Whether it's paused or not */
1076
+ paused: boolean;
1077
+ /** Voice Endpoint data */
1078
+ voice: LavalinkPlayerVoice;
1079
+ /** All Audio Filters */
1080
+ filters: Partial<LavalinkFilterData>;
1081
+ /** Lavalink-Voice-State Variables */
1082
+ state: {
1083
+ /** Time since connection established */
1084
+ time: number;
1085
+ /** Position of the track */
1086
+ position: number;
1087
+ /** COnnected or not */
1088
+ connected: boolean;
1089
+ /** Ping to voice server */
1090
+ ping: number;
1091
+ };
1092
+ }
1093
+ interface ChannelDeletePacket {
1094
+ /** Packet key for channel delete */
1095
+ t: "CHANNEL_DELETE";
1096
+ /** data which is sent and relevant */
1097
+ d: {
1098
+ /** guild id */
1099
+ guild_id: string;
1100
+ /** Channel id */
1101
+ id: string;
1102
+ };
1103
+ }
1104
+ interface VoiceState {
1105
+ /** OP key from lavalink */
1106
+ op: "voiceUpdate";
1107
+ /** GuildId provided by lavalink */
1108
+ guildId: string;
1109
+ /** Event data */
1110
+ event: VoiceServer;
1111
+ /** Session Id of the voice connection */
1112
+ sessionId?: string;
1113
+ /** guild id of the voice channel */
1114
+ guild_id: string;
1115
+ /** user id from the voice connection */
1116
+ user_id: string;
1117
+ /** Session Id of the voice connection */
1118
+ session_id: string;
1119
+ /** Voice Channel Id */
1120
+ channel_id: string;
1121
+ /** Server Mute status */
1122
+ mute: boolean;
1123
+ /** Server Deaf status */
1124
+ deaf: boolean;
1125
+ /** Self Deaf status */
1126
+ self_deaf: boolean;
1127
+ /** Self Mute status */
1128
+ self_mute: boolean;
1129
+ /** Self Video (Camera) status */
1130
+ self_video: boolean;
1131
+ /** Self Stream status */
1132
+ self_stream: boolean;
1133
+ /** Whether the user requests to speak (stage channel) */
1134
+ request_to_speak_timestamp: boolean;
1135
+ /** Self suppressed status (stage channel) */
1136
+ suppress: boolean;
1137
+ }
1138
+ /** The Base64 decodes tring by lavalink */
1139
+ type Base64 = string;
1140
+ interface VoiceServer {
1141
+ /** Voice Token */
1142
+ token: string;
1143
+ /** Guild Id of the voice server connection */
1144
+ guild_id: string;
1145
+ /** Server Endpoint */
1146
+ endpoint: string;
1147
+ /** Voice Channel Id (Lavalink v4 DAVE support) */
1148
+ channel_id?: string;
1149
+ }
1150
+ interface VoicePacket {
1151
+ /** Voice Packet Keys to send */
1152
+ t?: "VOICE_SERVER_UPDATE" | "VOICE_STATE_UPDATE";
1153
+ /** Voice Packets to send */
1154
+ d: VoiceState | VoiceServer;
1155
+ }
1156
+ interface NodeMessage extends NodeStats {
1157
+ /** The type of the event */
1158
+ type: PlayerEventType;
1159
+ /** what ops are applying to that event */
1160
+ op: "stats" | "playerUpdate" | "event";
1161
+ /** The specific guild id for that message */
1162
+ guildId: string;
1163
+ }
1164
+ /** Specific types to filter for lavasearch, will be filtered to correct types */
1165
+ type LavaSearchType = "track" | "album" | "artist" | "playlist" | "text" | "tracks" | "albums" | "artists" | "playlists" | "texts";
1166
+ interface LavaSearchFilteredResponse {
1167
+ /** The Information of a playlist provided by lavasearch */
1168
+ info: PlaylistInfo;
1169
+ /** additional plugin information */
1170
+ pluginInfo: PluginInfo;
1171
+ /** List of tracks */
1172
+ tracks: Track[];
1173
+ }
1174
+ interface LavaSearchResponse {
1175
+ /** An array of tracks, only present if track is in types */
1176
+ tracks: Track[];
1177
+ /** An array of albums, only present if album is in types */
1178
+ albums: LavaSearchFilteredResponse[];
1179
+ /** An array of artists, only present if artist is in types */
1180
+ artists: LavaSearchFilteredResponse[];
1181
+ /** An array of playlists, only present if playlist is in types */
1182
+ playlists: LavaSearchFilteredResponse[];
1183
+ /** An array of text results, only present if text is in types */
1184
+ texts: {
1185
+ text: string;
1186
+ pluginInfo: PluginInfo;
1187
+ }[];
1188
+ /** Addition result data provided by plugins */
1189
+ pluginInfo: PluginInfo;
1190
+ }
1191
+ /** SearchQuery Object for raw lavalink requests */
1192
+ type SearchQuery = {
1193
+ /** lavalink search Query / identifier string */
1194
+ query: string;
1195
+ /** Extra url query params to use, e.g. for flowertts */
1196
+ extraQueryUrlParams?: URLSearchParams;
1197
+ /** Source to append to the search query string */
1198
+ source?: SearchPlatform;
1199
+ } | /** Our just the search query / identifier string */ string;
1200
+ /** SearchQuery Object for Lavalink LavaSearch Plugin requests */
1201
+ type LavaSearchQuery = {
1202
+ /** lavalink search Query / identifier string */
1203
+ query: string;
1204
+ /** Source to append to the search query string */
1205
+ source: LavaSrcSearchPlatformBase;
1206
+ /** The Types to filter the search to */
1207
+ types?: LavaSearchType[];
1208
+ };
1209
+ type Awaitable<T> = Promise<T> | T;
1210
+ //#endregion
1211
+ //#region src/structures/Types/Filters.d.ts
1212
+ /** The Audio Outputs type */
1213
+ type AudioOutputs = "mono" | "stereo" | "left" | "right";
1214
+ /** The "active" / "disabled" Player Filters */
1215
+ interface PlayerFilters {
1216
+ /** Sets nightcore to false, and vaporwave to false */
1217
+ custom: boolean;
1218
+ /** Sets custom to false, and vaporwave to false */
1219
+ nightcore: boolean;
1220
+ /** Sets custom to false, and nightcore to false */
1221
+ vaporwave: boolean;
1222
+ /** If rotation filter is enabled / not */
1223
+ rotation: boolean;
1224
+ /** if karaoke filter is enabled / not */
1225
+ karaoke: boolean;
1226
+ /** if tremolo filter is enabled / not */
1227
+ tremolo: boolean;
1228
+ /** if vibrato filter is enabled / not */
1229
+ vibrato: boolean;
1230
+ lowPass: boolean;
1231
+ /** audio Output (default stereo, mono sounds the fullest and best for not-stereo tracks) */
1232
+ audioOutput: AudioOutputs;
1233
+ /** if NodeLink echo filter is enabled / not */
1234
+ nodeLinkEcho: boolean;
1235
+ /** if NodeLink chorus filter is enabled / not */
1236
+ nodeLinkChorus: boolean;
1237
+ /** if NodeLink compressor filter is enabled / not */
1238
+ nodeLinkCompressor: boolean;
1239
+ /** if NodeLink highpass filter is enabled / not */
1240
+ nodeLinkHighPass: boolean;
1241
+ /** if NodeLink phaser filter is enabled / not */
1242
+ nodeLinkPhaser: boolean;
1243
+ /** if NodeLink spatial filter is enabled / not */
1244
+ nodeLinkSpatial: boolean;
1245
+ /** Lavalink Volume FILTER (not player Volume, think of it as a gain booster) */
1246
+ volume: boolean;
1247
+ /** Filters for the Lavalink Filter Plugin */
1248
+ lavalinkFilterPlugin: {
1249
+ /** if echo filter is enabled / not */
1250
+ echo: boolean;
1251
+ /** if reverb filter is enabled / not */
1252
+ reverb: boolean;
1253
+ };
1254
+ lavalinkLavaDspxPlugin: {
1255
+ /** if lowPass filter is enabled / not */
1256
+ lowPass: boolean;
1257
+ /** if highPass filter is enabled / not */
1258
+ highPass: boolean;
1259
+ /** if normalization filter is enabled / not */
1260
+ normalization: boolean;
1261
+ /** if echo filter is enabled / not */
1262
+ echo: boolean;
1263
+ };
1264
+ }
1265
+ /**
1266
+ * There are 15 bands (0-14) that can be changed.
1267
+ * "gain" is the multiplier for the given band.
1268
+ * The default value is 0.
1269
+ * 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.
1270
+ * Modifying the gain could also change the volume of the output.
1271
+ */
1272
+ interface EQBand {
1273
+ /** On what band position (0-14) it should work */
1274
+ band: IntegerNumber | number;
1275
+ /** The gain (-0.25 to 1.0) */
1276
+ gain: FloatNumber | number;
1277
+ }
1278
+ /**
1279
+ * Uses equalization to eliminate part of a band, usually targeting vocals.
1280
+ */
1281
+ interface KaraokeFilter {
1282
+ /** The level (0 to 1.0 where 0.0 is no effect and 1.0 is full effect) */
1283
+ level?: number;
1284
+ /** The mono level (0 to 1.0 where 0.0 is no effect and 1.0 is full effect) */
1285
+ monoLevel?: number;
1286
+ /** The filter band (in Hz) */
1287
+ filterBand?: number;
1288
+ /** The filter width */
1289
+ filterWidth?: number;
1290
+ }
1291
+ /**
1292
+ * Changes the speed, pitch, and rate
1293
+ */
1294
+ interface TimescaleFilter {
1295
+ /** The playback speed 0.0 ≤ x */
1296
+ speed?: number;
1297
+ /** The pitch 0.0 ≤ x */
1298
+ pitch?: number;
1299
+ /** The rate 0.0 ≤ x */
1300
+ rate?: number;
1301
+ }
1302
+ /**
1303
+ * Uses amplification to create a shuddering effect, where the volume quickly oscillates.
1304
+ * Demo: https://en.wikipedia.org/wiki/File:Fuse_Electronics_Tremolo_MK-III_Quick_Demo.ogv
1305
+ */
1306
+ interface TremoloFilter {
1307
+ /** The frequency 0.0 < x */
1308
+ frequency?: number;
1309
+ /** The tremolo depth 0.0 < x ≤ 1.0 */
1310
+ depth?: number;
1311
+ }
1312
+ /**
1313
+ * Similar to tremolo. While tremolo oscillates the volume, vibrato oscillates the pitch.
1314
+ */
1315
+ interface VibratoFilter {
1316
+ /** The frequency 0.0 < x ≤ 14.0 */
1317
+ frequency?: number;
1318
+ /** The vibrato depth 0.0 < x ≤ 1.0 */
1319
+ depth?: number;
1320
+ }
1321
+ /**
1322
+ * Rotates the sound around the stereo channels/user headphones (aka Audio Panning).
1323
+ * It can produce an effect similar to https://youtu.be/QB9EB8mTKcc (without the reverb).
1324
+ */
1325
+ interface RotationFilter {
1326
+ /** The frequency of the audio rotating around the listener in Hz. 0.2 is similar to the example video above */
1327
+ rotationHz?: number;
1328
+ }
1329
+ /**
1330
+ * Distortion effect. It can generate some pretty unique audio effects.
1331
+ */
1332
+ interface DistortionFilter {
1333
+ sinOffset?: number;
1334
+ sinScale?: number;
1335
+ cosOffset?: number;
1336
+ cosScale?: number;
1337
+ tanOffset?: number;
1338
+ tanScale?: number;
1339
+ offset?: number;
1340
+ scale?: number;
1341
+ }
1342
+ /**
1343
+ * Mixes both channels (left and right), with a configurable factor on how much each channel affects the other.
1344
+ * With the defaults, both channels are kept independent of each other.
1345
+ * Setting all factors to 0.5 means both channels get the same audio.
1346
+ */
1347
+ interface ChannelMixFilter {
1348
+ /** The left to left channel mix factor (0.0 ≤ x ≤ 1.0) */
1349
+ leftToLeft?: number;
1350
+ /** The left to right channel mix factor (0.0 ≤ x ≤ 1.0) */
1351
+ leftToRight?: number;
1352
+ /** The right to left channel mix factor (0.0 ≤ x ≤ 1.0) */
1353
+ rightToLeft?: number;
1354
+ /** The right to right channel mix factor (0.0 ≤ x ≤ 1.0) */
1355
+ rightToRight?: number;
1356
+ }
1357
+ /**
1358
+ * Creates delay-based echo with feedback control
1359
+ */
1360
+ interface NodeLink_EchoFilter {
1361
+ /** Delay time in milliseconds (0 to 5000ms) */
1362
+ delay?: number;
1363
+ /** Amount of signal fed back into the delay (0.0 to 1.0) */
1364
+ feedback?: number;
1365
+ /** Dry/wet mix ratio (0.0 = dry only, 1.0 = wet only) */
1366
+ mix?: number;
1367
+ }
1368
+ /**
1369
+ * Simulates multiple voices playing together with modulated delays
1370
+ */
1371
+ interface NodeLink_ChorusFilter {
1372
+ /** LFO modulation rate in Hz */
1373
+ rate?: number;
1374
+ /** Modulation depth (0.0 to 1.0) */
1375
+ depth?: number;
1376
+ /** Base delay time in milliseconds (1 to 45ms) */
1377
+ delay?: number;
1378
+ /** Dry/wet mix ratio (0.0 to 1.0) */
1379
+ mix?: number;
1380
+ /** Feedback amount (0.0 to 0.95) */
1381
+ feedback?: number;
1382
+ }
1383
+ /**
1384
+ * Dynamic range compression for balanced audio levels
1385
+ */
1386
+ interface NodeLink_CompressorFilter {
1387
+ /** Threshold level in dB (when compression starts) */
1388
+ threshold?: number;
1389
+ /** Compression ratio (1.0 = no compression, higher = more compression) */
1390
+ ratio?: number;
1391
+ /** Attack time in milliseconds (how fast compression engages) */
1392
+ attack?: number;
1393
+ /** Release time in milliseconds (how fast compression disengages) */
1394
+ release?: number;
1395
+ /** Makeup gain in dB (compensates for volume reduction) */
1396
+ gain?: number;
1397
+ }
1398
+ /**
1399
+ * Filters out low frequencies, letting high frequencies pass through
1400
+ */
1401
+ interface NodeLink_HighPassFilter {
1402
+ /** Smoothing factor (must be > 1.0 to enable) */
1403
+ smoothing?: number;
1404
+ }
1405
+ /**
1406
+ * Sweeps all-pass filters across the frequency spectrum for a swooshing effect
1407
+ */
1408
+ interface NodeLink_PhaserFilter {
1409
+ /** Number of filter stages (2 to 12, more = stronger effect) */
1410
+ stages?: number;
1411
+ /** LFO sweep rate in Hz */
1412
+ rate?: number;
1413
+ /** Modulation depth (0.0 to 1.0) */
1414
+ depth?: number;
1415
+ /** Feedback amount (0.0 to 0.9) */
1416
+ feedback?: number;
1417
+ /** Dry/wet mix ratio (0.0 to 1.0) */
1418
+ mix?: number;
1419
+ /** Minimum sweep frequency in Hz */
1420
+ minFrequency?: number;
1421
+ /** Maximum sweep frequency in Hz */
1422
+ maxFrequency?: number;
1423
+ }
1424
+ /**
1425
+ * Creates spatial audio using cross-channel delays and modulation
1426
+ */
1427
+ interface NodeLink_SpatialFilter {
1428
+ /** Effect depth (0.0 to 1.0) */
1429
+ depth?: number;
1430
+ /** Modulation rate in Hz */
1431
+ rate?: number;
1432
+ }
1433
+ /**
1434
+ * Higher frequencies get suppressed, while lower frequencies pass through this filter, thus the name low pass.
1435
+ * Any smoothing values equal to or less than 1.0 will disable the filter.
1436
+ */
1437
+ interface LowPassFilter {
1438
+ /** The smoothing factor (1.0 < x) */
1439
+ smoothing?: number;
1440
+ }
1441
+ /**
1442
+ * Filter Data stored in the Client and partially sent to Lavalink
1443
+ */
1444
+ interface FilterData {
1445
+ volume?: number;
1446
+ karaoke?: KaraokeFilter;
1447
+ timescale?: TimescaleFilter;
1448
+ tremolo?: TremoloFilter;
1449
+ vibrato?: VibratoFilter;
1450
+ rotation?: RotationFilter;
1451
+ distortion?: DistortionFilter;
1452
+ channelMix?: ChannelMixFilter;
1453
+ lowPass?: LowPassFilter;
1454
+ echo?: NodeLink_EchoFilter;
1455
+ chorus?: NodeLink_ChorusFilter;
1456
+ compressor?: NodeLink_CompressorFilter;
1457
+ highPass?: NodeLink_HighPassFilter;
1458
+ phaser?: NodeLink_PhaserFilter;
1459
+ spatial?: NodeLink_SpatialFilter;
1460
+ pluginFilters?: {
1461
+ "lavalink-filter-plugin"?: {
1462
+ echo?: {
1463
+ delay?: number;
1464
+ decay?: number;
1465
+ };
1466
+ reverb?: {
1467
+ delays?: number[];
1468
+ gains?: number[];
1469
+ };
1470
+ };
1471
+ "high-pass"?: {
1472
+ cutoffFrequency?: number;
1473
+ boostFactor?: number;
1474
+ };
1475
+ "low-pass"?: {
1476
+ cutoffFrequency?: number;
1477
+ boostFactor?: number;
1478
+ };
1479
+ normalization?: {
1480
+ maxAmplitude?: number;
1481
+ adaptive?: boolean;
1482
+ };
1483
+ echo?: {
1484
+ echoLength?: number;
1485
+ decay?: number;
1486
+ };
1487
+ };
1488
+ }
1489
+ /**
1490
+ * Actual Filter Data sent to Lavalink
1491
+ */
1492
+ interface LavalinkFilterData extends FilterData {
1493
+ equalizer?: EQBand[];
1494
+ }
1495
+ //#endregion
1496
+ //#region src/structures/Types/NodeLink.d.ts
1497
+ type NodeLinkEventTypes = "PlayerCreatedEvent" | "PlayerDestroyedEvent" | "PlayerConnectedEvent" | "PlayerReconnectingEvent" | "VolumeChangedEvent" | "FiltersChangedEvent" | "SeekEvent" | "PauseEvent" | "ConnectionStatusEvent" | "MixStartedEvent" | "MixEndedEvent" | "LyricsFoundEvent" | "LyricsLineEvent" | "LyricsNotFoundEvent";
1498
+ interface NodeLinkBaseEvent {
1499
+ op: "event";
1500
+ type: NodeLinkEventTypes;
1501
+ guildId: string;
1502
+ }
1503
+ interface PlayerCreatedEvent extends NodeLinkBaseEvent {
1504
+ type: "PlayerCreatedEvent";
1505
+ }
1506
+ interface PlayerDestroyedEvent extends NodeLinkBaseEvent {
1507
+ type: "PlayerDestroyedEvent";
1508
+ }
1509
+ interface PlayerConnectedEvent extends NodeLinkBaseEvent {
1510
+ type: "PlayerConnectedEvent";
1511
+ }
1512
+ interface PlayerReconnectingEvent extends NodeLinkBaseEvent {
1513
+ type: "PlayerReconnectingEvent";
1514
+ }
1515
+ interface VolumeChangedEvent extends NodeLinkBaseEvent {
1516
+ type: "VolumeChangedEvent";
1517
+ /** New volume level (0-1000) */
1518
+ volume: number;
1519
+ }
1520
+ interface FiltersChangedEvent extends NodeLinkBaseEvent {
1521
+ type: "FiltersChangedEvent";
1522
+ filters: LavalinkFilterData;
1523
+ }
1524
+ interface SeekEvent extends NodeLinkBaseEvent {
1525
+ type: "SeekEvent";
1526
+ /** New position in milliseconds */
1527
+ position: number;
1528
+ }
1529
+ interface PauseEvent extends NodeLinkBaseEvent {
1530
+ type: "PauseEvent";
1531
+ /** Whether playback is now paused (true) or resumed (false) */
1532
+ paused: boolean;
1533
+ }
1534
+ interface ConnectionStatusEvent extends NodeLinkBaseEvent {
1535
+ type: "ConnectionStatusEvent";
1536
+ /** Current connection status */
1537
+ connected: boolean;
1538
+ }
1539
+ interface MixStartedEvent extends NodeLinkBaseEvent {
1540
+ type: "MixStartedEvent";
1541
+ /** Unique identifier for the mix layer */
1542
+ mixId: string;
1543
+ /** Full track information of the mixed layer */
1544
+ track: LavalinkTrack;
1545
+ /** Volume of the mixed layer (0.0 to 1.0) */
1546
+ volume: number;
1547
+ }
1548
+ interface MixEndedEvent extends NodeLinkBaseEvent {
1549
+ type: "MixEndedEvent";
1550
+ /** Unique identifier for the mix layer */
1551
+ mixId: string;
1552
+ /** Reason the mix layer ended (FINISHED, REMOVED, ERROR, MAIN_ENDED) */
1553
+ reason: "FINISHED" | "REMOVED" | "ERROR" | "MAIN_ENDED" | string;
1554
+ }
1555
+ type NodeLinkEventPayload<T extends NodeLinkEventTypes> = T extends "PlayerCreatedEvent" ? PlayerCreatedEvent : T extends "PlayerDestroyedEvent" ? PlayerDestroyedEvent : T extends "PlayerConnectedEvent" ? PlayerConnectedEvent : T extends "PlayerReconnectingEvent" ? PlayerReconnectingEvent : T extends "VolumeChangedEvent" ? VolumeChangedEvent : T extends "FiltersChangedEvent" ? FiltersChangedEvent : T extends "SeekEvent" ? SeekEvent : T extends "PauseEvent" ? PauseEvent : T extends "ConnectionStatusEvent" ? ConnectionStatusEvent : T extends "MixStartedEvent" ? MixStartedEvent : T extends "MixEndedEvent" ? MixEndedEvent : never;
1556
+ type HealthStatusThreshold = {
1557
+ excellent: number;
1558
+ good: number;
1559
+ fair: number;
1560
+ poor: number;
1561
+ };
1562
+ type HealthStatusThresholdOptions = {
1563
+ cpu: Partial<HealthStatusThreshold>;
1564
+ memory: Partial<HealthStatusThreshold>;
1565
+ ping: Partial<HealthStatusThreshold>;
1566
+ };
1567
+ type NodeMetricSummary = {
1568
+ cpuLoad: number;
1569
+ systemLoad: number;
1570
+ memoryUsage: number;
1571
+ players: number;
1572
+ playingPlayers: number;
1573
+ uptime: number;
1574
+ ping: number;
1575
+ frameDeficit: number;
1576
+ };
1577
+ type HealthStatusObject = {
1578
+ status: HealthStatusKeys;
1579
+ performance: HealthPerformanceKeys;
1580
+ isOverloaded: boolean;
1581
+ needsRestart: boolean;
1582
+ penaltyScore: number;
1583
+ estimatedRemainingCapacity: number;
1584
+ recommendations: string[];
1585
+ metrics: {
1586
+ cpuLoad: number;
1587
+ memoryUsage: number;
1588
+ players: number;
1589
+ playingPlayers: number;
1590
+ uptime: number;
1591
+ ping: number;
1592
+ frameDeficit: number;
1593
+ };
1594
+ };
1595
+ type HealthPerformanceKeys = "excellent" | "good" | "fair" | "poor";
1596
+ type HealthStatusKeys = "healthy" | "degraded" | "critical" | "offline";
1597
+ type AddMixerLayerResponse = {
1598
+ id: string;
1599
+ track: LavalinkTrack;
1600
+ volume: number;
1601
+ };
1602
+ type ListMixerLayersResponse = {
1603
+ mixes: {
1604
+ id: string;
1605
+ track: LavalinkTrack;
1606
+ volume: number;
1607
+ position: number;
1608
+ startTime: number;
1609
+ }[];
1610
+ };
1611
+ type ConnectionMetricsResponse = {
1612
+ status: string;
1613
+ metrics: {
1614
+ speed: {
1615
+ bps: number;
1616
+ kbps: number;
1617
+ mbps: number;
1618
+ };
1619
+ downloadedBytes: number;
1620
+ durationSeconds: number;
1621
+ timestamp: number;
1622
+ };
1623
+ };
1624
+ type NodeLinkLyricsSynced = {
1625
+ loadType: string;
1626
+ data: {
1627
+ synced: true;
1628
+ lang: string;
1629
+ source: string;
1630
+ lines: [{
1631
+ text: string;
1632
+ time: number;
1633
+ duration: number;
1634
+ }, {
1635
+ text: string;
1636
+ time: number;
1637
+ duration: number;
1638
+ }, {
1639
+ text: string;
1640
+ time: number;
1641
+ duration: number;
1642
+ }];
1643
+ };
1644
+ };
1645
+ type NodeLinkLyricsPlain = {
1646
+ loadType: string;
1647
+ data: {
1648
+ synced: false;
1649
+ lang: string;
1650
+ source: string;
1651
+ lines: [{
1652
+ text: string;
1653
+ time: null;
1654
+ duration: null;
1655
+ }, {
1656
+ text: string;
1657
+ time: null;
1658
+ duration: null;
1659
+ }, {
1660
+ text: string;
1661
+ time: null;
1662
+ duration: null;
1663
+ }];
1664
+ };
1665
+ };
1666
+ type NodeLinkLyrics = NodeLinkLyricsSynced | NodeLinkLyricsPlain;
1667
+ type NodeLinkNoLyrics = {
1668
+ loadType: string;
1669
+ data: {};
1670
+ };
1671
+ type NodeLinkChapter = {
1672
+ title: string;
1673
+ startTime: number;
1674
+ thumbnails: [{
1675
+ url: string;
1676
+ width: number;
1677
+ height: number;
1678
+ }];
1679
+ duration: number;
1680
+ endTime: number;
1681
+ };
1682
+ type DirectStreamResponse = {
1683
+ url: string;
1684
+ protocol: string;
1685
+ format: string;
1686
+ hlsUrl: string | null;
1687
+ formats: {
1688
+ itag: number;
1689
+ mimeType: string;
1690
+ qualityLabel: string;
1691
+ bitrate: number;
1692
+ }[];
1693
+ };
1694
+ type YoutubeOAuthResponse = {
1695
+ access_token: string;
1696
+ expires_in: number;
1697
+ scope: string;
1698
+ token_type: string;
1699
+ };
1700
+ type MeaningResponse = {
1701
+ loadType: "meaning";
1702
+ data: {
1703
+ title: string;
1704
+ description: string;
1705
+ paragraphs: string[];
1706
+ url: string;
1707
+ provider: string;
1708
+ type: string;
1709
+ };
1710
+ };
1711
+ //#endregion
1712
+ //#region src/structures/Constants.d.ts
1713
+ /**
1714
+ * Debug events for more detailed logging
1715
+ */
1716
+ declare enum DebugEvents {
1717
+ SetSponsorBlock = "SetSponsorBlock",
1718
+ DeleteSponsorBlock = "DeleteSponsorBlock",
1719
+ TrackEndReplaced = "TrackEndReplaced",
1720
+ AutoplayExecution = "AutoplayExecution",
1721
+ AutoplayNoSongsAdded = "AutoplayNoSongsAdded",
1722
+ AutoplayThresholdSpamLimiter = "AutoplayThresholdSpamLimiter",
1723
+ TriggerQueueEmptyInterval = "TriggerQueueEmptyInterval",
1724
+ QueueEnded = "QueueEnded",
1725
+ TrackStartNewSongsOnly = "TrackStartNewSongsOnly",
1726
+ TrackStartNoTrack = "TrackStartNoTrack",
1727
+ ResumingFetchingError = "ResumingFetchingError",
1728
+ PlayerUpdateNoPlayer = "PlayerUpdateNoPlayer",
1729
+ PlayerUpdateFilterFixApply = "PlayerUpdateFilterFixApply",
1730
+ PlayerUpdateSuccess = "PlayerUpdateSuccess",
1731
+ HeartBeatTriggered = "HeartBeatTriggered",
1732
+ NoSocketOnDestroy = "NoSocketOnDestroy",
1733
+ SocketCleanupError = "SocketCleanupError",
1734
+ SocketTerminateHeartBeatTimeout = "SocketTerminateHeartBeatTimeout",
1735
+ TryingConnectWhileConnected = "TryingConnectWhileConnected",
1736
+ LavaSearchNothingFound = "LavaSearchNothingFound",
1737
+ SearchNothingFound = "SearchNothingFound",
1738
+ ValidatingBlacklistLinks = "ValidatingBlacklistLinks",
1739
+ ValidatingWhitelistLinks = "ValidatingWhitelistLinks",
1740
+ TrackErrorMaxTracksErroredPerTime = "TrackErrorMaxTracksErroredPerTime",
1741
+ TrackStuckMaxTracksErroredPerTime = "TrackStuckMaxTracksErroredPerTime",
1742
+ PlayerDestroyingSomewhereElse = "PlayerDestroyingSomewhereElse",
1743
+ PlayerCreateNodeNotFound = "PlayerCreateNodeNotFound",
1744
+ PlayerPlayQueueEmptyTimeoutClear = "PlayerPlayQueueEmptyTimeoutClear",
1745
+ PlayerPlayWithTrackReplace = "PlayerPlayWithTrackReplace",
1746
+ PlayerPlayUnresolvedTrack = "PlayerPlayUnresolvedTrack",
1747
+ PlayerPlayUnresolvedTrackFailed = "PlayerPlayUnresolvedTrackFailed",
1748
+ PlayerVolumeAsFilter = "PlayerVolumeAsFilter",
1749
+ BandcampSearchLokalEngine = "BandcampSearchLokalEngine",
1750
+ PlayerChangeNode = "PlayerChangeNode",
1751
+ BuildTrackError = "BuildTrackError",
1752
+ TransformRequesterFunctionFailed = "TransformRequesterFunctionFailed",
1753
+ GetClosestTrackFailed = "GetClosestTrackFailed",
1754
+ PlayerDeleteInsteadOfDestroy = "PlayerDeleteInsteadOfDestroy",
1755
+ FailedToConnectToNodes = "FailedToConnectToNodes",
1756
+ NoAudioDebug = "NoAudioDebug",
1757
+ PlayerAutoReconnect = "PlayerAutoReconnect",
1758
+ PlayerDestroyFail = "PlayerDestroyFail",
1759
+ PlayerChangeNodeFailNoEligibleNode = "PlayerChangeNodeFailNoEligibleNode",
1760
+ PlayerChangeNodeFail = "PlayerChangeNodeFail"
1761
+ }
1762
+ /**
1763
+ * Reasons why a player got destroyed
1764
+ */
1765
+ declare enum DestroyReasons {
1766
+ QueueEmpty = "QueueEmpty",
1767
+ NodeDestroy = "NodeDestroy",
1768
+ NodeDeleted = "NodeDeleted",
1769
+ LavalinkNoVoice = "LavalinkNoVoice",
1770
+ NodeReconnectFail = "NodeReconnectFail",
1771
+ Disconnected = "Disconnected",
1772
+ PlayerReconnectFail = "PlayerReconnectFail",
1773
+ PlayerChangeNodeFail = "PlayerChangeNodeFail",
1774
+ PlayerChangeNodeFailNoEligibleNode = "PlayerChangeNodeFailNoEligibleNode",
1775
+ ChannelDeleted = "ChannelDeleted",
1776
+ DisconnectAllNodes = "DisconnectAllNodes",
1777
+ ReconnectAllNodes = "ReconnectAllNodes",
1778
+ TrackErrorMaxTracksErroredPerTime = "TrackErrorMaxTracksErroredPerTime",
1779
+ TrackStuckMaxTracksErroredPerTime = "TrackStuckMaxTracksErroredPerTime"
1780
+ }
1781
+ /**
1782
+ * Reasons why a player got disconnected
1783
+ */
1784
+ declare enum DisconnectReasons {
1785
+ Disconnected = "Disconnected",
1786
+ DisconnectAllNodes = "DisconnectAllNodes"
1787
+ }
1788
+ /** The valid SponsorBlock categories */
1789
+ declare const validSponsorBlocks: string[];
1790
+ /** The audio Outputs Data map declaration */
1791
+ declare const audioOutputsData: Record<AudioOutputs, ChannelMixFilter>;
1792
+ /** Equalizer Presets */
1793
+ declare const EQList: {
1794
+ /** A Bassboost Equalizer, so high it distorts the audio */
1795
+ BassboostEarrape: EQBand[];
1796
+ /** A High and decent Bassboost Equalizer */
1797
+ BassboostHigh: EQBand[];
1798
+ /** A decent Bassboost Equalizer */
1799
+ BassboostMedium: EQBand[];
1800
+ /** A slight Bassboost Equalizer */
1801
+ BassboostLow: EQBand[];
1802
+ /** Makes the Music slightly "better" */
1803
+ BetterMusic: EQBand[];
1804
+ /** Makes the Music sound like rock music / sound rock music better */
1805
+ Rock: EQBand[];
1806
+ /** Makes the Music sound like Classic music / sound Classic music better */
1807
+ Classic: EQBand[];
1808
+ /** Makes the Music sound like Pop music / sound Pop music better */
1809
+ Pop: EQBand[];
1810
+ /** Makes the Music sound like Electronic music / sound Electronic music better */
1811
+ Electronic: EQBand[];
1812
+ /** Boosts all Bands slightly for louder and fuller sound */
1813
+ FullSound: EQBand[];
1814
+ /** Boosts basses + lower highs for a pro gaming sound */
1815
+ Gaming: EQBand[];
1816
+ };
1817
+ declare const RecommendationsStrings: {
1818
+ highCPULoad: (cpuLoad: number) => string;
1819
+ highSystemLoad: (systemLoad: number) => string;
1820
+ highMemoryUsage: (memoryUsagePercent: number) => string;
1821
+ frameDeficit: (frameDeficit: number) => string;
1822
+ highLatency: (ping: number) => string;
1823
+ nodeRestart: string;
1824
+ highPlayercount: (players: number) => string;
1825
+ nodeOffline: string;
1826
+ checkConnectivity: string;
1827
+ };
1828
+ declare const NodeLinkExclusiveEvents: NodeLinkEventTypes[];
1829
+ //#endregion
1830
+ //#region src/structures/Filters.d.ts
1831
+ declare class FilterManager {
1832
+ static EQList: {
1833
+ BassboostEarrape: EQBand[];
1834
+ BassboostHigh: EQBand[];
1835
+ BassboostMedium: EQBand[];
1836
+ BassboostLow: EQBand[];
1837
+ BetterMusic: EQBand[];
1838
+ Rock: EQBand[];
1839
+ Classic: EQBand[];
1840
+ Pop: EQBand[];
1841
+ Electronic: EQBand[];
1842
+ FullSound: EQBand[];
1843
+ Gaming: EQBand[];
1844
+ };
1845
+ /** The Equalizer bands currently applied to the Lavalink Server */
1846
+ equalizerBands: EQBand[];
1847
+ /** Private Util for the instaFix Filters option */
1848
+ filterUpdatedState: boolean;
1849
+ /** All "Active" / "disabled" Player Filters */
1850
+ filters: PlayerFilters;
1851
+ /** The Filter Data sent to Lavalink, only if the filter is enabled (ofc.) */
1852
+ data: FilterData;
1853
+ /** The Player assigned to this Filter Manager */
1854
+ player: Player;
1855
+ /** The Constructor for the FilterManager */
1856
+ constructor(player: Player);
1857
+ /**
1858
+ * Apply Player filters for lavalink filter sending data, if the filter is enabled / not
1859
+ *
1860
+ * @returns {Promise<void>}
1861
+ *
1862
+ * @example
1863
+ * ```ts
1864
+ * // Apply the filters after changing them manually:
1865
+ * player.filterManager.data.volume = 0.5;
1866
+ * // maybe you wanna manually set a distorition filter? then do it like this...
1867
+ * player.filterManager.data.distortion = { sinOffset: 0.5, sinScale: 2, cosOffset: 0.5, cosScale: 2, tanOffset: 0.5, tanScale: 2, offset: 0.5, scale: 2 };
1868
+ * await player.filterManager.applyPlayerFilters();
1869
+ * ```
1870
+ */
1871
+ applyPlayerFilters(): Promise<void>;
1872
+ private privateNot0;
1873
+ private getLavalinkFilterData;
1874
+ /**
1875
+ * Checks if the filters are correctly stated (active / not-active) - mostly used internally.
1876
+ * @param oldFilterTimescale
1877
+ * @returns {boolean} True, if the check was successfull
1878
+ *
1879
+ * @example
1880
+ * ```ts
1881
+ * // Check the filter states
1882
+ * player.filterManager.checkFiltersState();
1883
+ * // Apply the filters after checking
1884
+ * await player.filterManager.applyPlayerFilters();
1885
+ * ```
1886
+ */
1887
+ checkFiltersState(oldFilterTimescale?: Partial<TimescaleFilter>): boolean;
1888
+ /**
1889
+ * Reset all Filters
1890
+ * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
1891
+ *
1892
+ * @example
1893
+ * ```ts
1894
+ * // Reset all filters
1895
+ * await player.filterManager.resetFilters();
1896
+ * ```
1897
+ */
1898
+ resetFilters(): Promise<FilterManager>;
1899
+ /**
1900
+ * Set the Filter Volume
1901
+ * @param volume the volume (0.0 - 5.0)
1902
+ * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
1903
+ *
1904
+ * @example
1905
+ * ```ts
1906
+ * // Set Volume to 50%
1907
+ * await player.filterManager.setVolume(0.5);
1908
+ * // note this is a filter, so it will "jump" to the volume, i think it's like a "volume boost effect" so i marketed it as a filter
1909
+ * ```
1910
+ */
1911
+ setVolume(volume: number): Promise<this>;
1912
+ /**
1913
+ * Set the AudioOutput Filter
1914
+ * @param {AudioOutputs} type the audio output type
1915
+ * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
1916
+ *
1917
+ * @example
1918
+ * ```ts
1919
+ * // Set Audio Output to Mono
1920
+ * await player.filterManager.setAudioOutput("mono");
1921
+ *
1922
+ * // Set Audio Output to Stereo
1923
+ * await player.filterManager.setAudioOutput("stereo");
1924
+ *
1925
+ * // Set Audio Output to Left
1926
+ * await player.filterManager.setAudioOutput("left");
1927
+ *
1928
+ * // Set Audio Output to Right
1929
+ * await player.filterManager.setAudioOutput("right");
1930
+ * ```
1931
+ */
1932
+ setAudioOutput(type: AudioOutputs): Promise<FilterManager>;
1933
+ /**
1934
+ * Set custom filter.timescale#speed . This method disabled both: nightcore & vaporwave. use 1 to reset it to normal
1935
+ * @param {number} speed set the speed of the filter
1936
+ * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
1937
+ *
1938
+ * @example
1939
+ * ```ts
1940
+ * // Set Speed to 1.25 (disableds nightcore and vaporwave effect which are pre-made timescale settings of rate,pitch and speed)
1941
+ * await player.filterManager.setSpeed(1.25);
1942
+ * ```
1943
+ */
1944
+ setSpeed(speed?: number): Promise<FilterManager>;
1945
+ /**
1946
+ * Set custom filter.timescale#pitch . This method disabled both: nightcore & vaporwave. use 1 to reset it to normal
1947
+ * @param {number} pitch set the pitch of the filter
1948
+ * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
1949
+ *
1950
+ * @example
1951
+ * ```ts
1952
+ * // Set Pitch to 1.25 (disableds nightcore and vaporwave effect which are pre-made timescale settings of rate,pitch and speed)
1953
+ * await player.filterManager.setPitch(1.25);
1954
+ * ```
1955
+ */
1956
+ setPitch(pitch?: number): Promise<FilterManager>;
1957
+ /**
1958
+ * Set custom filter.timescale#rate . This method disabled both: nightcore & vaporwave. use 1 to reset it to normal
1959
+ * @param {number} rate set the rate of the filter
1960
+ * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
1961
+ *
1962
+ * @example
1963
+ * ```ts
1964
+ * // Set Rate to 1.25 (disableds nightcore and vaporwave effect which are pre-made timescale settings of rate,pitch and speed)
1965
+ * await player.filterManager.setRate(1.25);
1966
+ * ```
1967
+ */
1968
+ setRate(rate?: number): Promise<FilterManager>;
1969
+ /**
1970
+ * Enables / Disables the rotation effect, (Optional: provide your Own Data)
1971
+ * @param {number} rotationHz set the rotationHz of the filter
1972
+ * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
1973
+ *
1974
+ * @example
1975
+ * ```ts
1976
+ * // Toggle Rotation filter with custom settings
1977
+ * await player.filterManager.toggleRotation(0.4);
1978
+ * // or use the defaults
1979
+ * await player.filterManager.toggleRotation();
1980
+ * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
1981
+ * ```
1982
+ */
1983
+ toggleRotation(rotationHz?: number): Promise<FilterManager>;
1984
+ /**
1985
+ * Enables / Disables the Vibrato effect, (Optional: provide your Own Data)
1986
+ * @param {number} frequency set the frequency of the filter
1987
+ * @param {number} depth set the depth of the filter
1988
+ * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
1989
+ *
1990
+ * @example
1991
+ * ```ts
1992
+ * // Toggle Vibrato filter with custom settings
1993
+ * await player.filterManager.toggleVibrato(8, 0.5);
1994
+ * // or use the defaults
1995
+ * await player.filterManager.toggleVibrato();
1996
+ * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
1997
+ * ```
1998
+ */
1999
+ toggleVibrato(frequency?: number, depth?: number): Promise<FilterManager>;
2000
+ /**
2001
+ * Enables / Disables the Tremolo effect, (Optional: provide your Own Data)
2002
+ * @param {number} frequency set the frequency of the filter
2003
+ * @param {number} depth set the depth of the filter
2004
+ * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
2005
+ *
2006
+ * @example
2007
+ * ```ts
2008
+ * // Toggle Tremolo filter with custom settings
2009
+ * await player.filterManager.toggleTremolo(5, 0.7);
2010
+ * // or use the defaults
2011
+ * await player.filterManager.toggleTremolo();
2012
+ * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
2013
+ * ```
2014
+ */
2015
+ toggleTremolo(frequency?: number, depth?: number): Promise<FilterManager>;
2016
+ /**
2017
+ * Enables / Disables the LowPass effect, (Optional: provide your Own Data)
2018
+ * @param {number} smoothing set the smoothing of the filter
2019
+ * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
2020
+ *
2021
+ * @example
2022
+ * ```ts
2023
+ * // Toggle LowPass filter with custom settings
2024
+ * await player.filterManager.toggleLowPass(30);
2025
+ * // or use the defaults
2026
+ * await player.filterManager.toggleLowPass();
2027
+ * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
2028
+ * ```
2029
+ */
2030
+ toggleLowPass(smoothing?: number): Promise<FilterManager>;
2031
+ /**
2032
+ * Lavalink LavaDspx Plugin Filters
2033
+ */
2034
+ lavalinkLavaDspxPlugin: {
2035
+ /**
2036
+ * Enables / Disables the LowPass effect, (Optional: provide your Own Data)
2037
+ * @param {number} boostFactor set the boost factor of the filter
2038
+ * @param {number} cutoffFrequency set the cutoff frequency of the filter
2039
+ * @returns {Promise<boolean>} the state of the filter after execution.
2040
+ *
2041
+ * @example
2042
+ * ```ts
2043
+ * // Toggle LowPass filter with custom settings
2044
+ * await player.filterManager.lavalinkLavaDspxPlugin.toggleLowPass(1.2, 300);
2045
+ * // or use the defaults
2046
+ * await player.filterManager.lavalinkLavaDspxPlugin.toggleLowPass();
2047
+ * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
2048
+ * ```
2049
+ */
2050
+ toggleLowPass: (boostFactor?: number, cutoffFrequency?: number) => Promise<FilterManager>;
2051
+ /**
2052
+ * Enables / Disables the HighPass effect, (Optional: provide your Own Data)
2053
+ * @param {number} boostFactor [] set the boost factor of the filter
2054
+ * @param {number} cutoffFrequency set the cutoff frequency of the filter
2055
+ * @returns {Promise<boolean>} the state of the filter after execution.
2056
+ *
2057
+ * @example
2058
+ * ```ts
2059
+ * // Toggle HighPass filter with custom settings
2060
+ * await player.filterManager.lavalinkLavaDspxPlugin.toggleHighPass(1.2, 150); // custom values
2061
+ * // or use the defaults
2062
+ * await player.filterManager.lavalinkLavaDspxPlugin.toggleHighPass();
2063
+ * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
2064
+ * ```
2065
+ */
2066
+ toggleHighPass: (boostFactor?: number, cutoffFrequency?: number) => Promise<FilterManager>;
2067
+ /**
2068
+ * Enables / Disables the Normalization effect.
2069
+ * @param {number} [maxAmplitude=0.75] - The maximum amplitude of the audio.
2070
+ * @param {boolean} [adaptive=true] Whether to use adaptive normalization or not.
2071
+ * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
2072
+ *
2073
+ * @example
2074
+ * ```ts
2075
+ * // Toggle Normalization filter with custom settings
2076
+ * await player.filterManager.lavalinkLavaDspxPlugin.toggleNormalization(0.9, false); // custom values
2077
+ * // or use the defaults
2078
+ * await player.filterManager.lavalinkLavaDspxPlugin.toggleNormalization();
2079
+ * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
2080
+ * ```
2081
+ */
2082
+ toggleNormalization: (maxAmplitude?: number, adaptive?: boolean) => Promise<FilterManager>;
2083
+ /**
2084
+ * Enables / Disables the Echo effect, IMPORTANT! Only works with the correct Lavalink Plugin installed. (Optional: provide your Own Data)
2085
+ * @param {number} [decay=0.5] The decay of the echo effect.
2086
+ * @param {number} [echoLength=0.5] The length of the echo effect.
2087
+ * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
2088
+ *
2089
+ * @example
2090
+ * ```ts
2091
+ * // Toggle Echo filter with custom settings
2092
+ * await player.filterManager.lavalinkLavaDspxPlugin.toggleEcho(0.7, 0.6); // custom values
2093
+ * // or use the defaults
2094
+ * await player.filterManager.lavalinkLavaDspxPlugin.toggleEcho();
2095
+ * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
2096
+ * ```
2097
+ */
2098
+ toggleEcho: (decay?: number, echoLength?: number) => Promise<FilterManager>;
2099
+ };
2100
+ /**
2101
+ * LavalinkFilter Plugin specific Filters
2102
+ */
2103
+ lavalinkFilterPlugin: {
2104
+ /**
2105
+ * Enables / Disables the Echo effect, IMPORTANT! Only works with the correct Lavalink Plugin installed. (Optional: provide your Own Data)
2106
+ * @param {number} delay set the delay of the echo
2107
+ * @param {number} decay set the decay of the echo
2108
+ * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
2109
+ *
2110
+ * @example
2111
+ * ```ts
2112
+ * // Toggle Echo filter with custom settings
2113
+ * await player.filterManager.lavalinkFilterPlugin.toggleEcho(3, 0.7); // custom values
2114
+ * // or use the defaults
2115
+ * await player.filterManager.lavalinkFilterPlugin.toggleEcho();
2116
+ * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
2117
+ * ```
2118
+ */
2119
+ toggleEcho: (delay?: number, decay?: number) => Promise<FilterManager>;
2120
+ /**
2121
+ * Enables / Disables the Echo effect, IMPORTANT! Only works with the correct Lavalink Plugin installed. (Optional: provide your Own Data)
2122
+ * @param {number} delays set the delays of the reverb
2123
+ * @param {number} gains set the gains of the reverb
2124
+ * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
2125
+ *
2126
+ * @example
2127
+ * ```ts
2128
+ * // Toggle Reverb filter with custom settings
2129
+ * await player.filterManager.lavalinkFilterPlugin.toggleReverb([0.04, 0.045, 0.05, 0.055], [0.85, 0.84, 0.83, 0.82]);
2130
+ * // or use the defaults
2131
+ * await player.filterManager.lavalinkFilterPlugin.toggleReverb();
2132
+ * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
2133
+ * ```
2134
+ */
2135
+ toggleReverb: (delays?: number[], gains?: number[]) => Promise<FilterManager>;
2136
+ };
2137
+ /**
2138
+ * Enables / Disables a Nightcore-like filter Effect. Disables/Overrides both: custom and Vaporwave Filter
2139
+ * @param {number} speed set the speed of the filter
2140
+ * @param {number} pitch set the pitch of the filter
2141
+ * @param {number} rate set the rate of the filter
2142
+ * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
2143
+ *
2144
+ * @example
2145
+ * ```ts
2146
+ * // Toggle Nightcore filter with custom settings
2147
+ * await player.filterManager.toggleNightcore(1.3, 1.3, 0.9);
2148
+ * // or use the defaults
2149
+ * await player.filterManager.toggleNightcore();
2150
+ * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
2151
+ * ```
2152
+ */
2153
+ toggleNightcore(speed?: number, pitch?: number, rate?: number): Promise<FilterManager>;
2154
+ /**
2155
+ * Enables / Disables a Vaporwave-like filter Effect. Disables/Overrides both: custom and nightcore Filter
2156
+ * @param {number} speed set the speed of the filterq
2157
+ * @param {number} pitch set the pitch of the filter
2158
+ * @param {number} rate set the rate of the filter
2159
+ * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
2160
+ *
2161
+ * @example
2162
+ * ```ts
2163
+ * // Toggle Vaporwave filter with custom settings
2164
+ * await player.filterManager.toggleVaporwave(0.9, 0.7, 1);
2165
+ * // or use the defaults
2166
+ * await player.filterManager.toggleVaporwave();
2167
+ * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
2168
+ * ```
2169
+ */
2170
+ toggleVaporwave(speed?: number, pitch?: number, rate?: number): Promise<FilterManager>;
2171
+ /**
2172
+ * Enable / Disables a Karaoke like Filter Effect
2173
+ * @param {number} level set the level of the filter
2174
+ * @param {number} monoLevel set the mono level of the filter
2175
+ * @param {number} filterBand set the filter band of the filter
2176
+ * @param {number} filterWidth set the filter width of the filter
2177
+ * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
2178
+ *
2179
+ * @example
2180
+ * ```ts
2181
+ * // Toggle Karaoke filter with custom settings
2182
+ * await player.filterManager.toggleKaraoke(1.5, 1.0, 220, 100);
2183
+ * // or use the defaults
2184
+ * await player.filterManager.toggleKaraoke();
2185
+ * // when it's enabled before calling the toggle function, it disables it, so you might need to do some if/else logic.
2186
+ * ```
2187
+ */
2188
+ toggleKaraoke(level?: number, monoLevel?: number, filterBand?: number, filterWidth?: number): Promise<FilterManager>;
2189
+ /**
2190
+ * Function to find out if currently there is a custom timescamle etc. filter applied
2191
+ * @returns {boolean} whether a custom filter is active
2192
+ *
2193
+ * @example
2194
+ * ```ts
2195
+ * // Check if a custom filter is active
2196
+ * const isCustom = player.filterManager.isCustomFilterActive();
2197
+ * console.log(`Is custom filter active? ${isCustom}`);
2198
+ * ```
2199
+ */
2200
+ isCustomFilterActive(): boolean;
2201
+ /**
2202
+ * Sets the players equalizer bands using one of the predefined presets.
2203
+ * @param {keyof typeof EQList} preset The preset to use.
2204
+ * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
2205
+ *
2206
+ * @example
2207
+ * ```ts
2208
+ * // Set EQ preset
2209
+ * await player.filterManager.setEQPreset('BassboostMedium');
2210
+ * ```
2211
+ */
2212
+ setEQPreset(preset: keyof typeof EQList): Promise<this>;
2213
+ /**
2214
+ * Sets the players equalizer band on-top of the existing ones.
2215
+ * @param {number} bands
2216
+ * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
2217
+ *
2218
+ * @example
2219
+ * ```ts
2220
+ * // Set EQ bands
2221
+ * await player.filterManager.setEQ([
2222
+ * { band: 0, gain: 0.3 },
2223
+ * { band: 1, gain: -0.2 },
2224
+ * { band: 2, gain: 0.1 }
2225
+ * ]);
2226
+ *
2227
+ * // or use one of the templates:
2228
+ * await player.filterManager.setEQ(player.filterManager.EQList.BassboostMedium); // you can also import EQList from somewhere package if wanted.
2229
+ * ```
2230
+ */
2231
+ setEQ(bands: EQBand | EQBand[]): Promise<this>;
2232
+ /**
2233
+ * Clears the equalizer bands.
2234
+ * @returns {Promise<FilterManager>} The Filter Manager, for chaining.
2235
+ *
2236
+ * @example
2237
+ * ```ts
2238
+ * // Clear all EQ bands
2239
+ * await player.filterManager.clearEQ();
2240
+ * ```
2241
+ */
2242
+ clearEQ(): Promise<this>;
2243
+ }
2244
+ //#endregion
2245
+ //#region src/structures/Queue.d.ts
2246
+ declare class QueueSaver {
2247
+ /**
2248
+ * The queue store manager
2249
+ */
2250
+ private _;
2251
+ /**
2252
+ * The options for the queue saver
2253
+ */
2254
+ options: {
2255
+ maxPreviousTracks: number;
2256
+ };
2257
+ constructor(options: ManagerQueueOptions);
2258
+ /**
2259
+ * Get the queue for a guild
2260
+ * @param guildId The guild ID
2261
+ * @returns The queue for the guild
2262
+ */
2263
+ get(guildId: string): Promise<Partial<StoredQueue>>;
2264
+ /**
2265
+ * Delete the queue for a guild
2266
+ * @param guildId The guild ID
2267
+ * @returns The queue for the guild
2268
+ */
2269
+ delete(guildId: string): Promise<void | boolean>;
2270
+ /**
2271
+ * Set the queue for a guild
2272
+ * @param guildId The guild ID
2273
+ * @param valueToStringify The queue to set
2274
+ * @returns The queue for the guild
2275
+ */
2276
+ set(guildId: string, valueToStringify: StoredQueue): Promise<void | boolean>;
2277
+ /**
2278
+ * Sync the queue for a guild
2279
+ * @param guildId The guild ID
2280
+ * @returns The queue for the guild
2281
+ */
2282
+ sync(guildId: string): Promise<Partial<StoredQueue>>;
2283
+ }
2284
+ declare class DefaultQueueStore implements QueueStoreManager {
2285
+ private data;
2286
+ constructor();
2287
+ /**
2288
+ * Get the queue for a guild
2289
+ * @param guildId The guild ID
2290
+ * @returns The queue for the guild
2291
+ */
2292
+ get(guildId: string): StoredQueue | undefined;
2293
+ /**
2294
+ * Set the queue for a guild
2295
+ * @param guildId The guild ID
2296
+ * @param valueToStringify The queue to set
2297
+ * @returns The queue for the guild
2298
+ */
2299
+ set(guildId: string, valueToStringify: any): boolean;
2300
+ /**
2301
+ * Delete the queue for a guild
2302
+ * @param guildId The guild ID
2303
+ * @returns The queue for the guild
2304
+ */
2305
+ delete(guildId: string): boolean;
2306
+ /**
2307
+ * Stringify the queue for a guild
2308
+ * @param value The queue to stringify
2309
+ * @returns The stringified queue
2310
+ */
2311
+ stringify(value: StoredQueue | string): StoredQueue | string;
2312
+ /**
2313
+ * Parse the queue for a guild
2314
+ * @param value The queue to parse
2315
+ * @returns The parsed queue
2316
+ */
2317
+ parse(value: StoredQueue | string): Partial<StoredQueue>;
2318
+ }
2319
+ declare class Queue {
2320
+ readonly tracks: (Track | UnresolvedTrack)[];
2321
+ readonly previous: Track[];
2322
+ current: Track | null;
2323
+ options: {
2324
+ maxPreviousTracks: number;
2325
+ };
2326
+ private readonly guildId;
2327
+ private readonly QueueSaver;
2328
+ private managerUtils;
2329
+ private queueChanges;
2330
+ /**
2331
+ * Create a new Queue
2332
+ * @param guildId The guild ID
2333
+ * @param data The data to initialize the queue with
2334
+ * @param QueueSaver The queue saver to use
2335
+ * @param queueOptions
2336
+ */
2337
+ constructor(guildId: string, data?: Partial<StoredQueue>, QueueSaver?: QueueSaver, queueOptions?: ManagerQueueOptions);
2338
+ /**
2339
+ * Utils for a Queue
2340
+ */
2341
+ utils: {
2342
+ /**
2343
+ * Save the current cached Queue on the database/server (overides the server)
2344
+ */
2345
+ save: () => Promise<void | boolean>;
2346
+ /**
2347
+ * Sync the current queue database/server with the cached one
2348
+ * @returns {void}
2349
+ */
2350
+ sync: (override?: boolean, dontSyncCurrent?: boolean) => Promise<void>;
2351
+ destroy: () => Promise<void | boolean>;
2352
+ /**
2353
+ * @returns {{current:Track|null, previous:Track[], tracks:Track[]}}The Queue, but in a raw State, which allows easier handling for the QueueStoreManager
2354
+ */
2355
+ toJSON: () => StoredQueue;
2356
+ /**
2357
+ * Get the Total Duration of the Queue-Songs summed up
2358
+ * @returns {number}
2359
+ */
2360
+ totalDuration: () => number;
2361
+ /**
2362
+ * Find tracks in the queue matching specific criteria.
2363
+ * **This method DOES NOT MUTATE the queue** - it returns a new array without modifying the original queue.
2364
+ * @param predicate Function to test each track, or an object with criteria to match
2365
+ * @returns Array of matching tracks with their indexes
2366
+ *
2367
+ * @example
2368
+ * ```ts
2369
+ * // Find by author
2370
+ * const artistTracks = player.queue.utils.filterTracks({ author: "Artist Name" });
2371
+ *
2372
+ * // Find by duration range (5-10 minutes)
2373
+ * const longTracks = player.queue.utils.filterTracks({ duration: { min: 300000, max: 600000 } });
2374
+ *
2375
+ * // Find by title (partial match)
2376
+ * const titleMatches = player.queue.utils.filterTracks({ title: "Never Gonna" });
2377
+ *
2378
+ * // Custom predicate
2379
+ * const customFilter = player.queue.utils.filterTracks(track => track.info.isStream);
2380
+ * ```
2381
+ */
2382
+ filterTracks: (predicate: ((track: Track | UnresolvedTrack, index: number) => boolean) | {
2383
+ title?: string;
2384
+ author?: string;
2385
+ duration?: number | {
2386
+ min?: number;
2387
+ max?: number;
2388
+ };
2389
+ uri?: string;
2390
+ identifier?: string;
2391
+ sourceName?: string;
2392
+ isStream?: boolean;
2393
+ isSeekable?: boolean;
2394
+ }) => Array<{
2395
+ track: Track | UnresolvedTrack;
2396
+ index: number;
2397
+ }>;
2398
+ /**
2399
+ * Find a single track in the queue matching specific criteria.
2400
+ * **This method DOES NOT MUTATE the queue** - it searches without modifying the original queue.
2401
+ * @param predicate Function to test each track, or an object with criteria to match
2402
+ * @returns First matching track with its index, or null if not found
2403
+ *
2404
+ * @example
2405
+ * ```ts
2406
+ * // Find first track by author
2407
+ * const track = player.queue.utils.findTrack({ author: "Artist Name" });
2408
+ * if (track) {
2409
+ * console.log(`Found at index ${track.index}: ${track.track.info.title}`);
2410
+ * }
2411
+ *
2412
+ * // Find with custom predicate
2413
+ * const liveStream = player.queue.utils.findTrack(track => track.info.isStream);
2414
+ * ```
2415
+ */
2416
+ findTrack: (predicate: ((track: Track | UnresolvedTrack, index: number) => boolean) | {
2417
+ title?: string;
2418
+ author?: string;
2419
+ duration?: number | {
2420
+ min?: number;
2421
+ max?: number;
2422
+ };
2423
+ uri?: string;
2424
+ identifier?: string;
2425
+ sourceName?: string;
2426
+ isStream?: boolean;
2427
+ isSeekable?: boolean;
2428
+ }) => {
2429
+ track: Track | UnresolvedTrack;
2430
+ index: number;
2431
+ } | null;
2432
+ };
2433
+ /**
2434
+ * Shuffles the current Queue, then saves it
2435
+ * @returns Amount of Tracks in the Queue
2436
+ */
2437
+ shuffle(): Promise<number>;
2438
+ /**
2439
+ * Add a Track to the Queue, and after saved in the "db" it returns the amount of the Tracks
2440
+ * @param {Track | Track[]} TrackOrTracks
2441
+ * @param {number} index At what position to add the Track
2442
+ * @returns {number} Queue-Size (for the next Tracks)
2443
+ */
2444
+ add(TrackOrTracks: Track | UnresolvedTrack | (Track | UnresolvedTrack)[], index?: number): any;
2445
+ /**
2446
+ * Splice the tracks in the Queue
2447
+ * @param {number} index Where to remove the Track
2448
+ * @param {number} amount How many Tracks to remove?
2449
+ * @param {Track | Track[]} TrackOrTracks Want to Add more Tracks?
2450
+ * @returns {Track} Spliced Track
2451
+ */
2452
+ splice(index: number, amount: number, TrackOrTracks?: Track | UnresolvedTrack | (Track | UnresolvedTrack)[]): any;
2453
+ /**
2454
+ * Remove stuff from the queue.tracks array
2455
+ * - single Track | UnresolvedTrack
2456
+ * - multiple Track | UnresovedTrack
2457
+ * - at the index or multiple indexes
2458
+ * - Since v2.7 the removed tracks get unshifted into the previous queue state instead of pushed (indexed at the start instead of end - as it should)
2459
+ * @param removeQueryTrack
2460
+ * @returns null (if nothing was removed) / { removed } where removed is an array with all removed elements
2461
+ *
2462
+ * @example
2463
+ * ```js
2464
+ * // remove single track
2465
+ *
2466
+ * const track = player.queue.tracks[4];
2467
+ * await player.queue.remove(track);
2468
+ *
2469
+ * // if you already have the index you can straight up pass it too
2470
+ * await player.queue.remove(4);
2471
+ *
2472
+ *
2473
+ * // if you want to remove multiple tracks, e.g. from position 4 to position 10 you can do smt like this
2474
+ * 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
2475
+ *
2476
+ * // I still highly suggest to use .splice!
2477
+ *
2478
+ * await player.queue.splice(4, 10); // removes at index 4, 10 tracks
2479
+ *
2480
+ * await player.queue.splice(1, 1); // removes at index 1, 1 track
2481
+ *
2482
+ * await player.queue.splice(4, 0, ...tracks) // removes 0 tracks at position 4, and then inserts all tracks after position 4.
2483
+ * ```
2484
+ */
2485
+ remove<T extends Track | UnresolvedTrack | number | Track[] | UnresolvedTrack[] | number[] | (number | Track | UnresolvedTrack)[]>(removeQueryTrack: T): Promise<{
2486
+ removed: (Track | UnresolvedTrack)[];
2487
+ } | null>;
2488
+ /**
2489
+ * Shifts the previous array, to return the last previous track & thus remove it from the previous queue
2490
+ * @returns
2491
+ *
2492
+ * @example
2493
+ * ```js
2494
+ * // example on how to play the previous track again
2495
+ * const previous = await player.queue.shiftPrevious(); // get the previous track and remove it from the previous queue array!!
2496
+ * if(!previous) return console.error("No previous track found");
2497
+ * await player.play({ clientTrack: previous }); // play it again
2498
+ * ```
2499
+ */
2500
+ shiftPrevious(): Promise<Track | null>;
2501
+ /**
2502
+ * Find tracks in the queue matching specific criteria.
2503
+ * **This method DOES NOT MUTATE the queue** - it returns a new array without modifying the original queue.
2504
+ * @deprecated Use `player.queue.utils.filterTracks()` instead.
2505
+ * @param predicate Function to test each track, or an object with criteria to match
2506
+ * @returns Array of matching tracks with their indexes
2507
+ *
2508
+ * @example
2509
+ * ```ts
2510
+ * // Use the new method instead:
2511
+ * const artistTracks = player.queue.utils.filterTracks({ author: "Artist Name" });
2512
+ * ```
2513
+ */
2514
+ filter(predicate: ((track: Track | UnresolvedTrack, index: number) => boolean) | {
2515
+ title?: string;
2516
+ author?: string;
2517
+ duration?: number | {
2518
+ min?: number;
2519
+ max?: number;
2520
+ };
2521
+ uri?: string;
2522
+ identifier?: string;
2523
+ sourceName?: string;
2524
+ isStream?: boolean;
2525
+ isSeekable?: boolean;
2526
+ }): Array<{
2527
+ track: Track | UnresolvedTrack;
2528
+ index: number;
2529
+ }>;
2530
+ /**
2531
+ * Find a single track in the queue matching specific criteria.
2532
+ * **This method DOES NOT MUTATE the queue** - it searches without modifying the original queue.
2533
+ * @deprecated Use `player.queue.utils.findTrack()` instead.
2534
+ * @param predicate Function to test each track, or an object with criteria to match
2535
+ * @returns First matching track with its index, or null if not found
2536
+ *
2537
+ * @example
2538
+ * ```ts
2539
+ * // Use the new method instead:
2540
+ * const track = player.queue.utils.findTrack({ author: "Artist Name" });
2541
+ * ```
2542
+ */
2543
+ find(predicate: ((track: Track | UnresolvedTrack, index: number) => boolean) | {
2544
+ title?: string;
2545
+ author?: string;
2546
+ duration?: number | {
2547
+ min?: number;
2548
+ max?: number;
2549
+ };
2550
+ uri?: string;
2551
+ identifier?: string;
2552
+ sourceName?: string;
2553
+ isStream?: boolean;
2554
+ isSeekable?: boolean;
2555
+ }): {
2556
+ track: Track | UnresolvedTrack;
2557
+ index: number;
2558
+ } | null;
2559
+ /**
2560
+ * Sort the queue tracks by a specific property.
2561
+ * **⚠️ This method MUTATES the queue** - it modifies the original queue in place.
2562
+ * @param sortBy Property to sort by or custom comparator function
2563
+ * @param order Sort order: 'asc' or 'desc' (default: 'asc')
2564
+ * @returns The queue instance for chaining
2565
+ *
2566
+ * @example
2567
+ * ```ts
2568
+ * // Sort by duration (shortest first)
2569
+ * await player.queue.sortBy("duration", "asc");
2570
+ *
2571
+ * // Sort by title alphabetically (Z-A)
2572
+ * await player.queue.sortBy("title", "desc");
2573
+ *
2574
+ * // Custom sorting
2575
+ * await player.queue.sortBy((a, b) => {
2576
+ * return a.info.title.localeCompare(b.info.title);
2577
+ * });
2578
+ * ```
2579
+ */
2580
+ sortBy(sortBy: "duration" | "title" | "author" | ((a: Track | UnresolvedTrack, b: Track | UnresolvedTrack) => number), order?: "asc" | "desc"): Promise<this>;
2581
+ /**
2582
+ * Get a sorted copy of the queue tracks without modifying the original queue.
2583
+ * **This method DOES NOT MUTATE the queue** - it returns a new sorted array, similar to `Array.toSorted()`.
2584
+ * @param sortBy Property to sort by or custom comparator function
2585
+ * @param order Sort order: 'asc' or 'desc' (default: 'asc')
2586
+ * @returns A new sorted array of tracks (does not modify the queue)
2587
+ *
2588
+ * @example
2589
+ * ```ts
2590
+ * // Get sorted copy by duration (shortest first)
2591
+ * const sortedTracks = player.queue.toSortedBy("duration", "asc");
2592
+ * // Original queue remains unchanged
2593
+ *
2594
+ * // Get sorted copy by title alphabetically (Z-A)
2595
+ * const sortedByTitle = player.queue.toSortedBy("title", "desc");
2596
+ *
2597
+ * // Custom sorting
2598
+ * const customSorted = player.queue.toSortedBy((a, b) => {
2599
+ * return a.info.title.localeCompare(b.info.title);
2600
+ * });
2601
+ * ```
2602
+ */
2603
+ toSortedBy(sortBy: "duration" | "title" | "author" | ((a: Track | UnresolvedTrack, b: Track | UnresolvedTrack) => number), order?: "asc" | "desc"): (Track | UnresolvedTrack)[];
2604
+ /**
2605
+ * Get a range of tracks from the queue.
2606
+ * **This method DOES NOT MUTATE the queue** - it returns a new array slice, similar to `Array.slice()`.
2607
+ * @param start Start index (inclusive)
2608
+ * @param end End index (exclusive)
2609
+ * @returns Array of tracks in the specified range
2610
+ *
2611
+ * @example
2612
+ * ```ts
2613
+ * // Get tracks 5-15
2614
+ * const tracks = player.queue.getTracks(5, 15);
2615
+ *
2616
+ * // Get first 10 tracks
2617
+ * const firstTen = player.queue.getTracks(0, 10);
2618
+ * ```
2619
+ */
2620
+ getTracks(start: number, end?: number): (Track | UnresolvedTrack)[];
2621
+ }
2622
+ //#endregion
2623
+ //#region src/structures/Player.d.ts
2624
+ declare class Player {
2625
+ /** Filter Manager per player */
2626
+ filterManager: FilterManager;
2627
+ /** circular reference to the lavalink Manager from the Player for easier use */
2628
+ LavalinkManager: LavalinkManager;
2629
+ /** Player options currently used, mutation doesn't affect player's state */
2630
+ options: PlayerOptions;
2631
+ /** The lavalink node assigned the the player, don't change it manually */
2632
+ node: LavalinkNode | NodeLinkNode;
2633
+ /** The queue from the player */
2634
+ queue: Queue;
2635
+ /** The Guild Id of the Player */
2636
+ guildId: string;
2637
+ /** The Voice Channel Id of the Player */
2638
+ voiceChannelId: string | null;
2639
+ /** The Text Channel Id of the Player */
2640
+ textChannelId: string | null;
2641
+ /** States if the Bot is supposed to be outputting audio */
2642
+ playing: boolean;
2643
+ /** States if the Bot is paused or not */
2644
+ paused: boolean;
2645
+ /** Repeat Mode of the Player */
2646
+ repeatMode: RepeatMode;
2647
+ /** Player's ping */
2648
+ ping: {
2649
+ lavalink: number;
2650
+ ws: number;
2651
+ };
2652
+ /** The Display Volume */
2653
+ volume: number;
2654
+ /** The Volume Lavalink actually is outputting */
2655
+ lavalinkVolume: number;
2656
+ /** The current Positin of the player (Calculated) */
2657
+ get position(): number;
2658
+ /** The timestamp when the last position change update happened */
2659
+ lastPositionChange: number | null;
2660
+ /** The current Positin of the player (from Lavalink) */
2661
+ lastPosition: number;
2662
+ lastSavedPosition: number;
2663
+ /** When the player was created [Timestamp in Ms] (from lavalink) */
2664
+ createdTimeStamp: number;
2665
+ /** The Player Connection's State (from Lavalink) */
2666
+ connected: boolean | undefined;
2667
+ /** Voice Server Data (from Lavalink) */
2668
+ voice: LavalinkPlayerVoiceOptions;
2669
+ voiceState: {
2670
+ selfDeaf: boolean;
2671
+ selfMute: boolean;
2672
+ serverDeaf: boolean;
2673
+ serverMute: boolean;
2674
+ suppress: boolean;
2675
+ };
2676
+ /** Custom data for the player */
2677
+ private readonly data;
2678
+ /**
2679
+ * Emits a debug event to the LavalinkManager
2680
+ * @param name name of the event
2681
+ * @param eventData event data
2682
+ */
2683
+ private _emitDebugEvent;
2684
+ /**
2685
+ * Create a new Player
2686
+ * @param options
2687
+ * @param LavalinkManager
2688
+ */
2689
+ constructor(options: PlayerOptions, LavalinkManager: LavalinkManager, dontEmitPlayerCreateEvent?: boolean);
2690
+ /**
2691
+ * Set custom data. (Deprecated - Use Player#setData instead.)
2692
+ * @param key
2693
+ * @param value
2694
+ * @deprecated Use Player#setData instead.
2695
+ */
2696
+ set(key: string, value: unknown): this;
2697
+ /**
2698
+ * Get custom data. (Deprecated - Use Player#getData instead.)
2699
+ * @param key
2700
+ * @deprecated Use Player#getData instead.
2701
+ */
2702
+ get<T>(key: string): T;
2703
+ /**
2704
+ * Set custom data.
2705
+ * @param key
2706
+ * @param value
2707
+ */
2708
+ setData(key: string, value: unknown): this;
2709
+ /**
2710
+ * Get custom data.
2711
+ * @param key
2712
+ */
2713
+ getData<T>(key: string): T;
2714
+ /**
2715
+ * Delete specific custom data.
2716
+ * @param key
2717
+ */
2718
+ deleteData(key: string): this;
2719
+ /**
2720
+ * CLears all the custom data.
2721
+ */
2722
+ clearData(): this;
2723
+ /**
2724
+ * Get all custom Data
2725
+ */
2726
+ getAllData(): Record<string, unknown>;
2727
+ /**
2728
+ * Play the next track from the queue / a specific track, with playoptions for Lavalink
2729
+ * @param options
2730
+ */
2731
+ play(options?: Partial<PlayOptions>): any;
2732
+ /**
2733
+ * The old JSON of the player, used for the "playerClientUpdate" event, which is emitted on every update of the player via a function call, so that you can compare the old data with the new data and do something with it if you want to.
2734
+ */
2735
+ oldJSON: PlayerJson;
2736
+ /**
2737
+ * Emits the "playerClientUpdate" event, which is emitted on every update of the player via a function call, so that you can compare the old data with the new data and do something with it if you want to.
2738
+ */
2739
+ triggerPlayerClientUpdate(): void;
2740
+ /**
2741
+ * Set the Volume for the Player
2742
+ * @param volume The Volume in percent
2743
+ * @param ignoreVolumeDecrementer If it should ignore the volumedecrementer option
2744
+ */
2745
+ setVolume(volume: number, ignoreVolumeDecrementer?: boolean): Promise<this>;
2746
+ /**
2747
+ * Search for a track
2748
+ * @param query The query to search for
2749
+ * @param requestUser The user that requested the track
2750
+ * @param throwOnEmpty If an error should be thrown if no track is found
2751
+ * @returns The search result
2752
+ */
2753
+ lavaSearch(query: LavaSearchQuery, requestUser: unknown, throwOnEmpty?: boolean): Promise<LavaSearchResponse | SearchResult>;
2754
+ /**
2755
+ * Set the SponsorBlock
2756
+ * @param segments The segments to set
2757
+ */
2758
+ setSponsorBlock(segments?: SponsorBlockSegment[]): Promise<void>;
2759
+ /**
2760
+ * Get the SponsorBlock
2761
+ */
2762
+ getSponsorBlock(): Promise<SponsorBlockSegment[]>;
2763
+ /**
2764
+ * Delete the SponsorBlock
2765
+ */
2766
+ deleteSponsorBlock(): Promise<void>;
2767
+ /**
2768
+ *
2769
+ * @param query Query for your data
2770
+ * @param requestUser
2771
+ */
2772
+ search(query: SearchQuery, requestUser: unknown, throwOnEmpty?: boolean): Promise<SearchResult | UnresolvedSearchResult>;
2773
+ /**
2774
+ * Pause the player
2775
+ */
2776
+ pause(): Promise<this>;
2777
+ /**
2778
+ * Resume the Player
2779
+ */
2780
+ resume(): Promise<this>;
2781
+ /**
2782
+ * Seek to a specific Position
2783
+ * @param position
2784
+ */
2785
+ seek(position: number): Promise<this | undefined>;
2786
+ /**
2787
+ * Set the Repeatmode of the Player
2788
+ * @param repeatMode
2789
+ */
2790
+ setRepeatMode(repeatMode: RepeatMode): Promise<this>;
2791
+ /**
2792
+ * Skip the current song, or a specific amount of songs
2793
+ * @param amount provide the index of the next track to skip to
2794
+ */
2795
+ skip(skipTo?: number, throwError?: boolean): Promise<this>;
2796
+ /**
2797
+ * Clears the queue and stops playing. Does not destroy the Player and not leave the channel
2798
+ * @returns
2799
+ */
2800
+ stopPlaying(clearQueue?: boolean, executeAutoplay?: boolean): Promise<this>;
2801
+ /**
2802
+ * Connects the Player to the Voice Channel
2803
+ * @returns
2804
+ */
2805
+ connect(): Promise<this>;
2806
+ changeVoiceState(data: {
2807
+ voiceChannelId?: string;
2808
+ selfDeaf?: boolean;
2809
+ selfMute?: boolean;
2810
+ }): Promise<this>;
2811
+ /**
2812
+ * Disconnects the Player from the Voice Channel, but keeps the player in the cache
2813
+ * @param force If false it throws an error, if player thinks it's already disconnected
2814
+ * @returns
2815
+ */
2816
+ disconnect(force?: boolean): Promise<this>;
2817
+ /**
2818
+ * Destroy the player and disconnect from the voice channel
2819
+ */
2820
+ destroy(reason?: DestroyReasons | string, disconnect?: boolean): Promise<this | undefined>;
2821
+ /**
2822
+ * Get the current lyrics of the track currently playing on the guild
2823
+ * @param guildId The guild id to get the current lyrics for
2824
+ * @param skipTrackSource If true, it will not try to get the lyrics from the track source
2825
+ * @returns The current lyrics
2826
+ * @example
2827
+ * ```ts
2828
+ * const lyrics = await player.getCurrentLyrics();
2829
+ * ```
2830
+ */
2831
+ getCurrentLyrics(skipTrackSource?: boolean): Promise<LyricsResult | null>;
2832
+ /**
2833
+ * Get the lyrics of a specific track
2834
+ * @param track The track to get the lyrics for
2835
+ * @param skipTrackSource If true, it will not try to get the lyrics from the track source
2836
+ * @returns The lyrics of the track
2837
+ * @example
2838
+ * ```ts
2839
+ * const lyrics = await player.getLyrics(player.queue.tracks[0], true);
2840
+ * ```
2841
+ */
2842
+ getLyrics(track: Track, skipTrackSource?: boolean): Promise<LyricsResult | null>;
2843
+ /**
2844
+ * Subscribe to the lyrics event on a specific guild to active live lyrics events}
2845
+ * @param skipTrackSource If true, it will not try to get the lyrics from the track source
2846
+ * @returns The unsubscribe function
2847
+ * @example
2848
+ * ```ts
2849
+ * const lyrics = await player.subscribeLyrics();
2850
+ * ```
2851
+ */
2852
+ subscribeLyrics(skipTrackSource?: boolean): Promise<unknown>;
2853
+ /**
2854
+ * Unsubscribe from the lyrics event on a specific guild to disable live lyrics events
2855
+ * @returns The unsubscribe function
2856
+ * @example
2857
+ * ```ts
2858
+ * const lyrics = await player.unsubscribeLyrics();
2859
+ * ```
2860
+ */
2861
+ unsubscribeLyrics(): Promise<void>;
2862
+ /**
2863
+ * Move the player on a different Audio-Node
2864
+ * @param newNode New Node / New Node Id
2865
+ * @param checkSources If it should check if the sources are supported by the new node @default true
2866
+ * @return The new Node Id
2867
+ * @example
2868
+ * ```ts
2869
+ * const changeNode = await player.changeNode(newNode, true);
2870
+ * ```
2871
+ */
2872
+ changeNode(newNode: LavalinkNode | string, checkSources?: boolean): Promise<string>;
2873
+ /**
2874
+ * (Wrapper-FN for changeNode) Move the player to a different node. If no node is provided, it will find the least used node that is not the same as the current node.
2875
+ * @param node the id of the node to move to
2876
+ * @returns the player
2877
+ * @throws RangeError if there is no available nodes.
2878
+ * @throws Error if the node to move to is the same as the current node.
2879
+ * @example
2880
+ * ```ts
2881
+ * const newNodeMovedTo = await player.moveNode(); // no need to specify the new node, it will find a least used node automatically, but you can ofc. use a custom node id.
2882
+ * ```
2883
+ */
2884
+ moveNode(node?: string): Promise<string | this>;
2885
+ /** Converts the Player including Queue to a Json state */
2886
+ toJSON(): PlayerJson;
2887
+ }
2888
+ //#endregion
2889
+ //#region src/structures/NodeLink.d.ts
2890
+ /** Default Sources Record for NodeLink, to allow source parsing with multiple inputs. */
2891
+ declare const NodeLinkDefaultSources: Record<SearchPlatform, NodeLinkSearchPlatform | ClientCustomSearchPlatformUtils>;
2892
+ declare class NodeLinkNode extends LavalinkNode {
2893
+ nodeType: NodeType;
2894
+ constructor(options: LavalinkNodeOptions, manager: NodeManager);
2895
+ /**
2896
+ * Uses the gapless feature to set the next track to be played.
2897
+ * @param player current player
2898
+ * @param track if no track provided, it will use the next track from queue
2899
+ */
2900
+ setNextTrackGapLess(player: Player, track?: Track | UnresolvedTrack): Promise<boolean>;
2901
+ /**
2902
+ * Removes the nextTrackGapLess configuration
2903
+ * @param player current player
2904
+ * @param track if no track provided, it will use the next track from queue
2905
+ */
2906
+ removeNextTrackGapLess(player: Player): Promise<boolean>;
2907
+ /**
2908
+ * Retrieves the meaning of a track.
2909
+ * @param track
2910
+ * @returns {MeaningResponse}
2911
+ * @link {https://nodelink.js.org/docs/api/nodelink-features#meaning-system}
2912
+ */
2913
+ getMeaning(track?: Track | UnresolvedTrack): Promise<MeaningResponse>;
2914
+ /**
2915
+ * Adds a new audio track to be mixed over the current playback.
2916
+ * @param player The player to add the mixer layer to.
2917
+ * @param trackToAdd The track to add to the mixer layer.
2918
+ * @param volume The volume of the track to add to the mixer layer. (0 - 100)
2919
+ * @link {https://nodelink.js.org/docs/api/rest#add-mix-layer} documentiation
2920
+ */
2921
+ addMixerLayer(player: Player, trackToAdd: Track, volume: number): Promise<AddMixerLayerResponse>;
2922
+ /**
2923
+ * Retrieves a list of currently active mix layers.
2924
+ * @param player The player to list the mixer layers for.
2925
+ * @link {https://nodelink.js.org/docs/api/rest#get-active-mixes} documentiation
2926
+ */
2927
+ listMixerLayers(player: Player): Promise<ListMixerLayersResponse>;
2928
+ /**
2929
+ * Updates the volume of a specific mix layer.
2930
+ * @param player The player to update the mixer layer volume for.
2931
+ * @param mixId The ID of the mix layer to update.
2932
+ * @param volume The volume of the mix layer to update. (0 - 100)
2933
+ * @link {https://nodelink.js.org/docs/api/rest#update-mix-volume} documentiation
2934
+ */
2935
+ updateMixerLayerVolume(player: Player, mixId: string, volume: number): Promise<boolean>;
2936
+ /**
2937
+ * Removes a specific mix layer.
2938
+ * @param player The player to remove the mix layer from.
2939
+ * @param mixId The ID of the mix layer to remove.
2940
+ * @link {https://nodelink.js.org/docs/api/rest#remove-mix-layer} documentiation
2941
+ */
2942
+ removeMixerLayer(player: Player, mixId: string): Promise<boolean>;
2943
+ /**
2944
+ * @description
2945
+ * NodeLink has a lot of filters SPECIFICALLY for NodeLink, check the documentation for more information.
2946
+ * @link {https://nodelink.js.org/docs/api/nodelink-features#additional-filters} documentiation
2947
+ */
2948
+ specificFilters: {
2949
+ /**
2950
+ * Creates delay-based echo with feedback control
2951
+ * @param player The player to apply the filter to
2952
+ * @param options The echo filter options
2953
+ */
2954
+ echo: (player: Player, options: NodeLink_EchoFilter, disableFilter?: boolean) => Promise<boolean>;
2955
+ /**
2956
+ * Simulates multiple voices playing together with modulated delays
2957
+ * @param player The player to apply the filter to
2958
+ * @param options The chorus filter options
2959
+ */
2960
+ chorus: (player: Player, options: NodeLink_ChorusFilter, disableFilter?: boolean) => Promise<boolean>;
2961
+ /**
2962
+ * Dynamic range compression for balanced audio levels
2963
+ * @param player The player to apply the filter to
2964
+ * @param options The compressor filter options
2965
+ */
2966
+ compressor: (player: Player, options: NodeLink_CompressorFilter, disableFilter?: boolean) => Promise<boolean>;
2967
+ /**
2968
+ * Filters out low frequencies, letting high frequencies pass through
2969
+ * @param player The player to apply the filter to
2970
+ * @param options The highpass filter options
2971
+ */
2972
+ highPass: (player: Player, options: NodeLink_HighPassFilter, disableFilter?: boolean) => Promise<boolean>;
2973
+ /**
2974
+ * Sweeps all-pass filters across the frequency spectrum for a swooshing effect
2975
+ * @param player The player to apply the filter to
2976
+ * @param options The phaser filter options
2977
+ */
2978
+ phaser: (player: Player, options: NodeLink_PhaserFilter, disableFilter?: boolean) => Promise<boolean>;
2979
+ /**
2980
+ * Creates spatial audio using cross-channel delays and modulation
2981
+ * @param player The player to apply the filter to
2982
+ * @param options The spatial filter options
2983
+ */
2984
+ spatial: (player: Player, options: NodeLink_SpatialFilter, disableFilter?: boolean) => Promise<boolean>;
2985
+ /**
2986
+ * Resets all NodeLink filters
2987
+ * @param player The player to reset the filters for
2988
+ */
2989
+ resetNodeLinkFilters: (player: Player) => Promise<boolean>;
2990
+ };
2991
+ /**
2992
+ * Retrieve Lyrics of Youtube Videos.
2993
+ * @param player The Player you use with that node.
2994
+ * @param track if not provided, it will use the current track
2995
+ * @param language if not provided, it will use the default language (en)
2996
+ * @link {https://nodelink.js.org/docs/api/nodelink-features#lyrics--chapters}
2997
+ * @returns NodeLinkLyrics either synced/unsynced or NodeLinkNoLyrics
2998
+ */
2999
+ nodeLinkLyrics(player: Player, track?: Track | UnresolvedTrack, language?: string): Promise<NodeLinkLyrics | NodeLinkNoLyrics>;
3000
+ /**
3001
+ * Retrieve Chapters of Youtube Videos.
3002
+ * @link {https://nodelink.js.org/docs/api/nodelink-features#loadchapters}
3003
+ * @param player The Player you use with that node.
3004
+ * @param track if not provided, it will use the current track
3005
+ * @returns Array of NodeLinkChapter objects (if empty than there are no chapters available)
3006
+ */
3007
+ getChapters(player: Player, track?: Track | UnresolvedTrack): Promise<NodeLinkChapter[]>;
3008
+ /**
3009
+ * @link {https://nodelink.js.org/docs/api/rest#node-information}
3010
+ * @returns
3011
+ */
3012
+ getConnectionMetrics(): Promise<ConnectionMetricsResponse>;
3013
+ /**
3014
+ * Stream audio directly from NodeLink without Discord voice connection. | Note this must be enabled by NodeLink...
3015
+ * @link {https://nodelink.js.org/docs/api/nodelink-features#direct-streaming}
3016
+ */
3017
+ getDirectStream(track: Track | UnresolvedTrack): Promise<DirectStreamResponse>;
3018
+ /**
3019
+ * Stream raw PCM audio for custom processing or recording.
3020
+ * @link {https://nodelink.js.org/docs/api/nodelink-features#loadstream}
3021
+ * @param track The track to stream
3022
+ * @param volume The volume to stream at
3023
+ * @param position The position to stream from
3024
+ * @param filters The filters to apply to the stream
3025
+ * @returns Returns a raw PCM stream with Content-Type: audio/l16;rate=48000;channels=2.
3026
+ */
3027
+ loadDirectStream(track: Track | UnresolvedTrack, volume: number, position: number, filters: object | string): Promise<ReadableStream>;
3028
+ /**
3029
+ * NodeLink supports selecting specific audio tracks for videos that contain multiple audio streams (e.g., Netflixstyle dubs, multi-language YouTube videos).
3030
+ * This function changes the current language of the audio, in place at the same position of the current track.
3031
+ * You can always do it manually by providing extra field in the track object "audioTrackId"
3032
+ * @link {https://nodelink.js.org/docs/api/nodelink-features#additional-filters}
3033
+ * @param player The player to apply the filter to
3034
+ * @param language_audioTrackId The language of the audio track to select, see it in the pluginInfo.audioTracks
3035
+ */
3036
+ changeAudioTrackLanguage(player: Player, language_audioTrackId: string): Promise<any>;
3037
+ /**
3038
+ * Updates the YouTube configuration (RefreshToken or VisitorData) in real-time.
3039
+ * @link {https://nodelink.js.org/docs/api/nodelink-features#update-config}
3040
+ */
3041
+ updateYoutubeConfig(refreshToken?: string, visitorData?: string): Promise<any>;
3042
+ getYoutubeConfig(validate?: boolean): Promise<{
3043
+ refreshToken: string;
3044
+ visitorData: string | null;
3045
+ isConfigured: boolean;
3046
+ isValid: boolean | null;
3047
+ }>;
3048
+ /**
3049
+ * @link {https://nodelink.js.org/docs/api/nodelink-features#oauth}
3050
+ */
3051
+ getYoutubeOAUTH(refreshToken: string): Promise<YoutubeOAuthResponse>;
3052
+ /**
3053
+ * @link {https://nodelink.js.org/docs/api/nodelink-features#oauth}
3054
+ */
3055
+ updateYoutubeOAUTH(refreshToken: string): Promise<YoutubeOAuthResponse>;
3056
+ }
3057
+ //#endregion
3058
+ //#region src/structures/Node.d.ts
3059
+ /**
3060
+ * Lavalink Node creator class
3061
+ */
3062
+ declare class LavalinkNode {
3063
+ private heartBeatPingTimestamp;
3064
+ private heartBeatPongTimestamp;
3065
+ private heartBeatInterval?;
3066
+ private pingTimeout?;
3067
+ nodeType: NodeType;
3068
+ isAlive: boolean;
3069
+ static _NodeLinkClass: unknown;
3070
+ /** The provided Options of the Node */
3071
+ options: LavalinkNodeOptions;
3072
+ /** The amount of rest calls the node has made. */
3073
+ calls: number;
3074
+ /** Stats from lavalink, will be updated via an interval by lavalink. */
3075
+ stats: NodeStats;
3076
+ /** The current sessionId, only present when connected */
3077
+ sessionId?: string | null;
3078
+ /** Wether the node resuming is enabled or not */
3079
+ resuming: {
3080
+ enabled: boolean;
3081
+ timeout: number | null;
3082
+ };
3083
+ /** Actual Lavalink Information of the Node */
3084
+ info: LavalinkInfo | null;
3085
+ /** current state of the Reconnections */
3086
+ reconnectionState: ReconnectionState;
3087
+ /** The Node Manager of this Node */
3088
+ private NodeManager;
3089
+ /** The Reconnection Timeout */
3090
+ private reconnectTimeout?;
3091
+ /** The Reconnection Attempt counter (array of datetimes when it tried it.) */
3092
+ private reconnectAttempts;
3093
+ /** The Socket of the Lavalink */
3094
+ private socket;
3095
+ /** Version of what the Lavalink Server should be */
3096
+ private version;
3097
+ /**
3098
+ * Returns the LavalinkManager of the Node
3099
+ */
3100
+ private get _LManager();
3101
+ /**
3102
+ * Returns the Heartbeat Ping of the Node
3103
+ */
3104
+ get heartBeatPing(): number;
3105
+ /**
3106
+ * Returns wether the plugin validations are enabled or not
3107
+ */
3108
+ get _checkForPlugins(): boolean;
3109
+ /**
3110
+ * Returns wether the source validations are enabled or not
3111
+ */
3112
+ get _checkForSources(): boolean;
3113
+ /**
3114
+ * Emits a debug event to the LavalinkManager
3115
+ * @param name name of the event
3116
+ * @param eventData event data
3117
+ */
3118
+ private _emitDebugEvent;
3119
+ /**
3120
+ * Returns if connected to the Node.
3121
+ *
3122
+ * @example
3123
+ * ```ts
3124
+ * const isConnected = player.node.connected;
3125
+ * console.log("node is connected: ", isConnected ? "yes" : "no")
3126
+ * ```
3127
+ */
3128
+ get connected(): boolean;
3129
+ /**
3130
+ * Returns the current ConnectionStatus
3131
+ *
3132
+ * @example
3133
+ * ```ts
3134
+ * try {
3135
+ * const statusOfConnection = player.node.connectionStatus;
3136
+ * console.log("node's connection status is:", statusOfConnection)
3137
+ * } catch (error) {
3138
+ * console.error("no socket available?", error)
3139
+ * }
3140
+ * ```
3141
+ */
3142
+ get connectionStatus(): string;
3143
+ /**
3144
+ * Create a new Node
3145
+ * @param options Lavalink Node Options
3146
+ * @param manager Node Manager
3147
+ *
3148
+ *
3149
+ * @example
3150
+ * ```ts
3151
+ * // don't create a node manually, instead use:
3152
+ *
3153
+ * client.lavalink.nodeManager.createNode(options)
3154
+ * ```
3155
+ */
3156
+ constructor(options: LavalinkNodeOptions, manager: NodeManager);
3157
+ /**
3158
+ * Raw Request util function
3159
+ * @param endpoint endpoint string
3160
+ * @param modify modify the request
3161
+ * @param extraQueryUrlParams UrlSearchParams to use in a encodedURI, useful for example for flowertts
3162
+ * @returns object containing request and option information
3163
+ *
3164
+ * @example
3165
+ * ```ts
3166
+ * player.node.rawRequest(`/loadtracks?identifier=Never gonna give you up`, (options) => options.method = "GET");
3167
+ * ```
3168
+ */
3169
+ rawRequest(endpoint: string, modify?: ModifyRequest): Promise<{
3170
+ response: Response;
3171
+ options: RequestInit & {
3172
+ path: string;
3173
+ extraQueryUrlParams?: URLSearchParams;
3174
+ };
3175
+ }>;
3176
+ /**
3177
+ * Makes an API call to the Node. Should only be used for manual parsing like for not supported plugins
3178
+ * @param endpoint The endpoint that we will make the call to
3179
+ * @param modify Used to modify the request before being sent
3180
+ * @returns The returned data
3181
+ *
3182
+ * @example
3183
+ * ```ts
3184
+ * player.node.request(`/loadtracks?identifier=Never gonna give you up`, (options) => options.method = "GET", false);
3185
+ * ```
3186
+ */
3187
+ request(endpoint: string, modify: ModifyRequest | undefined, parseAsText: true): Promise<string>;
3188
+ request(endpoint: string, modify?: ModifyRequest, parseAsText?: false): Promise<any>;
3189
+ /**
3190
+ * Search something raw on the node, please note only add tracks to players of that node
3191
+ * @param query SearchQuery Object
3192
+ * @param requestUser Request User for creating the player(s)
3193
+ * @param throwOnEmpty Wether to throw on an empty result or not
3194
+ * @returns Searchresult
3195
+ *
3196
+ * @example
3197
+ * ```ts
3198
+ * // use player.search() instead
3199
+ * player.node.search({ query: "Never gonna give you up by Rick Astley", source: "soundcloud" }, interaction.user);
3200
+ * player.node.search({ query: "https://deezer.com/track/123456789" }, interaction.user);
3201
+ * ```
3202
+ */
3203
+ search(query: SearchQuery, requestUser: unknown, throwOnEmpty?: boolean): Promise<SearchResult>;
3204
+ /**
3205
+ * Search something using the lavaSearchPlugin (filtered searches by types)
3206
+ * @param query LavaSearchQuery Object
3207
+ * @param requestUser Request User for creating the player(s)
3208
+ * @param throwOnEmpty Wether to throw on an empty result or not
3209
+ * @returns LavaSearchresult (SearchResult if link is provided)
3210
+ *
3211
+ * @example
3212
+ * ```ts
3213
+ * // use player.search() instead
3214
+ * player.node.lavaSearch({ types: ["playlist", "album"], query: "Rick Astley", source: "spotify" }, interaction.user);
3215
+ * ```
3216
+ */
3217
+ lavaSearch(query: LavaSearchQuery, requestUser: unknown, throwOnEmpty?: boolean): Promise<LavaSearchResponse | SearchResult>;
3218
+ /**
3219
+ * Update the Player State on the Lavalink Server
3220
+ * @param data data to send to lavalink and sync locally
3221
+ * @returns result from lavalink
3222
+ *
3223
+ * @example
3224
+ * ```ts
3225
+ * // use player.search() instead
3226
+ * player.node.updatePlayer({ guildId: player.guildId, playerOptions: { paused: true } }); // example to pause it
3227
+ * ```
3228
+ */
3229
+ updatePlayer(data: PlayerUpdateInfo): Promise<LavalinkPlayer>;
3230
+ /**
3231
+ * Destroys the Player on the Lavalink Server
3232
+ * @param guildId
3233
+ * @returns request result
3234
+ *
3235
+ * @example
3236
+ * ```ts
3237
+ * // use player.destroy() instead
3238
+ * player.node.destroyPlayer(player.guildId);
3239
+ * ```
3240
+ */
3241
+ destroyPlayer(guildId: any): Promise<void>;
3242
+ /**
3243
+ * Connect to the Lavalink Node
3244
+ * @param sessionId Provide the Session Id of the previous connection, to resume the node and it's player(s)
3245
+ * @returns void
3246
+ *
3247
+ * @example
3248
+ * ```ts
3249
+ * player.node.connect(); // if provided on bootup in managerOptions#nodes, this will be called automatically when doing lavalink.init()
3250
+ *
3251
+ * // or connect from a resuming session:
3252
+ * player.node.connect("sessionId");
3253
+ * ```
3254
+ */
3255
+ connect(sessionId?: string): void;
3256
+ private heartBeat;
3257
+ /**
3258
+ * Get the id of the node
3259
+ *
3260
+ * @example
3261
+ * ```ts
3262
+ * const nodeId = player.node.id;
3263
+ * console.log("node id is: ", nodeId)
3264
+ * ```
3265
+ */
3266
+ get id(): string;
3267
+ /**
3268
+ * Destroys the Node-Connection (Websocket) and all player's of the node
3269
+ * @param destroyReason Destroy Reason to use when destroying the players
3270
+ * @param deleteNode wether to delete the nodte from the nodes list too, if false it will emit a disconnect. @default true
3271
+ * @param movePlayers whether to movePlayers to different eligible connected node. If false players won't be moved @default false
3272
+ * @returns void
3273
+ *
3274
+ * @example
3275
+ * Destroys node and its players
3276
+ * ```ts
3277
+ * player.node.destroy("custom Player Destroy Reason", true);
3278
+ * ```
3279
+ * destroys only the node and moves its players to different connected node.
3280
+ * ```ts
3281
+ * player.node.destroy("custom Player Destroy Reason", true, true);
3282
+ * ```
3283
+ */
3284
+ destroy(destroyReason?: DestroyReasonsType, deleteNode?: boolean, movePlayers?: boolean): void;
3285
+ /**
3286
+ * Disconnects the Node-Connection (Websocket)
3287
+ * @param disconnectReason Disconnect Reason to use when disconnecting Node
3288
+ * @returns void
3289
+ *
3290
+ * Also the node will not get re-connected again.
3291
+ *
3292
+ * @example
3293
+ * ```ts
3294
+ * player.node.disconnect("Forcefully disconnect the connection to the node.");
3295
+ * ```
3296
+ */
3297
+ disconnect(disconnectReason?: DisconnectReasonsType): void;
3298
+ /**
3299
+ * Pick the best ready node to move players to.
3300
+ * A node must be connected and have a sessionId before a player can be migrated to it.
3301
+ */
3302
+ private getReadyMigrationNode;
3303
+ private getMigrationErrorMessage;
3304
+ private getMigrationConfig;
3305
+ private getMigrationReservationCount;
3306
+ private reserveMigrationTarget;
3307
+ private releaseMigrationTarget;
3308
+ private getEffectiveMigrationLoad;
3309
+ private selectMigrationTarget;
3310
+ private hasAnyHealthyMigrationNode;
3311
+ private isMigrationNodeHealthy;
3312
+ private waitForMigrationCapacity;
3313
+ /**
3314
+ * Move a batch of players to a ready node with bounded concurrency.
3315
+ * This keeps migration responsive without flooding the replacement node with requests.
3316
+ */
3317
+ private movePlayersToReplacementNode;
3318
+ /**
3319
+ * Gets all Players of a Node
3320
+ * @returns array of players inside of lavalink
3321
+ *
3322
+ * @example
3323
+ * ```ts
3324
+ * const node = lavalink.nodes.get("NODEID");
3325
+ * const playersOfLavalink = await node?.fetchAllPlayers();
3326
+ * ```
3327
+ */
3328
+ fetchAllPlayers(): Promise<LavalinkPlayer[] | InvalidLavalinkRestRequest | null>;
3329
+ /**
3330
+ * Gets specific Player Information
3331
+ * @returns lavalink player object if player exists on lavalink
3332
+ *
3333
+ * @example
3334
+ * ```ts
3335
+ * const node = lavalink.nodes.get("NODEID");
3336
+ * const playerInformation = await node?.fetchPlayer("guildId");
3337
+ * ```
3338
+ */
3339
+ fetchPlayer(guildId: string): Promise<LavalinkPlayer | InvalidLavalinkRestRequest | null>;
3340
+ /**
3341
+ * Updates the session with and enables/disables resuming and timeout
3342
+ * @param resuming Whether resuming is enabled for this session or not
3343
+ * @param timeout The timeout in seconds (default is 60s)
3344
+ * @returns the result of the request
3345
+ *
3346
+ * @example
3347
+ * ```ts
3348
+ * const node = player.node || lavalink.nodes.get("NODEID");
3349
+ * await node?.updateSession(true, 180e3); // will enable resuming for 180seconds
3350
+ * ```
3351
+ */
3352
+ updateSession(resuming?: boolean, timeout?: number): Promise<Session | InvalidLavalinkRestRequest | null>;
3353
+ /**
3354
+ * Decode Track or Tracks
3355
+ */
3356
+ decode: {
3357
+ /**
3358
+ * Decode a single track into its info
3359
+ * @param encoded valid encoded base64 string from a track
3360
+ * @param requester the requesteruser for building the track
3361
+ * @returns decoded track from lavalink
3362
+ *
3363
+ * @example
3364
+ * ```ts
3365
+ * const encodedBase64 = 'QAACDgMACk5vIERpZ2dpdHkAC0JsYWNrc3RyZWV0AAAAAAAEo4AABjkxNjQ5NgABAB9odHRwczovL2RlZXplci5jb20vdHJhY2svOTE2NDk2AQBpaHR0cHM6Ly9lLWNkbnMtaW1hZ2VzLmR6Y2RuLm5ldC9pbWFnZXMvY292ZXIvZGFlN2EyNjViNzlmYjcxMjc4Y2RlMjUwNDg0OWQ2ZjcvMTAwMHgxMDAwLTAwMDAwMC04MC0wLTAuanBnAQAMVVNJUjE5NjAwOTc4AAZkZWV6ZXIBAChObyBEaWdnaXR5OiBUaGUgVmVyeSBCZXN0IE9mIEJsYWNrc3RyZWV0AQAjaHR0cHM6Ly93d3cuZGVlemVyLmNvbS9hbGJ1bS8xMDMyNTQBACJodHRwczovL3d3dy5kZWV6ZXIuY29tL2FydGlzdC8xODYxAQBqaHR0cHM6Ly9lLWNkbnMtaW1hZ2VzLmR6Y2RuLm5ldC9pbWFnZXMvYXJ0aXN0L2YxNmNhYzM2ZmVjMzkxZjczN2I3ZDQ4MmY1YWM3M2UzLzEwMDB4MTAwMC0wMDAwMDAtODAtMC0wLmpwZwEAT2h0dHBzOi8vY2RuLXByZXZpZXctYS5kemNkbi5uZXQvc3RyZWFtL2MtYTE1Yjg1NzFhYTYyMDBjMDQ0YmY1OWM3NmVkOTEyN2MtNi5tcDMAAAAAAAAAAAA=';
3366
+ * const track = await player.node.decode.singleTrack(encodedBase64, interaction.user);
3367
+ * ```
3368
+ */
3369
+ singleTrack: (encoded: Base64, requester: unknown) => Promise<Track>;
3370
+ /**
3371
+ * Decodes multiple tracks into their info
3372
+ * @param encodeds valid encoded base64 string array from all tracks
3373
+ * @param requester the requesteruser for building the tracks
3374
+ * @returns array of all tracks you decoded
3375
+ *
3376
+ * @example
3377
+ * ```ts
3378
+ * const encodedBase64_1 = 'QAACDgMACk5vIERpZ2dpdHkAC0JsYWNrc3RyZWV0AAAAAAAEo4AABjkxNjQ5NgABAB9odHRwczovL2RlZXplci5jb20vdHJhY2svOTE2NDk2AQBpaHR0cHM6Ly9lLWNkbnMtaW1hZ2VzLmR6Y2RuLm5ldC9pbWFnZXMvY292ZXIvZGFlN2EyNjViNzlmYjcxMjc4Y2RlMjUwNDg0OWQ2ZjcvMTAwMHgxMDAwLTAwMDAwMC04MC0wLTAuanBnAQAMVVNJUjE5NjAwOTc4AAZkZWV6ZXIBAChObyBEaWdnaXR5OiBUaGUgVmVyeSBCZXN0IE9mIEJsYWNrc3RyZWV0AQAjaHR0cHM6Ly93d3cuZGVlemVyLmNvbS9hbGJ1bS8xMDMyNTQBACJodHRwczovL3d3dy5kZWV6ZXIuY29tL2FydGlzdC8xODYxAQBqaHR0cHM6Ly9lLWNkbnMtaW1hZ2VzLmR6Y2RuLm5ldC9pbWFnZXMvYXJ0aXN0L2YxNmNhYzM2ZmVjMzkxZjczN2I3ZDQ4MmY1YWM3M2UzLzEwMDB4MTAwMC0wMDAwMDAtODAtMC0wLmpwZwEAT2h0dHBzOi8vY2RuLXByZXZpZXctYS5kemNkbi5uZXQvc3RyZWFtL2MtYTE1Yjg1NzFhYTYyMDBjMDQ0YmY1OWM3NmVkOTEyN2MtNi5tcDMAAAAAAAAAAAA=';
3379
+ * const encodedBase64_2 = 'QAABJAMAClRhbGsgYSBMb3QACjQwNHZpbmNlbnQAAAAAAAHr1gBxTzpodHRwczovL2FwaS12Mi5zb3VuZGNsb3VkLmNvbS9tZWRpYS9zb3VuZGNsb3VkOnRyYWNrczo4NTE0MjEwNzYvMzUyYTRiOTAtNzYxOS00M2E5LWJiOGItMjIxMzE0YzFjNjNhL3N0cmVhbS9obHMAAQAsaHR0cHM6Ly9zb3VuZGNsb3VkLmNvbS80MDR2aW5jZW50L3RhbGstYS1sb3QBADpodHRwczovL2kxLnNuZGNkbi5jb20vYXJ0d29ya3MtRTN1ek5Gc0Y4QzBXLTAtb3JpZ2luYWwuanBnAQAMUVpITkExOTg1Nzg0AApzb3VuZGNsb3VkAAAAAAAAAAA=';
3380
+ * const tracks = await player.node.decode.multipleTracks([encodedBase64_1, encodedBase64_2], interaction.user);
3381
+ * ```
3382
+ */
3383
+ multipleTracks: (encodeds: Base64[], requester: unknown) => Promise<Track[]>;
3384
+ };
3385
+ lyrics: {
3386
+ /**
3387
+ * Get the lyrics of a track
3388
+ * @param track the track to get the lyrics for
3389
+ * @param skipTrackSource wether to skip the track source or not
3390
+ * @returns the lyrics of the track
3391
+ * @example
3392
+ *
3393
+ * ```ts
3394
+ * const lyrics = await player.node.lyrics.get(track, true);
3395
+ * // use it of player instead:
3396
+ * // const lyrics = await player.getLyrics(track, true);
3397
+ * ```
3398
+ */
3399
+ get: (track: Track, skipTrackSource?: boolean) => Promise<LyricsResult | null>;
3400
+ /**
3401
+ * Get the lyrics of the current playing track
3402
+ *
3403
+ * @param guildId the guild id of the player
3404
+ * @param skipTrackSource wether to skip the track source or not
3405
+ * @returns the lyrics of the current playing track
3406
+ * @example
3407
+ * ```ts
3408
+ * const lyrics = await player.node.lyrics.getCurrent(guildId);
3409
+ * // use it of player instead:
3410
+ * // const lyrics = await player.getCurrentLyrics();
3411
+ * ```
3412
+ */
3413
+ getCurrent: (guildId: string, skipTrackSource?: boolean) => Promise<LyricsResult | null>;
3414
+ /**
3415
+ * subscribe to lyrics updates for a guild
3416
+ * @param guildId the guild id of the player
3417
+ * @param skipTrackSource wether to skip the track source or not
3418
+ * @returns request data of the request
3419
+ *
3420
+ * @example
3421
+ * ```ts
3422
+ * await player.node.lyrics.subscribe(guildId);
3423
+ * // use it of player instead:
3424
+ * // const lyrics = await player.subscribeLyrics();
3425
+ * ```
3426
+ */
3427
+ subscribe: (guildId: string, skipTrackSource?: boolean) => Promise<unknown>;
3428
+ /**
3429
+ * unsubscribe from lyrics updates for a guild
3430
+ * @param guildId the guild id of the player
3431
+ * @returns request data of the request
3432
+ *
3433
+ * @example
3434
+ * ```ts
3435
+ * await player.node.lyrics.unsubscribe(guildId);
3436
+ * // use it of player instead:
3437
+ * // const lyrics = await player.unsubscribeLyrics();
3438
+ * ```
3439
+ */
3440
+ unsubscribe: (guildId: string) => Promise<void>;
3441
+ };
3442
+ /**
3443
+ * Request Lavalink statistics.
3444
+ * @returns the lavalink node stats
3445
+ *
3446
+ * @example
3447
+ * ```ts
3448
+ * const lavalinkStats = await player.node.fetchStats();
3449
+ * ```
3450
+ */
3451
+ fetchStats(): Promise<BaseNodeStats>;
3452
+ /**
3453
+ * Request NodeLink connection metrics. https://nodelink.js.org/docs/differences#connection-metrics
3454
+ * @returns the connection metrics of the node
3455
+ *
3456
+ * @example
3457
+ * ```ts
3458
+ * const connectionMetrics = await player.node.fetchConnectionMetrics();
3459
+ * ```
3460
+ */
3461
+ fetchConnectionMetrics(): Promise<NodeLinkConnectionMetrics>;
3462
+ /**
3463
+ * Request Lavalink version.
3464
+ * @returns the current used lavalink version
3465
+ *
3466
+ * @example
3467
+ * ```ts
3468
+ * const lavalinkVersion = await player.node.fetchVersion();
3469
+ * ```
3470
+ */
3471
+ fetchVersion(): Promise<string>;
3472
+ /**
3473
+ * Request Lavalink information.
3474
+ * @returns lavalink info object
3475
+ *
3476
+ * @example
3477
+ * ```ts
3478
+ * const lavalinkInfo = await player.node.fetchInfo();
3479
+ * const availablePlugins:string[] = lavalinkInfo.plugins.map(plugin => plugin.name);
3480
+ * const availableSources:string[] = lavalinkInfo.sourceManagers;
3481
+ * ```
3482
+ */
3483
+ fetchInfo(): Promise<LavalinkInfo>;
3484
+ /**
3485
+ * Returns the metric summary of the node
3486
+ * @returns the metric summary of the node
3487
+ */
3488
+ nodeMetricSummary(): NodeMetricSummary;
3489
+ /**
3490
+ * Get the node's health status with performance assessment.
3491
+ * @returns Object containing health status, performance rating, load balancing info, and recommendations
3492
+ *
3493
+ * @example
3494
+ * ```ts
3495
+ * const health = node.getHealthStatus();
3496
+ * console.log(`Node Status: ${health.status}`); // "healthy" | "degraded" | "critical" | "offline"
3497
+ * console.log(`Performance: ${health.performance}`); // "excellent" | "good" | "fair" | "poor"
3498
+ * console.log(`Penalty Score: ${health.penaltyScore}`); // Lower is better for load balancing
3499
+ * console.log(`Estimated Capacity: ${health.estimatedRemainingCapacity} more players`);
3500
+ * console.log(`Overloaded: ${health.isOverloaded}`);
3501
+ * console.log(`Needs Restart: ${health.needsRestart}`);
3502
+ * if (health.recommendations.length) {
3503
+ * console.log("Recommendations:", health.recommendations);
3504
+ * }
3505
+ * ```
3506
+ */
3507
+ getHealthStatus(thresholds?: HealthStatusThresholdOptions): HealthStatusObject;
3508
+ /**
3509
+ * Lavalink's Route Planner Api
3510
+ */
3511
+ routePlannerApi: {
3512
+ /**
3513
+ * Get routplanner Info from Lavalink for ip rotation
3514
+ * @returns the status of the routeplanner
3515
+ *
3516
+ * @example
3517
+ * ```ts
3518
+ * const routePlannerStatus = await player.node.routePlannerApi.getStatus();
3519
+ * const usedBlock = routePlannerStatus.details?.ipBlock;
3520
+ * const currentIp = routePlannerStatus.currentAddress;
3521
+ * ```
3522
+ */
3523
+ getStatus: () => Promise<RoutePlanner>;
3524
+ /**
3525
+ * Release blacklisted IP address into pool of IPs for ip rotation
3526
+ * @param address IP address
3527
+ * @returns request data of the request
3528
+ *
3529
+ * @example
3530
+ * ```ts
3531
+ * await player.node.routePlannerApi.unmarkFailedAddress("ipv6address");
3532
+ * ```
3533
+ */
3534
+ unmarkFailedAddress: (address: string) => Promise<unknown>;
3535
+ /**
3536
+ * Release all blacklisted IP addresses into pool of IPs
3537
+ * @returns request data of the request
3538
+ *
3539
+ * @example
3540
+ * ```ts
3541
+ * await player.node.routePlannerApi.unmarkAllFailedAddresses();
3542
+ * ```
3543
+ */
3544
+ unmarkAllFailedAddresses: () => Promise<unknown>;
3545
+ };
3546
+ /** @private Utils for validating the */
3547
+ private validate;
3548
+ /**
3549
+ * Checks if the node is a NodeLink node
3550
+ * @returns true if the node is a NodeLink node
3551
+ */
3552
+ isNodeLink(): this is NodeLinkNode;
3553
+ /**
3554
+ * Checks if the node is a Lavalink node
3555
+ * @returns true if the node is a Lavalink node
3556
+ */
3557
+ isLavalinkNode(): this is LavalinkNode;
3558
+ /**
3559
+ * Sync the data of the player you make an action to lavalink to
3560
+ * @param data data to use to update the player
3561
+ * @param res result data from lavalink, to override, if available
3562
+ * @returns boolean
3563
+ */
3564
+ private syncPlayerData;
3565
+ /**
3566
+ * Get the rest Adress for making requests
3567
+ */
3568
+ private get restAddress();
3569
+ /**
3570
+ * If already trying to reconnect or pending, return
3571
+ */
3572
+ get isNodeReconnecting(): boolean;
3573
+ /**
3574
+ * Reconnect to the lavalink node
3575
+ * @param force @default false Wether to instantly try to reconnect (force it)
3576
+ * @returns void
3577
+ *
3578
+ * @example
3579
+ * ```ts
3580
+ * await player.node.reconnect(true); //true forcefully trys the reconnect
3581
+ * ```
3582
+ */
3583
+ private reconnect;
3584
+ get reconnectionAttemptCount(): number;
3585
+ /**
3586
+ * Private Utility function to execute the reconnection
3587
+ */
3588
+ private executeReconnect;
3589
+ /**
3590
+ * Private function to reset the reconnection attempts
3591
+ * @returns
3592
+ */
3593
+ private resetReconnectionAttempts;
3594
+ /**
3595
+ * Private function to reset timeouts/intervals for heartbeating/pinging
3596
+ * @param heartbeat
3597
+ * @param ping
3598
+ * @returns
3599
+ */
3600
+ private resetAckTimeouts;
3601
+ /** @private util function for handling opening events from websocket */
3602
+ private open;
3603
+ /** @private util function for handling closing events from websocket */
3604
+ private close;
3605
+ /** @private util function for handling error events from websocket */
3606
+ private error;
3607
+ /** @private util function for handling message events from websocket */
3608
+ private message;
3609
+ /** @private middleware util function for handling all kind of events from websocket */
3610
+ private handleEvent;
3611
+ /**
3612
+ * nodeLink specific events handling https://nodelink.js.org/docs/api/websocket#incoming-events-server--client
3613
+ * @param eventName
3614
+ * @param player
3615
+ * @param track
3616
+ * @param payload
3617
+ */
3618
+ private nodeLinkEventHandler;
3619
+ private getTrackOfPayload;
3620
+ /** @private util function for handling trackStart event */
3621
+ private trackStart;
3622
+ /** @private util function for handling trackEnd event */
3623
+ private trackEnd;
3624
+ /** @private util function for handling trackStuck event */
3625
+ private trackStuck;
3626
+ /** @private util function for handling trackError event */
3627
+ private trackError;
3628
+ /** @private util function for handling socketClosed event */
3629
+ private socketClosed;
3630
+ /** @private util function for handling SponsorBlock Segmentloaded event */
3631
+ private SponsorBlockSegmentLoaded;
3632
+ /** @private util function for handling SponsorBlock SegmentSkipped event */
3633
+ private SponsorBlockSegmentSkipped;
3634
+ /** @private util function for handling SponsorBlock Chaptersloaded event */
3635
+ private SponsorBlockChaptersLoaded;
3636
+ /** @private util function for handling SponsorBlock Chaptersstarted event */
3637
+ private SponsorBlockChapterStarted;
3638
+ /**
3639
+ * Get the current sponsorblocks for the sponsorblock plugin
3640
+ * @param player passthrough the player
3641
+ * @returns sponsorblock seggment from lavalink
3642
+ *
3643
+ * @example
3644
+ * ```ts
3645
+ * // use it on the player via player.getSponsorBlock();
3646
+ * const sponsorBlockSegments = await player.node.getSponsorBlock(player);
3647
+ * ```
3648
+ */
3649
+ getSponsorBlock(player: Player): Promise<SponsorBlockSegment[]>;
3650
+ /**
3651
+ * Set the current sponsorblocks for the sponsorblock plugin
3652
+ * @param player passthrough the player
3653
+ * @returns void
3654
+ *
3655
+ * @example
3656
+ * ```ts
3657
+ * // use it on the player via player.setSponsorBlock();
3658
+ * const sponsorBlockSegments = await player.node.setSponsorBlock(player, ["sponsor", "selfpromo"]);
3659
+ * ```
3660
+ */
3661
+ setSponsorBlock(player: Player, segments?: SponsorBlockSegment[]): Promise<void>;
3662
+ /**
3663
+ * Delete the sponsorblock plugins
3664
+ * @param player passthrough the player
3665
+ * @returns void
3666
+ *
3667
+ * @example
3668
+ * ```ts
3669
+ * // use it on the player via player.deleteSponsorBlock();
3670
+ * const sponsorBlockSegments = await player.node.deleteSponsorBlock(player);
3671
+ * ```
3672
+ */
3673
+ deleteSponsorBlock(player: Player): Promise<void>;
3674
+ /** private util function for handling the queue end event */
3675
+ private queueEnd;
3676
+ /**
3677
+ * Emitted whenever a line of lyrics gets emitted
3678
+ * @event
3679
+ * @param {Player} player The player that emitted the event
3680
+ * @param {Track} track The track that emitted the event
3681
+ * @param {LyricsLineEvent} payload The payload of the event
3682
+ */
3683
+ private LyricsLine;
3684
+ /**
3685
+ * Emitted whenever the lyrics for a track got found
3686
+ * @event
3687
+ * @param {Player} player The player that emitted the event
3688
+ * @param {Track} track The track that emitted the event
3689
+ * @param {LyricsFoundEvent} payload The payload of the event
3690
+ */
3691
+ private LyricsFound;
3692
+ /**
3693
+ * Emitted whenever the lyrics for a track got not found
3694
+ * @event
3695
+ * @param {Player} player The player that emitted the event
3696
+ * @param {Track} track The track that emitted the event
3697
+ * @param {LyricsNotFoundEvent} payload The payload of the event
3698
+ */
3699
+ private LyricsNotFound;
3700
+ /**
3701
+ * @private
3702
+ * util function to check if a provided source is valid with current node.
3703
+ * @param {LavalinkSearchPlatform} src
3704
+ * @returns {boolean} True if provided source is valid.
3705
+ */
3706
+ private isLavaSrcSource;
3707
+ }
3708
+ //#endregion
3709
+ //#region src/structures/NodeManager.d.ts
3710
+ declare class NodeManager extends EventEmitter {
3711
+ /**
3712
+ * Emit an event
3713
+ * @param event The event to emit
3714
+ * @param args The arguments to pass to the event
3715
+ * @returns
3716
+ */
3717
+ emit<Event extends keyof NodeManagerEvents>(event: Event, ...args: Parameters<NodeManagerEvents[Event]>): boolean;
3718
+ /**
3719
+ * Add an event listener
3720
+ * @param event The event to listen to
3721
+ * @param listener The listener to add
3722
+ * @returns
3723
+ */
3724
+ on<Event extends keyof NodeManagerEvents>(event: Event, listener: NodeManagerEvents[Event]): this;
3725
+ /**
3726
+ * Add an event listener that only fires once
3727
+ * @param event The event to listen to
3728
+ * @param listener The listener to add
3729
+ * @returns
3730
+ */
3731
+ once<Event extends keyof NodeManagerEvents>(event: Event, listener: NodeManagerEvents[Event]): this;
3732
+ /**
3733
+ * Remove an event listener
3734
+ * @param event The event to remove the listener from
3735
+ * @param listener The listener to remove
3736
+ * @returns
3737
+ */
3738
+ off<Event extends keyof NodeManagerEvents>(event: Event, listener: NodeManagerEvents[Event]): this;
3739
+ /**
3740
+ * Remove an event listener
3741
+ * @param event The event to remove the listener from
3742
+ * @param listener The listener to remove
3743
+ * @returns
3744
+ */
3745
+ removeListener<Event extends keyof NodeManagerEvents>(event: Event, listener: NodeManagerEvents[Event]): this;
3746
+ /**
3747
+ * The LavalinkManager that created this NodeManager
3748
+ */
3749
+ LavalinkManager: LavalinkManager;
3750
+ /**
3751
+ * A map of all nodes in the nodeManager
3752
+ */
3753
+ nodes: MiniMap<string, LavalinkNode | NodeLinkNode>;
3754
+ /** @internal Coordinates player migrations between nodes owned by this manager. */
3755
+ readonly playerMigration: {
3756
+ reservations: Map<string, number>;
3757
+ capacityWaiters: Set<() => void>;
3758
+ };
3759
+ /** @internal Wakes migrations waiting for capacity on one of this manager's nodes. */
3760
+ signalPlayerMigrationCapacityChange(): void;
3761
+ /**
3762
+ * @param LavalinkManager The LavalinkManager that created this NodeManager
3763
+ */
3764
+ constructor(LavalinkManager: LavalinkManager);
3765
+ /**
3766
+ * Disconnects all Nodes from lavalink ws sockets
3767
+ * @param deleteAllNodes if the nodes should also be deleted from nodeManager.nodes
3768
+ * @param destroyPlayers if the players should be destroyed
3769
+ * @returns amount of disconnected Nodes
3770
+ */
3771
+ disconnectAll(deleteAllNodes?: boolean, destroyPlayers?: boolean): Promise<number>;
3772
+ /**
3773
+ * Connects all not connected nodes
3774
+ * @returns Amount of connected Nodes
3775
+ */
3776
+ connectAll(): Promise<number>;
3777
+ /**
3778
+ * Forcefully reconnects all nodes
3779
+ * @returns amount of nodes
3780
+ */
3781
+ reconnectAll(): Promise<number>;
3782
+ /**
3783
+ * Create a node and add it to the nodeManager
3784
+ * @param options The options for the node
3785
+ * @returns The node that was created
3786
+ */
3787
+ createNode<T extends LavalinkNode | NodeLinkNode>(options: LavalinkNodeOptions | NodeLinkNode | LavalinkNode): T;
3788
+ /**
3789
+ * Get the nodes sorted for the least usage, by a sorttype
3790
+ * @param sortType The type of sorting to use
3791
+ * @returns
3792
+ */
3793
+ leastUsedNodes(sortType?: "memory" | "cpuLavalink" | "cpuSystem" | "calls" | "playingPlayers" | "players", filterForNodeTypes?: (NodeType | NodeLinkNode | LavalinkNode)[]): LavalinkNode[];
3794
+ /**
3795
+ * Delete a node from the nodeManager and destroy it
3796
+ * @param node The node to delete
3797
+ * @param movePlayers whether to movePlayers to different connected node before deletion. @default false
3798
+ * @returns
3799
+ *
3800
+ * @example
3801
+ * Deletes the node
3802
+ * ```ts
3803
+ * client.lavalink.nodeManager.deleteNode("nodeId to delete");
3804
+ * ```
3805
+ * Moves players to a different node before deleting
3806
+ * ```ts
3807
+ * client.lavalink.nodeManager.deleteNode("nodeId to delete", true);
3808
+ * ```
3809
+ */
3810
+ deleteNode(node: LavalinkNodeIdentifier | LavalinkNode | NodeLinkNode, movePlayers?: boolean): void;
3811
+ /**
3812
+ * Get a node from the nodeManager
3813
+ * @param node The node to get either by idetnifier, by class or by enum
3814
+ * @returns The node that was retrieved
3815
+ */
3816
+ getNode(node: LavalinkNodeIdentifier | LavalinkNode | NodeLinkNode | NodeType): LavalinkNode | NodeLinkNode | undefined;
3817
+ }
3818
+ //#endregion
3819
+ //#region src/structures/Types/Manager.d.ts
3820
+ /**
3821
+ * The events from the lavalink Manager
3822
+ */
3823
+ interface LavalinkManagerEvents<CustomPlayerT extends Player = Player> {
3824
+ /**
3825
+ * Emitted when a Track started playing.
3826
+ * @event Manager#trackStart
3827
+ */
3828
+ trackStart: (player: CustomPlayerT, track: Track | null, payload: TrackStartEvent) => void;
3829
+ /**
3830
+ * Emitted when a Track finished.
3831
+ * @event Manager#trackEnd
3832
+ */
3833
+ trackEnd: (player: CustomPlayerT, track: Track | null, payload: TrackEndEvent) => void;
3834
+ /**
3835
+ * Emitted when a Track got stuck while playing.
3836
+ * @event Manager#trackStuck
3837
+ */
3838
+ trackStuck: (player: CustomPlayerT, track: Track | null, payload: TrackStuckEvent) => void;
3839
+ /**
3840
+ * Emitted when a Track errored.
3841
+ * @event Manager#trackError
3842
+ */
3843
+ trackError: (player: CustomPlayerT, track: Track | UnresolvedTrack | null, payload: TrackExceptionEvent) => void;
3844
+ /**
3845
+ * Emitted when the Playing finished and no more tracks in the queue.
3846
+ * @event Manager#queueEnd
3847
+ */
3848
+ queueEnd: (player: CustomPlayerT, track: Track | UnresolvedTrack | null, payload: TrackEndEvent | TrackStuckEvent | TrackExceptionEvent) => void;
3849
+ /**
3850
+ * Emitted when a Player is created.
3851
+ * @event Manager#playerCreate
3852
+ */
3853
+ playerCreate: (player: CustomPlayerT) => void;
3854
+ /**
3855
+ * Emitted when a Player is moved within the channel.
3856
+ * @event Manager#playerMove
3857
+ */
3858
+ playerMove: (player: CustomPlayerT, oldVoiceChannelId: string, newVoiceChannelId: string) => void;
3859
+ /**
3860
+ * Emitted when a Player is disconnected from a channel.
3861
+ * @event Manager#playerDisconnect
3862
+ */
3863
+ playerDisconnect: (player: CustomPlayerT, voiceChannelId: string) => void;
3864
+ /**
3865
+ * Emitted when a Player automatically reconnects after a disconnect.
3866
+ * This event is triggered when the player successfully reconnects to the voice channel
3867
+ * and resumes playback after being disconnected (requires onDisconnect.autoReconnect to be enabled).
3868
+ * @event Manager#playerReconnect
3869
+ */
3870
+ playerReconnect: (player: CustomPlayerT, voiceChannelId: string) => void;
3871
+ /**
3872
+ * Emitted when a Node-Socket got closed for a specific Player.
3873
+ * 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.
3874
+ *
3875
+ * So this is just information, normally lavalink should handle disconnections
3876
+ *
3877
+ * Discord Docs:
3878
+ * @link https://discord.com/developers/docs/topics/opcodes-and-status-codes#voice-voice-close-event-codes
3879
+ *
3880
+ * Lavalink Docs:
3881
+ * @link https://lavalink.dev/api/websocket.html#websocketclosedevent
3882
+ * @event Manager#playerSocketClosed
3883
+ */
3884
+ playerSocketClosed: (player: CustomPlayerT, payload: WebSocketClosedEvent) => void;
3885
+ /**
3886
+ * Emitted when a Player get's destroyed
3887
+ * @event Manager#playerDestroy
3888
+ */
3889
+ playerDestroy: (player: CustomPlayerT, destroyReason?: DestroyReasonsType) => void;
3890
+ /**
3891
+ * Always emits when the player (on lavalink side) got updated
3892
+ * @event Manager#playerUpdate
3893
+ */
3894
+ playerUpdate: (oldPlayerJson: PlayerJson, newPlayer: CustomPlayerT) => void;
3895
+ /**
3896
+ * Always emits when the player (on client side) got updated via a function-call.
3897
+ * This is useful for example, if you want to save the player data on every update, or similar.
3898
+ * @event Manager#playerClientUpdate
3899
+ *
3900
+ * Emits only when you call one of those functions:
3901
+ * player.pause()
3902
+ * player.resume()
3903
+ * player.seek()
3904
+ * player.setRepeatMode()
3905
+ * player.setVolume()
3906
+ * and on every call of the filterManager.
3907
+ */
3908
+ playerClientUpdate: (oldPlayerJson: PlayerJson, newPlayer: CustomPlayerT) => void;
3909
+ /**
3910
+ * Emitted when the player's selfMuted or serverMuted state changed (true -> false | false -> true)
3911
+ * @event Manager#playerMuteChange
3912
+ */
3913
+ playerMuteChange: (player: CustomPlayerT, selfMuted: boolean, serverMuted: boolean) => void;
3914
+ /**
3915
+ * Emitted when the player's selfDeafed or serverDeafed state changed (true -> false | false -> true)
3916
+ * @event Manager#playerDeafChange
3917
+ */
3918
+ playerDeafChange: (player: CustomPlayerT, selfDeafed: boolean, serverDeafed: boolean) => void;
3919
+ /**
3920
+ * Emitted when the player's suppressed (true -> false | false -> true)
3921
+ * @event Manager#playerSuppressChange
3922
+ */
3923
+ playerSuppressChange: (player: CustomPlayerT, suppress: boolean) => void;
3924
+ /**
3925
+ * Emitted when the player's queue got empty, and the timeout started
3926
+ * @event Manager#playerQueueEmptyStart
3927
+ */
3928
+ playerQueueEmptyStart: (player: CustomPlayerT, timeoutMs: number) => void;
3929
+ /**
3930
+ * Emitted when the player's queue got empty, and the timeout finished leading to destroying the player
3931
+ * @event Manager#playerQueueEmptyEnd
3932
+ */
3933
+ playerQueueEmptyEnd: (player: CustomPlayerT) => void;
3934
+ /**
3935
+ * Emitted when the player's queue got empty, and the timeout got cancelled becuase a track got re-added to it.
3936
+ * @event Manager#playerQueueEmptyEnd
3937
+ */
3938
+ playerQueueEmptyCancel: (player: CustomPlayerT) => void;
3939
+ /**
3940
+ * Emitted, when a user joins the voice channel, while there is a player existing
3941
+ * @event Manager#playerQueueEmptyStart
3942
+ */
3943
+ playerVoiceJoin: (player: CustomPlayerT, userId: string) => void;
3944
+ /**
3945
+ * Emitted, when a user leaves the voice channel, while there is a player existing
3946
+ * @event Manager#playerQueueEmptyEnd
3947
+ */
3948
+ playerVoiceLeave: (player: CustomPlayerT, userId: string) => void;
3949
+ /**
3950
+ * SPONSORBLOCK-PLUGIN EVENT
3951
+ * Emitted when Segments are loaded
3952
+ * @link https://github.com/topi314/Sponsorblock-Plugin#segmentsloaded
3953
+ * @event Manager#trackError
3954
+ */
3955
+ SegmentsLoaded: (player: CustomPlayerT, track: Track | UnresolvedTrack | null, payload: SponsorBlockSegmentsLoaded) => void;
3956
+ /**
3957
+ * SPONSORBLOCK-PLUGIN EVENT
3958
+ * Emitted when a specific Segment was skipped
3959
+ * @link https://github.com/topi314/Sponsorblock-Plugin#segmentskipped
3960
+ * @event Manager#trackError
3961
+ */
3962
+ SegmentSkipped: (player: CustomPlayerT, track: Track | UnresolvedTrack | null, payload: SponsorBlockSegmentSkipped) => void;
3963
+ /**
3964
+ * SPONSORBLOCK-PLUGIN EVENT
3965
+ * Emitted when a specific Chapter starts playing
3966
+ * @link https://github.com/topi314/Sponsorblock-Plugin#chapterstarted
3967
+ * @event Manager#trackError
3968
+ */
3969
+ ChapterStarted: (player: CustomPlayerT, track: Track | UnresolvedTrack | null, payload: SponsorBlockChapterStarted) => void;
3970
+ /**
3971
+ * SPONSORBLOCK-PLUGIN EVENT
3972
+ * Emitted when Chapters are loaded
3973
+ * @link https://github.com/topi314/Sponsorblock-Plugin#chaptersloaded
3974
+ * @event Manager#trackError
3975
+ */
3976
+ ChaptersLoaded: (player: CustomPlayerT, track: Track | UnresolvedTrack | null, payload: SponsorBlockChaptersLoaded) => void;
3977
+ /**
3978
+ * Lavalink-Client Debug Event
3979
+ * Emitted for several erros, and logs within lavalink-client, if managerOptions.advancedOptions.enableDebugEvents is true
3980
+ * Useful for debugging the lavalink-client
3981
+ *
3982
+ * @event Manager#debug
3983
+ */
3984
+ debug: (eventKey: DebugEvents, eventData: {
3985
+ message: string;
3986
+ state: "log" | "warn" | "error";
3987
+ error?: Error | string;
3988
+ functionLayer: string;
3989
+ }) => void;
3990
+ /**
3991
+ * Emitted when a Lyrics line is received
3992
+ * @link https://github.com/topi314/LavaLyrics
3993
+ * @event Manager#LyricsLine
3994
+ */
3995
+ LyricsLine: (player: CustomPlayerT, track: Track | UnresolvedTrack | null, payload: LyricsLineEvent) => void;
3996
+ /**
3997
+ * Emitted when a Lyrics is found
3998
+ * @link https://github.com/topi314/LavaLyrics
3999
+ * @event Manager#LyricsFound
4000
+ */
4001
+ LyricsFound: (player: CustomPlayerT, track: Track | UnresolvedTrack | null, payload: LyricsFoundEvent) => void;
4002
+ /**
4003
+ * Emitted when a Lyrics is not found
4004
+ * @link https://github.com/topi314/LavaLyrics
4005
+ * @event Manager#LyricsNotFound
4006
+ */
4007
+ LyricsNotFound: (player: CustomPlayerT, track: Track | UnresolvedTrack | null, payload: LyricsNotFoundEvent) => void;
4008
+ playerResumed: (player: CustomPlayerT, track: Track | UnresolvedTrack | null) => void;
4009
+ playerPaused: (player: CustomPlayerT, track: Track | UnresolvedTrack | null) => void;
4010
+ }
4011
+ /**
4012
+ * The Bot client Options needed for the manager
4013
+ */
4014
+ interface BotClientOptions {
4015
+ /** Bot Client Id */
4016
+ id: string;
4017
+ /** Bot Client Username */
4018
+ username?: string;
4019
+ /** So users can pass entire objects / classes */
4020
+ [x: string | number | symbol]: unknown;
4021
+ }
4022
+ /** Sub Manager Options, for player specific things */
4023
+ interface ManagerPlayerOptions<CustomPlayerT extends Player = Player> {
4024
+ /** If the Lavalink Volume should be decremented by x number */
4025
+ volumeDecrementer?: number;
4026
+ /** How often it should update the the player Position */
4027
+ clientBasedPositionUpdateInterval?: number;
4028
+ /** What should be used as a searchPlatform, if no source was provided during the query */
4029
+ defaultSearchPlatform?: SearchPlatform;
4030
+ /** Allow custom sources which lavalink-client does not support (yet) */
4031
+ allowCustomSources?: boolean;
4032
+ /** Applies the volume via a filter, not via the lavalink volume transformer */
4033
+ applyVolumeAsFilter?: boolean;
4034
+ /** Transforms the saved data of a requested user */
4035
+ requesterTransformer?: (requester: unknown) => unknown;
4036
+ /** What lavalink-client should do when the player reconnects */
4037
+ onDisconnect?: {
4038
+ /** Try to reconnect? -> If fails -> Destroy */
4039
+ autoReconnect?: boolean;
4040
+ /** Only try to reconnect if there are tracks in the queue */
4041
+ autoReconnectOnlyWithTracks?: boolean;
4042
+ /** Instantly destroy player (overrides autoReconnect) | Don't provide == disable feature*/
4043
+ destroyPlayer?: boolean;
4044
+ };
4045
+ /** Minimum time to play the song before autoPlayFunction is executed (prevents error spamming) Set to 0 to disable it @default 10000 */
4046
+ minAutoPlayMs?: number;
4047
+ /** Allows you to declare how many tracks are allowed to error/stuck within a time-frame before player is destroyed @default "{threshold: 35000, maxAmount: 3 }" */
4048
+ maxErrorsPerTime?: {
4049
+ /** The threshold time to count errors (recommended is 35s) */
4050
+ threshold: number;
4051
+ /** The max amount of errors within the threshold time which are allowed before destroying the player (when errors > maxAmount -> player.destroy()) */
4052
+ maxAmount: number;
4053
+ };
4054
+ onEmptyQueue?: {
4055
+ /** 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! */
4056
+ autoPlayFunction?: (player: CustomPlayerT, lastPlayedTrack: Track) => Promise<void>;
4057
+ destroyAfterMs?: number;
4058
+ };
4059
+ useUnresolvedData?: boolean;
4060
+ /**
4061
+ * If true (default), when changing nodes, `setSponsorBlock()` with default categories is called
4062
+ * even if the user never explicitly set categories. This is needed so the SponsorBlock plugin
4063
+ * registers its event listeners (ChapterStarted/ChapterLoaded) on the new node.
4064
+ * Set to false to disable this behavior if you don't use SponsorBlock events.
4065
+ * @default true
4066
+ */
4067
+ enforceSponsorBlockRequestForEventEnablement?: boolean;
4068
+ }
4069
+ type DeepRequired<T> = { [K in keyof T]-?: NonNullable<T[K]> extends object ? DeepRequired<NonNullable<T[K]>> : NonNullable<T[K]>; };
4070
+ type RequiredManagerOptions<T extends Player> = DeepRequired<ManagerOptions<T>>;
4071
+ type PlayerConstructor<T extends Player = Player> = new (options: PlayerOptions, LavalinkManager: LavalinkManager, dontEmitPlayerCreateEvent?: boolean) => T;
4072
+ /** Manager Options used to create the manager */
4073
+ interface ManagerOptions<CustomPlayerT extends Player = Player> {
4074
+ /** The Node Options, for all Nodes! (on init) */
4075
+ nodes: (LavalinkNodeOptions | NodeLinkNode | LavalinkNode)[];
4076
+ /** @async The Function to send the voice connection changes from Lavalink to Discord */
4077
+ sendToShard: (guildId: string, payload: GuildShardPayload) => void;
4078
+ /** The Bot Client's Data for Authorization */
4079
+ client?: BotClientOptions;
4080
+ /** QueueOptions for all Queues */
4081
+ queueOptions?: ManagerQueueOptions;
4082
+ /** PlayerOptions for all Players */
4083
+ playerOptions?: ManagerPlayerOptions<CustomPlayerT>;
4084
+ /** The player class you want to use when creating a player. (can be extendable) */
4085
+ playerClass?: PlayerConstructor<CustomPlayerT>;
4086
+ /** If it should skip to the next Track on TrackEnd / TrackError etc. events */
4087
+ autoSkip?: boolean;
4088
+ /** If it should automatically move the player to the next node when node is down */
4089
+ autoMove?: boolean;
4090
+ /** If it should skip to the next Track if track.resolve errors while trying to play a track. */
4091
+ autoSkipOnResolveError?: boolean;
4092
+ /** If it should emit only new (unique) songs and not when a looping track (or similar) is plaid, default false */
4093
+ emitNewSongsOnly?: boolean;
4094
+ /** Only allow link requests with links either matching some of that regExp or including some of that string */
4095
+ linksWhitelist?: (RegExp | string)[];
4096
+ /** 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) */
4097
+ linksBlacklist?: (RegExp | string)[];
4098
+ /** If links should be allowed or not. If set to false, it will throw an error if a link was provided. */
4099
+ linksAllowed?: boolean;
4100
+ /** Custom http headers to be sent with every request to lavalink */
4101
+ httpHeaders?: Record<string, string>;
4102
+ /** Advanced Options for the Library, which may or may not be "library breaking" */
4103
+ advancedOptions?: {
4104
+ /** Max duration for that the filter fix duration works (in ms) - default is 8mins */
4105
+ maxFilterFixDuration?: number;
4106
+ /** Enable Debug event */
4107
+ enableDebugEvents?: boolean;
4108
+ /** optional */
4109
+ debugOptions?: {
4110
+ /** For logging custom searches */
4111
+ logCustomSearches?: boolean;
4112
+ /** logs for debugging the "no-Audio" playing error */
4113
+ noAudio?: boolean;
4114
+ /** For Logging the Destroy function */
4115
+ playerDestroy?: {
4116
+ /** To show the debug reason at all times. */
4117
+ debugLog?: boolean;
4118
+ /** If you get 'Error: Use Player#destroy("reason") not LavalinkManager#deletePlayer() to stop the Player' put it on true */
4119
+ dontThrowError?: boolean;
4120
+ };
4121
+ };
4122
+ /** Player migration configuration */
4123
+ playerMigration?: {
4124
+ /** Maximum number of players migrated concurrently. Default: 5 */
4125
+ concurrency?: number;
4126
+ /** Maximum number of concurrent migrations to a single target node. Default: 2 */
4127
+ perTargetConcurrency?: number;
4128
+ /** Maximum time to wait for migration capacity before retrying. Default: 50ms */
4129
+ backpressureDelayMs?: number;
4130
+ };
4131
+ };
4132
+ }
4133
+ //#endregion
4134
+ //#region src/structures/LavalinkManager.d.ts
4135
+ declare class LavalinkManager<CustomPlayerT extends Player = Player> extends EventEmitter {
4136
+ /**
4137
+ * Emit an event
4138
+ * @param event The event to emit
4139
+ * @param args The arguments to pass to the event
4140
+ * @returns
4141
+ */
4142
+ emit<Event extends keyof LavalinkManagerEvents<CustomPlayerT>>(event: Event, ...args: Parameters<LavalinkManagerEvents<CustomPlayerT>[Event]>): boolean;
4143
+ /**
4144
+ * Add an event listener
4145
+ * @param event The event to listen to
4146
+ * @param listener The listener to add
4147
+ * @returns
4148
+ */
4149
+ on<Event extends keyof LavalinkManagerEvents<CustomPlayerT>>(event: Event, listener: LavalinkManagerEvents<CustomPlayerT>[Event]): this;
4150
+ /**
4151
+ * Add an event listener that only fires once
4152
+ * @param event The event to listen to
4153
+ * @param listener The listener to add
4154
+ * @returns
4155
+ */
4156
+ once<Event extends keyof LavalinkManagerEvents<CustomPlayerT>>(event: Event, listener: LavalinkManagerEvents<CustomPlayerT>[Event]): this;
4157
+ /**
4158
+ * Remove an event listener
4159
+ * @param event The event to remove the listener from
4160
+ * @param listener The listener to remove
4161
+ * @returns
4162
+ */
4163
+ off<Event extends keyof LavalinkManagerEvents<CustomPlayerT>>(event: Event, listener: LavalinkManagerEvents<CustomPlayerT>[Event]): this;
4164
+ /**
4165
+ * Remove an event listener
4166
+ * @param event The event to remove the listener from
4167
+ * @param listener The listener to remove
4168
+ * @returns
4169
+ */
4170
+ removeListener<Event extends keyof LavalinkManagerEvents<CustomPlayerT>>(event: Event, listener: LavalinkManagerEvents<CustomPlayerT>[Event]): this;
4171
+ /** The Options of LavalinkManager (changeable) */
4172
+ options: ManagerOptions<CustomPlayerT>;
4173
+ /** LavalinkManager's NodeManager to manage all Nodes */
4174
+ nodeManager: NodeManager;
4175
+ /** LavalinkManager's Utils Class */
4176
+ utils: ManagerUtils;
4177
+ /** Whether the manager was initiated or not */
4178
+ initiated: boolean;
4179
+ /** All Players stored in a MiniMap */
4180
+ readonly players: MiniMap<string, CustomPlayerT>;
4181
+ /**
4182
+ * Applies the options provided by the User
4183
+ * @param options
4184
+ * @returns
4185
+ */
4186
+ private applyOptions;
4187
+ /**
4188
+ * Validates the current manager's options
4189
+ * @param options
4190
+ */
4191
+ private validateOptions;
4192
+ /**
4193
+ * Emits a debug event to the LavalinkManager
4194
+ * @param name name of the event
4195
+ * @param eventData event data
4196
+ */
4197
+ private _emitDebugEvent;
4198
+ private static readonly _noAudioDebugPrefix;
4199
+ /**
4200
+ * Emits NoAudioDebug and optionally logs to console when debugOptions.noAudio is enabled.
4201
+ */
4202
+ private _debugNoAudio;
4203
+ /**
4204
+ * Create the Lavalink Manager
4205
+ * @param options
4206
+ *
4207
+ * @example
4208
+ * ```ts
4209
+ * //const client = new Client({...}); // create your BOT Client (e.g. via discord.js)
4210
+ * client.lavalink = new LavalinkManager({
4211
+ * nodes: [
4212
+ * {
4213
+ * authorization: "yourverystrongpassword",
4214
+ * host: "localhost",
4215
+ * port: 2333,
4216
+ * id: "testnode"
4217
+ * },
4218
+ * // you can also use the util like this, and it will return a valid node option object. must start with: lavalink:// | nodelink://
4219
+ * // parseLavalinkConnUrl("nodelink://<nodeId>:<nodeAuthorization(Password)>@<NodeHost>:<NodePort>")
4220
+ * sendToShard(guildId, payload) => client.guilds.cache.get(guildId)?.shard?.send(payload),
4221
+ * ],
4222
+ * client: {
4223
+ * id: process.env.CLIENT_ID,
4224
+ * username: "TESTBOT"
4225
+ * },
4226
+ * // optional Options:
4227
+ * autoSkip: true,
4228
+ * playerOptions: {
4229
+ * applyVolumeAsFilter: false,
4230
+ * clientBasedPositionUpdateInterval: 150,
4231
+ * defaultSearchPlatform: "ytmsearch",
4232
+ * allowCustomSources: false,
4233
+ * volumeDecrementer: 0.75,
4234
+ * //requesterTransformer: YourRequesterTransformerFunction,
4235
+ * onDisconnect: {
4236
+ * autoReconnect: true,
4237
+ * destroyPlayer: false
4238
+ * },
4239
+ * onEmptyQueue: {
4240
+ * destroyAfterMs: 30_000,
4241
+ * //autoPlayFunction: YourAutoplayFunction,
4242
+ * },
4243
+ * useUnresolvedData: true
4244
+ * },
4245
+ * queueOptions: {
4246
+ * maxPreviousTracks: 25,
4247
+ * //queueStore: yourCustomQueueStoreManagerClass,
4248
+ * //queueChangesWatcher: yourCustomQueueChangesWatcherClass
4249
+ * },
4250
+ * linksBlacklist: [],
4251
+ * linksWhitelist: [],
4252
+ * advancedOptions: {
4253
+ * maxFilterFixDuration: 600_000,
4254
+ * debugOptions: {
4255
+ * noAudio: false,
4256
+ * playerDestroy: {
4257
+ * dontThrowError: false,
4258
+ * debugLogs: false
4259
+ * }
4260
+ * }
4261
+ * }
4262
+ * })
4263
+ * ```
4264
+ */
4265
+ constructor(options: ManagerOptions<CustomPlayerT>);
4266
+ /**
4267
+ * Get a Player from Lava
4268
+ * @param guildId The guildId of the player
4269
+ *
4270
+ * @example
4271
+ * ```ts
4272
+ * const player = client.lavalink.getPlayer(interaction.guildId);
4273
+ * ```
4274
+ * A quicker and easier way than doing:
4275
+ * ```ts
4276
+ * const player = client.lavalink.players.get(interaction.guildId);
4277
+ * ```
4278
+ * @returns
4279
+ */
4280
+ getPlayer(guildId: string): CustomPlayerT | undefined;
4281
+ /**
4282
+ * Create a Music-Player. If a player exists, then it returns it before creating a new one
4283
+ * @param options
4284
+ * @returns
4285
+ *
4286
+ * @example
4287
+ * ```ts
4288
+ * const player = client.lavalink.createPlayer({
4289
+ * guildId: interaction.guildId,
4290
+ * voiceChannelId: interaction.member.voice.channelId,
4291
+ * // everything below is optional
4292
+ * textChannelId: interaction.channelId,
4293
+ * volume: 100,
4294
+ * selfDeaf: true,
4295
+ * selfMute: false,
4296
+ * instaUpdateFiltersFix: true,
4297
+ * applyVolumeAsFilter: false
4298
+ * //only needed if you want to autopick node by region (configured by you)
4299
+ * // vcRegion: interaction.member.voice.rtcRegion,
4300
+ * // provide a specific node
4301
+ * // node: client.lavalink.nodeManager.leastUsedNodes("memory")[0]
4302
+ * });
4303
+ * ```
4304
+ */
4305
+ createPlayer(options: PlayerOptions): CustomPlayerT;
4306
+ /**
4307
+ * Destroy a player with optional destroy reason and disconnect it from the voice channel
4308
+ * @param guildId
4309
+ * @param destroyReason
4310
+ * @returns
4311
+ *
4312
+ * @example
4313
+ * ```ts
4314
+ * client.lavalink.destroyPlayer(interaction.guildId, "forcefully destroyed the player");
4315
+ * // recommend to do it on the player tho: player.destroy("forcefully destroyed the player");
4316
+ * ```
4317
+ */
4318
+ destroyPlayer(guildId: string, destroyReason?: string): Promise<void | CustomPlayerT>;
4319
+ /**
4320
+ * Delete's a player from the cache without destroying it on lavalink (only works when it's disconnected)
4321
+ * @param guildId
4322
+ * @returns
4323
+ *
4324
+ * @example
4325
+ * ```ts
4326
+ * client.lavalink.deletePlayer(interaction.guildId);
4327
+ * // shouldn't be used except you know what you are doing.
4328
+ * ```
4329
+ */
4330
+ deletePlayer(guildId: string): boolean | void;
4331
+ /**
4332
+ * Checks whether the the lib is useable based on if any node is connected
4333
+ *
4334
+ * @example
4335
+ * ```ts
4336
+ * if(!client.lavalink.useable) return console.error("can'T search yet, because there is no useable lavalink node.")
4337
+ * // continue with code e.g. createing a player and searching
4338
+ * ```
4339
+ */
4340
+ get useable(): boolean;
4341
+ /**
4342
+ * Initiates the Manager, creates all nodes and connects all of them
4343
+ * @param clientData
4344
+ *
4345
+ * @example
4346
+ * ```ts
4347
+ * // on the bot ready event
4348
+ * client.on("ready", () => {
4349
+ * client.lavalink.init({
4350
+ * id: client.user.id,
4351
+ * username: client.user.username
4352
+ * });
4353
+ * });
4354
+ * ```
4355
+ */
4356
+ init(clientData: BotClientOptions): Promise<this>;
4357
+ /**
4358
+ * Sends voice data to the Lavalink server.
4359
+ * ! Without this the library won't work
4360
+ * @param data
4361
+ *
4362
+ * @example
4363
+ *
4364
+ * ```ts
4365
+ * // on the bot "raw" event
4366
+ * client.on("raw", (d) => {
4367
+ * // required in order to send audio updates and register channel deletion etc.
4368
+ * client.lavalink.sendRawData(d)
4369
+ * })
4370
+ * ```
4371
+ */
4372
+ sendRawData(data: VoicePacket | VoiceServer | VoiceState | ChannelDeletePacket): Promise<void>;
4373
+ }
4374
+ //#endregion
4375
+ //#region src/structures/LavalinkManagerStatics.d.ts
4376
+ /** Default Sources Record, to allow source parsing with multiple inputs. */
4377
+ declare const DefaultSources: Record<SearchPlatform, LavalinkSearchPlatform | ClientCustomSearchPlatformUtils>;
4378
+ /** Lavalink Plugins definiton */
4379
+ declare const LavalinkPlugins: {
4380
+ DuncteBot_Plugin: string;
4381
+ LavaSrc: string;
4382
+ GoogleCloudTTS: string;
4383
+ LavaSearch: string;
4384
+ Jiosaavn_Plugin: string;
4385
+ LavalinkFilterPlugin: string;
4386
+ JavaTimedLyricsPlugin: string;
4387
+ PulseLinkPlugin: string;
4388
+ };
4389
+ /** Lavalink Sources regexes for url validations */
4390
+ declare const SourceLinksRegexes: Record<SourcesRegex, RegExp>;
4391
+ //#endregion
4392
+ export { AudioOutputs, Awaitable, Base64, BaseNodeStats, BasePlayOptions, BotClientOptions, CPUStats, ChannelDeletePacket, ChannelMixFilter, ClientCustomSearchPlatformUtils, ClientSearchPlatform, DebugEvents, DeepRequired, DefaultQueueStore, DefaultSources, DestroyReasons, DestroyReasonsType, DisconnectReasons, DisconnectReasonsType, DistortionFilter, DuncteSearchPlatform, EQBand, EQList, Exception, FailingAddress, FilterData, FilterManager, FloatNumber, FrameStats, GitObject, GuildShardPayload, IntegerNumber, InvalidLavalinkRestRequest, JioSaavnSearchPlatform, KaraokeFilter, LavaSearchFilteredResponse, LavaSearchQuery, LavaSearchResponse, LavaSearchType, LavaSrcSearchPlatform, LavaSrcSearchPlatformBase, LavalinkClientSearchPlatform, LavalinkClientSearchPlatformResolve, LavalinkFilterData, LavalinkInfo, LavalinkManager, LavalinkManagerEvents, LavalinkNode, LavalinkNodeIdentifier, LavalinkNodeOptions, LavalinkPlayOptions, LavalinkPlayer, LavalinkPlayerVoice, LavalinkPlayerVoiceOptions, LavalinkPlugin_JioSaavn_SourceNames, LavalinkPlugin_LavaSrc_SourceNames, LavalinkPlugins, LavalinkSearchPlatform, LavalinkSourceNames, LavalinkTrack, LavalinkTrackInfo, LoadTypes, LowPassFilter, LyricsEvent, LyricsEventType, LyricsFoundEvent, LyricsLine, LyricsLineEvent, LyricsNotFoundEvent, LyricsResult, ManagerOptions, ManagerPlayerOptions, ManagerQueueOptions, ManagerUtils, MemoryStats, MiniMap, MiniMapConstructor, ModifyRequest, NodeLinkConnectionMetrics, NodeLinkDefaultSources, NodeLinkExclusiveEvents, NodeLinkNode, NodeLinkRecommendationPlatform, NodeLinkSearchPlatform, NodeLinkSearchPlatformBase, NodeLink_ChorusFilter, NodeLink_CompressorFilter, NodeLink_EchoFilter, NodeLink_HighPassFilter, NodeLink_PhaserFilter, NodeLink_SpatialFilter, NodeManager, NodeManagerEvents, NodeMessage, NodeStats, NodeSymbol, NodeType, Opaque, PlayOptions, Player, PlayerEvent, PlayerEventType, PlayerEvents, PlayerFilters, PlayerJson, PlayerOptions, PlayerUpdateInfo, PlaylistInfo, PluginInfo, PluginObject, PulseLinkSearchPlatform, Queue, QueueChangesWatcher, QueueSaver, QueueStoreManager, QueueSymbol, RecommendationsStrings, ReconnectionState, RepeatMode, RequiredManagerOptions, RotationFilter, RoutePlanner, RoutePlannerTypes, SearchPlatform, SearchQuery, SearchResult, Session, Severity, SourceLinksRegexes, SourceNames, SourcesRegex, SponsorBlockChapterStarted, SponsorBlockChaptersLoaded, SponsorBlockSegment, SponsorBlockSegmentEventType, SponsorBlockSegmentEvents, SponsorBlockSegmentSkipped, SponsorBlockSegmentsLoaded, State, StoredQueue, TimescaleFilter, Track, TrackEndEvent, TrackEndReason, TrackExceptionEvent, TrackInfo, TrackRequester, TrackStartEvent, TrackStuckEvent, TrackSymbol, TremoloFilter, UnresolvedQuery, UnresolvedSearchResult, UnresolvedTrack, UnresolvedTrackInfo, UnresolvedTrackSymbol, VersionObject, VibratoFilter, VoicePacket, VoiceServer, VoiceState, WebSocketClosedEvent, anyObject, audioOutputsData, parseLavalinkConnUrl, queueTrackEnd, safeStringify, validSponsorBlocks };