lavalink-client 2.3.3 → 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.
- package/README.md +211 -24
- package/dist/cjs/index.d.ts +16 -16
- package/dist/cjs/index.js +16 -16
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/structures/Constants.d.ts +2 -1
- package/dist/cjs/structures/Constants.js +1 -0
- package/dist/cjs/structures/CustomSearches/BandCampSearch.d.ts +2 -2
- package/dist/cjs/structures/Filters.d.ts +2 -2
- package/dist/cjs/structures/Filters.js +1 -1
- package/dist/cjs/structures/LavalinkManager.d.ts +6 -6
- package/dist/cjs/structures/LavalinkManager.js +5 -5
- package/dist/cjs/structures/LavalinkManagerStatics.d.ts +1 -1
- package/dist/cjs/structures/Node.d.ts +6 -6
- package/dist/cjs/structures/Node.js +10 -3
- package/dist/cjs/structures/NodeManager.d.ts +5 -5
- package/dist/cjs/structures/NodeManager.js +5 -5
- package/dist/cjs/structures/Player.d.ts +10 -10
- package/dist/cjs/structures/Player.js +37 -14
- package/dist/cjs/structures/Queue.d.ts +3 -3
- package/dist/cjs/structures/Queue.js +1 -1
- package/dist/cjs/structures/Types/Filters.d.ts +1 -1
- package/dist/cjs/structures/Types/Manager.d.ts +7 -7
- package/dist/cjs/structures/Types/Node.d.ts +3 -3
- package/dist/cjs/structures/Types/Player.d.ts +5 -5
- package/dist/cjs/structures/Types/Queue.d.ts +1 -1
- package/dist/cjs/structures/Types/Track.d.ts +3 -3
- package/dist/cjs/structures/Types/Utils.d.ts +5 -5
- package/dist/cjs/structures/Utils.d.ts +6 -6
- package/dist/cjs/structures/Utils.js +23 -7
- package/dist/esm/index.d.ts +16 -16
- package/dist/esm/index.js +16 -16
- package/dist/esm/package.json +3 -0
- package/dist/esm/structures/Constants.d.ts +2 -1
- package/dist/esm/structures/Constants.js +1 -0
- package/dist/esm/structures/CustomSearches/BandCampSearch.d.ts +2 -2
- package/dist/esm/structures/Filters.d.ts +2 -2
- package/dist/esm/structures/Filters.js +1 -1
- package/dist/esm/structures/LavalinkManager.d.ts +6 -6
- package/dist/esm/structures/LavalinkManager.js +5 -5
- package/dist/esm/structures/LavalinkManagerStatics.d.ts +1 -1
- package/dist/esm/structures/Node.d.ts +6 -6
- package/dist/esm/structures/Node.js +10 -3
- package/dist/esm/structures/NodeManager.d.ts +5 -5
- package/dist/esm/structures/NodeManager.js +4 -4
- package/dist/esm/structures/Player.d.ts +10 -10
- package/dist/esm/structures/Player.js +37 -14
- package/dist/esm/structures/Queue.d.ts +3 -3
- package/dist/esm/structures/Queue.js +1 -1
- package/dist/esm/structures/Types/Filters.d.ts +1 -1
- package/dist/esm/structures/Types/Manager.d.ts +7 -7
- package/dist/esm/structures/Types/Node.d.ts +3 -3
- package/dist/esm/structures/Types/Player.d.ts +5 -5
- package/dist/esm/structures/Types/Queue.d.ts +1 -1
- package/dist/esm/structures/Types/Track.d.ts +3 -3
- package/dist/esm/structures/Types/Utils.d.ts +5 -5
- package/dist/esm/structures/Utils.d.ts +6 -6
- package/dist/esm/structures/Utils.js +23 -7
- package/dist/types/structures/Constants.d.ts +1 -0
- package/dist/types/structures/NodeManager.d.ts +1 -1
- package/package.json +13 -6
|
@@ -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;
|
|
@@ -138,7 +138,7 @@ class Player {
|
|
|
138
138
|
*/
|
|
139
139
|
async play(options = {}) {
|
|
140
140
|
if (this.get("internal_queueempty")) {
|
|
141
|
-
if (
|
|
141
|
+
if (this.LavalinkManager.options?.advancedOptions?.enableDebugEvents) {
|
|
142
142
|
this.LavalinkManager.emit("debug", Constants_1.DebugEvents.PlayerPlayQueueEmptyTimeoutClear, {
|
|
143
143
|
state: "log",
|
|
144
144
|
message: `Player was called to play something, while there was a queueEmpty Timeout set, clearing the timeout.`,
|
|
@@ -150,8 +150,31 @@ class Player {
|
|
|
150
150
|
}
|
|
151
151
|
// if clientTrack provided, override options.track object
|
|
152
152
|
if (options?.clientTrack && (this.LavalinkManager.utils.isTrack(options?.clientTrack) || this.LavalinkManager.utils.isUnresolvedTrack(options.clientTrack))) {
|
|
153
|
-
if (this.LavalinkManager.utils.isUnresolvedTrack(options.clientTrack))
|
|
154
|
-
|
|
153
|
+
if (this.LavalinkManager.utils.isUnresolvedTrack(options.clientTrack)) {
|
|
154
|
+
try {
|
|
155
|
+
// resolve the unresolved track
|
|
156
|
+
await options.clientTrack.resolve(this);
|
|
157
|
+
}
|
|
158
|
+
catch (error) {
|
|
159
|
+
if (this.LavalinkManager.options?.advancedOptions?.enableDebugEvents) {
|
|
160
|
+
this.LavalinkManager.emit("debug", Constants_1.DebugEvents.PlayerPlayUnresolvedTrackFailed, {
|
|
161
|
+
state: "error",
|
|
162
|
+
error: error,
|
|
163
|
+
message: `Player Play was called with clientTrack, Song is unresolved, but couldn't resolve it`,
|
|
164
|
+
functionLayer: "Player > play() > resolve currentTrack",
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
this.LavalinkManager.emit("trackError", this, this.queue.current, error);
|
|
168
|
+
if (options && "clientTrack" in options)
|
|
169
|
+
delete options.clientTrack;
|
|
170
|
+
if (options && "track" in options)
|
|
171
|
+
delete options.track;
|
|
172
|
+
// try to play the next track if possible
|
|
173
|
+
if (this.LavalinkManager.options?.autoSkipOnResolveError === true && this.queue.tracks[0])
|
|
174
|
+
return this.play(options);
|
|
175
|
+
return this;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
155
178
|
if ((typeof options.track?.userData === "object" || typeof options.clientTrack?.userData === "object") && options.clientTrack)
|
|
156
179
|
options.clientTrack.userData = { ...(options?.clientTrack.userData || {}), ...(options.track?.userData || {}) };
|
|
157
180
|
options.track = {
|
|
@@ -185,7 +208,7 @@ class Player {
|
|
|
185
208
|
...(track.userData || {}),
|
|
186
209
|
requester: this.LavalinkManager.utils.getTransformedRequester(options?.track?.requester || {})
|
|
187
210
|
};
|
|
188
|
-
if (
|
|
211
|
+
if (this.LavalinkManager.options?.advancedOptions?.enableDebugEvents) {
|
|
189
212
|
this.LavalinkManager.emit("debug", Constants_1.DebugEvents.PlayerPlayWithTrackReplace, {
|
|
190
213
|
state: "log",
|
|
191
214
|
message: `Player was called to play something, with a specific track provided. Replacing the current Track and resolving the track on trackStart Event.`,
|
|
@@ -209,7 +232,7 @@ class Player {
|
|
|
209
232
|
if (!this.queue.current && this.queue.tracks.length)
|
|
210
233
|
await (0, Utils_1.queueTrackEnd)(this);
|
|
211
234
|
if (this.queue.current && this.LavalinkManager.utils.isUnresolvedTrack(this.queue.current)) {
|
|
212
|
-
if (
|
|
235
|
+
if (this.LavalinkManager.options?.advancedOptions?.enableDebugEvents) {
|
|
213
236
|
this.LavalinkManager.emit("debug", Constants_1.DebugEvents.PlayerPlayUnresolvedTrack, {
|
|
214
237
|
state: "log",
|
|
215
238
|
message: `Player Play was called, current Queue Song is unresolved, resolving the track.`,
|
|
@@ -223,7 +246,7 @@ class Player {
|
|
|
223
246
|
this.queue.current.userData = { ...(this.queue.current?.userData || {}), ...(options.track?.userData || {}) };
|
|
224
247
|
}
|
|
225
248
|
catch (error) {
|
|
226
|
-
if (
|
|
249
|
+
if (this.LavalinkManager.options?.advancedOptions?.enableDebugEvents) {
|
|
227
250
|
this.LavalinkManager.emit("debug", Constants_1.DebugEvents.PlayerPlayUnresolvedTrackFailed, {
|
|
228
251
|
state: "error",
|
|
229
252
|
error: error,
|
|
@@ -297,7 +320,7 @@ class Player {
|
|
|
297
320
|
: this.volume), 1000), 0));
|
|
298
321
|
const now = performance.now();
|
|
299
322
|
if (this.LavalinkManager.options.playerOptions.applyVolumeAsFilter) {
|
|
300
|
-
if (
|
|
323
|
+
if (this.LavalinkManager.options?.advancedOptions?.enableDebugEvents) {
|
|
301
324
|
this.LavalinkManager.emit("debug", Constants_1.DebugEvents.PlayerVolumeAsFilter, {
|
|
302
325
|
state: "log",
|
|
303
326
|
message: `Player Volume was set as a Filter, because LavalinkManager option "playerOptions.applyVolumeAsFilter" is true`,
|
|
@@ -349,7 +372,7 @@ class Player {
|
|
|
349
372
|
async search(query, requestUser, throwOnEmpty = false) {
|
|
350
373
|
const Query = this.LavalinkManager.utils.transformQuery(query);
|
|
351
374
|
if (["bcsearch", "bandcamp"].includes(Query.source) && !this.node.info.sourceManagers.includes("bandcamp")) {
|
|
352
|
-
if (
|
|
375
|
+
if (this.LavalinkManager.options?.advancedOptions?.enableDebugEvents) {
|
|
353
376
|
this.LavalinkManager.emit("debug", Constants_1.DebugEvents.BandcampSearchLokalEngine, {
|
|
354
377
|
state: "log",
|
|
355
378
|
message: `Player.search was called with a Bandcamp Query, but no bandcamp search was enabled on lavalink, searching with the custom Search Engine.`,
|
|
@@ -559,7 +582,7 @@ class Player {
|
|
|
559
582
|
const updateNode = typeof newNode === "string" ? this.LavalinkManager.nodeManager.nodes.get(newNode) : newNode;
|
|
560
583
|
if (!updateNode)
|
|
561
584
|
throw new Error("Could not find the new Node");
|
|
562
|
-
if (
|
|
585
|
+
if (this.LavalinkManager.options?.advancedOptions?.enableDebugEvents) {
|
|
563
586
|
this.LavalinkManager.emit("debug", Constants_1.DebugEvents.PlayerChangeNode, {
|
|
564
587
|
state: "log",
|
|
565
588
|
message: `Player.changeNode() was executed, trying to change from "${this.node.id}" to "${updateNode.id}"`,
|
|
@@ -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,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,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");
|
|
@@ -427,11 +427,27 @@ async function queueTrackEnd(player) {
|
|
|
427
427
|
player.queue.tracks.push(player.queue.current);
|
|
428
428
|
// change the current Track to the next upcoming one
|
|
429
429
|
const nextSong = player.queue.tracks.shift();
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
430
|
+
try {
|
|
431
|
+
if (player.LavalinkManager.utils.isUnresolvedTrack(nextSong))
|
|
432
|
+
await nextSong.resolve(player);
|
|
433
|
+
player.queue.current = nextSong || null;
|
|
434
|
+
// save it in the DB
|
|
435
|
+
await player.queue.utils.save();
|
|
436
|
+
}
|
|
437
|
+
catch (error) {
|
|
438
|
+
if (player.LavalinkManager.options?.advancedOptions?.enableDebugEvents) {
|
|
439
|
+
player.LavalinkManager.emit("debug", Constants_1.DebugEvents.PlayerPlayUnresolvedTrackFailed, {
|
|
440
|
+
state: "error",
|
|
441
|
+
error: error,
|
|
442
|
+
message: `queueTrackEnd Util was called, tried to resolve the next track, but failed to find the closest matching song`,
|
|
443
|
+
functionLayer: "Player > play() > resolve currentTrack",
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
player.LavalinkManager.emit("trackError", player, player.queue.current, error);
|
|
447
|
+
// try to play the next track if possible
|
|
448
|
+
if (player.LavalinkManager.options?.autoSkipOnResolveError === true && player.queue.tracks[0])
|
|
449
|
+
return queueTrackEnd(player);
|
|
450
|
+
}
|
|
435
451
|
// return the new current Track
|
|
436
452
|
return player.queue.current;
|
|
437
453
|
}
|
package/dist/esm/index.d.ts
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";
|
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,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 (
|
|
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
|
-
import { EventEmitter } from "
|
|
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";
|
|
2
|
+
import { EventEmitter } from "events";
|
|
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
|
-
import { EventEmitter } from "
|
|
2
|
-
import { DestroyReasons } from "./Constants";
|
|
3
|
-
import { LavalinkNode } from "./Node";
|
|
4
|
-
import { MiniMap } from "./Utils";
|
|
1
|
+
import { EventEmitter } from "events";
|
|
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
|
*/
|