lavalink-client 2.5.9 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -449,6 +449,138 @@ declare class FilterManager {
449
449
  clearEQ(): Promise<this>;
450
450
  }
451
451
 
452
+ /** Sourcenames provided by lavalink server */
453
+ type LavalinkSourceNames = "youtube" | "youtubemusic" | "soundcloud" | "bandcamp" | "twitch";
454
+ /** Source Names provided by lava src plugin */
455
+ type LavalinkPlugin_LavaSrc_SourceNames = "deezer" | "spotify" | "applemusic" | "yandexmusic" | "flowery-tts" | "vkmusic" | "tidal" | "qobuz";
456
+ /** Source Names provided by jiosaavan plugin */
457
+ type LavalinkPlugin_JioSaavn_SourceNames = "jiosaavn";
458
+ /** The SourceNames provided by lavalink */
459
+ type SourceNames = LavalinkSourceNames | LavalinkPlugin_LavaSrc_SourceNames | LavalinkPlugin_JioSaavn_SourceNames;
460
+ interface LavalinkTrackInfo {
461
+ /** The Identifier of the Track */
462
+ identifier: string;
463
+ /** The Track Title / Name */
464
+ title: string;
465
+ /** The Name of the Author */
466
+ author: string;
467
+ /** The duration of the Track */
468
+ length: number;
469
+ /** The URL of the artwork if available */
470
+ artworkUrl: string | null;
471
+ /** The URL (aka Link) of the Track called URI */
472
+ uri: string;
473
+ /** The Source name of the Track, e.g. soundcloud, youtube, spotify */
474
+ sourceName: SourceNames;
475
+ /** Wether the audio is seekable */
476
+ isSeekable: boolean;
477
+ /** Wether the audio is of a live stream */
478
+ isStream: boolean;
479
+ /** If isrc code is available, it's provided */
480
+ isrc: string | null;
481
+ }
482
+ interface TrackInfo {
483
+ /** The Identifier of the Track */
484
+ identifier: string;
485
+ /** The Track Title / Name */
486
+ title: string;
487
+ /** The Name of the Author */
488
+ author: string;
489
+ /** The duration of the Track */
490
+ duration: number;
491
+ /** The URL of the artwork if available */
492
+ artworkUrl: string | null;
493
+ /** The URL (aka Link) of the Track called URI */
494
+ uri: string;
495
+ /** The Source name of the Track, e.g. soundcloud, youtube, spotify */
496
+ sourceName: SourceNames;
497
+ /** Wether the audio is seekable */
498
+ isSeekable: boolean;
499
+ /** Wether the audio is of a live stream */
500
+ isStream: boolean;
501
+ /** If isrc code is available, it's provided */
502
+ isrc: string | null;
503
+ }
504
+ interface PluginInfo {
505
+ /** The Type provided by a plugin */
506
+ type?: "album" | "playlist" | "artist" | "recommendations" | string;
507
+ /** The Identifier provided by a plugin */
508
+ albumName?: string;
509
+ /** The url of the album */
510
+ albumUrl?: string;
511
+ /** The url of the album art */
512
+ albumArtUrl?: string;
513
+ /** The url of the artist */
514
+ artistUrl?: string;
515
+ /** The url of the artist artwork */
516
+ artistArtworkUrl?: string;
517
+ /** The url of the preview */
518
+ previewUrl?: string;
519
+ /** Whether the track is a preview */
520
+ isPreview?: boolean;
521
+ /** The total number of tracks in the playlist */
522
+ totalTracks?: number;
523
+ /** The Identifier provided by a plugin */
524
+ identifier?: string;
525
+ /** The ArtworkUrl provided by a plugin */
526
+ artworkUrl?: string;
527
+ /** The Author Information provided by a plugin */
528
+ author?: string;
529
+ /** The Url provided by a Plugin */
530
+ url?: string;
531
+ /** The Url provided by a Plugin */
532
+ uri?: string;
533
+ /** You can put specific track information here, to transform the tracks... */
534
+ clientData?: {
535
+ previousTrack?: boolean;
536
+ [key: string]: any;
537
+ };
538
+ }
539
+ interface LavalinkTrack {
540
+ /** The Base 64 encoded String */
541
+ encoded?: Base64;
542
+ /** Track Information */
543
+ info: LavalinkTrackInfo;
544
+ /** Plugin Information from Lavalink */
545
+ pluginInfo: Partial<PluginInfo>;
546
+ /** The userData Object from when you provide to the lavalink request */
547
+ userData?: anyObject;
548
+ }
549
+ interface Track {
550
+ /** The Base 64 encoded String */
551
+ encoded?: Base64;
552
+ /** Track Information */
553
+ info: TrackInfo;
554
+ /** Plugin Information from Lavalink */
555
+ pluginInfo: Partial<PluginInfo>;
556
+ /** The Track's Requester */
557
+ requester?: unknown;
558
+ /** The userData Object from when you provide to the lavalink request */
559
+ userData?: anyObject;
560
+ }
561
+ interface UnresolvedTrackInfo extends Partial<TrackInfo> {
562
+ /** Required */
563
+ title: string;
564
+ }
565
+ interface UnresolvedQuery extends UnresolvedTrackInfo {
566
+ /** The base64 of the unresolved track to "encode" */
567
+ encoded?: Base64;
568
+ }
569
+ interface UnresolvedTrack {
570
+ /** Required */
571
+ resolve: (player: Player) => Promise<void>;
572
+ /** The Base 64 encoded String */
573
+ encoded?: Base64;
574
+ /** Track Information */
575
+ info: UnresolvedTrackInfo;
576
+ /** Plugin Information from Lavalink */
577
+ pluginInfo: Partial<PluginInfo>;
578
+ /** The userData Object from when you provide to the lavalink request */
579
+ userData?: anyObject;
580
+ /** The Track's Requester */
581
+ requester?: unknown;
582
+ }
583
+
452
584
  declare class QueueSaver {
453
585
  /**
454
586
  * The queue store manager
@@ -862,138 +994,6 @@ declare class Player {
862
994
  toJSON(): PlayerJson;
863
995
  }
864
996
 
865
- /** Sourcenames provided by lavalink server */
866
- type LavalinkSourceNames = "youtube" | "youtubemusic" | "soundcloud" | "bandcamp" | "twitch";
867
- /** Source Names provided by lava src plugin */
868
- type LavalinkPlugin_LavaSrc_SourceNames = "deezer" | "spotify" | "applemusic" | "yandexmusic" | "flowery-tts" | "vkmusic" | "tidal" | "qobuz";
869
- /** Source Names provided by jiosaavan plugin */
870
- type LavalinkPlugin_JioSaavn_SourceNames = "jiosaavn";
871
- /** The SourceNames provided by lavalink */
872
- type SourceNames = LavalinkSourceNames | LavalinkPlugin_LavaSrc_SourceNames | LavalinkPlugin_JioSaavn_SourceNames;
873
- interface LavalinkTrackInfo {
874
- /** The Identifier of the Track */
875
- identifier: string;
876
- /** The Track Title / Name */
877
- title: string;
878
- /** The Name of the Author */
879
- author: string;
880
- /** The duration of the Track */
881
- length: number;
882
- /** The URL of the artwork if available */
883
- artworkUrl: string | null;
884
- /** The URL (aka Link) of the Track called URI */
885
- uri: string;
886
- /** The Source name of the Track, e.g. soundcloud, youtube, spotify */
887
- sourceName: SourceNames;
888
- /** Wether the audio is seekable */
889
- isSeekable: boolean;
890
- /** Wether the audio is of a live stream */
891
- isStream: boolean;
892
- /** If isrc code is available, it's provided */
893
- isrc: string | null;
894
- }
895
- interface TrackInfo {
896
- /** The Identifier of the Track */
897
- identifier: string;
898
- /** The Track Title / Name */
899
- title: string;
900
- /** The Name of the Author */
901
- author: string;
902
- /** The duration of the Track */
903
- duration: number;
904
- /** The URL of the artwork if available */
905
- artworkUrl: string | null;
906
- /** The URL (aka Link) of the Track called URI */
907
- uri: string;
908
- /** The Source name of the Track, e.g. soundcloud, youtube, spotify */
909
- sourceName: SourceNames;
910
- /** Wether the audio is seekable */
911
- isSeekable: boolean;
912
- /** Wether the audio is of a live stream */
913
- isStream: boolean;
914
- /** If isrc code is available, it's provided */
915
- isrc: string | null;
916
- }
917
- interface PluginInfo {
918
- /** The Type provided by a plugin */
919
- type?: "album" | "playlist" | "artist" | "recommendations" | string;
920
- /** The Identifier provided by a plugin */
921
- albumName?: string;
922
- /** The url of the album */
923
- albumUrl?: string;
924
- /** The url of the album art */
925
- albumArtUrl?: string;
926
- /** The url of the artist */
927
- artistUrl?: string;
928
- /** The url of the artist artwork */
929
- artistArtworkUrl?: string;
930
- /** The url of the preview */
931
- previewUrl?: string;
932
- /** Whether the track is a preview */
933
- isPreview?: boolean;
934
- /** The total number of tracks in the playlist */
935
- totalTracks?: number;
936
- /** The Identifier provided by a plugin */
937
- identifier?: string;
938
- /** The ArtworkUrl provided by a plugin */
939
- artworkUrl?: string;
940
- /** The Author Information provided by a plugin */
941
- author?: string;
942
- /** The Url provided by a Plugin */
943
- url?: string;
944
- /** The Url provided by a Plugin */
945
- uri?: string;
946
- /** You can put specific track information here, to transform the tracks... */
947
- clientData?: {
948
- previousTrack?: boolean;
949
- [key: string]: any;
950
- };
951
- }
952
- interface LavalinkTrack {
953
- /** The Base 64 encoded String */
954
- encoded?: Base64;
955
- /** Track Information */
956
- info: LavalinkTrackInfo;
957
- /** Plugin Information from Lavalink */
958
- pluginInfo: Partial<PluginInfo>;
959
- /** The userData Object from when you provide to the lavalink request */
960
- userData?: anyObject;
961
- }
962
- interface Track {
963
- /** The Base 64 encoded String */
964
- encoded?: Base64;
965
- /** Track Information */
966
- info: TrackInfo;
967
- /** Plugin Information from Lavalink */
968
- pluginInfo: Partial<PluginInfo>;
969
- /** The Track's Requester */
970
- requester?: unknown;
971
- /** The userData Object from when you provide to the lavalink request */
972
- userData?: anyObject;
973
- }
974
- interface UnresolvedTrackInfo extends Partial<TrackInfo> {
975
- /** Required */
976
- title: string;
977
- }
978
- interface UnresolvedQuery extends UnresolvedTrackInfo {
979
- /** The base64 of the unresolved track to "encode" */
980
- encoded?: Base64;
981
- }
982
- interface UnresolvedTrack {
983
- /** Required */
984
- resolve: (player: Player) => Promise<void>;
985
- /** The Base 64 encoded String */
986
- encoded?: Base64;
987
- /** Track Information */
988
- info: UnresolvedTrackInfo;
989
- /** Plugin Information from Lavalink */
990
- pluginInfo: Partial<PluginInfo>;
991
- /** The userData Object from when you provide to the lavalink request */
992
- userData?: anyObject;
993
- /** The Track's Requester */
994
- requester?: unknown;
995
- }
996
-
997
997
  interface StoredQueue {
998
998
  current: Track | null;
999
999
  previous: Track[];
@@ -1011,7 +1011,7 @@ interface QueueStoreManager {
1011
1011
  /** @async Parse the saved value back to the Queue (IF YOU DON'T NEED PARSING/STRINGIFY, then just return the value) */
1012
1012
  parse: (value: StoredQueue | string) => Awaitable<Partial<StoredQueue>>;
1013
1013
  }
1014
- interface ManagerQueueOptions {
1014
+ interface ManagerQueueOptions<CustomPlayerT extends Player = Player> {
1015
1015
  /** Maximum Amount of tracks for the queue.previous array. Set to 0 to not save previous songs. Defaults to 25 Tracks */
1016
1016
  maxPreviousTracks?: number;
1017
1017
  /** Custom Queue Store option */
@@ -2538,47 +2538,47 @@ declare class NodeManager extends EventEmitter {
2538
2538
  /**
2539
2539
  * The events from the lavalink Manager
2540
2540
  */
2541
- interface LavalinkManagerEvents {
2541
+ interface LavalinkManagerEvents<CustomPlayerT extends Player = Player> {
2542
2542
  /**
2543
2543
  * Emitted when a Track started playing.
2544
2544
  * @event Manager#trackStart
2545
2545
  */
2546
- "trackStart": (player: Player, track: Track | null, payload: TrackStartEvent) => void;
2546
+ "trackStart": (player: CustomPlayerT, track: Track | null, payload: TrackStartEvent) => void;
2547
2547
  /**
2548
2548
  * Emitted when a Track finished.
2549
2549
  * @event Manager#trackEnd
2550
2550
  */
2551
- "trackEnd": (player: Player, track: Track | null, payload: TrackEndEvent) => void;
2551
+ "trackEnd": (player: CustomPlayerT, track: Track | null, payload: TrackEndEvent) => void;
2552
2552
  /**
2553
2553
  * Emitted when a Track got stuck while playing.
2554
2554
  * @event Manager#trackStuck
2555
2555
  */
2556
- "trackStuck": (player: Player, track: Track | null, payload: TrackStuckEvent) => void;
2556
+ "trackStuck": (player: CustomPlayerT, track: Track | null, payload: TrackStuckEvent) => void;
2557
2557
  /**
2558
2558
  * Emitted when a Track errored.
2559
2559
  * @event Manager#trackError
2560
2560
  */
2561
- "trackError": (player: Player, track: Track | UnresolvedTrack | null, payload: TrackExceptionEvent) => void;
2561
+ "trackError": (player: CustomPlayerT, track: Track | UnresolvedTrack | null, payload: TrackExceptionEvent) => void;
2562
2562
  /**
2563
2563
  * Emitted when the Playing finished and no more tracks in the queue.
2564
2564
  * @event Manager#queueEnd
2565
2565
  */
2566
- "queueEnd": (player: Player, track: Track | UnresolvedTrack | null, payload: TrackEndEvent | TrackStuckEvent | TrackExceptionEvent) => void;
2566
+ "queueEnd": (player: CustomPlayerT, track: Track | UnresolvedTrack | null, payload: TrackEndEvent | TrackStuckEvent | TrackExceptionEvent) => void;
2567
2567
  /**
2568
2568
  * Emitted when a Player is created.
2569
2569
  * @event Manager#playerCreate
2570
2570
  */
2571
- "playerCreate": (player: Player) => void;
2571
+ "playerCreate": (player: CustomPlayerT) => void;
2572
2572
  /**
2573
2573
  * Emitted when a Player is moved within the channel.
2574
2574
  * @event Manager#playerMove
2575
2575
  */
2576
- "playerMove": (player: Player, oldVoiceChannelId: string, newVoiceChannelId: string) => void;
2576
+ "playerMove": (player: CustomPlayerT, oldVoiceChannelId: string, newVoiceChannelId: string) => void;
2577
2577
  /**
2578
2578
  * Emitted when a Player is disconnected from a channel.
2579
2579
  * @event Manager#playerDisconnect
2580
2580
  */
2581
- "playerDisconnect": (player: Player, voiceChannelId: string) => void;
2581
+ "playerDisconnect": (player: CustomPlayerT, voiceChannelId: string) => void;
2582
2582
  /**
2583
2583
  * Emitted when a Node-Socket got closed for a specific Player.
2584
2584
  * 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.
@@ -2592,85 +2592,85 @@ interface LavalinkManagerEvents {
2592
2592
  * @link https://lavalink.dev/api/websocket.html#websocketclosedevent
2593
2593
  * @event Manager#playerSocketClosed
2594
2594
  */
2595
- "playerSocketClosed": (player: Player, payload: WebSocketClosedEvent) => void;
2595
+ "playerSocketClosed": (player: CustomPlayerT, payload: WebSocketClosedEvent) => void;
2596
2596
  /**
2597
2597
  * Emitted when a Player get's destroyed
2598
2598
  * @event Manager#playerDestroy
2599
2599
  */
2600
- "playerDestroy": (player: Player, destroyReason?: DestroyReasonsType) => void;
2600
+ "playerDestroy": (player: CustomPlayerT, destroyReason?: DestroyReasonsType) => void;
2601
2601
  /**
2602
2602
  * Always emits when the player (on lavalink side) got updated
2603
2603
  * @event Manager#playerUpdate
2604
2604
  */
2605
- "playerUpdate": (oldPlayerJson: PlayerJson, newPlayer: Player) => void;
2605
+ "playerUpdate": (oldPlayerJson: PlayerJson, newPlayer: CustomPlayerT) => void;
2606
2606
  /**
2607
2607
  * Emitted when the player's selfMuted or serverMuted state changed (true -> false | false -> true)
2608
2608
  * @event Manager#playerMuteChange
2609
2609
  */
2610
- "playerMuteChange": (player: Player, selfMuted: boolean, serverMuted: boolean) => void;
2610
+ "playerMuteChange": (player: CustomPlayerT, selfMuted: boolean, serverMuted: boolean) => void;
2611
2611
  /**
2612
2612
  * Emitted when the player's selfDeafed or serverDeafed state changed (true -> false | false -> true)
2613
2613
  * @event Manager#playerDeafChange
2614
2614
  */
2615
- "playerDeafChange": (player: Player, selfDeafed: boolean, serverDeafed: boolean) => void;
2615
+ "playerDeafChange": (player: CustomPlayerT, selfDeafed: boolean, serverDeafed: boolean) => void;
2616
2616
  /**
2617
2617
  * Emitted when the player's suppressed (true -> false | false -> true)
2618
2618
  * @event Manager#playerSuppressChange
2619
2619
  */
2620
- "playerSuppressChange": (player: Player, suppress: boolean) => void;
2620
+ "playerSuppressChange": (player: CustomPlayerT, suppress: boolean) => void;
2621
2621
  /**
2622
2622
  * Emitted when the player's queue got empty, and the timeout started
2623
2623
  * @event Manager#playerQueueEmptyStart
2624
2624
  */
2625
- "playerQueueEmptyStart": (player: Player, timeoutMs: number) => void;
2625
+ "playerQueueEmptyStart": (player: CustomPlayerT, timeoutMs: number) => void;
2626
2626
  /**
2627
2627
  * Emitted when the player's queue got empty, and the timeout finished leading to destroying the player
2628
2628
  * @event Manager#playerQueueEmptyEnd
2629
2629
  */
2630
- "playerQueueEmptyEnd": (player: Player) => void;
2630
+ "playerQueueEmptyEnd": (player: CustomPlayerT) => void;
2631
2631
  /**
2632
2632
  * Emitted when the player's queue got empty, and the timeout got cancelled becuase a track got re-added to it.
2633
2633
  * @event Manager#playerQueueEmptyEnd
2634
2634
  */
2635
- "playerQueueEmptyCancel": (player: Player) => void;
2635
+ "playerQueueEmptyCancel": (player: CustomPlayerT) => void;
2636
2636
  /**
2637
2637
  * Emitted, when a user joins the voice channel, while there is a player existing
2638
2638
  * @event Manager#playerQueueEmptyStart
2639
2639
  */
2640
- "playerVoiceJoin": (player: Player, userId: string) => void;
2640
+ "playerVoiceJoin": (player: CustomPlayerT, userId: string) => void;
2641
2641
  /**
2642
2642
  * Emitted, when a user leaves the voice channel, while there is a player existing
2643
2643
  * @event Manager#playerQueueEmptyEnd
2644
2644
  */
2645
- "playerVoiceLeave": (player: Player, userId: string) => void;
2645
+ "playerVoiceLeave": (player: CustomPlayerT, userId: string) => void;
2646
2646
  /**
2647
2647
  * SPONSORBLOCK-PLUGIN EVENT
2648
2648
  * Emitted when Segments are loaded
2649
2649
  * @link https://github.com/topi314/Sponsorblock-Plugin#segmentsloaded
2650
2650
  * @event Manager#trackError
2651
2651
  */
2652
- "SegmentsLoaded": (player: Player, track: Track | UnresolvedTrack | null, payload: SponsorBlockSegmentsLoaded) => void;
2652
+ "SegmentsLoaded": (player: CustomPlayerT, track: Track | UnresolvedTrack | null, payload: SponsorBlockSegmentsLoaded) => void;
2653
2653
  /**
2654
2654
  * SPONSORBLOCK-PLUGIN EVENT
2655
2655
  * Emitted when a specific Segment was skipped
2656
2656
  * @link https://github.com/topi314/Sponsorblock-Plugin#segmentskipped
2657
2657
  * @event Manager#trackError
2658
2658
  */
2659
- "SegmentSkipped": (player: Player, track: Track | UnresolvedTrack | null, payload: SponsorBlockSegmentSkipped) => void;
2659
+ "SegmentSkipped": (player: CustomPlayerT, track: Track | UnresolvedTrack | null, payload: SponsorBlockSegmentSkipped) => void;
2660
2660
  /**
2661
2661
  * SPONSORBLOCK-PLUGIN EVENT
2662
2662
  * Emitted when a specific Chapter starts playing
2663
2663
  * @link https://github.com/topi314/Sponsorblock-Plugin#chapterstarted
2664
2664
  * @event Manager#trackError
2665
2665
  */
2666
- "ChapterStarted": (player: Player, track: Track | UnresolvedTrack | null, payload: SponsorBlockChapterStarted) => void;
2666
+ "ChapterStarted": (player: CustomPlayerT, track: Track | UnresolvedTrack | null, payload: SponsorBlockChapterStarted) => void;
2667
2667
  /**
2668
2668
  * SPONSORBLOCK-PLUGIN EVENT
2669
2669
  * Emitted when Chapters are loaded
2670
2670
  * @link https://github.com/topi314/Sponsorblock-Plugin#chaptersloaded
2671
2671
  * @event Manager#trackError
2672
2672
  */
2673
- "ChaptersLoaded": (player: Player, track: Track | UnresolvedTrack | null, payload: SponsorBlockChaptersLoaded) => void;
2673
+ "ChaptersLoaded": (player: CustomPlayerT, track: Track | UnresolvedTrack | null, payload: SponsorBlockChaptersLoaded) => void;
2674
2674
  /**
2675
2675
  * Lavalink-Client Debug Event
2676
2676
  * Emitted for several erros, and logs within lavalink-client, if managerOptions.advancedOptions.enableDebugEvents is true
@@ -2689,21 +2689,21 @@ interface LavalinkManagerEvents {
2689
2689
  * @link https://github.com/topi314/LavaLyrics
2690
2690
  * @event Manager#LyricsLine
2691
2691
  */
2692
- "LyricsLine": (player: Player, track: Track | UnresolvedTrack | null, payload: LyricsLineEvent) => void;
2692
+ "LyricsLine": (player: CustomPlayerT, track: Track | UnresolvedTrack | null, payload: LyricsLineEvent) => void;
2693
2693
  /**
2694
2694
  * Emitted when a Lyrics is found
2695
2695
  * @link https://github.com/topi314/LavaLyrics
2696
2696
  * @event Manager#LyricsFound
2697
2697
  */
2698
- "LyricsFound": (player: Player, track: Track | UnresolvedTrack | null, payload: LyricsFoundEvent) => void;
2698
+ "LyricsFound": (player: CustomPlayerT, track: Track | UnresolvedTrack | null, payload: LyricsFoundEvent) => void;
2699
2699
  /**
2700
2700
  * Emitted when a Lyrics is not found
2701
2701
  * @link https://github.com/topi314/LavaLyrics
2702
2702
  * @event Manager#LyricsNotFound
2703
2703
  */
2704
- "LyricsNotFound": (player: Player, track: Track | UnresolvedTrack | null, payload: LyricsNotFoundEvent) => void;
2705
- "playerResumed": (player: Player, track: Track | UnresolvedTrack | null) => void;
2706
- "playerPaused": (player: Player, track: Track | UnresolvedTrack | null) => void;
2704
+ "LyricsNotFound": (player: CustomPlayerT, track: Track | UnresolvedTrack | null, payload: LyricsNotFoundEvent) => void;
2705
+ "playerResumed": (player: CustomPlayerT, track: Track | UnresolvedTrack | null) => void;
2706
+ "playerPaused": (player: CustomPlayerT, track: Track | UnresolvedTrack | null) => void;
2707
2707
  }
2708
2708
  /**
2709
2709
  * The Bot client Options needed for the manager
@@ -2717,7 +2717,7 @@ interface BotClientOptions {
2717
2717
  [x: string | number | symbol]: unknown;
2718
2718
  }
2719
2719
  /** Sub Manager Options, for player specific things */
2720
- interface ManagerPlayerOptions {
2720
+ interface ManagerPlayerOptions<CustomPlayerT extends Player = Player> {
2721
2721
  /** If the Lavalink Volume should be decremented by x number */
2722
2722
  volumeDecrementer?: number;
2723
2723
  /** How often it should update the the player Position */
@@ -2748,13 +2748,18 @@ interface ManagerPlayerOptions {
2748
2748
  };
2749
2749
  onEmptyQueue?: {
2750
2750
  /** 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! */
2751
- autoPlayFunction?: (player: Player, lastPlayedTrack: Track) => Promise<void>;
2751
+ autoPlayFunction?: (player: CustomPlayerT, lastPlayedTrack: Track) => Promise<void>;
2752
2752
  destroyAfterMs?: number;
2753
2753
  };
2754
2754
  useUnresolvedData?: boolean;
2755
2755
  }
2756
+ type DeepRequired<T> = {
2757
+ [K in keyof T]-?: NonNullable<T[K]> extends object ? DeepRequired<NonNullable<T[K]>> : NonNullable<T[K]>;
2758
+ };
2759
+ type RequiredManagerOptions<T extends Player> = DeepRequired<ManagerOptions<T>>;
2760
+ type PlayerConstructor<T extends Player = Player> = new (options: PlayerOptions, LavalinkManager: LavalinkManager, dontEmitPlayerCreateEvent?: boolean) => T;
2756
2761
  /** Manager Options used to create the manager */
2757
- interface ManagerOptions {
2762
+ interface ManagerOptions<CustomPlayerT extends Player = Player> {
2758
2763
  /** The Node Options, for all Nodes! (on init) */
2759
2764
  nodes: LavalinkNodeOptions[];
2760
2765
  /** @async The Function to send the voice connection changes from Lavalink to Discord */
@@ -2762,9 +2767,11 @@ interface ManagerOptions {
2762
2767
  /** The Bot Client's Data for Authorization */
2763
2768
  client?: BotClientOptions;
2764
2769
  /** QueueOptions for all Queues */
2765
- queueOptions?: ManagerQueueOptions;
2770
+ queueOptions?: ManagerQueueOptions<CustomPlayerT>;
2766
2771
  /** PlayerOptions for all Players */
2767
- playerOptions?: ManagerPlayerOptions;
2772
+ playerOptions?: ManagerPlayerOptions<CustomPlayerT>;
2773
+ /** The player class you want to use when creating a player. (can be extendable) */
2774
+ playerClass?: PlayerConstructor<CustomPlayerT>;
2768
2775
  /** If it should skip to the next Track on TrackEnd / TrackError etc. events */
2769
2776
  autoSkip?: boolean;
2770
2777
  /** If it should automatically move the player to the next node when node is down */
@@ -2802,44 +2809,44 @@ interface ManagerOptions {
2802
2809
  };
2803
2810
  }
2804
2811
 
2805
- declare class LavalinkManager extends EventEmitter {
2812
+ declare class LavalinkManager<CustomPlayerT extends Player = Player> extends EventEmitter {
2806
2813
  /**
2807
2814
  * Emit an event
2808
2815
  * @param event The event to emit
2809
2816
  * @param args The arguments to pass to the event
2810
2817
  * @returns
2811
2818
  */
2812
- emit<Event extends keyof LavalinkManagerEvents>(event: Event, ...args: Parameters<LavalinkManagerEvents[Event]>): boolean;
2819
+ emit<Event extends keyof LavalinkManagerEvents<CustomPlayerT>>(event: Event, ...args: Parameters<LavalinkManagerEvents<CustomPlayerT>[Event]>): boolean;
2813
2820
  /**
2814
2821
  * Add an event listener
2815
2822
  * @param event The event to listen to
2816
2823
  * @param listener The listener to add
2817
2824
  * @returns
2818
2825
  */
2819
- on<Event extends keyof LavalinkManagerEvents>(event: Event, listener: LavalinkManagerEvents[Event]): this;
2826
+ on<Event extends keyof LavalinkManagerEvents<CustomPlayerT>>(event: Event, listener: LavalinkManagerEvents<CustomPlayerT>[Event]): this;
2820
2827
  /**
2821
2828
  * Add an event listener that only fires once
2822
2829
  * @param event The event to listen to
2823
2830
  * @param listener The listener to add
2824
2831
  * @returns
2825
2832
  */
2826
- once<Event extends keyof LavalinkManagerEvents>(event: Event, listener: LavalinkManagerEvents[Event]): this;
2833
+ once<Event extends keyof LavalinkManagerEvents<CustomPlayerT>>(event: Event, listener: LavalinkManagerEvents<CustomPlayerT>[Event]): this;
2827
2834
  /**
2828
2835
  * Remove an event listener
2829
2836
  * @param event The event to remove the listener from
2830
2837
  * @param listener The listener to remove
2831
2838
  * @returns
2832
2839
  */
2833
- off<Event extends keyof LavalinkManagerEvents>(event: Event, listener: LavalinkManagerEvents[Event]): this;
2840
+ off<Event extends keyof LavalinkManagerEvents<CustomPlayerT>>(event: Event, listener: LavalinkManagerEvents<CustomPlayerT>[Event]): this;
2834
2841
  /**
2835
2842
  * Remove an event listener
2836
2843
  * @param event The event to remove the listener from
2837
2844
  * @param listener The listener to remove
2838
2845
  * @returns
2839
2846
  */
2840
- removeListener<Event extends keyof LavalinkManagerEvents>(event: Event, listener: LavalinkManagerEvents[Event]): this;
2847
+ removeListener<Event extends keyof LavalinkManagerEvents<CustomPlayerT>>(event: Event, listener: LavalinkManagerEvents<CustomPlayerT>[Event]): this;
2841
2848
  /** The Options of LavalinkManager (changeable) */
2842
- options: ManagerOptions;
2849
+ options: ManagerOptions<CustomPlayerT>;
2843
2850
  /** LavalinkManager's NodeManager to manage all Nodes */
2844
2851
  nodeManager: NodeManager;
2845
2852
  /** LavalinkManager's Utils Class */
@@ -2847,7 +2854,7 @@ declare class LavalinkManager extends EventEmitter {
2847
2854
  /** Wether the manager was initiated or not */
2848
2855
  initiated: boolean;
2849
2856
  /** All Players stored in a MiniMap */
2850
- readonly players: MiniMap<string, Player>;
2857
+ readonly players: MiniMap<string, CustomPlayerT>;
2851
2858
  /**
2852
2859
  * Applies the options provided by the User
2853
2860
  * @param options
@@ -2918,7 +2925,7 @@ declare class LavalinkManager extends EventEmitter {
2918
2925
  * })
2919
2926
  * ```
2920
2927
  */
2921
- constructor(options: ManagerOptions);
2928
+ constructor(options: ManagerOptions<CustomPlayerT>);
2922
2929
  /**
2923
2930
  * Get a Player from Lava
2924
2931
  * @param guildId The guildId of the player
@@ -2933,7 +2940,7 @@ declare class LavalinkManager extends EventEmitter {
2933
2940
  * ```
2934
2941
  * @returns
2935
2942
  */
2936
- getPlayer(guildId: string): Player | undefined;
2943
+ getPlayer(guildId: string): CustomPlayerT | undefined;
2937
2944
  /**
2938
2945
  * Create a Music-Player. If a player exists, then it returns it before creating a new one
2939
2946
  * @param options
@@ -2958,7 +2965,7 @@ declare class LavalinkManager extends EventEmitter {
2958
2965
  * });
2959
2966
  * ```
2960
2967
  */
2961
- createPlayer(options: PlayerOptions): Player;
2968
+ createPlayer(options: PlayerOptions): CustomPlayerT;
2962
2969
  /**
2963
2970
  * Destroy a player with optional destroy reason and disconnect it from the voice channel
2964
2971
  * @param guildId
@@ -2971,7 +2978,7 @@ declare class LavalinkManager extends EventEmitter {
2971
2978
  * // recommend to do it on the player tho: player.destroy("forcefully destroyed the player");
2972
2979
  * ```
2973
2980
  */
2974
- destroyPlayer(guildId: string, destroyReason?: string): Promise<void | Player>;
2981
+ destroyPlayer(guildId: string, destroyReason?: string): Promise<void | CustomPlayerT>;
2975
2982
  /**
2976
2983
  * Delete's a player from the cache without destroying it on lavalink (only works when it's disconnected)
2977
2984
  * @param guildId
@@ -3009,7 +3016,7 @@ declare class LavalinkManager extends EventEmitter {
3009
3016
  * });
3010
3017
  * ```
3011
3018
  */
3012
- init(clientData: BotClientOptions): Promise<LavalinkManager>;
3019
+ init(clientData: BotClientOptions): Promise<this>;
3013
3020
  /**
3014
3021
  * Sends voice data to the Lavalink server.
3015
3022
  * ! Without this the library won't work
@@ -3043,4 +3050,4 @@ declare const LavalinkPlugins: {
3043
3050
  /** Lavalink Sources regexes for url validations */
3044
3051
  declare const SourceLinksRegexes: Record<SourcesRegex, RegExp>;
3045
3052
 
3046
- export { type AudioOutputs, type Awaitable, type Base64, type BaseNodeStats, type BasePlayOptions, type BotClientOptions, type CPUStats, type ChannelDeletePacket, type ChannelMixFilter, type ClientCustomSearchPlatformUtils, type ClientSearchPlatform, DebugEvents, DefaultQueueStore, DefaultSources, DestroyReasons, type DestroyReasonsType, DisconnectReasons, type DisconnectReasonsType, type DistortionFilter, type DuncteSearchPlatform, type EQBand, EQList, type Exception, type FailingAddress, type FilterData, FilterManager, type FloatNumber, type FrameStats, type GitObject, type GuildShardPayload, type IntegerNumber, type InvalidLavalinkRestRequest, type JioSaavnSearchPlatform, type KaraokeFilter, type LavaSearchFilteredResponse, type LavaSearchQuery, type LavaSearchResponse, type LavaSearchType, type LavaSrcSearchPlatform, type LavaSrcSearchPlatformBase, type LavalinkClientSearchPlatform, type LavalinkClientSearchPlatformResolve, type LavalinkFilterData, type LavalinkInfo, LavalinkManager, type LavalinkManagerEvents, LavalinkNode, type LavalinkNodeIdentifier, type LavalinkNodeOptions, type LavalinkPlayOptions, type LavalinkPlayer, type LavalinkPlayerVoice, type LavalinkPlayerVoiceOptions, type LavalinkPlugin_JioSaavn_SourceNames, type LavalinkPlugin_LavaSrc_SourceNames, LavalinkPlugins, type LavalinkSearchPlatform, type LavalinkSourceNames, type LavalinkTrack, type LavalinkTrackInfo, type LoadTypes, type LowPassFilter, type LyricsEvent, type LyricsEventType, type LyricsFoundEvent, type LyricsLine, type LyricsLineEvent, type LyricsNotFoundEvent, type LyricsResult, type ManagerOptions, type ManagerPlayerOptions, type ManagerQueueOptions, ManagerUtils, type MemoryStats, MiniMap, type MiniMapConstructor, type ModifyRequest, NodeManager, type NodeManagerEvents, type NodeMessage, type NodeStats, NodeSymbol, type Opaque, type PlayOptions, Player, type PlayerEvent, type PlayerEventType, type PlayerEvents, type PlayerFilters, type PlayerJson, type PlayerOptions, type PlayerUpdateInfo, type PlaylistInfo, type PluginInfo, type PluginObject, Queue, type QueueChangesWatcher, QueueSaver, type QueueStoreManager, QueueSymbol, type RepeatMode, type RotationFilter, type RoutePlanner, type RoutePlannerTypes, type SearchPlatform, type SearchQuery, type SearchResult, type Session, type Severity, SourceLinksRegexes, type SourceNames, type SourcesRegex, type SponsorBlockChapterStarted, type SponsorBlockChaptersLoaded, type SponsorBlockSegment, type SponsorBlockSegmentEventType, type SponsorBlockSegmentEvents, type SponsorBlockSegmentSkipped, type SponsorBlockSegmentsLoaded, type State, type StoredQueue, type TimescaleFilter, type Track, type TrackEndEvent, type TrackEndReason, type TrackExceptionEvent, type TrackInfo, type TrackStartEvent, type TrackStuckEvent, TrackSymbol, type TremoloFilter, type UnresolvedQuery, type UnresolvedSearchResult, type UnresolvedTrack, type UnresolvedTrackInfo, UnresolvedTrackSymbol, type VersionObject, type VibratoFilter, type VoicePacket, type VoiceServer, type VoiceState, type WebSocketClosedEvent, type anyObject, audioOutputsData, parseLavalinkConnUrl, queueTrackEnd, safeStringify, validSponsorBlocks };
3053
+ export { type AudioOutputs, type Awaitable, type Base64, type BaseNodeStats, type BasePlayOptions, type BotClientOptions, type CPUStats, type ChannelDeletePacket, type ChannelMixFilter, type ClientCustomSearchPlatformUtils, type ClientSearchPlatform, DebugEvents, type DeepRequired, DefaultQueueStore, DefaultSources, DestroyReasons, type DestroyReasonsType, DisconnectReasons, type DisconnectReasonsType, type DistortionFilter, type DuncteSearchPlatform, type EQBand, EQList, type Exception, type FailingAddress, type FilterData, FilterManager, type FloatNumber, type FrameStats, type GitObject, type GuildShardPayload, type IntegerNumber, type InvalidLavalinkRestRequest, type JioSaavnSearchPlatform, type KaraokeFilter, type LavaSearchFilteredResponse, type LavaSearchQuery, type LavaSearchResponse, type LavaSearchType, type LavaSrcSearchPlatform, type LavaSrcSearchPlatformBase, type LavalinkClientSearchPlatform, type LavalinkClientSearchPlatformResolve, type LavalinkFilterData, type LavalinkInfo, LavalinkManager, type LavalinkManagerEvents, LavalinkNode, type LavalinkNodeIdentifier, type LavalinkNodeOptions, type LavalinkPlayOptions, type LavalinkPlayer, type LavalinkPlayerVoice, type LavalinkPlayerVoiceOptions, type LavalinkPlugin_JioSaavn_SourceNames, type LavalinkPlugin_LavaSrc_SourceNames, LavalinkPlugins, type LavalinkSearchPlatform, type LavalinkSourceNames, type LavalinkTrack, type LavalinkTrackInfo, type LoadTypes, type LowPassFilter, type LyricsEvent, type LyricsEventType, type LyricsFoundEvent, type LyricsLine, type LyricsLineEvent, type LyricsNotFoundEvent, type LyricsResult, type ManagerOptions, type ManagerPlayerOptions, type ManagerQueueOptions, ManagerUtils, type MemoryStats, MiniMap, type MiniMapConstructor, type ModifyRequest, NodeManager, type NodeManagerEvents, type NodeMessage, type NodeStats, NodeSymbol, type Opaque, type PlayOptions, Player, type PlayerEvent, type PlayerEventType, type PlayerEvents, type PlayerFilters, type PlayerJson, type PlayerOptions, type PlayerUpdateInfo, type PlaylistInfo, type PluginInfo, type PluginObject, Queue, type QueueChangesWatcher, QueueSaver, type QueueStoreManager, QueueSymbol, type RepeatMode, type RequiredManagerOptions, type RotationFilter, type RoutePlanner, type RoutePlannerTypes, type SearchPlatform, type SearchQuery, type SearchResult, type Session, type Severity, SourceLinksRegexes, type SourceNames, type SourcesRegex, type SponsorBlockChapterStarted, type SponsorBlockChaptersLoaded, type SponsorBlockSegment, type SponsorBlockSegmentEventType, type SponsorBlockSegmentEvents, type SponsorBlockSegmentSkipped, type SponsorBlockSegmentsLoaded, type State, type StoredQueue, type TimescaleFilter, type Track, type TrackEndEvent, type TrackEndReason, type TrackExceptionEvent, type TrackInfo, type TrackStartEvent, type TrackStuckEvent, TrackSymbol, type TremoloFilter, type UnresolvedQuery, type UnresolvedSearchResult, type UnresolvedTrack, type UnresolvedTrackInfo, UnresolvedTrackSymbol, type VersionObject, type VibratoFilter, type VoicePacket, type VoiceServer, type VoiceState, type WebSocketClosedEvent, type anyObject, audioOutputsData, parseLavalinkConnUrl, queueTrackEnd, safeStringify, validSponsorBlocks };