lavalink-client 2.3.4 → 2.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.
Files changed (57) hide show
  1. package/README.md +207 -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 +1 -1
  12. package/dist/cjs/structures/Node.d.ts +6 -6
  13. package/dist/cjs/structures/Node.js +10 -3
  14. package/dist/cjs/structures/NodeManager.d.ts +4 -4
  15. package/dist/cjs/structures/NodeManager.js +3 -3
  16. package/dist/cjs/structures/Player.d.ts +10 -10
  17. package/dist/cjs/structures/Player.js +5 -5
  18. package/dist/cjs/structures/Queue.d.ts +3 -3
  19. package/dist/cjs/structures/Queue.js +1 -1
  20. package/dist/cjs/structures/Types/Filters.d.ts +1 -1
  21. package/dist/cjs/structures/Types/Manager.d.ts +7 -7
  22. package/dist/cjs/structures/Types/Node.d.ts +3 -3
  23. package/dist/cjs/structures/Types/Player.d.ts +5 -5
  24. package/dist/cjs/structures/Types/Queue.d.ts +1 -1
  25. package/dist/cjs/structures/Types/Track.d.ts +3 -3
  26. package/dist/cjs/structures/Types/Utils.d.ts +5 -5
  27. package/dist/cjs/structures/Utils.d.ts +6 -6
  28. package/dist/cjs/structures/Utils.js +2 -2
  29. package/dist/esm/index.d.ts +16 -16
  30. package/dist/esm/index.js +16 -16
  31. package/dist/esm/structures/Constants.d.ts +2 -1
  32. package/dist/esm/structures/Constants.js +1 -0
  33. package/dist/esm/structures/CustomSearches/BandCampSearch.d.ts +2 -2
  34. package/dist/esm/structures/Filters.d.ts +2 -2
  35. package/dist/esm/structures/Filters.js +1 -1
  36. package/dist/esm/structures/LavalinkManager.d.ts +6 -6
  37. package/dist/esm/structures/LavalinkManager.js +5 -5
  38. package/dist/esm/structures/LavalinkManagerStatics.d.ts +1 -1
  39. package/dist/esm/structures/Node.d.ts +6 -6
  40. package/dist/esm/structures/Node.js +10 -3
  41. package/dist/esm/structures/NodeManager.d.ts +4 -4
  42. package/dist/esm/structures/NodeManager.js +3 -3
  43. package/dist/esm/structures/Player.d.ts +10 -10
  44. package/dist/esm/structures/Player.js +5 -5
  45. package/dist/esm/structures/Queue.d.ts +3 -3
  46. package/dist/esm/structures/Queue.js +1 -1
  47. package/dist/esm/structures/Types/Filters.d.ts +1 -1
  48. package/dist/esm/structures/Types/Manager.d.ts +7 -7
  49. package/dist/esm/structures/Types/Node.d.ts +3 -3
  50. package/dist/esm/structures/Types/Player.d.ts +5 -5
  51. package/dist/esm/structures/Types/Queue.d.ts +1 -1
  52. package/dist/esm/structures/Types/Track.d.ts +3 -3
  53. package/dist/esm/structures/Types/Utils.d.ts +5 -5
  54. package/dist/esm/structures/Utils.d.ts +6 -6
  55. package/dist/esm/structures/Utils.js +2 -2
  56. package/dist/types/structures/Constants.d.ts +1 -0
  57. 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,17 @@ 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
@@ -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 */
@@ -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, ModifyRequest, NodeStats, SponsorBlockSegment } from "./Types/Node.js";
7
7
  /**
8
8
  * Lavalink Node creator class
9
9
  */
@@ -4,8 +4,8 @@ exports.LavalinkNode = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const path_1 = require("path");
6
6
  const ws_1 = tslib_1.__importDefault(require("ws"));
7
- const Constants_1 = require("./Constants");
8
- const Utils_1 = require("./Utils");
7
+ const Constants_1 = require("./Constants.js");
8
+ const Utils_1 = require("./Utils.js");
9
9
  /**
10
10
  * Lavalink Node creator class
11
11
  */
@@ -1256,9 +1256,16 @@ class LavalinkNode {
1256
1256
  });
1257
1257
  }
