aqualink 2.0.2 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/index.d.ts CHANGED
@@ -1,352 +1,1324 @@
1
1
  declare module "aqualink" {
2
2
  import { EventEmitter } from "events";
3
3
 
4
+ /**
5
+ * Main Aqua client for managing audio nodes and players
6
+ * @extends EventEmitter
7
+ */
4
8
  export class Aqua extends EventEmitter {
5
- constructor(client: any, nodes: Array<NodeConfig>, options?: AquaOptions);
9
+ /**
10
+ * Creates a new Aqua instance
11
+ * @param client The Discord client instance
12
+ * @param nodes Array of node configurations
13
+ * @param options Optional Aqua configuration
14
+ */
15
+ constructor(client: any, nodes: NodeConfig[], options?: AquaOptions);
16
+
17
+ /**
18
+ * Initializes the Aqua instance with the client ID
19
+ * @param clientId The Discord client ID
20
+ * @returns This Aqua instance
21
+ */
6
22
  init(clientId: string): this;
23
+
24
+ /**
25
+ * Creates a new Node instance
26
+ * @param options Node configuration
27
+ * @returns The created Node
28
+ */
7
29
  createNode(options: NodeConfig): Node;
30
+
31
+ /**
32
+ * Creates a new Player instance
33
+ * @param node Node to create the player on
34
+ * @param options Player configuration
35
+ * @returns The created Player
36
+ */
8
37
  createPlayer(node: Node, options: PlayerOptions): Player;
38
+
39
+ /**
40
+ * Destroys a player by guild ID
41
+ * @param guildId The guild ID
42
+ */
9
43
  destroyPlayer(guildId: string): Promise<void>;
44
+
45
+ /**
46
+ * Resolves a track query
47
+ * @param options Track resolve options
48
+ * @returns Track resolution response
49
+ */
10
50
  resolve(options: ResolveOptions): Promise<ResolveResponse>;
51
+
52
+ /**
53
+ * Updates voice state based on Discord voice state update
54
+ * @param data Voice state update data
55
+ */
11
56
  updateVoiceState(data: VoiceStateUpdate): void;
57
+
58
+ /**
59
+ * Gets an option with a default fallback
60
+ * @param options Options object
61
+ * @param key Key to retrieve
62
+ * @param defaultValue Default value if key doesn't exist
63
+ * @returns The option value or default
64
+ */
12
65
  getOption<T>(options: Record<string, any>, key: string, defaultValue: T): T;
66
+
67
+ /**
68
+ * Default function for sending voice updates to Discord
69
+ * @param payload Voice payload
70
+ */
13
71
  defaultSendFunction(payload: any): void;
14
- validateInputs(client: any, nodes: Array<NodeConfig>): void;
72
+
73
+ /**
74
+ * Validates client and nodes input
75
+ * @param client Discord client
76
+ * @param nodes Array of node configurations
77
+ */
78
+ validateInputs(client: any, nodes: NodeConfig[]): void;
79
+
80
+ /**
81
+ * Gets nodes sorted by least load
82
+ */
15
83
  get leastUsedNodes(): Node[];
84
+
85
+ /**
86
+ * Fetches nodes by region
87
+ * @param region Region to filter by
88
+ * @returns Nodes in the specified region
89
+ */
16
90
  fetchRegion(region: string): Node[];
91
+
92
+ /**
93
+ * Calculates load on a node
94
+ * @param node Node to calculate load for
95
+ * @returns Load metric
96
+ */
17
97
  calculateLoad(node: Node): number;
98
+
99
+ /**
100
+ * Creates a player connection
101
+ * @param options Player options
102
+ * @returns The created Player
103
+ */
18
104
  createConnection(options: PlayerOptions): Player;
105
+
106
+ /**
107
+ * Gets a node for making requests
108
+ * @param nodes Optional node specification
109
+ * @returns Selected node
110
+ */
19
111
  getRequestNode(nodes?: string | Node): Node;
112
+
113
+ /**
114
+ * Ensures the Aqua instance is initialized
115
+ * @throws If not initialized
116
+ */
20
117
  ensureInitialized(): void;
118
+
119
+ /**
120
+ * Formats a query for a specific source
121
+ * @param query Search query
122
+ * @param source Source platform
123
+ * @returns Formatted query string
124
+ */
21
125
  formatQuery(query: string, source: string): string;
126
+
127
+ /**
128
+ * Handles when no matches are found for a query
129
+ * @param rest Rest instance
130
+ * @param query Search query
131
+ * @returns Resolve response
132
+ */
22
133
  handleNoMatches(rest: Rest, query: string): Promise<ResolveResponse>;
134
+
135
+ /**
136
+ * Constructs a response for track resolution
137
+ * @param response Raw response
138
+ * @param requester Requester
139
+ * @param requestNode Node used for the request
140
+ * @returns Formatted resolve response
141
+ */
23
142
  constructorResponse(response: any, requester: any, requestNode: Node): ResolveResponse;
24
- get(guildId: string): Player;
143
+
144
+ /**
145
+ * Gets a player by guild ID
146
+ * @param guildId Guild ID
147
+ * @returns Player instance or undefined
148
+ */
149
+ get(guildId: string): Player | undefined;
150
+
151
+ /**
152
+ * Cleans up a player
153
+ * @param player Player to clean up
154
+ */
25
155
  cleanupPlayer(player: Player): void;
26
156
 
157
+ /** Discord client instance */
27
158
  client: any;
28
- nodes: Array<NodeConfig>;
159
+
160
+ /** Array of node configurations */
161
+ nodes: NodeConfig[];
162
+
163
+ /** Map of node names to Node instances */
29
164
  nodeMap: Map<string, Node>;
165
+
166
+ /** Map of guild IDs to Player instances */
30
167
  players: Map<string, Player>;
168
+
169
+ /** Discord client ID */
31
170
  clientId: string | null;
171
+
172
+ /** Whether the client has been initialized */
32
173
  initiated: boolean;
174
+
175
+ /** Aqua options */
33
176
  options: AquaOptions;
177
+
178
+ /** Whether to delete nowplaying messages */
34
179
  shouldDeleteMessage: boolean;
180
+
181
+ /** Default platform for searching */
35
182
  defaultSearchPlatform: string;
183
+
184
+ /** Whether to leave voice channel when queue ends */
36
185
  leaveOnEnd: boolean;
186
+
187
+ /** REST API version to use */
37
188
  restVersion: string;
38
- plugins: Array<Plugin>;
189
+
190
+ /** Loaded plugins */
191
+ plugins: Plugin[];
192
+
193
+ /** Aqualink version */
39
194
  version: string;
195
+
196
+ /** Function for sending voice updates to Discord */
40
197
  send: (payload: any) => void;
198
+
199
+ /** Whether to auto-resume sessions */
41
200
  autoResume: boolean;
201
+
202
+ /** Whether to reconnect indefinitely */
42
203
  infiniteReconnects: boolean;
204
+
205
+ /** Cache for least used nodes */
43
206
  _leastUsedCache: { nodes: Node[], timestamp: number };
44
207
  }
45
208
 
209
+ /**
210
+ * Aqua client configuration options
211
+ */
46
212
  export interface AquaOptions {
213
+ /** Function for sending voice updates to Discord */
47
214
  send?: (payload: any) => void;
215
+
216
+ /** Default platform for searching */
48
217
  defaultSearchPlatform?: string;
218
+
219
+ /** REST API version to use */
49
220
  restVersion?: string;
50
- plugins?: Array<Plugin>;
221
+
222
+ /** Plugins to load */
223
+ plugins?: Plugin[];
224
+
225
+ /** Whether to auto-resume sessions */
51
226
  autoResume?: boolean;
227
+
228
+ /** Whether to reconnect indefinitely */
52
229
  infiniteReconnects?: boolean;
230
+
231
+ /** Whether to delete nowplaying messages */
53
232
  shouldDeleteMessage?: boolean;
233
+
234
+ /** Whether to leave voice channel when queue ends */
54
235
  leaveOnEnd?: boolean;
55
236
  }
56
237
 
238
+ /**
239
+ * Configuration for a Lavalink node
240
+ */
57
241
  export interface NodeConfig {
242
+ /** Node name for identification */
58
243
  name?: string;
244
+
245
+ /** Node hostname */
59
246
  host: string;
247
+
248
+ /** Node port */
60
249
  port: number;
250
+
251
+ /** Node password */
61
252
  password: string;
253
+
254
+ /** Whether to use secure connection */
62
255
  secure?: boolean;
256
+
257
+ /** Session ID for resuming */
63
258
  sessionId?: string;
259
+
260
+ /** Regions this node handles */
64
261
  regions?: string[];
65
262
  }
66
263
 
264
+ /**
265
+ * Configuration for a player
266
+ */
67
267
  export interface PlayerOptions {
268
+ /** Guild ID */
68
269
  guildId: string;
270
+
271
+ /** Text channel ID */
69
272
  textChannel?: string;
273
+
274
+ /** Voice channel ID */
70
275
  voiceChannel?: string;
276
+
277
+ /** Default volume (0-1000) */
71
278
  defaultVolume?: number;
279
+
280
+ /** Loop mode */
72
281
  loop?: string;
282
+
283
+ /** Whether to delete nowplaying messages */
73
284
  shouldDeleteMessage?: boolean;
285
+
286
+ /** Whether to leave voice channel when queue ends */
74
287
  leaveOnEnd?: boolean;
288
+
289
+ /** Voice region */
75
290
  region?: string;
76
291
  }
77
292
 
293
+ /**
294
+ * Options for resolving a track
295
+ */
78
296
  export interface ResolveOptions {
297
+ /** Search query */
79
298
  query: string;
299
+
300
+ /** Source platform */
80
301
  source?: string;
302
+
303
+ /** Requester data */
81
304
  requester?: any;
305
+
306
+ /** Specific node(s) to use */
82
307
  nodes?: string | Node;
83
308
  }
84
309
 
310
+ /**
311
+ * Response from a track resolution
312
+ */
85
313
  export interface ResolveResponse {
314
+ /** Type of load (TRACK_LOADED, SEARCH_RESULT, etc.) */
86
315
  loadType: string;
316
+
317
+ /** Exception details if any */
87
318
  exception: any;
319
+
320
+ /** Playlist information if result is a playlist */
88
321
  playlistInfo: any;
322
+
323
+ /** Plugin-specific information */
89
324
  pluginInfo: any;
325
+
326
+ /** Resolved tracks */
90
327
  tracks: Track[];
91
328
  }
92
329
 
330
+ /**
331
+ * Discord voice state update data
332
+ */
93
333
  export interface VoiceStateUpdate {
334
+ /** Update data */
94
335
  d: any;
336
+
337
+ /** Update type */
95
338
  t: string;
96
339
  }
97
340
 
341
+ /**
342
+ * Manages voice connection for a player
343
+ */
98
344
  export class Connection {
345
+ /**
346
+ * Creates a new Connection
347
+ * @param player Player instance
348
+ */
99
349
  constructor(player: Player);
350
+
351
+ /**
352
+ * Sets server update data
353
+ * @param data Server update data
354
+ */
100
355
  setServerUpdate(data: { endpoint: string, token: string }): void;
356
+
357
+ /**
358
+ * Sets state update data
359
+ * @param data State update data
360
+ */
101
361
  setStateUpdate(data: { channel_id: string, session_id: string, self_deaf: boolean, self_mute: boolean }): void;
362
+
363
+ /**
364
+ * Updates player voice data
365
+ */
102
366
  _updatePlayerVoiceData(): Promise<void>;
103
367
 
368
+ /** Weak reference to player */
104
369
  playerRef: WeakRef<Player>;
370
+
371
+ /** Voice connection data */
105
372
  voice: { sessionId: string | null, endpoint: string | null, token: string | null };
373
+
374
+ /** Voice region */
106
375
  region: string | null;
376
+
377
+ /** Whether the bot is self-deafened */
107
378
  selfDeaf: boolean;
379
+
380
+ /** Whether the bot is self-muted */
108
381
  selfMute: boolean;
382
+
383
+ /** Voice channel ID */
109
384
  voiceChannel: string;
385
+
386
+ /** Guild ID */
110
387
  guildId: string;
388
+
389
+ /** Aqua instance */
111
390
  aqua: Aqua;
391
+
392
+ /** Available nodes */
112
393
  nodes: any;
113
394
  }
114
395
 
396
+ /**
397
+ * Manages audio filters for a player
398
+ */
115
399
  export class Filters {
400
+ /**
401
+ * Creates a new Filters instance
402
+ * @param player Player instance
403
+ * @param options Filter options
404
+ */
116
405
  constructor(player: Player, options?: FiltersOptions);
406
+
407
+ /**
408
+ * Sets equalizer bands
409
+ * @param bands Array of frequency bands
410
+ */
117
411
  setEqualizer(bands: Array<any>): Promise<void>;
412
+
413
+ /**
414
+ * Toggles karaoke filter
415
+ * @param enabled Whether to enable the filter
416
+ * @param options Filter options
417
+ */
118
418
  setKaraoke(enabled: boolean, options?: FiltersOptions): Promise<void>;
419
+
420
+ /**
421
+ * Toggles timescale filter
422
+ * @param enabled Whether to enable the filter
423
+ * @param options Filter options
424
+ */
119
425
  setTimescale(enabled: boolean, options?: FiltersOptions): Promise<void>;
426
+
427
+ /**
428
+ * Toggles tremolo filter
429
+ * @param enabled Whether to enable the filter
430
+ * @param options Filter options
431
+ */
120
432
  setTremolo(enabled: boolean, options?: FiltersOptions): Promise<void>;
433
+
434
+ /**
435
+ * Toggles vibrato filter
436
+ * @param enabled Whether to enable the filter
437
+ * @param options Filter options
438
+ */
121
439
  setVibrato(enabled: boolean, options?: FiltersOptions): Promise<void>;
440
+
441
+ /**
442
+ * Toggles rotation filter
443
+ * @param enabled Whether to enable the filter
444
+ * @param options Filter options
445
+ */
122
446
  setRotation(enabled: boolean, options?: FiltersOptions): Promise<void>;
447
+
448
+ /**
449
+ * Toggles distortion filter
450
+ * @param enabled Whether to enable the filter
451
+ * @param options Filter options
452
+ */
123
453
  setDistortion(enabled: boolean, options?: FiltersOptions): Promise<void>;
454
+
455
+ /**
456
+ * Toggles channel mix filter
457
+ * @param enabled Whether to enable the filter
458
+ * @param options Filter options
459
+ */
124
460
  setChannelMix(enabled: boolean, options?: FiltersOptions): Promise<void>;
461
+
462
+ /**
463
+ * Toggles low pass filter
464
+ * @param enabled Whether to enable the filter
465
+ * @param options Filter options
466
+ */
125
467
  setLowPass(enabled: boolean, options?: FiltersOptions): Promise<void>;
468
+
469
+ /**
470
+ * Toggles bass boost filter
471
+ * @param enabled Whether to enable the filter
472
+ * @param options Filter options
473
+ */
126
474
  setBassboost(enabled: boolean, options?: FiltersOptions): Promise<void>;
475
+
476
+ /**
477
+ * Toggles slow mode filter
478
+ * @param enabled Whether to enable the filter
479
+ * @param options Filter options
480
+ */
127
481
  setSlowmode(enabled: boolean, options?: FiltersOptions): Promise<void>;
482
+
483
+ /**
484
+ * Toggles nightcore filter
485
+ * @param enabled Whether to enable the filter
486
+ * @param options Filter options
487
+ */
128
488
  setNightcore(enabled: boolean, options?: FiltersOptions): Promise<void>;
489
+
490
+ /**
491
+ * Toggles vaporwave filter
492
+ * @param enabled Whether to enable the filter
493
+ * @param options Filter options
494
+ */
129
495
  setVaporwave(enabled: boolean, options?: FiltersOptions): Promise<void>;
496
+
497
+ /**
498
+ * Toggles 8D filter
499
+ * @param enabled Whether to enable the filter
500
+ * @param options Filter options
501
+ */
130
502
  set8D(enabled: boolean, options?: FiltersOptions): Promise<void>;
503
+
504
+ /**
505
+ * Clears all active filters
506
+ */
131
507
  clearFilters(): Promise<void>;
508
+
509
+ /**
510
+ * Updates all filters
511
+ */
132
512
  updateFilters(): Promise<void>;
133
513
 
514
+ /** Player instance */
134
515
  player: Player;
516
+
517
+ /** Current volume */
135
518
  volume: number;
519
+
520
+ /** Equalizer bands */
136
521
  equalizer: any[];
522
+
523
+ /** Karaoke filter settings */
137
524
  karaoke: any;
525
+
526
+ /** Timescale filter settings */
138
527
  timescale: any;
528
+
529
+ /** Tremolo filter settings */
139
530
  tremolo: any;
531
+
532
+ /** Vibrato filter settings */
140
533
  vibrato: any;
534
+
535
+ /** Rotation filter settings */
141
536
  rotation: any;
537
+
538
+ /** Distortion filter settings */
142
539
  distortion: any;
540
+
541
+ /** Channel mix filter settings */
143
542
  channelMix: any;
543
+
544
+ /** Low pass filter settings */
144
545
  lowPass: any;
546
+
547
+ /** Bass boost filter settings */
145
548
  bassboost: any;
549
+
550
+ /** Slow mode filter settings */
146
551
  slowmode: any;
552
+
553
+ /** Nightcore filter settings */
147
554
  nightcore: any;
555
+
556
+ /** Vaporwave filter settings */
148
557
  vaporwave: any;
558
+
559
+ /** 8D filter settings */
149
560
  _8d: any;
150
561
  }
151
562
 
563
+ /**
564
+ * Options for audio filters
565
+ */
152
566
  export interface FiltersOptions {
567
+ /** Volume level */
153
568
  volume?: number;
569
+
570
+ /** Equalizer bands */
154
571
  equalizer?: any[];
572
+
573
+ /** Karaoke filter settings */
155
574
  karaoke?: any;
575
+
576
+ /** Timescale filter settings */
156
577
  timescale?: any;
578
+
579
+ /** Tremolo filter settings */
157
580
  tremolo?: any;
581
+
582
+ /** Vibrato filter settings */
158
583
  vibrato?: any;
584
+
585
+ /** Rotation filter settings */
159
586
  rotation?: any;
587
+
588
+ /** Distortion filter settings */
160
589
  distortion?: any;
590
+
591
+ /** Channel mix filter settings */
161
592
  channelMix?: any;
593
+
594
+ /** Low pass filter settings */
162
595
  lowPass?: any;
596
+
597
+ /** Bass boost filter settings */
163
598
  bassboost?: any;
599
+
600
+ /** Slow mode filter settings */
164
601
  slowmode?: any;
602
+
603
+ /** Nightcore filter settings */
165
604
  nightcore?: any;
605
+
606
+ /** Vaporwave filter settings */
166
607
  vaporwave?: any;
608
+
609
+ /** 8D filter settings */
167
610
  _8d?: any;
168
611
  }
169
612
 
613
+ /**
614
+ * Represents a Lavalink node
615
+ */
170
616
  export class Node {
617
+ /**
618
+ * Creates a new Node instance
619
+ * @param aqua Aqua instance
620
+ * @param connOptions Node connection options
621
+ * @param options Node behavior options
622
+ */
171
623
  constructor(aqua: Aqua, connOptions: NodeConfig, options?: NodeOptions);
624
+
625
+ /**
626
+ * Connects to the Lavalink node
627
+ */
172
628
  connect(): Promise<void>;
629
+
630
+ /**
631
+ * Gets node statistics
632
+ */
173
633
  getStats(): Promise<any>;
634
+
635
+ /**
636
+ * Destroys the node connection
637
+ * @param clean Whether to clean up gracefully
638
+ */
174
639
  destroy(clean?: boolean): void;
175
640
 
641
+ /** Aqua instance */
176
642
  aqua: Aqua;
643
+
644
+ /** Node name */
177
645
  name: string;
646
+
647
+ /** Node host */
178
648
  host: string;
649
+
650
+ /** Node port */
179
651
  port: number;
652
+
653
+ /** Node password */
180
654
  password: string;
655
+
656
+ /** Whether to use secure connection */
181
657
  secure: boolean;
658
+
659
+ /** Session ID for resuming */
182
660
  sessionId: string | null;
661
+
662
+ /** Regions this node handles */
183
663
  regions: string[];
664
+
665
+ /** WebSocket URL */
184
666
  wsUrl: URL;
667
+
668
+ /** REST interface */
185
669
  rest: Rest;
670
+
671
+ /** Resume timeout in seconds */
186
672
  resumeTimeout: number;
673
+
674
+ /** Whether to auto-resume */
187
675
  autoResume: boolean;
676
+
677
+ /** Reconnection timeout in ms */
188
678
  reconnectTimeout: number;
679
+
680
+ /** Max reconnection attempts */
189
681
  reconnectTries: number;
682
+
683
+ /** Whether to reconnect indefinitely */
190
684
  infiniteReconnects: boolean;
685
+
686
+ /** Whether connected to the node */
191
687
  connected: boolean;
688
+
689
+ /** Node information */
192
690
  info: any;
691
+
692
+ /** Default statistics */
193
693
  defaultStats: any;
694
+
695
+ /** Current statistics */
194
696
  stats: any;
195
697
  }
196
698
 
699
+ /**
700
+ * Node behavior options
701
+ */
197
702
  export interface NodeOptions {
703
+ /** Resume timeout in seconds */
198
704
  resumeTimeout?: number;
705
+
706
+ /** Whether to auto-resume */
199
707
  autoResume?: boolean;
708
+
709
+ /** Reconnection timeout in ms */
200
710
  reconnectTimeout?: number;
711
+
712
+ /** Max reconnection attempts */
201
713
  reconnectTries?: number;
714
+
715
+ /** Whether to reconnect indefinitely */
202
716
  infiniteReconnects?: boolean;
203
717
  }
204
718
 
719
+ /**
720
+ * Audio player for a guild
721
+ * @extends EventEmitter
722
+ */
205
723
  export class Player extends EventEmitter {
724
+ /**
725
+ * Creates a new Player instance
726
+ * @param aqua Aqua instance
727
+ * @param nodes Available nodes
728
+ * @param options Player options
729
+ */
206
730
  constructor(aqua: Aqua, nodes: any, options?: PlayerOptions);
731
+
732
+ /**
733
+ * Starts playback of the current track
734
+ */
207
735
  play(): Promise<void>;
736
+
737
+ /**
738
+ * Toggles pause state
739
+ * @param paused Whether to pause
740
+ * @returns This player instance
741
+ */
208
742
  pause(paused: boolean): this;
743
+
744
+ /**
745
+ * Skips the current track
746
+ */
209
747
  skip(): Promise<void>;
748
+
749
+ /**
750
+ * Destroys the player
751
+ */
210
752
  destroy(): void;
753
+
754
+ /**
755
+ * Connects to a voice channel
756
+ * @param options Connection options
757
+ * @returns This player instance
758
+ */
211
759
  connect(options: PlayerOptions): this;
760
+
761
+ /**
762
+ * Disconnects from voice channel
763
+ * @returns This player instance
764
+ */
212
765
  disconnect(): this;
766
+
767
+ /**
768
+ * Sets player volume
769
+ * @param volume Volume level (0-1000)
770
+ * @returns This player instance
771
+ */
213
772
  setVolume(volume: number): this;
773
+
774
+ /**
775
+ * Sets loop mode
776
+ * @param mode Loop mode ("none", "track", "queue")
777
+ * @returns This player instance
778
+ */
214
779
  setLoop(mode: string): this;
780
+
781
+ /**
782
+ * Sets text channel
783
+ * @param channel Text channel ID
784
+ * @returns This player instance
785
+ */
215
786
  setTextChannel(channel: string): this;
787
+
788
+ /**
789
+ * Sets voice channel
790
+ * @param channel Voice channel ID
791
+ * @returns This player instance
792
+ */
216
793
  setVoiceChannel(channel: string): this;
794
+
795
+ /**
796
+ * Shuffles the queue
797
+ * @returns This player instance
798
+ */
217
799
  shuffle(): this;
800
+
801
+ /**
802
+ * Replays current track
803
+ * @returns This player instance
804
+ */
218
805
  replay(): this;
806
+
807
+ /**
808
+ * Stops playback
809
+ * @returns This player instance
810
+ */
219
811
  stop(): this;
812
+
813
+ /**
814
+ * Seeks to position
815
+ * @param position Position in milliseconds
816
+ * @returns This player instance
817
+ */
220
818
  seek(position: number): this;
819
+
820
+ /**
821
+ * Searches for lyrics
822
+ * @param query Search query
823
+ * @returns Lyrics search result
824
+ */
221
825
  searchLyrics(query: string): Promise<any>;
826
+
827
+ /**
828
+ * Gets lyrics for current track
829
+ * @returns Lyrics result
830
+ */
222
831
  lyrics(): Promise<any>;
832
+
833
+ /**
834
+ * Adds track to previous tracks
835
+ * @param track Track to add
836
+ */
223
837
  addToPreviousTrack(track: Track): void;
838
+
839
+ /**
840
+ * Updates player state
841
+ * @param data Update data
842
+ */
224
843
  updatePlayer(data: any): Promise<void>;
844
+
845
+ /**
846
+ * Cleans up player resources
847
+ */
225
848
  cleanup(): Promise<void>;
849
+
850
+ /**
851
+ * Updates track state
852
+ * @param playing Whether playing
853
+ * @param paused Whether paused
854
+ */
226
855
  updateTrackState(playing: boolean, paused: boolean): void;
856
+
857
+ /**
858
+ * Handles an event from node
859
+ * @param payload Event payload
860
+ */
227
861
  handleEvent(payload: any): Promise<void>;
862
+
863
+ /**
864
+ * Handles unknown event
865
+ * @param payload Event payload
866
+ */
228
867
  handleUnknownEvent(payload: any): void;
868
+
869
+ /**
870
+ * Handles track start event
871
+ * @param player Player instance
872
+ * @param track Current track
873
+ */
229
874
  trackStart(player: Player, track: Track): Promise<void>;
875
+
876
+ /**
877
+ * Handles track end event
878
+ * @param player Player instance
879
+ * @param track Ended track
880
+ * @param payload Event payload
881
+ */
230
882
  trackEnd(player: Player, track: Track, payload: any): Promise<void>;
883
+
884
+ /**
885
+ * Handles track error event
886
+ * @param player Player instance
887
+ * @param track Errored track
888
+ * @param payload Event payload
889
+ */
231
890
  trackError(player: Player, track: Track, payload: any): Promise<void>;
891
+
892
+ /**
893
+ * Handles track stuck event
894
+ * @param player Player instance
895
+ * @param track Stuck track
896
+ * @param payload Event payload
897
+ */
232
898
  trackStuck(player: Player, track: Track, payload: any): Promise<void>;
899
+
900
+ /**
901
+ * Handles socket closed event
902
+ * @param player Player instance
903
+ * @param payload Event payload
904
+ */
233
905
  socketClosed(player: Player, payload: any): Promise<void>;
906
+
907
+ /**
908
+ * Sends data to node
909
+ * @param data Data to send
910
+ */
234
911
  send(data: any): void;
235
912
 
913
+ /** Available loop modes */
236
914
  static LOOP_MODES: { NONE: string, TRACK: string, QUEUE: string };
915
+
916
+ /** Event handler mapping */
237
917
  static EVENT_HANDLERS: { [key: string]: string };
918
+
919
+ /** Valid loop modes */
238
920
  static validModes: Set<string>;
239
921
 
922
+ /** Aqua instance */
240
923
  aqua: Aqua;
924
+
925
+ /** Available nodes */
241
926
  nodes: any;
927
+
928
+ /** Guild ID */
242
929
  guildId: string;
930
+
931
+ /** Text channel ID */
243
932
  textChannel: string;
933
+
934
+ /** Voice channel ID */
244
935
  voiceChannel: string;
936
+
937
+ /** Voice connection */
245
938
  connection: Connection;
939
+
940
+ /** Audio filters */
246
941
  filters: Filters;
942
+
943
+ /** Volume level */
247
944
  volume: number;
945
+
946
+ /** Loop mode */
248
947
  loop: string;
948
+
949
+ /** Track queue */
249
950
  queue: Queue;
951
+
952
+ /** Previously played tracks */
250
953
  previousTracks: Track[];
954
+
955
+ /** Whether to delete nowplaying messages */
251
956
  shouldDeleteMessage: boolean;
957
+
958
+ /** Whether to leave on queue end */
252
959
  leaveOnEnd: boolean;
960
+
961
+ /** Whether currently playing */
253
962
  playing: boolean;
963
+
964
+ /** Whether currently paused */
254
965
  paused: boolean;
966
+
967
+ /** Whether connected to voice */
255
968
  connected: boolean;
969
+
970
+ /** Current track */
256
971
  current: Track | null;
972
+
973
+ /** Timestamp of last update */
257
974
  timestamp: number;
975
+
976
+ /** Connection ping */
258
977
  ping: number;
978
+
979
+ /** Now playing message */
259
980
  nowPlayingMessage: any;
981
+
982
+ /** Player update handler */
260
983
  onPlayerUpdate: (state: any) => void;
261
984
  }
262
985
 
986
+ /**
987
+ * Plugin for extending Aqua functionality
988
+ */
263
989
  export class Plugin {
990
+ /**
991
+ * Creates a new Plugin
992
+ * @param name Plugin name
993
+ */
264
994
  constructor(name: string);
995
+
996
+ /**
997
+ * Loads the plugin
998
+ * @param aqua Aqua instance
999
+ */
265
1000
  load(aqua: Aqua): void;
1001
+
1002
+ /**
1003
+ * Unloads the plugin
1004
+ * @param aqua Aqua instance
1005
+ */
266
1006
  unload(aqua: Aqua): void;
267
1007
 
1008
+ /** Plugin name */
268
1009
  name: string;
269
1010
  }
270
1011
 
1012
+ /**
1013
+ * Track queue implementation
1014
+ * @extends Array
1015
+ */
271
1016
  export class Queue extends Array<any> {
1017
+ /**
1018
+ * Creates a new Queue
1019
+ * @param elements Initial elements
1020
+ */
272
1021
  constructor(...elements: any[]);
1022
+
1023
+ /** Number of items in queue */
273
1024
  size: number;
1025
+
1026
+ /** First item in queue */
274
1027
  first: any;
1028
+
1029
+ /** Last item in queue */
275
1030
  last: any;
1031
+
1032
+ /**
1033
+ * Adds a track to the queue
1034
+ * @param track Track to add
1035
+ * @returns This queue instance
1036
+ */
276
1037
  add(track: any): this;
1038
+
1039
+ /**
1040
+ * Removes a track from the queue
1041
+ * @param track Track to remove
1042
+ */
277
1043
  remove(track: any): void;
1044
+
1045
+ /**
1046
+ * Clears the queue
1047
+ */
278
1048
  clear(): void;
1049
+
1050
+ /**
1051
+ * Shuffles the queue
1052
+ */
279
1053
  shuffle(): void;
1054
+
1055
+ /**
1056
+ * Gets the first item without removing
1057
+ * @returns First item
1058
+ */
280
1059
  peek(): any;
1060
+
1061
+ /**
1062
+ * Converts queue to array
1063
+ * @returns Array of items
1064
+ */
281
1065
  toArray(): any[];
1066
+
1067
+ /**
1068
+ * Gets item at index
1069
+ * @param index Index
1070
+ * @returns Item at index
1071
+ */
282
1072
  at(index: number): any;
1073
+
1074
+ /**
1075
+ * Removes and returns first item
1076
+ * @returns First item
1077
+ */
283
1078
  dequeue(): any;
1079
+
1080
+ /**
1081
+ * Checks if queue is empty
1082
+ * @returns Whether empty
1083
+ */
284
1084
  isEmpty(): boolean;
1085
+
1086
+ /**
1087
+ * Adds item to end of queue
1088
+ * @param track Item to add
1089
+ * @returns This queue instance
1090
+ */
285
1091
  enqueue(track: any): this;
286
1092
  }
287
1093
 
1094
+ /**
1095
+ * REST API wrapper for Lavalink
1096
+ */
288
1097
  export class Rest {
1098
+ /**
1099
+ * Creates a new Rest instance
1100
+ * @param aqua Aqua instance
1101
+ * @param options REST options
1102
+ */
289
1103
  constructor(aqua: Aqua, options: RestOptions);
1104
+
1105
+ /**
1106
+ * Makes an HTTP request
1107
+ * @param method HTTP method
1108
+ * @param endpoint API endpoint
1109
+ * @param body Request body
1110
+ * @returns Response data
1111
+ */
290
1112
  makeRequest(method: string, endpoint: string, body?: any): Promise<any>;
1113
+
1114
+ /**
1115
+ * Gets all players on the node
1116
+ */
291
1117
  getPlayers(): Promise<any>;
1118
+
1119
+ /**
1120
+ * Destroys a player on the node
1121
+ * @param guildId Guild ID
1122
+ */
292
1123
  destroyPlayer(guildId: string): Promise<void>;
1124
+
1125
+ /**
1126
+ * Gets tracks by identifier
1127
+ * @param identifier Track identifier
1128
+ */
293
1129
  getTracks(identifier: string): Promise<any>;
1130
+
1131
+ /**
1132
+ * Decodes a track
1133
+ * @param track Encoded track
1134
+ */
294
1135
  decodeTrack(track: string): Promise<any>;
1136
+
1137
+ /**
1138
+ * Decodes multiple tracks
1139
+ * @param tracks Encoded tracks
1140
+ */
295
1141
  decodeTracks(tracks: any[]): Promise<any>;
1142
+
1143
+ /**
1144
+ * Gets node statistics
1145
+ */
296
1146
  getStats(): Promise<any>;
1147
+
1148
+ /**
1149
+ * Gets node information
1150
+ */
297
1151
  getInfo(): Promise<any>;
1152
+
1153
+ /**
1154
+ * Gets route planner status
1155
+ */
298
1156
  getRoutePlannerStatus(): Promise<any>;
1157
+
1158
+ /**
1159
+ * Gets route planner address
1160
+ * @param address IP address
1161
+ */
299
1162
  getRoutePlannerAddress(address: string): Promise<any>;
1163
+
1164
+ /**
1165
+ * Gets lyrics for a track
1166
+ * @param options Lyrics options
1167
+ */
300
1168
  getLyrics(options: { track: any }): Promise<any>;
1169
+
1170
+ /**
1171
+ * Sets the session ID
1172
+ * @param sessionId Session ID
1173
+ */
301
1174
  setSessionId(sessionId: string): void;
1175
+
1176
+ /**
1177
+ * Builds an API endpoint path
1178
+ * @param segments Path segments
1179
+ */
302
1180
  buildEndpoint(...segments: string[]): string;
1181
+
1182
+ /**
1183
+ * Validates session ID exists
1184
+ * @throws If no session ID
1185
+ */
303
1186
  validateSessionId(): void;
1187
+
1188
+ /**
1189
+ * Updates player state
1190
+ * @param options Update options
1191
+ */
304
1192
  updatePlayer(options: { guildId: string, data: any }): Promise<void>;
305
1193
 
1194
+ /** Aqua instance */
306
1195
  aqua: Aqua;
1196
+
1197
+ /** Session ID */
307
1198
  sessionId: string;
1199
+
1200
+ /** API version */
308
1201
  version: string;
1202
+
1203
+ /** Base URL */
309
1204
  baseUrl: string;
1205
+
1206
+ /** Request headers */
310
1207
  headers: Record<string, string>;
1208
+
1209
+ /** HTTP client */
311
1210
  client: any;
312
1211
  }
313
1212
 
1213
+ /**
1214
+ * REST API options
1215
+ */
314
1216
  export interface RestOptions {
1217
+ /** Whether to use HTTPS */
315
1218
  secure: boolean;
1219
+
1220
+ /** Host address */
316
1221
  host: string;
1222
+
1223
+ /** Port number */
317
1224
  port: number;
1225
+
1226
+ /** Session ID */
318
1227
  sessionId: string;
1228
+
1229
+ /** Authentication password */
319
1230
  password: string;
320
1231
  }
321
1232
 
1233
+ /**
1234
+ * Represents an audio track
1235
+ */
322
1236
  export class Track {
1237
+ /**
1238
+ * Creates a new Track
1239
+ * @param data Track data
1240
+ * @param requester Requester
1241
+ * @param nodes Node
1242
+ */
323
1243
  constructor(data: TrackData, requester: Player, nodes: Node);
1244
+
1245
+ /**
1246
+ * Resolves a track
1247
+ * @param aqua Aqua instance
1248
+ * @returns Resolved track or null
1249
+ */
324
1250
  resolve(aqua: Aqua): Promise<Track | null>;
1251
+
1252
+ /**
1253
+ * Resolves track thumbnail
1254
+ * @param thumbnail Thumbnail URL
1255
+ * @returns Processed thumbnail URL or null
1256
+ */
325
1257
  resolveThumbnail(thumbnail: string): string | null;
1258
+
1259
+ /**
1260
+ * Finds matching track in collection
1261
+ * @param tracks Tracks to search
1262
+ * @returns Matching track or null
1263
+ */
326
1264
  _findMatchingTrack(tracks: Track[]): Track | null;
327
1265
 
1266
+ /** Track information */
328
1267
  info: TrackInfo;
1268
+
1269
+ /** Encoded track string */
329
1270
  track: string | null;
1271
+
1272
+ /** Playlist information if part of playlist */
330
1273
  playlist: any;
1274
+
1275
+ /** Track requester */
331
1276
  requester: Player;
1277
+
1278
+ /** Node for this track */
332
1279
  nodes: Node;
333
1280
  }
334
1281
 
1282
+ /**
1283
+ * Track data structure
1284
+ */
335
1285
  export interface TrackData {
1286
+ /** Track information */
336
1287
  info?: TrackInfo;
1288
+
1289
+ /** Encoded track string */
337
1290
  encoded?: string;
1291
+
1292
+ /** Playlist information */
338
1293
  playlist?: any;
339
1294
  }
340
1295
 
1296
+ /**
1297
+ * Track information
1298
+ */
341
1299
  export interface TrackInfo {
1300
+ /** Track identifier */
342
1301
  identifier: string;
1302
+
1303
+ /** Whether track is seekable */
343
1304
  isSeekable: boolean;
1305
+
1306
+ /** Track author/artist */
344
1307
  author: string;
1308
+
1309
+ /** Track length in ms */
345
1310
  length: number;
1311
+
1312
+ /** Whether track is a stream */
346
1313
  isStream: boolean;
1314
+
1315
+ /** Track title */
347
1316
  title: string;
1317
+
1318
+ /** Track URI */
348
1319
  uri: string;
349
- sourceName: string;
350
- artworkUrl: string;
1320
+
1321
+ /** Track thumbnail URL */
1322
+ thumbnail?: string;
351
1323
  }
352
- }
1324
+ }