lavalink-client 2.3.4 → 2.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/README.md +225 -2
  2. package/dist/cjs/index.d.ts +16 -16
  3. package/dist/cjs/index.js +16 -16
  4. package/dist/cjs/structures/Constants.d.ts +2 -1
  5. package/dist/cjs/structures/Constants.js +1 -0
  6. package/dist/cjs/structures/CustomSearches/BandCampSearch.d.ts +2 -2
  7. package/dist/cjs/structures/Filters.d.ts +2 -2
  8. package/dist/cjs/structures/Filters.js +1 -1
  9. package/dist/cjs/structures/LavalinkManager.d.ts +6 -6
  10. package/dist/cjs/structures/LavalinkManager.js +5 -5
  11. package/dist/cjs/structures/LavalinkManagerStatics.d.ts +3 -1
  12. package/dist/cjs/structures/LavalinkManagerStatics.js +11 -2
  13. package/dist/cjs/structures/Node.d.ts +86 -6
  14. package/dist/cjs/structures/Node.js +147 -3
  15. package/dist/cjs/structures/NodeManager.d.ts +4 -4
  16. package/dist/cjs/structures/NodeManager.js +3 -3
  17. package/dist/cjs/structures/Player.d.ts +53 -10
  18. package/dist/cjs/structures/Player.js +55 -5
  19. package/dist/cjs/structures/Queue.d.ts +3 -3
  20. package/dist/cjs/structures/Queue.js +1 -1
  21. package/dist/cjs/structures/Types/Filters.d.ts +1 -1
  22. package/dist/cjs/structures/Types/Manager.d.ts +25 -7
  23. package/dist/cjs/structures/Types/Node.d.ts +26 -3
  24. package/dist/cjs/structures/Types/Player.d.ts +5 -5
  25. package/dist/cjs/structures/Types/Queue.d.ts +1 -1
  26. package/dist/cjs/structures/Types/Track.d.ts +3 -3
  27. package/dist/cjs/structures/Types/Utils.d.ts +68 -10
  28. package/dist/cjs/structures/Utils.d.ts +6 -6
  29. package/dist/cjs/structures/Utils.js +11 -2
  30. package/dist/esm/index.d.ts +16 -16
  31. package/dist/esm/index.js +16 -16
  32. package/dist/esm/structures/Constants.d.ts +2 -1
  33. package/dist/esm/structures/Constants.js +1 -0
  34. package/dist/esm/structures/CustomSearches/BandCampSearch.d.ts +2 -2
  35. package/dist/esm/structures/Filters.d.ts +2 -2
  36. package/dist/esm/structures/Filters.js +1 -1
  37. package/dist/esm/structures/LavalinkManager.d.ts +6 -6
  38. package/dist/esm/structures/LavalinkManager.js +5 -5
  39. package/dist/esm/structures/LavalinkManagerStatics.d.ts +3 -1
  40. package/dist/esm/structures/LavalinkManagerStatics.js +11 -2
  41. package/dist/esm/structures/Node.d.ts +86 -6
  42. package/dist/esm/structures/Node.js +147 -3
  43. package/dist/esm/structures/NodeManager.d.ts +4 -4
  44. package/dist/esm/structures/NodeManager.js +3 -3
  45. package/dist/esm/structures/Player.d.ts +53 -10
  46. package/dist/esm/structures/Player.js +55 -5
  47. package/dist/esm/structures/Queue.d.ts +3 -3
  48. package/dist/esm/structures/Queue.js +1 -1
  49. package/dist/esm/structures/Types/Filters.d.ts +1 -1
  50. package/dist/esm/structures/Types/Manager.d.ts +25 -7
  51. package/dist/esm/structures/Types/Node.d.ts +26 -3
  52. package/dist/esm/structures/Types/Player.d.ts +5 -5
  53. package/dist/esm/structures/Types/Queue.d.ts +1 -1
  54. package/dist/esm/structures/Types/Track.d.ts +3 -3
  55. package/dist/esm/structures/Types/Utils.d.ts +68 -10
  56. package/dist/esm/structures/Utils.d.ts +6 -6
  57. package/dist/esm/structures/Utils.js +11 -2
  58. package/dist/types/structures/Constants.d.ts +1 -0
  59. package/dist/types/structures/LavalinkManagerStatics.d.ts +2 -0
  60. package/dist/types/structures/Node.d.ts +81 -1
  61. package/dist/types/structures/Player.d.ts +43 -0
  62. package/dist/types/structures/Types/Manager.d.ts +19 -1
  63. package/dist/types/structures/Types/Node.d.ts +23 -0
  64. package/dist/types/structures/Types/Utils.d.ts +64 -6
  65. package/package.json +1 -1