1258
1258
  if (typeof this.NodeManager.LavalinkManager.options?.playerOptions?.onEmptyQueue?.autoPlayFunction === "function" && typeof player.get("internal_autoplayStopPlaying") === "undefined") {
1259
+ if (this.NodeManager.LavalinkManager.options?.advancedOptions?.enableDebugEvents) {
1260
+ this.NodeManager.LavalinkManager.emit("debug", Constants_1.DebugEvents.AutoplayExecution, {
1261
+ state: "log",
1262
+ message: `Now Triggering Autoplay.`,
1263
+ functionLayer: "LavalinkNode > queueEnd() > autoplayFunction",
1264
+ });
1265
+ }
1259
1266
  const previousAutoplayTime = player.get("internal_previousautoplay");
1260
1267
  const duration = previousAutoplayTime ? Date.now() - previousAutoplayTime : 0;
1261
- if ((duration && duration > this.NodeManager.LavalinkManager.options.playerOptions.minAutoPlayMs) || !!player.get("internal_skipped")) {
1268
+ if (!duration || duration > this.NodeManager.LavalinkManager.options.playerOptions.minAutoPlayMs || !!player.get("internal_skipped")) {
1262
1269
  await this.NodeManager.LavalinkManager.options?.playerOptions?.onEmptyQueue?.autoPlayFunction(player, track);
1263
1270
  player.set("internal_previousautoplay", Date.now());
1264
1271
  if (player.queue.tracks.length > 0)
@@ -1,9 +1,9 @@
1
1
  /// <reference types="node" />
2
2
  import { EventEmitter } from "events";
3
- import { LavalinkNode } from "./Node";
4
- import { MiniMap } from "./Utils";
5
- import type { LavalinkNodeIdentifier, LavalinkNodeOptions, NodeManagerEvents } from "./Types/Node";
6
- import type { LavalinkManager } from "./LavalinkManager";
3
+ import { LavalinkNode } from "./Node.js";
4
+ import { MiniMap } from "./Utils.js";
5
+ import type { LavalinkNodeIdentifier, LavalinkNodeOptions, NodeManagerEvents } from "./Types/Node.js";
6
+ import type { LavalinkManager } from "./LavalinkManager.js";
7
7
  export declare class NodeManager extends EventEmitter {
8
8
  /**
9
9
  * Emit an event
@@ -2,9 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.NodeManager = void 0;
4
4
  const events_1 = require("events");
5
- const Constants_1 = require("./Constants");
6
- const Node_1 = require("./Node");
7
- const Utils_1 = require("./Utils");
5
+ const Constants_1 = require("./Constants.js");
6
+ const Node_1 = require("./Node.js");
7
+ const Utils_1 = require("./Utils.js");
8
8
  class NodeManager extends events_1.EventEmitter {
9
9
  /**
10
10
  * Emit an event
@@ -1,11 +1,11 @@
1
- import { FilterManager } from "./Filters";
2
- import { Queue } from "./Queue";
3
- import type { DestroyReasons } from "./Constants";
4
- import type { LavalinkNode } from "./Node";
5
- import type { SponsorBlockSegment } from "./Types/Node";
6
- import type { PlayerJson, PlayerOptions, PlayOptions, RepeatMode } from "./Types/Player";
7
- import type { LavalinkManager } from "./LavalinkManager";
8
- import type { LavalinkPlayerVoiceOptions, LavaSearchQuery, SearchQuery } from "./Types/Utils";
1
+ import { FilterManager } from "./Filters.js";
2
+ import { Queue } from "./Queue.js";
3
+ import type { DestroyReasons } from "./Constants.js";
4
+ import type { LavalinkNode } from "./Node.js";
5
+ import type { SponsorBlockSegment } from "./Types/Node.js";
6
+ import type { PlayerJson, PlayerOptions, PlayOptions, RepeatMode } from "./Types/Player.js";
7
+ import type { LavalinkManager } from "./LavalinkManager.js";
8
+ import type { LavalinkPlayerVoiceOptions, LavaSearchQuery, SearchQuery } from "./Types/Utils.js";
9
9
  export declare class Player {
10
10
  /** Filter Manager per player */
11
11
  filterManager: FilterManager;
@@ -96,7 +96,7 @@ export declare class Player {
96
96
  * @param throwOnEmpty If an error should be thrown if no track is found
97
97
  * @returns The search result
98
98
  */
99
- lavaSearch(query: LavaSearchQuery, requestUser: unknown, throwOnEmpty?: boolean): Promise<import("./Types/Utils").SearchResult | import("./Types/Utils").LavaSearchResponse>;
99
+ lavaSearch(query: LavaSearchQuery, requestUser: unknown, throwOnEmpty?: boolean): Promise<import("./Types/Utils.js").SearchResult | import("./Types/Utils.js").LavaSearchResponse>;
100
100
  /**
101
101
  * Set the SponsorBlock
102
102
  * @param segments The segments to set
@@ -115,7 +115,7 @@ export declare class Player {
115
115
  * @param query Query for your data
116
116
  * @param requestUser
117
117
  */
118
- search(query: SearchQuery, requestUser: unknown, throwOnEmpty?: boolean): Promise<import("./Types/Utils").UnresolvedSearchResult | import("./Types/Utils").SearchResult>;
118
+ search(query: SearchQuery, requestUser: unknown, throwOnEmpty?: boolean): Promise<import("./Types/Utils.js").UnresolvedSearchResult | import("./Types/Utils.js").SearchResult>;
119
119
  /**
120
120
  * Pause the player
121
121
  */
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Player = void 0;
4
- const Constants_1 = require("./Constants");
5
- const BandCampSearch_1 = require("./CustomSearches/BandCampSearch");
6
- const Filters_1 = require("./Filters");
7
- const Queue_1 = require("./Queue");
8
- const Utils_1 = require("./Utils");
4
+ const Constants_1 = require("./Constants.js");
5
+ const BandCampSearch_1 = require("./CustomSearches/BandCampSearch.js");
6
+ const Filters_1 = require("./Filters.js");
7
+ const Queue_1 = require("./Queue.js");
8
+ const Utils_1 = require("./Utils.js");
9
9
  class Player {
10
10
  /** Filter Manager per player */
11
11
  filterManager;
@@ -1,6 +1,6 @@
1
- import { MiniMap } from "./Utils";
2
- import type { Track, UnresolvedTrack } from "./Types/Track";
3
- import type { ManagerQueueOptions, QueueStoreManager, StoredQueue } from "./Types/Queue";
1
+ import { MiniMap } from "./Utils.js";
2
+ import type { Track, UnresolvedTrack } from "./Types/Track.js";
3
+ import type { ManagerQueueOptions, QueueStoreManager, StoredQueue } from "./Types/Queue.js";
4
4
  export declare class QueueSaver {
5
5
  /**
6
6
  * The queue store manager
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Queue = exports.DefaultQueueStore = exports.QueueSaver = void 0;
4
- const Utils_1 = require("./Utils");
4
+ const Utils_1 = require("./Utils.js");
5
5
  class QueueSaver {
6
6
  /**
7
7
  * The queue store manager
@@ -1,4 +1,4 @@
1
- import type { FloatNumber, IntegerNumber } from "./Utils";
1
+ import type { FloatNumber, IntegerNumber } from "./Utils.js";
2
2
  /** The Audio Outputs type */
3
3
  export type AudioOutputs = "mono" | "stereo" | "left" | "right";
4
4
  /** The "active" / "disabled" Player Filters */
@@ -1,10 +1,10 @@
1
- import type { DebugEvents } from "../Constants";
2
- import type { Player } from "../Player";
3
- import type { LavalinkNodeOptions } from "./Node";
4
- import type { DestroyReasonsType, PlayerJson } from "./Player";
5
- import type { ManagerQueueOptions } from "./Queue";
6
- import type { Track, UnresolvedTrack } from "./Track";
7
- import type { GuildShardPayload, SearchPlatform, SponsorBlockChaptersLoaded, SponsorBlockChapterStarted, SponsorBlockSegmentSkipped, SponsorBlockSegmentsLoaded, TrackExceptionEvent, TrackEndEvent, TrackStuckEvent, WebSocketClosedEvent, TrackStartEvent } from "./Utils";
1
+ import type { DebugEvents } from "../Constants.js";
2
+ import type { Player } from "../Player.js";
3
+ import type { LavalinkNodeOptions } from "./Node.js";
4
+ import type { DestroyReasonsType, PlayerJson } from "./Player.js";
5
+ import type { ManagerQueueOptions } from "./Queue.js";
6
+ import type { Track, UnresolvedTrack } from "./Track.js";
7
+ import type { GuildShardPayload, SearchPlatform, SponsorBlockChaptersLoaded, SponsorBlockChapterStarted, SponsorBlockSegmentSkipped, SponsorBlockSegmentsLoaded, TrackExceptionEvent, TrackEndEvent, TrackStuckEvent, WebSocketClosedEvent, TrackStartEvent } from "./Utils.js";
8
8
  /**
9
9
  * The events from the lavalink Manager
10
10
  */
@@ -1,8 +1,8 @@
1
1
  /// <reference types="node" />
2
2
  import type internal from "stream";
3
- import type { LavalinkNode } from "../Node";
4
- import type { DestroyReasonsType } from "./Player";
5
- import type { InvalidLavalinkRestRequest, LavalinkPlayer } from "./Utils";
3
+ import type { LavalinkNode } from "../Node.js";
4
+ import type { DestroyReasonsType } from "./Player.js";
5
+ import type { InvalidLavalinkRestRequest, LavalinkPlayer } from "./Utils.js";
6
6
  /** Ability to manipulate fetch requests */
7
7
  export type ModifyRequest = (options: RequestInit & {
8
8
  path: string;
@@ -1,8 +1,8 @@
1
- import type { DestroyReasons } from "../Constants";
2
- import type { LavalinkNode } from "../Node";
3
- import type { EQBand, FilterData, LavalinkFilterData } from "./Filters";
4
- import type { Track, UnresolvedTrack } from "./Track";
5
- import type { Base64, LavalinkPlayerVoiceOptions } from "./Utils";
1
+ import type { DestroyReasons } from "../Constants.js";
2
+ import type { LavalinkNode } from "../Node.js";
3
+ import type { EQBand, FilterData, LavalinkFilterData } from "./Filters.js";
4
+ import type { Track, UnresolvedTrack } from "./Track.js";
5
+ import type { Base64, LavalinkPlayerVoiceOptions } from "./Utils.js";
6
6
  export type DestroyReasonsType = keyof typeof DestroyReasons | string;
7
7
  export interface PlayerJson {
8
8
  /** Guild Id where the player was playing in */
@@ -1,4 +1,4 @@
1
- import type { Track, UnresolvedTrack } from "./Track";
1
+ import type { Track, UnresolvedTrack } from "./Track.js";
2
2
  export interface StoredQueue {
3
3
  current: Track | null;
4
4
  previous: Track[];
@@ -1,6 +1,6 @@
1
- import type { Player } from "../Player";
2
- import type { anyObject } from "./Player";
3
- import type { Base64 } from "./Utils";
1
+ import type { Player } from "../Player.js";
2
+ import type { anyObject } from "./Player.js";
3
+ import type { Base64 } from "./Utils.js";
4
4
  /** Sourcenames provided by lavalink server */
5
5
  export type LavalinkSourceNames = "youtube" | "youtubemusic" | "soundcloud" | "bandcamp" | "twitch";
6
6
  /** Source Names provided by lava src plugin */
@@ -1,8 +1,8 @@
1
- import type { MiniMap } from "../Utils";
2
- import type { LavalinkFilterData } from "./Filters";
3
- import type { NodeStats } from "./Node";
4
- import type { LavalinkPlayOptions } from "./Player";
5
- import type { LavalinkTrack, PluginInfo, Track, UnresolvedTrack } from "./Track";
1
+ import type { MiniMap } from "../Utils.js";
2
+ import type { LavalinkFilterData } from "./Filters.js";
3
+ import type { NodeStats } from "./Node.js";
4
+ import type { LavalinkPlayOptions } from "./Player.js";
5
+ import type { LavalinkTrack, PluginInfo, Track, UnresolvedTrack } from "./Track.js";
6
6
  /** Helper for generating Opaque types. */
7
7
  export type Opaque<T, K> = T & {
8
8
  __opaque__: K;
@@ -1,9 +1,9 @@
1
- import type { LavalinkNodeOptions } from "./Types/Node";
2
- import type { LavalinkSearchPlatform, LavaSearchQuery, MiniMapConstructor, SearchPlatform, SearchQuery } from "./Types/Utils";
3
- import type { LavalinkManager } from "./LavalinkManager";
4
- import type { LavalinkNode } from "./Node";
5
- import type { Player } from "./Player";
6
- import type { LavalinkTrack, Track, UnresolvedQuery, UnresolvedTrack } from "./Types/Track";
1
+ import type { LavalinkNodeOptions } from "./Types/Node.js";
2
+ import type { LavalinkSearchPlatform, LavaSearchQuery, MiniMapConstructor, SearchPlatform, SearchQuery } from "./Types/Utils.js";
3
+ import type { LavalinkManager } from "./LavalinkManager.js";
4
+ import type { LavalinkNode } from "./Node.js";
5
+ import type { Player } from "./Player.js";
6
+ import type { LavalinkTrack, Track, UnresolvedQuery, UnresolvedTrack } from "./Types/Track.js";
7
7
  export declare const TrackSymbol: unique symbol;
8
8
  export declare const UnresolvedTrackSymbol: unique symbol;
9
9
  export declare const QueueSymbol: unique symbol;
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.queueTrackEnd = exports.MiniMap = exports.ManagerUtils = exports.parseLavalinkConnUrl = exports.NodeSymbol = exports.QueueSymbol = exports.UnresolvedTrackSymbol = exports.TrackSymbol = void 0;
4
4
  const node_url_1 = require("node:url");
5
5
  const types_1 = require("node:util/types");
6
- const Constants_1 = require("./Constants");
7
- const LavalinkManagerStatics_1 = require("./LavalinkManagerStatics");
6
+ const Constants_1 = require("./Constants.js");
7
+ const LavalinkManagerStatics_1 = require("./LavalinkManagerStatics.js");
8
8
  exports.TrackSymbol = Symbol("LC-Track");
9
9
  exports.UnresolvedTrackSymbol = Symbol("LC-Track-Unresolved");
10
10
  exports.QueueSymbol = Symbol("LC-Queue");
@@ -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/esm/index.js CHANGED
@@ -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";
@@ -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",
@@ -3,6 +3,7 @@ export var DebugEvents;
3
3
  DebugEvents["SetSponsorBlock"] = "SetSponsorBlock";
4
4
  DebugEvents["DeleteSponsorBlock"] = "DeleteSponsorBlock";
5
5
  DebugEvents["TrackEndReplaced"] = "TrackEndReplaced";
6
+ DebugEvents["AutoplayExecution"] = "AutoplayExecution";
6
7
  DebugEvents["AutoplayNoSongsAdded"] = "AutoplayNoSongsAdded";
7
8
  DebugEvents["AutoplayThresholdSpamLimiter"] = "AutoplayThresholdSpamLimiter";
8
9
  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,4 +1,4 @@
1
- import { audioOutputsData } from "./Constants";
1
+ import { audioOutputsData } from "./Constants.js";
2
2
  /**
3
3
  * The FilterManager for each player
4
4
  */
@@ -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
@@ -1,9 +1,9 @@
1
1
  import { EventEmitter } from "events";
2
- import { DebugEvents, DestroyReasons } from "./Constants";
3
- import { NodeManager } from "./NodeManager";
4
- import { Player } from "./Player";
5
- import { DefaultQueueStore } from "./Queue";
6
- import { ManagerUtils, MiniMap } from "./Utils";
2
+ import { DebugEvents, DestroyReasons } from "./Constants.js";
3
+ import { NodeManager } from "./NodeManager.js";
4
+ import { Player } from "./Player.js";
5
+ import { DefaultQueueStore } from "./Queue.js";
6
+ import { ManagerUtils, MiniMap } from "./Utils.js";
7
7
  export class LavalinkManager extends EventEmitter {
8
8
  /**
9
9
  * 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 */
@@ -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, ModifyRequest, NodeStats, SponsorBlockSegment } from "./Types/Node.js";
7
7
  /**
8
8
  * Lavalink Node creator class
9
9
  */
@@ -1,7 +1,7 @@
1
1
  import { isAbsolute } from "path";
2
2
  import WebSocket from "ws";
3
- import { DebugEvents, DestroyReasons, validSponsorBlocks } from "./Constants";
4
- import { NodeSymbol, queueTrackEnd } from "./Utils";
3
+ import { DebugEvents, DestroyReasons, validSponsorBlocks } from "./Constants.js";
4
+ import { NodeSymbol, queueTrackEnd } from "./Utils.js";
5
5
  /**
6
6
  * Lavalink Node creator class
7
7
  */
@@ -1252,9 +1252,16 @@ export class LavalinkNode {
1252
1252
  });
1253
1253
  }
1254
1254
  if (typeof this.NodeManager.LavalinkManager.options?.playerOptions?.onEmptyQueue?.autoPlayFunction === "function" && typeof player.get("internal_autoplayStopPlaying") === "undefined") {
1255
+ if (this.NodeManager.LavalinkManager.options?.advancedOptions?.enableDebugEvents) {
1256
+ this.NodeManager.LavalinkManager.emit("debug", DebugEvents.AutoplayExecution, {
1257
+ state: "log",
1258
+ message: `Now Triggering Autoplay.`,
1259
+ functionLayer: "LavalinkNode > queueEnd() > autoplayFunction",
1260
+ });
1261
+ }
1255
1262
  const previousAutoplayTime = player.get("internal_previousautoplay");
1256
1263
  const duration = previousAutoplayTime ? Date.now() - previousAutoplayTime : 0;
1257
- if ((duration && duration > this.NodeManager.LavalinkManager.options.playerOptions.minAutoPlayMs) || !!player.get("internal_skipped")) {
1264
+ if (!duration || duration > this.NodeManager.LavalinkManager.options.playerOptions.minAutoPlayMs || !!player.get("internal_skipped")) {
1258
1265
  await this.NodeManager.LavalinkManager.options?.playerOptions?.onEmptyQueue?.autoPlayFunction(player, track);
1259
1266
  player.set("internal_previousautoplay", Date.now());
1260
1267
  if (player.queue.tracks.length > 0)
@@ -1,9 +1,9 @@
1
1
  /// <reference types="node" />
2
2
  import { EventEmitter } from "events";
3
- import { LavalinkNode } from "./Node";
4
- import { MiniMap } from "./Utils";
5
- import type { LavalinkNodeIdentifier, LavalinkNodeOptions, NodeManagerEvents } from "./Types/Node";
6
- import type { LavalinkManager } from "./LavalinkManager";
3
+ import { LavalinkNode } from "./Node.js";
4
+ import { MiniMap } from "./Utils.js";
5
+ import type { LavalinkNodeIdentifier, LavalinkNodeOptions, NodeManagerEvents } from "./Types/Node.js";
6
+ import type { LavalinkManager } from "./LavalinkManager.js";
7
7
  export declare class NodeManager extends EventEmitter {
8
8
  /**
9
9
  * Emit an event
@@ -1,7 +1,7 @@
1
1
  import { EventEmitter } from "events";
2
- import { DestroyReasons } from "./Constants";
3
- import { LavalinkNode } from "./Node";
4
- import { MiniMap } from "./Utils";
2
+ import { DestroyReasons } from "./Constants.js";
3
+ import { LavalinkNode } from "./Node.js";
4
+ import { MiniMap } from "./Utils.js";
5
5
  export class NodeManager extends EventEmitter {
6
6
  /**
7
7
  * Emit an event
@@ -1,11 +1,11 @@
1
- import { FilterManager } from "./Filters";
2
- import { Queue } from "./Queue";
3
- import type { DestroyReasons } from "./Constants";
4
- import type { LavalinkNode } from "./Node";
5
- import type { SponsorBlockSegment } from "./Types/Node";
6
- import type { PlayerJson, PlayerOptions, PlayOptions, RepeatMode } from "./Types/Player";
7
- import type { LavalinkManager } from "./LavalinkManager";
8
- import type { LavalinkPlayerVoiceOptions, LavaSearchQuery, SearchQuery } from "./Types/Utils";
1
+ import { FilterManager } from "./Filters.js";
2
+ import { Queue } from "./Queue.js";
3
+ import type { DestroyReasons } from "./Constants.js";
4
+ import type { LavalinkNode } from "./Node.js";
5
+ import type { SponsorBlockSegment } from "./Types/Node.js";
6
+ import type { PlayerJson, PlayerOptions, PlayOptions, RepeatMode } from "./Types/Player.js";
7
+ import type { LavalinkManager } from "./LavalinkManager.js";
8
+ import type { LavalinkPlayerVoiceOptions, LavaSearchQuery, SearchQuery } from "./Types/Utils.js";
9
9
  export declare class Player {
10
10
  /** Filter Manager per player */
11
11
  filterManager: FilterManager;
@@ -96,7 +96,7 @@ export declare class Player {
96
96
  * @param throwOnEmpty If an error should be thrown if no track is found
97
97
  * @returns The search result
98
98
  */
99
- lavaSearch(query: LavaSearchQuery, requestUser: unknown, throwOnEmpty?: boolean): Promise<import("./Types/Utils").SearchResult | import("./Types/Utils").LavaSearchResponse>;
99
+ lavaSearch(query: LavaSearchQuery, requestUser: unknown, throwOnEmpty?: boolean): Promise<import("./Types/Utils.js").SearchResult | import("./Types/Utils.js").LavaSearchResponse>;
100
100
  /**
101
101
  * Set the SponsorBlock
102
102
  * @param segments The segments to set
@@ -115,7 +115,7 @@ export declare class Player {
115
115
  * @param query Query for your data
116
116
  * @param requestUser
117
117
  */
118
- search(query: SearchQuery, requestUser: unknown, throwOnEmpty?: boolean): Promise<import("./Types/Utils").UnresolvedSearchResult | import("./Types/Utils").SearchResult>;
118
+ search(query: SearchQuery, requestUser: unknown, throwOnEmpty?: boolean): Promise<import("./Types/Utils.js").UnresolvedSearchResult | import("./Types/Utils.js").SearchResult>;
119
119
  /**
120
120
  * Pause the player
121
121
  */
@@ -1,8 +1,8 @@
1
- import { DebugEvents } from "./Constants";
2
- import { bandCampSearch } from "./CustomSearches/BandCampSearch";
3
- import { FilterManager } from "./Filters";
4
- import { Queue, QueueSaver } from "./Queue";
5
- import { queueTrackEnd } from "./Utils";
1
+ import { DebugEvents } from "./Constants.js";
2
+ import { bandCampSearch } from "./CustomSearches/BandCampSearch.js";
3
+ import { FilterManager } from "./Filters.js";
4
+ import { Queue, QueueSaver } from "./Queue.js";
5
+ import { queueTrackEnd } from "./Utils.js";
6
6
  export class Player {
7
7
  /** Filter Manager per player */
8
8
  filterManager;
@@ -1,6 +1,6 @@
1
- import { MiniMap } from "./Utils";
2
- import type { Track, UnresolvedTrack } from "./Types/Track";
3
- import type { ManagerQueueOptions, QueueStoreManager, StoredQueue } from "./Types/Queue";
1
+ import { MiniMap } from "./Utils.js";
2
+ import type { Track, UnresolvedTrack } from "./Types/Track.js";
3
+ import type { ManagerQueueOptions, QueueStoreManager, StoredQueue } from "./Types/Queue.js";
4
4
  export declare class QueueSaver {
5
5
  /**
6
6
  * The queue store manager
@@ -1,4 +1,4 @@
1
- import { ManagerUtils, MiniMap, QueueSymbol } from "./Utils";
1
+ import { ManagerUtils, MiniMap, QueueSymbol } from "./Utils.js";
2
2
  export class QueueSaver {
3
3
  /**
4
4
  * The queue store manager
@@ -1,4 +1,4 @@
1
- import type { FloatNumber, IntegerNumber } from "./Utils";
1
+ import type { FloatNumber, IntegerNumber } from "./Utils.js";
2
2
  /** The Audio Outputs type */
3
3
  export type AudioOutputs = "mono" | "stereo" | "left" | "right";
4
4
  /** The "active" / "disabled" Player Filters */
@@ -1,10 +1,10 @@
1
- import type { DebugEvents } from "../Constants";
2
- import type { Player } from "../Player";
3
- import type { LavalinkNodeOptions } from "./Node";
4
- import type { DestroyReasonsType, PlayerJson } from "./Player";
5
- import type { ManagerQueueOptions } from "./Queue";
6
- import type { Track, UnresolvedTrack } from "./Track";
7
- import type { GuildShardPayload, SearchPlatform, SponsorBlockChaptersLoaded, SponsorBlockChapterStarted, SponsorBlockSegmentSkipped, SponsorBlockSegmentsLoaded, TrackExceptionEvent, TrackEndEvent, TrackStuckEvent, WebSocketClosedEvent, TrackStartEvent } from "./Utils";
1
+ import type { DebugEvents } from "../Constants.js";
2
+ import type { Player } from "../Player.js";
3
+ import type { LavalinkNodeOptions } from "./Node.js";
4
+ import type { DestroyReasonsType, PlayerJson } from "./Player.js";
5
+ import type { ManagerQueueOptions } from "./Queue.js";
6
+ import type { Track, UnresolvedTrack } from "./Track.js";
7
+ import type { GuildShardPayload, SearchPlatform, SponsorBlockChaptersLoaded, SponsorBlockChapterStarted, SponsorBlockSegmentSkipped, SponsorBlockSegmentsLoaded, TrackExceptionEvent, TrackEndEvent, TrackStuckEvent, WebSocketClosedEvent, TrackStartEvent } from "./Utils.js";
8
8
  /**
9
9
  * The events from the lavalink Manager
10
10
  */
@@ -1,8 +1,8 @@
1
1
  /// <reference types="node" />
2
2
  import type internal from "stream";
3
- import type { LavalinkNode } from "../Node";
4
- import type { DestroyReasonsType } from "./Player";
5
- import type { InvalidLavalinkRestRequest, LavalinkPlayer } from "./Utils";
3
+ import type { LavalinkNode } from "../Node.js";
4
+ import type { DestroyReasonsType } from "./Player.js";
5
+ import type { InvalidLavalinkRestRequest, LavalinkPlayer } from "./Utils.js";
6
6
  /** Ability to manipulate fetch requests */
7
7
  export type ModifyRequest = (options: RequestInit & {
8
8
  path: string;
@@ -1,8 +1,8 @@
1
- import type { DestroyReasons } from "../Constants";
2
- import type { LavalinkNode } from "../Node";
3
- import type { EQBand, FilterData, LavalinkFilterData } from "./Filters";
4
- import type { Track, UnresolvedTrack } from "./Track";
5
- import type { Base64, LavalinkPlayerVoiceOptions } from "./Utils";
1
+ import type { DestroyReasons } from "../Constants.js";
2
+ import type { LavalinkNode } from "../Node.js";
3
+ import type { EQBand, FilterData, LavalinkFilterData } from "./Filters.js";
4
+ import type { Track, UnresolvedTrack } from "./Track.js";
5
+ import type { Base64, LavalinkPlayerVoiceOptions } from "./Utils.js";
6
6
  export type DestroyReasonsType = keyof typeof DestroyReasons | string;
7
7
  export interface PlayerJson {
8
8
  /** Guild Id where the player was playing in */
@@ -1,4 +1,4 @@
1
- import type { Track, UnresolvedTrack } from "./Track";
1
+ import type { Track, UnresolvedTrack } from "./Track.js";
2
2
  export interface StoredQueue {
3
3
  current: Track | null;
4
4
  previous: Track[];
@@ -1,6 +1,6 @@
1
- import type { Player } from "../Player";
2
- import type { anyObject } from "./Player";
3
- import type { Base64 } from "./Utils";
1
+ import type { Player } from "../Player.js";
2
+ import type { anyObject } from "./Player.js";
3
+ import type { Base64 } from "./Utils.js";
4
4
  /** Sourcenames provided by lavalink server */
5
5
  export type LavalinkSourceNames = "youtube" | "youtubemusic" | "soundcloud" | "bandcamp" | "twitch";
6
6
  /** Source Names provided by lava src plugin */
@@ -1,8 +1,8 @@
1
- import type { MiniMap } from "../Utils";
2
- import type { LavalinkFilterData } from "./Filters";
3
- import type { NodeStats } from "./Node";
4
- import type { LavalinkPlayOptions } from "./Player";
5
- import type { LavalinkTrack, PluginInfo, Track, UnresolvedTrack } from "./Track";
1
+ import type { MiniMap } from "../Utils.js";
2
+ import type { LavalinkFilterData } from "./Filters.js";
3
+ import type { NodeStats } from "./Node.js";
4
+ import type { LavalinkPlayOptions } from "./Player.js";
5
+ import type { LavalinkTrack, PluginInfo, Track, UnresolvedTrack } from "./Track.js";
6
6
  /** Helper for generating Opaque types. */
7
7
  export type Opaque<T, K> = T & {
8
8
  __opaque__: K;
@@ -1,9 +1,9 @@
1
- import type { LavalinkNodeOptions } from "./Types/Node";
2
- import type { LavalinkSearchPlatform, LavaSearchQuery, MiniMapConstructor, SearchPlatform, SearchQuery } from "./Types/Utils";
3
- import type { LavalinkManager } from "./LavalinkManager";
4
- import type { LavalinkNode } from "./Node";
5
- import type { Player } from "./Player";
6
- import type { LavalinkTrack, Track, UnresolvedQuery, UnresolvedTrack } from "./Types/Track";
1
+ import type { LavalinkNodeOptions } from "./Types/Node.js";
2
+ import type { LavalinkSearchPlatform, LavaSearchQuery, MiniMapConstructor, SearchPlatform, SearchQuery } from "./Types/Utils.js";
3
+ import type { LavalinkManager } from "./LavalinkManager.js";
4
+ import type { LavalinkNode } from "./Node.js";
5
+ import type { Player } from "./Player.js";
6
+ import type { LavalinkTrack, Track, UnresolvedQuery, UnresolvedTrack } from "./Types/Track.js";
7
7
  export declare const TrackSymbol: unique symbol;
8
8
  export declare const UnresolvedTrackSymbol: unique symbol;
9
9
  export declare const QueueSymbol: unique symbol;
@@ -1,7 +1,7 @@
1
1
  import { URL } from "node:url";
2
2
  import { isRegExp } from "node:util/types";
3
- import { DebugEvents } from "./Constants";
4
- import { DefaultSources, LavalinkPlugins, SourceLinksRegexes } from "./LavalinkManagerStatics";
3
+ import { DebugEvents } from "./Constants.js";
4
+ import { DefaultSources, LavalinkPlugins, SourceLinksRegexes } from "./LavalinkManagerStatics.js";
5
5
  export const TrackSymbol = Symbol("LC-Track");
6
6
  export const UnresolvedTrackSymbol = Symbol("LC-Track-Unresolved");
7
7
  export const QueueSymbol = Symbol("LC-Queue");
@@ -3,6 +3,7 @@ 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",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lavalink-client",
3
- "version": "2.3.4",
3
+ "version": "2.3.5",
4
4
  "description": "Easy, flexible and feature-rich lavalink@v4 Client. Both for Beginners and Proficients.",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",