lavalink-client 2.5.10 → 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 +184 -181
- package/dist/index.d.ts +184 -181
- package/dist/index.js +2 -2
- package/dist/index.mjs +2 -2
- package/package.json +1 -1
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
2705
|
-
"playerResumed": (player:
|
|
2706
|
-
"playerPaused": (player:
|
|
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,7 +2748,7 @@ 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:
|
|
2751
|
+
autoPlayFunction?: (player: CustomPlayerT, lastPlayedTrack: Track) => Promise<void>;
|
|
2752
2752
|
destroyAfterMs?: number;
|
|
2753
2753
|
};
|
|
2754
2754
|
useUnresolvedData?: boolean;
|
|
@@ -2756,9 +2756,10 @@ interface ManagerPlayerOptions {
|
|
|
2756
2756
|
type DeepRequired<T> = {
|
|
2757
2757
|
[K in keyof T]-?: NonNullable<T[K]> extends object ? DeepRequired<NonNullable<T[K]>> : NonNullable<T[K]>;
|
|
2758
2758
|
};
|
|
2759
|
-
type RequiredManagerOptions = DeepRequired<ManagerOptions
|
|
2759
|
+
type RequiredManagerOptions<T extends Player> = DeepRequired<ManagerOptions<T>>;
|
|
2760
|
+
type PlayerConstructor<T extends Player = Player> = new (options: PlayerOptions, LavalinkManager: LavalinkManager, dontEmitPlayerCreateEvent?: boolean) => T;
|
|
2760
2761
|
/** Manager Options used to create the manager */
|
|
2761
|
-
interface ManagerOptions {
|
|
2762
|
+
interface ManagerOptions<CustomPlayerT extends Player = Player> {
|
|
2762
2763
|
/** The Node Options, for all Nodes! (on init) */
|
|
2763
2764
|
nodes: LavalinkNodeOptions[];
|
|
2764
2765
|
/** @async The Function to send the voice connection changes from Lavalink to Discord */
|
|
@@ -2766,9 +2767,11 @@ interface ManagerOptions {
|
|
|
2766
2767
|
/** The Bot Client's Data for Authorization */
|
|
2767
2768
|
client?: BotClientOptions;
|
|
2768
2769
|
/** QueueOptions for all Queues */
|
|
2769
|
-
queueOptions?: ManagerQueueOptions
|
|
2770
|
+
queueOptions?: ManagerQueueOptions<CustomPlayerT>;
|
|
2770
2771
|
/** PlayerOptions for all Players */
|
|
2771
|
-
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>;
|
|
2772
2775
|
/** If it should skip to the next Track on TrackEnd / TrackError etc. events */
|
|
2773
2776
|
autoSkip?: boolean;
|
|
2774
2777
|
/** If it should automatically move the player to the next node when node is down */
|
|
@@ -2806,44 +2809,44 @@ interface ManagerOptions {
|
|
|
2806
2809
|
};
|
|
2807
2810
|
}
|
|
2808
2811
|
|
|
2809
|
-
declare class LavalinkManager extends EventEmitter {
|
|
2812
|
+
declare class LavalinkManager<CustomPlayerT extends Player = Player> extends EventEmitter {
|
|
2810
2813
|
/**
|
|
2811
2814
|
* Emit an event
|
|
2812
2815
|
* @param event The event to emit
|
|
2813
2816
|
* @param args The arguments to pass to the event
|
|
2814
2817
|
* @returns
|
|
2815
2818
|
*/
|
|
2816
|
-
emit<Event extends keyof LavalinkManagerEvents
|
|
2819
|
+
emit<Event extends keyof LavalinkManagerEvents<CustomPlayerT>>(event: Event, ...args: Parameters<LavalinkManagerEvents<CustomPlayerT>[Event]>): boolean;
|
|
2817
2820
|
/**
|
|
2818
2821
|
* Add an event listener
|
|
2819
2822
|
* @param event The event to listen to
|
|
2820
2823
|
* @param listener The listener to add
|
|
2821
2824
|
* @returns
|
|
2822
2825
|
*/
|
|
2823
|
-
on<Event extends keyof LavalinkManagerEvents
|
|
2826
|
+
on<Event extends keyof LavalinkManagerEvents<CustomPlayerT>>(event: Event, listener: LavalinkManagerEvents<CustomPlayerT>[Event]): this;
|
|
2824
2827
|
/**
|
|
2825
2828
|
* Add an event listener that only fires once
|
|
2826
2829
|
* @param event The event to listen to
|
|
2827
2830
|
* @param listener The listener to add
|
|
2828
2831
|
* @returns
|
|
2829
2832
|
*/
|
|
2830
|
-
once<Event extends keyof LavalinkManagerEvents
|
|
2833
|
+
once<Event extends keyof LavalinkManagerEvents<CustomPlayerT>>(event: Event, listener: LavalinkManagerEvents<CustomPlayerT>[Event]): this;
|
|
2831
2834
|
/**
|
|
2832
2835
|
* Remove an event listener
|
|
2833
2836
|
* @param event The event to remove the listener from
|
|
2834
2837
|
* @param listener The listener to remove
|
|
2835
2838
|
* @returns
|
|
2836
2839
|
*/
|
|
2837
|
-
off<Event extends keyof LavalinkManagerEvents
|
|
2840
|
+
off<Event extends keyof LavalinkManagerEvents<CustomPlayerT>>(event: Event, listener: LavalinkManagerEvents<CustomPlayerT>[Event]): this;
|
|
2838
2841
|
/**
|
|
2839
2842
|
* Remove an event listener
|
|
2840
2843
|
* @param event The event to remove the listener from
|
|
2841
2844
|
* @param listener The listener to remove
|
|
2842
2845
|
* @returns
|
|
2843
2846
|
*/
|
|
2844
|
-
removeListener<Event extends keyof LavalinkManagerEvents
|
|
2847
|
+
removeListener<Event extends keyof LavalinkManagerEvents<CustomPlayerT>>(event: Event, listener: LavalinkManagerEvents<CustomPlayerT>[Event]): this;
|
|
2845
2848
|
/** The Options of LavalinkManager (changeable) */
|
|
2846
|
-
options: ManagerOptions
|
|
2849
|
+
options: ManagerOptions<CustomPlayerT>;
|
|
2847
2850
|
/** LavalinkManager's NodeManager to manage all Nodes */
|
|
2848
2851
|
nodeManager: NodeManager;
|
|
2849
2852
|
/** LavalinkManager's Utils Class */
|
|
@@ -2851,7 +2854,7 @@ declare class LavalinkManager extends EventEmitter {
|
|
|
2851
2854
|
/** Wether the manager was initiated or not */
|
|
2852
2855
|
initiated: boolean;
|
|
2853
2856
|
/** All Players stored in a MiniMap */
|
|
2854
|
-
readonly players: MiniMap<string,
|
|
2857
|
+
readonly players: MiniMap<string, CustomPlayerT>;
|
|
2855
2858
|
/**
|
|
2856
2859
|
* Applies the options provided by the User
|
|
2857
2860
|
* @param options
|
|
@@ -2922,7 +2925,7 @@ declare class LavalinkManager extends EventEmitter {
|
|
|
2922
2925
|
* })
|
|
2923
2926
|
* ```
|
|
2924
2927
|
*/
|
|
2925
|
-
constructor(options: ManagerOptions);
|
|
2928
|
+
constructor(options: ManagerOptions<CustomPlayerT>);
|
|
2926
2929
|
/**
|
|
2927
2930
|
* Get a Player from Lava
|
|
2928
2931
|
* @param guildId The guildId of the player
|
|
@@ -2937,7 +2940,7 @@ declare class LavalinkManager extends EventEmitter {
|
|
|
2937
2940
|
* ```
|
|
2938
2941
|
* @returns
|
|
2939
2942
|
*/
|
|
2940
|
-
getPlayer(guildId: string):
|
|
2943
|
+
getPlayer(guildId: string): CustomPlayerT | undefined;
|
|
2941
2944
|
/**
|
|
2942
2945
|
* Create a Music-Player. If a player exists, then it returns it before creating a new one
|
|
2943
2946
|
* @param options
|
|
@@ -2962,7 +2965,7 @@ declare class LavalinkManager extends EventEmitter {
|
|
|
2962
2965
|
* });
|
|
2963
2966
|
* ```
|
|
2964
2967
|
*/
|
|
2965
|
-
createPlayer(options: PlayerOptions):
|
|
2968
|
+
createPlayer(options: PlayerOptions): CustomPlayerT;
|
|
2966
2969
|
/**
|
|
2967
2970
|
* Destroy a player with optional destroy reason and disconnect it from the voice channel
|
|
2968
2971
|
* @param guildId
|
|
@@ -2975,7 +2978,7 @@ declare class LavalinkManager extends EventEmitter {
|
|
|
2975
2978
|
* // recommend to do it on the player tho: player.destroy("forcefully destroyed the player");
|
|
2976
2979
|
* ```
|
|
2977
2980
|
*/
|
|
2978
|
-
destroyPlayer(guildId: string, destroyReason?: string): Promise<void |
|
|
2981
|
+
destroyPlayer(guildId: string, destroyReason?: string): Promise<void | CustomPlayerT>;
|
|
2979
2982
|
/**
|
|
2980
2983
|
* Delete's a player from the cache without destroying it on lavalink (only works when it's disconnected)
|
|
2981
2984
|
* @param guildId
|
|
@@ -3013,7 +3016,7 @@ declare class LavalinkManager extends EventEmitter {
|
|
|
3013
3016
|
* });
|
|
3014
3017
|
* ```
|
|
3015
3018
|
*/
|
|
3016
|
-
init(clientData: BotClientOptions): Promise<
|
|
3019
|
+
init(clientData: BotClientOptions): Promise<this>;
|
|
3017
3020
|
/**
|
|
3018
3021
|
* Sends voice data to the Lavalink server.
|
|
3019
3022
|
* ! Without this the library won't work
|
package/dist/index.d.ts
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
2705
|
-
"playerResumed": (player:
|
|
2706
|
-
"playerPaused": (player:
|
|
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,7 +2748,7 @@ 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:
|
|
2751
|
+
autoPlayFunction?: (player: CustomPlayerT, lastPlayedTrack: Track) => Promise<void>;
|
|
2752
2752
|
destroyAfterMs?: number;
|
|
2753
2753
|
};
|
|
2754
2754
|
useUnresolvedData?: boolean;
|
|
@@ -2756,9 +2756,10 @@ interface ManagerPlayerOptions {
|
|
|
2756
2756
|
type DeepRequired<T> = {
|
|
2757
2757
|
[K in keyof T]-?: NonNullable<T[K]> extends object ? DeepRequired<NonNullable<T[K]>> : NonNullable<T[K]>;
|
|
2758
2758
|
};
|
|
2759
|
-
type RequiredManagerOptions = DeepRequired<ManagerOptions
|
|
2759
|
+
type RequiredManagerOptions<T extends Player> = DeepRequired<ManagerOptions<T>>;
|
|
2760
|
+
type PlayerConstructor<T extends Player = Player> = new (options: PlayerOptions, LavalinkManager: LavalinkManager, dontEmitPlayerCreateEvent?: boolean) => T;
|
|
2760
2761
|
/** Manager Options used to create the manager */
|
|
2761
|
-
interface ManagerOptions {
|
|
2762
|
+
interface ManagerOptions<CustomPlayerT extends Player = Player> {
|
|
2762
2763
|
/** The Node Options, for all Nodes! (on init) */
|
|
2763
2764
|
nodes: LavalinkNodeOptions[];
|
|
2764
2765
|
/** @async The Function to send the voice connection changes from Lavalink to Discord */
|
|
@@ -2766,9 +2767,11 @@ interface ManagerOptions {
|
|
|
2766
2767
|
/** The Bot Client's Data for Authorization */
|
|
2767
2768
|
client?: BotClientOptions;
|
|
2768
2769
|
/** QueueOptions for all Queues */
|
|
2769
|
-
queueOptions?: ManagerQueueOptions
|
|
2770
|
+
queueOptions?: ManagerQueueOptions<CustomPlayerT>;
|
|
2770
2771
|
/** PlayerOptions for all Players */
|
|
2771
|
-
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>;
|
|
2772
2775
|
/** If it should skip to the next Track on TrackEnd / TrackError etc. events */
|
|
2773
2776
|
autoSkip?: boolean;
|
|
2774
2777
|
/** If it should automatically move the player to the next node when node is down */
|
|
@@ -2806,44 +2809,44 @@ interface ManagerOptions {
|
|
|
2806
2809
|
};
|
|
2807
2810
|
}
|
|
2808
2811
|
|
|
2809
|
-
declare class LavalinkManager extends EventEmitter {
|
|
2812
|
+
declare class LavalinkManager<CustomPlayerT extends Player = Player> extends EventEmitter {
|
|
2810
2813
|
/**
|
|
2811
2814
|
* Emit an event
|
|
2812
2815
|
* @param event The event to emit
|
|
2813
2816
|
* @param args The arguments to pass to the event
|
|
2814
2817
|
* @returns
|
|
2815
2818
|
*/
|
|
2816
|
-
emit<Event extends keyof LavalinkManagerEvents
|
|
2819
|
+
emit<Event extends keyof LavalinkManagerEvents<CustomPlayerT>>(event: Event, ...args: Parameters<LavalinkManagerEvents<CustomPlayerT>[Event]>): boolean;
|
|
2817
2820
|
/**
|
|
2818
2821
|
* Add an event listener
|
|
2819
2822
|
* @param event The event to listen to
|
|
2820
2823
|
* @param listener The listener to add
|
|
2821
2824
|
* @returns
|
|
2822
2825
|
*/
|
|
2823
|
-
on<Event extends keyof LavalinkManagerEvents
|
|
2826
|
+
on<Event extends keyof LavalinkManagerEvents<CustomPlayerT>>(event: Event, listener: LavalinkManagerEvents<CustomPlayerT>[Event]): this;
|
|
2824
2827
|
/**
|
|
2825
2828
|
* Add an event listener that only fires once
|
|
2826
2829
|
* @param event The event to listen to
|
|
2827
2830
|
* @param listener The listener to add
|
|
2828
2831
|
* @returns
|
|
2829
2832
|
*/
|
|
2830
|
-
once<Event extends keyof LavalinkManagerEvents
|
|
2833
|
+
once<Event extends keyof LavalinkManagerEvents<CustomPlayerT>>(event: Event, listener: LavalinkManagerEvents<CustomPlayerT>[Event]): this;
|
|
2831
2834
|
/**
|
|
2832
2835
|
* Remove an event listener
|
|
2833
2836
|
* @param event The event to remove the listener from
|
|
2834
2837
|
* @param listener The listener to remove
|
|
2835
2838
|
* @returns
|
|
2836
2839
|
*/
|
|
2837
|
-
off<Event extends keyof LavalinkManagerEvents
|
|
2840
|
+
off<Event extends keyof LavalinkManagerEvents<CustomPlayerT>>(event: Event, listener: LavalinkManagerEvents<CustomPlayerT>[Event]): this;
|
|
2838
2841
|
/**
|
|
2839
2842
|
* Remove an event listener
|
|
2840
2843
|
* @param event The event to remove the listener from
|
|
2841
2844
|
* @param listener The listener to remove
|
|
2842
2845
|
* @returns
|
|
2843
2846
|
*/
|
|
2844
|
-
removeListener<Event extends keyof LavalinkManagerEvents
|
|
2847
|
+
removeListener<Event extends keyof LavalinkManagerEvents<CustomPlayerT>>(event: Event, listener: LavalinkManagerEvents<CustomPlayerT>[Event]): this;
|
|
2845
2848
|
/** The Options of LavalinkManager (changeable) */
|
|
2846
|
-
options: ManagerOptions
|
|
2849
|
+
options: ManagerOptions<CustomPlayerT>;
|
|
2847
2850
|
/** LavalinkManager's NodeManager to manage all Nodes */
|
|
2848
2851
|
nodeManager: NodeManager;
|
|
2849
2852
|
/** LavalinkManager's Utils Class */
|
|
@@ -2851,7 +2854,7 @@ declare class LavalinkManager extends EventEmitter {
|
|
|
2851
2854
|
/** Wether the manager was initiated or not */
|
|
2852
2855
|
initiated: boolean;
|
|
2853
2856
|
/** All Players stored in a MiniMap */
|
|
2854
|
-
readonly players: MiniMap<string,
|
|
2857
|
+
readonly players: MiniMap<string, CustomPlayerT>;
|
|
2855
2858
|
/**
|
|
2856
2859
|
* Applies the options provided by the User
|
|
2857
2860
|
* @param options
|
|
@@ -2922,7 +2925,7 @@ declare class LavalinkManager extends EventEmitter {
|
|
|
2922
2925
|
* })
|
|
2923
2926
|
* ```
|
|
2924
2927
|
*/
|
|
2925
|
-
constructor(options: ManagerOptions);
|
|
2928
|
+
constructor(options: ManagerOptions<CustomPlayerT>);
|
|
2926
2929
|
/**
|
|
2927
2930
|
* Get a Player from Lava
|
|
2928
2931
|
* @param guildId The guildId of the player
|
|
@@ -2937,7 +2940,7 @@ declare class LavalinkManager extends EventEmitter {
|
|
|
2937
2940
|
* ```
|
|
2938
2941
|
* @returns
|
|
2939
2942
|
*/
|
|
2940
|
-
getPlayer(guildId: string):
|
|
2943
|
+
getPlayer(guildId: string): CustomPlayerT | undefined;
|
|
2941
2944
|
/**
|
|
2942
2945
|
* Create a Music-Player. If a player exists, then it returns it before creating a new one
|
|
2943
2946
|
* @param options
|
|
@@ -2962,7 +2965,7 @@ declare class LavalinkManager extends EventEmitter {
|
|
|
2962
2965
|
* });
|
|
2963
2966
|
* ```
|
|
2964
2967
|
*/
|
|
2965
|
-
createPlayer(options: PlayerOptions):
|
|
2968
|
+
createPlayer(options: PlayerOptions): CustomPlayerT;
|
|
2966
2969
|
/**
|
|
2967
2970
|
* Destroy a player with optional destroy reason and disconnect it from the voice channel
|
|
2968
2971
|
* @param guildId
|
|
@@ -2975,7 +2978,7 @@ declare class LavalinkManager extends EventEmitter {
|
|
|
2975
2978
|
* // recommend to do it on the player tho: player.destroy("forcefully destroyed the player");
|
|
2976
2979
|
* ```
|
|
2977
2980
|
*/
|
|
2978
|
-
destroyPlayer(guildId: string, destroyReason?: string): Promise<void |
|
|
2981
|
+
destroyPlayer(guildId: string, destroyReason?: string): Promise<void | CustomPlayerT>;
|
|
2979
2982
|
/**
|
|
2980
2983
|
* Delete's a player from the cache without destroying it on lavalink (only works when it's disconnected)
|
|
2981
2984
|
* @param guildId
|
|
@@ -3013,7 +3016,7 @@ declare class LavalinkManager extends EventEmitter {
|
|
|
3013
3016
|
* });
|
|
3014
3017
|
* ```
|
|
3015
3018
|
*/
|
|
3016
|
-
init(clientData: BotClientOptions): Promise<
|
|
3019
|
+
init(clientData: BotClientOptions): Promise<this>;
|
|
3017
3020
|
/**
|
|
3018
3021
|
* Sends voice data to the Lavalink server.
|
|
3019
3022
|
* ! Without this the library won't work
|
package/dist/index.js
CHANGED
|
@@ -4463,7 +4463,6 @@ var LavalinkManager = class extends import_events2.EventEmitter {
|
|
|
4463
4463
|
applyOptions(options) {
|
|
4464
4464
|
const optionsToAssign = {
|
|
4465
4465
|
...options,
|
|
4466
|
-
// allow users to apply other options if they need to.
|
|
4467
4466
|
client: {
|
|
4468
4467
|
...options?.client,
|
|
4469
4468
|
id: options?.client?.id,
|
|
@@ -4472,6 +4471,7 @@ var LavalinkManager = class extends import_events2.EventEmitter {
|
|
|
4472
4471
|
sendToShard: options?.sendToShard,
|
|
4473
4472
|
autoMove: options?.autoMove ?? false,
|
|
4474
4473
|
nodes: options?.nodes,
|
|
4474
|
+
playerClass: options?.playerClass ?? Player,
|
|
4475
4475
|
playerOptions: {
|
|
4476
4476
|
applyVolumeAsFilter: options?.playerOptions?.applyVolumeAsFilter ?? false,
|
|
4477
4477
|
clientBasedPositionUpdateInterval: options?.playerOptions?.clientBasedPositionUpdateInterval ?? 100,
|
|
@@ -4654,7 +4654,7 @@ var LavalinkManager = class extends import_events2.EventEmitter {
|
|
|
4654
4654
|
createPlayer(options) {
|
|
4655
4655
|
const oldPlayer = this.getPlayer(options?.guildId);
|
|
4656
4656
|
if (oldPlayer) return oldPlayer;
|
|
4657
|
-
const newPlayer = new
|
|
4657
|
+
const newPlayer = new this.options.playerClass(options, this, true);
|
|
4658
4658
|
this.players.set(newPlayer.guildId, newPlayer);
|
|
4659
4659
|
this.emit("playerCreate", newPlayer);
|
|
4660
4660
|
return newPlayer;
|
package/dist/index.mjs
CHANGED
|
@@ -4403,7 +4403,6 @@ var LavalinkManager = class extends EventEmitter2 {
|
|
|
4403
4403
|
applyOptions(options) {
|
|
4404
4404
|
const optionsToAssign = {
|
|
4405
4405
|
...options,
|
|
4406
|
-
// allow users to apply other options if they need to.
|
|
4407
4406
|
client: {
|
|
4408
4407
|
...options?.client,
|
|
4409
4408
|
id: options?.client?.id,
|
|
@@ -4412,6 +4411,7 @@ var LavalinkManager = class extends EventEmitter2 {
|
|
|
4412
4411
|
sendToShard: options?.sendToShard,
|
|
4413
4412
|
autoMove: options?.autoMove ?? false,
|
|
4414
4413
|
nodes: options?.nodes,
|
|
4414
|
+
playerClass: options?.playerClass ?? Player,
|
|
4415
4415
|
playerOptions: {
|
|
4416
4416
|
applyVolumeAsFilter: options?.playerOptions?.applyVolumeAsFilter ?? false,
|
|
4417
4417
|
clientBasedPositionUpdateInterval: options?.playerOptions?.clientBasedPositionUpdateInterval ?? 100,
|
|
@@ -4594,7 +4594,7 @@ var LavalinkManager = class extends EventEmitter2 {
|
|
|
4594
4594
|
createPlayer(options) {
|
|
4595
4595
|
const oldPlayer = this.getPlayer(options?.guildId);
|
|
4596
4596
|
if (oldPlayer) return oldPlayer;
|
|
4597
|
-
const newPlayer = new
|
|
4597
|
+
const newPlayer = new this.options.playerClass(options, this, true);
|
|
4598
4598
|
this.players.set(newPlayer.guildId, newPlayer);
|
|
4599
4599
|
this.emit("playerCreate", newPlayer);
|
|
4600
4600
|
return newPlayer;
|
package/package.json
CHANGED