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