lavalink-client 2.6.7 → 2.7.1

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/README.md CHANGED
@@ -108,17 +108,21 @@ pnpm add tomato6966/lavalink-client
108
108
  ## 💖 Used In
109
109
  This client powers various Discord bots:
110
110
  - **[Mivator](https://discord.gg/5dUb7M2qCj)** (Public Bot by @Tomato6966)
111
- - **[Betty](https://betty.cx/)** (Public Bot by fb_sean)
111
+ - **[Betty](https://betty.bot/?utm_source=lavalink-client)** (Public Bot by @fb_sean)
112
+ - **[Nero](https://betty.bot/?utm_source=lavalink-client)** (Public Bot by @fb_sean)
112
113
  - **Bots by Contributors:**
113
114
  - [Mintone](https://mintone.tech/) (@appujet)
114
115
  - [Stelle](https://github.com/Ganyu-Studios/stelle-music) (@EvilG-MC)
115
116
  - [Panais](https://panais.xyz/) (@LucasB25)
116
117
  - [Akyn](https://akynbot.vercel.app/) (@notdeltaxd)
117
118
  - [ARINO](https://site.arinoapp.qzz.io/) (@ryanwtf88)
119
+ - [iHorizon](https://github.com/ihrz/ihrz) (@iHorizon)
118
120
  - **Bots Community (Users):**
119
121
  - [Soundy](https://github.com/idMJA/Soundy) (@idMJA)
120
- - [BeatBot ](https://getbeatbot.vercel.app/) (@zenitsujs)
122
+ - [BeatBot](https://getbeatbot.vercel.app/) (@zenitsujs)
121
123
  - [Atom Music](https://top.gg/bot/1320469557411971165) (@sakshamyep)
124
+ - [All Time Bot](https://top.gg/bot/1163027457671180418) (@PeterGamez)
125
+ - [BeatDock](https://github.com/lazaroagomez/BeatDock) (@lazaroagomez)
122
126
 
123
127
  ***
124
128
 
@@ -459,5 +463,3 @@ if (response.tracks.length > 0) {
459
463
  </details>
460
464
 
461
465
  </div>
462
-
463
-
package/dist/index.d.mts CHANGED
@@ -210,6 +210,7 @@ declare enum DebugEvents {
210
210
  PlayerUpdateSuccess = "PlayerUpdateSuccess",
211
211
  HeartBeatTriggered = "HeartBeatTriggered",
212
212
  NoSocketOnDestroy = "NoSocketOnDestroy",
213
+ SocketCleanupError = "SocketCleanupError",
213
214
  SocketTerminateHeartBeatTimeout = "SocketTerminateHeartBeatTimeout",
214
215
  TryingConnectWhileConnected = "TryingConnectWhileConnected",
215
216
  LavaSearchNothingFound = "LavaSearchNothingFound",
@@ -704,138 +705,6 @@ declare class FilterManager {
704
705
  clearEQ(): Promise<this>;
705
706
  }
706
707
 
707
- /** Sourcenames provided by lavalink server */
708
- type LavalinkSourceNames = "youtube" | "youtubemusic" | "soundcloud" | "bandcamp" | "twitch";
709
- /** Source Names provided by lava src plugin */
710
- type LavalinkPlugin_LavaSrc_SourceNames = "deezer" | "spotify" | "applemusic" | "yandexmusic" | "flowery-tts" | "vkmusic" | "tidal" | "qobuz" | "pandora";
711
- /** Source Names provided by jiosaavan plugin */
712
- type LavalinkPlugin_JioSaavn_SourceNames = "jiosaavn";
713
- /** The SourceNames provided by lavalink */
714
- type SourceNames = LavalinkSourceNames | LavalinkPlugin_LavaSrc_SourceNames | LavalinkPlugin_JioSaavn_SourceNames;
715
- interface LavalinkTrackInfo {
716
- /** The Identifier of the Track */
717
- identifier: string;
718
- /** The Track Title / Name */
719
- title: string;
720
- /** The Name of the Author */
721
- author: string;
722
- /** The duration of the Track */
723
- length: number;
724
- /** The URL of the artwork if available */
725
- artworkUrl: string | null;
726
- /** The URL (aka Link) of the Track called URI */
727
- uri: string;
728
- /** The Source name of the Track, e.g. soundcloud, youtube, spotify */
729
- sourceName: SourceNames;
730
- /** Wether the audio is seekable */
731
- isSeekable: boolean;
732
- /** Wether the audio is of a live stream */
733
- isStream: boolean;
734
- /** If isrc code is available, it's provided */
735
- isrc: string | null;
736
- }
737
- interface TrackInfo {
738
- /** The Identifier of the Track */
739
- identifier: string;
740
- /** The Track Title / Name */
741
- title: string;
742
- /** The Name of the Author */
743
- author: string;
744
- /** The duration of the Track */
745
- duration: number;
746
- /** The URL of the artwork if available */
747
- artworkUrl: string | null;
748
- /** The URL (aka Link) of the Track called URI */
749
- uri: string;
750
- /** The Source name of the Track, e.g. soundcloud, youtube, spotify */
751
- sourceName: SourceNames;
752
- /** Wether the audio is seekable */
753
- isSeekable: boolean;
754
- /** Wether the audio is of a live stream */
755
- isStream: boolean;
756
- /** If isrc code is available, it's provided */
757
- isrc: string | null;
758
- }
759
- interface PluginInfo {
760
- /** The Type provided by a plugin */
761
- type?: "album" | "playlist" | "artist" | "recommendations" | string;
762
- /** The Identifier provided by a plugin */
763
- albumName?: string;
764
- /** The url of the album */
765
- albumUrl?: string;
766
- /** The url of the album art */
767
- albumArtUrl?: string;
768
- /** The url of the artist */
769
- artistUrl?: string;
770
- /** The url of the artist artwork */
771
- artistArtworkUrl?: string;
772
- /** The url of the preview */
773
- previewUrl?: string;
774
- /** Whether the track is a preview */
775
- isPreview?: boolean;
776
- /** The total number of tracks in the playlist */
777
- totalTracks?: number;
778
- /** The Identifier provided by a plugin */
779
- identifier?: string;
780
- /** The ArtworkUrl provided by a plugin */
781
- artworkUrl?: string;
782
- /** The Author Information provided by a plugin */
783
- author?: string;
784
- /** The Url provided by a Plugin */
785
- url?: string;
786
- /** The Url provided by a Plugin */
787
- uri?: string;
788
- /** You can put specific track information here, to transform the tracks... */
789
- clientData?: {
790
- previousTrack?: boolean;
791
- [key: string]: any;
792
- };
793
- }
794
- interface LavalinkTrack {
795
- /** The Base 64 encoded String */
796
- encoded?: Base64;
797
- /** Track Information */
798
- info: LavalinkTrackInfo;
799
- /** Plugin Information from Lavalink */
800
- pluginInfo: Partial<PluginInfo>;
801
- /** The userData Object from when you provide to the lavalink request */
802
- userData?: anyObject;
803
- }
804
- interface Track {
805
- /** The Base 64 encoded String */
806
- encoded?: Base64;
807
- /** Track Information */
808
- info: TrackInfo;
809
- /** Plugin Information from Lavalink */
810
- pluginInfo: Partial<PluginInfo>;
811
- /** The Track's Requester */
812
- requester?: unknown;
813
- /** The userData Object from when you provide to the lavalink request */
814
- userData?: anyObject;
815
- }
816
- interface UnresolvedTrackInfo extends Partial<TrackInfo> {
817
- /** Required */
818
- title: string;
819
- }
820
- interface UnresolvedQuery extends UnresolvedTrackInfo {
821
- /** The base64 of the unresolved track to "encode" */
822
- encoded?: Base64;
823
- }
824
- interface UnresolvedTrack {
825
- /** Required */
826
- resolve: (player: Player) => Promise<void>;
827
- /** The Base 64 encoded String */
828
- encoded?: Base64;
829
- /** Track Information */
830
- info: UnresolvedTrackInfo;
831
- /** Plugin Information from Lavalink */
832
- pluginInfo: Partial<PluginInfo>;
833
- /** The userData Object from when you provide to the lavalink request */
834
- userData?: anyObject;
835
- /** The Track's Requester */
836
- requester?: unknown;
837
- }
838
-
839
708
  declare class QueueSaver {
840
709
  /**
841
710
  * The queue store manager
@@ -977,6 +846,7 @@ declare class Queue {
977
846
  * - single Track | UnresolvedTrack
978
847
  * - multiple Track | UnresovedTrack
979
848
  * - at the index or multiple indexes
849
+ * - Since v2.7 the removed tracks get unshifted into the previous queue state instead of pushed (indexed at the start instead of end - as it should)
980
850
  * @param removeQueryTrack
981
851
  * @returns null (if nothing was removed) / { removed } where removed is an array with all removed elements
982
852
  *
@@ -1249,6 +1119,138 @@ declare class Player {
1249
1119
  toJSON(): PlayerJson;
1250
1120
  }
1251
1121
 
1122
+ /** Sourcenames provided by lavalink server */
1123
+ type LavalinkSourceNames = "youtube" | "youtubemusic" | "soundcloud" | "bandcamp" | "twitch";
1124
+ /** Source Names provided by lava src plugin */
1125
+ type LavalinkPlugin_LavaSrc_SourceNames = "deezer" | "spotify" | "applemusic" | "yandexmusic" | "flowery-tts" | "vkmusic" | "tidal" | "qobuz" | "pandora";
1126
+ /** Source Names provided by jiosaavan plugin */
1127
+ type LavalinkPlugin_JioSaavn_SourceNames = "jiosaavn";
1128
+ /** The SourceNames provided by lavalink */
1129
+ type SourceNames = LavalinkSourceNames | LavalinkPlugin_LavaSrc_SourceNames | LavalinkPlugin_JioSaavn_SourceNames;
1130
+ interface LavalinkTrackInfo {
1131
+ /** The Identifier of the Track */
1132
+ identifier: string;
1133
+ /** The Track Title / Name */
1134
+ title: string;
1135
+ /** The Name of the Author */
1136
+ author: string;
1137
+ /** The duration of the Track */
1138
+ length: number;
1139
+ /** The URL of the artwork if available */
1140
+ artworkUrl: string | null;
1141
+ /** The URL (aka Link) of the Track called URI */
1142
+ uri: string;
1143
+ /** The Source name of the Track, e.g. soundcloud, youtube, spotify */
1144
+ sourceName: SourceNames;
1145
+ /** Wether the audio is seekable */
1146
+ isSeekable: boolean;
1147
+ /** Wether the audio is of a live stream */
1148
+ isStream: boolean;
1149
+ /** If isrc code is available, it's provided */
1150
+ isrc: string | null;
1151
+ }
1152
+ interface TrackInfo {
1153
+ /** The Identifier of the Track */
1154
+ identifier: string;
1155
+ /** The Track Title / Name */
1156
+ title: string;
1157
+ /** The Name of the Author */
1158
+ author: string;
1159
+ /** The duration of the Track */
1160
+ duration: number;
1161
+ /** The URL of the artwork if available */
1162
+ artworkUrl: string | null;
1163
+ /** The URL (aka Link) of the Track called URI */
1164
+ uri: string;
1165
+ /** The Source name of the Track, e.g. soundcloud, youtube, spotify */
1166
+ sourceName: SourceNames;
1167
+ /** Wether the audio is seekable */
1168
+ isSeekable: boolean;
1169
+ /** Wether the audio is of a live stream */
1170
+ isStream: boolean;
1171
+ /** If isrc code is available, it's provided */
1172
+ isrc: string | null;
1173
+ }
1174
+ interface PluginInfo {
1175
+ /** The Type provided by a plugin */
1176
+ type?: "album" | "playlist" | "artist" | "recommendations" | string;
1177
+ /** The Identifier provided by a plugin */
1178
+ albumName?: string;
1179
+ /** The url of the album */
1180
+ albumUrl?: string;
1181
+ /** The url of the album art */
1182
+ albumArtUrl?: string;
1183
+ /** The url of the artist */
1184
+ artistUrl?: string;
1185
+ /** The url of the artist artwork */
1186
+ artistArtworkUrl?: string;
1187
+ /** The url of the preview */
1188
+ previewUrl?: string;
1189
+ /** Whether the track is a preview */
1190
+ isPreview?: boolean;
1191
+ /** The total number of tracks in the playlist */
1192
+ totalTracks?: number;
1193
+ /** The Identifier provided by a plugin */
1194
+ identifier?: string;
1195
+ /** The ArtworkUrl provided by a plugin */
1196
+ artworkUrl?: string;
1197
+ /** The Author Information provided by a plugin */
1198
+ author?: string;
1199
+ /** The Url provided by a Plugin */
1200
+ url?: string;
1201
+ /** The Url provided by a Plugin */
1202
+ uri?: string;
1203
+ /** You can put specific track information here, to transform the tracks... */
1204
+ clientData?: {
1205
+ previousTrack?: boolean;
1206
+ [key: string]: any;
1207
+ };
1208
+ }
1209
+ interface LavalinkTrack {
1210
+ /** The Base 64 encoded String */
1211
+ encoded?: Base64;
1212
+ /** Track Information */
1213
+ info: LavalinkTrackInfo;
1214
+ /** Plugin Information from Lavalink */
1215
+ pluginInfo: Partial<PluginInfo>;
1216
+ /** The userData Object from when you provide to the lavalink request */
1217
+ userData?: anyObject;
1218
+ }
1219
+ interface Track {
1220
+ /** The Base 64 encoded String */
1221
+ encoded?: Base64;
1222
+ /** Track Information */
1223
+ info: TrackInfo;
1224
+ /** Plugin Information from Lavalink */
1225
+ pluginInfo: Partial<PluginInfo>;
1226
+ /** The Track's Requester */
1227
+ requester?: unknown;
1228
+ /** The userData Object from when you provide to the lavalink request */
1229
+ userData?: anyObject;
1230
+ }
1231
+ interface UnresolvedTrackInfo extends Partial<TrackInfo> {
1232
+ /** Required */
1233
+ title: string;
1234
+ }
1235
+ interface UnresolvedQuery extends UnresolvedTrackInfo {
1236
+ /** The base64 of the unresolved track to "encode" */
1237
+ encoded?: Base64;
1238
+ }
1239
+ interface UnresolvedTrack {
1240
+ /** Required */
1241
+ resolve: (player: Player) => Promise<void>;
1242
+ /** The Base 64 encoded String */
1243
+ encoded?: Base64;
1244
+ /** Track Information */
1245
+ info: UnresolvedTrackInfo;
1246
+ /** Plugin Information from Lavalink */
1247
+ pluginInfo: Partial<PluginInfo>;
1248
+ /** The userData Object from when you provide to the lavalink request */
1249
+ userData?: anyObject;
1250
+ /** The Track's Requester */
1251
+ requester?: unknown;
1252
+ }
1253
+
1252
1254
  interface StoredQueue {
1253
1255
  current: Track | null;
1254
1256
  previous: Track[];
@@ -1266,7 +1268,7 @@ interface QueueStoreManager {
1266
1268
  /** @async Parse the saved value back to the Queue (IF YOU DON'T NEED PARSING/STRINGIFY, then just return the value) */
1267
1269
  parse: (value: StoredQueue | string) => Awaitable<Partial<StoredQueue>>;
1268
1270
  }
1269
- interface ManagerQueueOptions<CustomPlayerT extends Player = Player> {
1271
+ interface ManagerQueueOptions {
1270
1272
  /** Maximum Amount of tracks for the queue.previous array. Set to 0 to not save previous songs. Defaults to 25 Tracks */
1271
1273
  maxPreviousTracks?: number;
1272
1274
  /** Custom Queue Store option */
@@ -1916,20 +1918,6 @@ interface LyricsFoundEvent extends PlayerEvent {
1916
1918
  /** The lyrics */
1917
1919
  lyrics: LyricsResult;
1918
1920
  }
1919
- interface LyricsFoundEvent extends PlayerEvent {
1920
- /** The lyricsfound event */
1921
- type: "LyricsFoundEvent";
1922
- /** The guildId */
1923
- guildId: string;
1924
- /** The lyrics */
1925
- lyrics: LyricsResult;
1926
- }
1927
- interface LyricsNotFoundEvent extends PlayerEvent {
1928
- /**The lyricsnotfound event*/
1929
- type: "LyricsNotFoundEvent";
1930
- /**The guildId*/
1931
- guildId: string;
1932
- }
1933
1921
  interface LyricsNotFoundEvent extends PlayerEvent {
1934
1922
  /**The lyricsnotfound event*/
1935
1923
  type: "LyricsNotFoundEvent";
@@ -1948,18 +1936,6 @@ interface LyricsLineEvent extends PlayerEvent {
1948
1936
  /**skipped is true if the line was skipped */
1949
1937
  skipped: boolean;
1950
1938
  }
1951
- interface LyricsLineEvent extends PlayerEvent {
1952
- /**The lyricsline event*/
1953
- type: "LyricsLineEvent";
1954
- /** The guildId */
1955
- guildId: string;
1956
- /** The line number */
1957
- lineIndex: number;
1958
- /** The line */
1959
- line: LyricsLine;
1960
- /**skipped is true if the line was skipped */
1961
- skipped: boolean;
1962
- }
1963
1939
  type LoadTypes = "track" | "playlist" | "search" | "error" | "empty";
1964
1940
  type State = "CONNECTED" | "CONNECTING" | "DISCONNECTED" | "DISCONNECTING" | "DESTROYING";
1965
1941
  type PlayerEventType = "TrackStartEvent" | "TrackEndEvent" | "TrackExceptionEvent" | "TrackStuckEvent" | "WebSocketClosedEvent" | SponsorBlockSegmentEventType | LyricsEventType;
@@ -2619,6 +2595,18 @@ declare class LavalinkNode {
2619
2595
  * ```
2620
2596
  */
2621
2597
  private reconnect;
2598
+ /**
2599
+ * Private function to reset the reconnection attempts
2600
+ * @returns
2601
+ */
2602
+ private resetReconnectionAttempts;
2603
+ /**
2604
+ * Private function to reset timeouts/intervals for heartbeating/pinging
2605
+ * @param heartbeat
2606
+ * @param ping
2607
+ * @returns
2608
+ */
2609
+ private resetAckTimeouts;
2622
2610
  /** @private util function for handling opening events from websocket */
2623
2611
  private open;
2624
2612
  /** @private util function for handling closing events from websocket */
@@ -3040,7 +3028,7 @@ interface ManagerOptions<CustomPlayerT extends Player = Player> {
3040
3028
  /** The Bot Client's Data for Authorization */
3041
3029
  client?: BotClientOptions;
3042
3030
  /** QueueOptions for all Queues */
3043
- queueOptions?: ManagerQueueOptions<CustomPlayerT>;
3031
+ queueOptions?: ManagerQueueOptions;
3044
3032
  /** PlayerOptions for all Players */
3045
3033
  playerOptions?: ManagerPlayerOptions<CustomPlayerT>;
3046
3034
  /** The player class you want to use when creating a player. (can be extendable) */