hoshimi 0.3.3 → 0.3.5

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
@@ -648,2743 +648,2828 @@ interface EnabledDSPXPluginFilters {
648
648
  }
649
649
 
650
650
  /**
651
- * Class representing a LyricsManager.
652
- * @class LyricsManager
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
+ * ```
653
664
  */
654
- declare class LyricsManager {
665
+ declare abstract class StorageAdapter<T extends QueueJson = QueueJson> {
655
666
  /**
656
- * The node instance.
657
- * @type {NodeStructure}
658
- * @readonly
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
+ * ```
659
676
  */
660
- readonly node: NodeStructure;
677
+ abstract get(key: string): Awaitable<T | undefined>;
661
678
  /**
662
- * Create a new LyricsManager instance.
663
- * @param {NodeStructure} node The node instance.
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?
664
684
  * @example
665
685
  * ```ts
666
- * const node = manager.nodeManager.get("nodeId");
667
- * const lyricsManager = new LyricsManager(node);
686
+ * await storage.set("key", "value");
668
687
  * ```
669
688
  */
670
- constructor(node: NodeStructure);
689
+ abstract set(key: string, value: T): Awaitable<void>;
671
690
  /**
672
691
  *
673
- * Get the current lyrics for the current track.
674
- * @param {boolean} skipSource Whether to skip the track source or not.
675
- * @returns {Promise<LyricsResult | null>} The lyrics result or null if not found.
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.
676
695
  * @example
677
696
  * ```ts
678
- * const player = manager.getPlayer("guildId");
679
- * const lyrics = await player.lyricsManager.current();
697
+ * const success = await storage.delete("key");
698
+ * console.log(success); // true
680
699
  * ```
681
700
  */
682
- current(guildId: string, skipSource?: boolean): Promise<LyricsResult | null>;
701
+ abstract delete(key: string): Awaitable<boolean>;
683
702
  /**
684
- *
685
- * Get the lyrics for a specific track.
686
- * @param {Track} track The track to get the lyrics for.
687
- * @param {boolean} skipSource Whether to skip the track source or not.
688
- * @returns {Promise<LyricsResult | null>} The lyrics result or null if not found.
703
+ * Clear the storage.
704
+ * @returns {Awaitable<void>} Scary, right?
689
705
  * @example
690
706
  * ```ts
691
- * const node = manager.nodeManager.get("nodeId");
692
- * const lyrics = await node.lyricsManager.get(track);
707
+ * await storage.clear();
693
708
  * ```
694
709
  */
695
- get(track: Track, skipSource?: boolean): Promise<LyricsResult | null>;
710
+ abstract clear(): Awaitable<void>;
711
+ /**
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
+ * ```
720
+ */
721
+ abstract has(key: string): Awaitable<boolean>;
696
722
  /**
697
723
  *
698
- * Subscribe to the lyrics for a specific guild.
699
- * @param {string} guildId The guild id to subscribe to.
700
- * @param {boolean} skipSource Whether to skip the track source or not.
701
- * @returns {Promise<void>} Let's start the sing session!
724
+ * Parse the value.
725
+ * @param {unknown} value The value to parse.
726
+ * @returns {T} The parsed value.
702
727
  * @example
703
728
  * ```ts
704
- * const node = manager.nodeManager.get("nodeId");
705
- * await node.lyricsManager.subscribe("guildId");
729
+ * const parsed = await storage.parse<{ key: string }>("{'key':'value'}");
730
+ * console.log(parsed); // { key: "value" }
706
731
  * ```
707
732
  */
708
- subscribe(guildId: string, skipSource?: boolean): Promise<void>;
733
+ abstract parse(value: unknown): Awaitable<T>;
709
734
  /**
710
735
  *
711
- * Unsubscribe from the lyrics for a specific guild.
712
- * @param {string} guildId The guild id to unsubscribe from.
713
- * @returns {Promise<void>} Let's stop the sing session!
736
+ * Stringify the value.
737
+ * @param {unknown} value The value to stringify.
738
+ * @returns {R} The stringified value.
714
739
  * @example
715
740
  * ```ts
716
- * const node = manager.nodeManager.get("nodeId");
717
- * await node.lyricsManager.unsubscribe("guildId");
741
+ * const stringified = await storage.stringify({ key: "value" });
742
+ * console.log(stringified); // "{'key':'value'}"
718
743
  * ```
719
744
  */
720
- unsubscribe(guildId: string): Promise<void>;
745
+ abstract stringify<R = string>(value: unknown): Awaitable<R>;
721
746
  }
722
747
 
723
748
  /**
724
- * Represents a collection that extends the built-in Map class.
725
- * @template K The type of the keys in the collection.
726
- * @template V The type of the values in the collection.
749
+ * The queue options.
727
750
  */
728
- declare class Collection<K, V> extends Map<K, V> {
751
+ interface HoshimiQueueOptions {
729
752
  /**
730
- * Removes elements from the collection based on a filter function.
731
- * @param fn The filter function that determines which elements to remove.
732
- * @param thisArg The value to use as `this` when executing the filter function.
733
- * @returns The number of elements removed from the collection.
734
- * @example
735
- * const collection = new Collection<number, string>();
736
- * collection.set(1, 'one');
737
- * collection.set(2, 'two');
738
- * collection.set(3, 'three');
739
- * const removedCount = collection.sweep((value, key) => key % 2 === 0);
740
- * console.log(removedCount); // Output: 1
741
- * console.log(collection.size); // Output: 2
753
+ * The maximum amount of tracks that can be saved in the queue.
754
+ * @type {number}
755
+ * @default 25
742
756
  */
743
- sweep(fn: (value: V, key: K, collection: this) => unknown): number;
757
+ maxHistory?: number;
744
758
  /**
745
- * Creates a new array with the results of calling a provided function on every element in the collection.
746
- * @param fn The function that produces an element of the new array.
747
- * @param thisArg The value to use as `this` when executing the map function.
748
- * @returns A new array with the results of calling the provided function on every element in the collection.
749
- * @example
750
- * const collection = new Collection<number, string>();
751
- * collection.set(1, 'one');
752
- * collection.set(2, 'two');
753
- * collection.set(3, 'three');
754
- * const mappedArray = collection.map((value, key) => `${key}: ${value}`);
755
- * console.log(mappedArray); // Output: ['1: one', '2: two', '3: three']
759
+ *
760
+ * The function to use for autoplay.
761
+ * @param {Player} player The player.
762
+ * @param {HoshimiTrack | null} lastTrack The last track played.
756
763
  */
757
- map<T>(fn: (value: V, key: K, collection: this) => T): T[];
764
+ autoplayFn?(player: PlayerStructure, lastTrack: HoshimiTrack | null): Awaitable<void>;
758
765
  /**
759
- * Creates a new array with all elements that pass the test implemented by the provided function.
760
- * @param fn The function to test each element of the collection.
761
- * @param thisArg The value to use as `this` when executing the filter function.
762
- * @returns A new array with the elements that pass the test.
763
- * @example
764
- * const collection = new Collection<number, string>();
765
- * collection.set(1, 'one');
766
- * collection.set(2, 'two');
767
- * collection.set(3, 'three');
768
- * const filteredArray = collection.filter((value, key) => key % 2 === 0);
769
- * console.log(filteredArray); // Output: ['two']
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
770
769
  */
771
- filter(fn: (value: V, key: K, collection: this) => boolean): V[];
770
+ autoPlay?: boolean;
772
771
  /**
773
- * Returns the value of the first element in the collection that satisfies the provided testing function.
774
- * @param fn The function to test each element of the collection.
775
- * @returns The value of the first element that passes the test. `undefined` if no element passes the test.
776
- * @example
777
- * const collection = new Collection<number, number>();
778
- * collection.set(1, 1);
779
- * collection.set(2, 2);
780
- * collection.set(3, 3);
781
- * const firstEvenValue = collection.find(value => value % 2 === 0);
782
- * console.log(firstEvenValue); // Output: 2
772
+ * The storage manager to use for the queue.
773
+ * @type {StorageAdapter}
774
+ * @default {MemoryAdapter}
783
775
  */
784
- find(fn: (value: V, key: K, collection: this) => boolean): V | undefined;
776
+ storage?: StorageAdapter;
785
777
  }
786
-
787
778
  /**
788
- * Class representing a node manager.
789
- * @class NodeManager
779
+ * The queue json.
790
780
  */
791
- declare class NodeManager {
781
+ interface QueueJson {
792
782
  /**
793
- * The manager for the node.
794
- * @type {Hoshimi}
795
- * @readonly
783
+ * The tracks of the queue.
784
+ * @type {HoshimiTrack[]}
796
785
  */
797
- readonly manager: Hoshimi;
786
+ tracks: HoshimiTrack[];
798
787
  /**
799
- * The nodes for the manager.
800
- * @type {Collection<string, Node>}
801
- * @readonly
788
+ * The previous tracks of the queue.
789
+ * @type {Track[]}
802
790
  */
803
- readonly nodes: Collection<string, NodeStructure>;
791
+ history: Track[];
804
792
  /**
805
- *
806
- * The constructor for the node manager.
807
- * @param {Hoshimi} manager The manager for the node.
808
- * @example
809
- * ```ts
810
- * const manager = new Hoshimi();
811
- * const nodeManager = new NodeManager(manager);
812
- *
813
- * console.log(nodeManager.nodes.size); // 0
814
- * ```
793
+ * The current track of the queue.
794
+ * @type {Track | null}
815
795
  */
816
- constructor(manager: Hoshimi);
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 {
817
807
  /**
818
- *
819
- * Delete the node.
820
- * @param {NodeIdentifier} node The node or node id to delete.
821
- * @returns {boolean} If the node was deleted.
822
- * @example
823
- * ```ts
824
- * const node = manager.nodeManager.get("node1");
825
- * if (node) manager.nodeManager.delete(node.id); // true if the node was deleted
826
- * ```
808
+ * The position to start the track.
809
+ * @type {number | undefined}
827
810
  */
828
- delete(node: NodeIdentifier): boolean;
811
+ position?: number;
829
812
  /**
830
- *
831
- * Get the node by id.
832
- * @param {NodeIdentifier} node The node or node id to get.
833
- * @returns {NodeStructure | undefined} The node or undefined if not found.
834
- * @example
835
- * ```ts
836
- * const node = manager.nodeManager.get("node1");
837
- * if (node) {
838
- * console.log(node.id); // node1
839
- * } else {
840
- * console.log("Node not found");
841
- * }
842
- * ```
813
+ * The position to end the track.
814
+ * @type {number | undefined}
843
815
  */
844
- get(node: NodeIdentifier): NodeStructure | undefined;
816
+ endTime?: number;
845
817
  /**
846
- *
847
- * Create a new node.
848
- * @param {NodeOptions} options The options for the node.
849
- * @returns {NodeStructure} The created node.
850
- * @example
851
- * ```ts
852
- * const node = manager.nodeManager.create({
853
- * host: "localhost",
854
- * port: 2333,
855
- * password: "password",
856
- * secure: false,
857
- * });
858
- *
859
- * console.log(node.id); // localhost:2333
860
- */
861
- create(options: NodeOptions): NodeStructure;
862
- /**
863
- *
864
- * Destroy a node.
865
- * @param {NodeIdentifier} node The node or node id to destroy.
866
- * @returns {void}
867
- * @example
868
- * ```ts
869
- * const node = manager.nodeManager.get("node1");
870
- * if (node) node.destroy();
871
- * ```
872
- */
873
- destroy(node: NodeIdentifier): void;
874
- /**
875
- *
876
- * Reconnect a node.
877
- * @param {NodeIdentifier} node The node or node id to reconnect.
878
- * @returns {void}
879
- * @example
880
- * ```ts
881
- * const node = manager.nodeManager.get("node1");
882
- * if (node) node.reconnect();
883
- * ```
884
- */
885
- reconnect(node: NodeIdentifier): void;
886
- /**
887
- *
888
- * Disconnect a node.
889
- * @param {NodeIdentifier} node The node or node id to disconnect.
890
- * @returns {void}
891
- * @example
892
- * ```ts
893
- * const node = manager.nodeManager.get("node1");
894
- * if (node) node.disconnect();
895
- * ```
818
+ * The pause state of the player.
819
+ * @type {boolean | undefined}
896
820
  */
897
- disconnect(node: NodeIdentifier): void;
821
+ paused?: boolean;
898
822
  /**
899
- *
900
- * Connect a node.
901
- * @param {NodeIdentifier} node The node or node id to connect.
902
- * @returns {void}
903
- * @example
904
- * ```ts
905
- * const node = manager.nodeManager.get("node1");
906
- * if (node) node.connect();
907
- * ```
823
+ * The volume of the player.
824
+ * @type {number | undefined}
908
825
  */
909
- connect(node: NodeIdentifier): void;
826
+ volume?: number;
910
827
  /**
911
- *
912
- * Get the least used node.
913
- * @returns {NodeStructure} The least used node.
914
- * @example
915
- * ```ts
916
- * const node = manager.nodeManager.getLeastUsed();
917
- * if (node) {
918
- * console.log(node.id); // node1
919
- * console.log(node.penalties); // the penalties of the node
920
- * console.log(node.state); // the state of the node
921
- * }
922
- * ```
828
+ * The filters for the player.
829
+ * @type {Partial<FilterSettings> | undefined}
923
830
  */
924
- getLeastUsed(sortType?: NodeSortTypes): NodeStructure;
831
+ filters?: Partial<FilterSettings>;
925
832
  /**
926
- *
927
- * Reconnect the nodes.
928
- * @returns {void}
929
- * @example
930
- * ```ts
931
- * const node = manager.nodeManager.get("node1");
932
- * if (node) node.reconnectAll();
933
- * ```
833
+ * The voice settings for the player.
834
+ * @type {LavalinkPlayerVoice | undefined}
934
835
  */
935
- reconnectAll(): void;
836
+ voice?: LavalinkPlayerVoice;
837
+ }
838
+ /**
839
+ * The types of loop modes.
840
+ */
841
+ declare enum LoopMode {
936
842
  /**
937
- * Disconnect the nodes.
938
- * @returns {void}
939
- * @example
940
- * ```ts
941
- * const node = manager.nodeManager.get("node1");
942
- * if (node) node.disconnectAll();
943
- * ```
843
+ * Loop mode for repeating the current track.
944
844
  */
945
- disconnectAll(): void;
845
+ Track = 1,
946
846
  /**
947
- * Connect the nodes.
948
- * @returns {void}
949
- * @example
950
- * ```ts
951
- * const node = manager.nodeManager.get("node1");
952
- * if (node) node.connect();
953
- * ```
847
+ * Loop mode for repeating the queue.
954
848
  */
955
- connectAll(): void;
849
+ Queue = 2,
956
850
  /**
957
- * Destroy the nodes.
958
- * @returns {void}
959
- * @example
960
- * ```ts
961
- * const node = manager.nodeManager.get("node1");
962
- * if (node) node.destroy();
963
- * ```
851
+ * Loop mode for repeating nothing.
964
852
  */
965
- destroyAll(): void;
853
+ Off = 3
966
854
  }
967
-
968
855
  /**
969
- * The methods for http requests
856
+ * The types of player events.
970
857
  */
971
- declare enum HttpMethods {
858
+ declare enum PlayerEventType {
972
859
  /**
973
- * The GET method requests a representation of the specified resource. Requests using GET should only retrieve data.
974
- * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/GET
975
- * @type {string}
860
+ * Event type for when a track starts.
976
861
  */
977
- Get = "GET",
862
+ TrackStart = "TrackStartEvent",
978
863
  /**
979
- * 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.
980
- * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST
981
- * @type {string}
864
+ * Event type for when a track ends.
982
865
  */
983
- Post = "POST",
866
+ TrackEnd = "TrackEndEvent",
984
867
  /**
985
- * The PUT method replaces all current representations of the target resource with the request payload.
986
- * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PUT
987
- * @type {string}
868
+ * Event type for when a track encounters an exception.
988
869
  */
989
- Put = "PUT",
870
+ TrackException = "TrackExceptionEvent",
990
871
  /**
991
- * The PATCH method is used to apply partial modifications to a resource.
992
- * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PATCH
993
- * @type {string}
872
+ * Event type for when a track gets stuck.
994
873
  */
995
- Patch = "PATCH",
874
+ TrackStuck = "TrackStuckEvent",
996
875
  /**
997
- * The DELETE method deletes the specified resource.
998
- * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/DELETE
999
- * @type {string}
876
+ * Event type for when lyrics are found.
1000
877
  */
1001
- Delete = "DELETE",
878
+ LyricsFound = "LyricsFoundEvent",
1002
879
  /**
1003
- * The HEAD method asks for a response identical to that of a GET request, but without the response body.
1004
- * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/HEAD
1005
- * @type {string}
880
+ * Event type for when lyrics are not found.
1006
881
  */
1007
- Head = "HEAD"
1008
- }
1009
- declare enum RestPathType {
882
+ LyricsNotFound = "LyricsNotFoundEvent",
1010
883
  /**
1011
- * The raw path of the request.
1012
- * @type {string}
884
+ * Event type for when a lyrics line is sent.
1013
885
  */
1014
- Raw = "/",
886
+ LyricsLine = "LyricsLineEvent",
1015
887
  /**
1016
- * The versioned path v4 of the request.
1017
- * @type {string}
888
+ * Event type for when the WebSocket connection is closed.
1018
889
  */
1019
- V4 = "/v4"
890
+ WebsocketClosed = "WebSocketClosedEvent"
1020
891
  }
1021
892
  /**
1022
- * The status codes for the REST.
1023
- * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Status
893
+ * The reasons a track can end.
1024
894
  */
1025
- declare enum HttpStatusCodes {
895
+ declare enum TrackEndReason {
1026
896
  /**
1027
- * The request has succeeded.
1028
- * @type {number}
897
+ * The track ended normally.
1029
898
  */
1030
- OK = 200,
899
+ Finished = "finished",
1031
900
  /**
1032
- * The request has been fulfilled and resulted in a new resource being created.
1033
- * @type {number}
901
+ * The track fails to load.
1034
902
  */
1035
- Created = 201,
903
+ LoadFailed = "loadFailed",
1036
904
  /**
1037
- * The request has been accepted for processing, but the processing has not been completed.
1038
- * @type {number}
905
+ * The track was stopped.
1039
906
  */
1040
- Accepted = 202,
907
+ Stopped = "stopped",
1041
908
  /**
1042
- * The server successfully processed the request, but is not returning any content.
1043
- * @type {number}
909
+ * The track was replaced.
1044
910
  */
1045
- NoContent = 204,
911
+ Replaced = "replaced",
1046
912
  /**
1047
- * The resource has been moved permanently to a new URI.
1048
- * @type {number}
913
+ * The track was cleaned up.
1049
914
  */
1050
- MovedPermanently = 301,
915
+ Cleanup = "cleanup"
916
+ }
917
+ /**
918
+ * The options for automatic player error handling.
919
+ */
920
+ interface ErrorPlayerActions {
1051
921
  /**
1052
- * The requested resource has been found at a different URI.
1053
- * @type {number}
922
+ * Whether to automatically destroy the player on error.
923
+ * @type {boolean | undefined}
924
+ * @default false
1054
925
  */
1055
- Found = 302,
926
+ autoDestroy?: boolean;
1056
927
  /**
1057
- * The resource has not been modified since the last request.
1058
- * @type {number}
928
+ * Whether to automatically skip the track on error.
929
+ * @type {boolean | undefined}
930
+ * @default false
1059
931
  */
1060
- NotModified = 304,
932
+ autoSkip?: boolean;
1061
933
  /**
1062
- * The request cannot be processed due to bad syntax.
1063
- * @type {number}
934
+ * Whether to automatically stop the player on error.
935
+ * @type {boolean | undefined}
936
+ * @default false
1064
937
  */
1065
- BadRequest = 400,
938
+ autoStop?: boolean;
939
+ }
940
+ /**
941
+ * The options for error actions.
942
+ */
943
+ interface DisconnectPlayerActions extends Pick<ErrorPlayerActions, "autoDestroy"> {
1066
944
  /**
1067
- * The request requires user authentication.
1068
- * @type {number}
945
+ * Whether to automatically reconnect on disconnect.
946
+ * @type {boolean | undefined}
947
+ * @default false
1069
948
  */
1070
- Unauthorized = 401,
949
+ autoReconnect?: boolean;
1071
950
  /**
1072
- * The request was valid, but the server is refusing action.
1073
- * @type {number}
951
+ * Whether to automatically add tracks back to the queue on disconnect.
952
+ * @type {boolean | undefined}
953
+ * @default false
1074
954
  */
1075
- Forbidden = 403,
955
+ autoQueue?: boolean;
956
+ }
957
+ /**
958
+ * The Hoshimi player options.
959
+ */
960
+ interface HoshimiPlayerOptions {
1076
961
  /**
1077
- * The server cannot find the requested resource.
1078
- * @type {number}
962
+ *
963
+ * The function to use to get the requester data.
964
+ * @param {TrackRequester} requester The requester of the track.
1079
965
  */
1080
- NotFound = 404,
966
+ requesterFn?<T extends TrackRequester = TrackRequester>(requester: TrackRequester): Awaitable<T>;
1081
967
  /**
1082
- * The request method is known by the server but has been disabled and cannot be used.
1083
- * @type {number}
968
+ * The options for handling errors.
969
+ * @type {ErrorPlayerActions | undefined}
1084
970
  */
1085
- MethodNotAllowed = 405,
971
+ onError?: ErrorPlayerActions;
1086
972
  /**
1087
- * The server timed out waiting for the request.
1088
- * @type {number}
973
+ * The options for handling disconnects.
974
+ * @type {DisconnectPlayerActions | undefined}
1089
975
  */
1090
- RequestTimeout = 408,
976
+ onDisconnect?: DisconnectPlayerActions;
977
+ }
978
+ /**
979
+ * The base interface for player events.
980
+ */
981
+ interface PlayerEvent {
1091
982
  /**
1092
- * The request could not be completed due to a conflict with the current state of the resource.
1093
- * @type {number}
1094
- */
1095
- Conflict = 409,
1096
- /**
1097
- * The requested resource is no longer available and will not be available again.
1098
- * @type {number}
1099
- */
1100
- Gone = 410,
1101
- /**
1102
- * The user has sent too many requests in a given amount of time.
1103
- * @type {number}
1104
- */
1105
- TooManyRequests = 429,
1106
- /**
1107
- * A generic error message, given when no more specific message is suitable.
1108
- * @type {number}
1109
- */
1110
- InternalServerError = 500,
1111
- /**
1112
- * The server does not recognize the request method or lacks the ability to fulfill it.
1113
- * @type {number}
983
+ * The operation code for the event.
984
+ * @type {OpCodes.Event}
1114
985
  */
1115
- NotImplemented = 501,
986
+ op: OpCodes.Event;
1116
987
  /**
1117
- * The server was acting as a gateway and received an invalid response.
1118
- * @type {number}
988
+ * The guild ID associated with the event.
989
+ * @type {string}
1119
990
  */
1120
- BadGateway = 502,
991
+ guildId: string;
992
+ }
993
+ /**
994
+ * The event for when a track starts playing.
995
+ */
996
+ interface TrackStartEvent extends PlayerEvent {
1121
997
  /**
1122
- * The server is currently unavailable (overloaded or down).
1123
- * @type {number}
998
+ * The type of the event.
999
+ * @type {PlayerEventType.TrackStart}
1124
1000
  */
1125
- ServiceUnavailable = 503,
1001
+ type: PlayerEventType.TrackStart;
1126
1002
  /**
1127
- * The server did not receive a timely response from an upstream server.
1128
- * @type {number}
1003
+ * The track that started playing.
1004
+ * @type {LavalinkTrack}
1129
1005
  */
1130
- GatewayTimeout = 504
1006
+ track: LavalinkTrack;
1131
1007
  }
1132
1008
  /**
1133
- * The options for the REST.
1009
+ * The event for when a track ends.
1134
1010
  */
1135
- interface RestOptions {
1011
+ interface TrackEndEvent extends PlayerEvent {
1136
1012
  /**
1137
- * The endpoint for the REST.
1138
- * @type {string}
1013
+ * The type of the event.
1014
+ * @type {PlayerEventType.TrackEnd}
1139
1015
  */
1140
- endpoint: `/${string}`;
1016
+ type: PlayerEventType.TrackEnd;
1141
1017
  /**
1142
- * The method for the REST.
1143
- * @type {HttpMethods}
1018
+ * The track that ended.
1019
+ * @type {LavalinkTrack}
1144
1020
  */
1145
- method?: HttpMethods;
1021
+ track: LavalinkTrack;
1146
1022
  /**
1147
- * The headers for the REST.
1148
- * @type {Record<string, string>}
1023
+ * The reason the track ended.
1024
+ * @type {TrackEndReason}
1149
1025
  */
1150
- headers?: Record<string, string>;
1026
+ reason: TrackEndReason;
1027
+ }
1028
+ /**
1029
+ * The event for when a track gets stuck.
1030
+ */
1031
+ interface TrackStuckEvent extends PlayerEvent {
1151
1032
  /**
1152
- * The body for the REST.
1153
- * @type {Record<string, unknown> | string | undefined}
1033
+ * The type of the event.
1034
+ * @type {PlayerEventType.TrackStuck}
1154
1035
  */
1155
- body?: Record<string, unknown> | string;
1036
+ type: PlayerEventType.TrackStuck;
1156
1037
  /**
1157
- * The query parameters for the REST.
1158
- * @type {Record<string, string>}
1038
+ * The track that got stuck.
1039
+ * @type {LavalinkTrack}
1159
1040
  */
1160
- params?: Record<string, string>;
1041
+ track: LavalinkTrack;
1161
1042
  /**
1162
- * The path type for the REST.
1163
- * @type {RestPathType}
1043
+ * The threshold in milliseconds.
1044
+ * @type {number}
1164
1045
  */
1165
- pathType?: RestPathType;
1046
+ thresholdMs: number;
1166
1047
  }
1167
1048
  /**
1168
- * The fetch options for the request.
1049
+ * The event for when a track encounters an exception.
1169
1050
  */
1170
- interface FetchOptions extends Omit<RestOptions, "endpoint" | "body"> {
1051
+ interface TrackExceptionEvent extends PlayerEvent {
1171
1052
  /**
1172
- * The signal for the request.
1053
+ * The type of the event.
1054
+ * @type {PlayerEventType.TrackException}
1173
1055
  */
1174
- signal: AbortSignal;
1056
+ type: PlayerEventType.TrackException;
1175
1057
  /**
1176
- * The stringified body for the request.
1058
+ * The exception that occurred.
1059
+ * @type {Exception}
1177
1060
  */
1178
- body?: string;
1061
+ exception: Exception;
1179
1062
  }
1180
1063
  /**
1181
- * The error for the REST.
1064
+ * The event for when the WebSocket connection is closed.
1182
1065
  */
1183
- interface LavalinkRestError {
1066
+ interface WebSocketClosedEvent extends PlayerEvent {
1184
1067
  /**
1185
- * The timestamp for the REST.
1186
- * @type {number}
1068
+ * The type of the event.
1069
+ * @type {PlayerEventType.WebsocketClosed}
1187
1070
  */
1188
- timestamp: number;
1071
+ type: PlayerEventType.WebsocketClosed;
1189
1072
  /**
1190
- * The status for the REST.
1073
+ * The close code.
1191
1074
  * @type {number}
1192
1075
  */
1193
- status: number;
1076
+ code: number;
1194
1077
  /**
1195
- * The error for the REST.
1196
- * @type {string}
1078
+ * Whether the connection was closed by the remote.
1079
+ * @type {boolean}
1197
1080
  */
1198
- error: string;
1081
+ byRemote: boolean;
1199
1082
  /**
1200
- * The trace for the REST.
1083
+ * The reason for the closure.
1201
1084
  * @type {string}
1202
1085
  */
1203
- trace?: string;
1086
+ reason: string;
1087
+ }
1088
+ /**
1089
+ * The event for when lyrics are found.
1090
+ */
1091
+ interface LyricsFoundEvent extends PlayerEvent {
1204
1092
  /**
1205
- * The message for the REST.
1206
- * @type {string}
1093
+ * The type of the event.
1094
+ * @type {PlayerEventType.LyricsFound}
1207
1095
  */
1208
- message: string;
1096
+ type: PlayerEventType.LyricsFound;
1209
1097
  /**
1210
- * The path for the REST.
1098
+ * The guild id associated with the event.
1211
1099
  * @type {string}
1212
1100
  */
1213
- path: string;
1101
+ guildId: string;
1102
+ /**
1103
+ * The lyrics result of the event.
1104
+ * @type {LyricsResult}
1105
+ */
1106
+ lyrics: LyricsResult;
1214
1107
  }
1215
1108
  /**
1216
- * The player response from the Lavalink REST API.
1109
+ * The event for when lyrics are not found.
1217
1110
  */
1218
- interface LavalinkPlayer {
1111
+ interface LyricsNotFoundEvent extends PlayerEvent {
1219
1112
  /**
1220
- * The guild ID associated with the player.
1113
+ * The type of the event.
1114
+ * @type {PlayerEventType.LyricsNotFound}
1115
+ */
1116
+ type: PlayerEventType.LyricsNotFound;
1117
+ /**
1118
+ * The guild id associated with the event.
1221
1119
  * @type {string}
1222
1120
  */
1223
1121
  guildId: string;
1122
+ }
1123
+ /**
1124
+ * The event for when a lyrics line is sent.
1125
+ */
1126
+ interface LyricsLineEvent extends PlayerEvent {
1224
1127
  /**
1225
- * The track currently being played.
1226
- * @type {LavalinkTrack}
1128
+ * The type of the event.
1129
+ * @type {PlayerEventType.LyricsLine}
1227
1130
  */
1228
- track?: LavalinkTrack;
1131
+ type: PlayerEventType.LyricsLine;
1229
1132
  /**
1230
- * The volume of the player.
1133
+ * The guild id associated with the event.
1134
+ * @type {string}
1135
+ */
1136
+ guildId: string;
1137
+ /**
1138
+ * The line index of the lyrics line.
1231
1139
  * @type {number}
1232
1140
  */
1233
- volume: number;
1141
+ lineIndex: number;
1234
1142
  /**
1235
- * Whether the player is paused.
1143
+ * The lyrics line of the event.
1144
+ * @type {LyricsLine}
1145
+ */
1146
+ line: LyricsLine;
1147
+ /**
1148
+ * Returns if the line was skipped.
1236
1149
  * @type {boolean}
1237
1150
  */
1238
- paused: boolean;
1151
+ skipped: boolean;
1152
+ }
1153
+ /**
1154
+ * The update for the player state.
1155
+ */
1156
+ interface PlayerUpdate {
1239
1157
  /**
1240
- * The voice connection details.
1241
- * @type {LavalinkPlayerVoice}
1158
+ * The operation code for the update.
1159
+ * @type {OpCodes.PlayerUpdate}
1242
1160
  */
1243
- voice: LavalinkPlayerVoice;
1161
+ op: OpCodes.PlayerUpdate;
1244
1162
  /**
1245
- * The filter options applied to the player.
1246
- * @type {FilterSettings}
1163
+ * The guild ID associated with the update.
1164
+ * @type {string}
1247
1165
  */
1248
- filters: FilterSettings;
1166
+ guildId: string;
1249
1167
  /**
1250
1168
  * The state of the player.
1251
- * @type {LavalinkPlayerState}
1169
+ * @type {PlayerUpdateState}
1252
1170
  */
1253
- state: LavalinkPlayerState;
1171
+ state: PlayerUpdateState;
1254
1172
  }
1255
- /**
1256
- * The state of the player.
1257
- */
1258
- interface LavalinkPlayerState {
1173
+ interface PlayerUpdateState {
1259
1174
  /**
1260
- * The time since the connection was established.
1261
- * @type {number}
1175
+ * Whether the player is connected.
1176
+ * @type {boolean}
1262
1177
  */
1263
- time: number;
1178
+ connected: boolean;
1264
1179
  /**
1265
- * The position of the current track in milliseconds.
1180
+ * The position of the track.
1266
1181
  * @type {number}
1267
1182
  */
1268
1183
  position: number;
1269
1184
  /**
1270
- * Whether the player is connected to the voice channel.
1271
- * @type {boolean}
1185
+ * The time of the update.
1186
+ * @type {number}
1272
1187
  */
1273
- connected: boolean;
1188
+ time: number;
1274
1189
  /**
1275
- * The ping to the voice server in milliseconds.
1190
+ * The ping of the player.
1276
1191
  * @type {number}
1277
1192
  */
1278
1193
  ping: number;
1279
1194
  }
1280
1195
  /**
1281
- * The options to update the player.
1196
+ * The options for the player.
1282
1197
  */
1283
- interface UpdatePlayerInfo {
1198
+ interface PlayerOptions {
1284
1199
  /**
1285
- * The guild id associated with the player.
1200
+ * Guild id of the player.
1286
1201
  * @type {string}
1287
1202
  */
1288
1203
  guildId: string;
1289
1204
  /**
1290
- * The options to update the player.
1291
- * @type {LavalinkPlayOptions}
1205
+ * Voice channel id of the player.
1206
+ * @type {string}
1292
1207
  */
1293
- playerOptions: LavalinkPlayOptions;
1208
+ voiceId: string;
1294
1209
  /**
1295
- * Whether to replace the current track.
1210
+ * Volume of the player.
1211
+ * @type {number | undefined}
1212
+ * @default 100
1213
+ */
1214
+ volume?: number;
1215
+ /**
1216
+ * Set if the player should be deafened.
1296
1217
  * @type {boolean | undefined}
1297
- * @default false
1218
+ * @default true
1298
1219
  */
1299
- noReplace?: boolean;
1300
- }
1301
- /**
1302
- * The updated session of the current session.
1303
- */
1304
- interface LavalinkSession {
1220
+ selfDeaf?: boolean;
1305
1221
  /**
1306
- * Whather the session is resuming.
1307
- * @type {boolean}
1222
+ * Set if the player should be muted.
1223
+ * @type {boolean | undefined}
1224
+ * @default false
1308
1225
  */
1309
- resuming: boolean;
1226
+ selfMute?: boolean;
1310
1227
  /**
1311
- * The timeout for the session.
1312
- * @type {number}
1228
+ * Text channel id of the player.
1229
+ * @type {string | undefined}
1313
1230
  */
1314
- timeout: number;
1231
+ textId?: string;
1232
+ /**
1233
+ * Lavalink node of the player.
1234
+ * @type {NodeIdentifier}
1235
+ */
1236
+ node?: NodeIdentifier;
1315
1237
  }
1316
1238
  /**
1317
- * The rest options.
1239
+ * The options for playing a track with Lavalink.
1318
1240
  */
1319
- interface HoshimiRestOptions {
1241
+ interface LavalinkPlayOptions extends BasePlayOptions {
1320
1242
  /**
1321
- * The amount of time to wait for the player to resume. (in milliseconds)
1322
- * @type {number}
1323
- * @default 10000
1243
+ * Track to play.
1244
+ * @type {PartialLavalinkTrack | undefined}
1324
1245
  */
1325
- resumeTimeout?: number;
1246
+ track?: PartialLavalinkTrack;
1326
1247
  }
1327
1248
  /**
1328
- * The methods for decoding base64 encoded tracks.
1249
+ * The options for playing a track.
1329
1250
  */
1330
- interface DecodeMethods {
1251
+ interface PlayOptions extends BasePlayOptions {
1331
1252
  /**
1332
- *
1333
- * Decodes a single base64 encoded track.
1334
- * @param {string} track The base64 encoded track.
1335
- * @param {TrackRequester} requester The requester of the track.
1336
- * @return {Promise<Track>} The decoded track.
1337
- * @example
1338
- * ```ts
1339
- * const node = player.node;
1340
- * const track = await node.decode.single("base64EncodedTrack");
1341
- * console.log(track.info.title); // Track Title
1342
- * ```
1253
+ * Whether to replace the current track.
1254
+ * @type {boolean | undefined}
1255
+ * @default false
1343
1256
  */
1344
- single(track: string, requester: TrackRequester): Promise<Track>;
1257
+ noReplace?: boolean;
1345
1258
  /**
1346
- * Decodes multiple base64 encoded tracks.
1347
- * @param {string[]} tracks The base64 encoded tracks.
1348
- * @param {TrackRequester} requester The requester of the tracks.
1349
- * @return {Promise<Track[]>} The decoded tracks.
1350
- * @example
1351
- * ```ts
1352
- * const node = player.node;
1353
- * const tracks = await node.decode.multiple(["base64EncodedTrack1", "base64EncodedTrack2"]);
1354
- * console.log(tracks[0].info.title); // Track Title 1
1355
- * console.log(tracks[1].info.title); // Track Title 2
1356
- * ```
1259
+ * Track to play.
1260
+ * @type {Track | UnresolvedTrack | undefined}
1357
1261
  */
1358
- multiple(tracks: string[], requester: TrackRequester): Promise<Track[]>;
1262
+ track?: Track | UnresolvedTrack;
1359
1263
  }
1360
- /**
1361
- * The session of the node.
1362
- */
1363
- type NullableLavalinkSession = PickNullable<LavalinkSession, "timeout">;
1364
-
1365
- /**
1366
- * Class representing the REST for the node.
1367
- * @class Rest
1368
- */
1369
- declare class Rest {
1264
+ interface PlayerVoice {
1370
1265
  /**
1371
- * The URL for the REST.
1266
+ * The voice server token.
1372
1267
  * @type {string}
1373
1268
  */
1374
- readonly url: string;
1269
+ token: string;
1375
1270
  /**
1376
- * The version for the REST.
1271
+ * The voice server endpoint.
1377
1272
  * @type {string}
1378
1273
  */
1379
- readonly version: string;
1274
+ endpoint: string;
1380
1275
  /**
1381
- * The timeout for the REST.
1382
- * @type {number}
1276
+ * The voice server session id.
1277
+ * @type {string}
1383
1278
  */
1384
- readonly restTimeout: number;
1279
+ sessionId: string;
1385
1280
  /**
1386
- * The user agent for the REST.
1387
- * @type {UserAgent}
1281
+ * The voice server guild id.
1282
+ * @type {string | undefined}
1388
1283
  */
1389
- readonly userAgent: UserAgent;
1284
+ connected?: boolean;
1390
1285
  /**
1391
- * The node for the REST.
1392
- * @type {Node}
1286
+ * The voice server ping.
1287
+ * @type {number | undefined}
1393
1288
  */
1394
- readonly node: NodeStructure;
1289
+ ping?: number;
1290
+ }
1291
+ /**
1292
+ * The JSON representation of the player.
1293
+ */
1294
+ interface PlayerJson {
1395
1295
  /**
1396
- *
1397
- * Create a new REST.
1398
- * @param {NodeStructure} node The node for the REST.
1399
- * @example
1400
- * ```ts
1401
- * const node = new Node({
1402
- * host: "localhost",
1403
- * port: 2333,
1404
- * password: "youshallnotpass",
1405
- * secure: false,
1406
- * });
1407
- *
1408
- * const rest = new Rest(node);
1409
- * console.log(rest.restUrl); // http://localhost:2333/v4
1410
- * ```
1296
+ * The guild id of the player.
1297
+ * @type {string}
1411
1298
  */
1412
- constructor(node: NodeStructure);
1299
+ guildId: string;
1413
1300
  /**
1414
- * The REST URL to make requests.
1415
- * @type {string}
1301
+ * The volume of the player.
1302
+ * @type {number}
1416
1303
  */
1417
- get restUrl(): string;
1304
+ volume: number;
1418
1305
  /**
1419
- * The session id of the node.
1420
- * @type {string}
1306
+ * The self deaf state of the player.
1307
+ * @type {boolean}
1421
1308
  */
1422
- get sessionId(): string;
1309
+ selfDeaf: boolean;
1423
1310
  /**
1424
- *
1425
- * Make a request to the node.
1426
- * @param {RestOptions} options The options to make the request.
1427
- * @returns {Promise<T | null>} The response from the node.
1311
+ * The self mute state of the player.
1312
+ * @type {boolean}
1428
1313
  */
1429
- request<T>(options: RestOptions): Promise<T | null>;
1314
+ selfMute: boolean;
1430
1315
  /**
1431
- *
1432
- * Update the player data.
1433
- * @param {Partial<UpdatePlayerInfo>} data The player data to update.
1434
- * @returns {LavalinkPlayer | null} The updated player data.
1435
- * @example
1436
- * ```ts
1437
- * const player = await node.rest.updatePlayer({
1438
- * guildId: "guildId",
1439
- * noReplace: true,
1440
- * playerOptions: {
1441
- * paused: false,
1442
- * track: { encoded: "encoded track" },
1443
- * },
1444
- * });
1445
- *
1446
- * console.log(player); // The updated lavalink player data
1447
- * ```
1316
+ * The voice settings for the player.
1317
+ * @type {LavalinkPlayerVoice}
1448
1318
  */
1449
- updatePlayer(data: Partial<UpdatePlayerInfo>): Promise<LavalinkPlayer | null>;
1319
+ voice: Nullable<LavalinkPlayerVoice>;
1450
1320
  /**
1451
- *
1452
- * Stop the track in player for the guild.
1453
- * @param {string} guildId the guild id to stop the player
1454
- * @returns {Promise<LavalinkPlayer | null>} The updated player data.
1455
- * @example
1456
- * ```ts
1457
- * const player = await node.rest.stopPlayer("guildId");
1458
- * if (player) console.log(player); // The lavalink player
1459
- * ```
1321
+ * The loop mode of the player.
1322
+ * @type {LoopMode}
1460
1323
  */
1461
- stopPlayer(guildId: string): Promise<LavalinkPlayer | null>;
1324
+ loop: LoopMode;
1462
1325
  /**
1463
- *
1464
- * Destroy the player for the guild.
1465
- * @param {string} guildId The guild id to destroy the player.
1466
- * @returns {Promise<void>} The updated player data.
1467
- * @example
1468
- * ```ts
1469
- * await node.rest.destroyPlayer("guildId");
1470
- * ```
1471
- * @example
1326
+ * The options for the player.
1327
+ * @type {boolean}
1472
1328
  */
1473
- destroyPlayer(guildId: string): Promise<void>;
1329
+ options: PlayerOptions;
1474
1330
  /**
1475
- *
1476
- * Update the session for the node
1477
- * @param {boolean} resuming Enable resuming for the session.
1478
- * @param {number | null} timeout The timeout for the session.
1479
- * @returns {Promise<LavalinkSession | null>} The updated session data.
1480
- * @example
1481
- * ```ts
1482
- * const session = await node.rest.updateSession(true, 10000);
1483
- * if (session) console.log(session); // The lavalink session data
1484
- * ```
1331
+ * The paused state of the player.
1332
+ * @type {boolean}
1485
1333
  */
1486
- updateSession(resuming: boolean, timeout?: number | null): Promise<LavalinkSession | null>;
1487
- }
1488
-
1489
- /**
1490
- * Class representing the DSPX Plugin filters for a player.
1491
- * @class DSPXPluginFilter
1492
- */
1493
- declare class DSPXPluginFilter {
1334
+ paused: boolean;
1494
1335
  /**
1495
- * The filter manager instance.
1496
- * @type {FilterManagerStructure}
1497
- * @readonly
1336
+ * The playing state of the player.
1337
+ * @type {boolean}
1498
1338
  */
1499
- readonly manager: FilterManagerStructure;
1339
+ playing: boolean;
1500
1340
  /**
1501
- * Create a new DSPXPluginFilter instance.
1502
- * @param {FilterManagerStructure} manager The filter manager instance.
1341
+ * The voice channel id of the player.
1342
+ * @type {string}
1503
1343
  */
1504
- constructor(manager: FilterManagerStructure);
1344
+ voiceId?: string;
1505
1345
  /**
1506
- *
1507
- * Set the low-pass filter with the given settings.
1508
- * @param {FilterPluginPassSettings} [settings=DefaultFilter.DSPXLowPass] The settings for the low-pass filter.
1509
- * @returns {Promise<this>} The instance of the filter manager.
1346
+ * The text channel id of the player.
1347
+ * @type {string | undefined}
1510
1348
  */
1511
- setLowPass(settings?: Partial<FilterPluginPassSettings>): Promise<this>;
1349
+ textId?: string;
1512
1350
  /**
1513
- *
1514
- * Set the high-pass filter with the given settings.
1515
- * @param {FilterPluginPassSettings} [settings=DefaultFilter.DSPXHighPass] The settings for the high-pass filter.
1516
- * @returns {Promise<this>} The instance of the filter manager.
1351
+ * The last position received from Lavalink.
1352
+ * @type {number}
1517
1353
  */
1518
- setHighPass(settings?: Partial<FilterPluginPassSettings>): Promise<this>;
1354
+ lastPosition: number;
1519
1355
  /**
1520
- *
1521
- * Set the normalization filter with the given settings.
1522
- * @param {NormalizationSettings} [settings=DefaultFilter.DSPXNormalization] The settings for the normalization filter.
1523
- * @returns {Promise<this>} The instance of the filter manager.
1356
+ * The timestamp when the last position change update happened.
1357
+ * @type {number | null}
1524
1358
  */
1525
- setNormalization(settings?: Partial<NormalizationSettings>): Promise<this>;
1359
+ lastPositionUpdate: number | null;
1526
1360
  /**
1527
- *
1528
- * Set the echo filter with the given settings.
1529
- * @param {EchoSettings} [settings=DefaultFilter.DSPXEcho] The settings for the echo filter.
1530
- * @returns {Promise<this>} The instance of the filter manager.
1361
+ * The current calculated position of the player.
1362
+ * @type {number}
1531
1363
  */
1532
- setEcho(settings?: Partial<EchoSettings>): Promise<this>;
1533
- }
1534
-
1535
- type NonLengthEchoSettings = Omit$1<EchoSettings, "echoLength">;
1536
- /**
1537
- * Class representing Lavalink plugin filters.
1538
- * @class LavalinkPluginFilter
1539
- */
1540
- declare class LavalinkPluginFilter {
1364
+ position: number;
1541
1365
  /**
1542
- * The filter manager instance.
1543
- * @type {FilterManagerStructure}
1544
- * @private
1545
- * @readonly
1366
+ * The timestamp when the player was created.
1367
+ * @type {number}
1546
1368
  */
1547
- private readonly manager;
1369
+ createdTimestamp: number;
1548
1370
  /**
1549
- * Creates an instance of LavalinkPluginFilter.
1550
- * @param {FilterManagerStructure} filters - The filter manager instance.
1371
+ * The ping of the player.
1372
+ * @type {number}
1551
1373
  */
1552
- constructor(filters: FilterManagerStructure);
1374
+ ping: number;
1553
1375
  /**
1554
- *
1555
- * Set the echo filter with the given settings.
1556
- * @param {Omit<EchoSettings, "echoLength">} [settings=DefaultFilter.PluginEcho] The settings for the echo filter.
1557
- * @returns {Promise<this>} The instance of the filter manager.
1376
+ * The queue of the player.
1377
+ * @type {QueueJson}
1558
1378
  */
1559
- setEcho(settings?: Partial<NonLengthEchoSettings>): Promise<this>;
1379
+ queue: QueueJson;
1560
1380
  /**
1561
- *
1562
- * Set the reverb filter with the given settings.
1563
- * @param {Partial<LavalinkFilterPluginReverbSettings>} [settings=DefaultFilter.PluginReverb] The settings for the reverb filter.
1564
- * @returns {Promise<this>} The instance of the filter manager.
1381
+ * The node of the player.
1382
+ * @type {NodeJson}
1565
1383
  */
1566
- setReverb(settings?: Partial<LavalinkFilterPluginReverbSettings>): Promise<this>;
1384
+ node: NodeJson;
1385
+ /**
1386
+ * The filter settings of the player.
1387
+ * @type {FilterSettings}
1388
+ */
1389
+ filters: FilterSettings;
1567
1390
  }
1568
-
1569
1391
  /**
1570
- * Class representing a filter manager for a player.
1571
- * @class FilterManager
1392
+ * The lyrics methods for the player.
1572
1393
  */
1573
- declare class FilterManager {
1394
+ interface LyricsMethods {
1574
1395
  /**
1575
- * The player this filter manager belongs to.
1576
- * @type {PlayerStructure}
1577
- * @public
1578
- * @readonly
1396
+ *
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.
1400
+ * @example
1401
+ * ```ts
1402
+ * const player = manager.getPlayer("guildId");
1403
+ * const lyrics = await player.lyricsManager.current();
1404
+ * ```
1579
1405
  */
1580
- readonly player: PlayerStructure;
1406
+ current(skipSource?: boolean): Promise<LyricsResult | null>;
1581
1407
  /**
1582
- * The bands applied to the player.
1583
- * @type {EQBandSettings[]}
1584
- * @readonly
1408
+ *
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.
1413
+ * @example
1414
+ * ```ts
1415
+ * const player = manager.getPlayer("guildId");
1416
+ * const track = player.queue.current;
1417
+ * const lyrics = await player.lyrics.get(track);
1418
+ * ```
1585
1419
  */
1586
- readonly bands: EQBandSettings[];
1420
+ get(track: Track, skipSource?: boolean): Promise<LyricsResult | null>;
1587
1421
  /**
1588
- * The current filter settings applied to the player.
1589
- * @type {FilterSettings}
1590
- * @public
1422
+ *
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!
1426
+ * @example
1427
+ * ```ts
1428
+ * const player = manager.getPlayer("guildId");
1429
+ * await player.lyrics.subscribe();
1430
+ * ```
1591
1431
  */
1592
- data: FilterSettings;
1432
+ subscribe(skipSource?: boolean): Promise<void>;
1593
1433
  /**
1594
- * The enabled filters for the player.
1595
- * @type {EnabledPlayerFilters}
1434
+ *
1435
+ * Unsubscribe from the lyrics for a specific guild.
1436
+ * @returns {Promise<void>} Let's stop the sing session!
1437
+ * @example
1438
+ * ```ts
1439
+ * const player = manager.getPlayer("guildId");
1440
+ * await player.lyrics.unsubscribe();
1441
+ * ```
1596
1442
  */
1597
- filters: EnabledPlayerFilters;
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 {
1598
1459
  /**
1599
- * The lavalink plugin filters manager.
1600
- * @type {LavalinkPluginFilter}
1460
+ * The node instance.
1461
+ * @type {NodeStructure}
1601
1462
  * @readonly
1602
1463
  */
1603
- readonly plugin: LavalinkPluginFilter;
1464
+ readonly node: NodeStructure;
1604
1465
  /**
1605
- * The DSPX plugin filters manager.
1606
- * @type {DSPXPluginFilter}
1607
- * @readonly
1466
+ * Create a new LyricsManager instance.
1467
+ * @param {NodeStructure} node The node instance.
1468
+ * @example
1469
+ * ```ts
1470
+ * const node = manager.nodeManager.get("nodeId");
1471
+ * const lyricsManager = new LyricsManager(node);
1472
+ * ```
1608
1473
  */
1609
- readonly dspx: DSPXPluginFilter;
1474
+ constructor(node: NodeStructure);
1610
1475
  /**
1611
1476
  *
1612
- * Creates a new filter manager.
1613
- * @param {PlayerStructure} player The player this filter manager belongs to.
1614
- */
1615
- constructor(player: PlayerStructure);
1616
- /**
1617
- * Resets all filters to their default values.
1618
- * @returns {Promise<this>} A promise that resolves to the instance of the filter manager.
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.
1480
+ * @example
1481
+ * ```ts
1482
+ * const player = manager.getPlayer("guildId");
1483
+ * const lyrics = await player.lyricsManager.current();
1484
+ * ```
1619
1485
  */
1620
- reset(): Promise<this>;
1486
+ current(guildId: string, skipSource?: boolean): Promise<LyricsResult | null>;
1621
1487
  /**
1622
1488
  *
1623
- * Applies the current filters to the player.
1624
- * @returns {Promise<this>} A promise that resolves to the instance of the filter manager.
1625
- */
1626
- apply(): Promise<this>;
1627
- /**
1628
- * Checks if the current filters are active.
1629
- * @param {TimescaleSettings} timescale The timescale settings to check against.
1630
- * @returns {void} Nothing!
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.
1493
+ * @example
1494
+ * ```ts
1495
+ * const node = manager.nodeManager.get("nodeId");
1496
+ * const lyrics = await node.lyricsManager.get(track);
1497
+ * ```
1631
1498
  */
1632
- check(timescale?: TimescaleSettings): void;
1499
+ get(track: Track, skipSource?: boolean): Promise<LyricsResult | null>;
1633
1500
  /**
1634
1501
  *
1635
- * Checks if a specific filter is active.
1636
- * @param {FilterType} filter The filter type to check.
1637
- * @returns {boolean} True if the filter is active, false otherwise.
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!
1506
+ * @example
1507
+ * ```ts
1508
+ * const node = manager.nodeManager.get("nodeId");
1509
+ * await node.lyricsManager.subscribe("guildId");
1510
+ * ```
1638
1511
  */
1639
- has(filter: FilterType): boolean;
1512
+ subscribe(guildId: string, skipSource?: boolean): Promise<void>;
1640
1513
  /**
1641
1514
  *
1642
- * Sets the volume for the player.
1643
- * @param {number} volume The volume level to set (between 0 and 5).
1644
- * @returns {Promise<this>} A promise that resolves to the player instance.
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!
1518
+ * @example
1519
+ * ```ts
1520
+ * const node = manager.nodeManager.get("nodeId");
1521
+ * await node.lyricsManager.unsubscribe("guildId");
1522
+ * ```
1645
1523
  */
1646
- setVolume(volume: number): Promise<this>;
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> {
1647
1533
  /**
1648
- * Sets the audio output for the player.
1649
- * @param {AudioOutput} output The audio output to set.
1650
- * @returns {Promise<this>} A promise that resolves to the player instance.
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
1651
1546
  */
1652
- setAudioOutput(output: AudioOutput): Promise<this>;
1547
+ sweep(fn: (value: V, key: K, collection: this) => unknown): number;
1653
1548
  /**
1654
- *
1655
- * Sets the speed for the player.
1656
- * @param {number} speed The speed to set (default is 1).
1657
- * @returns {Promise<this>} A promise that resolves to the player instance.
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.
1553
+ * @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']
1658
1560
  */
1659
- setSpeed(speed?: number): Promise<this>;
1561
+ map<T>(fn: (value: V, key: K, collection: this) => T): T[];
1660
1562
  /**
1661
- *
1662
- * Sets the rate for the player.
1663
- * @param {number} rate The rate to set (default is 1).
1664
- * @returns {Promise<this>} A promise that resolves to the player instance.
1665
- */
1666
- setRate(rate?: number): Promise<this>;
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.
1567
+ * @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']
1574
+ */
1575
+ filter(fn: (value: V, key: K, collection: this) => boolean): V[];
1576
+ /**
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.
1580
+ * @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
1587
+ */
1588
+ find(fn: (value: V, key: K, collection: this) => boolean): V | undefined;
1589
+ }
1590
+
1591
+ /**
1592
+ * Class representing a node manager.
1593
+ * @class NodeManager
1594
+ */
1595
+ declare class NodeManager {
1596
+ /**
1597
+ * The manager for the node.
1598
+ * @type {Hoshimi}
1599
+ * @readonly
1600
+ */
1601
+ readonly manager: Hoshimi;
1602
+ /**
1603
+ * The nodes for the manager.
1604
+ * @type {Collection<string, Node>}
1605
+ * @readonly
1606
+ */
1607
+ readonly nodes: Collection<string, NodeStructure>;
1667
1608
  /**
1668
1609
  *
1669
- * Sets the pitch for the player.
1670
- * @param {number} pitch The pitch
1671
- * @returns {Promise<this>} A promise that resolves to the player instance.
1610
+ * The constructor for the node manager.
1611
+ * @param {Hoshimi} manager The manager for the node.
1612
+ * @example
1613
+ * ```ts
1614
+ * const manager = new Hoshimi();
1615
+ * const nodeManager = new NodeManager(manager);
1616
+ *
1617
+ * console.log(nodeManager.nodes.size); // 0
1618
+ * ```
1672
1619
  */
1673
- setPitch(pitch?: number): Promise<this>;
1620
+ constructor(manager: Hoshimi);
1674
1621
  /**
1675
1622
  *
1676
- * Sets the EQ bands for the player.
1677
- * @param {RestOrArray<EQBandSettings>} bands The EQ band settings to set.
1678
- * @returns {Promise<this>} A promise that resolves to the instance of the manager.
1623
+ * Delete the node.
1624
+ * @param {NodeIdentifier} node The node or node id to delete.
1625
+ * @returns {boolean} If the node was deleted.
1626
+ * @example
1627
+ * ```ts
1628
+ * const node = manager.nodeManager.get("node1");
1629
+ * if (node) manager.nodeManager.delete(node.id); // true if the node was deleted
1630
+ * ```
1679
1631
  */
1680
- setEQBand(...bands: RestOrArray<EQBandSettings>): Promise<this>;
1632
+ delete(node: NodeIdentifier): boolean;
1681
1633
  /**
1682
1634
  *
1683
- * Clears all EQ bands for the player.
1684
- * @returns {Promise<this>} A promise that resolves to the instance of the manager.
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.
1638
+ * @example
1639
+ * ```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
+ * }
1646
+ * ```
1685
1647
  */
1686
- clearEQBands(): Promise<this>;
1648
+ get(node: NodeIdentifier): NodeStructure | undefined;
1687
1649
  /**
1688
1650
  *
1689
- * Set the vibrato filter with the given settings.
1690
- * @param {TremoloSettings} [settings=DefaultFilterPreset.Vibrato] The settings for the vibrato filter.
1691
- * @returns {Promise<this>} The instance of the filter manager.
1651
+ * Create a new node.
1652
+ * @param {NodeOptions} options The options for the node.
1653
+ * @returns {NodeStructure} The created node.
1654
+ * @example
1655
+ * ```ts
1656
+ * const node = manager.nodeManager.create({
1657
+ * host: "localhost",
1658
+ * port: 2333,
1659
+ * password: "password",
1660
+ * secure: false,
1661
+ * });
1662
+ *
1663
+ * console.log(node.id); // localhost:2333
1692
1664
  */
1693
- setVibrato(settings?: Partial<TremoloSettings>): Promise<this>;
1665
+ create(options: NodeOptions): NodeStructure;
1694
1666
  /**
1695
1667
  *
1696
- * Set the tremolo filter with the given settings.
1697
- * @param {TremoloSettings} [settings=DefaultFilterPreset.Tremolo] The settings for the tremolo filter.
1698
- * @returns {Promise<this>} The instance of the filter manager.
1668
+ * Destroy a node.
1669
+ * @param {NodeIdentifier} node The node or node id to destroy.
1670
+ * @returns {void}
1671
+ * @example
1672
+ * ```ts
1673
+ * const node = manager.nodeManager.get("node1");
1674
+ * if (node) node.destroy();
1675
+ * ```
1699
1676
  */
1700
- setTremolo(settings?: Partial<TremoloSettings>): Promise<this>;
1677
+ destroy(node: NodeIdentifier): void;
1701
1678
  /**
1702
1679
  *
1703
- * Set the low-pass filter with the given settings.
1704
- * @param {LowPassSettings} [settings=DefaultFilterPreset.Lowpass] The settings for the low-pass filter.
1705
- * @returns {Promise<this>} The instance of the filter manager.
1680
+ * Reconnect a node.
1681
+ * @param {NodeIdentifier} node The node or node id to reconnect.
1682
+ * @returns {void}
1683
+ * @example
1684
+ * ```ts
1685
+ * const node = manager.nodeManager.get("node1");
1686
+ * if (node) node.reconnect();
1687
+ * ```
1706
1688
  */
1707
- setLowPass(settings?: Partial<LowPassSettings>): Promise<this>;
1689
+ reconnect(node: NodeIdentifier): void;
1708
1690
  /**
1709
- * Set the nightcore filter with the given settings.
1710
- * @param {Partial<TimescaleSettings>} [settings=DefaultFilterPreset.Nightcore] The settings for the nightcore filter.
1711
- * @returns {Promise<this>} The instance of the filter manager.
1691
+ *
1692
+ * Disconnect a node.
1693
+ * @param {NodeIdentifier} node The node or node id to disconnect.
1694
+ * @returns {void}
1695
+ * @example
1696
+ * ```ts
1697
+ * const node = manager.nodeManager.get("node1");
1698
+ * if (node) node.disconnect();
1699
+ * ```
1712
1700
  */
1713
- setNightcore(settings?: Partial<TimescaleSettings>): Promise<this>;
1701
+ disconnect(node: NodeIdentifier): void;
1714
1702
  /**
1715
1703
  *
1716
- * Set the vaporwave filter with the given settings.
1717
- * @param {Partial<TimescaleSettings>} [settings=DefaultFilterPreset.Vaporwave] The settings for the vaporwave filter.
1718
- * @returns {Promise<this>} The instance of the filter manager.
1704
+ * Connect a node.
1705
+ * @param {NodeIdentifier} node The node or node id to connect.
1706
+ * @returns {void}
1707
+ * @example
1708
+ * ```ts
1709
+ * const node = manager.nodeManager.get("node1");
1710
+ * if (node) node.connect();
1711
+ * ```
1719
1712
  */
1720
- setVaporwave(settings?: Partial<TimescaleSettings>): Promise<this>;
1713
+ connect(node: NodeIdentifier): void;
1721
1714
  /**
1722
1715
  *
1723
- * Set the karaoke filter with the given settings.
1724
- * @param {KaraokeSettings} [settings=DefaultFilterPreset.Karaoke] The settings for the karaoke filter.
1725
- * @returns {Promise<this>} The instance of the filter manager.
1716
+ * Get the least used node.
1717
+ * @returns {NodeStructure} The least used node.
1718
+ * @example
1719
+ * ```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
+ * }
1726
+ * ```
1726
1727
  */
1727
- setKaraoke(settings?: Partial<KaraokeSettings>): Promise<this>;
1728
+ getLeastUsed(sortType?: NodeSortTypes): NodeStructure;
1728
1729
  /**
1729
1730
  *
1730
- * Set the distortion filter with the given settings.
1731
- * @param {Partial<DistortionSettings>} [settings=DefaultFilterPreset.Distortion] The settings for the distortion filter.
1732
- * @returns {Promise<this>} The instance of the filter manager.
1731
+ * Reconnect the nodes.
1732
+ * @returns {void}
1733
+ * @example
1734
+ * ```ts
1735
+ * const node = manager.nodeManager.get("node1");
1736
+ * if (node) node.reconnectAll();
1737
+ * ```
1733
1738
  */
1734
- setDistortion(settings?: Partial<DistortionSettings>): Promise<this>;
1739
+ reconnectAll(): void;
1735
1740
  /**
1736
- * Set the timescale filter with the given settings.
1737
- * @param {Partial<TimescaleSettings>} settings The timescale settings to set.
1738
- * @returns {Promise<this>} The instance of the filter manager.
1741
+ * Disconnect the nodes.
1742
+ * @returns {void}
1743
+ * @example
1744
+ * ```ts
1745
+ * const node = manager.nodeManager.get("node1");
1746
+ * if (node) node.disconnectAll();
1747
+ * ```
1739
1748
  */
1740
- setTimescale(settings: Partial<TimescaleSettings>): Promise<this>;
1749
+ disconnectAll(): void;
1741
1750
  /**
1742
- * Convert the filter settings to a JSON object.
1743
- * @returns {FilterSettings} The filter settings as a JSON object.
1751
+ * Connect the nodes.
1752
+ * @returns {void}
1753
+ * @example
1754
+ * ```ts
1755
+ * const node = manager.nodeManager.get("node1");
1756
+ * if (node) node.connect();
1757
+ * ```
1744
1758
  */
1745
- toJSON(): FilterSettings;
1759
+ connectAll(): void;
1760
+ /**
1761
+ * Destroy the nodes.
1762
+ * @returns {void}
1763
+ * @example
1764
+ * ```ts
1765
+ * const node = manager.nodeManager.get("node1");
1766
+ * if (node) node.destroy();
1767
+ * ```
1768
+ */
1769
+ destroyAll(): void;
1746
1770
  }
1747
1771
 
1748
1772
  /**
1749
- * Type representing the customizable player storage.
1750
- */
1751
- type StorageKeys = keyof CustomizablePlayerStorage | (string & {});
1752
- /**
1753
- * Type representing the customizable player storage values.
1754
- */
1755
- type StorageValues<V extends StorageKeys = StorageKeys> = V extends keyof CustomizablePlayerStorage ? CustomizablePlayerStorage[V] : unknown;
1756
- /**
1757
- * Class representing a player storage.
1758
- * @class PlayerStorage
1773
+ * The methods for http requests
1759
1774
  */
1760
- declare class PlayerStorage<K extends StorageKeys = StorageKeys, V extends StorageValues<K> = StorageValues<K>> {
1775
+ declare enum HttpMethods {
1761
1776
  /**
1762
- *
1763
- * Get the value for a key in the storage.
1764
- * @param {K} key The key to get the value for.
1765
- * @returns {V | undefined} The value for the key, or undefined if it doesn't exist.
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}
1766
1780
  */
1767
- get<K extends StorageKeys, V extends StorageValues<K>>(key: K): V | undefined;
1781
+ Get = "GET",
1768
1782
  /**
1769
- * Set the value for a key in the storage.
1770
- * @param {K} key The key to set the value for.
1771
- * @param {V} value The value to set for the key.
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}
1772
1786
  */
1773
- set<K extends StorageKeys, V extends StorageValues<K>>(key: K, value: V): void;
1787
+ Post = "POST",
1774
1788
  /**
1775
- * Check if the storage has a key.
1776
- * @param {K} key The key to check for.
1777
- * @returns {boolean} True if the storage has the key, false otherwise.
1778
- */
1779
- has(key: K): boolean;
1780
- /**
1781
- * Delete a key from the storage.
1782
- * @param {K} key The key to delete.
1783
- * @returns {boolean} True if the key was deleted, false otherwise.
1784
- */
1785
- delete(key: K): boolean;
1786
- /**
1787
- * Get all keys in the storage.
1788
- * @returns {K[]} The keys in the storage.
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}
1789
1792
  */
1790
- keys<K extends StorageKeys[]>(): K[];
1793
+ Put = "PUT",
1791
1794
  /**
1792
- * Get all values in the storage.
1793
- * @returns {V[]} The values in the storage.
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}
1794
1798
  */
1795
- values<K extends StorageKeys[], V extends StorageValues<K[number]>>(): V[];
1799
+ Patch = "PATCH",
1796
1800
  /**
1797
- * Get all entries in the storage.
1798
- * @returns {[K, V][]} The entries in the storage.
1801
+ * The DELETE method deletes the specified resource.
1802
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/DELETE
1803
+ * @type {string}
1799
1804
  */
1800
- entries<K extends StorageKeys[], V extends StorageValues<K[number]>>(): [K, V][];
1805
+ Delete = "DELETE",
1801
1806
  /**
1802
- *
1803
- * Get all key-value pairs in the storage.
1804
- * @returns {Record<K[number], V>} An object containing all key-value pairs in the storage, excluding internal keys.
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}
1805
1810
  */
1806
- all<K extends StorageKeys[], V extends StorageValues<K[number]>>(): Record<K[number], V>;
1811
+ Head = "HEAD"
1812
+ }
1813
+ declare enum RestPathType {
1807
1814
  /**
1808
- * Clear the storage.
1815
+ * The raw path of the request.
1816
+ * @type {string}
1809
1817
  */
1810
- clear(): void;
1818
+ Raw = "/",
1811
1819
  /**
1812
- * Get the size of the storage.
1813
- * @returns {number} The number of entries in the storage.
1820
+ * The versioned path v4 of the request.
1821
+ * @type {string}
1814
1822
  */
1815
- get size(): number;
1823
+ V4 = "/v4"
1816
1824
  }
1817
-
1818
1825
  /**
1819
- * Class representing a Hoshimi player.
1820
- * @class Player
1826
+ * The status codes for the REST.
1827
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Status
1821
1828
  */
1822
- declare class Player {
1829
+ declare enum HttpStatusCodes {
1823
1830
  /**
1824
- * The data for the player.
1825
- * @type {PlayerStorage}
1826
- * @readonly
1831
+ * The request has succeeded.
1832
+ * @type {number}
1827
1833
  */
1828
- readonly data: PlayerStorage;
1834
+ OK = 200,
1829
1835
  /**
1830
- * The options for the player.
1831
- * @type {PlayerOptions}
1832
- * @readonly
1836
+ * The request has been fulfilled and resulted in a new resource being created.
1837
+ * @type {number}
1833
1838
  */
1834
- readonly options: PlayerOptions;
1839
+ Created = 201,
1835
1840
  /**
1836
- * The manager for the player.
1837
- * @type {Hoshimi}
1838
- * @readonly
1841
+ * The request has been accepted for processing, but the processing has not been completed.
1842
+ * @type {number}
1839
1843
  */
1840
- readonly manager: Hoshimi;
1844
+ Accepted = 202,
1841
1845
  /**
1842
- * The queue for the player.
1843
- * @type {Queue}
1844
- * @readonly
1846
+ * The server successfully processed the request, but is not returning any content.
1847
+ * @type {number}
1845
1848
  */
1846
- readonly queue: QueueStructure;
1849
+ NoContent = 204,
1847
1850
  /**
1848
- * The filter manager for the player.
1849
- * @type {FilterManager}
1850
- * @readonly
1851
+ * The resource has been moved permanently to a new URI.
1852
+ * @type {number}
1851
1853
  */
1852
- readonly filterManager: FilterManager;
1854
+ MovedPermanently = 301,
1853
1855
  /**
1854
- * The node for the player.
1855
- * @type {NodeStructure}
1856
+ * The requested resource has been found at a different URI.
1857
+ * @type {number}
1856
1858
  */
1857
- node: NodeStructure;
1859
+ Found = 302,
1858
1860
  /**
1859
- * Check if the player is self deafened.
1860
- * @type {boolean}
1861
+ * The resource has not been modified since the last request.
1862
+ * @type {number}
1861
1863
  */
1862
- selfDeaf: boolean;
1864
+ NotModified = 304,
1863
1865
  /**
1864
- * Check if the player is self muted.
1865
- * @type {boolean}
1866
+ * The request cannot be processed due to bad syntax.
1867
+ * @type {number}
1866
1868
  */
1867
- selfMute: boolean;
1869
+ BadRequest = 400,
1868
1870
  /**
1869
- * Loop mode of the player.
1870
- * @type {LoopMode}
1871
- * @default LoopMode.Off
1871
+ * The request requires user authentication.
1872
+ * @type {number}
1872
1873
  */
1873
- loop: LoopMode;
1874
+ Unauthorized = 401,
1874
1875
  /**
1875
- * Check if the player is playing.
1876
- * @type {boolean}
1877
- * @default false
1876
+ * The request was valid, but the server is refusing action.
1877
+ * @type {number}
1878
1878
  */
1879
- playing: boolean;
1879
+ Forbidden = 403,
1880
1880
  /**
1881
- * Check if the player is paused.
1882
- * @type {boolean}
1883
- * @default false
1881
+ * The server cannot find the requested resource.
1882
+ * @type {number}
1884
1883
  */
1885
- paused: boolean;
1884
+ NotFound = 404,
1886
1885
  /**
1887
- * Check if the player is connected.
1888
- * @type {boolean}
1889
- * @default false
1886
+ * The request method is known by the server but has been disabled and cannot be used.
1887
+ * @type {number}
1890
1888
  */
1891
- connected: boolean;
1889
+ MethodNotAllowed = 405,
1892
1890
  /**
1893
- * Volume of the player.
1891
+ * The server timed out waiting for the request.
1894
1892
  * @type {number}
1895
- * @default 100
1896
1893
  */
1897
- volume: number;
1894
+ RequestTimeout = 408,
1898
1895
  /**
1899
- * Guild ig of the player.
1900
- * @type {string}
1896
+ * The request could not be completed due to a conflict with the current state of the resource.
1897
+ * @type {number}
1901
1898
  */
1902
- guildId: string;
1899
+ Conflict = 409,
1903
1900
  /**
1904
- * Voice channel idof the player.
1905
- * @type {string | undefined}
1901
+ * The requested resource is no longer available and will not be available again.
1902
+ * @type {number}
1906
1903
  */
1907
- voiceId: string | undefined;
1904
+ Gone = 410,
1908
1905
  /**
1909
- * Text channel id of the player.
1910
- * @type {string | undefined}
1906
+ * The user has sent too many requests in a given amount of time.
1907
+ * @type {number}
1911
1908
  */
1912
- textId: string | undefined;
1909
+ TooManyRequests = 429,
1913
1910
  /**
1914
- * The ping of the player.
1911
+ * A generic error message, given when no more specific message is suitable.
1915
1912
  * @type {number}
1916
1913
  */
1917
- ping: number;
1914
+ InternalServerError = 500,
1918
1915
  /**
1919
- * The timestamp when the player was created.
1916
+ * The server does not recognize the request method or lacks the ability to fulfill it.
1920
1917
  * @type {number}
1921
1918
  */
1922
- createdTimestamp: number;
1919
+ NotImplemented = 501,
1923
1920
  /**
1924
- * The last position received from Lavalink.
1921
+ * The server was acting as a gateway and received an invalid response.
1925
1922
  * @type {number}
1926
1923
  */
1927
- lastPosition: number;
1924
+ BadGateway = 502,
1928
1925
  /**
1929
- * The timestamp when the last position change update happened.
1930
- * @type {number | null}
1926
+ * The server is currently unavailable (overloaded or down).
1927
+ * @type {number}
1931
1928
  */
1932
- lastPositionUpdate: number | null;
1929
+ ServiceUnavailable = 503,
1933
1930
  /**
1934
- * The current calculated position of the player.
1931
+ * The server did not receive a timely response from an upstream server.
1935
1932
  * @type {number}
1936
- * @readonly
1937
1933
  */
1938
- get position(): number;
1934
+ GatewayTimeout = 504
1935
+ }
1936
+ /**
1937
+ * The options for the REST.
1938
+ */
1939
+ interface RestOptions {
1939
1940
  /**
1940
- * The voice connection details.
1941
- * @type {PlayerVoice}
1941
+ * The endpoint for the REST.
1942
+ * @type {string}
1942
1943
  */
1943
- voice: Nullable<LavalinkPlayerVoice>;
1944
+ endpoint: `/${string}`;
1944
1945
  /**
1945
- *
1946
- * Create a new player.
1947
- * @param {Hoshimi} manager The manager for the player.
1948
- * @param {PlayOptions} options The options for the player.
1949
- * @example
1950
- * ```ts
1951
- * const player = new Player(manager, {
1952
- * guildId: "guildId",
1953
- * voiceId: "voiceId",
1954
- * textId: "textId",
1955
- * selfDeaf: true,
1956
- * selfMute: false,
1957
- * volume: 100,
1958
- * });
1959
- *
1960
- * console.log(player.guildId); // guildId
1961
- * console.log(player.voiceId); // voiceId
1962
- * console.log(player.textId); // textId
1946
+ * The method for the REST.
1947
+ * @type {HttpMethods}
1963
1948
  */
1964
- constructor(manager: Hoshimi, options: PlayerOptions);
1949
+ method?: HttpMethods;
1965
1950
  /**
1966
- * The lyrics methods for the player.
1967
- * @type {LyricsMethods}
1968
- * @readonly
1951
+ * The headers for the REST.
1952
+ * @type {Record<string, string>}
1969
1953
  */
1970
- readonly lyrics: LyricsMethods;
1954
+ headers?: Record<string, string>;
1971
1955
  /**
1972
- *
1973
- * Search for a track or playlist.
1974
- * @param {SearchOptions} options The options for the search.
1975
- * @returns {Promise<QueryResult>} The search result.
1976
- * @example
1977
- * ```ts
1978
- * const player = manager.getPlayer("guildId");
1979
- * const result = await player.search({
1980
- * query: "track name",
1981
- * engine: SearchEngine.Youtube,
1982
- * requester: {},
1983
- * });
1984
- *
1985
- * console.log(result) // the search result
1986
- * ```
1956
+ * The body for the REST.
1957
+ * @type {Record<string, unknown> | string | undefined}
1987
1958
  */
1988
- search(options: SearchOptions): Promise<QueryResult>;
1959
+ body?: Record<string, unknown> | string;
1989
1960
  /**
1990
- *
1991
- * Play the next track in the queue.
1992
- * @param {number} [to=0] The amount of tracks to skip.
1993
- * @param {boolean} [throwError=true] Whether to throw an error if there are no tracks to skip.
1994
- * @returns {Promise<void>}
1995
- * @throws {PlayerError} If there are no tracks to skip.
1996
- * @example
1997
- * ```ts
1998
- * const player = manager.getPlayer("guildId");
1999
- * player.skip(2); // skip 2 tracks
2000
- * player.skip(); // skip 1 track
2001
- * ```
1961
+ * The query parameters for the REST.
1962
+ * @type {Record<string, string>}
2002
1963
  */
2003
- skip(to?: number, throwError?: boolean): Promise<void>;
1964
+ params?: Record<string, string>;
2004
1965
  /**
2005
- *
2006
- * Seek to a specific position in the current track.
2007
- * @param {number} position The position to seek to in milliseconds.
2008
- * @returns {Promise<void>}
2009
- * @throws {PlayerError} If the position is invalid.
2010
- * @example
2011
- * ```ts
2012
- * const player = manager.getPlayer("guildId");
2013
- * player.seek(30000); // seek to 30 seconds
2014
- * ```
1966
+ * The path type for the REST.
1967
+ * @type {RestPathType}
2015
1968
  */
2016
- seek(position: number): Promise<void>;
1969
+ pathType?: RestPathType;
1970
+ }
1971
+ /**
1972
+ * The fetch options for the request.
1973
+ */
1974
+ interface FetchOptions extends Omit<RestOptions, "endpoint" | "body"> {
2017
1975
  /**
2018
- *
2019
- * Disconnect the player from the voice channel.
2020
- * @returns {Promise<this>} The player instance.
2021
- * @example
2022
- * ```ts
2023
- * const player = manager.getPlayer("guildId");
2024
- * player.disconnect();
2025
- * ```
1976
+ * The signal for the request.
2026
1977
  */
2027
- disconnect(): Promise<this>;
1978
+ signal: AbortSignal;
2028
1979
  /**
2029
- *
2030
- * Destroy and disconnect the player.
2031
- * @param {DestroyReasons} [reason] The reason for destroying the player.
2032
- * @returns {Promise<void>}
2033
- * @example
2034
- * ```ts
2035
- * const player = manager.getPlayer("guildId");
2036
- * player.destroy(DestroyReasons.Stop);
2037
- * ```
1980
+ * The stringified body for the request.
2038
1981
  */
2039
- destroy(reason?: DestroyReasons): Promise<boolean>;
1982
+ body?: string;
1983
+ }
1984
+ /**
1985
+ * The error for the REST.
1986
+ */
1987
+ interface LavalinkRestError {
2040
1988
  /**
2041
- *
2042
- * Play a track in the player.
2043
- * @param {Partial<PlayOptions>} [options] The options to play the track.
2044
- * @returns {Promise<void>}
2045
- * @throws {PlayerError} If there are no tracks to play.
2046
- * @example
2047
- * ```ts
2048
- * const player = manager.getPlayer("guildId");
2049
- *
2050
- * player.play({
2051
- * track: track,
2052
- * noReplace: true,
2053
- * });
2054
- * ```
1989
+ * The timestamp for the REST.
1990
+ * @type {number}
2055
1991
  */
2056
- play(options?: Partial<PlayOptions>): Promise<void>;
1992
+ timestamp: number;
2057
1993
  /**
2058
- * Connect the player to the voice channel.
2059
- * @returns {Promise<this>} The player instance.
2060
- * @example
2061
- * ```ts
2062
- * const player = manager.getPlayer("guildId");
2063
- * player.connect();
2064
- * ```
1994
+ * The status for the REST.
1995
+ * @type {number}
2065
1996
  */
2066
- connect(): Promise<this>;
1997
+ status: number;
2067
1998
  /**
2068
- *
2069
- * Stop the player from playing.
2070
- * @param {boolean} [destroy=true] Whether to destroy the player or not.
2071
- * @returns {Promise<void>}
2072
- * @example
2073
- * ```ts
2074
- * const player = manager.getPlayer("guildId");
2075
- * player.stop();
2076
- * ```
1999
+ * The error for the REST.
2000
+ * @type {string}
2077
2001
  */
2078
- stop(destroy?: boolean): Promise<void>;
2002
+ error: string;
2079
2003
  /**
2080
- *
2081
- * Pause or resume the player.
2082
- * @returns {Promise<void>}
2083
- * @example
2084
- * ```ts
2085
- * const player = manager.getPlayer("guildId");
2086
- * player.setPaused();
2087
- * ```
2004
+ * The trace for the REST.
2005
+ * @type {string}
2088
2006
  */
2089
- setPaused(paused?: boolean): Promise<boolean>;
2007
+ trace?: string;
2090
2008
  /**
2091
- *
2092
- * Set the volume of the player.
2093
- * @param {number} volume The volume to set.
2094
- * @returns {Promise<void>}
2095
- * @example
2096
- * ```ts
2097
- * const player = manager.getPlayer("guildId");
2098
- * player.setVolume(50); // set the volume to 50%
2099
- * ```
2009
+ * The message for the REST.
2010
+ * @type {string}
2100
2011
  */
2101
- setVolume(volume: number): Promise<void>;
2012
+ message: string;
2102
2013
  /**
2103
- *
2104
- * Set the loop mode of the player.
2105
- * @param {LoopMode} mode The loop mode to set.
2106
- * @throws {PlayerError} If the loop mode is invalid.
2107
- * @example
2108
- * ```ts
2109
- * const player = manager.getPlayer("guildId");
2110
- * player.setLoop(LoopMode.Track);
2111
- * ```
2014
+ * The path for the REST.
2015
+ * @type {string}
2112
2016
  */
2113
- setLoop(mode: LoopMode): this;
2017
+ path: string;
2018
+ }
2019
+ /**
2020
+ * The player response from the Lavalink REST API.
2021
+ */
2022
+ interface LavalinkPlayer {
2114
2023
  /**
2115
- * Set the voice of the player.
2116
- * @param {Partial<VoiceChannelUpdate>} voice The voice state to set.
2117
- * @returns {Promise<void>}
2118
- * @example
2119
- * ```ts
2120
- * const player = manager.getPlayer("guildId");
2121
- * player.setVoice({ voiceId: "newVoiceId" });
2122
- * ```
2024
+ * The guild ID associated with the player.
2025
+ * @type {string}
2123
2026
  */
2124
- setVoice(voice: Partial<VoiceChannelUpdate>): Promise<void>;
2027
+ guildId: string;
2125
2028
  /**
2126
- *
2127
- * Change the node the player is connected to.
2128
- * @param {NodeIdentifier} node The node to change to.
2129
- * @returns {Promise<void>} A promise that resolves when the node has been changed.
2130
- * @throws {PlayerError} If the target node is not found, not connected, or missing source managers.
2131
- * @example
2132
- * ```ts
2133
- * const player = manager.getPlayer("guildId");
2134
- * player.move("newNodeId");
2135
- * ```
2029
+ * The track currently being played.
2030
+ * @type {LavalinkTrack}
2136
2031
  */
2137
- move(node: NodeIdentifier): Promise<void>;
2032
+ track?: LavalinkTrack;
2138
2033
  /**
2139
- * Update the player with new data.
2140
- * @param {NonGuildUpdatePlayerInfo} data The data to update the player with.
2141
- * @returns {Promise<LavalinkPlayer | null>} The updated player data.
2034
+ * The volume of the player.
2035
+ * @type {number}
2142
2036
  */
2143
- updatePlayer(data: NonGuildUpdatePlayerInfo): Promise<LavalinkPlayer | null>;
2037
+ volume: number;
2144
2038
  /**
2145
- *
2146
- * Return the player as a json object.
2147
- * @returns {PlayerJson}
2148
- * @example
2149
- * ```ts
2150
- * const player = manager.getPlayer("guildId");
2151
- * const json = player.toJSON();
2152
- * console.log(json); // the player as a json object
2153
- * ```
2039
+ * Whether the player is paused.
2040
+ * @type {boolean}
2154
2041
  */
2155
- toJSON(): PlayerJson;
2156
- }
2157
- /**
2158
- * Type representing the update player information without guildId.
2159
- */
2160
- type NonGuildUpdatePlayerInfo = Omit<UpdatePlayerInfo, "guildId">;
2161
- /**
2162
- * Interface representing the customizable player storage.
2163
- */
2164
- interface CustomizablePlayerStorage {
2042
+ paused: boolean;
2043
+ /**
2044
+ * The voice connection details.
2045
+ * @type {LavalinkPlayerVoice}
2046
+ */
2047
+ voice: LavalinkPlayerVoice;
2048
+ /**
2049
+ * The filter options applied to the player.
2050
+ * @type {FilterSettings}
2051
+ */
2052
+ filters: FilterSettings;
2053
+ /**
2054
+ * The state of the player.
2055
+ * @type {LavalinkPlayerState}
2056
+ */
2057
+ state: LavalinkPlayerState;
2165
2058
  }
2166
-
2167
2059
  /**
2168
- * Class representing a storage manager.
2169
- * @abstract
2170
- * @class StorageManager
2171
- * @example
2172
- * ```ts
2173
- * class MyStorageManager extends StorageManager {};
2174
- *
2175
- * const storage = new MyStorageManager();
2176
- * storage.set("key", "value");
2177
- *
2178
- * const value = await storage.get("key");
2179
- * console.log(value); // "value"
2180
- * ```
2060
+ * The state of the player.
2181
2061
  */
2182
- declare abstract class StorageAdapter<T extends QueueJson = QueueJson> {
2062
+ interface LavalinkPlayerState {
2183
2063
  /**
2184
- *
2185
- * Get the value using the key.
2186
- * @param {string} key The key to get the value from.
2187
- * @returns {Awaitable<T | undefined>} The value of the key.
2188
- * @example
2189
- * ```ts
2190
- * const value = await storage.get("key");
2191
- * console.log(value); // "value"
2192
- * ```
2064
+ * The time since the connection was established.
2065
+ * @type {number}
2193
2066
  */
2194
- abstract get(key: string): Awaitable<T | undefined>;
2067
+ time: number;
2195
2068
  /**
2196
- *
2197
- * Set the value using the key.
2198
- * @param {string} key The key to set the value to.
2199
- * @param {unknown} value The value to set.
2200
- * @returns {Awaitable<void>} Did you know this can be async?
2201
- * @example
2202
- * ```ts
2203
- * await storage.set("key", "value");
2204
- * ```
2069
+ * The position of the current track in milliseconds.
2070
+ * @type {number}
2205
2071
  */
2206
- abstract set(key: string, value: T): Awaitable<void>;
2072
+ position: number;
2207
2073
  /**
2208
- *
2209
- * Delete the value using the key.
2210
- * @param {string} key The key to delete the value from.
2211
- * @returns {Awaitable<boolean>} Returns true if the key was deleted.
2212
- * @example
2213
- * ```ts
2214
- * const success = await storage.delete("key");
2215
- * console.log(success); // true
2216
- * ```
2074
+ * Whether the player is connected to the voice channel.
2075
+ * @type {boolean}
2217
2076
  */
2218
- abstract delete(key: string): Awaitable<boolean>;
2077
+ connected: boolean;
2219
2078
  /**
2220
- * Clear the storage.
2221
- * @returns {Awaitable<void>} Scary, right?
2222
- * @example
2223
- * ```ts
2224
- * await storage.clear();
2225
- * ```
2079
+ * The ping to the voice server in milliseconds.
2080
+ * @type {number}
2226
2081
  */
2227
- abstract clear(): Awaitable<void>;
2082
+ ping: number;
2083
+ }
2084
+ /**
2085
+ * The options to update the player.
2086
+ */
2087
+ interface UpdatePlayerInfo {
2228
2088
  /**
2229
- * Check if the storage has the key.
2230
- * @param {string} key The key to check.
2231
- * @returns {Awaitable<boolean>} Return true if the key exists.
2232
- * @example
2233
- * ```ts
2234
- * const exists = await storage.has("key");
2235
- * console.log(exists); // true
2236
- * ```
2089
+ * The guild id associated with the player.
2090
+ * @type {string}
2237
2091
  */
2238
- abstract has(key: string): Awaitable<boolean>;
2092
+ guildId: string;
2093
+ /**
2094
+ * The options to update the player.
2095
+ * @type {LavalinkPlayOptions}
2096
+ */
2097
+ playerOptions: LavalinkPlayOptions;
2098
+ /**
2099
+ * Whether to replace the current track.
2100
+ * @type {boolean | undefined}
2101
+ * @default false
2102
+ */
2103
+ noReplace?: boolean;
2104
+ }
2105
+ /**
2106
+ * The updated session of the current session.
2107
+ */
2108
+ interface LavalinkSession {
2109
+ /**
2110
+ * Whather the session is resuming.
2111
+ * @type {boolean}
2112
+ */
2113
+ resuming: boolean;
2114
+ /**
2115
+ * The timeout for the session.
2116
+ * @type {number}
2117
+ */
2118
+ timeout: number;
2119
+ }
2120
+ /**
2121
+ * The rest options.
2122
+ */
2123
+ interface HoshimiRestOptions {
2124
+ /**
2125
+ * The amount of time to wait for the player to resume. (in milliseconds)
2126
+ * @type {number}
2127
+ * @default 10000
2128
+ */
2129
+ resumeTimeout?: number;
2130
+ }
2131
+ /**
2132
+ * The methods for decoding base64 encoded tracks.
2133
+ */
2134
+ interface DecodeMethods {
2239
2135
  /**
2240
2136
  *
2241
- * Parse the value.
2242
- * @param {unknown} value The value to parse.
2243
- * @returns {T} The parsed value.
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.
2244
2141
  * @example
2245
2142
  * ```ts
2246
- * const parsed = await storage.parse<{ key: string }>("{'key':'value'}");
2247
- * console.log(parsed); // { key: "value" }
2143
+ * const node = player.node;
2144
+ * const track = await node.decode.single("base64EncodedTrack");
2145
+ * console.log(track.info.title); // Track Title
2248
2146
  * ```
2249
2147
  */
2250
- abstract parse(value: unknown): Awaitable<T>;
2148
+ single(track: string, requester: TrackRequester): Promise<Track>;
2251
2149
  /**
2252
- *
2253
- * Stringify the value.
2254
- * @param {unknown} value The value to stringify.
2255
- * @returns {R} The stringified value.
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.
2256
2154
  * @example
2257
2155
  * ```ts
2258
- * const stringified = await storage.stringify({ key: "value" });
2259
- * console.log(stringified); // "{'key':'value'}"
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
2260
2160
  * ```
2261
2161
  */
2262
- abstract stringify<R = string>(value: unknown): Awaitable<R>;
2162
+ multiple(tracks: string[], requester: TrackRequester): Promise<Track[]>;
2263
2163
  }
2164
+ /**
2165
+ * The session of the node.
2166
+ */
2167
+ type NullableLavalinkSession = PickNullable<LavalinkSession, "timeout">;
2264
2168
 
2265
2169
  /**
2266
- * The queue options.
2170
+ * Class representing the REST for the node.
2171
+ * @class Rest
2267
2172
  */
2268
- interface HoshimiQueueOptions {
2173
+ declare class Rest {
2269
2174
  /**
2270
- * The maximum amount of tracks that can be saved in the queue.
2175
+ * The URL for the REST.
2176
+ * @type {string}
2177
+ */
2178
+ readonly url: string;
2179
+ /**
2180
+ * The version for the REST.
2181
+ * @type {string}
2182
+ */
2183
+ readonly version: string;
2184
+ /**
2185
+ * The timeout for the REST.
2271
2186
  * @type {number}
2272
- * @default 25
2273
2187
  */
2274
- maxPreviousTracks?: number;
2188
+ readonly restTimeout: number;
2275
2189
  /**
2276
- *
2277
- * The function to use for autoplay.
2278
- * @param {Player} player The player.
2279
- * @param {HoshimiTrack | null} lastTrack The last track played.
2190
+ * The user agent for the REST.
2191
+ * @type {UserAgent}
2280
2192
  */
2281
- autoplayFn?(player: PlayerStructure, lastTrack: HoshimiTrack | null): Awaitable<void>;
2193
+ readonly userAgent: UserAgent;
2282
2194
  /**
2283
- * Enable the auto play for the queue. (By default, only supports `youtube` and `spotify`, add more with your own function)
2284
- * @type {boolean}
2285
- * @default false
2195
+ * The node for the REST.
2196
+ * @type {Node}
2286
2197
  */
2287
- autoPlay?: boolean;
2198
+ readonly node: NodeStructure;
2288
2199
  /**
2289
- * The storage manager to use for the queue.
2290
- * @type {StorageAdapter}
2291
- * @default {MemoryAdapter}
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
+ * ```
2292
2215
  */
2293
- storage?: StorageAdapter;
2294
- }
2295
- /**
2296
- * The queue json.
2297
- */
2298
- interface QueueJson {
2216
+ constructor(node: NodeStructure);
2299
2217
  /**
2300
- * The tracks of the queue.
2301
- * @type {HoshimiTrack[]}
2218
+ * The REST URL to make requests.
2219
+ * @type {string}
2302
2220
  */
2303
- tracks: HoshimiTrack[];
2221
+ get restUrl(): string;
2304
2222
  /**
2305
- * The previous tracks of the queue.
2306
- * @type {Track[]}
2223
+ * The session id of the node.
2224
+ * @type {string}
2307
2225
  */
2308
- history: Track[];
2226
+ get sessionId(): string;
2309
2227
  /**
2310
- * The current track of the queue.
2311
- * @type {Track | null}
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.
2312
2232
  */
2313
- current: Track | null;
2314
- }
2315
-
2316
- /**
2317
- * Class representing the queue utils.
2318
- * @class QueueUtils
2319
- */
2320
- declare class QueueUtils {
2233
+ request<T>(options: RestOptions): Promise<T | null>;
2321
2234
  /**
2322
2235
  *
2323
- * Constructor of the queue utils.
2324
- * @param {QueueStructure} queue The queue instance.
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
+ * ```
2325
2252
  */
2326
- constructor(queue: QueueStructure);
2253
+ updatePlayer(data: Partial<UpdatePlayerInfo>): Promise<LavalinkPlayer | null>;
2327
2254
  /**
2328
2255
  *
2329
- * Save the queue.
2330
- * @returns {Awaitable<void>}
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.
2331
2259
  * @example
2332
2260
  * ```ts
2333
- * await player.queue.utils.save();
2261
+ * const player = await node.rest.stopPlayer("guildId");
2262
+ * if (player) console.log(player); // The lavalink player
2334
2263
  * ```
2335
2264
  */
2336
- save(): Awaitable<void>;
2265
+ stopPlayer(guildId: string): Promise<LavalinkPlayer | null>;
2337
2266
  /**
2338
2267
  *
2339
- * Destroy the queue.
2340
- * @returns {Promise<void>}
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.
2341
2271
  * @example
2342
2272
  * ```ts
2343
- * await player.queue.utils.destroy();
2273
+ * await node.rest.destroyPlayer("guildId");
2344
2274
  * ```
2275
+ * @example
2345
2276
  */
2346
- destroy(): Awaitable<boolean>;
2277
+ destroyPlayer(guildId: string): Promise<void>;
2347
2278
  /**
2348
2279
  *
2349
- * Sync the queue.
2350
- * @returns {Awaitable<void>}
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.
2351
2284
  * @example
2352
2285
  * ```ts
2353
- * await player.queue.utils.sync();
2286
+ * const session = await node.rest.updateSession(true, 10000);
2287
+ * if (session) console.log(session); // The lavalink session data
2354
2288
  * ```
2355
2289
  */
2356
- sync(override?: boolean, syncCurrent?: boolean): Promise<void>;
2290
+ updateSession(resuming: boolean, timeout?: number | null): Promise<LavalinkSession | null>;
2357
2291
  }
2358
2292
 
2359
2293
  /**
2360
- * Class representing a queue.
2361
- * @class Queue
2294
+ * Class representing the DSPX Plugin filters for a player.
2295
+ * @class DSPXPluginFilter
2362
2296
  */
2363
- declare class Queue {
2297
+ declare class DSPXPluginFilter {
2364
2298
  /**
2365
- * Tracks of the queue.
2366
- * @type {HoshimiTrack[]}
2299
+ * The filter manager instance.
2300
+ * @type {FilterManagerStructure}
2301
+ * @readonly
2367
2302
  */
2368
- tracks: HoshimiTrack[];
2303
+ readonly manager: FilterManagerStructure;
2369
2304
  /**
2370
- * Previous tracks of the queue.
2371
- * @type {Track[]}
2305
+ * Create a new DSPXPluginFilter instance.
2306
+ * @param {FilterManagerStructure} manager The filter manager instance.
2372
2307
  */
2373
- history: Track[];
2308
+ constructor(manager: FilterManagerStructure);
2374
2309
  /**
2375
- * Current track of the queue.
2376
- * @type {Track | null}
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.
2377
2314
  */
2378
- current: Track | null;
2315
+ setLowPass(settings?: Partial<FilterPluginPassSettings>): Promise<this>;
2379
2316
  /**
2380
- * The player instance.
2381
- * @type {PlayerStructure}
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.
2382
2321
  */
2383
- readonly player: PlayerStructure;
2322
+ setHighPass(settings?: Partial<FilterPluginPassSettings>): Promise<this>;
2384
2323
  /**
2385
- * The queue utils instance.
2386
- * @type {QueueUtils}
2387
- * @readonly
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.
2388
2328
  */
2389
- readonly utils: QueueUtils;
2329
+ setNormalization(settings?: Partial<NormalizationSettings>): Promise<this>;
2390
2330
  /**
2391
2331
  *
2392
- * Constructor of the queue.
2393
- * @param {PlayerStructure} player Player instance.
2394
- * @example
2395
- * ```ts
2396
- * const player = new Player();
2397
- * const queue = new Queue(player);
2398
- *
2399
- * console.log(queue.size); // 0
2400
- * queue.add(track);
2401
- * console.log(queue.size); // 1
2402
- * ```
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.
2403
2335
  */
2404
- constructor(player: PlayerStructure);
2336
+ setEcho(settings?: Partial<EchoSettings>): Promise<this>;
2337
+ }
2338
+
2339
+ type NonLengthEchoSettings = Omit$1<EchoSettings, "echoLength">;
2340
+ /**
2341
+ * Class representing Lavalink plugin filters.
2342
+ * @class LavalinkPluginFilter
2343
+ */
2344
+ declare class LavalinkPluginFilter {
2405
2345
  /**
2406
- * Get the track size of the queue.
2407
- * @type {number}
2408
- * @returns {number} The track size of the queue.
2346
+ * The filter manager instance.
2347
+ * @type {FilterManagerStructure}
2348
+ * @private
2409
2349
  * @readonly
2410
- * @example
2411
- * ```ts
2412
- * const queue = player.queue;
2413
- *
2414
- * console.log(queue.size); // 0
2415
- * queue.add(track);
2416
- *
2417
- * console.log(queue.size); // 1
2418
- * queue.add([track1, track2]);
2350
+ */
2351
+ private readonly manager;
2352
+ /**
2353
+ * Creates an instance of LavalinkPluginFilter.
2354
+ * @param {FilterManagerStructure} filters - The filter manager instance.
2355
+ */
2356
+ constructor(filters: FilterManagerStructure);
2357
+ /**
2419
2358
  *
2420
- * console.log(queue.size); // 3
2421
- * queue.shift();
2422
- * console.log(queue.size); // 2
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.
2362
+ */
2363
+ setEcho(settings?: Partial<NonLengthEchoSettings>): Promise<this>;
2364
+ /**
2423
2365
  *
2424
- * queue.clear();
2425
- * console.log(queue.size); // 0
2426
- * ```
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.
2427
2369
  */
2428
- get size(): number;
2370
+ setReverb(settings?: Partial<LavalinkFilterPluginReverbSettings>): Promise<this>;
2371
+ }
2372
+
2373
+ /**
2374
+ * Class representing a filter manager for a player.
2375
+ * @class FilterManager
2376
+ */
2377
+ declare class FilterManager {
2429
2378
  /**
2430
- * Get the total track size of the queue (Includes the current track).
2431
- * @type {number}
2432
- * @returns {number} The total track size of the queue.
2379
+ * The player this filter manager belongs to.
2380
+ * @type {PlayerStructure}
2381
+ * @public
2433
2382
  * @readonly
2434
- * @example
2435
- * ```ts
2436
- * const queue = player.queue;
2437
- *
2438
- * console.log(queue.totalSize); // 0
2439
- * queue.add(track);
2440
- *
2441
- * console.log(queue.totalSize); // 1
2442
- * queue.add([track1, track2]);
2443
- *
2444
- * console.log(queue.totalSize); // 3
2445
- * queue.shift();
2446
- * console.log(queue.totalSize); // 2
2447
- *
2448
- * queue.clear();
2449
- * console.log(queue.totalSize); // 0
2450
- * ```
2451
2383
  */
2452
- get totalSize(): number;
2384
+ readonly player: PlayerStructure;
2453
2385
  /**
2454
- *
2455
- * Check if the queue is empty.
2456
- * @type {boolean}
2457
- * @returns {boolean} True if the queue is empty.
2386
+ * The bands applied to the player.
2387
+ * @type {EQBandSettings[]}
2458
2388
  * @readonly
2459
- * @example
2460
- * ```ts
2461
- * const queue = player.queue;
2462
- *
2463
- * console.log(queue.isEmpty()); // true
2464
- * queue.add(track);
2465
- *
2466
- * console.log(queue.isEmpty()); // false
2467
- * queue.clear();
2468
- *
2469
- * console.log(queue.isEmpty()); // true
2470
- * ```
2471
2389
  */
2472
- isEmpty(): boolean;
2390
+ readonly bands: EQBandSettings[];
2473
2391
  /**
2474
- *
2475
- * Get the previous track of the queue.
2476
- * @param {boolean} [remove=false] Whether to remove the track from the previous queue.
2477
- * @returns {Track | null} The previous track of the queue.
2478
- * @example
2479
- * ```ts
2480
- * const queue = player.queue;
2481
- *
2482
- * console.log(queue.previous()); // null
2483
- * queue.add(track);
2484
- * queue.add(track2);
2485
- *
2486
- * console.log(queue.previous()); // track
2487
- * console.log(queue.previous(true)); // track and remove it from the previous tracks
2488
- * ```
2392
+ * The current filter settings applied to the player.
2393
+ * @type {FilterSettings}
2394
+ * @public
2489
2395
  */
2490
- previous(remove?: boolean): Track | null;
2396
+ data: FilterSettings;
2491
2397
  /**
2492
- *
2493
- * Add a track or tracks to the queue.
2494
- * @param {Track | Track[]} track The track or tracks to add.
2495
- * @param {number} [position] The position to add the track or tracks.
2496
- * @returns {this} The queue instance.
2497
- * @example
2498
- * ```ts
2499
- * const queue = player.queue;
2500
- *
2501
- * console.log(queue.size); // 0
2502
- *
2503
- * queue.add(track);
2504
- * console.log(queue.size); // 1
2505
- *
2506
- * queue.add([track1, track2]);
2507
- * console.log(queue.size); // 3
2508
- *
2509
- * queue.add(track3, 1);
2510
- * console.log(queue.size); // 4
2511
- * console.log(queue.tracks); // [track1, track3, track2, track]
2512
- * ```
2398
+ * The enabled filters for the player.
2399
+ * @type {EnabledPlayerFilters}
2513
2400
  */
2514
- add(track: HoshimiTrack | HoshimiTrack[], position?: number): this;
2401
+ filters: EnabledPlayerFilters;
2515
2402
  /**
2516
- *
2517
- * Get the first track of the queue.
2518
- * @returns {HoshimiTrack | null} The first track of the queue.
2519
- * @example
2520
- * ```ts
2521
- * const queue = player.queue;
2522
- *
2523
- * console.log(queue.shift()); // null
2524
- * queue.add(track);
2525
- *
2526
- * console.log(queue.shift()); // track
2527
- * queue.add(track2);
2528
- * ```
2403
+ * The lavalink plugin filters manager.
2404
+ * @type {LavalinkPluginFilter}
2405
+ * @readonly
2529
2406
  */
2530
- shift(): HoshimiTrack | null;
2407
+ readonly plugin: LavalinkPluginFilter;
2531
2408
  /**
2532
- *
2533
- * Add tracks to the beginning of the queue.
2534
- * @param {Track[]} tracks The tracks to add.
2535
- * @returns {this} The queue instance.
2536
- * @example
2537
- * ```ts
2538
- * const queue = player.queue;
2539
- *
2540
- * console.log(queue.size); // 0
2541
- * queue.unshift(track);
2542
- *
2543
- * console.log(queue.size); // 1
2544
- * queue.unshift([track1, track2]);
2545
- *
2546
- * console.log(queue.size); // 3
2547
- * console.log(queue.tracks); // [track1, track2, track]
2548
- * ```
2409
+ * The DSPX plugin filters manager.
2410
+ * @type {DSPXPluginFilter}
2411
+ * @readonly
2549
2412
  */
2550
- unshift(...tracks: Track[]): this;
2413
+ readonly dspx: DSPXPluginFilter;
2551
2414
  /**
2552
2415
  *
2553
- * Shuffle the queue.
2554
- * @returns {this} The queue instance.
2555
- * @example
2556
- * ```ts
2557
- * const queue = player.queue;
2558
- *
2559
- * console.log(queue.size); // 0
2560
- * queue.add(track);
2561
- * queue.add([track1, track2]);
2562
- *
2563
- * console.log(queue.size); // 3
2564
- * console.log(queue.tracks); // [track, track1, track2]
2565
- *
2566
- * queue.shuffle();
2567
- * console.log(queue.tracks); // [track2, track, track1]
2568
- * ```
2416
+ * Creates a new filter manager.
2417
+ * @param {PlayerStructure} player The player this filter manager belongs to.
2569
2418
  */
2570
- shuffle(): this;
2419
+ constructor(player: PlayerStructure);
2571
2420
  /**
2572
- *
2573
- * Clear the queue.
2574
- * @returns {this} The queue instance.
2575
- * @example
2576
- * ```ts
2577
- * const queue = player.queue;
2578
- *
2579
- * console.log(queue.size); // 0
2580
- * queue.add(track);
2581
- * queue.add([track1, track2]);
2582
- *
2583
- * console.log(queue.size); // 3
2584
- * queue.clear();
2585
- * console.log(queue.size); // 0
2586
- * ```
2421
+ * Resets all filters to their default values.
2422
+ * @returns {Promise<this>} A promise that resolves to the instance of the filter manager.
2587
2423
  */
2588
- clear(): this;
2424
+ reset(): Promise<this>;
2589
2425
  /**
2590
2426
  *
2591
- * Move a track to a specific position in the queue.
2592
- * @param {Track} track The track to move.
2593
- * @param {number} to The position to move.
2594
- * @returns {this} The queue instance.
2427
+ * Applies the current filters to the player.
2428
+ * @returns {Promise<this>} A promise that resolves to the instance of the filter manager.
2595
2429
  */
2596
- move(track: Track, to: number): this;
2430
+ apply(): Promise<this>;
2597
2431
  /**
2598
- *
2599
- * Delete tracks from the queue.
2600
- * @param {number} start The start index.
2601
- * @param {number} deleteCount The number of tracks to delete.
2602
- * @param {Track | Track[]} [tracks] The tracks to add.
2603
- * @returns {this} The queue instance.
2432
+ * Checks if the current filters are active.
2433
+ * @param {TimescaleSettings} timescale The timescale settings to check against.
2434
+ * @returns {void} Nothing!
2604
2435
  */
2605
- splice(start: number, deleteCount: number, tracks?: HoshimiTrack | HoshimiTrack[]): this;
2436
+ check(timescale?: TimescaleSettings): void;
2606
2437
  /**
2607
2438
  *
2608
- * Convert the queue to a JSON object.
2609
- * @returns {QueueJson} The queue JSON object.
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.
2610
2442
  */
2611
- toJSON(): QueueJson;
2612
- }
2613
-
2614
- /**
2615
- * The structure for the Player class.
2616
- */
2617
- type PlayerStructure = InferCustomStructure<Player, "Player">;
2618
- /**
2619
- * The structure for the Rest class.
2620
- */
2621
- type RestStructure = InferCustomStructure<Rest, "Rest">;
2622
- /**
2623
- * The structure for the Node class.
2624
- */
2625
- type NodeStructure = InferCustomStructure<Node, "Node">;
2626
- /**
2627
- * The structure for the Queue class.
2628
- */
2629
- type QueueStructure = InferCustomStructure<Queue, "Queue">;
2630
- /**
2631
- * The structure for the LyricsManager class.
2632
- */
2633
- type LyricsManagerStructure = InferCustomStructure<LyricsManager, "LyricsManager">;
2634
- /**
2635
- * The structure for the NodeManager class.
2636
- */
2637
- type NodeManagerStructure = InferCustomStructure<NodeManager, "NodeManager">;
2638
- /**
2639
- * The structure for the FilterManager class.
2640
- */
2641
- type FilterManagerStructure = InferCustomStructure<FilterManager, "FilterManager">;
2642
- /**
2643
- * The structures of the Hoshimi classes.
2644
- */
2645
- declare const Structures: {
2646
- Player(manager: Hoshimi, options: PlayerOptions): PlayerStructure;
2647
- Rest(node: Node): RestStructure;
2648
- Node(nodeManager: NodeManager, options: NodeOptions): NodeStructure;
2649
- Queue(player: Player): QueueStructure;
2650
- LyricsManager(node: Node): LyricsManagerStructure;
2651
- NodeManager(manager: Hoshimi): NodeManagerStructure;
2652
- FilterManager(player: Player): FilterManagerStructure;
2653
- };
2654
- /**
2655
- * Infers the custom structure for a given class.
2656
- */
2657
- type InferCustomStructure<T, N extends string> = CustomizableStructures extends Record<N, infer P> ? P : T;
2658
-
2659
- /**
2660
- * Class representing a Hoshimi track.
2661
- * @class Track
2662
- * @implements {LavalinkTrack}
2663
- */
2664
- declare class Track implements LavalinkTrack {
2443
+ has(filter: FilterType): boolean;
2665
2444
  /**
2666
- * The base64 encoded track.
2667
- * @type {string}
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.
2668
2449
  */
2669
- readonly encoded: string;
2450
+ setVolume(volume: number): Promise<this>;
2670
2451
  /**
2671
- * The track info.
2672
- * @type {TrackInfo}
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.
2673
2455
  */
2674
- readonly info: TrackInfo;
2456
+ setAudioOutput(output: AudioOutput): Promise<this>;
2675
2457
  /**
2676
- * The plugin info of the track.
2677
- * @type {PluginInfo}
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.
2678
2462
  */
2679
- readonly pluginInfo: PluginInfo;
2463
+ setSpeed(speed?: number): Promise<this>;
2680
2464
  /**
2681
- * The track user data.
2682
- * @type {Record<string, unknown>}
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.
2683
2469
  */
2684
- userData: Record<string, unknown>;
2470
+ setRate(rate?: number): Promise<this>;
2685
2471
  /**
2686
- * The requester of the track.
2687
- * @type {TrackRequester}
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
2476
  */
2689
- requester: TrackRequester;
2477
+ setPitch(pitch?: number): Promise<this>;
2690
2478
  /**
2691
- * The constructor for the track.
2692
- * @param {LavalinkTrack} track The track to construct the track from.
2693
- * @param {TrackRequester} requester The requester of the track.
2694
- * @example
2695
- * ```ts
2696
- * const track = new Track({
2697
- * encoded: "base64",
2698
- * info: {
2699
- * title: "Track Title",
2700
- * uri: "https://example.com",
2701
- * duration: 300000,
2702
- * },
2703
- * // the rest of the track info
2704
- * }, requester);
2705
2479
  *
2706
- * console.log(track.encoded); // the track encoded in base64
2707
- * ```
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.
2708
2483
  */
2709
- constructor(track: LavalinkTrack | null, requester?: TrackRequester);
2484
+ setEQBand(...bands: RestOrArray<EQBandSettings>): Promise<this>;
2710
2485
  /**
2711
2486
  *
2712
- * Get the hyperlink of the track.
2713
- * @param {boolean} [embedable=true] Whether the hyperlink should be embedable or not.
2714
- * @returns {string} The hyperlink of the track.
2715
- * @example
2716
- * ```ts
2717
- * const track = queue.current;
2718
- * console.log(track.toHyperlink()); // [Track Title](https://example.com)
2719
- * console.log(track.toHyperlink(false)); // [Track Title](<https://example.com>)
2720
- * ```
2487
+ * Clears all EQ bands for the player.
2488
+ * @returns {Promise<this>} A promise that resolves to the instance of the manager.
2721
2489
  */
2722
- toHyperlink(embedable?: boolean): string;
2723
- }
2724
- /**
2725
- * Class representing an unresolved track.
2726
- * @class UnresolvedTrack
2727
- * @implements {UnresolvedLavalinkTrack}
2728
- */
2729
- declare class UnresolvedTrack implements UnresolvedLavalinkTrack {
2490
+ clearEQBands(): Promise<this>;
2730
2491
  /**
2731
- * The base64 encoded track.
2732
- * @type {string | undefined}
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.
2733
2496
  */
2734
- readonly encoded?: string;
2497
+ setVibrato(settings?: Partial<TremoloSettings>): Promise<this>;
2735
2498
  /**
2736
- * The track info.
2737
- * @type {UnresolvedTrackInfo}
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.
2738
2503
  */
2739
- readonly info: UnresolvedTrackInfo;
2504
+ setTremolo(settings?: Partial<TremoloSettings>): Promise<this>;
2740
2505
  /**
2741
- * The plugin info of the track.
2742
- * @type {Partial<PluginInfo>}
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.
2743
2510
  */
2744
- readonly pluginInfo?: Partial<PluginInfo>;
2511
+ setLowPass(settings?: Partial<LowPassSettings>): Promise<this>;
2745
2512
  /**
2746
- * The track user data.
2747
- * @type {Record<string, unknown> | undefined}
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.
2748
2516
  */
2749
- userData?: Record<string, unknown>;
2517
+ setNightcore(settings?: Partial<TimescaleSettings>): Promise<this>;
2750
2518
  /**
2751
- * The requester of the track.
2752
- * @type {TrackRequester | undefined}
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.
2753
2523
  */
2754
- requester: TrackRequester;
2524
+ setVaporwave(settings?: Partial<TimescaleSettings>): Promise<this>;
2755
2525
  /**
2756
- * The constructor for the track.
2757
- * @param {UnresolvedLavalinkTrack} track The track to construct the track from.
2758
- * @param {TrackRequester} requester The requester of the track.
2759
- * @example
2760
- * ```ts
2761
- * const track = new UnresolvedTrack({
2762
- * encoded: "base64",
2763
- * info: {
2764
- * title: "Track Title",
2765
- * },
2766
- * // the rest of the track info
2767
- * }, requester);
2768
2526
  *
2769
- * console.log(track.encoded); // the track encoded in base64
2770
- * ```
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.
2771
2530
  */
2772
- constructor(track: UnresolvedLavalinkTrack, requester: TrackRequester);
2531
+ setKaraoke(settings?: Partial<KaraokeSettings>): Promise<this>;
2773
2532
  /**
2774
- * Resolves the track to a playable track.
2775
- * @param {PlayerStructure} player The player to resolve the track for.
2776
- * @returns {Promise<Track>} The resolved track.
2777
- * @throws {ResolveError} If the track cannot be resolved.
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.
2778
2537
  */
2779
- resolve(player: PlayerStructure): Promise<Track>;
2780
- }
2781
- /**
2782
- * Type representing a Hoshimi track, which can be either a resolved or unresolved track.
2783
- */
2784
- type HoshimiTrack = Track | UnresolvedTrack;
2785
- /**
2786
- * Interface representing an extendable track.
2787
- */
2788
- interface CustomizableTrack {
2538
+ setDistortion(settings?: Partial<DistortionSettings>): Promise<this>;
2539
+ /**
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.
2543
+ */
2544
+ setTimescale(settings: Partial<TimescaleSettings>): Promise<this>;
2545
+ /**
2546
+ * Convert the filter settings to a JSON object.
2547
+ * @returns {FilterSettings} The filter settings as a JSON object.
2548
+ */
2549
+ toJSON(): FilterSettings;
2789
2550
  }
2551
+
2790
2552
  /**
2791
- * The requester of the track.
2553
+ * Type representing the customizable player storage.
2792
2554
  */
2793
- type TrackRequester = Inferable<CustomizableTrack, "requester">;
2794
-
2555
+ type StorageKeys = keyof CustomizablePlayerStorage | (string & {});
2795
2556
  /**
2796
- * Partial Lavalink track type.
2557
+ * Type representing the customizable player storage values.
2797
2558
  */
2798
- type PartialLavalinkTrack = Partial<Nullable<LavalinkTrack>>;
2559
+ type StorageValues<V extends StorageKeys = StorageKeys> = V extends keyof CustomizablePlayerStorage ? CustomizablePlayerStorage[V] : unknown;
2799
2560
  /**
2800
- * The base options for playing a track.
2561
+ * Class representing a player storage.
2562
+ * @class PlayerStorage
2801
2563
  */
2802
- interface BasePlayOptions {
2564
+ declare class PlayerStorage<K extends StorageKeys = StorageKeys, V extends StorageValues<K> = StorageValues<K>> {
2803
2565
  /**
2804
- * The position to start the track.
2805
- * @type {number | undefined}
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.
2806
2570
  */
2807
- position?: number;
2571
+ get<K extends StorageKeys, V extends StorageValues<K>>(key: K): V | undefined;
2808
2572
  /**
2809
- * The position to end the track.
2810
- * @type {number | undefined}
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.
2811
2576
  */
2812
- endTime?: number;
2577
+ set<K extends StorageKeys, V extends StorageValues<K>>(key: K, value: V): void;
2813
2578
  /**
2814
- * The pause state of the player.
2815
- * @type {boolean | undefined}
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.
2816
2582
  */
2817
- paused?: boolean;
2583
+ has(key: K): boolean;
2818
2584
  /**
2819
- * The volume of the player.
2820
- * @type {number | undefined}
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.
2821
2588
  */
2822
- volume?: number;
2589
+ delete(key: K): boolean;
2823
2590
  /**
2824
- * The filters for the player.
2825
- * @type {Partial<FilterSettings> | undefined}
2591
+ * Get all keys in the storage.
2592
+ * @returns {K[]} The keys in the storage.
2826
2593
  */
2827
- filters?: Partial<FilterSettings>;
2594
+ keys<K extends StorageKeys[]>(): K[];
2828
2595
  /**
2829
- * The voice settings for the player.
2830
- * @type {LavalinkPlayerVoice | undefined}
2596
+ * Get all values in the storage.
2597
+ * @returns {V[]} The values in the storage.
2831
2598
  */
2832
- voice?: LavalinkPlayerVoice;
2833
- }
2834
- /**
2835
- * The types of loop modes.
2836
- */
2837
- declare enum LoopMode {
2599
+ values<K extends StorageKeys[], V extends StorageValues<K[number]>>(): V[];
2838
2600
  /**
2839
- * Loop mode for repeating the current track.
2601
+ * Get all entries in the storage.
2602
+ * @returns {[K, V][]} The entries in the storage.
2840
2603
  */
2841
- Track = 1,
2604
+ entries<K extends StorageKeys[], V extends StorageValues<K[number]>>(): [K, V][];
2842
2605
  /**
2843
- * Loop mode for repeating the queue.
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.
2844
2609
  */
2845
- Queue = 2,
2610
+ all<K extends StorageKeys[], V extends StorageValues<K[number]>>(): Record<K[number], V>;
2846
2611
  /**
2847
- * Loop mode for repeating nothing.
2612
+ * Clear the storage.
2848
2613
  */
2849
- Off = 3
2614
+ clear(): void;
2615
+ /**
2616
+ * Get the size of the storage.
2617
+ * @returns {number} The number of entries in the storage.
2618
+ */
2619
+ get size(): number;
2850
2620
  }
2621
+
2851
2622
  /**
2852
- * The types of player events.
2623
+ * Type representing a nullable voice channel update.
2853
2624
  */
2854
- declare enum PlayerEventType {
2855
- /**
2856
- * Event type for when a track starts.
2857
- */
2858
- TrackStart = "TrackStartEvent",
2625
+ type NullableVoiceChannelUpdate = Partial<Nullable<VoiceChannelUpdate>>;
2626
+ /**
2627
+ * Class representing a Hoshimi player.
2628
+ * @class Player
2629
+ */
2630
+ declare class Player {
2859
2631
  /**
2860
- * Event type for when a track ends.
2632
+ * The data for the player.
2633
+ * @type {PlayerStorage}
2634
+ * @readonly
2861
2635
  */
2862
- TrackEnd = "TrackEndEvent",
2636
+ readonly data: PlayerStorage;
2863
2637
  /**
2864
- * Event type for when a track encounters an exception.
2638
+ * The options for the player.
2639
+ * @type {PlayerOptions}
2640
+ * @readonly
2865
2641
  */
2866
- TrackException = "TrackExceptionEvent",
2642
+ readonly options: PlayerOptions;
2867
2643
  /**
2868
- * Event type for when a track gets stuck.
2644
+ * The manager for the player.
2645
+ * @type {Hoshimi}
2646
+ * @readonly
2869
2647
  */
2870
- TrackStuck = "TrackStuckEvent",
2648
+ readonly manager: Hoshimi;
2871
2649
  /**
2872
- * Event type for when lyrics are found.
2650
+ * The queue for the player.
2651
+ * @type {Queue}
2652
+ * @readonly
2873
2653
  */
2874
- LyricsFound = "LyricsFoundEvent",
2654
+ readonly queue: QueueStructure;
2875
2655
  /**
2876
- * Event type for when lyrics are not found.
2656
+ * The filter manager for the player.
2657
+ * @type {FilterManager}
2658
+ * @readonly
2877
2659
  */
2878
- LyricsNotFound = "LyricsNotFoundEvent",
2660
+ readonly filterManager: FilterManager;
2879
2661
  /**
2880
- * Event type for when a lyrics line is sent.
2662
+ * The node for the player.
2663
+ * @type {NodeStructure}
2881
2664
  */
2882
- LyricsLine = "LyricsLineEvent",
2665
+ node: NodeStructure;
2883
2666
  /**
2884
- * Event type for when the WebSocket connection is closed.
2667
+ * Check if the player is self deafened.
2668
+ * @type {boolean}
2885
2669
  */
2886
- WebsocketClosed = "WebSocketClosedEvent"
2887
- }
2888
- /**
2889
- * The reasons a track can end.
2890
- */
2891
- declare enum TrackEndReason {
2670
+ selfDeaf: boolean;
2892
2671
  /**
2893
- * The track ended normally.
2672
+ * Check if the player is self muted.
2673
+ * @type {boolean}
2894
2674
  */
2895
- Finished = "finished",
2675
+ selfMute: boolean;
2896
2676
  /**
2897
- * The track fails to load.
2677
+ * Loop mode of the player.
2678
+ * @type {LoopMode}
2679
+ * @default LoopMode.Off
2898
2680
  */
2899
- LoadFailed = "loadFailed",
2681
+ loop: LoopMode;
2900
2682
  /**
2901
- * The track was stopped.
2683
+ * Check if the player is playing.
2684
+ * @type {boolean}
2685
+ * @default false
2902
2686
  */
2903
- Stopped = "stopped",
2687
+ playing: boolean;
2904
2688
  /**
2905
- * The track was replaced.
2689
+ * Check if the player is paused.
2690
+ * @type {boolean}
2691
+ * @default false
2906
2692
  */
2907
- Replaced = "replaced",
2693
+ paused: boolean;
2908
2694
  /**
2909
- * The track was cleaned up.
2695
+ * Check if the player is connected.
2696
+ * @type {boolean}
2697
+ * @default false
2910
2698
  */
2911
- Cleanup = "cleanup"
2912
- }
2913
- /**
2914
- * The base interface for player events.
2915
- */
2916
- interface PlayerEvent {
2699
+ connected: boolean;
2917
2700
  /**
2918
- * The operation code for the event.
2919
- * @type {OpCodes.Event}
2701
+ * Volume of the player.
2702
+ * @type {number}
2703
+ * @default 100
2920
2704
  */
2921
- op: OpCodes.Event;
2705
+ volume: number;
2922
2706
  /**
2923
- * The guild ID associated with the event.
2707
+ * Guild ig of the player.
2924
2708
  * @type {string}
2925
2709
  */
2926
2710
  guildId: string;
2927
- }
2928
- /**
2929
- * The event for when a track starts playing.
2930
- */
2931
- interface TrackStartEvent extends PlayerEvent {
2932
- /**
2933
- * The type of the event.
2934
- * @type {PlayerEventType.TrackStart}
2935
- */
2936
- type: PlayerEventType.TrackStart;
2937
2711
  /**
2938
- * The track that started playing.
2939
- * @type {LavalinkTrack}
2712
+ * Voice channel idof the player.
2713
+ * @type {string | undefined}
2940
2714
  */
2941
- track: LavalinkTrack;
2942
- }
2943
- /**
2944
- * The event for when a track ends.
2945
- */
2946
- interface TrackEndEvent extends PlayerEvent {
2715
+ voiceId: string | undefined;
2947
2716
  /**
2948
- * The type of the event.
2949
- * @type {PlayerEventType.TrackEnd}
2717
+ * Text channel id of the player.
2718
+ * @type {string | undefined}
2950
2719
  */
2951
- type: PlayerEventType.TrackEnd;
2720
+ textId: string | undefined;
2952
2721
  /**
2953
- * The track that ended.
2954
- * @type {LavalinkTrack}
2722
+ * The ping of the player.
2723
+ * @type {number}
2955
2724
  */
2956
- track: LavalinkTrack;
2725
+ ping: number;
2957
2726
  /**
2958
- * The reason the track ended.
2959
- * @type {TrackEndReason}
2727
+ * The timestamp when the player was created.
2728
+ * @type {number}
2960
2729
  */
2961
- reason: TrackEndReason;
2962
- }
2963
- /**
2964
- * The event for when a track gets stuck.
2965
- */
2966
- interface TrackStuckEvent extends PlayerEvent {
2730
+ createdTimestamp: number;
2967
2731
  /**
2968
- * The type of the event.
2969
- * @type {PlayerEventType.TrackStuck}
2732
+ * The last position received from Lavalink.
2733
+ * @type {number}
2970
2734
  */
2971
- type: PlayerEventType.TrackStuck;
2735
+ lastPosition: number;
2972
2736
  /**
2973
- * The track that got stuck.
2974
- * @type {LavalinkTrack}
2737
+ * The timestamp when the last position change update happened.
2738
+ * @type {number | null}
2975
2739
  */
2976
- track: LavalinkTrack;
2740
+ lastPositionUpdate: number | null;
2977
2741
  /**
2978
- * The threshold in milliseconds.
2742
+ * The current calculated position of the player.
2979
2743
  * @type {number}
2744
+ * @readonly
2980
2745
  */
2981
- thresholdMs: number;
2982
- }
2983
- /**
2984
- * The event for when a track encounters an exception.
2985
- */
2986
- interface TrackExceptionEvent extends PlayerEvent {
2746
+ get position(): number;
2987
2747
  /**
2988
- * The type of the event.
2989
- * @type {PlayerEventType.TrackException}
2748
+ * The voice connection details.
2749
+ * @type {PlayerVoice}
2990
2750
  */
2991
- type: PlayerEventType.TrackException;
2751
+ voice: Nullable<LavalinkPlayerVoice>;
2992
2752
  /**
2993
- * The exception that occurred.
2994
- * @type {Exception}
2753
+ *
2754
+ * Create a new player.
2755
+ * @param {Hoshimi} manager The manager for the player.
2756
+ * @param {PlayOptions} options The options for the player.
2757
+ * @example
2758
+ * ```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,
2766
+ * });
2767
+ *
2768
+ * console.log(player.guildId); // guildId
2769
+ * console.log(player.voiceId); // voiceId
2770
+ * console.log(player.textId); // textId
2995
2771
  */
2996
- exception: Exception;
2997
- }
2998
- /**
2999
- * The event for when the WebSocket connection is closed.
3000
- */
3001
- interface WebSocketClosedEvent extends PlayerEvent {
2772
+ constructor(manager: Hoshimi, options: PlayerOptions);
3002
2773
  /**
3003
- * The type of the event.
3004
- * @type {PlayerEventType.WebsocketClosed}
3005
- */
3006
- type: PlayerEventType.WebsocketClosed;
3007
- /**
3008
- * The close code.
3009
- * @type {number}
2774
+ * The lyrics methods for the player.
2775
+ * @type {LyricsMethods}
2776
+ * @readonly
3010
2777
  */
3011
- code: number;
2778
+ readonly lyrics: LyricsMethods;
3012
2779
  /**
3013
- * Whether the connection was closed by the remote.
3014
- * @type {boolean}
2780
+ *
2781
+ * Search for a track or playlist.
2782
+ * @param {SearchOptions} options The options for the search.
2783
+ * @returns {Promise<QueryResult>} The search result.
2784
+ * @example
2785
+ * ```ts
2786
+ * const player = manager.getPlayer("guildId");
2787
+ * const result = await player.search({
2788
+ * query: "track name",
2789
+ * engine: SearchEngine.Youtube,
2790
+ * requester: {},
2791
+ * });
2792
+ *
2793
+ * console.log(result) // the search result
2794
+ * ```
3015
2795
  */
3016
- byRemote: boolean;
2796
+ search(options: SearchOptions): Promise<QueryResult>;
3017
2797
  /**
3018
- * The reason for the closure.
3019
- * @type {string}
2798
+ *
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.
2804
+ * @example
2805
+ * ```ts
2806
+ * const player = manager.getPlayer("guildId");
2807
+ * player.skip(2); // skip 2 tracks
2808
+ * player.skip(); // skip 1 track
2809
+ * ```
3020
2810
  */
3021
- reason: string;
3022
- }
3023
- /**
3024
- * The event for when lyrics are found.
3025
- */
3026
- interface LyricsFoundEvent extends PlayerEvent {
2811
+ skip(to?: number, throwError?: boolean): Promise<void>;
3027
2812
  /**
3028
- * The type of the event.
3029
- * @type {PlayerEventType.LyricsFound}
2813
+ *
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.
2818
+ * @example
2819
+ * ```ts
2820
+ * const player = manager.getPlayer("guildId");
2821
+ * player.seek(30000); // seek to 30 seconds
2822
+ * ```
3030
2823
  */
3031
- type: PlayerEventType.LyricsFound;
2824
+ seek(position: number): Promise<void>;
3032
2825
  /**
3033
- * The guild id associated with the event.
3034
- * @type {string}
2826
+ *
2827
+ * Disconnect the player from the voice channel.
2828
+ * @returns {Promise<this>} The player instance.
2829
+ * @example
2830
+ * ```ts
2831
+ * const player = manager.getPlayer("guildId");
2832
+ * player.disconnect();
2833
+ * ```
3035
2834
  */
3036
- guildId: string;
2835
+ disconnect(): Promise<this>;
3037
2836
  /**
3038
- * The lyrics result of the event.
3039
- * @type {LyricsResult}
2837
+ *
2838
+ * Destroy and disconnect the player.
2839
+ * @param {DestroyReasons} [reason] The reason for destroying the player.
2840
+ * @returns {Promise<void>}
2841
+ * @example
2842
+ * ```ts
2843
+ * const player = manager.getPlayer("guildId");
2844
+ * player.destroy(DestroyReasons.Stop);
2845
+ * ```
3040
2846
  */
3041
- lyrics: LyricsResult;
3042
- }
3043
- /**
3044
- * The event for when lyrics are not found.
3045
- */
3046
- interface LyricsNotFoundEvent extends PlayerEvent {
2847
+ destroy(reason?: DestroyReasons): Promise<boolean>;
3047
2848
  /**
3048
- * The type of the event.
3049
- * @type {PlayerEventType.LyricsNotFound}
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.
2854
+ * @example
2855
+ * ```ts
2856
+ * const player = manager.getPlayer("guildId");
2857
+ *
2858
+ * player.play({
2859
+ * track: track,
2860
+ * noReplace: true,
2861
+ * });
2862
+ * ```
3050
2863
  */
3051
- type: PlayerEventType.LyricsNotFound;
2864
+ play(options?: Partial<PlayOptions>): Promise<void>;
3052
2865
  /**
3053
- * The guild id associated with the event.
3054
- * @type {string}
2866
+ * Connect the player to the voice channel.
2867
+ * @returns {Promise<this>} The player instance.
2868
+ * @example
2869
+ * ```ts
2870
+ * const player = manager.getPlayer("guildId");
2871
+ * player.connect();
2872
+ * ```
3055
2873
  */
3056
- guildId: string;
3057
- }
3058
- /**
3059
- * The event for when a lyrics line is sent.
3060
- */
3061
- interface LyricsLineEvent extends PlayerEvent {
2874
+ connect(): Promise<this>;
3062
2875
  /**
3063
- * The type of the event.
3064
- * @type {PlayerEventType.LyricsLine}
2876
+ *
2877
+ * Stop the player from playing.
2878
+ * @param {boolean} [destroy=true] Whether to destroy the player or not.
2879
+ * @returns {Promise<void>}
2880
+ * @example
2881
+ * ```ts
2882
+ * const player = manager.getPlayer("guildId");
2883
+ * player.stop();
2884
+ * ```
3065
2885
  */
3066
- type: PlayerEventType.LyricsLine;
2886
+ stop(destroy?: boolean): Promise<void>;
3067
2887
  /**
3068
- * The guild id associated with the event.
3069
- * @type {string}
2888
+ *
2889
+ * Pause or resume the player.
2890
+ * @returns {Promise<void>}
2891
+ * @example
2892
+ * ```ts
2893
+ * const player = manager.getPlayer("guildId");
2894
+ * player.setPaused();
2895
+ * ```
3070
2896
  */
3071
- guildId: string;
2897
+ setPaused(paused?: boolean): Promise<boolean>;
3072
2898
  /**
3073
- * The line index of the lyrics line.
3074
- * @type {number}
2899
+ *
2900
+ * Set the volume of the player.
2901
+ * @param {number} volume The volume to set.
2902
+ * @returns {Promise<void>}
2903
+ * @example
2904
+ * ```ts
2905
+ * const player = manager.getPlayer("guildId");
2906
+ * player.setVolume(50); // set the volume to 50%
2907
+ * ```
3075
2908
  */
3076
- lineIndex: number;
2909
+ setVolume(volume: number): Promise<void>;
3077
2910
  /**
3078
- * The lyrics line of the event.
3079
- * @type {LyricsLine}
2911
+ *
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.
2915
+ * @example
2916
+ * ```ts
2917
+ * const player = manager.getPlayer("guildId");
2918
+ * player.setLoop(LoopMode.Track);
2919
+ * ```
3080
2920
  */
3081
- line: LyricsLine;
2921
+ setLoop(mode: LoopMode): this;
3082
2922
  /**
3083
- * Returns if the line was skipped.
3084
- * @type {boolean}
2923
+ * Set the voice of the player.
2924
+ * @param {NullableVoiceChannelUpdate} options The voice state to set.
2925
+ * @returns {Promise<void>}
2926
+ * @example
2927
+ * ```ts
2928
+ * const player = manager.getPlayer("guildId");
2929
+ * player.setVoice({ voiceId: "newVoiceId" });
2930
+ * ```
3085
2931
  */
3086
- skipped: boolean;
3087
- }
3088
- /**
3089
- * The update for the player state.
3090
- */
3091
- interface PlayerUpdate {
2932
+ setVoice(options?: NullableVoiceChannelUpdate): Promise<void>;
3092
2933
  /**
3093
- * The operation code for the update.
3094
- * @type {OpCodes.PlayerUpdate}
2934
+ *
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.
2939
+ * @example
2940
+ * ```ts
2941
+ * const player = manager.getPlayer("guildId");
2942
+ * player.move("newNodeId");
2943
+ * ```
3095
2944
  */
3096
- op: OpCodes.PlayerUpdate;
2945
+ move(node: NodeIdentifier): Promise<void>;
3097
2946
  /**
3098
- * The guild ID associated with the update.
3099
- * @type {string}
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.
3100
2950
  */
3101
- guildId: string;
2951
+ updatePlayer(data: NonGuildUpdatePlayerInfo): Promise<LavalinkPlayer | null>;
3102
2952
  /**
3103
- * The state of the player.
3104
- * @type {PlayerUpdateState}
2953
+ *
2954
+ * Return the player as a json object.
2955
+ * @returns {PlayerJson}
2956
+ * @example
2957
+ * ```ts
2958
+ * const player = manager.getPlayer("guildId");
2959
+ * const json = player.toJSON();
2960
+ * console.log(json); // the player as a json object
2961
+ * ```
3105
2962
  */
3106
- state: PlayerUpdateState;
2963
+ toJSON(): PlayerJson;
3107
2964
  }
3108
- interface PlayerUpdateState {
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 {
2973
+ }
2974
+
2975
+ /**
2976
+ * Class representing the queue utils.
2977
+ * @class QueueUtils
2978
+ */
2979
+ declare class QueueUtils {
3109
2980
  /**
3110
- * Whether the player is connected.
3111
- * @type {boolean}
2981
+ *
2982
+ * Constructor of the queue utils.
2983
+ * @param {QueueStructure} queue The queue instance.
3112
2984
  */
3113
- connected: boolean;
2985
+ constructor(queue: QueueStructure);
3114
2986
  /**
3115
- * The position of the track.
3116
- * @type {number}
3117
- */
3118
- position: number;
2987
+ *
2988
+ * Save the queue.
2989
+ * @returns {Awaitable<void>}
2990
+ * @example
2991
+ * ```ts
2992
+ * await player.queue.utils.save();
2993
+ * ```
2994
+ */
2995
+ save(): Awaitable<void>;
3119
2996
  /**
3120
- * The time of the update.
3121
- * @type {number}
2997
+ *
2998
+ * Destroy the queue.
2999
+ * @returns {Promise<void>}
3000
+ * @example
3001
+ * ```ts
3002
+ * await player.queue.utils.destroy();
3003
+ * ```
3122
3004
  */
3123
- time: number;
3005
+ destroy(): Awaitable<boolean>;
3124
3006
  /**
3125
- * The ping of the player.
3126
- * @type {number}
3007
+ *
3008
+ * Sync the queue.
3009
+ * @returns {Awaitable<void>}
3010
+ * @example
3011
+ * ```ts
3012
+ * await player.queue.utils.sync();
3013
+ * ```
3127
3014
  */
3128
- ping: number;
3015
+ sync(override?: boolean, syncCurrent?: boolean): Promise<void>;
3129
3016
  }
3017
+
3130
3018
  /**
3131
- * The options for the player.
3019
+ * Class representing a queue.
3020
+ * @class Queue
3132
3021
  */
3133
- interface PlayerOptions {
3134
- /**
3135
- * Guild id of the player.
3136
- * @type {string}
3137
- */
3138
- guildId: string;
3139
- /**
3140
- * Voice channel id of the player.
3141
- * @type {string}
3142
- */
3143
- voiceId: string;
3144
- /**
3145
- * Volume of the player.
3146
- * @type {number | undefined}
3147
- * @default 100
3148
- */
3149
- volume?: number;
3150
- /**
3151
- * Set if the player should be deafened.
3152
- * @type {boolean | undefined}
3153
- * @default true
3154
- */
3155
- selfDeaf?: boolean;
3156
- /**
3157
- * Set if the player should be muted.
3158
- * @type {boolean | undefined}
3159
- * @default false
3160
- */
3161
- selfMute?: boolean;
3022
+ declare class Queue {
3162
3023
  /**
3163
- * Text channel id of the player.
3164
- * @type {string | undefined}
3024
+ * Tracks of the queue.
3025
+ * @type {HoshimiTrack[]}
3165
3026
  */
3166
- textId?: string;
3027
+ tracks: HoshimiTrack[];
3167
3028
  /**
3168
- * Lavalink node of the player.
3169
- * @type {NodeIdentifier}
3029
+ * Previous tracks of the queue.
3030
+ * @type {Track[]}
3170
3031
  */
3171
- node?: NodeIdentifier;
3172
- }
3173
- /**
3174
- * The options for playing a track with Lavalink.
3175
- */
3176
- interface LavalinkPlayOptions extends BasePlayOptions {
3032
+ history: Track[];
3177
3033
  /**
3178
- * Track to play.
3179
- * @type {PartialLavalinkTrack | undefined}
3034
+ * Current track of the queue.
3035
+ * @type {Track | null}
3180
3036
  */
3181
- track?: PartialLavalinkTrack;
3182
- }
3183
- /**
3184
- * The options for playing a track.
3185
- */
3186
- interface PlayOptions extends BasePlayOptions {
3037
+ current: Track | null;
3187
3038
  /**
3188
- * Whether to replace the current track.
3189
- * @type {boolean | undefined}
3190
- * @default false
3039
+ * The player instance.
3040
+ * @type {PlayerStructure}
3191
3041
  */
3192
- noReplace?: boolean;
3042
+ readonly player: PlayerStructure;
3193
3043
  /**
3194
- * Track to play.
3195
- * @type {Track | UnresolvedTrack | undefined}
3044
+ * The queue utils instance.
3045
+ * @type {QueueUtils}
3046
+ * @readonly
3196
3047
  */
3197
- track?: Track | UnresolvedTrack;
3198
- }
3199
- interface PlayerVoice {
3048
+ readonly utils: QueueUtils;
3200
3049
  /**
3201
- * The voice server token.
3202
- * @type {string}
3050
+ *
3051
+ * Constructor of the queue.
3052
+ * @param {PlayerStructure} player Player instance.
3053
+ * @example
3054
+ * ```ts
3055
+ * const player = new Player();
3056
+ * const queue = new Queue(player);
3057
+ *
3058
+ * console.log(queue.size); // 0
3059
+ * queue.add(track);
3060
+ * console.log(queue.size); // 1
3061
+ * ```
3203
3062
  */
3204
- token: string;
3063
+ constructor(player: PlayerStructure);
3205
3064
  /**
3206
- * The voice server endpoint.
3207
- * @type {string}
3065
+ * Get the track size of the queue.
3066
+ * @type {number}
3067
+ * @returns {number} The track size of the queue.
3068
+ * @readonly
3069
+ * @example
3070
+ * ```ts
3071
+ * const queue = player.queue;
3072
+ *
3073
+ * console.log(queue.size); // 0
3074
+ * queue.add(track);
3075
+ *
3076
+ * console.log(queue.size); // 1
3077
+ * queue.add([track1, track2]);
3078
+ *
3079
+ * console.log(queue.size); // 3
3080
+ * queue.shift();
3081
+ * console.log(queue.size); // 2
3082
+ *
3083
+ * queue.clear();
3084
+ * console.log(queue.size); // 0
3085
+ * ```
3208
3086
  */
3209
- endpoint: string;
3087
+ get size(): number;
3210
3088
  /**
3211
- * The voice server session id.
3212
- * @type {string}
3089
+ * Get the total track size of the queue (Includes the current track).
3090
+ * @type {number}
3091
+ * @returns {number} The total track size of the queue.
3092
+ * @readonly
3093
+ * @example
3094
+ * ```ts
3095
+ * const queue = player.queue;
3096
+ *
3097
+ * console.log(queue.totalSize); // 0
3098
+ * queue.add(track);
3099
+ *
3100
+ * console.log(queue.totalSize); // 1
3101
+ * queue.add([track1, track2]);
3102
+ *
3103
+ * console.log(queue.totalSize); // 3
3104
+ * queue.shift();
3105
+ * console.log(queue.totalSize); // 2
3106
+ *
3107
+ * queue.clear();
3108
+ * console.log(queue.totalSize); // 0
3109
+ * ```
3213
3110
  */
3214
- sessionId: string;
3111
+ get totalSize(): number;
3215
3112
  /**
3216
- * The voice server guild id.
3217
- * @type {string | undefined}
3113
+ *
3114
+ * Check if the queue is empty.
3115
+ * @type {boolean}
3116
+ * @returns {boolean} True if the queue is empty.
3117
+ * @readonly
3118
+ * @example
3119
+ * ```ts
3120
+ * const queue = player.queue;
3121
+ *
3122
+ * console.log(queue.isEmpty()); // true
3123
+ * queue.add(track);
3124
+ *
3125
+ * console.log(queue.isEmpty()); // false
3126
+ * queue.clear();
3127
+ *
3128
+ * console.log(queue.isEmpty()); // true
3129
+ * ```
3218
3130
  */
3219
- connected?: boolean;
3131
+ isEmpty(): boolean;
3220
3132
  /**
3221
- * The voice server ping.
3222
- * @type {number | undefined}
3133
+ *
3134
+ * Build a track from a Lavalink track or unresolved Lavalink track.
3135
+ * @param {LavalinkTrack | UnresolvedLavalinkTrack} track The track to build.
3136
+ * @param {TrackRequester} requester The requester of the track.
3137
+ * @returns {Promise<Track>} The built track.
3138
+ * @example
3139
+ * ```ts
3140
+ * const queue = player.queue;
3141
+ * const lavalinkTrack = {...} // some lavalink track
3142
+ * const track = await queue.build(lavalinkTrack, author);
3143
+ *
3144
+ * console.log(track.info.title); // The title of the track
3145
+ * ```
3223
3146
  */
3224
- ping?: number;
3225
- }
3226
- /**
3227
- * The JSON representation of the player.
3228
- */
3229
- interface PlayerJson {
3147
+ build(track: LavalinkTrack | UnresolvedLavalinkTrack | HoshimiTrack, requester: TrackRequester): Promise<Track>;
3230
3148
  /**
3231
- * The guild id of the player.
3232
- * @type {string}
3149
+ *
3150
+ * Get the previous track of the queue.
3151
+ * @param {boolean} [remove=false] Whether to remove the track from the previous queue.
3152
+ * @returns {Promise<Track | null>} The previous track of the queue.
3153
+ * @example
3154
+ * ```ts
3155
+ * const queue = player.queue;
3156
+ *
3157
+ * console.log(await queue.previous()); // null
3158
+ * queue.add(track);
3159
+ * queue.add(track2);
3160
+ *
3161
+ * console.log(await queue.previous()); // track
3162
+ * console.log(await queue.previous(true)); // track and remove it from the previous tracks
3163
+ * ```
3233
3164
  */
3234
- guildId: string;
3165
+ previous(remove?: boolean): Promise<Track | null>;
3235
3166
  /**
3236
- * The volume of the player.
3237
- * @type {number}
3167
+ *
3168
+ * Add a track or tracks to the queue.
3169
+ * @param {Track | Track[]} track The track or tracks to add.
3170
+ * @param {number} [position] The position to add the track or tracks.
3171
+ * @returns {Promise<this>} The queue instance.
3172
+ * @example
3173
+ * ```ts
3174
+ * const queue = player.queue;
3175
+ *
3176
+ * console.log(queue.size); // 0
3177
+ *
3178
+ * await queue.add(track);
3179
+ * console.log(queue.size); // 1
3180
+ *
3181
+ * await queue.add([track1, track2]);
3182
+ * console.log(queue.size); // 3
3183
+ *
3184
+ * await queue.add(track3, 1);
3185
+ * console.log(queue.size); // 4
3186
+ * console.log(queue.tracks); // [track1, track3, track2, track]
3187
+ * ```
3238
3188
  */
3239
- volume: number;
3189
+ add(track: HoshimiTrack | HoshimiTrack[], position?: number): Promise<this>;
3240
3190
  /**
3241
- * The self deaf state of the player.
3242
- * @type {boolean}
3191
+ *
3192
+ * Get the first track of the queue.
3193
+ * @returns {Promise<HoshimiTrack | null>} The first track of the queue.
3194
+ * @example
3195
+ * ```ts
3196
+ * const queue = player.queue;
3197
+ *
3198
+ * console.log(await queue.shift()); // null
3199
+ * await queue.add(track);
3200
+ *
3201
+ * console.log(await queue.shift()); // track
3202
+ * await queue.add(track2);
3203
+ * ```
3243
3204
  */
3244
- selfDeaf: boolean;
3205
+ shift(): Promise<HoshimiTrack | null>;
3245
3206
  /**
3246
- * The self mute state of the player.
3247
- * @type {boolean}
3207
+ *
3208
+ * Add tracks to the beginning of the queue.
3209
+ * @param {Track[]} tracks The tracks to add.
3210
+ * @returns {Promise<this>} The queue instance.
3211
+ * @example
3212
+ * ```ts
3213
+ * const queue = player.queue;
3214
+ *
3215
+ * console.log(queue.size); // 0
3216
+ * await queue.unshift(track);
3217
+ *
3218
+ * console.log(queue.size); // 1
3219
+ * await queue.unshift(track1, track2);
3220
+ *
3221
+ * console.log(queue.size); // 3
3222
+ * console.log(queue.tracks); // [track1, track2, track]
3223
+ * ```
3248
3224
  */
3249
- selfMute: boolean;
3225
+ unshift(...tracks: Track[]): Promise<this>;
3250
3226
  /**
3251
- * The voice settings for the player.
3252
- * @type {LavalinkPlayerVoice}
3227
+ *
3228
+ * Shuffle the queue.
3229
+ * @returns {Promise<this>} The queue instance.
3230
+ * @example
3231
+ * ```ts
3232
+ * const queue = player.queue;
3233
+ *
3234
+ * console.log(queue.size); // 0
3235
+ * await queue.add(track);
3236
+ * await queue.add(track1, track2);
3237
+ *
3238
+ * console.log(queue.size); // 3
3239
+ * console.log(queue.tracks); // [track, track1, track2]
3240
+ *
3241
+ * await queue.shuffle();
3242
+ * console.log(queue.tracks); // [track2, track, track1]
3243
+ * ```
3253
3244
  */
3254
- voice: Nullable<LavalinkPlayerVoice>;
3245
+ shuffle(): Promise<this>;
3255
3246
  /**
3256
- * The loop mode of the player.
3257
- * @type {LoopMode}
3247
+ *
3248
+ * Clear the queue.
3249
+ * @returns {Promise<this>} The queue instance.
3250
+ * @example
3251
+ * ```ts
3252
+ * const queue = player.queue;
3253
+ *
3254
+ * console.log(queue.size); // 0
3255
+ * await queue.add(track);
3256
+ * await queue.add(track1, track2);
3257
+ *
3258
+ * console.log(queue.size); // 3
3259
+ * await queue.clear();
3260
+ * console.log(queue.size); // 0
3261
+ * ```
3258
3262
  */
3259
- loop: LoopMode;
3263
+ clear(): Promise<this>;
3260
3264
  /**
3261
- * The options for the player.
3262
- * @type {boolean}
3265
+ *
3266
+ * Move a track to a specific position in the queue.
3267
+ * @param {Track} track The track to move.
3268
+ * @param {number} to The position to move.
3269
+ * @returns {Promise<this>} The queue instance.
3263
3270
  */
3264
- options: PlayerOptions;
3271
+ move(track: Track, to: number): Promise<this>;
3265
3272
  /**
3266
- * The paused state of the player.
3267
- * @type {boolean}
3273
+ *
3274
+ * Delete tracks from the queue.
3275
+ * @param {number} start The start index.
3276
+ * @param {number} deleteCount The number of tracks to delete.
3277
+ * @param {Track | Track[]} [tracks] The tracks to add.
3278
+ * @returns {Promise<this>} The queue instance.
3268
3279
  */
3269
- paused: boolean;
3280
+ splice(start: number, deleteCount: number, tracks?: HoshimiTrack | HoshimiTrack[]): Promise<this>;
3270
3281
  /**
3271
- * The playing state of the player.
3272
- * @type {boolean}
3282
+ *
3283
+ * Convert the queue to a JSON object.
3284
+ * @returns {QueueJson} The queue JSON object.
3273
3285
  */
3274
- playing: boolean;
3286
+ toJSON(): QueueJson;
3287
+ }
3288
+
3289
+ /**
3290
+ * The structure for the Player class.
3291
+ */
3292
+ type PlayerStructure = InferCustomStructure<Player, "Player">;
3293
+ /**
3294
+ * The structure for the Rest class.
3295
+ */
3296
+ type RestStructure = InferCustomStructure<Rest, "Rest">;
3297
+ /**
3298
+ * The structure for the Node class.
3299
+ */
3300
+ type NodeStructure = InferCustomStructure<Node, "Node">;
3301
+ /**
3302
+ * The structure for the Queue class.
3303
+ */
3304
+ type QueueStructure = InferCustomStructure<Queue, "Queue">;
3305
+ /**
3306
+ * The structure for the LyricsManager class.
3307
+ */
3308
+ type LyricsManagerStructure = InferCustomStructure<LyricsManager, "LyricsManager">;
3309
+ /**
3310
+ * The structure for the NodeManager class.
3311
+ */
3312
+ type NodeManagerStructure = InferCustomStructure<NodeManager, "NodeManager">;
3313
+ /**
3314
+ * The structure for the FilterManager class.
3315
+ */
3316
+ type FilterManagerStructure = InferCustomStructure<FilterManager, "FilterManager">;
3317
+ /**
3318
+ * The structures of the Hoshimi classes.
3319
+ */
3320
+ declare const Structures: {
3321
+ Player(manager: Hoshimi, options: PlayerOptions): PlayerStructure;
3322
+ Rest(node: Node): RestStructure;
3323
+ Node(nodeManager: NodeManager, options: NodeOptions): NodeStructure;
3324
+ Queue(player: Player): QueueStructure;
3325
+ LyricsManager(node: Node): LyricsManagerStructure;
3326
+ NodeManager(manager: Hoshimi): NodeManagerStructure;
3327
+ FilterManager(player: Player): FilterManagerStructure;
3328
+ };
3329
+ /**
3330
+ * Infers the custom structure for a given class.
3331
+ */
3332
+ type InferCustomStructure<T, N extends string> = CustomizableStructures extends Record<N, infer P> ? P : T;
3333
+
3334
+ /**
3335
+ * Class representing a Hoshimi track.
3336
+ * @class Track
3337
+ * @implements {LavalinkTrack}
3338
+ */
3339
+ declare class Track implements LavalinkTrack {
3275
3340
  /**
3276
- * The voice channel id of the player.
3341
+ * The base64 encoded track.
3277
3342
  * @type {string}
3278
3343
  */
3279
- voiceId?: string;
3344
+ readonly encoded: string;
3280
3345
  /**
3281
- * The text channel id of the player.
3282
- * @type {string | undefined}
3346
+ * The track info.
3347
+ * @type {TrackInfo}
3283
3348
  */
3284
- textId?: string;
3349
+ readonly info: TrackInfo;
3285
3350
  /**
3286
- * The last position received from Lavalink.
3287
- * @type {number}
3351
+ * The plugin info of the track.
3352
+ * @type {PluginInfo}
3288
3353
  */
3289
- lastPosition: number;
3354
+ readonly pluginInfo: PluginInfo;
3290
3355
  /**
3291
- * The timestamp when the last position change update happened.
3292
- * @type {number | null}
3356
+ * The track user data.
3357
+ * @type {TrackUserData}
3293
3358
  */
3294
- lastPositionUpdate: number | null;
3359
+ userData: TrackUserData;
3295
3360
  /**
3296
- * The current calculated position of the player.
3297
- * @type {number}
3361
+ * The requester of the track.
3362
+ * @type {TrackRequester}
3298
3363
  */
3299
- position: number;
3364
+ requester: TrackRequester;
3300
3365
  /**
3301
- * The timestamp when the player was created.
3302
- * @type {number}
3366
+ * The constructor for the track.
3367
+ * @param {LavalinkTrack} track The track to construct the track from.
3368
+ * @param {TrackRequester} requester The requester of the track.
3369
+ * @example
3370
+ * ```ts
3371
+ * const track = new Track({
3372
+ * encoded: "base64",
3373
+ * info: {
3374
+ * title: "Track Title",
3375
+ * uri: "https://example.com",
3376
+ * duration: 300000,
3377
+ * },
3378
+ * // the rest of the track info
3379
+ * }, requester);
3380
+ *
3381
+ * console.log(track.encoded); // the track encoded in base64
3382
+ * ```
3303
3383
  */
3304
- createdTimestamp: number;
3384
+ constructor(track: LavalinkTrack | null, requester?: TrackRequester);
3305
3385
  /**
3306
- * The ping of the player.
3307
- * @type {number}
3386
+ *
3387
+ * Get the hyperlink of the track.
3388
+ * @param {boolean} [embedable=true] Whether the hyperlink should be embedable or not.
3389
+ * @returns {string} The hyperlink of the track.
3390
+ * @example
3391
+ * ```ts
3392
+ * const track = queue.current;
3393
+ * console.log(track.toHyperlink()); // [Track Title](https://example.com)
3394
+ * console.log(track.toHyperlink(false)); // [Track Title](<https://example.com>)
3395
+ * ```
3308
3396
  */
3309
- ping: number;
3397
+ toHyperlink(embedable?: boolean): string;
3398
+ }
3399
+ /**
3400
+ * Class representing an unresolved track.
3401
+ * @class UnresolvedTrack
3402
+ * @implements {UnresolvedLavalinkTrack}
3403
+ */
3404
+ declare class UnresolvedTrack implements UnresolvedLavalinkTrack {
3310
3405
  /**
3311
- * The queue of the player.
3312
- * @type {QueueJson}
3406
+ * The base64 encoded track.
3407
+ * @type {string | undefined}
3313
3408
  */
3314
- queue: QueueJson;
3409
+ readonly encoded?: string;
3315
3410
  /**
3316
- * The node of the player.
3317
- * @type {NodeJson}
3411
+ * The track info.
3412
+ * @type {UnresolvedTrackInfo}
3318
3413
  */
3319
- node: NodeJson;
3414
+ readonly info: UnresolvedTrackInfo;
3320
3415
  /**
3321
- * The filter settings of the player.
3322
- * @type {FilterSettings}
3416
+ * The plugin info of the track.
3417
+ * @type {Partial<PluginInfo>}
3323
3418
  */
3324
- filters: FilterSettings;
3325
- }
3326
- /**
3327
- * The lyrics methods for the player.
3328
- */
3329
- interface LyricsMethods {
3419
+ readonly pluginInfo?: Partial<PluginInfo>;
3330
3420
  /**
3331
- *
3332
- * Get the current lyrics for the current track.
3333
- * @param {boolean} [skipSource=false] Whether to skip the source or not.
3334
- * @returns {Promise<LyricsResult | null>} The lyrics result or null if not found.
3335
- * @example
3336
- * ```ts
3337
- * const player = manager.getPlayer("guildId");
3338
- * const lyrics = await player.lyricsManager.current();
3339
- * ```
3421
+ * The track user data.
3422
+ * @type {TrackUserData | undefined}
3340
3423
  */
3341
- current(skipSource?: boolean): Promise<LyricsResult | null>;
3424
+ userData?: TrackUserData;
3342
3425
  /**
3343
- *
3344
- * Get the lyrics for a specific track.
3345
- * @param {Track} track The track to get the lyrics for.
3346
- * @param {boolean} [skipSource=false] Whether to skip the source or not.
3347
- * @returns {Promise<LyricsResult | null>} The lyrics result or null if not found.
3348
- * @example
3349
- * ```ts
3350
- * const player = manager.getPlayer("guildId");
3351
- * const track = player.queue.current;
3352
- * const lyrics = await player.lyrics.get(track);
3353
- * ```
3426
+ * The requester of the track.
3427
+ * @type {TrackRequester | undefined}
3354
3428
  */
3355
- get(track: Track, skipSource?: boolean): Promise<LyricsResult | null>;
3429
+ requester: TrackRequester;
3356
3430
  /**
3357
- *
3358
- * Subscribe to the lyrics for a specific guild.
3359
- * @param {boolean} [skipSource=false] Whether to skip the source or not.
3360
- * @returns {Promise<void>} Let's start the sing session!
3431
+ * The constructor for the track.
3432
+ * @param {UnresolvedLavalinkTrack} track The track to construct the track from.
3433
+ * @param {TrackRequester} requester The requester of the track.
3361
3434
  * @example
3362
3435
  * ```ts
3363
- * const player = manager.getPlayer("guildId");
3364
- * await player.lyrics.subscribe();
3436
+ * const track = new UnresolvedTrack({
3437
+ * encoded: "base64",
3438
+ * info: {
3439
+ * title: "Track Title",
3440
+ * },
3441
+ * // the rest of the track info
3442
+ * }, requester);
3443
+ *
3444
+ * console.log(track.encoded); // the track encoded in base64
3365
3445
  * ```
3366
3446
  */
3367
- subscribe(skipSource?: boolean): Promise<void>;
3447
+ constructor(track: UnresolvedLavalinkTrack, requester?: TrackRequester);
3368
3448
  /**
3369
- *
3370
- * Unsubscribe from the lyrics for a specific guild.
3371
- * @returns {Promise<void>} Let's stop the sing session!
3372
- * @example
3373
- * ```ts
3374
- * const player = manager.getPlayer("guildId");
3375
- * await player.lyrics.unsubscribe();
3376
- * ```
3449
+ * Resolves the track to a playable track.
3450
+ * @param {PlayerStructure} player The player to resolve the track for.
3451
+ * @returns {Promise<Track>} The resolved track.
3452
+ * @throws {ResolveError} If the track cannot be resolved.
3377
3453
  */
3378
- unsubscribe(): Promise<void>;
3454
+ resolve(player: PlayerStructure): Promise<Track>;
3379
3455
  }
3380
3456
  /**
3381
- * The voice channel update options.
3457
+ * Type representing a Hoshimi track, which can be either a resolved or unresolved track.
3382
3458
  */
3383
- type VoiceChannelUpdate = Pick<PlayerOptions, "selfDeaf" | "voiceId" | "selfMute">;
3459
+ type HoshimiTrack = Track | UnresolvedTrack;
3384
3460
  /**
3385
- * The voice settings for the player.
3461
+ * Interface representing an extendable track.
3386
3462
  */
3387
- type LavalinkPlayerVoice = Omit<PlayerVoice, "connected" | "ping">;
3463
+ interface CustomizableTrack {
3464
+ }
3465
+ /**
3466
+ * The requester of the track.
3467
+ */
3468
+ type TrackRequester = Inferable<CustomizableTrack, "requester">;
3469
+ /**
3470
+ * The user data of the track.
3471
+ */
3472
+ type TrackUserData = Inferable<CustomizableTrack, "userData">;
3388
3473
 
3389
3474
  /**
3390
3475
  * The states.
@@ -3954,9 +4039,9 @@ interface LavalinkTrack {
3954
4039
  info: TrackInfo;
3955
4040
  /**
3956
4041
  * The user data of the track.
3957
- * @type {Record<string, unknown> | undefined}
4042
+ * @type {TrackUserData | undefined}
3958
4043
  */
3959
- userData?: Record<string, unknown>;
4044
+ userData?: TrackUserData;
3960
4045
  }
3961
4046
  interface UnresolvedLavalinkTrack {
3962
4047
  /**
@@ -3976,9 +4061,9 @@ interface UnresolvedLavalinkTrack {
3976
4061
  pluginInfo?: Partial<PluginInfo>;
3977
4062
  /**
3978
4063
  * The user data of the track.
3979
- * @type {Record<string, unknown> | undefined}
4064
+ * @type {TrackUserData | undefined}
3980
4065
  */
3981
- userData?: Record<string, unknown>;
4066
+ userData?: TrackUserData;
3982
4067
  }
3983
4068
  /**
3984
4069
  * The track information.
@@ -5168,6 +5253,10 @@ declare enum Events {
5168
5253
  * Emitted when the player is destroyed.
5169
5254
  */
5170
5255
  PlayerDestroy = "playerDestroy",
5256
+ /**
5257
+ * Emitted when the player has an error.
5258
+ */
5259
+ PlayerError = "playerError",
5171
5260
  /**
5172
5261
  * Emitted when a track starts playing.
5173
5262
  */
@@ -5236,7 +5325,15 @@ declare enum DestroyReasons {
5236
5325
  /**
5237
5326
  * The player was destroyed because the voice channel was deleted.
5238
5327
  */
5239
- VoiceChannelDeleted = "Player-VoiceChannelDeleted"
5328
+ VoiceChannelDeleted = "Player-VoiceChannelDeleted",
5329
+ /**
5330
+ * The player was destroyed because it left the voice channel.
5331
+ */
5332
+ VoiceChannelLeft = "Player-VoiceChannelLeft",
5333
+ /**
5334
+ * The player was destroyed because it failed to reconnect.
5335
+ */
5336
+ ReconnectFailed = "Player-ReconnectFailed"
5240
5337
  }
5241
5338
  /**
5242
5339
  * The client data for the manager.
@@ -5335,6 +5432,11 @@ interface HoshimiOptions {
5335
5432
  * @type {HoshimiRestOptions}
5336
5433
  */
5337
5434
  restOptions?: HoshimiRestOptions;
5435
+ /**
5436
+ * The player options to use.
5437
+ * @type {HoshimiPlayerOptions}
5438
+ */
5439
+ playerOptions?: HoshimiPlayerOptions;
5338
5440
  }
5339
5441
  /**
5340
5442
  * The events for the manager.
@@ -5417,6 +5519,12 @@ interface HoshimiEvents {
5417
5519
  * @param {string} reason The reason for the destroy.
5418
5520
  */
5419
5521
  playerDestroy: [player: PlayerStructure, reason: string];
5522
+ /**
5523
+ * Emitted when the player has an error.
5524
+ * @param {PlayerStructure} player The player that emitted the event.
5525
+ * @param {Error | unknown} error The error that was emitted.
5526
+ */
5527
+ playerError: [player: PlayerStructure, error: Error | unknown];
5420
5528
  /**
5421
5529
  * Emitted when a track starts playing.
5422
5530
  * @param {PlayerStructure} player The player that emitted the event.
@@ -5799,10 +5907,24 @@ declare class Hoshimi extends EventEmitter<RawEvents> {
5799
5907
  * resumeByLibrary: false,
5800
5908
  * },
5801
5909
  * queueOptions: {
5802
- * maxPreviousTracks: 25,
5803
- * autoplayFn: autoplayFn,
5804
- * autoPlay: false,
5910
+ * maxHistory: 25,
5911
+ * autoplayFn: autoplayFn,
5912
+ * autoPlay: false,
5913
+ * storage: new MemoryAdapter(),
5914
+ * requesterFn: defaultRequesterFn,
5805
5915
  * },
5916
+ * playerOptions: {
5917
+ * onDisconnect: {
5918
+ * autoDestroy: false,
5919
+ * autoReconnect: false,
5920
+ * autoQueue: false,
5921
+ * },
5922
+ * onError: {
5923
+ * autoDestroy: false,
5924
+ * autoSkip: false,
5925
+ * autoStop: false,
5926
+ * },
5927
+ * },
5806
5928
  * });
5807
5929
  *
5808
5930
  * console.log(manager); // The manager instance
@@ -5936,4 +6058,4 @@ declare class MemoryAdapter<T extends QueueJson = QueueJson> extends StorageAdap
5936
6058
  stringify<R = string>(value: unknown): R;
5937
6059
  }
5938
6060
 
5939
- 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 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 TremoloSettings, type UnresolvedLavalinkTrack, UnresolvedTrack, type UnresolvedTrackInfo, type UpdatePlayerInfo, type UserAgent, type VoiceChannelUpdate, type VoicePacket, type VoiceServer, type VoiceState, type WebSocketClosedEvent, WebsocketCloseCodes, createHoshimi };
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 };