package/README.md CHANGED
@@ -106,6 +106,198 @@ Check out the [Documentation](https://lc4.gitbook.io/lavalink-client) | or the [
106
106
 
107
107
  ***
108
108
 
109
+ # Sample Configuration
110
+
111
+
112
+ <details><summary>Complete Configuration Example, with all available options</summary>
113
+
114
+ ```ts
115
+ import { LavalinkManager, QueueChangesWatcher, QueueStoreManager } from "lavalink-client";
116
+ import { RedisClientType } from "redis"; // example for custom queue store
117
+ import { Client, GatewayIntentBits } from "discord.js"; // example for a discord bot
118
+
119
+ // you might want to extend the types of the client, to bind lavalink to it.
120
+ const client = new Client({
121
+ intents: [
122
+ GatewayIntentBits.Guilds,
123
+ GatewayIntentBits.GuildVoiceStates,
124
+ ]
125
+ });
126
+
127
+ const previouslyUsedSessions = new Map<string, string>(); //nodeManager.on("connect", node => previouslyUsedSessions.set(node.id, node.sessionId))
128
+
129
+ client.lavalink = new LavalinkManager({
130
+ nodes: [
131
+ {
132
+ authorization: "localhoist",
133
+ host: "localhost",
134
+ port: 2333,
135
+ id: "testnode",
136
+ // get the previously used session, to restart with "resuming" enabled
137
+ sessionId: previouslyUsedSessions.get("testnode"),
138
+ requestSignalTimeoutMS: 3000,
139
+ closeOnError: true,
140
+ heartBeatInterval: 30_000,
141
+ enablePingOnStatsCheck: true,
142
+ retryDelay: 10e3,
143
+ secure: false,
144
+ retryAmount: 5,
145
+ }
146
+ ],
147
+ sendToShard: (guildId, payload) => client.guilds.cache.get(guildId)?.shard?.send(payload),
148
+ autoSkip: true,
149
+ client: { // client: client.user
150
+ id: envConfig.clientId, // REQUIRED! (at least after the .init)
151
+ username: "TESTBOT",
152
+ },
153
+ autoSkipOnResolveError: true, // skip song, if resolving an unresolved song fails
154
+ emitNewSongsOnly: true, // don't emit "looping songs"
155
+ playerOptions: {
156
+ // These are the default prevention methods
157
+ maxErrorsPerTime: {
158
+ threshold: 10_000,
159
+ maxAmount: 3,
160
+ },
161
+ // only allow an autoplay function to execute, if the previous function was longer ago than this number.
162
+ minAutoPlayMs: 10_000,
163
+
164
+ applyVolumeAsFilter: false,
165
+ clientBasedPositionUpdateInterval: 50, // in ms to up-calc player.position
166
+ defaultSearchPlatform: "ytmsearch",
167
+ volumeDecrementer: 0.75, // on client 100% == on lavalink 75%
168
+ requesterTransformer: requesterTransformer,
169
+ onDisconnect: {
170
+ autoReconnect: true, // automatically attempts a reconnect, if the bot disconnects from the voice channel, if it fails, it get's destroyed
171
+ destroyPlayer: false // overrides autoReconnect and directly destroys the player if the bot disconnects from the vc
172
+ },
173
+ onEmptyQueue: {
174
+ destroyAfterMs: 30_000, // 0 === instantly destroy | don't provide the option, to don't destroy the player
175
+ autoPlayFunction: autoPlayFunction,
176
+ },
177
+ useUnresolvedData: true,
178
+ },
179
+ queueOptions: {
180
+ maxPreviousTracks: 10,
181
+ // only needed if you want and need external storage, don't provide if you don't need to
182
+ queueStore: new myCustomStore(client.redis), // client.redis = new redis()
183
+ // only needed, if you want to watch changes in the queue via a custom class,
184
+ queueChangesWatcher: new myCustomWatcher(client)
185
+ },
186
+ linksAllowed: true,
187
+ // example: don't allow p*rn / youtube links., you can also use a regex pattern if you want.
188
+ // linksBlacklist: ["porn", "youtube.com", "youtu.be"],
189
+ linksBlacklist: [],
190
+ linksWhitelist: [],
191
+ advancedOptions: {
192
+ enableDebugEvents: true,
193
+ maxFilterFixDuration: 600_000, // only allow instafixfilterupdate for tracks sub 10mins
194
+ debugOptions: {
195
+ noAudio: false,
196
+ playerDestroy: {
197
+ dontThrowError: false,
198
+ debugLog: false,
199
+ },
200
+ logCustomSearches: false,
201
+ }
202
+ }
203
+ });
204
+
205
+
206
+ client.on("raw", d => client.lavalink.sendRawData(d)); // send raw data to lavalink-client to handle stuff
207
+
208
+ client.on("ready", () => {
209
+ client.lavalink.init(client.user); // init lavalink
210
+ });
211
+
212
+ // for the custom queue Store create a redis instance
213
+ client.redis = createClient({ url: "redis://localhost:6379", password: "securepass" });
214
+ client.redis.connect();
215
+
216
+
217
+ // Custom external queue Store
218
+ export class myCustomStore implements QueueStoreManager {
219
+ private redis:RedisClientType;
220
+ constructor(redisClient:RedisClientType) {
221
+ this.redis = redisClient;
222
+ }
223
+ async get(guildId): Promise<any> {
224
+ return await this.redis.get(this.id(guildId));
225
+ }
226
+ async set(guildId, stringifiedQueueData): Promise<any> {
227
+ return await this.redis.set(this.id(guildId), stringifiedQueueData);
228
+ }
229
+ async delete(guildId): Promise<any> {
230
+ return await this.redis.del(this.id(guildId));
231
+ }
232
+ async parse(stringifiedQueueData): Promise<Partial<StoredQueue>> {
233
+ return JSON.parse(stringifiedQueueData);
234
+ }
235
+ async stringify(parsedQueueData): Promise<any> {
236
+ return JSON.stringify(parsedQueueData);
237
+ }
238
+ private id(guildId) {
239
+ return `lavalinkqueue_${guildId}`; // transform the id to your belikings
240
+ }
241
+ }
242
+
243
+ // Custom Queue Watcher Functions
244
+ export class myCustomWatcher implements QueueChangesWatcher {
245
+ constructor() {
246
+ }
247
+ shuffled(guildId, oldStoredQueue, newStoredQueue) {
248
+ console.log(`${this.client.guilds.cache.get(guildId)?.name || guildId}: Queue got shuffled`)
249
+ }
250
+ tracksAdd(guildId, tracks, position, oldStoredQueue, newStoredQueue) {
251
+ console.log(`${this.client.guilds.cache.get(guildId)?.name || guildId}: ${tracks.length} Tracks got added into the Queue at position #${position}`);
252
+ }
253
+ tracksRemoved(guildId, tracks, position, oldStoredQueue, newStoredQueue) {
254
+ console.log(`${this.client.guilds.cache.get(guildId)?.name || guildId}: ${tracks.length} Tracks got removed from the Queue at position #${position}`);
255
+ }
256
+ }
257
+ ```
258
+
259
+ </details>
260
+
261
+
262
+
263
+ ```ts
264
+ import { LavalinkManager } from "lavalink-client";
265
+ import { Client, GatewayIntentBits } from "discord.js"; // example for a discord bot
266
+
267
+ // you might want to extend the types of the client, to bind lavalink to it.
268
+ const client = new Client({
269
+ intents: [
270
+ GatewayIntentBits.Guilds,
271
+ GatewayIntentBits.GuildVoiceStates,
272
+ ]
273
+ });
274
+
275
+ // create instance
276
+ client.lavalink = new LavalinkManager({
277
+ nodes: [
278
+ {
279
+ authorization: "localhoist",
280
+ host: "localhost",
281
+ port: 2333,
282
+ id: "testnode",
283
+ }
284
+ ],
285
+ sendToShard: (guildId, payload) => client.guilds.cache.get(guildId)?.shard?.send(payload),
286
+ autoSkip: true,
287
+ client: {
288
+ id: envConfig.clientId,
289
+ username: "TESTBOT",
290
+ },
291
+ });
292
+
293
+ client.on("raw", d => client.lavalink.sendRawData(d)); // send raw data to lavalink-client to handle stuff
294
+
295
+ client.on("ready", () => {
296
+ client.lavalink.init(client.user); // init lavalink
297
+ });
298
+
299
+ ```
300
+
109
301
  # All Events:
110
302
 
111
303
  ## On **Lavalink-Manager**:
@@ -493,7 +685,7 @@ if(previousTrack) {
493
685
  - Fixed Export, where types of Manager weren't exported correctly
494
686
  - Fixed Dist Folder containing old, left over not needed files
495
687
 
496
- ## **Version 2.3.2**
688
+ ## **Version 2.3.2** / **Version 2.3.3**
497
689
  - Added Missing function calls for the QueueWatcher of tracksRemoved within the queue.remove() function:
498
690
  - Added new DestroyReasons:
499
691
  - TrackStuckMaxTracksErroredPerTime
@@ -516,4 +708,35 @@ if(previousTrack) {
516
708
  - The **` functionLayer `** string will show you where the debug event was triggered from
517
709
  - The **` message `** string will show what is debugged
518
710
  - The **` error `** object will show you the error that happened, if there was one.
519
- - *This took quite some time to code, and i am sure there are still many logs you might want, feel free to open an issue or commit with an PR, if you think something is missing!*
711
+ - *This took quite some time to code, and i am sure there are still many logs you might want, feel free to open an issue
712
+
713
+
714
+ ## **Version 2.3.4**
715
+ - Improved the package bundling with tsc-alias, to export files with file types
716
+ - Added package.json to exported dist, for easier parsing ability and compatibility with older and newer node versions
717
+ - Added error handling for resolving unresolved tracks on trackend
718
+
719
+
720
+ ## **Version 2.3.5**
721
+ - FIXED not able to import :: Accidentally removed tsc-alias configuration, which made importing not work
722
+ - FIXED autoplay not working :: Accidentally added an invalid if statement, which made autoplay not working anymore (during the if statement to not prevent autoplay spam)
723
+ - Added a new AutoplayExecution Debug Log
724
+ - Added more samples to the Testbot related configuration
725
+
726
+
727
+ ## **Version 2.3.6
728
+ - Added Lyrics Support:
729
+ - New Player Functions:
730
+ - **` const lyrics = await player.getCurrentLyrics(false); `** -> *Get lyrics of current playing track*
731
+ - **` const lyrics = await player.getLyrics(track, true); `** -> *Get lyrics of a specific track with ignoring it's sources*
732
+ - **` player.subscribeLyrics(); `** -> *Subscribe this guild to retrieve "live lyrics" as the song is *playing
733
+ - **` player.unsubscribeLyrics(); `** -> *Unsubscribe from lyrics
734
+ - New Node Functions ( same as from player, just so you can access it without player too ):*
735
+ - **` const lyrics = await player.node.lyrics.getCurrent(player.guildId, false); `**
736
+ - **` const lyrics = await player.node.lyrics.get(track, true); `**
737
+ - **` player.node.lyrics.subscribe(player.guildId); `**
738
+ - **` player.node.lyrics.unsubscribe(player.guildId); `**
739
+ - New Manager Event sfor Lyrics:
740
+ - **` lavalink.on("LyricsLine", (player, track, lyricsLine) => {}); `**
741
+ - **` lavalink.on("LyricsFound", (player, track, data) => {}); `**
742
+ - **` lavalink.on("LyricsNotFound", (player, track, lyricsLine) => {}); `**
@@ -1,16 +1,16 @@
1
- export * from "./structures/LavalinkManager";
2
- export * from "./structures/Filters";
3
- export * from "./structures/LavalinkManagerStatics";
4
- export * from "./structures/Node";
5
- export * from "./structures/NodeManager";
6
- export * from "./structures/Player";
7
- export * from "./structures/Queue";
8
- export * from "./structures/Utils";
9
- export * from "./structures/Types/Track";
10
- export * from "./structures/Types/Utils";
11
- export * from "./structures/Types/Filters";
12
- export * from "./structures/Types/Player";
13
- export * from "./structures/Types/Queue";
14
- export * from "./structures/Types/Node";
15
- export * from "./structures/Constants";
16
- export * from "./structures/Types/Manager";
1
+ export * from "./structures/LavalinkManager.js";
2
+ export * from "./structures/Filters.js";
3
+ export * from "./structures/LavalinkManagerStatics.js";
4
+ export * from "./structures/Node.js";
5
+ export * from "./structures/NodeManager.js";
6
+ export * from "./structures/Player.js";
7
+ export * from "./structures/Queue.js";
8
+ export * from "./structures/Utils.js";
9
+ export * from "./structures/Types/Track.js";
10
+ export * from "./structures/Types/Utils.js";
11
+ export * from "./structures/Types/Filters.js";
12
+ export * from "./structures/Types/Player.js";
13
+ export * from "./structures/Types/Queue.js";
14
+ export * from "./structures/Types/Node.js";
15
+ export * from "./structures/Constants.js";
16
+ export * from "./structures/Types/Manager.js";
package/dist/cjs/index.js CHANGED
@@ -1,19 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./structures/LavalinkManager"), exports);
5
- tslib_1.__exportStar(require("./structures/Filters"), exports);
6
- tslib_1.__exportStar(require("./structures/LavalinkManagerStatics"), exports);
7
- tslib_1.__exportStar(require("./structures/Node"), exports);
8
- tslib_1.__exportStar(require("./structures/NodeManager"), exports);
9
- tslib_1.__exportStar(require("./structures/Player"), exports);
10
- tslib_1.__exportStar(require("./structures/Queue"), exports);
11
- tslib_1.__exportStar(require("./structures/Utils"), exports);
12
- tslib_1.__exportStar(require("./structures/Types/Track"), exports);
13
- tslib_1.__exportStar(require("./structures/Types/Utils"), exports);
14
- tslib_1.__exportStar(require("./structures/Types/Filters"), exports);
15
- tslib_1.__exportStar(require("./structures/Types/Player"), exports);
16
- tslib_1.__exportStar(require("./structures/Types/Queue"), exports);
17
- tslib_1.__exportStar(require("./structures/Types/Node"), exports);
18
- tslib_1.__exportStar(require("./structures/Constants"), exports);
19
- tslib_1.__exportStar(require("./structures/Types/Manager"), exports);
4
+ tslib_1.__exportStar(require("./structures/LavalinkManager.js"), exports);
5
+ tslib_1.__exportStar(require("./structures/Filters.js"), exports);
6
+ tslib_1.__exportStar(require("./structures/LavalinkManagerStatics.js"), exports);
7
+ tslib_1.__exportStar(require("./structures/Node.js"), exports);
8
+ tslib_1.__exportStar(require("./structures/NodeManager.js"), exports);
9
+ tslib_1.__exportStar(require("./structures/Player.js"), exports);
10
+ tslib_1.__exportStar(require("./structures/Queue.js"), exports);
11
+ tslib_1.__exportStar(require("./structures/Utils.js"), exports);
12
+ tslib_1.__exportStar(require("./structures/Types/Track.js"), exports);
13
+ tslib_1.__exportStar(require("./structures/Types/Utils.js"), exports);
14
+ tslib_1.__exportStar(require("./structures/Types/Filters.js"), exports);
15
+ tslib_1.__exportStar(require("./structures/Types/Player.js"), exports);
16
+ tslib_1.__exportStar(require("./structures/Types/Queue.js"), exports);
17
+ tslib_1.__exportStar(require("./structures/Types/Node.js"), exports);
18
+ tslib_1.__exportStar(require("./structures/Constants.js"), exports);
19
+ tslib_1.__exportStar(require("./structures/Types/Manager.js"), exports);
@@ -1,8 +1,9 @@
1
- import type { AudioOutputs, ChannelMixFilter, EQBand } from "./Types/Filters";
1
+ import type { AudioOutputs, ChannelMixFilter, EQBand } from "./Types/Filters.js";
2
2
  export declare enum DebugEvents {
3
3
  SetSponsorBlock = "SetSponsorBlock",
4
4
  DeleteSponsorBlock = "DeleteSponsorBlock",
5
5
  TrackEndReplaced = "TrackEndReplaced",
6
+ AutoplayExecution = "AutoplayExecution",
6
7
  AutoplayNoSongsAdded = "AutoplayNoSongsAdded",
7
8
  AutoplayThresholdSpamLimiter = "AutoplayThresholdSpamLimiter",
8
9
  TriggerQueueEmptyInterval = "TriggerQueueEmptyInterval",
@@ -6,6 +6,7 @@ var DebugEvents;
6
6
  DebugEvents["SetSponsorBlock"] = "SetSponsorBlock";
7
7
  DebugEvents["DeleteSponsorBlock"] = "DeleteSponsorBlock";
8
8
  DebugEvents["TrackEndReplaced"] = "TrackEndReplaced";
9
+ DebugEvents["AutoplayExecution"] = "AutoplayExecution";
9
10
  DebugEvents["AutoplayNoSongsAdded"] = "AutoplayNoSongsAdded";
10
11
  DebugEvents["AutoplayThresholdSpamLimiter"] = "AutoplayThresholdSpamLimiter";
11
12
  DebugEvents["TriggerQueueEmptyInterval"] = "TriggerQueueEmptyInterval";
@@ -1,3 +1,3 @@
1
- import type { Player } from "../Player";
2
- import type { UnresolvedSearchResult } from "../Types/Utils";
1
+ import type { Player } from "../Player.js";
2
+ import type { UnresolvedSearchResult } from "../Types/Utils.js";
3
3
  export declare const bandCampSearch: (player: Player, query: string, requestUser: unknown) => Promise<UnresolvedSearchResult>;
@@ -1,5 +1,5 @@
1
- import type { Player } from "./Player";
2
- import type { AudioOutputs, EQBand, FilterData, PlayerFilters, TimescaleFilter } from "./Types/Filters";
1
+ import type { Player } from "./Player.js";
2
+ import type { AudioOutputs, EQBand, FilterData, PlayerFilters, TimescaleFilter } from "./Types/Filters.js";
3
3
  /**
4
4
  * The FilterManager for each player
5
5
  */
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FilterManager = void 0;
4
- const Constants_1 = require("./Constants");
4
+ const Constants_1 = require("./Constants.js");
5
5
  /**
6
6
  * The FilterManager for each player
7
7
  */
@@ -1,11 +1,11 @@
1
1
  /// <reference types="node" />
2
2
  import { EventEmitter } from "events";
3
- import { NodeManager } from "./NodeManager";
4
- import { Player } from "./Player";
5
- import { ManagerUtils, MiniMap } from "./Utils";
6
- import type { BotClientOptions, LavalinkManagerEvents, ManagerOptions } from "./Types/Manager";
7
- import type { PlayerOptions } from "./Types/Player";
8
- import type { ChannelDeletePacket, VoicePacket, VoiceServer, VoiceState } from "./Types/Utils";
3
+ import { NodeManager } from "./NodeManager.js";
4
+ import { Player } from "./Player.js";
5
+ import { ManagerUtils, MiniMap } from "./Utils.js";
6
+ import type { BotClientOptions, LavalinkManagerEvents, ManagerOptions } from "./Types/Manager.js";
7
+ import type { PlayerOptions } from "./Types/Player.js";
8
+ import type { ChannelDeletePacket, VoicePacket, VoiceServer, VoiceState } from "./Types/Utils.js";
9
9
  export declare class LavalinkManager extends EventEmitter {
10
10
  /**
11
11
  * Emit an event
@@ -2,11 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LavalinkManager = void 0;
4
4
  const events_1 = require("events");
5
- const Constants_1 = require("./Constants");
6
- const NodeManager_1 = require("./NodeManager");
7
- const Player_1 = require("./Player");
8
- const Queue_1 = require("./Queue");
9
- const Utils_1 = require("./Utils");
5
+ const Constants_1 = require("./Constants.js");
6
+ const NodeManager_1 = require("./NodeManager.js");
7
+ const Player_1 = require("./Player.js");
8
+ const Queue_1 = require("./Queue.js");
9
+ const Utils_1 = require("./Utils.js");
10
10
  class LavalinkManager extends events_1.EventEmitter {
11
11
  /**
12
12
  * Emit an event
@@ -1,4 +1,4 @@
1
- import type { ClientCustomSearchPlatformUtils, LavalinkSearchPlatform, SearchPlatform, SourcesRegex } from "./Types/Utils";
1
+ import type { ClientCustomSearchPlatformUtils, LavalinkSearchPlatform, SearchPlatform, SourcesRegex } from "./Types/Utils.js";
2
2
  /** Default Sources Record, to allow source parsing with multiple inputs. */
3
3
  export declare const DefaultSources: Record<SearchPlatform, LavalinkSearchPlatform | ClientCustomSearchPlatformUtils>;
4
4
  /** Lavalink Plugins definiton */
@@ -7,7 +7,9 @@ export declare const LavalinkPlugins: {
7
7
  LavaSrc: string;
8
8
  GoogleCloudTTS: string;
9
9
  LavaSearch: string;
10
+ Jiosaavn_Plugin: string;
10
11
  LavalinkFilterPlugin: string;
12
+ JavaTimedLyricsPlugin: string;
11
13
  };
12
14
  /** Lavalink Sources regexes for url validations */
13
15
  export declare const SourceLinksRegexes: Record<SourcesRegex, RegExp>;
@@ -65,7 +65,12 @@ exports.DefaultSources = {
65
65
  "http": "http",
66
66
  "https": "https",
67
67
  "link": "link",
68
- "uri": "uri"
68
+ "uri": "uri",
69
+ // jiosaavn
70
+ "jiosaavn": "jssearch",
71
+ "js": "jssearch",
72
+ "jssearch": "jssearch",
73
+ "jsrec": "jsrec"
69
74
  };
70
75
  /** Lavalink Plugins definiton */
71
76
  exports.LavalinkPlugins = {
@@ -73,7 +78,9 @@ exports.LavalinkPlugins = {
73
78
  LavaSrc: "lavasrc-plugin",
74
79
  GoogleCloudTTS: "tts-plugin",
75
80
  LavaSearch: "lavasearch-plugin",
76
- LavalinkFilterPlugin: "lavalink-filter-plugin"
81
+ Jiosaavn_Plugin: "jiosaavn-plugin",
82
+ LavalinkFilterPlugin: "lavalink-filter-plugin",
83
+ JavaTimedLyricsPlugin: "java-lyrics-plugin"
77
84
  };
78
85
  /** Lavalink Sources regexes for url validations */
79
86
  exports.SourceLinksRegexes = {
@@ -111,6 +118,8 @@ exports.SourceLinksRegexes = {
111
118
  SpotifyAlbumRegex: /(https?:\/\/)(www\.)?open\.spotify\.com\/((?<region>[a-zA-Z-]+)\/)?(user\/(?<user>[a-zA-Z0-9-_]+)\/)?album\/(?<identifier>[a-zA-Z0-9-_]+)/,
112
119
  AllSpotifyRegex: /(https?:\/\/)(www\.)?open\.spotify\.com\/((?<region>[a-zA-Z-]+)\/)?(user\/(?<user>[a-zA-Z0-9-_]+)\/)?(?<type>track|album|playlist|artist|episode|show)\/(?<identifier>[a-zA-Z0-9-_]+)/,
113
120
  appleMusic: /https?:\/\/?(?:www\.)?music\.apple\.com\/(\S+)/,
121
+ /** From jiosaavn-plugin */
122
+ jiosaavn: /(https?:\/\/)(www\.)?jiosaavn\.com\/(?<type>song|album|featured|artist)\/([a-zA-Z0-9-_\/,]+)/,
114
123
  /** FROM DUNCTE BOT PLUGIN */
115
124
  tiktok: /https:\/\/www\.tiktok\.com\//,
116
125
  mixcloud: /https:\/\/www\.mixcloud\.com\//,
@@ -1,9 +1,9 @@
1
- import type { Player } from "./Player";
2
- import type { DestroyReasonsType } from "./Types/Player";
3
- import type { Track } from "./Types/Track";
4
- import type { Base64, InvalidLavalinkRestRequest, LavalinkPlayer, LavaSearchQuery, LavaSearchResponse, PlayerUpdateInfo, RoutePlanner, SearchQuery, SearchResult, Session } from "./Types/Utils";
5
- import type { NodeManager } from "./NodeManager";
6
- import type { BaseNodeStats, LavalinkInfo, LavalinkNodeOptions, ModifyRequest, NodeStats, SponsorBlockSegment } from "./Types/Node";
1
+ import type { Player } from "./Player.js";
2
+ import type { DestroyReasonsType } from "./Types/Player.js";
3
+ import type { Track } from "./Types/Track.js";
4
+ import type { Base64, InvalidLavalinkRestRequest, LavalinkPlayer, LavaSearchQuery, LavaSearchResponse, PlayerUpdateInfo, RoutePlanner, SearchQuery, SearchResult, Session } from "./Types/Utils.js";
5
+ import type { NodeManager } from "./NodeManager.js";
6
+ import type { BaseNodeStats, LavalinkInfo, LavalinkNodeOptions, LyricsResult, ModifyRequest, NodeStats, SponsorBlockSegment } from "./Types/Node.js";
7
7
  /**
8
8
  * Lavalink Node creator class
9
9
  */
@@ -271,6 +271,62 @@ export declare class LavalinkNode {
271
271
  */
272
272
  multipleTracks: (encodeds: Base64[], requester: unknown) => Promise<Track[]>;
273
273
  };
274
+ lyrics: {
275
+ /**
276
+ * Get the lyrics of a track
277
+ * @param track the track to get the lyrics for
278
+ * @param skipTrackSource wether to skip the track source or not
279
+ * @returns the lyrics of the track
280
+ * @example
281
+ *
282
+ * ```ts
283
+ * const lyrics = await player.node.lyrics.get(track, true);
284
+ * // use it of player instead:
285
+ * // const lyrics = await player.getLyrics(track, true);
286
+ * ```
287
+ */
288
+ get: (track: Track, skipTrackSource?: boolean) => Promise<LyricsResult>;
289
+ /**
290
+ * Get the lyrics of the current playing track
291
+ *
292
+ * @param guildId the guild id of the player
293
+ * @param skipTrackSource wether to skip the track source or not
294
+ * @returns the lyrics of the current playing track
295
+ * @example
296
+ * ```ts
297
+ * const lyrics = await player.node.lyrics.getCurrent(guildId);
298
+ * // use it of player instead:
299
+ * // const lyrics = await player.getCurrentLyrics();
300
+ * ```
301
+ */
302
+ getCurrent: (guildId: string, skipTrackSource?: boolean) => Promise<LyricsResult>;
303
+ /**
304
+ * subscribe to lyrics updates for a guild
305
+ * @param guildId the guild id of the player
306
+ * @returns request data of the request
307
+ *
308
+ * @example
309
+ * ```ts
310
+ * await player.node.lyrics.subscribe(guildId);
311
+ * // use it of player instead:
312
+ * // const lyrics = await player.subscribeLyrics();
313
+ * ```
314
+ */
315
+ subscribe: (guildId: string) => Promise<any>;
316
+ /**
317
+ * unsubscribe from lyrics updates for a guild
318
+ * @param guildId the guild id of the player
319
+ * @returns request data of the request
320
+ *
321
+ * @example
322
+ * ```ts
323
+ * await player.node.lyrics.unsubscribe(guildId);
324
+ * // use it of player instead:
325
+ * // const lyrics = await player.unsubscribeLyrics();
326
+ * ```
327
+ */
328
+ unsubscribe: (guildId: string) => Promise<any>;
329
+ };
274
330
  /**
275
331
  * Request Lavalink statistics.
276
332
  * @returns the lavalink node stats
@@ -432,4 +488,28 @@ export declare class LavalinkNode {
432
488
  deleteSponsorBlock(player: Player): Promise<void>;
433
489
  /** private util function for handling the queue end event */
434
490
  private queueEnd;
491
+ /**
492
+ * Emitted whenever a line of lyrics gets emitted
493
+ * @event
494
+ * @param {Player} player The player that emitted the event
495
+ * @param {Track} track The track that emitted the event
496
+ * @param {LyricsLineEvent} payload The payload of the event
497
+ */
498
+ private LyricsLine;
499
+ /**
500
+ * Emitted whenever the lyrics for a track got found
501
+ * @event
502
+ * @param {Player} player The player that emitted the event
503
+ * @param {Track} track The track that emitted the event
504
+ * @param {LyricsFoundEvent} payload The payload of the event
505
+ */
506
+ private LyricsFound;
507
+ /**
508
+ * Emitted whenever the lyrics for a track got not found
509
+ * @event
510
+ * @param {Player} player The player that emitted the event
511
+ * @param {Track} track The track that emitted the event
512
+ * @param {LyricsNotFoundEvent} payload The payload of the event
513
+ */
514
+ private LyricsNotFound;
435
515
  }