hoshimi 0.3.5 → 0.3.6

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
@@ -41,6 +41,14 @@ declare class NodeError extends Error {
41
41
  declare class StorageError extends Error {
42
42
  constructor(message: string);
43
43
  }
44
+ /**
45
+ * Error class for the node manager.
46
+ * @class NodeManagerError
47
+ * @extends {Error}
48
+ */
49
+ declare class NodeManagerError extends Error {
50
+ constructor(message: string);
51
+ }
44
52
  /**
45
53
  * Error class for resolving tracks.
46
54
  * @class ResolveError
@@ -648,2328 +656,2686 @@ interface EnabledDSPXPluginFilters {
648
656
  }
649
657
 
650
658
  /**
651
- * Class representing a storage manager.
652
- * @abstract
653
- * @class StorageManager
654
- * @example
655
- * ```ts
656
- * class MyStorageManager extends StorageManager {};
657
- *
658
- * const storage = new MyStorageManager();
659
- * storage.set("key", "value");
660
- *
661
- * const value = await storage.get("key");
662
- * console.log(value); // "value"
663
- * ```
659
+ * The methods for http requests
664
660
  */
665
- declare abstract class StorageAdapter<T extends QueueJson = QueueJson> {
661
+ declare enum HttpMethods {
666
662
  /**
667
- *
668
- * Get the value using the key.
669
- * @param {string} key The key to get the value from.
670
- * @returns {Awaitable<T | undefined>} The value of the key.
671
- * @example
672
- * ```ts
673
- * const value = await storage.get("key");
674
- * console.log(value); // "value"
675
- * ```
663
+ * The GET method requests a representation of the specified resource. Requests using GET should only retrieve data.
664
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/GET
665
+ * @type {string}
676
666
  */
677
- abstract get(key: string): Awaitable<T | undefined>;
667
+ Get = "GET",
678
668
  /**
679
- *
680
- * Set the value using the key.
681
- * @param {string} key The key to set the value to.
682
- * @param {unknown} value The value to set.
683
- * @returns {Awaitable<void>} Did you know this can be async?
684
- * @example
685
- * ```ts
686
- * await storage.set("key", "value");
687
- * ```
669
+ * The POST method is used to submit an entity to the specified resource, often causing a change in state or side effects on the server.
670
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST
671
+ * @type {string}
688
672
  */
689
- abstract set(key: string, value: T): Awaitable<void>;
673
+ Post = "POST",
690
674
  /**
691
- *
692
- * Delete the value using the key.
693
- * @param {string} key The key to delete the value from.
694
- * @returns {Awaitable<boolean>} Returns true if the key was deleted.
695
- * @example
696
- * ```ts
697
- * const success = await storage.delete("key");
698
- * console.log(success); // true
699
- * ```
675
+ * The PUT method replaces all current representations of the target resource with the request payload.
676
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PUT
677
+ * @type {string}
700
678
  */
701
- abstract delete(key: string): Awaitable<boolean>;
679
+ Put = "PUT",
702
680
  /**
703
- * Clear the storage.
704
- * @returns {Awaitable<void>} Scary, right?
705
- * @example
706
- * ```ts
707
- * await storage.clear();
708
- * ```
681
+ * The PATCH method is used to apply partial modifications to a resource.
682
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PATCH
683
+ * @type {string}
709
684
  */
710
- abstract clear(): Awaitable<void>;
685
+ Patch = "PATCH",
711
686
  /**
712
- * Check if the storage has the key.
713
- * @param {string} key The key to check.
714
- * @returns {Awaitable<boolean>} Return true if the key exists.
715
- * @example
716
- * ```ts
717
- * const exists = await storage.has("key");
718
- * console.log(exists); // true
719
- * ```
687
+ * The DELETE method deletes the specified resource.
688
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/DELETE
689
+ * @type {string}
720
690
  */
721
- abstract has(key: string): Awaitable<boolean>;
691
+ Delete = "DELETE",
722
692
  /**
723
- *
724
- * Parse the value.
725
- * @param {unknown} value The value to parse.
726
- * @returns {T} The parsed value.
727
- * @example
728
- * ```ts
729
- * const parsed = await storage.parse<{ key: string }>("{'key':'value'}");
730
- * console.log(parsed); // { key: "value" }
731
- * ```
693
+ * The HEAD method asks for a response identical to that of a GET request, but without the response body.
694
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/HEAD
695
+ * @type {string}
732
696
  */
733
- abstract parse(value: unknown): Awaitable<T>;
697
+ Head = "HEAD"
698
+ }
699
+ declare enum RestPathType {
734
700
  /**
735
- *
736
- * Stringify the value.
737
- * @param {unknown} value The value to stringify.
738
- * @returns {R} The stringified value.
739
- * @example
740
- * ```ts
741
- * const stringified = await storage.stringify({ key: "value" });
742
- * console.log(stringified); // "{'key':'value'}"
743
- * ```
701
+ * The raw path of the request.
702
+ * @type {string}
744
703
  */
745
- abstract stringify<R = string>(value: unknown): Awaitable<R>;
704
+ Raw = "/",
705
+ /**
706
+ * The versioned path v4 of the request.
707
+ * @type {string}
708
+ */
709
+ V4 = "/v4"
746
710
  }
747
-
748
711
  /**
749
- * The queue options.
712
+ * The status codes for the REST.
713
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Status
750
714
  */
751
- interface HoshimiQueueOptions {
715
+ declare enum HttpStatusCodes {
752
716
  /**
753
- * The maximum amount of tracks that can be saved in the queue.
717
+ * The request has succeeded.
754
718
  * @type {number}
755
- * @default 25
756
719
  */
757
- maxHistory?: number;
720
+ OK = 200,
758
721
  /**
759
- *
760
- * The function to use for autoplay.
761
- * @param {Player} player The player.
762
- * @param {HoshimiTrack | null} lastTrack The last track played.
722
+ * The request has been fulfilled and resulted in a new resource being created.
723
+ * @type {number}
763
724
  */
764
- autoplayFn?(player: PlayerStructure, lastTrack: HoshimiTrack | null): Awaitable<void>;
725
+ Created = 201,
765
726
  /**
766
- * Enable the auto play for the queue. (By default, only supports `youtube` and `spotify`, add more with your own function)
767
- * @type {boolean}
768
- * @default false
727
+ * The request has been accepted for processing, but the processing has not been completed.
728
+ * @type {number}
769
729
  */
770
- autoPlay?: boolean;
730
+ Accepted = 202,
771
731
  /**
772
- * The storage manager to use for the queue.
773
- * @type {StorageAdapter}
774
- * @default {MemoryAdapter}
732
+ * The server successfully processed the request, but is not returning any content.
733
+ * @type {number}
775
734
  */
776
- storage?: StorageAdapter;
777
- }
778
- /**
779
- * The queue json.
780
- */
781
- interface QueueJson {
735
+ NoContent = 204,
782
736
  /**
783
- * The tracks of the queue.
784
- * @type {HoshimiTrack[]}
737
+ * The resource has been moved permanently to a new URI.
738
+ * @type {number}
785
739
  */
786
- tracks: HoshimiTrack[];
740
+ MovedPermanently = 301,
787
741
  /**
788
- * The previous tracks of the queue.
789
- * @type {Track[]}
742
+ * The requested resource has been found at a different URI.
743
+ * @type {number}
790
744
  */
791
- history: Track[];
745
+ Found = 302,
792
746
  /**
793
- * The current track of the queue.
794
- * @type {Track | null}
747
+ * The resource has not been modified since the last request.
748
+ * @type {number}
795
749
  */
796
- current: Track | null;
797
- }
798
-
799
- /**
800
- * Partial Lavalink track type.
801
- */
802
- type PartialLavalinkTrack = Partial<Nullable<LavalinkTrack>>;
803
- /**
804
- * The base options for playing a track.
805
- */
806
- interface BasePlayOptions {
750
+ NotModified = 304,
807
751
  /**
808
- * The position to start the track.
809
- * @type {number | undefined}
752
+ * The request cannot be processed due to bad syntax.
753
+ * @type {number}
810
754
  */
811
- position?: number;
755
+ BadRequest = 400,
812
756
  /**
813
- * The position to end the track.
814
- * @type {number | undefined}
757
+ * The request requires user authentication.
758
+ * @type {number}
815
759
  */
816
- endTime?: number;
760
+ Unauthorized = 401,
817
761
  /**
818
- * The pause state of the player.
819
- * @type {boolean | undefined}
762
+ * The request was valid, but the server is refusing action.
763
+ * @type {number}
820
764
  */
821
- paused?: boolean;
765
+ Forbidden = 403,
822
766
  /**
823
- * The volume of the player.
824
- * @type {number | undefined}
767
+ * The server cannot find the requested resource.
768
+ * @type {number}
825
769
  */
826
- volume?: number;
770
+ NotFound = 404,
827
771
  /**
828
- * The filters for the player.
829
- * @type {Partial<FilterSettings> | undefined}
772
+ * The request method is known by the server but has been disabled and cannot be used.
773
+ * @type {number}
830
774
  */
831
- filters?: Partial<FilterSettings>;
775
+ MethodNotAllowed = 405,
832
776
  /**
833
- * The voice settings for the player.
834
- * @type {LavalinkPlayerVoice | undefined}
777
+ * The server timed out waiting for the request.
778
+ * @type {number}
835
779
  */
836
- voice?: LavalinkPlayerVoice;
837
- }
838
- /**
839
- * The types of loop modes.
840
- */
841
- declare enum LoopMode {
780
+ RequestTimeout = 408,
842
781
  /**
843
- * Loop mode for repeating the current track.
782
+ * The request could not be completed due to a conflict with the current state of the resource.
783
+ * @type {number}
844
784
  */
845
- Track = 1,
785
+ Conflict = 409,
846
786
  /**
847
- * Loop mode for repeating the queue.
787
+ * The requested resource is no longer available and will not be available again.
788
+ * @type {number}
848
789
  */
849
- Queue = 2,
790
+ Gone = 410,
850
791
  /**
851
- * Loop mode for repeating nothing.
792
+ * The user has sent too many requests in a given amount of time.
793
+ * @type {number}
852
794
  */
853
- Off = 3
854
- }
855
- /**
856
- * The types of player events.
857
- */
858
- declare enum PlayerEventType {
795
+ TooManyRequests = 429,
859
796
  /**
860
- * Event type for when a track starts.
797
+ * A generic error message, given when no more specific message is suitable.
798
+ * @type {number}
861
799
  */
862
- TrackStart = "TrackStartEvent",
800
+ InternalServerError = 500,
863
801
  /**
864
- * Event type for when a track ends.
802
+ * The server does not recognize the request method or lacks the ability to fulfill it.
803
+ * @type {number}
865
804
  */
866
- TrackEnd = "TrackEndEvent",
805
+ NotImplemented = 501,
867
806
  /**
868
- * Event type for when a track encounters an exception.
807
+ * The server was acting as a gateway and received an invalid response.
808
+ * @type {number}
869
809
  */
870
- TrackException = "TrackExceptionEvent",
810
+ BadGateway = 502,
871
811
  /**
872
- * Event type for when a track gets stuck.
812
+ * The server is currently unavailable (overloaded or down).
813
+ * @type {number}
873
814
  */
874
- TrackStuck = "TrackStuckEvent",
815
+ ServiceUnavailable = 503,
875
816
  /**
876
- * Event type for when lyrics are found.
817
+ * The server did not receive a timely response from an upstream server.
818
+ * @type {number}
877
819
  */
878
- LyricsFound = "LyricsFoundEvent",
820
+ GatewayTimeout = 504
821
+ }
822
+ /**
823
+ * The REST routes.
824
+ */
825
+ declare const RestRoutes: {
879
826
  /**
880
- * Event type for when lyrics are not found.
827
+ *
828
+ * Get the updated player endpoint.
829
+ * @param {string} sessionId The session id of the node.
830
+ * @param {string} guildId The guild id of the player.
831
+ * @returns {RestEndpoint} The endpoint for updating the player.
881
832
  */
882
- LyricsNotFound = "LyricsNotFoundEvent",
833
+ UpdatePlayer(sessionId: string, guildId: string): `/sessions/${string}/players/${string}`;
883
834
  /**
884
- * Event type for when a lyrics line is sent.
835
+ *
836
+ * Get the update session endpoint.
837
+ * @param {string} sessionId The session id of the node.
838
+ * @returns {RestEndpoint} The endpoint for updating the session.
885
839
  */
886
- LyricsLine = "LyricsLineEvent",
840
+ UpdateSession(sessionId: string): `/sessions/${string}`;
887
841
  /**
888
- * Event type for when the WebSocket connection is closed.
842
+ *
843
+ * Get the get players endpoint.
844
+ * @param {string} sessionId The session id of the node.
845
+ * @returns {RestEndpoint} The endpoint for getting the players.
889
846
  */
890
- WebsocketClosed = "WebSocketClosedEvent"
891
- }
892
- /**
893
- * The reasons a track can end.
894
- */
895
- declare enum TrackEndReason {
847
+ GetPlayers(sessionId: string): `/sessions/${string}/players`;
896
848
  /**
897
- * The track ended normally.
849
+ *
850
+ * Get the current lyrics endpoint.
851
+ * @param {string} sessionId The session id of the node.
852
+ * @param {string} guildId The guild id of the player.
853
+ * @returns {RestEndpoint} The endpoint for getting the current lyrics.
898
854
  */
899
- Finished = "finished",
855
+ CurrentLyrics(sessionId: string, guildId: string): `/sessions/${string}/players/${string}/track/lyrics`;
900
856
  /**
901
- * The track fails to load.
857
+ *
858
+ * Subscribe to lyrics endpoint.
859
+ * @param {string} sessionId The session id of the node.
860
+ * @param {string} guildId The guild id of the player.
861
+ * @returns {RestEndpoint} The endpoint for subscribing to lyrics.
902
862
  */
903
- LoadFailed = "loadFailed",
863
+ SubscribeLyrics(sessionId: string, guildId: string): `/sessions/${string}/players/${string}/lyrics/subscribe`;
904
864
  /**
905
- * The track was stopped.
865
+ * Get the lyrics endpoint.
866
+ * @type {RestEndpoint}
906
867
  */
907
- Stopped = "stopped",
868
+ GetLyrics: "/lyrics";
908
869
  /**
909
- * The track was replaced.
870
+ * Get the decode track endpoint.
871
+ * @type {RestEndpoint}
910
872
  */
911
- Replaced = "replaced",
873
+ DecodeTrack: "/decodetrack";
912
874
  /**
913
- * The track was cleaned up.
875
+ * Get the decode tracks endpoint.
876
+ * @type {RestEndpoint}
914
877
  */
915
- Cleanup = "cleanup"
916
- }
917
- /**
918
- * The options for automatic player error handling.
919
- */
920
- interface ErrorPlayerActions {
878
+ DecodeTracks: "/decodetracks";
921
879
  /**
922
- * Whether to automatically destroy the player on error.
923
- * @type {boolean | undefined}
924
- * @default false
880
+ * Get the load tracks endpoint.
881
+ * @type {RestEndpoint}
925
882
  */
926
- autoDestroy?: boolean;
883
+ LoadTracks: "/loadtracks";
927
884
  /**
928
- * Whether to automatically skip the track on error.
929
- * @type {boolean | undefined}
930
- * @default false
885
+ * Get the node info endpoint.
886
+ * @type {RestEndpoint}
931
887
  */
932
- autoSkip?: boolean;
888
+ NodeInfo: "/info";
933
889
  /**
934
- * Whether to automatically stop the player on error.
935
- * @type {boolean | undefined}
936
- * @default false
890
+ * Get the load lyrics endpoint.
891
+ * @type {RestEndpoint}
892
+ * @description Used in NodelinkLyricsManager, only for nodelink nodes.
937
893
  */
938
- autoStop?: boolean;
939
- }
894
+ LoadLyrics: "/loadlyrics";
895
+ /**
896
+ * Get the connection endpoint.
897
+ * @type {RestEndpoint}
898
+ * @description Used for checking the connection status of the node, only for nodelink nodes.
899
+ */
900
+ Connection: "/connection";
901
+ };
940
902
  /**
941
- * The options for error actions.
903
+ * The options for the REST.
942
904
  */
943
- interface DisconnectPlayerActions extends Pick<ErrorPlayerActions, "autoDestroy"> {
905
+ interface RestOptions {
944
906
  /**
945
- * Whether to automatically reconnect on disconnect.
946
- * @type {boolean | undefined}
947
- * @default false
907
+ * The endpoint for the REST.
908
+ * @type {RestEndpoint}
948
909
  */
949
- autoReconnect?: boolean;
910
+ endpoint: RestEndpoint;
950
911
  /**
951
- * Whether to automatically add tracks back to the queue on disconnect.
952
- * @type {boolean | undefined}
953
- * @default false
912
+ * The method for the REST.
913
+ * @type {HttpMethods}
954
914
  */
955
- autoQueue?: boolean;
956
- }
957
- /**
958
- * The Hoshimi player options.
959
- */
960
- interface HoshimiPlayerOptions {
915
+ method?: HttpMethods;
961
916
  /**
962
- *
963
- * The function to use to get the requester data.
964
- * @param {TrackRequester} requester The requester of the track.
917
+ * The headers for the REST.
918
+ * @type {Record<string, string>}
965
919
  */
966
- requesterFn?<T extends TrackRequester = TrackRequester>(requester: TrackRequester): Awaitable<T>;
920
+ headers?: Record<string, string>;
967
921
  /**
968
- * The options for handling errors.
969
- * @type {ErrorPlayerActions | undefined}
922
+ * The body for the REST.
923
+ * @type {Record<string, unknown> | string | undefined}
970
924
  */
971
- onError?: ErrorPlayerActions;
925
+ body?: Record<string, unknown> | string;
972
926
  /**
973
- * The options for handling disconnects.
974
- * @type {DisconnectPlayerActions | undefined}
927
+ * The query parameters for the REST.
928
+ * @type {Record<string, string>}
975
929
  */
976
- onDisconnect?: DisconnectPlayerActions;
930
+ params?: Record<string, string>;
931
+ /**
932
+ * The path type for the REST.
933
+ * @type {RestPathType}
934
+ */
935
+ pathType?: RestPathType;
977
936
  }
978
937
  /**
979
- * The base interface for player events.
938
+ * The fetch options for the request.
980
939
  */
981
- interface PlayerEvent {
940
+ interface FetchOptions extends Omit<RestOptions, "endpoint" | "body"> {
982
941
  /**
983
- * The operation code for the event.
984
- * @type {OpCodes.Event}
942
+ * The signal for the request.
985
943
  */
986
- op: OpCodes.Event;
944
+ signal: AbortSignal;
987
945
  /**
988
- * The guild ID associated with the event.
989
- * @type {string}
946
+ * The stringified body for the request.
990
947
  */
991
- guildId: string;
948
+ body?: string;
992
949
  }
993
950
  /**
994
- * The event for when a track starts playing.
951
+ * The error for the REST.
995
952
  */
996
- interface TrackStartEvent extends PlayerEvent {
953
+ interface LavalinkRestError {
997
954
  /**
998
- * The type of the event.
999
- * @type {PlayerEventType.TrackStart}
955
+ * The timestamp for the REST.
956
+ * @type {number}
1000
957
  */
1001
- type: PlayerEventType.TrackStart;
958
+ timestamp: number;
1002
959
  /**
1003
- * The track that started playing.
1004
- * @type {LavalinkTrack}
960
+ * The status for the REST.
961
+ * @type {number}
1005
962
  */
1006
- track: LavalinkTrack;
1007
- }
1008
- /**
1009
- * The event for when a track ends.
1010
- */
1011
- interface TrackEndEvent extends PlayerEvent {
963
+ status: number;
1012
964
  /**
1013
- * The type of the event.
1014
- * @type {PlayerEventType.TrackEnd}
965
+ * The error for the REST.
966
+ * @type {string}
1015
967
  */
1016
- type: PlayerEventType.TrackEnd;
968
+ error: string;
1017
969
  /**
1018
- * The track that ended.
1019
- * @type {LavalinkTrack}
970
+ * The trace for the REST.
971
+ * @type {string}
1020
972
  */
1021
- track: LavalinkTrack;
973
+ trace?: string;
1022
974
  /**
1023
- * The reason the track ended.
1024
- * @type {TrackEndReason}
975
+ * The message for the REST.
976
+ * @type {string}
1025
977
  */
1026
- reason: TrackEndReason;
978
+ message: string;
979
+ /**
980
+ * The path for the REST.
981
+ * @type {string}
982
+ */
983
+ path: string;
1027
984
  }
1028
985
  /**
1029
- * The event for when a track gets stuck.
986
+ * The player response from the Lavalink REST API.
1030
987
  */
1031
- interface TrackStuckEvent extends PlayerEvent {
988
+ interface LavalinkPlayer {
1032
989
  /**
1033
- * The type of the event.
1034
- * @type {PlayerEventType.TrackStuck}
990
+ * The guild ID associated with the player.
991
+ * @type {string}
1035
992
  */
1036
- type: PlayerEventType.TrackStuck;
993
+ guildId: string;
1037
994
  /**
1038
- * The track that got stuck.
995
+ * The track currently being played.
1039
996
  * @type {LavalinkTrack}
1040
997
  */
1041
- track: LavalinkTrack;
998
+ track?: LavalinkTrack;
1042
999
  /**
1043
- * The threshold in milliseconds.
1000
+ * The volume of the player.
1044
1001
  * @type {number}
1045
1002
  */
1046
- thresholdMs: number;
1047
- }
1048
- /**
1049
- * The event for when a track encounters an exception.
1050
- */
1051
- interface TrackExceptionEvent extends PlayerEvent {
1003
+ volume: number;
1052
1004
  /**
1053
- * The type of the event.
1054
- * @type {PlayerEventType.TrackException}
1005
+ * Whether the player is paused.
1006
+ * @type {boolean}
1055
1007
  */
1056
- type: PlayerEventType.TrackException;
1008
+ paused: boolean;
1057
1009
  /**
1058
- * The exception that occurred.
1059
- * @type {Exception}
1010
+ * The voice connection details.
1011
+ * @type {LavalinkPlayerVoice}
1060
1012
  */
1061
- exception: Exception;
1013
+ voice: LavalinkPlayerVoice;
1014
+ /**
1015
+ * The filter options applied to the player.
1016
+ * @type {FilterSettings}
1017
+ */
1018
+ filters: FilterSettings;
1019
+ /**
1020
+ * The state of the player.
1021
+ * @type {LavalinkPlayerState}
1022
+ */
1023
+ state: LavalinkPlayerState;
1062
1024
  }
1063
1025
  /**
1064
- * The event for when the WebSocket connection is closed.
1026
+ * The state of the player.
1065
1027
  */
1066
- interface WebSocketClosedEvent extends PlayerEvent {
1028
+ interface LavalinkPlayerState {
1067
1029
  /**
1068
- * The type of the event.
1069
- * @type {PlayerEventType.WebsocketClosed}
1030
+ * The time since the connection was established.
1031
+ * @type {number}
1070
1032
  */
1071
- type: PlayerEventType.WebsocketClosed;
1033
+ time: number;
1072
1034
  /**
1073
- * The close code.
1035
+ * The position of the current track in milliseconds.
1074
1036
  * @type {number}
1075
1037
  */
1076
- code: number;
1038
+ position: number;
1077
1039
  /**
1078
- * Whether the connection was closed by the remote.
1040
+ * Whether the player is connected to the voice channel.
1079
1041
  * @type {boolean}
1080
1042
  */
1081
- byRemote: boolean;
1043
+ connected: boolean;
1082
1044
  /**
1083
- * The reason for the closure.
1084
- * @type {string}
1045
+ * The ping to the voice server in milliseconds.
1046
+ * @type {number}
1085
1047
  */
1086
- reason: string;
1048
+ ping: number;
1087
1049
  }
1088
1050
  /**
1089
- * The event for when lyrics are found.
1051
+ * The options to update the player.
1090
1052
  */
1091
- interface LyricsFoundEvent extends PlayerEvent {
1092
- /**
1093
- * The type of the event.
1094
- * @type {PlayerEventType.LyricsFound}
1095
- */
1096
- type: PlayerEventType.LyricsFound;
1053
+ interface UpdatePlayerInfo {
1097
1054
  /**
1098
- * The guild id associated with the event.
1055
+ * The guild id associated with the player.
1099
1056
  * @type {string}
1100
1057
  */
1101
1058
  guildId: string;
1102
1059
  /**
1103
- * The lyrics result of the event.
1104
- * @type {LyricsResult}
1060
+ * The options to update the player.
1061
+ * @type {LavalinkPlayOptions}
1105
1062
  */
1106
- lyrics: LyricsResult;
1063
+ playerOptions: LavalinkPlayOptions;
1064
+ /**
1065
+ * Whether to replace the current track.
1066
+ * @type {boolean | undefined}
1067
+ * @default false
1068
+ */
1069
+ noReplace?: boolean;
1107
1070
  }
1108
1071
  /**
1109
- * The event for when lyrics are not found.
1072
+ * The updated session of the current session.
1110
1073
  */
1111
- interface LyricsNotFoundEvent extends PlayerEvent {
1074
+ interface LavalinkSession {
1112
1075
  /**
1113
- * The type of the event.
1114
- * @type {PlayerEventType.LyricsNotFound}
1076
+ * Whather the session is resuming.
1077
+ * @type {boolean}
1115
1078
  */
1116
- type: PlayerEventType.LyricsNotFound;
1079
+ resuming: boolean;
1117
1080
  /**
1118
- * The guild id associated with the event.
1119
- * @type {string}
1081
+ * The timeout for the session.
1082
+ * @type {number}
1120
1083
  */
1121
- guildId: string;
1084
+ timeout: number;
1122
1085
  }
1123
1086
  /**
1124
- * The event for when a lyrics line is sent.
1087
+ * The rest options.
1125
1088
  */
1126
- interface LyricsLineEvent extends PlayerEvent {
1127
- /**
1128
- * The type of the event.
1129
- * @type {PlayerEventType.LyricsLine}
1130
- */
1131
- type: PlayerEventType.LyricsLine;
1089
+ interface HoshimiRestOptions {
1132
1090
  /**
1133
- * The guild id associated with the event.
1134
- * @type {string}
1135
- */
1136
- guildId: string;
1137
- /**
1138
- * The line index of the lyrics line.
1091
+ * The amount of time to wait for the player to resume. (in milliseconds)
1139
1092
  * @type {number}
1093
+ * @default 10000
1140
1094
  */
1141
- lineIndex: number;
1142
- /**
1143
- * The lyrics line of the event.
1144
- * @type {LyricsLine}
1145
- */
1146
- line: LyricsLine;
1147
- /**
1148
- * Returns if the line was skipped.
1149
- * @type {boolean}
1150
- */
1151
- skipped: boolean;
1095
+ resumeTimeout?: number;
1152
1096
  }
1153
1097
  /**
1154
- * The update for the player state.
1098
+ * The methods for decoding base64 encoded tracks.
1155
1099
  */
1156
- interface PlayerUpdate {
1157
- /**
1158
- * The operation code for the update.
1159
- * @type {OpCodes.PlayerUpdate}
1160
- */
1161
- op: OpCodes.PlayerUpdate;
1100
+ interface DecodeMethods {
1162
1101
  /**
1163
- * The guild ID associated with the update.
1164
- * @type {string}
1102
+ *
1103
+ * Decodes a single base64 encoded track.
1104
+ * @param {string} track The base64 encoded track.
1105
+ * @param {TrackRequester} requester The requester of the track.
1106
+ * @return {Promise<Track>} The decoded track.
1107
+ * @example
1108
+ * ```ts
1109
+ * const node = player.node;
1110
+ * const track = await node.decode.single("base64EncodedTrack");
1111
+ * console.log(track.info.title); // Track Title
1112
+ * ```
1165
1113
  */
1166
- guildId: string;
1114
+ single(track: string, requester: TrackRequester): Promise<Track>;
1167
1115
  /**
1168
- * The state of the player.
1169
- * @type {PlayerUpdateState}
1116
+ * Decodes multiple base64 encoded tracks.
1117
+ * @param {string[]} tracks The base64 encoded tracks.
1118
+ * @param {TrackRequester} requester The requester of the tracks.
1119
+ * @return {Promise<Track[]>} The decoded tracks.
1120
+ * @example
1121
+ * ```ts
1122
+ * const node = player.node;
1123
+ * const tracks = await node.decode.multiple(["base64EncodedTrack1", "base64EncodedTrack2"]);
1124
+ * console.log(tracks[0].info.title); // Track Title 1
1125
+ * console.log(tracks[1].info.title); // Track Title 2
1126
+ * ```
1170
1127
  */
1171
- state: PlayerUpdateState;
1128
+ multiple(tracks: string[], requester: TrackRequester): Promise<Track[]>;
1172
1129
  }
1173
- interface PlayerUpdateState {
1130
+ /**
1131
+ * The options for resuming a session.
1132
+ */
1133
+ interface SessionResumingOptions {
1174
1134
  /**
1175
- * Whether the player is connected.
1135
+ * Whether the session is resuming.
1176
1136
  * @type {boolean}
1177
1137
  */
1178
- connected: boolean;
1179
- /**
1180
- * The position of the track.
1181
- * @type {number}
1182
- */
1183
- position: number;
1184
- /**
1185
- * The time of the update.
1186
- * @type {number}
1187
- */
1188
- time: number;
1138
+ resuming: boolean;
1189
1139
  /**
1190
- * The ping of the player.
1191
- * @type {number}
1140
+ * The timeout for resuming the session in milliseconds.
1141
+ * @type {number | null | undefined}
1192
1142
  */
1193
- ping: number;
1143
+ timeout?: number | null;
1194
1144
  }
1195
1145
  /**
1196
- * The options for the player.
1146
+ * The session of the node.
1197
1147
  */
1198
- interface PlayerOptions {
1199
- /**
1200
- * Guild id of the player.
1201
- * @type {string}
1202
- */
1203
- guildId: string;
1148
+ type NullableLavalinkSession = PickNullable<LavalinkSession, "timeout">;
1149
+ /**
1150
+ * The REST endpoint type.
1151
+ */
1152
+ type RestEndpoint = `/${string}`;
1153
+
1154
+ /**
1155
+ * Class representing the DSPX Plugin filters for a player.
1156
+ * @class DSPXPluginFilter
1157
+ */
1158
+ declare class DSPXPluginFilter {
1204
1159
  /**
1205
- * Voice channel id of the player.
1206
- * @type {string}
1160
+ * The filter manager instance.
1161
+ * @type {FilterManagerStructure}
1162
+ * @readonly
1207
1163
  */
1208
- voiceId: string;
1164
+ readonly manager: FilterManagerStructure;
1209
1165
  /**
1210
- * Volume of the player.
1211
- * @type {number | undefined}
1212
- * @default 100
1166
+ * Create a new DSPXPluginFilter instance.
1167
+ * @param {FilterManagerStructure} manager The filter manager instance.
1213
1168
  */
1214
- volume?: number;
1169
+ constructor(manager: FilterManagerStructure);
1215
1170
  /**
1216
- * Set if the player should be deafened.
1217
- * @type {boolean | undefined}
1218
- * @default true
1171
+ *
1172
+ * Set the low-pass filter with the given settings.
1173
+ * @param {FilterPluginPassSettings} [settings=DefaultFilter.DSPXLowPass] The settings for the low-pass filter.
1174
+ * @returns {Promise<this>} The instance of the filter manager.
1175
+ * @throws {PlayerError} If the node does not have the required plugin or filter enabled.
1176
+ * @example
1177
+ * ```ts
1178
+ * // Set the low-pass filter with custom settings
1179
+ * await player.filterManager.dspxPlugin.setLowPass({ cutoffFrequency: 500, boostFactor: 1.5 });
1180
+ * // Disable the low-pass filter
1181
+ * await player.filterManager.dspxPlugin.setLowPass();
1182
+ * ```
1219
1183
  */
1220
- selfDeaf?: boolean;
1184
+ setLowPass(settings?: Partial<FilterPluginPassSettings>): Promise<this>;
1221
1185
  /**
1222
- * Set if the player should be muted.
1223
- * @type {boolean | undefined}
1224
- * @default false
1186
+ *
1187
+ * Set the high-pass filter with the given settings.
1188
+ * @param {FilterPluginPassSettings} [settings=DefaultFilter.DSPXHighPass] The settings for the high-pass filter.
1189
+ * @returns {Promise<this>} The instance of the filter manager.
1190
+ * @throws {PlayerError} If the node does not have the required plugin or filter enabled.
1191
+ * @example
1192
+ * ```ts
1193
+ * // Set the high-pass filter with custom settings
1194
+ * await player.filterManager.dspxPlugin.setHighPass({ cutoffFrequency: 2000, boostFactor: 0.8 });
1195
+ * // Disable the high-pass filter
1196
+ * await player.filterManager.dspxPlugin.setHighPass();
1197
+ * ```
1225
1198
  */
1226
- selfMute?: boolean;
1199
+ setHighPass(settings?: Partial<FilterPluginPassSettings>): Promise<this>;
1227
1200
  /**
1228
- * Text channel id of the player.
1229
- * @type {string | undefined}
1201
+ *
1202
+ * Set the normalization filter with the given settings.
1203
+ * @param {NormalizationSettings} [settings=DefaultFilter.DSPXNormalization] The settings for the normalization filter.
1204
+ * @returns {Promise<this>} The instance of the filter manager.
1205
+ * @throws {PlayerError} If the node does not have the required plugin or filter enabled.
1206
+ * @example
1207
+ * ```ts
1208
+ * // Set the normalization filter with custom settings
1209
+ * await player.filterManager.dspxPlugin.setNormalization({ maxAmplitude: 0.9, adaptive: true });
1210
+ * // Disable the normalization filter
1211
+ * await player.filterManager.dspxPlugin.setNormalization();
1212
+ * ```
1230
1213
  */
1231
- textId?: string;
1214
+ setNormalization(settings?: Partial<NormalizationSettings>): Promise<this>;
1232
1215
  /**
1233
- * Lavalink node of the player.
1234
- * @type {NodeIdentifier}
1216
+ *
1217
+ * Set the echo filter with the given settings.
1218
+ * @param {EchoSettings} [settings=DefaultFilter.DSPXEcho] The settings for the echo filter.
1219
+ * @returns {Promise<this>} The instance of the filter manager.
1220
+ * @throws {PlayerError} If the node does not have the required plugin or filter enabled.
1221
+ * @example
1222
+ * ```ts
1223
+ * // Set the echo filter with custom settings
1224
+ * await player.filterManager.dspxPlugin.setEcho({ echoLength: 500, decay: 0.5, delay: 200 });
1225
+ * // Disable the echo filter
1226
+ * await player.filterManager.dspxPlugin.setEcho();
1227
+ * ```
1235
1228
  */
1236
- node?: NodeIdentifier;
1229
+ setEcho(settings?: Partial<EchoSettings>): Promise<this>;
1237
1230
  }
1231
+
1232
+ type NonLengthEchoSettings = Omit$1<EchoSettings, "echoLength">;
1238
1233
  /**
1239
- * The options for playing a track with Lavalink.
1234
+ * Class representing Lavalink plugin filters.
1235
+ * @class LavalinkPluginFilter
1240
1236
  */
1241
- interface LavalinkPlayOptions extends BasePlayOptions {
1237
+ declare class LavalinkPluginFilter {
1242
1238
  /**
1243
- * Track to play.
1244
- * @type {PartialLavalinkTrack | undefined}
1239
+ * The filter manager instance.
1240
+ * @type {FilterManagerStructure}
1241
+ * @private
1242
+ * @readonly
1245
1243
  */
1246
- track?: PartialLavalinkTrack;
1247
- }
1248
- /**
1249
- * The options for playing a track.
1250
- */
1251
- interface PlayOptions extends BasePlayOptions {
1244
+ private readonly manager;
1252
1245
  /**
1253
- * Whether to replace the current track.
1254
- * @type {boolean | undefined}
1255
- * @default false
1246
+ * Creates an instance of LavalinkPluginFilter.
1247
+ * @param {FilterManagerStructure} filters - The filter manager instance.
1256
1248
  */
1257
- noReplace?: boolean;
1249
+ constructor(filters: FilterManagerStructure);
1258
1250
  /**
1259
- * Track to play.
1260
- * @type {Track | UnresolvedTrack | undefined}
1251
+ *
1252
+ * Set the echo filter with the given settings.
1253
+ * @param {Omit<EchoSettings, "echoLength">} [settings=DefaultFilter.PluginEcho] The settings for the echo filter.
1254
+ * @returns {Promise<this>} The instance of the filter manager.
1255
+ * @throws {PlayerError} If the node does not have the required plugin or filter enabled.
1256
+ * @example
1257
+ * ```ts
1258
+ * // Set the echo filter with custom settings
1259
+ * await player.filterManager.lavalinkPlugin.setEcho({ decay: 0.5, delay: 200 });
1260
+ * // Disable the echo filter
1261
+ * await player.filterManager.lavalinkPlugin.setEcho();
1262
+ * ```
1261
1263
  */
1262
- track?: Track | UnresolvedTrack;
1263
- }
1264
- interface PlayerVoice {
1264
+ setEcho(settings?: Partial<NonLengthEchoSettings>): Promise<this>;
1265
1265
  /**
1266
- * The voice server token.
1267
- * @type {string}
1266
+ *
1267
+ * Set the reverb filter with the given settings.
1268
+ * @param {Partial<LavalinkFilterPluginReverbSettings>} [settings=DefaultFilter.PluginReverb] The settings for the reverb filter.
1269
+ * @returns {Promise<this>} The instance of the filter manager.
1270
+ * @throws {PlayerError} If the node does not have the required plugin or filter enabled.
1271
+ * @example
1272
+ * ```ts
1273
+ * // Set the reverb filter with custom settings
1274
+ * await player.filterManager.lavalinkPlugin.setReverb({ delays: [50, 100, 150], gains: [0.5, 0.3, 0.2] });
1275
+ * // Disable the reverb filter
1276
+ * await player.filterManager.lavalinkPlugin.setReverb();
1277
+ * ```
1268
1278
  */
1269
- token: string;
1279
+ setReverb(settings?: Partial<LavalinkFilterPluginReverbSettings>): Promise<this>;
1280
+ }
1281
+
1282
+ /**
1283
+ * Class representing a filter manager for a player.
1284
+ * @class FilterManager
1285
+ */
1286
+ declare class FilterManager {
1270
1287
  /**
1271
- * The voice server endpoint.
1272
- * @type {string}
1288
+ * The player this filter manager belongs to.
1289
+ * @type {PlayerStructure}
1290
+ * @public
1291
+ * @readonly
1273
1292
  */
1274
- endpoint: string;
1293
+ readonly player: PlayerStructure;
1275
1294
  /**
1276
- * The voice server session id.
1277
- * @type {string}
1295
+ * The bands applied to the player.
1296
+ * @type {EQBandSettings[]}
1297
+ * @readonly
1278
1298
  */
1279
- sessionId: string;
1299
+ readonly bands: EQBandSettings[];
1280
1300
  /**
1281
- * The voice server guild id.
1282
- * @type {string | undefined}
1301
+ * The current filter settings applied to the player.
1302
+ * @type {FilterSettings}
1303
+ * @public
1283
1304
  */
1284
- connected?: boolean;
1305
+ data: FilterSettings;
1285
1306
  /**
1286
- * The voice server ping.
1287
- * @type {number | undefined}
1307
+ * The enabled filters for the player.
1308
+ * @type {EnabledPlayerFilters}
1288
1309
  */
1289
- ping?: number;
1290
- }
1291
- /**
1292
- * The JSON representation of the player.
1293
- */
1294
- interface PlayerJson {
1310
+ filters: EnabledPlayerFilters;
1295
1311
  /**
1296
- * The guild id of the player.
1297
- * @type {string}
1312
+ * The lavalink plugin filters manager.
1313
+ * @type {LavalinkPluginFilter}
1314
+ * @readonly
1298
1315
  */
1299
- guildId: string;
1316
+ readonly plugin: LavalinkPluginFilter;
1300
1317
  /**
1301
- * The volume of the player.
1302
- * @type {number}
1303
- */
1304
- volume: number;
1305
- /**
1306
- * The self deaf state of the player.
1307
- * @type {boolean}
1308
- */
1309
- selfDeaf: boolean;
1310
- /**
1311
- * The self mute state of the player.
1312
- * @type {boolean}
1313
- */
1314
- selfMute: boolean;
1315
- /**
1316
- * The voice settings for the player.
1317
- * @type {LavalinkPlayerVoice}
1318
- */
1319
- voice: Nullable<LavalinkPlayerVoice>;
1320
- /**
1321
- * The loop mode of the player.
1322
- * @type {LoopMode}
1323
- */
1324
- loop: LoopMode;
1325
- /**
1326
- * The options for the player.
1327
- * @type {boolean}
1328
- */
1329
- options: PlayerOptions;
1330
- /**
1331
- * The paused state of the player.
1332
- * @type {boolean}
1333
- */
1334
- paused: boolean;
1335
- /**
1336
- * The playing state of the player.
1337
- * @type {boolean}
1338
- */
1339
- playing: boolean;
1340
- /**
1341
- * The voice channel id of the player.
1342
- * @type {string}
1343
- */
1344
- voiceId?: string;
1345
- /**
1346
- * The text channel id of the player.
1347
- * @type {string | undefined}
1318
+ * The DSPX plugin filters manager.
1319
+ * @type {DSPXPluginFilter}
1320
+ * @readonly
1348
1321
  */
1349
- textId?: string;
1322
+ readonly dspx: DSPXPluginFilter;
1350
1323
  /**
1351
- * The last position received from Lavalink.
1352
- * @type {number}
1324
+ *
1325
+ * Creates a new filter manager.
1326
+ * @param {PlayerStructure} player The player this filter manager belongs to.
1353
1327
  */
1354
- lastPosition: number;
1328
+ constructor(player: PlayerStructure);
1355
1329
  /**
1356
- * The timestamp when the last position change update happened.
1357
- * @type {number | null}
1330
+ * Resets all filters to their default values.
1331
+ * @returns {Promise<this>} A promise that resolves to the instance of the filter manager.
1332
+ * @example
1333
+ * ```ts
1334
+ * // Reset all filters
1335
+ * await player.filterManager.reset();
1336
+ * ```
1358
1337
  */
1359
- lastPositionUpdate: number | null;
1338
+ reset(): Promise<this>;
1360
1339
  /**
1361
- * The current calculated position of the player.
1362
- * @type {number}
1340
+ *
1341
+ * Applies the current filters to the player.
1342
+ * @returns {Promise<this>} A promise that resolves to the instance of the filter manager.
1343
+ * @example
1344
+ * ```ts
1345
+ * // Apply the current filters
1346
+ * await player.filterManager.apply();
1347
+ * ```
1363
1348
  */
1364
- position: number;
1349
+ apply(): Promise<this>;
1365
1350
  /**
1366
- * The timestamp when the player was created.
1367
- * @type {number}
1351
+ * Checks if the current filters are active.
1352
+ * @param {TimescaleSettings} timescale The timescale settings to check against.
1353
+ * @returns {void} Nothing!
1354
+ * @example
1355
+ * ```ts
1356
+ * // Check the current filters
1357
+ * player.filterManager.check();
1358
+ * ```
1368
1359
  */
1369
- createdTimestamp: number;
1360
+ check(timescale?: TimescaleSettings): void;
1370
1361
  /**
1371
- * The ping of the player.
1372
- * @type {number}
1362
+ *
1363
+ * Checks if a specific filter is active.
1364
+ * @param {FilterType} filter The filter type to check.
1365
+ * @returns {boolean} True if the filter is active, false otherwise.
1366
+ * @example
1367
+ * ```ts
1368
+ * // Check if the nightcore filter is active
1369
+ * const isNightcoreActive = player.filterManager.has(FilterType.Nightcore);
1370
+ * console.log(isNightcoreActive); // true or false
1371
+ * ```
1373
1372
  */
1374
- ping: number;
1373
+ has(filter: FilterType): boolean;
1375
1374
  /**
1376
- * The queue of the player.
1377
- * @type {QueueJson}
1375
+ *
1376
+ * Sets the volume for the player.
1377
+ * @param {number} volume The volume level to set (between 0 and 5).
1378
+ * @returns {Promise<this>} A promise that resolves to the player instance.
1379
+ * @throws {PlayerError} If the volume is not a number between 0 and 5.
1380
+ * @example
1381
+ * ```ts
1382
+ * // Set the volume to 2.5
1383
+ * await player.filterManager.setVolume(2.5);
1384
+ * ```
1378
1385
  */
1379
- queue: QueueJson;
1386
+ setVolume(volume: number): Promise<this>;
1380
1387
  /**
1381
- * The node of the player.
1382
- * @type {NodeJson}
1388
+ * Sets the audio output for the player.
1389
+ * @param {AudioOutput} output The audio output to set.
1390
+ * @returns {Promise<this>} A promise that resolves to the player instance.
1391
+ * @throws {PlayerError} If the output is not a valid AudioOutput value.
1392
+ * @example
1393
+ * ```ts
1394
+ * // Set the audio output to mono
1395
+ * await player.filterManager.setAudioOutput(AudioOutput.Mono);
1396
+ * ```
1383
1397
  */
1384
- node: NodeJson;
1398
+ setAudioOutput(output: AudioOutput): Promise<this>;
1385
1399
  /**
1386
- * The filter settings of the player.
1387
- * @type {FilterSettings}
1400
+ *
1401
+ * Sets the speed for the player.
1402
+ * @param {number} speed The speed to set (default is 1).
1403
+ * @returns {Promise<this>} A promise that resolves to the player instance.
1404
+ * @throws {PlayerError} If the node does not support the timescale filter.
1405
+ * @example
1406
+ * ```ts
1407
+ * // Set the speed to 1.5
1408
+ * await player.filterManager.setSpeed(1.5);
1409
+ * ```
1388
1410
  */
1389
- filters: FilterSettings;
1390
- }
1391
- /**
1392
- * The lyrics methods for the player.
1393
- */
1394
- interface LyricsMethods {
1411
+ setSpeed(speed?: number): Promise<this>;
1395
1412
  /**
1396
1413
  *
1397
- * Get the current lyrics for the current track.
1398
- * @param {boolean} [skipSource=false] Whether to skip the source or not.
1399
- * @returns {Promise<LyricsResult | null>} The lyrics result or null if not found.
1414
+ * Sets the rate for the player.
1415
+ * @param {number} rate The rate to set (default is 1).
1416
+ * @returns {Promise<this>} A promise that resolves to the player instance.
1417
+ * @throws {PlayerError} If the node does not support the timescale filter.
1400
1418
  * @example
1401
1419
  * ```ts
1402
- * const player = manager.getPlayer("guildId");
1403
- * const lyrics = await player.lyricsManager.current();
1420
+ * // Set the rate to 1.2
1421
+ * await player.filterManager.setRate(1.2);
1404
1422
  * ```
1405
1423
  */
1406
- current(skipSource?: boolean): Promise<LyricsResult | null>;
1424
+ setRate(rate?: number): Promise<this>;
1407
1425
  /**
1408
1426
  *
1409
- * Get the lyrics for a specific track.
1410
- * @param {Track} track The track to get the lyrics for.
1411
- * @param {boolean} [skipSource=false] Whether to skip the source or not.
1412
- * @returns {Promise<LyricsResult | null>} The lyrics result or null if not found.
1427
+ * Sets the pitch for the player.
1428
+ * @param {number} pitch The pitch
1429
+ * @returns {Promise<this>} A promise that resolves to the player instance.
1430
+ * @throws {PlayerError} If the node does not support the timescale filter.
1413
1431
  * @example
1414
1432
  * ```ts
1415
- * const player = manager.getPlayer("guildId");
1416
- * const track = player.queue.current;
1417
- * const lyrics = await player.lyrics.get(track);
1433
+ * // Set the pitch to 0.8
1434
+ * await player.filterManager.setPitch(0.8);
1418
1435
  * ```
1419
1436
  */
1420
- get(track: Track, skipSource?: boolean): Promise<LyricsResult | null>;
1437
+ setPitch(pitch?: number): Promise<this>;
1421
1438
  /**
1422
1439
  *
1423
- * Subscribe to the lyrics for a specific guild.
1424
- * @param {boolean} [skipSource=false] Whether to skip the source or not.
1425
- * @returns {Promise<void>} Let's start the sing session!
1440
+ * Sets the EQ bands for the player.
1441
+ * @param {RestOrArray<EQBandSettings>} bands The EQ band settings to set.
1442
+ * @returns {Promise<this>} A promise that resolves to the instance of the manager.
1443
+ * @throws {PlayerError} If the bands array is empty or contains invalid band settings.
1426
1444
  * @example
1427
1445
  * ```ts
1428
- * const player = manager.getPlayer("guildId");
1429
- * await player.lyrics.subscribe();
1446
+ * // Set multiple EQ bands
1447
+ * await player.filterManager.setEQBand(
1448
+ * { band: 0, gain: 0.5 },
1449
+ * { band: 1, gain: -0.3 },
1450
+ * );
1430
1451
  * ```
1431
1452
  */
1432
- subscribe(skipSource?: boolean): Promise<void>;
1453
+ setEQBand(...bands: RestOrArray<EQBandSettings>): Promise<this>;
1433
1454
  /**
1434
1455
  *
1435
- * Unsubscribe from the lyrics for a specific guild.
1436
- * @returns {Promise<void>} Let's stop the sing session!
1456
+ * Clears all EQ bands for the player.
1457
+ * @returns {Promise<this>} A promise that resolves to the instance of the manager.
1437
1458
  * @example
1438
1459
  * ```ts
1439
- * const player = manager.getPlayer("guildId");
1440
- * await player.lyrics.unsubscribe();
1460
+ * // Clear all EQ bands
1461
+ * await player.filterManager.clearEQBands();
1441
1462
  * ```
1442
1463
  */
1443
- unsubscribe(): Promise<void>;
1444
- }
1445
- /**
1446
- * The voice channel update options.
1447
- */
1448
- type VoiceChannelUpdate = Pick<PlayerOptions, "selfDeaf" | "voiceId" | "selfMute">;
1449
- /**
1450
- * The voice settings for the player.
1451
- */
1452
- type LavalinkPlayerVoice = Omit<PlayerVoice, "connected" | "ping">;
1453
-
1454
- /**
1455
- * Class representing a LyricsManager.
1456
- * @class LyricsManager
1457
- */
1458
- declare class LyricsManager {
1464
+ clearEQBands(): Promise<this>;
1459
1465
  /**
1460
- * The node instance.
1461
- * @type {NodeStructure}
1462
- * @readonly
1466
+ *
1467
+ * Set the vibrato filter with the given settings.
1468
+ * @param {TremoloSettings} [settings=DefaultFilterPreset.Vibrato] The settings for the vibrato filter.
1469
+ * @returns {Promise<this>} The instance of the filter manager.
1470
+ * @throws {PlayerError} If the node does not support the vibrato filter.
1471
+ * @example
1472
+ * ```ts
1473
+ * // Set the vibrato filter
1474
+ * await player.filterManager.setVibrato({ frequency: 4.0, depth: 0.5 });
1475
+ * ```
1463
1476
  */
1464
- readonly node: NodeStructure;
1477
+ setVibrato(settings?: Partial<TremoloSettings>): Promise<this>;
1465
1478
  /**
1466
- * Create a new LyricsManager instance.
1467
- * @param {NodeStructure} node The node instance.
1479
+ *
1480
+ * Set the tremolo filter with the given settings.
1481
+ * @param {TremoloSettings} [settings=DefaultFilterPreset.Tremolo] The settings for the tremolo filter.
1482
+ * @returns {Promise<this>} The instance of the filter manager.
1483
+ * @throws {PlayerError} If the node does not support the tremolo filter.
1468
1484
  * @example
1469
1485
  * ```ts
1470
- * const node = manager.nodeManager.get("nodeId");
1471
- * const lyricsManager = new LyricsManager(node);
1486
+ * // Set the tremolo filter
1487
+ * await player.filterManager.setTremolo({ frequency: 4.0, depth: 0.5 });
1472
1488
  * ```
1473
1489
  */
1474
- constructor(node: NodeStructure);
1490
+ setTremolo(settings?: Partial<TremoloSettings>): Promise<this>;
1475
1491
  /**
1476
1492
  *
1477
- * Get the current lyrics for the current track.
1478
- * @param {boolean} skipSource Whether to skip the track source or not.
1479
- * @returns {Promise<LyricsResult | null>} The lyrics result or null if not found.
1493
+ * Set the low-pass filter with the given settings.
1494
+ * @param {LowPassSettings} [settings=DefaultFilterPreset.Lowpass] The settings for the low-pass filter.
1495
+ * @returns {Promise<this>} The instance of the filter manager.
1496
+ * @throws {PlayerError} If the node does not support the low-pass filter.
1480
1497
  * @example
1481
1498
  * ```ts
1482
- * const player = manager.getPlayer("guildId");
1483
- * const lyrics = await player.lyricsManager.current();
1499
+ * // Set the low-pass filter
1500
+ * await player.filterManager.setLowPass({ smoothing: 20.0 });
1484
1501
  * ```
1485
1502
  */
1486
- current(guildId: string, skipSource?: boolean): Promise<LyricsResult | null>;
1503
+ setLowPass(settings?: Partial<LowPassSettings>): Promise<this>;
1487
1504
  /**
1488
- *
1489
- * Get the lyrics for a specific track.
1490
- * @param {Track} track The track to get the lyrics for.
1491
- * @param {boolean} skipSource Whether to skip the track source or not.
1492
- * @returns {Promise<LyricsResult | null>} The lyrics result or null if not found.
1505
+ * Set the nightcore filter with the given settings.
1506
+ * @param {Partial<TimescaleSettings>} [settings=DefaultFilterPreset.Nightcore] The settings for the nightcore filter.
1507
+ * @returns {Promise<this>} The instance of the filter manager.
1508
+ * @throws {PlayerError} If the node does not support the timescale filter.
1493
1509
  * @example
1494
1510
  * ```ts
1495
- * const node = manager.nodeManager.get("nodeId");
1496
- * const lyrics = await node.lyricsManager.get(track);
1511
+ * // Set the nightcore filter
1512
+ * await player.filterManager.setNightcore();
1497
1513
  * ```
1498
1514
  */
1499
- get(track: Track, skipSource?: boolean): Promise<LyricsResult | null>;
1515
+ setNightcore(settings?: Partial<TimescaleSettings>): Promise<this>;
1500
1516
  /**
1501
1517
  *
1502
- * Subscribe to the lyrics for a specific guild.
1503
- * @param {string} guildId The guild id to subscribe to.
1504
- * @param {boolean} skipSource Whether to skip the track source or not.
1505
- * @returns {Promise<void>} Let's start the sing session!
1518
+ * Set the vaporwave filter with the given settings.
1519
+ * @param {Partial<TimescaleSettings>} [settings=DefaultFilterPreset.Vaporwave] The settings for the vaporwave filter.
1520
+ * @returns {Promise<this>} The instance of the filter manager.
1521
+ * @throws {PlayerError} If the node does not support the timescale filter.
1506
1522
  * @example
1507
1523
  * ```ts
1508
- * const node = manager.nodeManager.get("nodeId");
1509
- * await node.lyricsManager.subscribe("guildId");
1524
+ * // Set the vaporwave filter
1525
+ * await player.filterManager.setVaporwave();
1510
1526
  * ```
1511
1527
  */
1512
- subscribe(guildId: string, skipSource?: boolean): Promise<void>;
1528
+ setVaporwave(settings?: Partial<TimescaleSettings>): Promise<this>;
1513
1529
  /**
1514
1530
  *
1515
- * Unsubscribe from the lyrics for a specific guild.
1516
- * @param {string} guildId The guild id to unsubscribe from.
1517
- * @returns {Promise<void>} Let's stop the sing session!
1531
+ * Set the karaoke filter with the given settings.
1532
+ * @param {KaraokeSettings} [settings=DefaultFilterPreset.Karaoke] The settings for the karaoke filter.
1533
+ * @returns {Promise<this>} The instance of the filter manager.
1534
+ * @throws {PlayerError} If the node does not support the karaoke filter.
1518
1535
  * @example
1519
1536
  * ```ts
1520
- * const node = manager.nodeManager.get("nodeId");
1521
- * await node.lyricsManager.unsubscribe("guildId");
1537
+ * // Set the karaoke filter
1538
+ * await player.filterManager.setKaraoke({ level: -15.0, monoLevel: -20.0, filterBand: 220.0, filterWidth: 100.0 });
1522
1539
  * ```
1523
1540
  */
1524
- unsubscribe(guildId: string): Promise<void>;
1525
- }
1526
-
1527
- /**
1528
- * Represents a collection that extends the built-in Map class.
1529
- * @template K The type of the keys in the collection.
1530
- * @template V The type of the values in the collection.
1531
- */
1532
- declare class Collection<K, V> extends Map<K, V> {
1533
- /**
1534
- * Removes elements from the collection based on a filter function.
1535
- * @param fn The filter function that determines which elements to remove.
1536
- * @param thisArg The value to use as `this` when executing the filter function.
1537
- * @returns The number of elements removed from the collection.
1538
- * @example
1539
- * const collection = new Collection<number, string>();
1540
- * collection.set(1, 'one');
1541
- * collection.set(2, 'two');
1542
- * collection.set(3, 'three');
1543
- * const removedCount = collection.sweep((value, key) => key % 2 === 0);
1544
- * console.log(removedCount); // Output: 1
1545
- * console.log(collection.size); // Output: 2
1546
- */
1547
- sweep(fn: (value: V, key: K, collection: this) => unknown): number;
1541
+ setKaraoke(settings?: Partial<KaraokeSettings>): Promise<this>;
1548
1542
  /**
1549
- * Creates a new array with the results of calling a provided function on every element in the collection.
1550
- * @param fn The function that produces an element of the new array.
1551
- * @param thisArg The value to use as `this` when executing the map function.
1552
- * @returns A new array with the results of calling the provided function on every element in the collection.
1543
+ *
1544
+ * Set the distortion filter with the given settings.
1545
+ * @param {Partial<DistortionSettings>} [settings=DefaultFilterPreset.Distortion] The settings for the distortion filter.
1546
+ * @returns {Promise<this>} The instance of the filter manager.
1547
+ * @throws {PlayerError} If the node does not support the distortion filter.
1553
1548
  * @example
1554
- * const collection = new Collection<number, string>();
1555
- * collection.set(1, 'one');
1556
- * collection.set(2, 'two');
1557
- * collection.set(3, 'three');
1558
- * const mappedArray = collection.map((value, key) => `${key}: ${value}`);
1559
- * console.log(mappedArray); // Output: ['1: one', '2: two', '3: three']
1549
+ * ```ts
1550
+ * // Set the distortion filter
1551
+ * await player.filterManager.setDistortion({ sinOffset: 0.5, sinScale: 2.0 });
1552
+ * ```
1560
1553
  */
1561
- map<T>(fn: (value: V, key: K, collection: this) => T): T[];
1554
+ setDistortion(settings?: Partial<DistortionSettings>): Promise<this>;
1562
1555
  /**
1563
- * Creates a new array with all elements that pass the test implemented by the provided function.
1564
- * @param fn The function to test each element of the collection.
1565
- * @param thisArg The value to use as `this` when executing the filter function.
1566
- * @returns A new array with the elements that pass the test.
1556
+ * Set the timescale filter with the given settings.
1557
+ * @param {Partial<TimescaleSettings>} settings The timescale settings to set.
1558
+ * @returns {Promise<this>} The instance of the filter manager.
1559
+ * @throws {PlayerError} If the node does not support the timescale filter.
1567
1560
  * @example
1568
- * const collection = new Collection<number, string>();
1569
- * collection.set(1, 'one');
1570
- * collection.set(2, 'two');
1571
- * collection.set(3, 'three');
1572
- * const filteredArray = collection.filter((value, key) => key % 2 === 0);
1573
- * console.log(filteredArray); // Output: ['two']
1561
+ * ```ts
1562
+ * // Set the timescale filter
1563
+ * await player.filterManager.setTimescale({ speed: 1.2, pitch: 0.8, rate: 1.0 });
1564
+ * ```
1574
1565
  */
1575
- filter(fn: (value: V, key: K, collection: this) => boolean): V[];
1566
+ setTimescale(settings: Partial<TimescaleSettings>): Promise<this>;
1576
1567
  /**
1577
- * Returns the value of the first element in the collection that satisfies the provided testing function.
1578
- * @param fn The function to test each element of the collection.
1579
- * @returns The value of the first element that passes the test. `undefined` if no element passes the test.
1568
+ * Convert the filter settings to a JSON object.
1569
+ * @returns {FilterSettings} The filter settings as a JSON object.
1580
1570
  * @example
1581
- * const collection = new Collection<number, number>();
1582
- * collection.set(1, 1);
1583
- * collection.set(2, 2);
1584
- * collection.set(3, 3);
1585
- * const firstEvenValue = collection.find(value => value % 2 === 0);
1586
- * console.log(firstEvenValue); // Output: 2
1571
+ * ```ts
1572
+ * // Convert filter settings to JSON
1573
+ * const filterSettingsJSON = player.filterManager.toJSON();
1574
+ * console.log(filterSettingsJSON); // { volume: 1, equalizer: [...], ... }
1575
+ * ```
1587
1576
  */
1588
- find(fn: (value: V, key: K, collection: this) => boolean): V | undefined;
1577
+ toJSON(): FilterSettings;
1589
1578
  }
1590
1579
 
1591
1580
  /**
1592
- * Class representing a node manager.
1593
- * @class NodeManager
1581
+ * Type representing a nullable voice channel update.
1594
1582
  */
1595
- declare class NodeManager {
1583
+ type NullableVoiceChannelUpdate = Partial<Nullable<VoiceChannelUpdate>>;
1584
+ /**
1585
+ * Class representing a Hoshimi player.
1586
+ * @class Player
1587
+ */
1588
+ declare class Player {
1596
1589
  /**
1597
- * The manager for the node.
1590
+ * The data for the player.
1591
+ * @type {PlayerStorageAdapter}
1592
+ * @readonly
1593
+ */
1594
+ readonly data: PlayerStorageAdapter;
1595
+ /**
1596
+ * The options for the player.
1597
+ * @type {PlayerOptions}
1598
+ * @readonly
1599
+ */
1600
+ readonly options: PlayerOptions;
1601
+ /**
1602
+ * The manager for the player.
1598
1603
  * @type {Hoshimi}
1599
1604
  * @readonly
1600
1605
  */
1601
1606
  readonly manager: Hoshimi;
1602
1607
  /**
1603
- * The nodes for the manager.
1604
- * @type {Collection<string, Node>}
1608
+ * The queue for the player.
1609
+ * @type {Queue}
1605
1610
  * @readonly
1606
1611
  */
1607
- readonly nodes: Collection<string, NodeStructure>;
1612
+ readonly queue: QueueStructure;
1613
+ /**
1614
+ * The filter manager for the player.
1615
+ * @type {FilterManager}
1616
+ * @readonly
1617
+ */
1618
+ readonly filterManager: FilterManager;
1619
+ /**
1620
+ * The node for the player.
1621
+ * @type {NodeStructure}
1622
+ */
1623
+ node: NodeStructure;
1624
+ /**
1625
+ * Check if the player is self deafened.
1626
+ * @type {boolean}
1627
+ */
1628
+ selfDeaf: boolean;
1629
+ /**
1630
+ * Check if the player is self muted.
1631
+ * @type {boolean}
1632
+ */
1633
+ selfMute: boolean;
1634
+ /**
1635
+ * Loop mode of the player.
1636
+ * @type {LoopMode}
1637
+ * @default LoopMode.Off
1638
+ */
1639
+ loop: LoopMode;
1640
+ /**
1641
+ * Check if the player is playing.
1642
+ * @type {boolean}
1643
+ * @default false
1644
+ */
1645
+ playing: boolean;
1646
+ /**
1647
+ * Check if the player is paused.
1648
+ * @type {boolean}
1649
+ * @default false
1650
+ */
1651
+ paused: boolean;
1652
+ /**
1653
+ * Check if the player is connected.
1654
+ * @type {boolean}
1655
+ * @default false
1656
+ */
1657
+ connected: boolean;
1658
+ /**
1659
+ * Volume of the player.
1660
+ * @type {number}
1661
+ * @default 100
1662
+ */
1663
+ volume: number;
1664
+ /**
1665
+ * Guild ig of the player.
1666
+ * @type {string}
1667
+ */
1668
+ guildId: string;
1669
+ /**
1670
+ * Voice channel idof the player.
1671
+ * @type {string | undefined}
1672
+ */
1673
+ voiceId: string | undefined;
1674
+ /**
1675
+ * Text channel id of the player.
1676
+ * @type {string | undefined}
1677
+ */
1678
+ textId: string | undefined;
1679
+ /**
1680
+ * The ping of the player.
1681
+ * @type {number}
1682
+ */
1683
+ ping: number;
1684
+ /**
1685
+ * The timestamp when the player was created.
1686
+ * @type {number}
1687
+ */
1688
+ createdTimestamp: number;
1689
+ /**
1690
+ * The last position received from Lavalink.
1691
+ * @type {number}
1692
+ */
1693
+ lastPosition: number;
1694
+ /**
1695
+ * The timestamp when the last position change update happened.
1696
+ * @type {number | null}
1697
+ */
1698
+ lastPositionUpdate: number | null;
1699
+ /**
1700
+ * The current calculated position of the player.
1701
+ * @type {number}
1702
+ * @readonly
1703
+ */
1704
+ get position(): number;
1705
+ /**
1706
+ * The voice connection details.
1707
+ * @type {PlayerVoice}
1708
+ */
1709
+ voice: Nullable<LavalinkPlayerVoice>;
1608
1710
  /**
1609
1711
  *
1610
- * The constructor for the node manager.
1611
- * @param {Hoshimi} manager The manager for the node.
1712
+ * Create a new player.
1713
+ * @param {Hoshimi} manager The manager for the player.
1714
+ * @param {PlayOptions} options The options for the player.
1612
1715
  * @example
1613
1716
  * ```ts
1614
- * const manager = new Hoshimi();
1615
- * const nodeManager = new NodeManager(manager);
1717
+ * const player = new Player(manager, {
1718
+ * guildId: "guildId",
1719
+ * voiceId: "voiceId",
1720
+ * textId: "textId",
1721
+ * selfDeaf: true,
1722
+ * selfMute: false,
1723
+ * volume: 100,
1724
+ * });
1616
1725
  *
1617
- * console.log(nodeManager.nodes.size); // 0
1726
+ * console.log(player.guildId); // guildId
1727
+ * console.log(player.voiceId); // voiceId
1728
+ * console.log(player.textId); // textId
1729
+ */
1730
+ constructor(manager: Hoshimi, options: PlayerOptions);
1731
+ /**
1732
+ * The lyrics methods for the player.
1733
+ * @type {LyricsMethods}
1734
+ * @readonly
1735
+ */
1736
+ readonly lyrics: LyricsMethods;
1737
+ /**
1738
+ *
1739
+ * Check if the player is currently playing a track.
1740
+ * @returns {boolean} Whether the player is currently playing a track.
1741
+ */
1742
+ isPlaying(): boolean;
1743
+ /**
1744
+ *
1745
+ * Search for a track or playlist.
1746
+ * @param {SearchOptions} options The options for the search.
1747
+ * @returns {Promise<QueryResult>} The search result.
1748
+ * @example
1749
+ * ```ts
1750
+ * const player = manager.getPlayer("guildId");
1751
+ * const result = await player.search({
1752
+ * query: "track name",
1753
+ * engine: SearchEngine.Youtube,
1754
+ * requester: {},
1755
+ * });
1756
+ *
1757
+ * console.log(result) // the search result
1618
1758
  * ```
1619
1759
  */
1620
- constructor(manager: Hoshimi);
1760
+ search(options: SearchOptions): Promise<QueryResult>;
1621
1761
  /**
1622
1762
  *
1623
- * Delete the node.
1624
- * @param {NodeIdentifier} node The node or node id to delete.
1625
- * @returns {boolean} If the node was deleted.
1763
+ * Play the next track in the queue.
1764
+ * @param {number} [to=0] The amount of tracks to skip.
1765
+ * @param {boolean} [throwError=true] Whether to throw an error if there are no tracks to skip.
1766
+ * @returns {Promise<void>}
1767
+ * @throws {PlayerError} If there are no tracks to skip.
1626
1768
  * @example
1627
1769
  * ```ts
1628
- * const node = manager.nodeManager.get("node1");
1629
- * if (node) manager.nodeManager.delete(node.id); // true if the node was deleted
1770
+ * const player = manager.getPlayer("guildId");
1771
+ * player.skip(2); // skip 2 tracks
1772
+ * player.skip(); // skip 1 track
1630
1773
  * ```
1631
1774
  */
1632
- delete(node: NodeIdentifier): boolean;
1775
+ skip(to?: number, throwError?: boolean): Promise<void>;
1633
1776
  /**
1634
1777
  *
1635
- * Get the node by id.
1636
- * @param {NodeIdentifier} node The node or node id to get.
1637
- * @returns {NodeStructure | undefined} The node or undefined if not found.
1778
+ * Seek to a specific position in the current track.
1779
+ * @param {number} position The position to seek to in milliseconds.
1780
+ * @returns {Promise<void>}
1781
+ * @throws {PlayerError} If the position is invalid.
1638
1782
  * @example
1639
1783
  * ```ts
1640
- * const node = manager.nodeManager.get("node1");
1641
- * if (node) {
1642
- * console.log(node.id); // node1
1643
- * } else {
1644
- * console.log("Node not found");
1645
- * }
1784
+ * const player = manager.getPlayer("guildId");
1785
+ * player.seek(30000); // seek to 30 seconds
1646
1786
  * ```
1647
1787
  */
1648
- get(node: NodeIdentifier): NodeStructure | undefined;
1788
+ seek(position: number): Promise<void>;
1649
1789
  /**
1650
1790
  *
1651
- * Create a new node.
1652
- * @param {NodeOptions} options The options for the node.
1653
- * @returns {NodeStructure} The created node.
1791
+ * Disconnect the player from the voice channel.
1792
+ * @returns {Promise<this>} The player instance.
1654
1793
  * @example
1655
1794
  * ```ts
1656
- * const node = manager.nodeManager.create({
1657
- * host: "localhost",
1658
- * port: 2333,
1659
- * password: "password",
1660
- * secure: false,
1795
+ * const player = manager.getPlayer("guildId");
1796
+ * player.disconnect();
1797
+ * ```
1798
+ */
1799
+ disconnect(): Promise<this>;
1800
+ /**
1801
+ *
1802
+ * Destroy and disconnect the player.
1803
+ * @param {DestroyReasons} [reason] The reason for destroying the player.
1804
+ * @returns {Promise<void>}
1805
+ * @example
1806
+ * ```ts
1807
+ * const player = manager.getPlayer("guildId");
1808
+ * player.destroy(DestroyReasons.Stop);
1809
+ * ```
1810
+ */
1811
+ destroy(reason?: DestroyReasons): Promise<boolean>;
1812
+ /**
1813
+ *
1814
+ * Play a track in the player.
1815
+ * @param {Partial<PlayOptions>} [options] The options to play the track.
1816
+ * @returns {Promise<void>}
1817
+ * @throws {PlayerError} If there are no tracks to play.
1818
+ * @example
1819
+ * ```ts
1820
+ * const player = manager.getPlayer("guildId");
1821
+ *
1822
+ * player.play({
1823
+ * track: track,
1824
+ * noReplace: true,
1661
1825
  * });
1826
+ * ```
1827
+ */
1828
+ play(options?: Partial<PlayOptions>): Promise<void>;
1829
+ /**
1830
+ * Connect the player to the voice channel.
1831
+ * @returns {Promise<this>} The player instance.
1832
+ * @example
1833
+ * ```ts
1834
+ * const player = manager.getPlayer("guildId");
1835
+ * player.connect();
1836
+ * ```
1837
+ */
1838
+ connect(): Promise<this>;
1839
+ /**
1662
1840
  *
1663
- * console.log(node.id); // localhost:2333
1841
+ * Stop the player from playing.
1842
+ * @param {boolean} [destroy=true] Whether to destroy the player or not.
1843
+ * @returns {Promise<void>}
1844
+ * @example
1845
+ * ```ts
1846
+ * const player = manager.getPlayer("guildId");
1847
+ * player.stop();
1848
+ * ```
1664
1849
  */
1665
- create(options: NodeOptions): NodeStructure;
1850
+ stop(destroy?: boolean): Promise<void>;
1666
1851
  /**
1667
1852
  *
1668
- * Destroy a node.
1669
- * @param {NodeIdentifier} node The node or node id to destroy.
1670
- * @returns {void}
1853
+ * Pause or resume the player.
1854
+ * @returns {Promise<void>}
1855
+ * @example
1856
+ * ```ts
1857
+ * const player = manager.getPlayer("guildId");
1858
+ * player.setPaused();
1859
+ * ```
1860
+ */
1861
+ setPaused(paused?: boolean): Promise<boolean>;
1862
+ /**
1863
+ *
1864
+ * Set the volume of the player.
1865
+ * @param {number} volume The volume to set.
1866
+ * @returns {Promise<void>}
1867
+ * @example
1868
+ * ```ts
1869
+ * const player = manager.getPlayer("guildId");
1870
+ * player.setVolume(50); // set the volume to 50%
1871
+ * ```
1872
+ */
1873
+ setVolume(volume: number): Promise<void>;
1874
+ /**
1875
+ *
1876
+ * Set the loop mode of the player.
1877
+ * @param {LoopMode} mode The loop mode to set.
1878
+ * @throws {PlayerError} If the loop mode is invalid.
1879
+ * @example
1880
+ * ```ts
1881
+ * const player = manager.getPlayer("guildId");
1882
+ * player.setLoop(LoopMode.Track);
1883
+ * ```
1884
+ */
1885
+ setLoop(mode: LoopMode): this;
1886
+ /**
1887
+ * Set the voice of the player.
1888
+ * @param {NullableVoiceChannelUpdate} options The voice state to set.
1889
+ * @returns {Promise<void>}
1890
+ * @example
1891
+ * ```ts
1892
+ * const player = manager.getPlayer("guildId");
1893
+ * player.setVoice({ voiceId: "newVoiceId" });
1894
+ * ```
1895
+ */
1896
+ setVoice(options?: NullableVoiceChannelUpdate): Promise<void>;
1897
+ /**
1898
+ *
1899
+ * Change the node the player is connected to.
1900
+ * @param {NodeIdentifier} node The node to change to.
1901
+ * @returns {Promise<void>} A promise that resolves when the node has been changed.
1902
+ * @throws {PlayerError} If the target node is not found, not connected, or missing source managers.
1903
+ * @example
1904
+ * ```ts
1905
+ * const player = manager.getPlayer("guildId");
1906
+ * player.move("newNodeId");
1907
+ * ```
1908
+ */
1909
+ move(node: NodeIdentifier): Promise<void>;
1910
+ /**
1911
+ * Update the player with new data.
1912
+ * @param {NonGuildUpdatePlayerInfo} data The data to update the player with.
1913
+ * @returns {Promise<LavalinkPlayer | null>} The updated player data.
1914
+ * @example
1915
+ * ```ts
1916
+ * const player = manager.getPlayer("guildId");
1917
+ * const updatedPlayer = await player.updatePlayer({ volume: 50 });
1918
+ * console.log(updatedPlayer); // the updated player data
1919
+ * ```
1920
+ */
1921
+ updatePlayer(data: NonGuildUpdatePlayerInfo): Promise<LavalinkPlayer | null>;
1922
+ /**
1923
+ *
1924
+ * Return the player as a json object.
1925
+ * @returns {PlayerJson}
1926
+ * @example
1927
+ * ```ts
1928
+ * const player = manager.getPlayer("guildId");
1929
+ * const json = player.toJSON();
1930
+ * console.log(json); // the player as a json object
1931
+ * ```
1932
+ */
1933
+ toJSON(): PlayerJson;
1934
+ }
1935
+ /**
1936
+ * Type representing the update player information without guildId.
1937
+ */
1938
+ type NonGuildUpdatePlayerInfo = Omit<UpdatePlayerInfo, "guildId">;
1939
+ /**
1940
+ * Interface representing the customizable player storage.
1941
+ */
1942
+ interface CustomizablePlayerStorage {
1943
+ }
1944
+
1945
+ /**
1946
+ * Type representing the customizable player storage.
1947
+ */
1948
+ type StorageKeys = keyof CustomizablePlayerStorage | (string & {});
1949
+ /**
1950
+ * Type representing the customizable player storage values.
1951
+ */
1952
+ type StorageValues<V extends StorageKeys = StorageKeys> = V extends keyof CustomizablePlayerStorage ? CustomizablePlayerStorage[V] : unknown;
1953
+ /**
1954
+ * Class representing a player storage adapter.
1955
+ * @abstract
1956
+ * @class PlayerStorageAdapter
1957
+ * @example
1958
+ * ```ts
1959
+ * class MyPlayerStorageAdapter extends PlayerStorageAdapter {};
1960
+ *
1961
+ * const storage = new MyPlayerStorageAdapter();
1962
+ * await storage.set("key", "value");
1963
+ *
1964
+ * const value = await storage.get("key");
1965
+ * console.log(value); // "value"
1966
+ * ```
1967
+ */
1968
+ declare abstract class PlayerStorageAdapter {
1969
+ /**
1970
+ * The namespace of the storage.
1971
+ * @type {string}
1972
+ * @default "hoshimiplayer"
1671
1973
  * @example
1672
1974
  * ```ts
1673
- * const node = manager.nodeManager.get("node1");
1674
- * if (node) node.destroy();
1975
+ * console.log(storage.namespace); // "hoshimiplayer"
1675
1976
  * ```
1676
1977
  */
1677
- destroy(node: NodeIdentifier): void;
1978
+ namespace: string;
1678
1979
  /**
1679
1980
  *
1680
- * Reconnect a node.
1681
- * @param {NodeIdentifier} node The node or node id to reconnect.
1682
- * @returns {void}
1981
+ * Get the value using the key.
1982
+ * @param {string} key The key to get the value from.
1983
+ * @returns {Awaitable<T | undefined>} The value of the key.
1683
1984
  * @example
1684
1985
  * ```ts
1685
- * const node = manager.nodeManager.get("node1");
1686
- * if (node) node.reconnect();
1986
+ * const value = await storage.get("key");
1987
+ * console.log(value); // "value"
1687
1988
  * ```
1688
1989
  */
1689
- reconnect(node: NodeIdentifier): void;
1990
+ abstract get<K extends StorageKeys, V extends StorageValues<K>>(key: K): Awaitable<V | undefined>;
1690
1991
  /**
1691
1992
  *
1692
- * Disconnect a node.
1693
- * @param {NodeIdentifier} node The node or node id to disconnect.
1694
- * @returns {void}
1993
+ * Set the value using the key.
1994
+ * @param {string} key The key to set the value to.
1995
+ * @param {unknown} value The value to set.
1996
+ * @returns {Awaitable<void>} Did you know this can be async?
1695
1997
  * @example
1696
1998
  * ```ts
1697
- * const node = manager.nodeManager.get("node1");
1698
- * if (node) node.disconnect();
1999
+ * await storage.set("key", "value");
1699
2000
  * ```
1700
2001
  */
1701
- disconnect(node: NodeIdentifier): void;
2002
+ abstract set<K extends StorageKeys, V extends StorageValues<K>>(key: K, value: V): Awaitable<void>;
1702
2003
  /**
1703
2004
  *
1704
- * Connect a node.
1705
- * @param {NodeIdentifier} node The node or node id to connect.
1706
- * @returns {void}
2005
+ * Delete the value using the key.
2006
+ * @param {string} key The key to delete the value from.
2007
+ * @returns {Awaitable<boolean>} Returns true if the key was deleted.
1707
2008
  * @example
1708
2009
  * ```ts
1709
- * const node = manager.nodeManager.get("node1");
1710
- * if (node) node.connect();
2010
+ * const success = await storage.delete("key");
2011
+ * console.log(success); // true
1711
2012
  * ```
1712
2013
  */
1713
- connect(node: NodeIdentifier): void;
2014
+ abstract delete<K extends StorageKeys>(key: K): Awaitable<boolean>;
1714
2015
  /**
1715
- *
1716
- * Get the least used node.
1717
- * @returns {NodeStructure} The least used node.
2016
+ * Clear the storage.
2017
+ * @returns {Awaitable<void>} Scary, right?
1718
2018
  * @example
1719
2019
  * ```ts
1720
- * const node = manager.nodeManager.getLeastUsed();
1721
- * if (node) {
1722
- * console.log(node.id); // node1
1723
- * console.log(node.penalties); // the penalties of the node
1724
- * console.log(node.state); // the state of the node
1725
- * }
2020
+ * await storage.clear();
1726
2021
  * ```
1727
2022
  */
1728
- getLeastUsed(sortType?: NodeSortTypes): NodeStructure;
2023
+ abstract clear(): Awaitable<void>;
1729
2024
  /**
1730
- *
1731
- * Reconnect the nodes.
1732
- * @returns {void}
2025
+ * Check if the storage has the key.
2026
+ * @param {string} key The key to check.
2027
+ * @returns {Awaitable<boolean>} Return true if the key exists.
1733
2028
  * @example
1734
2029
  * ```ts
1735
- * const node = manager.nodeManager.get("node1");
1736
- * if (node) node.reconnectAll();
2030
+ * const exists = await storage.has("key");
2031
+ * console.log(exists); // true
1737
2032
  * ```
1738
2033
  */
1739
- reconnectAll(): void;
2034
+ abstract has<K extends StorageKeys>(key: K): Awaitable<boolean>;
1740
2035
  /**
1741
- * Disconnect the nodes.
1742
- * @returns {void}
2036
+ * Get all keys in the storage.
2037
+ * @returns {Awaitable<K[]>} The keys in the storage.
1743
2038
  * @example
1744
2039
  * ```ts
1745
- * const node = manager.nodeManager.get("node1");
1746
- * if (node) node.disconnectAll();
2040
+ * const keys = await storage.keys();
2041
+ * console.log(keys); // ["key1", "key2"]
1747
2042
  * ```
1748
2043
  */
1749
- disconnectAll(): void;
2044
+ abstract keys<K extends StorageKeys[]>(): Awaitable<K[]>;
1750
2045
  /**
1751
- * Connect the nodes.
1752
- * @returns {void}
2046
+ * Get all values in the storage.
2047
+ * @returns {Awaitable<V[]>} The values in the storage.
1753
2048
  * @example
1754
2049
  * ```ts
1755
- * const node = manager.nodeManager.get("node1");
1756
- * if (node) node.connect();
2050
+ * const values = await storage.values();
2051
+ * console.log(values); // ["value1", "value2"]
1757
2052
  * ```
1758
2053
  */
1759
- connectAll(): void;
2054
+ abstract values<K extends StorageKeys[], V extends StorageValues<K[number]>>(): Awaitable<V[]>;
1760
2055
  /**
1761
- * Destroy the nodes.
1762
- * @returns {void}
2056
+ * Get all entries in the storage.
2057
+ * @returns {Awaitable<[K, V][]>} The entries in the storage.
1763
2058
  * @example
1764
2059
  * ```ts
1765
- * const node = manager.nodeManager.get("node1");
1766
- * if (node) node.destroy();
2060
+ * const entries = await storage.entries();
2061
+ * console.log(entries); // [["key1", "value1"], ["key2", "value2"]]
1767
2062
  * ```
1768
2063
  */
1769
- destroyAll(): void;
1770
- }
1771
-
1772
- /**
1773
- * The methods for http requests
1774
- */
1775
- declare enum HttpMethods {
1776
- /**
1777
- * The GET method requests a representation of the specified resource. Requests using GET should only retrieve data.
1778
- * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/GET
1779
- * @type {string}
1780
- */
1781
- Get = "GET",
1782
- /**
1783
- * The POST method is used to submit an entity to the specified resource, often causing a change in state or side effects on the server.
1784
- * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST
1785
- * @type {string}
1786
- */
1787
- Post = "POST",
1788
- /**
1789
- * The PUT method replaces all current representations of the target resource with the request payload.
1790
- * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PUT
1791
- * @type {string}
1792
- */
1793
- Put = "PUT",
1794
- /**
1795
- * The PATCH method is used to apply partial modifications to a resource.
1796
- * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PATCH
1797
- * @type {string}
1798
- */
1799
- Patch = "PATCH",
1800
- /**
1801
- * The DELETE method deletes the specified resource.
1802
- * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/DELETE
1803
- * @type {string}
1804
- */
1805
- Delete = "DELETE",
2064
+ abstract entries<K extends StorageKeys[], V extends StorageValues<K[number]>>(): Awaitable<[K, V][]>;
1806
2065
  /**
1807
- * The HEAD method asks for a response identical to that of a GET request, but without the response body.
1808
- * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/HEAD
1809
- * @type {string}
2066
+ * Get all key-value pairs in the storage.
2067
+ * @returns {Awaitable<Record<K[number], V>>} An object containing all key-value pairs in the storage, excluding internal keys.
2068
+ * @example
2069
+ * ```ts
2070
+ * const all = await storage.all();
2071
+ * console.log(all); // { key1: "value1", key2: "value2" }
2072
+ * ```
1810
2073
  */
1811
- Head = "HEAD"
1812
- }
1813
- declare enum RestPathType {
2074
+ abstract all<K extends StorageKeys[], V extends StorageValues<K[number]>>(): Awaitable<Record<K[number], V>>;
1814
2075
  /**
1815
- * The raw path of the request.
1816
- * @type {string}
2076
+ * Get the size of the storage.
2077
+ * @returns {Awaitable<number>} The size of the storage.
2078
+ * @example
2079
+ * ```ts
2080
+ * const size = await storage.size();
2081
+ * console.log(size); // 2
2082
+ * ```
1817
2083
  */
1818
- Raw = "/",
2084
+ abstract size(): Awaitable<number>;
1819
2085
  /**
1820
- * The versioned path v4 of the request.
1821
- * @type {string}
2086
+ *
2087
+ * Build a key from the given parts.
2088
+ * @param {string[]} parts The parts to build the key from.
2089
+ * @returns {string} The built key.
2090
+ * @example
2091
+ * ```ts
2092
+ * const key = storage.buildKey("part1", "part2", "part3");
2093
+ * ```
1822
2094
  */
1823
- V4 = "/v4"
2095
+ abstract buildKey(...parts: RestOrArray<string>): string;
1824
2096
  }
2097
+
1825
2098
  /**
1826
- * The status codes for the REST.
1827
- * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Status
2099
+ * Class representing a storage manager.
2100
+ * @abstract
2101
+ * @class StorageManager
2102
+ * @example
2103
+ * ```ts
2104
+ * class MyStorageManager extends StorageManager {};
2105
+ *
2106
+ * const storage = new MyStorageManager();
2107
+ * storage.set("key", "value");
2108
+ *
2109
+ * const value = await storage.get("key");
2110
+ * console.log(value); // "value"
2111
+ * ```
1828
2112
  */
1829
- declare enum HttpStatusCodes {
1830
- /**
1831
- * The request has succeeded.
1832
- * @type {number}
1833
- */
1834
- OK = 200,
1835
- /**
1836
- * The request has been fulfilled and resulted in a new resource being created.
1837
- * @type {number}
1838
- */
1839
- Created = 201,
1840
- /**
1841
- * The request has been accepted for processing, but the processing has not been completed.
1842
- * @type {number}
1843
- */
1844
- Accepted = 202,
1845
- /**
1846
- * The server successfully processed the request, but is not returning any content.
1847
- * @type {number}
1848
- */
1849
- NoContent = 204,
1850
- /**
1851
- * The resource has been moved permanently to a new URI.
1852
- * @type {number}
1853
- */
1854
- MovedPermanently = 301,
1855
- /**
1856
- * The requested resource has been found at a different URI.
1857
- * @type {number}
1858
- */
1859
- Found = 302,
1860
- /**
1861
- * The resource has not been modified since the last request.
1862
- * @type {number}
1863
- */
1864
- NotModified = 304,
1865
- /**
1866
- * The request cannot be processed due to bad syntax.
1867
- * @type {number}
1868
- */
1869
- BadRequest = 400,
1870
- /**
1871
- * The request requires user authentication.
1872
- * @type {number}
1873
- */
1874
- Unauthorized = 401,
1875
- /**
1876
- * The request was valid, but the server is refusing action.
1877
- * @type {number}
1878
- */
1879
- Forbidden = 403,
1880
- /**
1881
- * The server cannot find the requested resource.
1882
- * @type {number}
1883
- */
1884
- NotFound = 404,
1885
- /**
1886
- * The request method is known by the server but has been disabled and cannot be used.
1887
- * @type {number}
1888
- */
1889
- MethodNotAllowed = 405,
2113
+ declare abstract class QueueStorageAdapter<T extends QueueJson = QueueJson> {
1890
2114
  /**
1891
- * The server timed out waiting for the request.
1892
- * @type {number}
2115
+ * The namespace of the storage.
2116
+ * @type {string}
2117
+ * @default "hoshimiqueue"
2118
+ * @example
2119
+ * ```ts
2120
+ * console.log(storage.namespace); // "hoshimiqueue"
2121
+ * ```
1893
2122
  */
1894
- RequestTimeout = 408,
2123
+ namespace: string;
1895
2124
  /**
1896
- * The request could not be completed due to a conflict with the current state of the resource.
1897
- * @type {number}
2125
+ *
2126
+ * Get the value using the key.
2127
+ * @param {string} key The key to get the value from.
2128
+ * @returns {Awaitable<T | undefined>} The value of the key.
2129
+ * @example
2130
+ * ```ts
2131
+ * const value = await storage.get("key");
2132
+ * console.log(value); // "value"
2133
+ * ```
1898
2134
  */
1899
- Conflict = 409,
2135
+ abstract get(key: string): Awaitable<T | undefined>;
1900
2136
  /**
1901
- * The requested resource is no longer available and will not be available again.
1902
- * @type {number}
2137
+ *
2138
+ * Set the value using the key.
2139
+ * @param {string} key The key to set the value to.
2140
+ * @param {unknown} value The value to set.
2141
+ * @returns {Awaitable<void>} Did you know this can be async?
2142
+ * @example
2143
+ * ```ts
2144
+ * await storage.set("key", "value");
2145
+ * ```
1903
2146
  */
1904
- Gone = 410,
2147
+ abstract set(key: string, value: T): Awaitable<void>;
1905
2148
  /**
1906
- * The user has sent too many requests in a given amount of time.
1907
- * @type {number}
2149
+ *
2150
+ * Delete the value using the key.
2151
+ * @param {string} key The key to delete the value from.
2152
+ * @returns {Awaitable<boolean>} Returns true if the key was deleted.
2153
+ * @example
2154
+ * ```ts
2155
+ * const success = await storage.delete("key");
2156
+ * console.log(success); // true
2157
+ * ```
1908
2158
  */
1909
- TooManyRequests = 429,
2159
+ abstract delete(key: string): Awaitable<boolean>;
1910
2160
  /**
1911
- * A generic error message, given when no more specific message is suitable.
1912
- * @type {number}
2161
+ * Clear the storage.
2162
+ * @returns {Awaitable<void>} Scary, right?
2163
+ * @example
2164
+ * ```ts
2165
+ * await storage.clear();
2166
+ * ```
1913
2167
  */
1914
- InternalServerError = 500,
2168
+ abstract clear(): Awaitable<void>;
1915
2169
  /**
1916
- * The server does not recognize the request method or lacks the ability to fulfill it.
1917
- * @type {number}
2170
+ * Check if the storage has the key.
2171
+ * @param {string} key The key to check.
2172
+ * @returns {Awaitable<boolean>} Return true if the key exists.
2173
+ * @example
2174
+ * ```ts
2175
+ * const exists = await storage.has("key");
2176
+ * console.log(exists); // true
2177
+ * ```
1918
2178
  */
1919
- NotImplemented = 501,
2179
+ abstract has(key: string): Awaitable<boolean>;
1920
2180
  /**
1921
- * The server was acting as a gateway and received an invalid response.
1922
- * @type {number}
2181
+ *
2182
+ * Parse the value.
2183
+ * @param {unknown} value The value to parse.
2184
+ * @returns {T} The parsed value.
2185
+ * @example
2186
+ * ```ts
2187
+ * const parsed = await storage.parse<{ key: string }>("{'key':'value'}");
2188
+ * console.log(parsed); // { key: "value" }
2189
+ * ```
1923
2190
  */
1924
- BadGateway = 502,
2191
+ abstract parse(value: unknown): Awaitable<T>;
1925
2192
  /**
1926
- * The server is currently unavailable (overloaded or down).
1927
- * @type {number}
2193
+ *
2194
+ * Stringify the value.
2195
+ * @param {unknown} value The value to stringify.
2196
+ * @returns {R} The stringified value.
2197
+ * @example
2198
+ * ```ts
2199
+ * const stringified = await storage.stringify({ key: "value" });
2200
+ * console.log(stringified); // "{'key':'value'}"
2201
+ * ```
1928
2202
  */
1929
- ServiceUnavailable = 503,
2203
+ abstract stringify<R = string>(value: unknown): Awaitable<R>;
1930
2204
  /**
1931
- * The server did not receive a timely response from an upstream server.
1932
- * @type {number}
2205
+ *
2206
+ * Build a key from the given parts.
2207
+ * @param {string[]} parts The parts to build the key from.
2208
+ * @returns {string} The built key.
2209
+ * @example
2210
+ * ```ts
2211
+ * const key = storage.buildKey("part1", "part2", "part3");
2212
+ * ```
1933
2213
  */
1934
- GatewayTimeout = 504
2214
+ abstract buildKey(...parts: RestOrArray<string>): string;
1935
2215
  }
2216
+
1936
2217
  /**
1937
- * The options for the REST.
2218
+ * The queue options.
1938
2219
  */
1939
- interface RestOptions {
1940
- /**
1941
- * The endpoint for the REST.
1942
- * @type {string}
1943
- */
1944
- endpoint: `/${string}`;
1945
- /**
1946
- * The method for the REST.
1947
- * @type {HttpMethods}
1948
- */
1949
- method?: HttpMethods;
2220
+ interface HoshimiQueueOptions {
1950
2221
  /**
1951
- * The headers for the REST.
1952
- * @type {Record<string, string>}
2222
+ * The maximum amount of tracks that can be saved in the queue.
2223
+ * @type {number}
2224
+ * @default 25
1953
2225
  */
1954
- headers?: Record<string, string>;
2226
+ maxHistory?: number;
1955
2227
  /**
1956
- * The body for the REST.
1957
- * @type {Record<string, unknown> | string | undefined}
2228
+ *
2229
+ * The function to use for autoplay.
2230
+ * @param {Player} player The player.
2231
+ * @param {HoshimiTrack | null} lastTrack The last track played.
1958
2232
  */
1959
- body?: Record<string, unknown> | string;
2233
+ autoplayFn?(player: PlayerStructure, lastTrack: HoshimiTrack | null): Awaitable<void>;
1960
2234
  /**
1961
- * The query parameters for the REST.
1962
- * @type {Record<string, string>}
2235
+ * Enable the auto play for the queue. (By default, only supports `youtube` and `spotify`, add more with your own function)
2236
+ * @type {boolean}
2237
+ * @default false
1963
2238
  */
1964
- params?: Record<string, string>;
2239
+ autoPlay?: boolean;
1965
2240
  /**
1966
- * The path type for the REST.
1967
- * @type {RestPathType}
2241
+ * The storage manager to use for the queue.
2242
+ * @type {QueueStorageAdapter}
2243
+ * @default {MemoryAdapter}
1968
2244
  */
1969
- pathType?: RestPathType;
2245
+ storage?: QueueStorageAdapter;
1970
2246
  }
1971
2247
  /**
1972
- * The fetch options for the request.
2248
+ * The queue json.
1973
2249
  */
1974
- interface FetchOptions extends Omit<RestOptions, "endpoint" | "body"> {
2250
+ interface QueueJson {
1975
2251
  /**
1976
- * The signal for the request.
2252
+ * The tracks of the queue.
2253
+ * @type {HoshimiTrack[]}
1977
2254
  */
1978
- signal: AbortSignal;
2255
+ tracks: HoshimiTrack[];
1979
2256
  /**
1980
- * The stringified body for the request.
2257
+ * The previous tracks of the queue.
2258
+ * @type {Track[]}
1981
2259
  */
1982
- body?: string;
2260
+ history: Track[];
2261
+ /**
2262
+ * The current track of the queue.
2263
+ * @type {Track | null}
2264
+ */
2265
+ current: Track | null;
1983
2266
  }
2267
+
1984
2268
  /**
1985
- * The error for the REST.
2269
+ * Partial Lavalink track type.
1986
2270
  */
1987
- interface LavalinkRestError {
2271
+ type PartialLavalinkTrack = Partial<Nullable<LavalinkTrack>>;
2272
+ /**
2273
+ * The base options for playing a track.
2274
+ */
2275
+ interface BasePlayOptions {
1988
2276
  /**
1989
- * The timestamp for the REST.
1990
- * @type {number}
2277
+ * The position to start the track.
2278
+ * @type {number | undefined}
1991
2279
  */
1992
- timestamp: number;
2280
+ position?: number;
1993
2281
  /**
1994
- * The status for the REST.
1995
- * @type {number}
2282
+ * The position to end the track.
2283
+ * @type {number | undefined}
1996
2284
  */
1997
- status: number;
2285
+ endTime?: number;
1998
2286
  /**
1999
- * The error for the REST.
2000
- * @type {string}
2287
+ * The pause state of the player.
2288
+ * @type {boolean | undefined}
2001
2289
  */
2002
- error: string;
2290
+ paused?: boolean;
2003
2291
  /**
2004
- * The trace for the REST.
2005
- * @type {string}
2292
+ * The volume of the player.
2293
+ * @type {number | undefined}
2006
2294
  */
2007
- trace?: string;
2295
+ volume?: number;
2008
2296
  /**
2009
- * The message for the REST.
2010
- * @type {string}
2297
+ * The filters for the player.
2298
+ * @type {Partial<FilterSettings> | undefined}
2011
2299
  */
2012
- message: string;
2300
+ filters?: Partial<FilterSettings>;
2013
2301
  /**
2014
- * The path for the REST.
2015
- * @type {string}
2302
+ * The voice settings for the player.
2303
+ * @type {LavalinkPlayerVoice | undefined}
2016
2304
  */
2017
- path: string;
2305
+ voice?: LavalinkPlayerVoice;
2018
2306
  }
2019
2307
  /**
2020
- * The player response from the Lavalink REST API.
2308
+ * The types of loop modes.
2021
2309
  */
2022
- interface LavalinkPlayer {
2310
+ declare enum LoopMode {
2023
2311
  /**
2024
- * The guild ID associated with the player.
2025
- * @type {string}
2312
+ * Loop mode for repeating the current track.
2026
2313
  */
2027
- guildId: string;
2314
+ Track = 1,
2028
2315
  /**
2029
- * The track currently being played.
2030
- * @type {LavalinkTrack}
2316
+ * Loop mode for repeating the queue.
2031
2317
  */
2032
- track?: LavalinkTrack;
2318
+ Queue = 2,
2033
2319
  /**
2034
- * The volume of the player.
2035
- * @type {number}
2320
+ * Loop mode for repeating nothing.
2036
2321
  */
2037
- volume: number;
2322
+ Off = 3
2323
+ }
2324
+ /**
2325
+ * The types of player events.
2326
+ */
2327
+ declare enum PlayerEventType {
2038
2328
  /**
2039
- * Whether the player is paused.
2040
- * @type {boolean}
2329
+ * Event type for when a track starts.
2041
2330
  */
2042
- paused: boolean;
2331
+ TrackStart = "TrackStartEvent",
2043
2332
  /**
2044
- * The voice connection details.
2045
- * @type {LavalinkPlayerVoice}
2333
+ * Event type for when a track ends.
2046
2334
  */
2047
- voice: LavalinkPlayerVoice;
2335
+ TrackEnd = "TrackEndEvent",
2048
2336
  /**
2049
- * The filter options applied to the player.
2050
- * @type {FilterSettings}
2337
+ * Event type for when a track encounters an exception.
2051
2338
  */
2052
- filters: FilterSettings;
2339
+ TrackException = "TrackExceptionEvent",
2053
2340
  /**
2054
- * The state of the player.
2055
- * @type {LavalinkPlayerState}
2341
+ * Event type for when a track gets stuck.
2056
2342
  */
2057
- state: LavalinkPlayerState;
2058
- }
2059
- /**
2060
- * The state of the player.
2061
- */
2062
- interface LavalinkPlayerState {
2343
+ TrackStuck = "TrackStuckEvent",
2063
2344
  /**
2064
- * The time since the connection was established.
2065
- * @type {number}
2345
+ * Event type for when lyrics are found.
2066
2346
  */
2067
- time: number;
2347
+ LyricsFound = "LyricsFoundEvent",
2068
2348
  /**
2069
- * The position of the current track in milliseconds.
2070
- * @type {number}
2349
+ * Event type for when lyrics are not found.
2071
2350
  */
2072
- position: number;
2351
+ LyricsNotFound = "LyricsNotFoundEvent",
2073
2352
  /**
2074
- * Whether the player is connected to the voice channel.
2075
- * @type {boolean}
2353
+ * Event type for when a lyrics line is sent.
2076
2354
  */
2077
- connected: boolean;
2355
+ LyricsLine = "LyricsLineEvent",
2078
2356
  /**
2079
- * The ping to the voice server in milliseconds.
2080
- * @type {number}
2357
+ * Event type for when the WebSocket connection is closed.
2081
2358
  */
2082
- ping: number;
2359
+ WebsocketClosed = "WebSocketClosedEvent"
2083
2360
  }
2084
2361
  /**
2085
- * The options to update the player.
2362
+ * The reasons a track can end.
2086
2363
  */
2087
- interface UpdatePlayerInfo {
2364
+ declare enum TrackEndReason {
2088
2365
  /**
2089
- * The guild id associated with the player.
2090
- * @type {string}
2366
+ * The track ended normally.
2091
2367
  */
2092
- guildId: string;
2368
+ Finished = "finished",
2093
2369
  /**
2094
- * The options to update the player.
2095
- * @type {LavalinkPlayOptions}
2370
+ * The track fails to load.
2371
+ */
2372
+ LoadFailed = "loadFailed",
2373
+ /**
2374
+ * The track was stopped.
2375
+ */
2376
+ Stopped = "stopped",
2377
+ /**
2378
+ * The track was replaced.
2096
2379
  */
2097
- playerOptions: LavalinkPlayOptions;
2380
+ Replaced = "replaced",
2098
2381
  /**
2099
- * Whether to replace the current track.
2100
- * @type {boolean | undefined}
2101
- * @default false
2382
+ * The track was cleaned up.
2102
2383
  */
2103
- noReplace?: boolean;
2384
+ Cleanup = "cleanup"
2104
2385
  }
2105
2386
  /**
2106
- * The updated session of the current session.
2387
+ * The options for automatic player error handling.
2107
2388
  */
2108
- interface LavalinkSession {
2389
+ interface ErrorPlayerActions {
2109
2390
  /**
2110
- * Whather the session is resuming.
2111
- * @type {boolean}
2391
+ * Whether to automatically destroy the player on disconnect or error.
2392
+ * @type {boolean | undefined}
2393
+ * @default false
2112
2394
  */
2113
- resuming: boolean;
2395
+ autoDestroy?: boolean;
2114
2396
  /**
2115
- * The timeout for the session.
2116
- * @type {number}
2397
+ * Whether to automatically skip the track on error
2398
+ * @type {boolean | undefined}
2399
+ * @default false
2117
2400
  */
2118
- timeout: number;
2119
- }
2120
- /**
2121
- * The rest options.
2122
- */
2123
- interface HoshimiRestOptions {
2401
+ autoSkip?: boolean;
2124
2402
  /**
2125
- * The amount of time to wait for the player to resume. (in milliseconds)
2126
- * @type {number}
2127
- * @default 10000
2403
+ * Whether to automatically stop the player on error.
2404
+ * @type {boolean | undefined}
2405
+ * @default false
2128
2406
  */
2129
- resumeTimeout?: number;
2407
+ autoStop?: boolean;
2130
2408
  }
2131
2409
  /**
2132
- * The methods for decoding base64 encoded tracks.
2410
+ * The options for error actions.
2133
2411
  */
2134
- interface DecodeMethods {
2412
+ interface DisconnectPlayerActions extends Pick<ErrorPlayerActions, "autoDestroy"> {
2135
2413
  /**
2136
- *
2137
- * Decodes a single base64 encoded track.
2138
- * @param {string} track The base64 encoded track.
2139
- * @param {TrackRequester} requester The requester of the track.
2140
- * @return {Promise<Track>} The decoded track.
2141
- * @example
2142
- * ```ts
2143
- * const node = player.node;
2144
- * const track = await node.decode.single("base64EncodedTrack");
2145
- * console.log(track.info.title); // Track Title
2146
- * ```
2414
+ * Whether to automatically reconnect on disconnect.
2415
+ * @type {boolean | undefined}
2416
+ * @default false
2147
2417
  */
2148
- single(track: string, requester: TrackRequester): Promise<Track>;
2418
+ autoReconnect?: boolean;
2149
2419
  /**
2150
- * Decodes multiple base64 encoded tracks.
2151
- * @param {string[]} tracks The base64 encoded tracks.
2152
- * @param {TrackRequester} requester The requester of the tracks.
2153
- * @return {Promise<Track[]>} The decoded tracks.
2154
- * @example
2155
- * ```ts
2156
- * const node = player.node;
2157
- * const tracks = await node.decode.multiple(["base64EncodedTrack1", "base64EncodedTrack2"]);
2158
- * console.log(tracks[0].info.title); // Track Title 1
2159
- * console.log(tracks[1].info.title); // Track Title 2
2160
- * ```
2420
+ * Whether to automatically add tracks back to the queue on disconnect.
2421
+ * @type {boolean | undefined}
2422
+ * @default false
2161
2423
  */
2162
- multiple(tracks: string[], requester: TrackRequester): Promise<Track[]>;
2424
+ autoQueue?: boolean;
2163
2425
  }
2164
2426
  /**
2165
- * The session of the node.
2166
- */
2167
- type NullableLavalinkSession = PickNullable<LavalinkSession, "timeout">;
2168
-
2169
- /**
2170
- * Class representing the REST for the node.
2171
- * @class Rest
2427
+ * The Hoshimi player options.
2172
2428
  */
2173
- declare class Rest {
2174
- /**
2175
- * The URL for the REST.
2176
- * @type {string}
2177
- */
2178
- readonly url: string;
2429
+ interface HoshimiPlayerOptions {
2179
2430
  /**
2180
- * The version for the REST.
2181
- * @type {string}
2431
+ *
2432
+ * The function to use to get the requester data.
2433
+ * @param {TrackRequester} requester The requester of the track.
2182
2434
  */
2183
- readonly version: string;
2435
+ requesterFn?<T extends TrackRequester = TrackRequester>(requester: TrackRequester): Awaitable<T>;
2184
2436
  /**
2185
- * The timeout for the REST.
2186
- * @type {number}
2437
+ * The options for handling errors.
2438
+ * @type {ErrorPlayerActions | undefined}
2187
2439
  */
2188
- readonly restTimeout: number;
2440
+ onError?: ErrorPlayerActions;
2189
2441
  /**
2190
- * The user agent for the REST.
2191
- * @type {UserAgent}
2442
+ * The options for handling disconnects.
2443
+ * @type {DisconnectPlayerActions | undefined}
2192
2444
  */
2193
- readonly userAgent: UserAgent;
2445
+ onDisconnect?: DisconnectPlayerActions;
2194
2446
  /**
2195
- * The node for the REST.
2196
- * @type {Node}
2447
+ * The customizable player storage adapter.
2448
+ * @type {PlayerStorageAdapter | undefined}
2449
+ * @default {PlayerMemoryStorage}
2197
2450
  */
2198
- readonly node: NodeStructure;
2451
+ storage?: PlayerStorageAdapter;
2452
+ }
2453
+ /**
2454
+ * The base interface for player events.
2455
+ */
2456
+ interface PlayerEvent<E extends PlayerEventType> {
2199
2457
  /**
2200
- *
2201
- * Create a new REST.
2202
- * @param {NodeStructure} node The node for the REST.
2203
- * @example
2204
- * ```ts
2205
- * const node = new Node({
2206
- * host: "localhost",
2207
- * port: 2333,
2208
- * password: "youshallnotpass",
2209
- * secure: false,
2210
- * });
2211
- *
2212
- * const rest = new Rest(node);
2213
- * console.log(rest.restUrl); // http://localhost:2333/v4
2214
- * ```
2458
+ * The type of the event.
2459
+ * @type {E}
2215
2460
  */
2216
- constructor(node: NodeStructure);
2461
+ type: E;
2217
2462
  /**
2218
- * The REST URL to make requests.
2219
- * @type {string}
2463
+ * The operation code for the event.
2464
+ * @type {OpCodes.Event}
2220
2465
  */
2221
- get restUrl(): string;
2466
+ op: OpCodes.Event;
2222
2467
  /**
2223
- * The session id of the node.
2468
+ * The guild id associated with the event.
2224
2469
  * @type {string}
2225
2470
  */
2226
- get sessionId(): string;
2471
+ guildId: string;
2472
+ }
2473
+ /**
2474
+ * The event for when a track starts playing.
2475
+ */
2476
+ interface TrackStartEvent extends PlayerEvent<PlayerEventType.TrackStart> {
2227
2477
  /**
2228
- *
2229
- * Make a request to the node.
2230
- * @param {RestOptions} options The options to make the request.
2231
- * @returns {Promise<T | null>} The response from the node.
2478
+ * The track that started playing.
2479
+ * @type {LavalinkTrack}
2232
2480
  */
2233
- request<T>(options: RestOptions): Promise<T | null>;
2481
+ track: LavalinkTrack;
2482
+ }
2483
+ /**
2484
+ * The event for when a track ends.
2485
+ */
2486
+ interface TrackEndEvent extends PlayerEvent<PlayerEventType.TrackEnd> {
2234
2487
  /**
2235
- *
2236
- * Update the player data.
2237
- * @param {Partial<UpdatePlayerInfo>} data The player data to update.
2238
- * @returns {LavalinkPlayer | null} The updated player data.
2239
- * @example
2240
- * ```ts
2241
- * const player = await node.rest.updatePlayer({
2242
- * guildId: "guildId",
2243
- * noReplace: true,
2244
- * playerOptions: {
2245
- * paused: false,
2246
- * track: { encoded: "encoded track" },
2247
- * },
2248
- * });
2249
- *
2250
- * console.log(player); // The updated lavalink player data
2251
- * ```
2488
+ * The track that ended.
2489
+ * @type {LavalinkTrack}
2252
2490
  */
2253
- updatePlayer(data: Partial<UpdatePlayerInfo>): Promise<LavalinkPlayer | null>;
2491
+ track: LavalinkTrack;
2254
2492
  /**
2255
- *
2256
- * Stop the track in player for the guild.
2257
- * @param {string} guildId the guild id to stop the player
2258
- * @returns {Promise<LavalinkPlayer | null>} The updated player data.
2259
- * @example
2260
- * ```ts
2261
- * const player = await node.rest.stopPlayer("guildId");
2262
- * if (player) console.log(player); // The lavalink player
2263
- * ```
2493
+ * The reason the track ended.
2494
+ * @type {TrackEndReason}
2264
2495
  */
2265
- stopPlayer(guildId: string): Promise<LavalinkPlayer | null>;
2496
+ reason: TrackEndReason;
2497
+ }
2498
+ /**
2499
+ * The event for when a track gets stuck.
2500
+ */
2501
+ interface TrackStuckEvent extends PlayerEvent<PlayerEventType.TrackStuck> {
2266
2502
  /**
2267
- *
2268
- * Destroy the player for the guild.
2269
- * @param {string} guildId The guild id to destroy the player.
2270
- * @returns {Promise<void>} The updated player data.
2271
- * @example
2272
- * ```ts
2273
- * await node.rest.destroyPlayer("guildId");
2274
- * ```
2275
- * @example
2503
+ * The track that got stuck.
2504
+ * @type {LavalinkTrack}
2276
2505
  */
2277
- destroyPlayer(guildId: string): Promise<void>;
2506
+ track: LavalinkTrack;
2278
2507
  /**
2279
- *
2280
- * Update the session for the node
2281
- * @param {boolean} resuming Enable resuming for the session.
2282
- * @param {number | null} timeout The timeout for the session.
2283
- * @returns {Promise<LavalinkSession | null>} The updated session data.
2284
- * @example
2285
- * ```ts
2286
- * const session = await node.rest.updateSession(true, 10000);
2287
- * if (session) console.log(session); // The lavalink session data
2288
- * ```
2508
+ * The threshold in milliseconds.
2509
+ * @type {number}
2289
2510
  */
2290
- updateSession(resuming: boolean, timeout?: number | null): Promise<LavalinkSession | null>;
2511
+ thresholdMs: number;
2291
2512
  }
2292
-
2293
2513
  /**
2294
- * Class representing the DSPX Plugin filters for a player.
2295
- * @class DSPXPluginFilter
2514
+ * The event for when a track encounters an exception.
2296
2515
  */
2297
- declare class DSPXPluginFilter {
2516
+ interface TrackExceptionEvent extends PlayerEvent<PlayerEventType.TrackException> {
2298
2517
  /**
2299
- * The filter manager instance.
2300
- * @type {FilterManagerStructure}
2301
- * @readonly
2518
+ * The exception that occurred.
2519
+ * @type {Exception}
2302
2520
  */
2303
- readonly manager: FilterManagerStructure;
2521
+ exception: Exception;
2522
+ }
2523
+ /**
2524
+ * The event for when the WebSocket connection is closed.
2525
+ */
2526
+ interface WebSocketClosedEvent extends PlayerEvent<PlayerEventType.WebsocketClosed> {
2304
2527
  /**
2305
- * Create a new DSPXPluginFilter instance.
2306
- * @param {FilterManagerStructure} manager The filter manager instance.
2528
+ * The close code.
2529
+ * @type {number}
2307
2530
  */
2308
- constructor(manager: FilterManagerStructure);
2531
+ code: number;
2309
2532
  /**
2310
- *
2311
- * Set the low-pass filter with the given settings.
2312
- * @param {FilterPluginPassSettings} [settings=DefaultFilter.DSPXLowPass] The settings for the low-pass filter.
2313
- * @returns {Promise<this>} The instance of the filter manager.
2533
+ * Whether the connection was closed by the remote.
2534
+ * @type {boolean}
2314
2535
  */
2315
- setLowPass(settings?: Partial<FilterPluginPassSettings>): Promise<this>;
2536
+ byRemote: boolean;
2316
2537
  /**
2317
- *
2318
- * Set the high-pass filter with the given settings.
2319
- * @param {FilterPluginPassSettings} [settings=DefaultFilter.DSPXHighPass] The settings for the high-pass filter.
2320
- * @returns {Promise<this>} The instance of the filter manager.
2538
+ * The reason for the closure.
2539
+ * @type {string}
2321
2540
  */
2322
- setHighPass(settings?: Partial<FilterPluginPassSettings>): Promise<this>;
2541
+ reason: string;
2542
+ }
2543
+ /**
2544
+ * The event for when lyrics are found.
2545
+ */
2546
+ interface LyricsFoundEvent extends PlayerEvent<PlayerEventType.LyricsFound> {
2323
2547
  /**
2324
- *
2325
- * Set the normalization filter with the given settings.
2326
- * @param {NormalizationSettings} [settings=DefaultFilter.DSPXNormalization] The settings for the normalization filter.
2327
- * @returns {Promise<this>} The instance of the filter manager.
2548
+ * The guild id associated with the event.
2549
+ * @type {string}
2328
2550
  */
2329
- setNormalization(settings?: Partial<NormalizationSettings>): Promise<this>;
2551
+ guildId: string;
2330
2552
  /**
2331
- *
2332
- * Set the echo filter with the given settings.
2333
- * @param {EchoSettings} [settings=DefaultFilter.DSPXEcho] The settings for the echo filter.
2334
- * @returns {Promise<this>} The instance of the filter manager.
2553
+ * The lyrics result of the event.
2554
+ * @type {LyricsResult}
2335
2555
  */
2336
- setEcho(settings?: Partial<EchoSettings>): Promise<this>;
2556
+ lyrics: LyricsResult;
2337
2557
  }
2338
-
2339
- type NonLengthEchoSettings = Omit$1<EchoSettings, "echoLength">;
2340
2558
  /**
2341
- * Class representing Lavalink plugin filters.
2342
- * @class LavalinkPluginFilter
2559
+ * The event for when lyrics are not found.
2343
2560
  */
2344
- declare class LavalinkPluginFilter {
2561
+ interface LyricsNotFoundEvent extends PlayerEvent<PlayerEventType.LyricsNotFound> {
2562
+ }
2563
+ /**
2564
+ * The event for when a lyrics line is sent.
2565
+ */
2566
+ interface LyricsLineEvent extends PlayerEvent<PlayerEventType.LyricsLine> {
2345
2567
  /**
2346
- * The filter manager instance.
2347
- * @type {FilterManagerStructure}
2348
- * @private
2349
- * @readonly
2568
+ * The guild id associated with the event.
2569
+ * @type {string}
2350
2570
  */
2351
- private readonly manager;
2571
+ guildId: string;
2352
2572
  /**
2353
- * Creates an instance of LavalinkPluginFilter.
2354
- * @param {FilterManagerStructure} filters - The filter manager instance.
2573
+ * The line index of the lyrics line.
2574
+ * @type {number}
2355
2575
  */
2356
- constructor(filters: FilterManagerStructure);
2576
+ lineIndex: number;
2357
2577
  /**
2358
- *
2359
- * Set the echo filter with the given settings.
2360
- * @param {Omit<EchoSettings, "echoLength">} [settings=DefaultFilter.PluginEcho] The settings for the echo filter.
2361
- * @returns {Promise<this>} The instance of the filter manager.
2578
+ * The lyrics line of the event.
2579
+ * @type {LyricsLine}
2362
2580
  */
2363
- setEcho(settings?: Partial<NonLengthEchoSettings>): Promise<this>;
2581
+ line: LyricsLine;
2364
2582
  /**
2365
- *
2366
- * Set the reverb filter with the given settings.
2367
- * @param {Partial<LavalinkFilterPluginReverbSettings>} [settings=DefaultFilter.PluginReverb] The settings for the reverb filter.
2368
- * @returns {Promise<this>} The instance of the filter manager.
2583
+ * Returns if the line was skipped.
2584
+ * @type {boolean}
2369
2585
  */
2370
- setReverb(settings?: Partial<LavalinkFilterPluginReverbSettings>): Promise<this>;
2586
+ skipped: boolean;
2371
2587
  }
2372
-
2373
2588
  /**
2374
- * Class representing a filter manager for a player.
2375
- * @class FilterManager
2589
+ * The update for the player state.
2376
2590
  */
2377
- declare class FilterManager {
2591
+ interface PlayerUpdate {
2378
2592
  /**
2379
- * The player this filter manager belongs to.
2380
- * @type {PlayerStructure}
2381
- * @public
2382
- * @readonly
2593
+ * The operation code for the update.
2594
+ * @type {OpCodes.PlayerUpdate}
2383
2595
  */
2384
- readonly player: PlayerStructure;
2596
+ op: OpCodes.PlayerUpdate;
2385
2597
  /**
2386
- * The bands applied to the player.
2387
- * @type {EQBandSettings[]}
2388
- * @readonly
2598
+ * The guild ID associated with the update.
2599
+ * @type {string}
2389
2600
  */
2390
- readonly bands: EQBandSettings[];
2601
+ guildId: string;
2391
2602
  /**
2392
- * The current filter settings applied to the player.
2393
- * @type {FilterSettings}
2394
- * @public
2603
+ * The state of the player.
2604
+ * @type {PlayerUpdateState}
2395
2605
  */
2396
- data: FilterSettings;
2606
+ state: PlayerUpdateState;
2607
+ }
2608
+ interface PlayerUpdateState {
2397
2609
  /**
2398
- * The enabled filters for the player.
2399
- * @type {EnabledPlayerFilters}
2610
+ * Whether the player is connected.
2611
+ * @type {boolean}
2400
2612
  */
2401
- filters: EnabledPlayerFilters;
2613
+ connected: boolean;
2402
2614
  /**
2403
- * The lavalink plugin filters manager.
2404
- * @type {LavalinkPluginFilter}
2405
- * @readonly
2615
+ * The position of the track.
2616
+ * @type {number}
2406
2617
  */
2407
- readonly plugin: LavalinkPluginFilter;
2618
+ position: number;
2408
2619
  /**
2409
- * The DSPX plugin filters manager.
2410
- * @type {DSPXPluginFilter}
2411
- * @readonly
2620
+ * The time of the update.
2621
+ * @type {number}
2412
2622
  */
2413
- readonly dspx: DSPXPluginFilter;
2623
+ time: number;
2414
2624
  /**
2415
- *
2416
- * Creates a new filter manager.
2417
- * @param {PlayerStructure} player The player this filter manager belongs to.
2625
+ * The ping of the player.
2626
+ * @type {number}
2418
2627
  */
2419
- constructor(player: PlayerStructure);
2628
+ ping: number;
2629
+ }
2630
+ /**
2631
+ * The options for the player.
2632
+ */
2633
+ interface PlayerOptions {
2420
2634
  /**
2421
- * Resets all filters to their default values.
2422
- * @returns {Promise<this>} A promise that resolves to the instance of the filter manager.
2635
+ * Guild id of the player.
2636
+ * @type {string}
2423
2637
  */
2424
- reset(): Promise<this>;
2638
+ guildId: string;
2425
2639
  /**
2426
- *
2427
- * Applies the current filters to the player.
2428
- * @returns {Promise<this>} A promise that resolves to the instance of the filter manager.
2640
+ * Voice channel id of the player.
2641
+ * @type {string}
2429
2642
  */
2430
- apply(): Promise<this>;
2643
+ voiceId: string;
2431
2644
  /**
2432
- * Checks if the current filters are active.
2433
- * @param {TimescaleSettings} timescale The timescale settings to check against.
2434
- * @returns {void} Nothing!
2645
+ * Volume of the player.
2646
+ * @type {number | undefined}
2647
+ * @default 100
2435
2648
  */
2436
- check(timescale?: TimescaleSettings): void;
2649
+ volume?: number;
2437
2650
  /**
2438
- *
2439
- * Checks if a specific filter is active.
2440
- * @param {FilterType} filter The filter type to check.
2441
- * @returns {boolean} True if the filter is active, false otherwise.
2651
+ * Set if the player should be deafened.
2652
+ * @type {boolean | undefined}
2653
+ * @default true
2442
2654
  */
2443
- has(filter: FilterType): boolean;
2655
+ selfDeaf?: boolean;
2444
2656
  /**
2445
- *
2446
- * Sets the volume for the player.
2447
- * @param {number} volume The volume level to set (between 0 and 5).
2448
- * @returns {Promise<this>} A promise that resolves to the player instance.
2657
+ * Set if the player should be muted.
2658
+ * @type {boolean | undefined}
2659
+ * @default false
2449
2660
  */
2450
- setVolume(volume: number): Promise<this>;
2661
+ selfMute?: boolean;
2451
2662
  /**
2452
- * Sets the audio output for the player.
2453
- * @param {AudioOutput} output The audio output to set.
2454
- * @returns {Promise<this>} A promise that resolves to the player instance.
2663
+ * Text channel id of the player.
2664
+ * @type {string | undefined}
2455
2665
  */
2456
- setAudioOutput(output: AudioOutput): Promise<this>;
2666
+ textId?: string;
2457
2667
  /**
2458
- *
2459
- * Sets the speed for the player.
2460
- * @param {number} speed The speed to set (default is 1).
2461
- * @returns {Promise<this>} A promise that resolves to the player instance.
2668
+ * Lavalink node of the player.
2669
+ * @type {NodeIdentifier}
2462
2670
  */
2463
- setSpeed(speed?: number): Promise<this>;
2671
+ node?: NodeIdentifier;
2672
+ }
2673
+ /**
2674
+ * The options for playing a track with Lavalink.
2675
+ */
2676
+ interface LavalinkPlayOptions extends BasePlayOptions {
2464
2677
  /**
2465
- *
2466
- * Sets the rate for the player.
2467
- * @param {number} rate The rate to set (default is 1).
2468
- * @returns {Promise<this>} A promise that resolves to the player instance.
2678
+ * Track to play.
2679
+ * @type {PartialLavalinkTrack | undefined}
2469
2680
  */
2470
- setRate(rate?: number): Promise<this>;
2681
+ track?: PartialLavalinkTrack;
2682
+ }
2683
+ /**
2684
+ * The options for playing a track.
2685
+ */
2686
+ interface PlayOptions extends BasePlayOptions {
2471
2687
  /**
2472
- *
2473
- * Sets the pitch for the player.
2474
- * @param {number} pitch The pitch
2475
- * @returns {Promise<this>} A promise that resolves to the player instance.
2688
+ * Whether to replace the current track.
2689
+ * @type {boolean | undefined}
2690
+ * @default false
2476
2691
  */
2477
- setPitch(pitch?: number): Promise<this>;
2692
+ noReplace?: boolean;
2478
2693
  /**
2479
- *
2480
- * Sets the EQ bands for the player.
2481
- * @param {RestOrArray<EQBandSettings>} bands The EQ band settings to set.
2482
- * @returns {Promise<this>} A promise that resolves to the instance of the manager.
2694
+ * Track to play.
2695
+ * @type {Track | UnresolvedTrack | undefined}
2483
2696
  */
2484
- setEQBand(...bands: RestOrArray<EQBandSettings>): Promise<this>;
2697
+ track?: Track | UnresolvedTrack;
2698
+ }
2699
+ interface PlayerVoice {
2485
2700
  /**
2486
- *
2487
- * Clears all EQ bands for the player.
2488
- * @returns {Promise<this>} A promise that resolves to the instance of the manager.
2701
+ * The voice server token.
2702
+ * @type {string}
2489
2703
  */
2490
- clearEQBands(): Promise<this>;
2704
+ token: string;
2491
2705
  /**
2492
- *
2493
- * Set the vibrato filter with the given settings.
2494
- * @param {TremoloSettings} [settings=DefaultFilterPreset.Vibrato] The settings for the vibrato filter.
2495
- * @returns {Promise<this>} The instance of the filter manager.
2706
+ * The voice server endpoint.
2707
+ * @type {string}
2496
2708
  */
2497
- setVibrato(settings?: Partial<TremoloSettings>): Promise<this>;
2709
+ endpoint: string;
2498
2710
  /**
2499
- *
2500
- * Set the tremolo filter with the given settings.
2501
- * @param {TremoloSettings} [settings=DefaultFilterPreset.Tremolo] The settings for the tremolo filter.
2502
- * @returns {Promise<this>} The instance of the filter manager.
2711
+ * The voice server session id.
2712
+ * @type {string}
2713
+ */
2714
+ sessionId: string;
2715
+ /**
2716
+ * The voice server guild id.
2717
+ * @type {string | undefined}
2718
+ */
2719
+ connected?: boolean;
2720
+ /**
2721
+ * The voice server ping.
2722
+ * @type {number | undefined}
2723
+ */
2724
+ ping?: number;
2725
+ }
2726
+ /**
2727
+ * The JSON representation of the player.
2728
+ */
2729
+ interface PlayerJson {
2730
+ /**
2731
+ * The guild id of the player.
2732
+ * @type {string}
2503
2733
  */
2504
- setTremolo(settings?: Partial<TremoloSettings>): Promise<this>;
2734
+ guildId: string;
2505
2735
  /**
2506
- *
2507
- * Set the low-pass filter with the given settings.
2508
- * @param {LowPassSettings} [settings=DefaultFilterPreset.Lowpass] The settings for the low-pass filter.
2509
- * @returns {Promise<this>} The instance of the filter manager.
2736
+ * The volume of the player.
2737
+ * @type {number}
2510
2738
  */
2511
- setLowPass(settings?: Partial<LowPassSettings>): Promise<this>;
2739
+ volume: number;
2512
2740
  /**
2513
- * Set the nightcore filter with the given settings.
2514
- * @param {Partial<TimescaleSettings>} [settings=DefaultFilterPreset.Nightcore] The settings for the nightcore filter.
2515
- * @returns {Promise<this>} The instance of the filter manager.
2741
+ * The self deaf state of the player.
2742
+ * @type {boolean}
2516
2743
  */
2517
- setNightcore(settings?: Partial<TimescaleSettings>): Promise<this>;
2744
+ selfDeaf: boolean;
2518
2745
  /**
2519
- *
2520
- * Set the vaporwave filter with the given settings.
2521
- * @param {Partial<TimescaleSettings>} [settings=DefaultFilterPreset.Vaporwave] The settings for the vaporwave filter.
2522
- * @returns {Promise<this>} The instance of the filter manager.
2746
+ * The self mute state of the player.
2747
+ * @type {boolean}
2523
2748
  */
2524
- setVaporwave(settings?: Partial<TimescaleSettings>): Promise<this>;
2749
+ selfMute: boolean;
2525
2750
  /**
2526
- *
2527
- * Set the karaoke filter with the given settings.
2528
- * @param {KaraokeSettings} [settings=DefaultFilterPreset.Karaoke] The settings for the karaoke filter.
2529
- * @returns {Promise<this>} The instance of the filter manager.
2751
+ * The voice settings for the player.
2752
+ * @type {LavalinkPlayerVoice}
2530
2753
  */
2531
- setKaraoke(settings?: Partial<KaraokeSettings>): Promise<this>;
2754
+ voice: Nullable<LavalinkPlayerVoice>;
2532
2755
  /**
2533
- *
2534
- * Set the distortion filter with the given settings.
2535
- * @param {Partial<DistortionSettings>} [settings=DefaultFilterPreset.Distortion] The settings for the distortion filter.
2536
- * @returns {Promise<this>} The instance of the filter manager.
2756
+ * The loop mode of the player.
2757
+ * @type {LoopMode}
2537
2758
  */
2538
- setDistortion(settings?: Partial<DistortionSettings>): Promise<this>;
2759
+ loop: LoopMode;
2539
2760
  /**
2540
- * Set the timescale filter with the given settings.
2541
- * @param {Partial<TimescaleSettings>} settings The timescale settings to set.
2542
- * @returns {Promise<this>} The instance of the filter manager.
2761
+ * The options for the player.
2762
+ * @type {boolean}
2543
2763
  */
2544
- setTimescale(settings: Partial<TimescaleSettings>): Promise<this>;
2764
+ options: PlayerOptions;
2545
2765
  /**
2546
- * Convert the filter settings to a JSON object.
2547
- * @returns {FilterSettings} The filter settings as a JSON object.
2766
+ * The paused state of the player.
2767
+ * @type {boolean}
2548
2768
  */
2549
- toJSON(): FilterSettings;
2550
- }
2551
-
2552
- /**
2553
- * Type representing the customizable player storage.
2554
- */
2555
- type StorageKeys = keyof CustomizablePlayerStorage | (string & {});
2556
- /**
2557
- * Type representing the customizable player storage values.
2558
- */
2559
- type StorageValues<V extends StorageKeys = StorageKeys> = V extends keyof CustomizablePlayerStorage ? CustomizablePlayerStorage[V] : unknown;
2560
- /**
2561
- * Class representing a player storage.
2562
- * @class PlayerStorage
2563
- */
2564
- declare class PlayerStorage<K extends StorageKeys = StorageKeys, V extends StorageValues<K> = StorageValues<K>> {
2769
+ paused: boolean;
2565
2770
  /**
2566
- *
2567
- * Get the value for a key in the storage.
2568
- * @param {K} key The key to get the value for.
2569
- * @returns {V | undefined} The value for the key, or undefined if it doesn't exist.
2771
+ * The playing state of the player.
2772
+ * @type {boolean}
2570
2773
  */
2571
- get<K extends StorageKeys, V extends StorageValues<K>>(key: K): V | undefined;
2774
+ playing: boolean;
2572
2775
  /**
2573
- * Set the value for a key in the storage.
2574
- * @param {K} key The key to set the value for.
2575
- * @param {V} value The value to set for the key.
2776
+ * The voice channel id of the player.
2777
+ * @type {string}
2576
2778
  */
2577
- set<K extends StorageKeys, V extends StorageValues<K>>(key: K, value: V): void;
2779
+ voiceId?: string;
2578
2780
  /**
2579
- * Check if the storage has a key.
2580
- * @param {K} key The key to check for.
2581
- * @returns {boolean} True if the storage has the key, false otherwise.
2781
+ * The text channel id of the player.
2782
+ * @type {string | undefined}
2582
2783
  */
2583
- has(key: K): boolean;
2784
+ textId?: string;
2584
2785
  /**
2585
- * Delete a key from the storage.
2586
- * @param {K} key The key to delete.
2587
- * @returns {boolean} True if the key was deleted, false otherwise.
2786
+ * The last position received from Lavalink.
2787
+ * @type {number}
2588
2788
  */
2589
- delete(key: K): boolean;
2789
+ lastPosition: number;
2590
2790
  /**
2591
- * Get all keys in the storage.
2592
- * @returns {K[]} The keys in the storage.
2791
+ * The timestamp when the last position change update happened.
2792
+ * @type {number | null}
2593
2793
  */
2594
- keys<K extends StorageKeys[]>(): K[];
2794
+ lastPositionUpdate: number | null;
2595
2795
  /**
2596
- * Get all values in the storage.
2597
- * @returns {V[]} The values in the storage.
2796
+ * The current calculated position of the player.
2797
+ * @type {number}
2598
2798
  */
2599
- values<K extends StorageKeys[], V extends StorageValues<K[number]>>(): V[];
2799
+ position: number;
2600
2800
  /**
2601
- * Get all entries in the storage.
2602
- * @returns {[K, V][]} The entries in the storage.
2801
+ * The timestamp when the player was created.
2802
+ * @type {number}
2603
2803
  */
2604
- entries<K extends StorageKeys[], V extends StorageValues<K[number]>>(): [K, V][];
2804
+ createdTimestamp: number;
2605
2805
  /**
2606
- *
2607
- * Get all key-value pairs in the storage.
2608
- * @returns {Record<K[number], V>} An object containing all key-value pairs in the storage, excluding internal keys.
2806
+ * The ping of the player.
2807
+ * @type {number}
2609
2808
  */
2610
- all<K extends StorageKeys[], V extends StorageValues<K[number]>>(): Record<K[number], V>;
2809
+ ping: number;
2611
2810
  /**
2612
- * Clear the storage.
2811
+ * The queue of the player.
2812
+ * @type {QueueJson}
2613
2813
  */
2614
- clear(): void;
2814
+ queue: QueueJson;
2615
2815
  /**
2616
- * Get the size of the storage.
2617
- * @returns {number} The number of entries in the storage.
2816
+ * The node of the player.
2817
+ * @type {NodeJson}
2618
2818
  */
2619
- get size(): number;
2819
+ node: NodeJson;
2820
+ /**
2821
+ * The filter settings of the player.
2822
+ * @type {FilterSettings}
2823
+ */
2824
+ filters: FilterSettings;
2620
2825
  }
2621
-
2622
- /**
2623
- * Type representing a nullable voice channel update.
2624
- */
2625
- type NullableVoiceChannelUpdate = Partial<Nullable<VoiceChannelUpdate>>;
2626
2826
  /**
2627
- * Class representing a Hoshimi player.
2628
- * @class Player
2827
+ * The lyrics methods for the player.
2629
2828
  */
2630
- declare class Player {
2631
- /**
2632
- * The data for the player.
2633
- * @type {PlayerStorage}
2634
- * @readonly
2635
- */
2636
- readonly data: PlayerStorage;
2829
+ interface LyricsMethods {
2637
2830
  /**
2638
- * The options for the player.
2639
- * @type {PlayerOptions}
2640
- * @readonly
2831
+ *
2832
+ * Get the current lyrics for the current track.
2833
+ * @param {boolean} [skipSource=false] Whether to skip the source or not.
2834
+ * @returns {Promise<LyricsResult | null>} The lyrics result or null if not found.
2835
+ * @example
2836
+ * ```ts
2837
+ * const player = manager.getPlayer("guildId");
2838
+ * const lyrics = await player.lyrics.current();
2839
+ * ```
2641
2840
  */
2642
- readonly options: PlayerOptions;
2841
+ current(skipSource?: boolean): Promise<LyricsResult | null>;
2643
2842
  /**
2644
- * The manager for the player.
2645
- * @type {Hoshimi}
2646
- * @readonly
2843
+ *
2844
+ * Get the lyrics for a specific track.
2845
+ * @param {Track} track The track to get the lyrics for.
2846
+ * @param {boolean} [skipSource=false] Whether to skip the source or not.
2847
+ * @returns {Promise<LyricsResult | null>} The lyrics result or null if not found.
2848
+ * @example
2849
+ * ```ts
2850
+ * const player = manager.getPlayer("guildId");
2851
+ * const track = player.queue.current;
2852
+ * const lyrics = await player.lyrics.get(track);
2853
+ * ```
2647
2854
  */
2648
- readonly manager: Hoshimi;
2855
+ get(track: Track, skipSource?: boolean): Promise<LyricsResult | null>;
2649
2856
  /**
2650
- * The queue for the player.
2651
- * @type {Queue}
2652
- * @readonly
2857
+ *
2858
+ * Subscribe to the lyrics for a specific guild.
2859
+ * @param {boolean} [skipSource=false] Whether to skip the source or not.
2860
+ * @returns {Promise<void>} Let's start the sing session!
2861
+ * @example
2862
+ * ```ts
2863
+ * const player = manager.getPlayer("guildId");
2864
+ * await player.lyrics.subscribe();
2865
+ * ```
2653
2866
  */
2654
- readonly queue: QueueStructure;
2867
+ subscribe(skipSource?: boolean): Promise<void>;
2655
2868
  /**
2656
- * The filter manager for the player.
2657
- * @type {FilterManager}
2658
- * @readonly
2869
+ *
2870
+ * Unsubscribe from the lyrics for a specific guild.
2871
+ * @returns {Promise<void>} Let's stop the sing session!
2872
+ * @example
2873
+ * ```ts
2874
+ * const player = manager.getPlayer("guildId");
2875
+ * await player.lyrics.unsubscribe();
2876
+ * ```
2659
2877
  */
2660
- readonly filterManager: FilterManager;
2878
+ unsubscribe(): Promise<void>;
2879
+ }
2880
+ /**
2881
+ * The voice channel update options.
2882
+ */
2883
+ type VoiceChannelUpdate = Pick<PlayerOptions, "selfDeaf" | "voiceId" | "selfMute">;
2884
+ /**
2885
+ * The voice settings for the player.
2886
+ */
2887
+ type LavalinkPlayerVoice = Omit<PlayerVoice, "connected" | "ping">;
2888
+
2889
+ /**
2890
+ * Class representing a LyricsManager.
2891
+ * @class LyricsManager
2892
+ */
2893
+ declare class LyricsManager {
2661
2894
  /**
2662
- * The node for the player.
2895
+ * The node instance.
2663
2896
  * @type {NodeStructure}
2897
+ * @readonly
2664
2898
  */
2665
- node: NodeStructure;
2666
- /**
2667
- * Check if the player is self deafened.
2668
- * @type {boolean}
2669
- */
2670
- selfDeaf: boolean;
2671
- /**
2672
- * Check if the player is self muted.
2673
- * @type {boolean}
2674
- */
2675
- selfMute: boolean;
2899
+ readonly node: NodeStructure;
2676
2900
  /**
2677
- * Loop mode of the player.
2678
- * @type {LoopMode}
2679
- * @default LoopMode.Off
2901
+ * Create a new LyricsManager instance.
2902
+ * @param {NodeStructure} node The node instance.
2903
+ * @example
2904
+ * ```ts
2905
+ * const node = manager.nodeManager.get("nodeId");
2906
+ * const lyricsManager = new LyricsManager(node);
2907
+ * ```
2680
2908
  */
2681
- loop: LoopMode;
2909
+ constructor(node: NodeStructure);
2682
2910
  /**
2683
- * Check if the player is playing.
2684
- * @type {boolean}
2685
- * @default false
2911
+ *
2912
+ * Get the current lyrics for the current track.
2913
+ * @param {boolean} skipSource Whether to skip the track source or not.
2914
+ * @returns {Promise<LyricsResult | null>} The lyrics result or null if not found.
2915
+ * @example
2916
+ * ```ts
2917
+ * const player = manager.getPlayer("guildId");
2918
+ * const lyrics = await player.lyricsManager.current();
2919
+ * ```
2686
2920
  */
2687
- playing: boolean;
2921
+ current(guildId: string, skipSource?: boolean): Promise<LyricsResult | null>;
2688
2922
  /**
2689
- * Check if the player is paused.
2690
- * @type {boolean}
2691
- * @default false
2923
+ *
2924
+ * Get the lyrics for a specific track.
2925
+ * @param {Track} track The track to get the lyrics for.
2926
+ * @param {boolean} skipSource Whether to skip the track source or not.
2927
+ * @returns {Promise<LyricsResult | null>} The lyrics result or null if not found.
2928
+ * @example
2929
+ * ```ts
2930
+ * const node = manager.nodeManager.get("nodeId");
2931
+ * const lyrics = await node.lyricsManager.get(track);
2932
+ * ```
2692
2933
  */
2693
- paused: boolean;
2694
- /**
2695
- * Check if the player is connected.
2696
- * @type {boolean}
2697
- * @default false
2934
+ get(track: Track, skipSource?: boolean): Promise<LyricsResult | null>;
2935
+ /**
2936
+ *
2937
+ * Subscribe to the lyrics for a specific guild.
2938
+ * @param {string} guildId The guild id to subscribe to.
2939
+ * @param {boolean} skipSource Whether to skip the track source or not.
2940
+ * @returns {Promise<void>} Let's start the sing session!
2941
+ * @example
2942
+ * ```ts
2943
+ * const node = manager.nodeManager.get("nodeId");
2944
+ * await node.lyricsManager.subscribe("guildId");
2945
+ * ```
2698
2946
  */
2699
- connected: boolean;
2947
+ subscribe(guildId: string, skipSource?: boolean): Promise<void>;
2700
2948
  /**
2701
- * Volume of the player.
2702
- * @type {number}
2703
- * @default 100
2949
+ *
2950
+ * Unsubscribe from the lyrics for a specific guild.
2951
+ * @param {string} guildId The guild id to unsubscribe from.
2952
+ * @returns {Promise<void>} Let's stop the sing session!
2953
+ * @example
2954
+ * ```ts
2955
+ * const node = manager.nodeManager.get("nodeId");
2956
+ * await node.lyricsManager.unsubscribe("guildId");
2957
+ * ```
2704
2958
  */
2705
- volume: number;
2959
+ unsubscribe(guildId: string): Promise<void>;
2960
+ }
2961
+
2962
+ /**
2963
+ * Represents a collection that extends the built-in Map class.
2964
+ * @template K The type of the keys in the collection.
2965
+ * @template V The type of the values in the collection.
2966
+ */
2967
+ declare class Collection<K, V> extends Map<K, V> {
2706
2968
  /**
2707
- * Guild ig of the player.
2708
- * @type {string}
2969
+ * Removes elements from the collection based on a filter function.
2970
+ * @param fn The filter function that determines which elements to remove.
2971
+ * @param thisArg The value to use as `this` when executing the filter function.
2972
+ * @returns The number of elements removed from the collection.
2973
+ * @example
2974
+ * const collection = new Collection<number, string>();
2975
+ * collection.set(1, 'one');
2976
+ * collection.set(2, 'two');
2977
+ * collection.set(3, 'three');
2978
+ * const removedCount = collection.sweep((value, key) => key % 2 === 0);
2979
+ * console.log(removedCount); // Output: 1
2980
+ * console.log(collection.size); // Output: 2
2709
2981
  */
2710
- guildId: string;
2982
+ sweep(fn: (value: V, key: K, collection: this) => unknown): number;
2711
2983
  /**
2712
- * Voice channel idof the player.
2713
- * @type {string | undefined}
2984
+ * Creates a new array with the results of calling a provided function on every element in the collection.
2985
+ * @param fn The function that produces an element of the new array.
2986
+ * @param thisArg The value to use as `this` when executing the map function.
2987
+ * @returns A new array with the results of calling the provided function on every element in the collection.
2988
+ * @example
2989
+ * const collection = new Collection<number, string>();
2990
+ * collection.set(1, 'one');
2991
+ * collection.set(2, 'two');
2992
+ * collection.set(3, 'three');
2993
+ * const mappedArray = collection.map((value, key) => `${key}: ${value}`);
2994
+ * console.log(mappedArray); // Output: ['1: one', '2: two', '3: three']
2714
2995
  */
2715
- voiceId: string | undefined;
2996
+ map<T>(fn: (value: V, key: K, collection: this) => T): T[];
2716
2997
  /**
2717
- * Text channel id of the player.
2718
- * @type {string | undefined}
2998
+ * Creates a new array with all elements that pass the test implemented by the provided function.
2999
+ * @param fn The function to test each element of the collection.
3000
+ * @param thisArg The value to use as `this` when executing the filter function.
3001
+ * @returns A new array with the elements that pass the test.
3002
+ * @example
3003
+ * const collection = new Collection<number, string>();
3004
+ * collection.set(1, 'one');
3005
+ * collection.set(2, 'two');
3006
+ * collection.set(3, 'three');
3007
+ * const filteredArray = collection.filter((value, key) => key % 2 === 0);
3008
+ * console.log(filteredArray); // Output: ['two']
2719
3009
  */
2720
- textId: string | undefined;
3010
+ filter(fn: (value: V, key: K, collection: this) => boolean): V[];
2721
3011
  /**
2722
- * The ping of the player.
2723
- * @type {number}
3012
+ * Returns the value of the first element in the collection that satisfies the provided testing function.
3013
+ * @param fn The function to test each element of the collection.
3014
+ * @returns The value of the first element that passes the test. `undefined` if no element passes the test.
3015
+ * @example
3016
+ * const collection = new Collection<number, number>();
3017
+ * collection.set(1, 1);
3018
+ * collection.set(2, 2);
3019
+ * collection.set(3, 3);
3020
+ * const firstEvenValue = collection.find(value => value % 2 === 0);
3021
+ * console.log(firstEvenValue); // Output: 2
2724
3022
  */
2725
- ping: number;
3023
+ find(fn: (value: V, key: K, collection: this) => boolean): V | undefined;
3024
+ }
3025
+
3026
+ /**
3027
+ * Class representing a node manager.
3028
+ * @class NodeManager
3029
+ */
3030
+ declare class NodeManager {
2726
3031
  /**
2727
- * The timestamp when the player was created.
2728
- * @type {number}
3032
+ * The manager for the node.
3033
+ * @type {Hoshimi}
3034
+ * @readonly
2729
3035
  */
2730
- createdTimestamp: number;
3036
+ readonly manager: Hoshimi;
2731
3037
  /**
2732
- * The last position received from Lavalink.
2733
- * @type {number}
3038
+ * The nodes for the manager.
3039
+ * @type {Collection<string, Node>}
3040
+ * @readonly
2734
3041
  */
2735
- lastPosition: number;
3042
+ readonly nodes: Collection<string, NodeStructure>;
2736
3043
  /**
2737
- * The timestamp when the last position change update happened.
2738
- * @type {number | null}
3044
+ *
3045
+ * The constructor for the node manager.
3046
+ * @param {Hoshimi} manager The manager for the node.
3047
+ * @example
3048
+ * ```ts
3049
+ * const manager = new Hoshimi();
3050
+ * const nodeManager = new NodeManager(manager);
3051
+ *
3052
+ * console.log(nodeManager.nodes.size); // 0
3053
+ * ```
2739
3054
  */
2740
- lastPositionUpdate: number | null;
3055
+ constructor(manager: Hoshimi);
2741
3056
  /**
2742
- * The current calculated position of the player.
2743
- * @type {number}
2744
- * @readonly
3057
+ *
3058
+ * Delete the node.
3059
+ * @param {NodeIdentifier} node The node or node id to delete.
3060
+ * @returns {boolean} If the node was deleted.
3061
+ * @example
3062
+ * ```ts
3063
+ * const node = manager.nodeManager.get("node1");
3064
+ * if (node) manager.nodeManager.delete(node.id); // true if the node was deleted
3065
+ * ```
2745
3066
  */
2746
- get position(): number;
3067
+ delete(node: NodeIdentifier): boolean;
2747
3068
  /**
2748
- * The voice connection details.
2749
- * @type {PlayerVoice}
3069
+ *
3070
+ * Get the node by id.
3071
+ * @param {NodeIdentifier} node The node or node id to get.
3072
+ * @returns {NodeStructure | undefined} The node or undefined if not found.
3073
+ * @example
3074
+ * ```ts
3075
+ * const node = manager.nodeManager.get("node1");
3076
+ * if (node) {
3077
+ * console.log(node.id); // node1
3078
+ * } else {
3079
+ * console.log("Node not found");
3080
+ * }
3081
+ * ```
2750
3082
  */
2751
- voice: Nullable<LavalinkPlayerVoice>;
3083
+ get(node: NodeIdentifier): NodeStructure | undefined;
2752
3084
  /**
2753
3085
  *
2754
- * Create a new player.
2755
- * @param {Hoshimi} manager The manager for the player.
2756
- * @param {PlayOptions} options The options for the player.
3086
+ * Create a new node.
3087
+ * @param {NodeOptions} options The options for the node.
3088
+ * @returns {NodeStructure} The created node.
2757
3089
  * @example
2758
3090
  * ```ts
2759
- * const player = new Player(manager, {
2760
- * guildId: "guildId",
2761
- * voiceId: "voiceId",
2762
- * textId: "textId",
2763
- * selfDeaf: true,
2764
- * selfMute: false,
2765
- * volume: 100,
3091
+ * const node = manager.nodeManager.create({
3092
+ * host: "localhost",
3093
+ * port: 2333,
3094
+ * password: "password",
3095
+ * secure: false,
2766
3096
  * });
2767
3097
  *
2768
- * console.log(player.guildId); // guildId
2769
- * console.log(player.voiceId); // voiceId
2770
- * console.log(player.textId); // textId
3098
+ * console.log(node.id); // localhost:2333
2771
3099
  */
2772
- constructor(manager: Hoshimi, options: PlayerOptions);
3100
+ create(options: NodeOptions): NodeStructure;
2773
3101
  /**
2774
- * The lyrics methods for the player.
2775
- * @type {LyricsMethods}
2776
- * @readonly
3102
+ *
3103
+ * Destroy a node.
3104
+ * @param {NodeIdentifier} node The node or node id to destroy.
3105
+ * @returns {void}
3106
+ * @example
3107
+ * ```ts
3108
+ * const node = manager.nodeManager.get("node1");
3109
+ * if (node) node.destroy();
3110
+ * ```
2777
3111
  */
2778
- readonly lyrics: LyricsMethods;
3112
+ destroy(node: NodeIdentifier): void;
2779
3113
  /**
2780
3114
  *
2781
- * Search for a track or playlist.
2782
- * @param {SearchOptions} options The options for the search.
2783
- * @returns {Promise<QueryResult>} The search result.
3115
+ * Reconnect a node.
3116
+ * @param {NodeIdentifier} node The node or node id to reconnect.
3117
+ * @returns {void}
2784
3118
  * @example
2785
3119
  * ```ts
2786
- * const player = manager.getPlayer("guildId");
2787
- * const result = await player.search({
2788
- * query: "track name",
2789
- * engine: SearchEngine.Youtube,
2790
- * requester: {},
2791
- * });
3120
+ * const node = manager.nodeManager.get("node1");
3121
+ * if (node) node.reconnect();
3122
+ * ```
3123
+ */
3124
+ reconnect(node: NodeIdentifier): void;
3125
+ /**
2792
3126
  *
2793
- * console.log(result) // the search result
3127
+ * Disconnect a node.
3128
+ * @param {NodeIdentifier} node The node or node id to disconnect.
3129
+ * @returns {void}
3130
+ * @example
3131
+ * ```ts
3132
+ * const node = manager.nodeManager.get("node1");
3133
+ * if (node) node.disconnect();
2794
3134
  * ```
2795
3135
  */
2796
- search(options: SearchOptions): Promise<QueryResult>;
3136
+ disconnect(node: NodeIdentifier): void;
2797
3137
  /**
2798
3138
  *
2799
- * Play the next track in the queue.
2800
- * @param {number} [to=0] The amount of tracks to skip.
2801
- * @param {boolean} [throwError=true] Whether to throw an error if there are no tracks to skip.
2802
- * @returns {Promise<void>}
2803
- * @throws {PlayerError} If there are no tracks to skip.
3139
+ * Connect a node.
3140
+ * @param {NodeIdentifier} node The node or node id to connect.
3141
+ * @returns {void}
2804
3142
  * @example
2805
3143
  * ```ts
2806
- * const player = manager.getPlayer("guildId");
2807
- * player.skip(2); // skip 2 tracks
2808
- * player.skip(); // skip 1 track
3144
+ * const node = manager.nodeManager.get("node1");
3145
+ * if (node) node.connect();
2809
3146
  * ```
2810
3147
  */
2811
- skip(to?: number, throwError?: boolean): Promise<void>;
3148
+ connect(node: NodeIdentifier): void;
2812
3149
  /**
2813
3150
  *
2814
- * Seek to a specific position in the current track.
2815
- * @param {number} position The position to seek to in milliseconds.
2816
- * @returns {Promise<void>}
2817
- * @throws {PlayerError} If the position is invalid.
3151
+ * Get the least used node.
3152
+ * @returns {NodeStructure} The least used node.
2818
3153
  * @example
2819
3154
  * ```ts
2820
- * const player = manager.getPlayer("guildId");
2821
- * player.seek(30000); // seek to 30 seconds
3155
+ * const node = manager.nodeManager.getLeastUsed();
3156
+ * if (node) {
3157
+ * console.log(node.id); // node1
3158
+ * console.log(node.penalties); // the penalties of the node
3159
+ * console.log(node.state); // the state of the node
3160
+ * }
2822
3161
  * ```
2823
3162
  */
2824
- seek(position: number): Promise<void>;
3163
+ getLeastUsed(sortType?: NodeSortTypes): NodeStructure;
2825
3164
  /**
2826
3165
  *
2827
- * Disconnect the player from the voice channel.
2828
- * @returns {Promise<this>} The player instance.
3166
+ * Reconnect the nodes.
3167
+ * @returns {void}
2829
3168
  * @example
2830
3169
  * ```ts
2831
- * const player = manager.getPlayer("guildId");
2832
- * player.disconnect();
3170
+ * const node = manager.nodeManager.get("node1");
3171
+ * if (node) node.reconnectAll();
2833
3172
  * ```
2834
3173
  */
2835
- disconnect(): Promise<this>;
3174
+ reconnectAll(): void;
2836
3175
  /**
2837
- *
2838
- * Destroy and disconnect the player.
2839
- * @param {DestroyReasons} [reason] The reason for destroying the player.
2840
- * @returns {Promise<void>}
3176
+ * Disconnect the nodes.
3177
+ * @returns {void}
2841
3178
  * @example
2842
3179
  * ```ts
2843
- * const player = manager.getPlayer("guildId");
2844
- * player.destroy(DestroyReasons.Stop);
3180
+ * const node = manager.nodeManager.get("node1");
3181
+ * if (node) node.disconnectAll();
2845
3182
  * ```
2846
3183
  */
2847
- destroy(reason?: DestroyReasons): Promise<boolean>;
3184
+ disconnectAll(): void;
2848
3185
  /**
2849
- *
2850
- * Play a track in the player.
2851
- * @param {Partial<PlayOptions>} [options] The options to play the track.
2852
- * @returns {Promise<void>}
2853
- * @throws {PlayerError} If there are no tracks to play.
3186
+ * Connect the nodes.
3187
+ * @returns {void}
2854
3188
  * @example
2855
3189
  * ```ts
2856
- * const player = manager.getPlayer("guildId");
2857
- *
2858
- * player.play({
2859
- * track: track,
2860
- * noReplace: true,
2861
- * });
3190
+ * const node = manager.nodeManager.get("node1");
3191
+ * if (node) node.connect();
2862
3192
  * ```
2863
3193
  */
2864
- play(options?: Partial<PlayOptions>): Promise<void>;
3194
+ connectAll(): void;
2865
3195
  /**
2866
- * Connect the player to the voice channel.
2867
- * @returns {Promise<this>} The player instance.
3196
+ * Destroy the nodes.
3197
+ * @returns {void}
2868
3198
  * @example
2869
3199
  * ```ts
2870
- * const player = manager.getPlayer("guildId");
2871
- * player.connect();
3200
+ * const node = manager.nodeManager.get("node1");
3201
+ * if (node) node.destroy();
2872
3202
  * ```
2873
3203
  */
2874
- connect(): Promise<this>;
3204
+ destroyAll(): void;
3205
+ }
3206
+
3207
+ /**
3208
+ * Class representing the REST for the node.
3209
+ * @class Rest
3210
+ */
3211
+ declare class Rest {
3212
+ /**
3213
+ * The URL for the REST.
3214
+ * @type {string}
3215
+ */
3216
+ readonly url: string;
3217
+ /**
3218
+ * The version for the REST.
3219
+ * @type {string}
3220
+ */
3221
+ readonly version: string;
3222
+ /**
3223
+ * The timeout for the REST.
3224
+ * @type {number}
3225
+ */
3226
+ readonly restTimeout: number;
3227
+ /**
3228
+ * The user agent for the REST.
3229
+ * @type {UserAgent}
3230
+ */
3231
+ readonly userAgent: UserAgent;
3232
+ /**
3233
+ * The node for the REST.
3234
+ * @type {Node}
3235
+ */
3236
+ readonly node: NodeStructure;
2875
3237
  /**
2876
3238
  *
2877
- * Stop the player from playing.
2878
- * @param {boolean} [destroy=true] Whether to destroy the player or not.
2879
- * @returns {Promise<void>}
3239
+ * Create a new REST.
3240
+ * @param {NodeStructure} node The node for the REST.
2880
3241
  * @example
2881
3242
  * ```ts
2882
- * const player = manager.getPlayer("guildId");
2883
- * player.stop();
3243
+ * const node = new Node({
3244
+ * host: "localhost",
3245
+ * port: 2333,
3246
+ * password: "youshallnotpass",
3247
+ * secure: false,
3248
+ * });
3249
+ *
3250
+ * const rest = new Rest(node);
3251
+ * console.log(rest.restUrl); // http://localhost:2333/v4
2884
3252
  * ```
2885
3253
  */
2886
- stop(destroy?: boolean): Promise<void>;
3254
+ constructor(node: NodeStructure);
3255
+ /**
3256
+ * The REST URL to make requests.
3257
+ * @type {string}
3258
+ */
3259
+ get restUrl(): string;
3260
+ /**
3261
+ * The session id of the node.
3262
+ * @type {string}
3263
+ */
3264
+ get sessionId(): string;
2887
3265
  /**
2888
3266
  *
2889
- * Pause or resume the player.
2890
- * @returns {Promise<void>}
2891
- * @example
2892
- * ```ts
2893
- * const player = manager.getPlayer("guildId");
2894
- * player.setPaused();
2895
- * ```
3267
+ * Make a request to the node.
3268
+ * @param {RestOptions} options The options to make the request.
3269
+ * @returns {Promise<T | null>} The response from the node.
2896
3270
  */
2897
- setPaused(paused?: boolean): Promise<boolean>;
3271
+ request<T>(options: RestOptions): Promise<T | null>;
2898
3272
  /**
2899
3273
  *
2900
- * Set the volume of the player.
2901
- * @param {number} volume The volume to set.
2902
- * @returns {Promise<void>}
3274
+ * Update the player data.
3275
+ * @param {Partial<UpdatePlayerInfo>} data The player data to update.
3276
+ * @returns {LavalinkPlayer | null} The updated player data.
2903
3277
  * @example
2904
3278
  * ```ts
2905
- * const player = manager.getPlayer("guildId");
2906
- * player.setVolume(50); // set the volume to 50%
3279
+ * const player = await node.rest.updatePlayer({
3280
+ * guildId: "guildId",
3281
+ * noReplace: true,
3282
+ * playerOptions: {
3283
+ * paused: false,
3284
+ * track: { encoded: "encoded track" },
3285
+ * },
3286
+ * });
3287
+ *
3288
+ * console.log(player); // The updated lavalink player data
2907
3289
  * ```
2908
3290
  */
2909
- setVolume(volume: number): Promise<void>;
3291
+ updatePlayer(data: Partial<UpdatePlayerInfo>): Promise<LavalinkPlayer | null>;
2910
3292
  /**
2911
3293
  *
2912
- * Set the loop mode of the player.
2913
- * @param {LoopMode} mode The loop mode to set.
2914
- * @throws {PlayerError} If the loop mode is invalid.
3294
+ * Stop the track in player for the guild.
3295
+ * @param {string} guildId the guild id to stop the player
3296
+ * @returns {Promise<LavalinkPlayer | null>} The updated player data.
2915
3297
  * @example
2916
3298
  * ```ts
2917
- * const player = manager.getPlayer("guildId");
2918
- * player.setLoop(LoopMode.Track);
3299
+ * const player = await node.rest.stopPlayer("guildId");
3300
+ * if (player) console.log(player); // The lavalink player
2919
3301
  * ```
2920
3302
  */
2921
- setLoop(mode: LoopMode): this;
3303
+ stopPlayer(guildId: string): Promise<LavalinkPlayer | null>;
2922
3304
  /**
2923
- * Set the voice of the player.
2924
- * @param {NullableVoiceChannelUpdate} options The voice state to set.
2925
- * @returns {Promise<void>}
3305
+ *
3306
+ * Destroy the player for the guild.
3307
+ * @param {string} guildId The guild id to destroy the player.
3308
+ * @returns {Promise<void>} The updated player data.
2926
3309
  * @example
2927
3310
  * ```ts
2928
- * const player = manager.getPlayer("guildId");
2929
- * player.setVoice({ voiceId: "newVoiceId" });
3311
+ * await node.rest.destroyPlayer("guildId");
2930
3312
  * ```
3313
+ * @example
2931
3314
  */
2932
- setVoice(options?: NullableVoiceChannelUpdate): Promise<void>;
3315
+ destroyPlayer(guildId: string): Promise<void>;
2933
3316
  /**
2934
3317
  *
2935
- * Change the node the player is connected to.
2936
- * @param {NodeIdentifier} node The node to change to.
2937
- * @returns {Promise<void>} A promise that resolves when the node has been changed.
2938
- * @throws {PlayerError} If the target node is not found, not connected, or missing source managers.
3318
+ * Update the session for the node
3319
+ * @param {SessionResumingOptions} options The session resuming options.
3320
+ * @returns {Promise<LavalinkSession | null>} The updated session data.
2939
3321
  * @example
2940
3322
  * ```ts
2941
- * const player = manager.getPlayer("guildId");
2942
- * player.move("newNodeId");
3323
+ * const session = await node.rest.updateSession({ resuming: true, timeout: 30000 });
3324
+ * if (session) console.log(session); // The lavalink session data
2943
3325
  * ```
2944
3326
  */
2945
- move(node: NodeIdentifier): Promise<void>;
2946
- /**
2947
- * Update the player with new data.
2948
- * @param {NonGuildUpdatePlayerInfo} data The data to update the player with.
2949
- * @returns {Promise<LavalinkPlayer | null>} The updated player data.
2950
- */
2951
- updatePlayer(data: NonGuildUpdatePlayerInfo): Promise<LavalinkPlayer | null>;
3327
+ updateSession(options: SessionResumingOptions): Promise<LavalinkSession | null>;
2952
3328
  /**
2953
3329
  *
2954
- * Return the player as a json object.
2955
- * @returns {PlayerJson}
3330
+ * Get all players for the current session.
3331
+ * @returns {Promise<LavalinkPlayer[]>} The players for the current session.
2956
3332
  * @example
2957
3333
  * ```ts
2958
- * const player = manager.getPlayer("guildId");
2959
- * const json = player.toJSON();
2960
- * console.log(json); // the player as a json object
3334
+ * const players = await node.rest.getPlayers();
3335
+ * console.log(players); // The lavalink players for the current session
2961
3336
  * ```
2962
3337
  */
2963
- toJSON(): PlayerJson;
2964
- }
2965
- /**
2966
- * Type representing the update player information without guildId.
2967
- */
2968
- type NonGuildUpdatePlayerInfo = Omit<UpdatePlayerInfo, "guildId">;
2969
- /**
2970
- * Interface representing the customizable player storage.
2971
- */
2972
- interface CustomizablePlayerStorage {
3338
+ getPlayers(): Promise<LavalinkPlayer[]>;
2973
3339
  }
2974
3340
 
2975
3341
  /**
@@ -3006,6 +3372,8 @@ declare class QueueUtils {
3006
3372
  /**
3007
3373
  *
3008
3374
  * Sync the queue.
3375
+ * @param {boolean} [override=true] Whether to override the current queue or not.
3376
+ * @param {boolean} [syncCurrent=false] Whether to sync the current track or not.
3009
3377
  * @returns {Awaitable<void>}
3010
3378
  * @example
3011
3379
  * ```ts
@@ -3267,6 +3635,17 @@ declare class Queue {
3267
3635
  * @param {Track} track The track to move.
3268
3636
  * @param {number} to The position to move.
3269
3637
  * @returns {Promise<this>} The queue instance.
3638
+ * @example
3639
+ * ```ts
3640
+ * const queue = player.queue;
3641
+ * await queue.add(track);
3642
+ * await queue.add(track1);
3643
+ * await queue.add(track2);
3644
+ *
3645
+ * console.log(queue.tracks); // [track, track1, track2]
3646
+ * await queue.move(track1, 0);
3647
+ * console.log(queue.tracks); // [track1, track, track2]
3648
+ * ```
3270
3649
  */
3271
3650
  move(track: Track, to: number): Promise<this>;
3272
3651
  /**
@@ -3276,12 +3655,30 @@ declare class Queue {
3276
3655
  * @param {number} deleteCount The number of tracks to delete.
3277
3656
  * @param {Track | Track[]} [tracks] The tracks to add.
3278
3657
  * @returns {Promise<this>} The queue instance.
3658
+ * @example
3659
+ * ```ts
3660
+ * const queue = player.queue;
3661
+ * await queue.add(track);
3662
+ * await queue.add(track1);
3663
+ * await queue.add(track2);
3664
+ *
3665
+ * console.log(queue.tracks); // [track, track1, track2]
3666
+ * await queue.splice(1, 1);
3667
+ * console.log(queue.tracks); // [track, track2]
3668
+ * ```
3279
3669
  */
3280
3670
  splice(start: number, deleteCount: number, tracks?: HoshimiTrack | HoshimiTrack[]): Promise<this>;
3281
3671
  /**
3282
3672
  *
3283
3673
  * Convert the queue to a JSON object.
3284
3674
  * @returns {QueueJson} The queue JSON object.
3675
+ * @example
3676
+ * ```ts
3677
+ * const queue = player.queue;
3678
+ * await queue.add(track);
3679
+ *
3680
+ * console.log(queue.toJSON()); // { tracks: [track], history: [], current: null }
3681
+ * ```
3285
3682
  */
3286
3683
  toJSON(): QueueJson;
3287
3684
  }
@@ -4466,6 +4863,11 @@ interface NodeInfo {
4466
4863
  * @type {NodeInfoPlugin[]}
4467
4864
  */
4468
4865
  plugins: NodeInfoPlugin[];
4866
+ /**
4867
+ * Whether the node is a Nodelink instance.
4868
+ * @type {boolean
4869
+ */
4870
+ isNodelink: boolean;
4469
4871
  }
4470
4872
  /**
4471
4873
  * The node options.
@@ -4733,7 +5135,7 @@ declare class Node {
4733
5135
  readonly nodeManager: NodeManagerStructure;
4734
5136
  /**
4735
5137
  * The lyrics manager for the node.
4736
- * @type {LyricsManager}
5138
+ * @type {LyricsManagerStructure}
4737
5139
  */
4738
5140
  readonly lyricsManager: LyricsManagerStructure;
4739
5141
  /**
@@ -4826,6 +5228,23 @@ declare class Node {
4826
5228
  * ```
4827
5229
  */
4828
5230
  get id(): string;
5231
+ /**
5232
+ *
5233
+ * Check if the node is a Nodelink node.
5234
+ * @returns {boolean} True if the node is a Nodelink node, false otherwise.
5235
+ * @example
5236
+ * ```ts
5237
+ * const node = manager.nodeManager.get("node1");
5238
+ * if (node) {
5239
+ * if (node.isNodelink()) {
5240
+ * console.log("The node is a Nodelink node");
5241
+ * } else {
5242
+ * console.log("The node is a Lavalink node");
5243
+ * }
5244
+ * }
5245
+ * ```
5246
+ */
5247
+ isNodelink(): boolean;
4829
5248
  /**
4830
5249
  * The socket address to connect the node.
4831
5250
  * @type {string}
@@ -4964,19 +5383,18 @@ declare class Node {
4964
5383
  /**
4965
5384
  *
4966
5385
  * Update the session for the node
4967
- * @param {boolean} resuming Enable resuming for the session.
4968
- * @param {number | null} timeout The timeout for the session.
5386
+ * @param {SessionResumingOptions} options The session resuming options.
4969
5387
  * @returns {Promise<LavalinkSession | null>}
4970
5388
  * @example
4971
5389
  * ```ts
4972
5390
  * const node = manager.nodeManager.get("node1");
4973
5391
  * if (node) {
4974
- * const session = await node.updateSession(true, 60);
5392
+ * const session = await node.updateSession({ resuming: true, timeout: 30000 });
4975
5393
  * console.log(session); // the lavalink session
4976
5394
  * }
4977
5395
  * ```
4978
5396
  */
4979
- updateSession(resuming: boolean, timeout?: number | null): Promise<LavalinkSession | null>;
5397
+ updateSession(options: SessionResumingOptions): Promise<LavalinkSession | null>;
4980
5398
  /**
4981
5399
  * Reconnect the node.
4982
5400
  * @returns {void}
@@ -5166,7 +5584,12 @@ declare enum SearchEngines {
5166
5584
  * Play voice using text to speech.
5167
5585
  * @description Provided by skybot-lavalink-plugin plugin.
5168
5586
  */
5169
- TextToSpeech = "speak"
5587
+ TextToSpeech = "speak",
5588
+ /**
5589
+ * Search via http url.
5590
+ * @description Provided by lavalink.
5591
+ */
5592
+ HTTP = "http"
5170
5593
  }
5171
5594
  /**
5172
5595
  * The debug levels for the manager.
@@ -5200,7 +5623,7 @@ declare enum DebugLevels {
5200
5623
  /**
5201
5624
  * The events for the manager.
5202
5625
  */
5203
- declare enum Events {
5626
+ declare enum EventNames {
5204
5627
  /**
5205
5628
  * Emitted when the manager emits a debug message.
5206
5629
  */
@@ -5786,7 +6209,7 @@ interface ChannelDeletePacket {
5786
6209
  /**
5787
6210
  * Make a function awaitable by returning a promise or the value.
5788
6211
  */
5789
- type Awaitable<T> = T | Promise<T>;
6212
+ type Awaitable<T> = Promise<T> | T;
5790
6213
  /**
5791
6214
  * Create a type that infers the value of a key from an object.
5792
6215
  */
@@ -5801,6 +6224,10 @@ type Omit$1<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
5801
6224
  * Create a type that can be a rest or an array.
5802
6225
  */
5803
6226
  type RestOrArray<T> = T[] | [T[]];
6227
+ /**
6228
+ * Conditional type to check if T is true, then A, else B or A | null.
6229
+ */
6230
+ type If<T extends boolean, A, B = null> = T extends true ? A : B extends null ? A | null : B;
5804
6231
  /**
5805
6232
  * Make a type required.
5806
6233
  */
@@ -5843,19 +6270,43 @@ type GatewayPackets = VoicePacket | VoiceServer | VoiceState | ChannelDeletePack
5843
6270
  * The required options for the manager.
5844
6271
  */
5845
6272
  type RequiredOptions = DeepRequired<HoshimiOptions>;
5846
- /**
5847
- * The events for the manager.
5848
- * This allows to extend the events.
5849
- */
5850
- type RawEvents = {
5851
- [K in keyof HoshimiEvents]: HoshimiEvents[K];
5852
- };
5853
6273
  /**
5854
6274
  * Class representing the Hoshimi manager.
5855
6275
  * @class Hoshimi
5856
- * @extends {EventEmitter<RawEvents>}
6276
+ * @extends {EventEmitter<HoshimiEvents>}
6277
+ * @example
6278
+ * ```ts
6279
+ * import { Hoshimi, SearchEngines } from "hoshimi";
6280
+ *
6281
+ * const manager = new Hoshimi({ // or via createHoshimi() function
6282
+ * sendPayload: async (guildId, payload) => {
6283
+ * const guild = await <Client>.guilds.fetch(guildId);
6284
+ * if (!guild) return;
6285
+ *
6286
+ * guild.shard.send(payload); // Adjust this line based on your library's method to send payloads
6287
+ * },
6288
+ * nodes: [
6289
+ * {
6290
+ * host: "localhost",
6291
+ * port: 2333,
6292
+ * password: "youshallnotpass",
6293
+ * secure: false,
6294
+ * },
6295
+ * ],
6296
+ * });
6297
+ *
6298
+ * manager.on("nodeReady", (node) => console.log(`Node ${node.id} is ready.`));
6299
+ * manager.on("playerCreate", (player) => console.log(`Player created for guild ${player.guildId}.`));
6300
+ * manager.on("error", (error) => console.error("An error occurred:", error));
6301
+ *
6302
+ * <Client>.on("ready", () => {
6303
+ * manager.init({ id: <Client>.user.id, username: <Client>.user.username });
6304
+ * });
6305
+ *
6306
+ * console.log(manager); // The manager instance
6307
+ * ```
5857
6308
  */
5858
- declare class Hoshimi extends EventEmitter<RawEvents> {
6309
+ declare class Hoshimi extends EventEmitter<HoshimiEvents> {
5859
6310
  /**
5860
6311
  * The options for the manager.
5861
6312
  * @type {HoshimiOptions}
@@ -5882,6 +6333,7 @@ declare class Hoshimi extends EventEmitter<RawEvents> {
5882
6333
  * The constructor for the manager.
5883
6334
  * @param {HoshimiOptions} options The options for the manager.
5884
6335
  * @throws {ManagerError} If the options are not provided.
6336
+ * @throws {OptionError} If the options are invalid.
5885
6337
  * @example
5886
6338
  * ```ts
5887
6339
  * const manager = new Hoshimi({
@@ -6043,12 +6495,31 @@ declare class Hoshimi extends EventEmitter<RawEvents> {
6043
6495
  */
6044
6496
  declare function createHoshimi(...args: ConstructorParameters<typeof Hoshimi>): Hoshimi;
6045
6497
 
6498
+ /**
6499
+ * Class representing a player storage.
6500
+ * @class PlayerMemoryStorage
6501
+ * @extends {PlayerStorageAdapter}
6502
+ */
6503
+ declare class PlayerMemoryStorage<K extends StorageKeys = StorageKeys, V extends StorageValues<K> = StorageValues<K>> extends PlayerStorageAdapter {
6504
+ get<K extends StorageKeys, V extends StorageValues<K>>(key: K): Awaitable<V | undefined>;
6505
+ set<K extends StorageKeys, V extends StorageValues<K>>(key: K, value: V): Awaitable<void>;
6506
+ has<K extends StorageKeys>(key: K): Awaitable<boolean>;
6507
+ delete<K extends StorageKeys>(key: K): Awaitable<boolean>;
6508
+ keys<K extends StorageKeys[]>(): Awaitable<K[]>;
6509
+ values<K extends StorageKeys[], V extends StorageValues<K[number]>>(): Awaitable<V[]>;
6510
+ entries<K extends StorageKeys[], V extends StorageValues<K[number]>>(): Awaitable<[K, V][]>;
6511
+ all<K extends StorageKeys[], V extends StorageValues<K[number]>>(): Awaitable<Record<K[number], V>>;
6512
+ clear(): Awaitable<void>;
6513
+ size(): Awaitable<number>;
6514
+ buildKey(...parts: RestOrArray<string>): string;
6515
+ }
6516
+
6046
6517
  /**
6047
6518
  * Class representing a memory storage manager.
6048
6519
  * @class MemoryAdapter
6049
- * @extends {StorageAdapter}
6520
+ * @extends {QueueStorageAdapter}
6050
6521
  */
6051
- declare class MemoryAdapter<T extends QueueJson = QueueJson> extends StorageAdapter<T> {
6522
+ declare class QueueMemoryStorage<T extends QueueJson = QueueJson> extends QueueStorageAdapter<T> {
6052
6523
  get(key: string): T | undefined;
6053
6524
  set(key: string, value: T): void;
6054
6525
  delete(key: string): boolean;
@@ -6056,6 +6527,108 @@ declare class MemoryAdapter<T extends QueueJson = QueueJson> extends StorageAdap
6056
6527
  has(key: string): boolean;
6057
6528
  parse(value: unknown): T;
6058
6529
  stringify<R = string>(value: unknown): R;
6530
+ buildKey(...parts: RestOrArray<string>): string;
6059
6531
  }
6060
6532
 
6061
- export { AudioOutput, type Awaitable, type ChannelDelete, type ChannelDeletePacket, type ChannelMixSettings, type ClientData, type CustomizablePlayerStorage, type CustomizableStructures, type CustomizableTrack, DSPXPluginFilter, DebugLevels, type DecodeMethods, type DeepRequired, DestroyReasons, type DistortionSettings, type EQBandSettings, type EchoSettings, type EnabledDSPXPluginFilters, type EnabledLavalinkFilters, type EnabledPlayerFilters, Events, type Exception, type FetchOptions, FilterManager, type FilterManagerStructure, type FilterPluginPassSettings, type FilterSettings, FilterType, type FreqSettings, type GatewayPayload, type GatewaySendPayload, Hoshimi, type HoshimiEvents, type HoshimiNodeOptions, type HoshimiOptions, type HoshimiPlayerOptions, type HoshimiQueueOptions, type HoshimiRestOptions, type HoshimiTrack, HttpMethods, HttpStatusCodes, type InferCustomStructure, type Inferable, type KaraokeSettings, type LavalinkFilterPluginEchoSettings, type LavalinkFilterPluginReverbSettings, type LavalinkFilterPluginSettings, type LavalinkPayload, type LavalinkPlayOptions, type LavalinkPlayer, type LavalinkPlayerState, type LavalinkPlayerVoice, LavalinkPluginFilter, type LavalinkRestError, type LavalinkSearchResponse, type LavalinkSession, type LavalinkTrack, LoadType, LoopMode, type LowPassSettings, type LyricsFoundEvent, type LyricsLine, type LyricsLineEvent, type LyricsManagerStructure, type LyricsMethods, type LyricsNotFoundEvent, type LyricsResult, ManagerError, MemoryAdapter, Node, type NodeCpu, type NodeDestroyInfo, NodeDestroyReasons, type NodeDisconnectInfo, NodeError, type NodeFrameStats, type NodeIdentifier, type NodeInfo, type NodeInfoGit, type NodeInfoPlugin, type NodeInfoVersion, type NodeJson, type NodeManagerStructure, type NodeMemory, type NodeOptions, NodeSortTypes, type NodeStructure, type NormalizationSettings, type Nullable, type NullableLavalinkSession, type Omit$1 as Omit, OpCodes, OptionError, type PickNullable, type PickRequired, type PlayOptions, Player, PlayerError, type PlayerEvent, PlayerEventType, type PlayerJson, type PlayerOptions, type PlayerStructure, type PlayerUpdate, type PlayerUpdateState, type PlayerVoice, type Playlist, type PlaylistInfo, type PluginFilterSettings, type PluginInfo, PluginInfoType, PluginNames, type QueryResult, Queue, type QueueJson, type QueueStructure, type Ready, ResolveError, Rest, type RestOptions, type RestOrArray, RestPathType, type RestStructure, type ResumableHeaders, type RotationSettings, SearchEngines, type SearchOptions, type SearchQuery, Severity, SourceNames, State, type Stats, StorageAdapter, StorageError, Structures, type TimescaleSettings, Track, type TrackEndEvent, TrackEndReason, type TrackExceptionEvent, type TrackInfo, type TrackRequester, type TrackStartEvent, type TrackStuckEvent, type TrackUserData, type TremoloSettings, type UnresolvedLavalinkTrack, UnresolvedTrack, type UnresolvedTrackInfo, type UpdatePlayerInfo, type UserAgent, type VoiceChannelUpdate, type VoicePacket, type VoiceServer, type VoiceState, type WebSocketClosedEvent, WebsocketCloseCodes, createHoshimi };
6533
+ /**
6534
+ * The auto output record type.
6535
+ */
6536
+ type AutoOutputRecord = Record<AudioOutput, Required<ChannelMixSettings>>;
6537
+ /**
6538
+ * The user agent for Hoshimi.
6539
+ * @type {UserAgent}
6540
+ */
6541
+ declare const HoshimiAgent: UserAgent;
6542
+ /**
6543
+ * The url regex for Hoshimi.
6544
+ * @type {RegExp}
6545
+ */
6546
+ declare const UrlRegex: RegExp;
6547
+ /**
6548
+ * The valid search engines for Hoshimi.
6549
+ * @type {SearchEngines[]}
6550
+ */
6551
+ declare const ValidEngines: SearchEngines[];
6552
+ /**
6553
+ * The valid sources for Hoshimi.
6554
+ * @type {Map<SourceNames, SearchEngines>}
6555
+ */
6556
+ declare const ValidSources: Map<SourceNames, SearchEngines>;
6557
+ /**
6558
+ * The audio output data for Hoshimi.
6559
+ * @type {Readonly<Record<AudioOutput, Required<ChannelMixSettings>>>}
6560
+ */
6561
+ declare const AudioOutputData: Readonly<AutoOutputRecord>;
6562
+ /**
6563
+ * The default filter presets.
6564
+ */
6565
+ declare const DefaultFilterPreset: Readonly<{
6566
+ Karaoke: {
6567
+ level: number;
6568
+ monoLevel: number;
6569
+ filterBand: number;
6570
+ filterWidth: number;
6571
+ };
6572
+ Vaporwave: {
6573
+ speed: number;
6574
+ pitch: number;
6575
+ rate: number;
6576
+ };
6577
+ Nightcore: {
6578
+ speed: number;
6579
+ pitch: number;
6580
+ rate: number;
6581
+ };
6582
+ Lowpass: {
6583
+ smoothing: number;
6584
+ };
6585
+ Tremolo: {
6586
+ frequency: number;
6587
+ depth: number;
6588
+ };
6589
+ Vibrato: {
6590
+ frequency: number;
6591
+ depth: number;
6592
+ };
6593
+ Distortion: {
6594
+ cosOffset: number;
6595
+ sinOffset: number;
6596
+ tanOffset: number;
6597
+ offset: number;
6598
+ scale: number;
6599
+ cosScale: number;
6600
+ sinScale: number;
6601
+ tanScale: number;
6602
+ };
6603
+ DSPXHighPass: {
6604
+ boostFactor: number;
6605
+ cutoffFrequency: number;
6606
+ };
6607
+ DSPXLowPass: {
6608
+ boostFactor: number;
6609
+ cutoffFrequency: number;
6610
+ };
6611
+ DSPXNormalization: {
6612
+ adaptive: boolean;
6613
+ maxAmplitude: number;
6614
+ };
6615
+ DSPXEcho: {
6616
+ decay: number;
6617
+ echoLength: number;
6618
+ };
6619
+ PluginEcho: {
6620
+ decay: number;
6621
+ delay: number;
6622
+ };
6623
+ PluginReverb: {
6624
+ delays: number[];
6625
+ gains: number[];
6626
+ };
6627
+ }>;
6628
+ /**
6629
+ * The default filter settings.
6630
+ * @type {Readonly<FilterSettings>} DefaultFilters
6631
+ */
6632
+ declare const DefaultPlayerFilters: Readonly<FilterSettings>;
6633
+
6634
+ export { AudioOutput, AudioOutputData, type Awaitable, type ChannelDelete, type ChannelDeletePacket, type ChannelMixSettings, type ClientData, type CustomizablePlayerStorage, type CustomizableStructures, type CustomizableTrack, DSPXPluginFilter, DebugLevels, type DecodeMethods, type DeepRequired, DefaultFilterPreset, DefaultPlayerFilters, DestroyReasons, type DistortionSettings, type EQBandSettings, type EchoSettings, type EnabledDSPXPluginFilters, type EnabledLavalinkFilters, type EnabledPlayerFilters, EventNames, type Exception, type FetchOptions, FilterManager, type FilterManagerStructure, type FilterPluginPassSettings, type FilterSettings, FilterType, type FreqSettings, type GatewayPayload, type GatewaySendPayload, Hoshimi, HoshimiAgent, type HoshimiEvents, type HoshimiNodeOptions, type HoshimiOptions, type HoshimiPlayerOptions, type HoshimiQueueOptions, type HoshimiRestOptions, type HoshimiTrack, HttpMethods, HttpStatusCodes, type If, type InferCustomStructure, type Inferable, type KaraokeSettings, type LavalinkFilterPluginEchoSettings, type LavalinkFilterPluginReverbSettings, type LavalinkFilterPluginSettings, type LavalinkPayload, type LavalinkPlayOptions, type LavalinkPlayer, type LavalinkPlayerState, type LavalinkPlayerVoice, LavalinkPluginFilter, type LavalinkRestError, type LavalinkSearchResponse, type LavalinkSession, type LavalinkTrack, LoadType, LoopMode, type LowPassSettings, type LyricsFoundEvent, type LyricsLine, type LyricsLineEvent, type LyricsManagerStructure, type LyricsMethods, type LyricsNotFoundEvent, type LyricsResult, ManagerError, Node, type NodeCpu, type NodeDestroyInfo, NodeDestroyReasons, type NodeDisconnectInfo, NodeError, type NodeFrameStats, type NodeIdentifier, type NodeInfo, type NodeInfoGit, type NodeInfoPlugin, type NodeInfoVersion, type NodeJson, NodeManagerError, type NodeManagerStructure, type NodeMemory, type NodeOptions, NodeSortTypes, type NodeStructure, type NormalizationSettings, type Nullable, type NullableLavalinkSession, type Omit$1 as Omit, OpCodes, OptionError, type PickNullable, type PickRequired, type PlayOptions, Player, PlayerError, type PlayerEvent, PlayerEventType, type PlayerJson, PlayerMemoryStorage, type PlayerOptions, PlayerStorageAdapter, type PlayerStructure, type PlayerUpdate, type PlayerUpdateState, type PlayerVoice, type Playlist, type PlaylistInfo, type PluginFilterSettings, type PluginInfo, PluginInfoType, PluginNames, type QueryResult, Queue, type QueueJson, QueueMemoryStorage, QueueStorageAdapter, type QueueStructure, type Ready, ResolveError, Rest, type RestEndpoint, type RestOptions, type RestOrArray, RestPathType, RestRoutes, type RestStructure, type ResumableHeaders, type RotationSettings, SearchEngines, type SearchOptions, type SearchQuery, type SessionResumingOptions, Severity, SourceNames, State, type Stats, StorageError, type StorageKeys, type StorageValues, Structures, type TimescaleSettings, Track, type TrackEndEvent, TrackEndReason, type TrackExceptionEvent, type TrackInfo, type TrackRequester, type TrackStartEvent, type TrackStuckEvent, type TrackUserData, type TremoloSettings, type UnresolvedLavalinkTrack, UnresolvedTrack, type UnresolvedTrackInfo, type UpdatePlayerInfo, UrlRegex, type UserAgent, ValidEngines, ValidSources, type VoiceChannelUpdate, type VoicePacket, type VoiceServer, type VoiceState, type WebSocketClosedEvent, WebsocketCloseCodes, createHoshimi };