hoshimi 0.3.3 → 0.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.
- package/dist/index.d.mts +2031 -1336
- package/dist/index.d.ts +2031 -1336
- package/dist/index.js +877 -302
- package/dist/index.mjs +863 -299
- package/package.json +10 -2
package/dist/index.mjs
CHANGED
|
@@ -29,6 +29,12 @@ var StorageError = class extends Error {
|
|
|
29
29
|
this.name = "Hoshimi [StorageError]";
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
|
+
var NodeManagerError = class extends Error {
|
|
33
|
+
constructor(message) {
|
|
34
|
+
super(message);
|
|
35
|
+
this.name = "Hoshimi [NodeManagerError]";
|
|
36
|
+
}
|
|
37
|
+
};
|
|
32
38
|
var ResolveError = class extends Error {
|
|
33
39
|
constructor(message) {
|
|
34
40
|
super(message);
|
|
@@ -73,6 +79,7 @@ var SearchEngines = /* @__PURE__ */ ((SearchEngines2) => {
|
|
|
73
79
|
SearchEngines2["Local"] = "local";
|
|
74
80
|
SearchEngines2["PornHub"] = "phsearch";
|
|
75
81
|
SearchEngines2["TextToSpeech"] = "speak";
|
|
82
|
+
SearchEngines2["HTTP"] = "http";
|
|
76
83
|
return SearchEngines2;
|
|
77
84
|
})(SearchEngines || {});
|
|
78
85
|
var DebugLevels = /* @__PURE__ */ ((DebugLevels2) => {
|
|
@@ -84,32 +91,33 @@ var DebugLevels = /* @__PURE__ */ ((DebugLevels2) => {
|
|
|
84
91
|
DebugLevels2[DebugLevels2["Test"] = 6] = "Test";
|
|
85
92
|
return DebugLevels2;
|
|
86
93
|
})(DebugLevels || {});
|
|
87
|
-
var
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
94
|
+
var EventNames = /* @__PURE__ */ ((EventNames2) => {
|
|
95
|
+
EventNames2["Debug"] = "debug";
|
|
96
|
+
EventNames2["Error"] = "error";
|
|
97
|
+
EventNames2["NodeRaw"] = "nodeRaw";
|
|
98
|
+
EventNames2["NodeError"] = "nodeError";
|
|
99
|
+
EventNames2["NodeReady"] = "nodeReady";
|
|
100
|
+
EventNames2["NodeDisconnect"] = "nodeDisconnect";
|
|
101
|
+
EventNames2["NodeReconnecting"] = "nodeReconnecting";
|
|
102
|
+
EventNames2["NodeDestroy"] = "nodeDestroy";
|
|
103
|
+
EventNames2["NodeResumed"] = "nodeResumed";
|
|
104
|
+
EventNames2["NodeCreate"] = "nodeCreate";
|
|
105
|
+
EventNames2["PlayerCreate"] = "playerCreate";
|
|
106
|
+
EventNames2["PlayerUpdate"] = "playerUpdate";
|
|
107
|
+
EventNames2["PlayerDestroy"] = "playerDestroy";
|
|
108
|
+
EventNames2["PlayerError"] = "playerError";
|
|
109
|
+
EventNames2["TrackStart"] = "trackStart";
|
|
110
|
+
EventNames2["TrackEnd"] = "trackEnd";
|
|
111
|
+
EventNames2["TrackStuck"] = "trackStuck";
|
|
112
|
+
EventNames2["TrackError"] = "trackError";
|
|
113
|
+
EventNames2["LyricsFound"] = "lyricsFound";
|
|
114
|
+
EventNames2["LyricsNotFound"] = "lyricsNotFound";
|
|
115
|
+
EventNames2["LyricsLine"] = "lyricsLine";
|
|
116
|
+
EventNames2["QueueEnd"] = "queueEnd";
|
|
117
|
+
EventNames2["QueueUpdate"] = "queueUpdate";
|
|
118
|
+
EventNames2["WebSocketClosed"] = "socketClosed";
|
|
119
|
+
return EventNames2;
|
|
120
|
+
})(EventNames || {});
|
|
113
121
|
var DestroyReasons = /* @__PURE__ */ ((DestroyReasons2) => {
|
|
114
122
|
DestroyReasons2["Stop"] = "Player-Stop";
|
|
115
123
|
DestroyReasons2["Requested"] = "Player-Requested";
|
|
@@ -117,6 +125,8 @@ var DestroyReasons = /* @__PURE__ */ ((DestroyReasons2) => {
|
|
|
117
125
|
DestroyReasons2["NodeDisconnected"] = "Player-NodeDisconnected";
|
|
118
126
|
DestroyReasons2["NodeDestroy"] = "Player-NodeDestroy";
|
|
119
127
|
DestroyReasons2["VoiceChannelDeleted"] = "Player-VoiceChannelDeleted";
|
|
128
|
+
DestroyReasons2["VoiceChannelLeft"] = "Player-VoiceChannelLeft";
|
|
129
|
+
DestroyReasons2["ReconnectFailed"] = "Player-ReconnectFailed";
|
|
120
130
|
return DestroyReasons2;
|
|
121
131
|
})(DestroyReasons || {});
|
|
122
132
|
|
|
@@ -279,9 +289,120 @@ var HttpStatusCodes = /* @__PURE__ */ ((HttpStatusCodes2) => {
|
|
|
279
289
|
HttpStatusCodes2[HttpStatusCodes2["GatewayTimeout"] = 504] = "GatewayTimeout";
|
|
280
290
|
return HttpStatusCodes2;
|
|
281
291
|
})(HttpStatusCodes || {});
|
|
292
|
+
var RestRoutes = {
|
|
293
|
+
/**
|
|
294
|
+
*
|
|
295
|
+
* Get the updated player endpoint.
|
|
296
|
+
* @param {string} sessionId The session id of the node.
|
|
297
|
+
* @param {string} guildId The guild id of the player.
|
|
298
|
+
* @returns {RestEndpoint} The endpoint for updating the player.
|
|
299
|
+
*/
|
|
300
|
+
UpdatePlayer(sessionId, guildId) {
|
|
301
|
+
return `/sessions/${sessionId}/players/${guildId}`;
|
|
302
|
+
},
|
|
303
|
+
/**
|
|
304
|
+
*
|
|
305
|
+
* Get the update session endpoint.
|
|
306
|
+
* @param {string} sessionId The session id of the node.
|
|
307
|
+
* @returns {RestEndpoint} The endpoint for updating the session.
|
|
308
|
+
*/
|
|
309
|
+
UpdateSession(sessionId) {
|
|
310
|
+
return `/sessions/${sessionId}`;
|
|
311
|
+
},
|
|
312
|
+
/**
|
|
313
|
+
*
|
|
314
|
+
* Get the get players endpoint.
|
|
315
|
+
* @param {string} sessionId The session id of the node.
|
|
316
|
+
* @returns {RestEndpoint} The endpoint for getting the players.
|
|
317
|
+
*/
|
|
318
|
+
GetPlayers(sessionId) {
|
|
319
|
+
return `/sessions/${sessionId}/players`;
|
|
320
|
+
},
|
|
321
|
+
/**
|
|
322
|
+
*
|
|
323
|
+
* Get the current lyrics endpoint.
|
|
324
|
+
* @param {string} sessionId The session id of the node.
|
|
325
|
+
* @param {string} guildId The guild id of the player.
|
|
326
|
+
* @returns {RestEndpoint} The endpoint for getting the current lyrics.
|
|
327
|
+
*/
|
|
328
|
+
CurrentLyrics(sessionId, guildId) {
|
|
329
|
+
return `/sessions/${sessionId}/players/${guildId}/track/lyrics`;
|
|
330
|
+
},
|
|
331
|
+
/**
|
|
332
|
+
*
|
|
333
|
+
* Subscribe to lyrics endpoint.
|
|
334
|
+
* @param {string} sessionId The session id of the node.
|
|
335
|
+
* @param {string} guildId The guild id of the player.
|
|
336
|
+
* @returns {RestEndpoint} The endpoint for subscribing to lyrics.
|
|
337
|
+
*/
|
|
338
|
+
SubscribeLyrics(sessionId, guildId) {
|
|
339
|
+
return `/sessions/${sessionId}/players/${guildId}/lyrics/subscribe`;
|
|
340
|
+
},
|
|
341
|
+
/**
|
|
342
|
+
* Get the lyrics endpoint.
|
|
343
|
+
* @type {RestEndpoint}
|
|
344
|
+
*/
|
|
345
|
+
GetLyrics: "/lyrics",
|
|
346
|
+
/**
|
|
347
|
+
* Get the decode track endpoint.
|
|
348
|
+
* @type {RestEndpoint}
|
|
349
|
+
*/
|
|
350
|
+
DecodeTrack: "/decodetrack",
|
|
351
|
+
/**
|
|
352
|
+
* Get the decode tracks endpoint.
|
|
353
|
+
* @type {RestEndpoint}
|
|
354
|
+
*/
|
|
355
|
+
DecodeTracks: "/decodetracks",
|
|
356
|
+
/**
|
|
357
|
+
* Get the load tracks endpoint.
|
|
358
|
+
* @type {RestEndpoint}
|
|
359
|
+
*/
|
|
360
|
+
LoadTracks: "/loadtracks",
|
|
361
|
+
/**
|
|
362
|
+
* Get the node info endpoint.
|
|
363
|
+
* @type {RestEndpoint}
|
|
364
|
+
*/
|
|
365
|
+
NodeInfo: "/info",
|
|
366
|
+
/**
|
|
367
|
+
* Get the load lyrics endpoint.
|
|
368
|
+
* @type {RestEndpoint}
|
|
369
|
+
* @description Used in NodelinkLyricsManager, only for nodelink nodes.
|
|
370
|
+
*/
|
|
371
|
+
LoadLyrics: "/loadlyrics",
|
|
372
|
+
/**
|
|
373
|
+
* Get the connection endpoint.
|
|
374
|
+
* @type {RestEndpoint}
|
|
375
|
+
* @description Used for checking the connection status of the node, only for nodelink nodes.
|
|
376
|
+
*/
|
|
377
|
+
Connection: "/connection"
|
|
378
|
+
};
|
|
379
|
+
|
|
380
|
+
// src/classes/storage/adapters/PlayerAdapter.ts
|
|
381
|
+
var PlayerStorageAdapter = class {
|
|
382
|
+
/**
|
|
383
|
+
* The namespace of the storage.
|
|
384
|
+
* @type {string}
|
|
385
|
+
* @default "hoshimiplayer"
|
|
386
|
+
* @example
|
|
387
|
+
* ```ts
|
|
388
|
+
* console.log(storage.namespace); // "hoshimiplayer"
|
|
389
|
+
* ```
|
|
390
|
+
*/
|
|
391
|
+
namespace = "hoshimiplayer";
|
|
392
|
+
};
|
|
282
393
|
|
|
283
|
-
// src/classes/
|
|
284
|
-
var
|
|
394
|
+
// src/classes/storage/adapters/QueueAdapter.ts
|
|
395
|
+
var QueueStorageAdapter = class {
|
|
396
|
+
/**
|
|
397
|
+
* The namespace of the storage.
|
|
398
|
+
* @type {string}
|
|
399
|
+
* @default "hoshimiqueue"
|
|
400
|
+
* @example
|
|
401
|
+
* ```ts
|
|
402
|
+
* console.log(storage.namespace); // "hoshimiqueue"
|
|
403
|
+
* ```
|
|
404
|
+
*/
|
|
405
|
+
namespace = "hoshimiqueue";
|
|
285
406
|
};
|
|
286
407
|
|
|
287
408
|
// src/classes/Track.ts
|
|
@@ -304,7 +425,7 @@ var Track = class {
|
|
|
304
425
|
pluginInfo;
|
|
305
426
|
/**
|
|
306
427
|
* The track user data.
|
|
307
|
-
* @type {
|
|
428
|
+
* @type {TrackUserData}
|
|
308
429
|
*/
|
|
309
430
|
userData;
|
|
310
431
|
/**
|
|
@@ -374,7 +495,7 @@ var UnresolvedTrack = class {
|
|
|
374
495
|
pluginInfo;
|
|
375
496
|
/**
|
|
376
497
|
* The track user data.
|
|
377
|
-
* @type {
|
|
498
|
+
* @type {TrackUserData | undefined}
|
|
378
499
|
*/
|
|
379
500
|
userData;
|
|
380
501
|
/**
|
|
@@ -402,7 +523,7 @@ var UnresolvedTrack = class {
|
|
|
402
523
|
constructor(track, requester) {
|
|
403
524
|
this.info = track.info;
|
|
404
525
|
this.encoded = track.encoded;
|
|
405
|
-
this.requester = requester;
|
|
526
|
+
this.requester = requester ?? {};
|
|
406
527
|
this.pluginInfo = track.pluginInfo;
|
|
407
528
|
this.userData = track.userData ?? {};
|
|
408
529
|
}
|
|
@@ -424,10 +545,14 @@ var UnresolvedTrack = class {
|
|
|
424
545
|
if (this.info.uri) {
|
|
425
546
|
const track = await player.search({ query: this.info.uri, requester: this.requester }).then((result) => result.tracks[0]);
|
|
426
547
|
if (!track) throw new ResolveError("Track could not be resolved from URI.");
|
|
427
|
-
player.manager.emit(
|
|
548
|
+
player.manager.emit(
|
|
549
|
+
"debug" /* Debug */,
|
|
550
|
+
3 /* Player */,
|
|
551
|
+
`[Unresolved] -> [Track] Resolved the track from URI: ${this.info.uri}`
|
|
552
|
+
);
|
|
428
553
|
return track;
|
|
429
554
|
}
|
|
430
|
-
const query = [this.info.title, this.info.
|
|
555
|
+
const query = [this.info.title, this.info.author].filter(Boolean).join(" by ");
|
|
431
556
|
const excluded = ["twitch" /* Twitch */, "flowery-tts" /* FloweryTTS */, "mixer" /* Mixer */, "vimeo" /* Vimeo */];
|
|
432
557
|
const engine = this.info.sourceName && !excluded.includes(this.info.sourceName) ? validateEngine(this.info.sourceName) : player.manager.options.defaultSearchEngine;
|
|
433
558
|
player.manager.emit(
|
|
@@ -464,12 +589,20 @@ var UnresolvedTrack = class {
|
|
|
464
589
|
// package.json
|
|
465
590
|
var package_default = {
|
|
466
591
|
name: "hoshimi",
|
|
467
|
-
version: "0.3.
|
|
592
|
+
version: "0.3.6",
|
|
468
593
|
description: "A lavalink@v4 client easy to use, up-to-date and all ears.",
|
|
469
594
|
main: "./dist/index.js",
|
|
470
595
|
module: "./dist/index.mjs",
|
|
471
596
|
types: "./dist/index.d.ts",
|
|
472
|
-
packageManager: "pnpm@10.
|
|
597
|
+
packageManager: "pnpm@10.29.3+sha512.498e1fb4cca5aa06c1dcf2611e6fafc50972ffe7189998c409e90de74566444298ffe43e6cd2acdc775ba1aa7cc5e092a8b7054c811ba8c5770f84693d33d2dc",
|
|
598
|
+
exports: {
|
|
599
|
+
".": {
|
|
600
|
+
types: "./dist/index.d.ts",
|
|
601
|
+
require: "./dist/index.js",
|
|
602
|
+
import: "./dist/index.mjs",
|
|
603
|
+
default: "./dist/index.js"
|
|
604
|
+
}
|
|
605
|
+
},
|
|
473
606
|
files: [
|
|
474
607
|
"dist"
|
|
475
608
|
],
|
|
@@ -505,8 +638,8 @@ var package_default = {
|
|
|
505
638
|
author: "Ganyu Studios",
|
|
506
639
|
license: "MIT",
|
|
507
640
|
devDependencies: {
|
|
508
|
-
"@biomejs/biome": "^2.3.
|
|
509
|
-
"@types/node": "^25.
|
|
641
|
+
"@biomejs/biome": "^2.3.15",
|
|
642
|
+
"@types/node": "^25.2.3",
|
|
510
643
|
"@types/ws": "^8.18.1",
|
|
511
644
|
husky: "^9.1.7",
|
|
512
645
|
"lint-staged": "^16.2.7",
|
|
@@ -515,7 +648,7 @@ var package_default = {
|
|
|
515
648
|
typescript: "^5.9.3"
|
|
516
649
|
},
|
|
517
650
|
dependencies: {
|
|
518
|
-
ws: "^8.
|
|
651
|
+
ws: "^8.19.0"
|
|
519
652
|
},
|
|
520
653
|
pnpm: {
|
|
521
654
|
onlyBuiltDependencies: [
|
|
@@ -694,20 +827,53 @@ function validateManagerOptions(options) {
|
|
|
694
827
|
throw new OptionError("The manager option 'options.nodes' must be a valid array of nodes and atleast one valid node.");
|
|
695
828
|
if (typeof options.sendPayload !== "function")
|
|
696
829
|
throw new OptionError("The manager option 'options.sendPayload' must be a vaid function.");
|
|
697
|
-
if (typeof options.queueOptions !== "undefined" && typeof options.queueOptions.maxPreviousTracks !== "number")
|
|
698
|
-
throw new OptionError("The manager option 'options.queueOptions.maxPreviousTracks' must be a number.");
|
|
699
|
-
if (typeof options.queueOptions !== "undefined" && typeof options.queueOptions.autoplayFn !== "function")
|
|
700
|
-
throw new OptionError("The manager option 'options.queueOptions.autoplayFn' must be a function.");
|
|
701
|
-
if (typeof options.queueOptions?.storage !== "undefined" && !(options.queueOptions.storage instanceof StorageAdapter))
|
|
702
|
-
throw new OptionError("The manager option 'options.queueOptions.storage' must be a valid storage manager.");
|
|
703
830
|
if (typeof options.defaultSearchEngine !== "undefined" && !ValidEngines.includes(options.defaultSearchEngine))
|
|
704
831
|
throw new OptionError("The manager option 'options.defaultSearchEngine' Must be a valid search engine.");
|
|
705
|
-
if (typeof options.
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
832
|
+
if (typeof options.queueOptions !== "undefined") {
|
|
833
|
+
if (typeof options.queueOptions.maxHistory !== "number")
|
|
834
|
+
throw new OptionError("The manager option 'options.queueOptions.maxPreviousTracks' must be a number.");
|
|
835
|
+
if (typeof options.queueOptions.autoplayFn !== "function")
|
|
836
|
+
throw new OptionError("The manager option 'options.queueOptions.autoplayFn' must be a function.");
|
|
837
|
+
if (typeof options.queueOptions.storage !== "undefined" && !(options.queueOptions.storage instanceof QueueStorageAdapter))
|
|
838
|
+
throw new OptionError("The manager option 'options.queueOptions.storage' must be a valid storage manager.");
|
|
839
|
+
if (typeof options.queueOptions.autoPlay !== "undefined" && typeof options.queueOptions.autoPlay !== "boolean")
|
|
840
|
+
throw new OptionError("The manager option 'options.queueOptions.autoPlay' must be a boolean.");
|
|
841
|
+
}
|
|
842
|
+
if (typeof options.playerOptions !== "undefined") {
|
|
843
|
+
if (!(options.playerOptions.storage instanceof PlayerStorageAdapter))
|
|
844
|
+
throw new OptionError("The manager option 'options.playerOptions.storage' must be a valid storage manager.");
|
|
845
|
+
if (typeof options.playerOptions.requesterFn !== "function")
|
|
846
|
+
throw new OptionError("The manager option 'options.playerOptions.requesterFn' must be a valid function.");
|
|
847
|
+
if (typeof options.playerOptions.onError !== "undefined") {
|
|
848
|
+
if (typeof options.playerOptions.onError.autoDestroy !== "boolean")
|
|
849
|
+
throw new OptionError("The manager option 'options.playerOptions.onError.autoDestroy' must be a boolean.");
|
|
850
|
+
if (typeof options.playerOptions.onError.autoSkip !== "boolean")
|
|
851
|
+
throw new OptionError("The manager option 'options.playerOptions.onError.autoSkip' must be a boolean.");
|
|
852
|
+
if (typeof options.playerOptions.onError.autoStop !== "boolean")
|
|
853
|
+
throw new OptionError("The manager option 'options.playerOptions.onError.autoStop' must be a boolean.");
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
if (typeof options.client !== "undefined") {
|
|
857
|
+
if (typeof options.client !== "object") throw new OptionError("The manager option 'options.client' Must be a valid object.");
|
|
858
|
+
if (typeof options.client.id !== "undefined" && typeof options.client.id !== "string")
|
|
859
|
+
throw new OptionError("The manager option 'options.client.id' Must be a valid string.");
|
|
860
|
+
if (typeof options.client.username !== "undefined" && typeof options.client.username !== "string")
|
|
861
|
+
throw new OptionError("The manager option 'options.client.username' must be a valid string.");
|
|
862
|
+
}
|
|
863
|
+
if (typeof options.nodeOptions !== "undefined") {
|
|
864
|
+
if (typeof options.nodeOptions.resumable !== "undefined" && typeof options.nodeOptions.resumable !== "boolean")
|
|
865
|
+
throw new OptionError("The manager option 'options.nodeOptions.resumable' must be a boolean.");
|
|
866
|
+
if (typeof options.nodeOptions.resumeTimeout !== "undefined" && typeof options.nodeOptions.resumeTimeout !== "number")
|
|
867
|
+
throw new OptionError("The manager option 'options.nodeOptions.resumeTimeout' must be a number.");
|
|
868
|
+
if (typeof options.nodeOptions.resumeByLibrary !== "undefined" && typeof options.nodeOptions.resumeByLibrary !== "boolean")
|
|
869
|
+
throw new OptionError("The manager option 'options.nodeOptions.resumeByLibrary' must be a boolean.");
|
|
870
|
+
if (typeof options.nodeOptions.userAgent !== "undefined" && typeof options.nodeOptions.userAgent !== "string")
|
|
871
|
+
throw new OptionError("The manager option 'options.nodeOptions.userAgent' must be a string.");
|
|
872
|
+
}
|
|
873
|
+
if (typeof options.restOptions !== "undefined") {
|
|
874
|
+
if (typeof options.restOptions.resumeTimeout !== "undefined" && typeof options.restOptions.resumeTimeout !== "number")
|
|
875
|
+
throw new OptionError("The manager option 'options.restOptions.resumeTimeout' must be a number.");
|
|
876
|
+
}
|
|
711
877
|
}
|
|
712
878
|
function validateQuery(search) {
|
|
713
879
|
if (typeof search !== "object") throw new OptionError("The 'query' must be a valid object.");
|
|
@@ -755,6 +921,11 @@ function validatePlayerData(data) {
|
|
|
755
921
|
player.lastPosition = data.playerOptions.position;
|
|
756
922
|
player.lastPositionUpdate = Date.now();
|
|
757
923
|
}
|
|
924
|
+
if (typeof data.playerOptions.filters === "object") {
|
|
925
|
+
const timescale = Object.freeze({ ...player.filterManager.data.timescale });
|
|
926
|
+
Object.assign(player.filterManager.data, data.playerOptions.filters);
|
|
927
|
+
player.filterManager.check(timescale);
|
|
928
|
+
}
|
|
758
929
|
}
|
|
759
930
|
}
|
|
760
931
|
function validateNodePlugins(node, plugins) {
|
|
@@ -779,9 +950,11 @@ function validateEngine(type) {
|
|
|
779
950
|
}
|
|
780
951
|
function validateTrack(player, track) {
|
|
781
952
|
if (!track) return Promise.resolve(null);
|
|
782
|
-
|
|
953
|
+
const requesterFn2 = player.manager.options.playerOptions.requesterFn;
|
|
954
|
+
if (isTrack(track)) return Promise.resolve(new Track(track, requesterFn2(track.requester)));
|
|
783
955
|
if (!isUnresolvedTrack(track)) throw new ResolveError("The track is not a valid unresolved track.");
|
|
784
|
-
if (!track.resolve || typeof track.resolve !== "function")
|
|
956
|
+
if (!track.resolve || typeof track.resolve !== "function")
|
|
957
|
+
return new UnresolvedTrack(track, requesterFn2(track.requester)).resolve(player);
|
|
785
958
|
return track.resolve(player);
|
|
786
959
|
}
|
|
787
960
|
var isTrack = (track) => {
|
|
@@ -813,6 +986,9 @@ function stringify(value, space) {
|
|
|
813
986
|
space
|
|
814
987
|
);
|
|
815
988
|
}
|
|
989
|
+
function requesterFn(requester) {
|
|
990
|
+
return requester;
|
|
991
|
+
}
|
|
816
992
|
function isNode(options) {
|
|
817
993
|
return typeof options.host === "string" && typeof options.port === "number" && typeof options.password === "string" && (typeof options.id === "string" || typeof options.id === "undefined") && (typeof options.secure === "boolean" || typeof options.secure === "undefined") && (typeof options.sessionId === "string" || typeof options.sessionId === "undefined") && (typeof options.retryAmount === "number" || typeof options.retryAmount === "undefined") && (typeof options.retryDelay === "number" || typeof options.retryDelay === "undefined");
|
|
818
994
|
}
|
|
@@ -852,7 +1028,7 @@ var LyricsManager = class {
|
|
|
852
1028
|
if (!this.node.sessionId) return null;
|
|
853
1029
|
validateNodePlugins(this.node, ["lavalyrics-plugin" /* LavaLyrics */, "java-lyrics-plugin" /* JavaLyrics */, "lavasrc-plugin" /* LavaSrc */]);
|
|
854
1030
|
return this.node.rest.request({
|
|
855
|
-
endpoint:
|
|
1031
|
+
endpoint: RestRoutes.CurrentLyrics(this.node.sessionId, guildId),
|
|
856
1032
|
params: {
|
|
857
1033
|
skipTrackSource: `${skipSource}`
|
|
858
1034
|
}
|
|
@@ -874,7 +1050,7 @@ var LyricsManager = class {
|
|
|
874
1050
|
if (!this.node.sessionId) return null;
|
|
875
1051
|
validateNodePlugins(this.node, ["lavalyrics-plugin" /* LavaLyrics */, "java-lyrics-plugin" /* JavaLyrics */, "lavasrc-plugin" /* LavaSrc */]);
|
|
876
1052
|
return this.node.rest.request({
|
|
877
|
-
endpoint:
|
|
1053
|
+
endpoint: RestRoutes.GetLyrics,
|
|
878
1054
|
params: {
|
|
879
1055
|
track: track.encoded,
|
|
880
1056
|
skipTrackSource: `${skipSource}`
|
|
@@ -897,7 +1073,7 @@ var LyricsManager = class {
|
|
|
897
1073
|
if (!this.node.sessionId) return;
|
|
898
1074
|
validateNodePlugins(this.node, ["lavalyrics-plugin" /* LavaLyrics */, "java-lyrics-plugin" /* JavaLyrics */, "lavasrc-plugin" /* LavaSrc */]);
|
|
899
1075
|
await this.node.rest.request({
|
|
900
|
-
endpoint:
|
|
1076
|
+
endpoint: RestRoutes.SubscribeLyrics(this.node.sessionId, guildId),
|
|
901
1077
|
method: "POST" /* Post */,
|
|
902
1078
|
params: {
|
|
903
1079
|
skipTrackSource: `${skipSource}`
|
|
@@ -919,7 +1095,7 @@ var LyricsManager = class {
|
|
|
919
1095
|
if (!this.node.sessionId) return;
|
|
920
1096
|
validateNodePlugins(this.node, ["lavalyrics-plugin" /* LavaLyrics */, "java-lyrics-plugin" /* JavaLyrics */, "lavasrc-plugin" /* LavaSrc */]);
|
|
921
1097
|
await this.node.rest.request({
|
|
922
|
-
endpoint:
|
|
1098
|
+
endpoint: RestRoutes.SubscribeLyrics(this.node.sessionId, guildId),
|
|
923
1099
|
method: "DELETE" /* Delete */
|
|
924
1100
|
});
|
|
925
1101
|
}
|
|
@@ -1186,7 +1362,7 @@ var NodeManager = class {
|
|
|
1186
1362
|
*/
|
|
1187
1363
|
getLeastUsed(sortType = "penalties" /* Penalties */) {
|
|
1188
1364
|
const nodes = this.nodes.filter((node) => node.state === 2 /* Connected */);
|
|
1189
|
-
if (!nodes.length) throw new
|
|
1365
|
+
if (!nodes.length) throw new NodeManagerError("No connected nodes available.");
|
|
1190
1366
|
switch (sortType) {
|
|
1191
1367
|
case "players" /* Players */:
|
|
1192
1368
|
return nodes.reduce((a, b) => (a.stats?.players ?? 0) < (b.stats?.players ?? 0) ? a : b);
|
|
@@ -1311,8 +1487,8 @@ async function onEnd() {
|
|
|
1311
1487
|
(x) => x.info.identifier === this.queue.current.info.identifier && x.info.title === this.queue.current.info.title
|
|
1312
1488
|
)) {
|
|
1313
1489
|
this.queue.history.unshift(this.queue.current);
|
|
1314
|
-
if (this.queue.history.length > this.manager.options.queueOptions.
|
|
1315
|
-
this.queue.history.splice(this.manager.options.queueOptions.
|
|
1490
|
+
if (this.queue.history.length > this.manager.options.queueOptions.maxHistory)
|
|
1491
|
+
this.queue.history.splice(this.manager.options.queueOptions.maxHistory, this.queue.history.length);
|
|
1316
1492
|
await this.queue.utils.save();
|
|
1317
1493
|
this.manager.emit(
|
|
1318
1494
|
"debug" /* Debug */,
|
|
@@ -1322,7 +1498,7 @@ async function onEnd() {
|
|
|
1322
1498
|
}
|
|
1323
1499
|
if (this.loop === 1 /* Track */ && this.queue.current) this.queue.unshift(this.queue.current);
|
|
1324
1500
|
if (this.loop === 2 /* Queue */ && this.queue.current) this.queue.add(this.queue.current);
|
|
1325
|
-
if (!this.queue.current) this.queue.current = await validateTrack(this, this.queue.shift());
|
|
1501
|
+
if (!this.queue.current) this.queue.current = await validateTrack(this, await this.queue.shift());
|
|
1326
1502
|
await this.queue.utils.save();
|
|
1327
1503
|
return;
|
|
1328
1504
|
}
|
|
@@ -1469,6 +1645,43 @@ async function socketClosed(payload) {
|
|
|
1469
1645
|
`[Player] -> [Socket] The socket has closed: ${this.guildId} | Payload: ${stringify(payload)}`
|
|
1470
1646
|
);
|
|
1471
1647
|
}
|
|
1648
|
+
async function resumeByLibrary(players) {
|
|
1649
|
+
this.nodeManager.manager.emit("debug" /* Debug */, 2 /* Node */, `[Socket] -> [${this.id}]: Resuming session by library...`);
|
|
1650
|
+
for (const player of players) {
|
|
1651
|
+
try {
|
|
1652
|
+
if (!player.playing && !player.paused && !player.queue.totalSize) {
|
|
1653
|
+
this.nodeManager.manager.emit(
|
|
1654
|
+
"debug" /* Debug */,
|
|
1655
|
+
2 /* Node */,
|
|
1656
|
+
`[Player] -> [Resume] Destroyed player for guild ${player.guildId} due to empty queue.`
|
|
1657
|
+
);
|
|
1658
|
+
await player.destroy();
|
|
1659
|
+
return;
|
|
1660
|
+
}
|
|
1661
|
+
const track = player.queue.current;
|
|
1662
|
+
await player.node.updatePlayer({
|
|
1663
|
+
guildId: player.guildId,
|
|
1664
|
+
playerOptions: { voice: player.voice }
|
|
1665
|
+
});
|
|
1666
|
+
await player.connect();
|
|
1667
|
+
await player.queue.utils.sync(false, true);
|
|
1668
|
+
if (track)
|
|
1669
|
+
await player.play({
|
|
1670
|
+
track,
|
|
1671
|
+
noReplace: false,
|
|
1672
|
+
position: player.lastPosition,
|
|
1673
|
+
paused: player.paused
|
|
1674
|
+
});
|
|
1675
|
+
} catch (error) {
|
|
1676
|
+
this.nodeManager.manager.emit("nodeError" /* NodeError */, this, error);
|
|
1677
|
+
}
|
|
1678
|
+
this.nodeManager.manager.emit(
|
|
1679
|
+
"debug" /* Debug */,
|
|
1680
|
+
2 /* Node */,
|
|
1681
|
+
`[Player] -> [Resume] Resumed player for guild ${player.guildId} using the library.`
|
|
1682
|
+
);
|
|
1683
|
+
}
|
|
1684
|
+
}
|
|
1472
1685
|
|
|
1473
1686
|
// src/util/events/websocket.ts
|
|
1474
1687
|
function onOpen(res) {
|
|
@@ -1541,34 +1754,36 @@ async function onMessage(message) {
|
|
|
1541
1754
|
this.sessionId = payload.sessionId;
|
|
1542
1755
|
this.session.resuming = payload.resumed;
|
|
1543
1756
|
if (payload.resumed) {
|
|
1544
|
-
const
|
|
1545
|
-
endpoint: `/sessions/${payload.sessionId}/players`
|
|
1546
|
-
}) ?? [];
|
|
1757
|
+
const players2 = await this.rest.getPlayers();
|
|
1547
1758
|
const timeout = this.nodeManager.manager.options.nodeOptions.resumeTimeout;
|
|
1548
|
-
this.nodeManager.manager.emit("nodeResumed" /* NodeResumed */, this,
|
|
1759
|
+
this.nodeManager.manager.emit("nodeResumed" /* NodeResumed */, this, players2, payload);
|
|
1549
1760
|
this.nodeManager.manager.emit(
|
|
1550
1761
|
"debug" /* Debug */,
|
|
1551
1762
|
2 /* Node */,
|
|
1552
|
-
`[Socket] <- [${this.id}]: Resumed session. | Session id: ${payload.sessionId} | Players: ${
|
|
1763
|
+
`[Socket] <- [${this.id}]: Resumed session. | Session id: ${payload.sessionId} | Players: ${players2.length} | Resumed: ${payload.resumed} | Timeout: ${timeout}ms`
|
|
1553
1764
|
);
|
|
1554
1765
|
}
|
|
1555
|
-
|
|
1556
|
-
this.nodeManager.manager.
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
const isResumable = this.nodeManager.manager.options.nodeOptions.resumable;
|
|
1563
|
-
if (isResumable) {
|
|
1766
|
+
const players = this.nodeManager.manager.players.filter((p) => p.node.id === this.id);
|
|
1767
|
+
const isLibrary = this.nodeManager.manager.options.nodeOptions.resumeByLibrary;
|
|
1768
|
+
if (!payload.resumed && isLibrary && players.length) await resumeByLibrary.call(this, players);
|
|
1769
|
+
this.info = await this.rest.request({ endpoint: RestRoutes.NodeInfo });
|
|
1770
|
+
if (this.info) this.info.isNodelink = !!this.info.isNodelink;
|
|
1771
|
+
const resuming = this.nodeManager.manager.options.nodeOptions.resumable;
|
|
1772
|
+
if (resuming) {
|
|
1564
1773
|
const timeout = this.nodeManager.manager.options.nodeOptions.resumeTimeout;
|
|
1565
1774
|
this.nodeManager.manager.emit(
|
|
1566
1775
|
"debug" /* Debug */,
|
|
1567
1776
|
2 /* Node */,
|
|
1568
|
-
`[Socket] -> [${this.id}]:
|
|
1777
|
+
`[Socket] -> [${this.id}]: Setting timeout to resume session. | Timeout: ${timeout}ms`
|
|
1569
1778
|
);
|
|
1570
|
-
await this.updateSession(
|
|
1779
|
+
await this.updateSession({ resuming, timeout });
|
|
1571
1780
|
}
|
|
1781
|
+
this.nodeManager.manager.emit(
|
|
1782
|
+
"debug" /* Debug */,
|
|
1783
|
+
2 /* Node */,
|
|
1784
|
+
`[Socket] <- [${this.id}]: Received ready event. | Session id: ${payload.sessionId} | Resumed: ${payload.resumed}`
|
|
1785
|
+
);
|
|
1786
|
+
this.nodeManager.manager.emit("nodeReady" /* NodeReady */, this, this.retryAmount, payload);
|
|
1572
1787
|
}
|
|
1573
1788
|
break;
|
|
1574
1789
|
case "event" /* Event */: {
|
|
@@ -1616,7 +1831,11 @@ async function onMessage(message) {
|
|
|
1616
1831
|
break;
|
|
1617
1832
|
}
|
|
1618
1833
|
}
|
|
1619
|
-
this.nodeManager.manager.emit(
|
|
1834
|
+
this.nodeManager.manager.emit(
|
|
1835
|
+
"debug" /* Debug */,
|
|
1836
|
+
2 /* Node */,
|
|
1837
|
+
`[Socket] -> [${this.id}]: Received payload: ${stringify(payload)}`
|
|
1838
|
+
);
|
|
1620
1839
|
} catch (error) {
|
|
1621
1840
|
this.nodeManager.manager.emit("nodeError" /* NodeError */, this, error);
|
|
1622
1841
|
}
|
|
@@ -1641,7 +1860,7 @@ var Node = class {
|
|
|
1641
1860
|
nodeManager;
|
|
1642
1861
|
/**
|
|
1643
1862
|
* The lyrics manager for the node.
|
|
1644
|
-
* @type {
|
|
1863
|
+
* @type {LyricsManagerStructure}
|
|
1645
1864
|
*/
|
|
1646
1865
|
lyricsManager;
|
|
1647
1866
|
/**
|
|
@@ -1742,14 +1961,14 @@ var Node = class {
|
|
|
1742
1961
|
decode = {
|
|
1743
1962
|
single: async (track, requester) => {
|
|
1744
1963
|
const raw = await this.rest.request({
|
|
1745
|
-
endpoint:
|
|
1964
|
+
endpoint: RestRoutes.DecodeTrack,
|
|
1746
1965
|
params: { encodedTrack: track }
|
|
1747
1966
|
});
|
|
1748
1967
|
return new Track(raw, requester);
|
|
1749
1968
|
},
|
|
1750
1969
|
multiple: async (tracks, requester) => {
|
|
1751
1970
|
const raw = await this.rest.request({
|
|
1752
|
-
endpoint:
|
|
1971
|
+
endpoint: RestRoutes.DecodeTracks,
|
|
1753
1972
|
method: "POST" /* Post */,
|
|
1754
1973
|
body: stringify(tracks)
|
|
1755
1974
|
}) ?? [];
|
|
@@ -1771,6 +1990,25 @@ var Node = class {
|
|
|
1771
1990
|
get id() {
|
|
1772
1991
|
return this.options.id;
|
|
1773
1992
|
}
|
|
1993
|
+
/**
|
|
1994
|
+
*
|
|
1995
|
+
* Check if the node is a Nodelink node.
|
|
1996
|
+
* @returns {boolean} True if the node is a Nodelink node, false otherwise.
|
|
1997
|
+
* @example
|
|
1998
|
+
* ```ts
|
|
1999
|
+
* const node = manager.nodeManager.get("node1");
|
|
2000
|
+
* if (node) {
|
|
2001
|
+
* if (node.isNodelink()) {
|
|
2002
|
+
* console.log("The node is a Nodelink node");
|
|
2003
|
+
* } else {
|
|
2004
|
+
* console.log("The node is a Lavalink node");
|
|
2005
|
+
* }
|
|
2006
|
+
* }
|
|
2007
|
+
* ```
|
|
2008
|
+
*/
|
|
2009
|
+
isNodelink() {
|
|
2010
|
+
return this.info?.isNodelink ?? false;
|
|
2011
|
+
}
|
|
1774
2012
|
/**
|
|
1775
2013
|
* The socket address to connect the node.
|
|
1776
2014
|
* @type {string}
|
|
@@ -1830,7 +2068,7 @@ var Node = class {
|
|
|
1830
2068
|
search.engine ??= this.nodeManager.manager.options.defaultSearchEngine;
|
|
1831
2069
|
const identifier = validateQuery(search);
|
|
1832
2070
|
return this.rest.request({
|
|
1833
|
-
endpoint:
|
|
2071
|
+
endpoint: RestRoutes.LoadTracks,
|
|
1834
2072
|
params: {
|
|
1835
2073
|
identifier,
|
|
1836
2074
|
...search.params
|
|
@@ -1994,21 +2232,20 @@ var Node = class {
|
|
|
1994
2232
|
/**
|
|
1995
2233
|
*
|
|
1996
2234
|
* Update the session for the node
|
|
1997
|
-
* @param {
|
|
1998
|
-
* @param {number | null} timeout The timeout for the session.
|
|
2235
|
+
* @param {SessionResumingOptions} options The session resuming options.
|
|
1999
2236
|
* @returns {Promise<LavalinkSession | null>}
|
|
2000
2237
|
* @example
|
|
2001
2238
|
* ```ts
|
|
2002
2239
|
* const node = manager.nodeManager.get("node1");
|
|
2003
2240
|
* if (node) {
|
|
2004
|
-
* const session = await node.updateSession(true,
|
|
2241
|
+
* const session = await node.updateSession({ resuming: true, timeout: 30000 });
|
|
2005
2242
|
* console.log(session); // the lavalink session
|
|
2006
2243
|
* }
|
|
2007
2244
|
* ```
|
|
2008
2245
|
*/
|
|
2009
|
-
async updateSession(
|
|
2246
|
+
async updateSession(options) {
|
|
2010
2247
|
if (!this.sessionId) return null;
|
|
2011
|
-
const session = await this.rest.updateSession(
|
|
2248
|
+
const session = await this.rest.updateSession(options);
|
|
2012
2249
|
if (session) this.session = session;
|
|
2013
2250
|
return session;
|
|
2014
2251
|
}
|
|
@@ -2264,7 +2501,7 @@ var Rest = class {
|
|
|
2264
2501
|
validatePlayerData.call(this.node, data);
|
|
2265
2502
|
return this.request({
|
|
2266
2503
|
method: "PATCH" /* Patch */,
|
|
2267
|
-
endpoint:
|
|
2504
|
+
endpoint: RestRoutes.UpdatePlayer(this.sessionId, data.guildId),
|
|
2268
2505
|
body: { ...data.playerOptions },
|
|
2269
2506
|
params: { noReplace: `${data.noReplace ?? false}` }
|
|
2270
2507
|
});
|
|
@@ -2315,23 +2552,23 @@ var Rest = class {
|
|
|
2315
2552
|
);
|
|
2316
2553
|
await this.request({
|
|
2317
2554
|
method: "DELETE" /* Delete */,
|
|
2318
|
-
endpoint:
|
|
2555
|
+
endpoint: RestRoutes.UpdatePlayer(this.sessionId, guildId)
|
|
2319
2556
|
});
|
|
2320
2557
|
}
|
|
2321
2558
|
/**
|
|
2322
2559
|
*
|
|
2323
2560
|
* Update the session for the node
|
|
2324
|
-
* @param {
|
|
2325
|
-
* @param {number | null} timeout The timeout for the session.
|
|
2561
|
+
* @param {SessionResumingOptions} options The session resuming options.
|
|
2326
2562
|
* @returns {Promise<LavalinkSession | null>} The updated session data.
|
|
2327
2563
|
* @example
|
|
2328
2564
|
* ```ts
|
|
2329
|
-
* const session = await node.rest.updateSession(true,
|
|
2565
|
+
* const session = await node.rest.updateSession({ resuming: true, timeout: 30000 });
|
|
2330
2566
|
* if (session) console.log(session); // The lavalink session data
|
|
2331
2567
|
* ```
|
|
2332
2568
|
*/
|
|
2333
|
-
updateSession(
|
|
2569
|
+
updateSession(options) {
|
|
2334
2570
|
if (!this.sessionId) return Promise.resolve(null);
|
|
2571
|
+
const { resuming, timeout } = options;
|
|
2335
2572
|
this.node.nodeManager.manager.emit(
|
|
2336
2573
|
"debug" /* Debug */,
|
|
2337
2574
|
4 /* Rest */,
|
|
@@ -2339,10 +2576,40 @@ var Rest = class {
|
|
|
2339
2576
|
);
|
|
2340
2577
|
return this.request({
|
|
2341
2578
|
method: "PATCH" /* Patch */,
|
|
2342
|
-
endpoint:
|
|
2579
|
+
endpoint: RestRoutes.UpdateSession(this.sessionId),
|
|
2343
2580
|
body: { resuming, timeout }
|
|
2344
2581
|
});
|
|
2345
2582
|
}
|
|
2583
|
+
/**
|
|
2584
|
+
*
|
|
2585
|
+
* Get all players for the current session.
|
|
2586
|
+
* @returns {Promise<LavalinkPlayer[]>} The players for the current session.
|
|
2587
|
+
* @example
|
|
2588
|
+
* ```ts
|
|
2589
|
+
* const players = await node.rest.getPlayers();
|
|
2590
|
+
* console.log(players); // The lavalink players for the current session
|
|
2591
|
+
* ```
|
|
2592
|
+
*/
|
|
2593
|
+
async getPlayers() {
|
|
2594
|
+
if (!this.sessionId) return [];
|
|
2595
|
+
this.node.nodeManager.manager.emit(
|
|
2596
|
+
"debug" /* Debug */,
|
|
2597
|
+
4 /* Rest */,
|
|
2598
|
+
`[Rest] -> [${this.node.id}]: Fetching all players for session id: ${this.sessionId}`
|
|
2599
|
+
);
|
|
2600
|
+
const players = await this.request({
|
|
2601
|
+
endpoint: RestRoutes.GetPlayers(this.sessionId)
|
|
2602
|
+
}) ?? [];
|
|
2603
|
+
if (!players.length) {
|
|
2604
|
+
this.node.nodeManager.manager.emit(
|
|
2605
|
+
"debug" /* Debug */,
|
|
2606
|
+
4 /* Rest */,
|
|
2607
|
+
`[Rest] <- [${this.node.id}]: No players found for session id: ${this.sessionId}`
|
|
2608
|
+
);
|
|
2609
|
+
return [];
|
|
2610
|
+
}
|
|
2611
|
+
return players;
|
|
2612
|
+
}
|
|
2346
2613
|
};
|
|
2347
2614
|
|
|
2348
2615
|
// src/classes/player/filters/DSPXPlugin.ts
|
|
@@ -2365,6 +2632,14 @@ var DSPXPluginFilter = class {
|
|
|
2365
2632
|
* Set the low-pass filter with the given settings.
|
|
2366
2633
|
* @param {FilterPluginPassSettings} [settings=DefaultFilter.DSPXLowPass] The settings for the low-pass filter.
|
|
2367
2634
|
* @returns {Promise<this>} The instance of the filter manager.
|
|
2635
|
+
* @throws {PlayerError} If the node does not have the required plugin or filter enabled.
|
|
2636
|
+
* @example
|
|
2637
|
+
* ```ts
|
|
2638
|
+
* // Set the low-pass filter with custom settings
|
|
2639
|
+
* await player.filterManager.dspxPlugin.setLowPass({ cutoffFrequency: 500, boostFactor: 1.5 });
|
|
2640
|
+
* // Disable the low-pass filter
|
|
2641
|
+
* await player.filterManager.dspxPlugin.setLowPass();
|
|
2642
|
+
* ```
|
|
2368
2643
|
*/
|
|
2369
2644
|
async setLowPass(settings = DefaultFilterPreset.DSPXLowPass) {
|
|
2370
2645
|
validateNodePlugins(this.manager.player.node, ["lavadspx-plugin" /* LavaDspx */]);
|
|
@@ -2387,6 +2662,14 @@ var DSPXPluginFilter = class {
|
|
|
2387
2662
|
* Set the high-pass filter with the given settings.
|
|
2388
2663
|
* @param {FilterPluginPassSettings} [settings=DefaultFilter.DSPXHighPass] The settings for the high-pass filter.
|
|
2389
2664
|
* @returns {Promise<this>} The instance of the filter manager.
|
|
2665
|
+
* @throws {PlayerError} If the node does not have the required plugin or filter enabled.
|
|
2666
|
+
* @example
|
|
2667
|
+
* ```ts
|
|
2668
|
+
* // Set the high-pass filter with custom settings
|
|
2669
|
+
* await player.filterManager.dspxPlugin.setHighPass({ cutoffFrequency: 2000, boostFactor: 0.8 });
|
|
2670
|
+
* // Disable the high-pass filter
|
|
2671
|
+
* await player.filterManager.dspxPlugin.setHighPass();
|
|
2672
|
+
* ```
|
|
2390
2673
|
*/
|
|
2391
2674
|
async setHighPass(settings = DefaultFilterPreset.DSPXHighPass) {
|
|
2392
2675
|
validateNodePlugins(this.manager.player.node, ["lavadspx-plugin" /* LavaDspx */]);
|
|
@@ -2409,6 +2692,14 @@ var DSPXPluginFilter = class {
|
|
|
2409
2692
|
* Set the normalization filter with the given settings.
|
|
2410
2693
|
* @param {NormalizationSettings} [settings=DefaultFilter.DSPXNormalization] The settings for the normalization filter.
|
|
2411
2694
|
* @returns {Promise<this>} The instance of the filter manager.
|
|
2695
|
+
* @throws {PlayerError} If the node does not have the required plugin or filter enabled.
|
|
2696
|
+
* @example
|
|
2697
|
+
* ```ts
|
|
2698
|
+
* // Set the normalization filter with custom settings
|
|
2699
|
+
* await player.filterManager.dspxPlugin.setNormalization({ maxAmplitude: 0.9, adaptive: true });
|
|
2700
|
+
* // Disable the normalization filter
|
|
2701
|
+
* await player.filterManager.dspxPlugin.setNormalization();
|
|
2702
|
+
* ```
|
|
2412
2703
|
*/
|
|
2413
2704
|
async setNormalization(settings = DefaultFilterPreset.DSPXNormalization) {
|
|
2414
2705
|
validateNodePlugins(this.manager.player.node, ["lavadspx-plugin" /* LavaDspx */]);
|
|
@@ -2431,6 +2722,14 @@ var DSPXPluginFilter = class {
|
|
|
2431
2722
|
* Set the echo filter with the given settings.
|
|
2432
2723
|
* @param {EchoSettings} [settings=DefaultFilter.DSPXEcho] The settings for the echo filter.
|
|
2433
2724
|
* @returns {Promise<this>} The instance of the filter manager.
|
|
2725
|
+
* @throws {PlayerError} If the node does not have the required plugin or filter enabled.
|
|
2726
|
+
* @example
|
|
2727
|
+
* ```ts
|
|
2728
|
+
* // Set the echo filter with custom settings
|
|
2729
|
+
* await player.filterManager.dspxPlugin.setEcho({ echoLength: 500, decay: 0.5, delay: 200 });
|
|
2730
|
+
* // Disable the echo filter
|
|
2731
|
+
* await player.filterManager.dspxPlugin.setEcho();
|
|
2732
|
+
* ```
|
|
2434
2733
|
*/
|
|
2435
2734
|
async setEcho(settings = DefaultFilterPreset.DSPXEcho) {
|
|
2436
2735
|
validateNodePlugins(this.manager.player.node, ["lavadspx-plugin" /* LavaDspx */]);
|
|
@@ -2471,6 +2770,14 @@ var LavalinkPluginFilter = class {
|
|
|
2471
2770
|
* Set the echo filter with the given settings.
|
|
2472
2771
|
* @param {Omit<EchoSettings, "echoLength">} [settings=DefaultFilter.PluginEcho] The settings for the echo filter.
|
|
2473
2772
|
* @returns {Promise<this>} The instance of the filter manager.
|
|
2773
|
+
* @throws {PlayerError} If the node does not have the required plugin or filter enabled.
|
|
2774
|
+
* @example
|
|
2775
|
+
* ```ts
|
|
2776
|
+
* // Set the echo filter with custom settings
|
|
2777
|
+
* await player.filterManager.lavalinkPlugin.setEcho({ decay: 0.5, delay: 200 });
|
|
2778
|
+
* // Disable the echo filter
|
|
2779
|
+
* await player.filterManager.lavalinkPlugin.setEcho();
|
|
2780
|
+
* ```
|
|
2474
2781
|
*/
|
|
2475
2782
|
async setEcho(settings = DefaultFilterPreset.PluginEcho) {
|
|
2476
2783
|
validateNodePlugins(this.manager.player.node, ["lavalink-filter-plugin" /* FilterPlugin */]);
|
|
@@ -2493,6 +2800,14 @@ var LavalinkPluginFilter = class {
|
|
|
2493
2800
|
* Set the reverb filter with the given settings.
|
|
2494
2801
|
* @param {Partial<LavalinkFilterPluginReverbSettings>} [settings=DefaultFilter.PluginReverb] The settings for the reverb filter.
|
|
2495
2802
|
* @returns {Promise<this>} The instance of the filter manager.
|
|
2803
|
+
* @throws {PlayerError} If the node does not have the required plugin or filter enabled.
|
|
2804
|
+
* @example
|
|
2805
|
+
* ```ts
|
|
2806
|
+
* // Set the reverb filter with custom settings
|
|
2807
|
+
* await player.filterManager.lavalinkPlugin.setReverb({ delays: [50, 100, 150], gains: [0.5, 0.3, 0.2] });
|
|
2808
|
+
* // Disable the reverb filter
|
|
2809
|
+
* await player.filterManager.lavalinkPlugin.setReverb();
|
|
2810
|
+
* ```
|
|
2496
2811
|
*/
|
|
2497
2812
|
async setReverb(settings = DefaultFilterPreset.PluginReverb) {
|
|
2498
2813
|
validateNodePlugins(this.manager.player.node, ["lavalink-filter-plugin" /* FilterPlugin */]);
|
|
@@ -2586,6 +2901,11 @@ var FilterManager = class {
|
|
|
2586
2901
|
/**
|
|
2587
2902
|
* Resets all filters to their default values.
|
|
2588
2903
|
* @returns {Promise<this>} A promise that resolves to the instance of the filter manager.
|
|
2904
|
+
* @example
|
|
2905
|
+
* ```ts
|
|
2906
|
+
* // Reset all filters
|
|
2907
|
+
* await player.filterManager.reset();
|
|
2908
|
+
* ```
|
|
2589
2909
|
*/
|
|
2590
2910
|
async reset() {
|
|
2591
2911
|
this.filters = {
|
|
@@ -2619,6 +2939,11 @@ var FilterManager = class {
|
|
|
2619
2939
|
*
|
|
2620
2940
|
* Applies the current filters to the player.
|
|
2621
2941
|
* @returns {Promise<this>} A promise that resolves to the instance of the filter manager.
|
|
2942
|
+
* @example
|
|
2943
|
+
* ```ts
|
|
2944
|
+
* // Apply the current filters
|
|
2945
|
+
* await player.filterManager.apply();
|
|
2946
|
+
* ```
|
|
2622
2947
|
*/
|
|
2623
2948
|
async apply() {
|
|
2624
2949
|
if (!this.player.node.sessionId) return this;
|
|
@@ -2655,6 +2980,11 @@ var FilterManager = class {
|
|
|
2655
2980
|
* Checks if the current filters are active.
|
|
2656
2981
|
* @param {TimescaleSettings} timescale The timescale settings to check against.
|
|
2657
2982
|
* @returns {void} Nothing!
|
|
2983
|
+
* @example
|
|
2984
|
+
* ```ts
|
|
2985
|
+
* // Check the current filters
|
|
2986
|
+
* player.filterManager.check();
|
|
2987
|
+
* ```
|
|
2658
2988
|
*/
|
|
2659
2989
|
check(timescale) {
|
|
2660
2990
|
this.filters.rotation = this.data.rotation?.rotationHz !== 0;
|
|
@@ -2685,6 +3015,12 @@ var FilterManager = class {
|
|
|
2685
3015
|
* Checks if a specific filter is active.
|
|
2686
3016
|
* @param {FilterType} filter The filter type to check.
|
|
2687
3017
|
* @returns {boolean} True if the filter is active, false otherwise.
|
|
3018
|
+
* @example
|
|
3019
|
+
* ```ts
|
|
3020
|
+
* // Check if the nightcore filter is active
|
|
3021
|
+
* const isNightcoreActive = player.filterManager.has(FilterType.Nightcore);
|
|
3022
|
+
* console.log(isNightcoreActive); // true or false
|
|
3023
|
+
* ```
|
|
2688
3024
|
*/
|
|
2689
3025
|
has(filter) {
|
|
2690
3026
|
const dspx = this.filters.lavalinkLavaDspxPlugin[filter];
|
|
@@ -2701,6 +3037,12 @@ var FilterManager = class {
|
|
|
2701
3037
|
* Sets the volume for the player.
|
|
2702
3038
|
* @param {number} volume The volume level to set (between 0 and 5).
|
|
2703
3039
|
* @returns {Promise<this>} A promise that resolves to the player instance.
|
|
3040
|
+
* @throws {PlayerError} If the volume is not a number between 0 and 5.
|
|
3041
|
+
* @example
|
|
3042
|
+
* ```ts
|
|
3043
|
+
* // Set the volume to 2.5
|
|
3044
|
+
* await player.filterManager.setVolume(2.5);
|
|
3045
|
+
* ```
|
|
2704
3046
|
*/
|
|
2705
3047
|
async setVolume(volume) {
|
|
2706
3048
|
if (typeof volume !== "number" || Number.isNaN(volume) || volume < 0 || volume > 5)
|
|
@@ -2713,6 +3055,12 @@ var FilterManager = class {
|
|
|
2713
3055
|
* Sets the audio output for the player.
|
|
2714
3056
|
* @param {AudioOutput} output The audio output to set.
|
|
2715
3057
|
* @returns {Promise<this>} A promise that resolves to the player instance.
|
|
3058
|
+
* @throws {PlayerError} If the output is not a valid AudioOutput value.
|
|
3059
|
+
* @example
|
|
3060
|
+
* ```ts
|
|
3061
|
+
* // Set the audio output to mono
|
|
3062
|
+
* await player.filterManager.setAudioOutput(AudioOutput.Mono);
|
|
3063
|
+
* ```
|
|
2716
3064
|
*/
|
|
2717
3065
|
async setAudioOutput(output) {
|
|
2718
3066
|
const outputs = Object.values(AudioOutput);
|
|
@@ -2726,6 +3074,12 @@ var FilterManager = class {
|
|
|
2726
3074
|
* Sets the speed for the player.
|
|
2727
3075
|
* @param {number} speed The speed to set (default is 1).
|
|
2728
3076
|
* @returns {Promise<this>} A promise that resolves to the player instance.
|
|
3077
|
+
* @throws {PlayerError} If the node does not support the timescale filter.
|
|
3078
|
+
* @example
|
|
3079
|
+
* ```ts
|
|
3080
|
+
* // Set the speed to 1.5
|
|
3081
|
+
* await player.filterManager.setSpeed(1.5);
|
|
3082
|
+
* ```
|
|
2729
3083
|
*/
|
|
2730
3084
|
async setSpeed(speed = 1) {
|
|
2731
3085
|
if (!this.player.node.info?.filters?.includes("timescale" /* Timescale */))
|
|
@@ -2747,6 +3101,12 @@ var FilterManager = class {
|
|
|
2747
3101
|
* Sets the rate for the player.
|
|
2748
3102
|
* @param {number} rate The rate to set (default is 1).
|
|
2749
3103
|
* @returns {Promise<this>} A promise that resolves to the player instance.
|
|
3104
|
+
* @throws {PlayerError} If the node does not support the timescale filter.
|
|
3105
|
+
* @example
|
|
3106
|
+
* ```ts
|
|
3107
|
+
* // Set the rate to 1.2
|
|
3108
|
+
* await player.filterManager.setRate(1.2);
|
|
3109
|
+
* ```
|
|
2750
3110
|
*/
|
|
2751
3111
|
async setRate(rate = 1) {
|
|
2752
3112
|
if (!this.player.node.info?.filters?.includes("timescale" /* Timescale */))
|
|
@@ -2768,6 +3128,12 @@ var FilterManager = class {
|
|
|
2768
3128
|
* Sets the pitch for the player.
|
|
2769
3129
|
* @param {number} pitch The pitch
|
|
2770
3130
|
* @returns {Promise<this>} A promise that resolves to the player instance.
|
|
3131
|
+
* @throws {PlayerError} If the node does not support the timescale filter.
|
|
3132
|
+
* @example
|
|
3133
|
+
* ```ts
|
|
3134
|
+
* // Set the pitch to 0.8
|
|
3135
|
+
* await player.filterManager.setPitch(0.8);
|
|
3136
|
+
* ```
|
|
2771
3137
|
*/
|
|
2772
3138
|
async setPitch(pitch = 1) {
|
|
2773
3139
|
if (!this.player.node.info?.filters?.includes("timescale" /* Timescale */))
|
|
@@ -2789,6 +3155,15 @@ var FilterManager = class {
|
|
|
2789
3155
|
* Sets the EQ bands for the player.
|
|
2790
3156
|
* @param {RestOrArray<EQBandSettings>} bands The EQ band settings to set.
|
|
2791
3157
|
* @returns {Promise<this>} A promise that resolves to the instance of the manager.
|
|
3158
|
+
* @throws {PlayerError} If the bands array is empty or contains invalid band settings.
|
|
3159
|
+
* @example
|
|
3160
|
+
* ```ts
|
|
3161
|
+
* // Set multiple EQ bands
|
|
3162
|
+
* await player.filterManager.setEQBand(
|
|
3163
|
+
* { band: 0, gain: 0.5 },
|
|
3164
|
+
* { band: 1, gain: -0.3 },
|
|
3165
|
+
* );
|
|
3166
|
+
* ```
|
|
2792
3167
|
*/
|
|
2793
3168
|
async setEQBand(...bands) {
|
|
2794
3169
|
bands = bands.flat();
|
|
@@ -2801,6 +3176,11 @@ var FilterManager = class {
|
|
|
2801
3176
|
*
|
|
2802
3177
|
* Clears all EQ bands for the player.
|
|
2803
3178
|
* @returns {Promise<this>} A promise that resolves to the instance of the manager.
|
|
3179
|
+
* @example
|
|
3180
|
+
* ```ts
|
|
3181
|
+
* // Clear all EQ bands
|
|
3182
|
+
* await player.filterManager.clearEQBands();
|
|
3183
|
+
* ```
|
|
2804
3184
|
*/
|
|
2805
3185
|
async clearEQBands() {
|
|
2806
3186
|
return this.setEQBand(Array.from({ length: 15 }, (_, i) => ({ band: i, gain: 0 })));
|
|
@@ -2810,6 +3190,12 @@ var FilterManager = class {
|
|
|
2810
3190
|
* Set the vibrato filter with the given settings.
|
|
2811
3191
|
* @param {TremoloSettings} [settings=DefaultFilterPreset.Vibrato] The settings for the vibrato filter.
|
|
2812
3192
|
* @returns {Promise<this>} The instance of the filter manager.
|
|
3193
|
+
* @throws {PlayerError} If the node does not support the vibrato filter.
|
|
3194
|
+
* @example
|
|
3195
|
+
* ```ts
|
|
3196
|
+
* // Set the vibrato filter
|
|
3197
|
+
* await player.filterManager.setVibrato({ frequency: 4.0, depth: 0.5 });
|
|
3198
|
+
* ```
|
|
2813
3199
|
*/
|
|
2814
3200
|
async setVibrato(settings = DefaultFilterPreset.Vibrato) {
|
|
2815
3201
|
if (!this.player.node.info?.filters?.includes("vibrato" /* Vibrato */))
|
|
@@ -2826,6 +3212,12 @@ var FilterManager = class {
|
|
|
2826
3212
|
* Set the tremolo filter with the given settings.
|
|
2827
3213
|
* @param {TremoloSettings} [settings=DefaultFilterPreset.Tremolo] The settings for the tremolo filter.
|
|
2828
3214
|
* @returns {Promise<this>} The instance of the filter manager.
|
|
3215
|
+
* @throws {PlayerError} If the node does not support the tremolo filter.
|
|
3216
|
+
* @example
|
|
3217
|
+
* ```ts
|
|
3218
|
+
* // Set the tremolo filter
|
|
3219
|
+
* await player.filterManager.setTremolo({ frequency: 4.0, depth: 0.5 });
|
|
3220
|
+
* ```
|
|
2829
3221
|
*/
|
|
2830
3222
|
async setTremolo(settings = DefaultFilterPreset.Tremolo) {
|
|
2831
3223
|
if (!this.player.node.info?.filters?.includes("tremolo" /* Tremolo */))
|
|
@@ -2842,6 +3234,12 @@ var FilterManager = class {
|
|
|
2842
3234
|
* Set the low-pass filter with the given settings.
|
|
2843
3235
|
* @param {LowPassSettings} [settings=DefaultFilterPreset.Lowpass] The settings for the low-pass filter.
|
|
2844
3236
|
* @returns {Promise<this>} The instance of the filter manager.
|
|
3237
|
+
* @throws {PlayerError} If the node does not support the low-pass filter.
|
|
3238
|
+
* @example
|
|
3239
|
+
* ```ts
|
|
3240
|
+
* // Set the low-pass filter
|
|
3241
|
+
* await player.filterManager.setLowPass({ smoothing: 20.0 });
|
|
3242
|
+
* ```
|
|
2845
3243
|
*/
|
|
2846
3244
|
async setLowPass(settings = DefaultFilterPreset.Lowpass) {
|
|
2847
3245
|
if (!this.player.node.info?.filters?.includes("lowPass" /* LowPass */))
|
|
@@ -2854,6 +3252,12 @@ var FilterManager = class {
|
|
|
2854
3252
|
* Set the nightcore filter with the given settings.
|
|
2855
3253
|
* @param {Partial<TimescaleSettings>} [settings=DefaultFilterPreset.Nightcore] The settings for the nightcore filter.
|
|
2856
3254
|
* @returns {Promise<this>} The instance of the filter manager.
|
|
3255
|
+
* @throws {PlayerError} If the node does not support the timescale filter.
|
|
3256
|
+
* @example
|
|
3257
|
+
* ```ts
|
|
3258
|
+
* // Set the nightcore filter
|
|
3259
|
+
* await player.filterManager.setNightcore();
|
|
3260
|
+
* ```
|
|
2857
3261
|
*/
|
|
2858
3262
|
async setNightcore(settings = DefaultFilterPreset.Nightcore) {
|
|
2859
3263
|
if (!this.player.node.info?.filters?.includes("timescale" /* Timescale */))
|
|
@@ -2873,6 +3277,12 @@ var FilterManager = class {
|
|
|
2873
3277
|
* Set the vaporwave filter with the given settings.
|
|
2874
3278
|
* @param {Partial<TimescaleSettings>} [settings=DefaultFilterPreset.Vaporwave] The settings for the vaporwave filter.
|
|
2875
3279
|
* @returns {Promise<this>} The instance of the filter manager.
|
|
3280
|
+
* @throws {PlayerError} If the node does not support the timescale filter.
|
|
3281
|
+
* @example
|
|
3282
|
+
* ```ts
|
|
3283
|
+
* // Set the vaporwave filter
|
|
3284
|
+
* await player.filterManager.setVaporwave();
|
|
3285
|
+
* ```
|
|
2876
3286
|
*/
|
|
2877
3287
|
async setVaporwave(settings = DefaultFilterPreset.Vaporwave) {
|
|
2878
3288
|
if (!this.player.node.info?.filters?.includes("timescale" /* Timescale */))
|
|
@@ -2892,6 +3302,12 @@ var FilterManager = class {
|
|
|
2892
3302
|
* Set the karaoke filter with the given settings.
|
|
2893
3303
|
* @param {KaraokeSettings} [settings=DefaultFilterPreset.Karaoke] The settings for the karaoke filter.
|
|
2894
3304
|
* @returns {Promise<this>} The instance of the filter manager.
|
|
3305
|
+
* @throws {PlayerError} If the node does not support the karaoke filter.
|
|
3306
|
+
* @example
|
|
3307
|
+
* ```ts
|
|
3308
|
+
* // Set the karaoke filter
|
|
3309
|
+
* await player.filterManager.setKaraoke({ level: -15.0, monoLevel: -20.0, filterBand: 220.0, filterWidth: 100.0 });
|
|
3310
|
+
* ```
|
|
2895
3311
|
*/
|
|
2896
3312
|
async setKaraoke(settings = DefaultFilterPreset.Karaoke) {
|
|
2897
3313
|
if (!this.player.node.info?.filters?.includes("karaoke" /* Karaoke */))
|
|
@@ -2910,6 +3326,12 @@ var FilterManager = class {
|
|
|
2910
3326
|
* Set the distortion filter with the given settings.
|
|
2911
3327
|
* @param {Partial<DistortionSettings>} [settings=DefaultFilterPreset.Distortion] The settings for the distortion filter.
|
|
2912
3328
|
* @returns {Promise<this>} The instance of the filter manager.
|
|
3329
|
+
* @throws {PlayerError} If the node does not support the distortion filter.
|
|
3330
|
+
* @example
|
|
3331
|
+
* ```ts
|
|
3332
|
+
* // Set the distortion filter
|
|
3333
|
+
* await player.filterManager.setDistortion({ sinOffset: 0.5, sinScale: 2.0 });
|
|
3334
|
+
* ```
|
|
2913
3335
|
*/
|
|
2914
3336
|
async setDistortion(settings = DefaultFilterPreset.Distortion) {
|
|
2915
3337
|
if (!this.player.node.info?.filters?.includes("distortion" /* Distortion */))
|
|
@@ -2930,6 +3352,12 @@ var FilterManager = class {
|
|
|
2930
3352
|
* Set the timescale filter with the given settings.
|
|
2931
3353
|
* @param {Partial<TimescaleSettings>} settings The timescale settings to set.
|
|
2932
3354
|
* @returns {Promise<this>} The instance of the filter manager.
|
|
3355
|
+
* @throws {PlayerError} If the node does not support the timescale filter.
|
|
3356
|
+
* @example
|
|
3357
|
+
* ```ts
|
|
3358
|
+
* // Set the timescale filter
|
|
3359
|
+
* await player.filterManager.setTimescale({ speed: 1.2, pitch: 0.8, rate: 1.0 });
|
|
3360
|
+
* ```
|
|
2933
3361
|
*/
|
|
2934
3362
|
async setTimescale(settings) {
|
|
2935
3363
|
if (!this.player.node.info?.filters?.includes("timescale" /* Timescale */))
|
|
@@ -2945,107 +3373,26 @@ var FilterManager = class {
|
|
|
2945
3373
|
/**
|
|
2946
3374
|
* Convert the filter settings to a JSON object.
|
|
2947
3375
|
* @returns {FilterSettings} The filter settings as a JSON object.
|
|
3376
|
+
* @example
|
|
3377
|
+
* ```ts
|
|
3378
|
+
* // Convert filter settings to JSON
|
|
3379
|
+
* const filterSettingsJSON = player.filterManager.toJSON();
|
|
3380
|
+
* console.log(filterSettingsJSON); // { volume: 1, equalizer: [...], ... }
|
|
3381
|
+
* ```
|
|
2948
3382
|
*/
|
|
2949
3383
|
toJSON() {
|
|
2950
3384
|
return { ...this.data };
|
|
2951
3385
|
}
|
|
2952
3386
|
};
|
|
2953
3387
|
|
|
2954
|
-
// src/classes/player/Storage.ts
|
|
2955
|
-
var PlayerStorage = class {
|
|
2956
|
-
/**
|
|
2957
|
-
* The internal storage.
|
|
2958
|
-
* @type {Map<K, V>}
|
|
2959
|
-
* @private
|
|
2960
|
-
* @readonly
|
|
2961
|
-
* @internal
|
|
2962
|
-
*/
|
|
2963
|
-
internal = /* @__PURE__ */ new Map();
|
|
2964
|
-
/**
|
|
2965
|
-
*
|
|
2966
|
-
* Get the value for a key in the storage.
|
|
2967
|
-
* @param {K} key The key to get the value for.
|
|
2968
|
-
* @returns {V | undefined} The value for the key, or undefined if it doesn't exist.
|
|
2969
|
-
*/
|
|
2970
|
-
get(key) {
|
|
2971
|
-
return this.internal.get(key);
|
|
2972
|
-
}
|
|
2973
|
-
/**
|
|
2974
|
-
* Set the value for a key in the storage.
|
|
2975
|
-
* @param {K} key The key to set the value for.
|
|
2976
|
-
* @param {V} value The value to set for the key.
|
|
2977
|
-
*/
|
|
2978
|
-
set(key, value) {
|
|
2979
|
-
this.internal.set(key, value);
|
|
2980
|
-
}
|
|
2981
|
-
/**
|
|
2982
|
-
* Check if the storage has a key.
|
|
2983
|
-
* @param {K} key The key to check for.
|
|
2984
|
-
* @returns {boolean} True if the storage has the key, false otherwise.
|
|
2985
|
-
*/
|
|
2986
|
-
has(key) {
|
|
2987
|
-
return this.internal.has(key);
|
|
2988
|
-
}
|
|
2989
|
-
/**
|
|
2990
|
-
* Delete a key from the storage.
|
|
2991
|
-
* @param {K} key The key to delete.
|
|
2992
|
-
* @returns {boolean} True if the key was deleted, false otherwise.
|
|
2993
|
-
*/
|
|
2994
|
-
delete(key) {
|
|
2995
|
-
return this.internal.delete(key);
|
|
2996
|
-
}
|
|
2997
|
-
/**
|
|
2998
|
-
* Get all keys in the storage.
|
|
2999
|
-
* @returns {K[]} The keys in the storage.
|
|
3000
|
-
*/
|
|
3001
|
-
keys() {
|
|
3002
|
-
return [...this.internal.keys()];
|
|
3003
|
-
}
|
|
3004
|
-
/**
|
|
3005
|
-
* Get all values in the storage.
|
|
3006
|
-
* @returns {V[]} The values in the storage.
|
|
3007
|
-
*/
|
|
3008
|
-
values() {
|
|
3009
|
-
return [...this.internal.values()];
|
|
3010
|
-
}
|
|
3011
|
-
/**
|
|
3012
|
-
* Get all entries in the storage.
|
|
3013
|
-
* @returns {[K, V][]} The entries in the storage.
|
|
3014
|
-
*/
|
|
3015
|
-
entries() {
|
|
3016
|
-
return [...this.internal.entries()];
|
|
3017
|
-
}
|
|
3018
|
-
/**
|
|
3019
|
-
*
|
|
3020
|
-
* Get all key-value pairs in the storage.
|
|
3021
|
-
* @returns {Record<K[number], V>} An object containing all key-value pairs in the storage, excluding internal keys.
|
|
3022
|
-
*/
|
|
3023
|
-
all() {
|
|
3024
|
-
return Object.fromEntries([...this.internal.entries()].filter(([key]) => !key.startsWith("internal_")));
|
|
3025
|
-
}
|
|
3026
|
-
/**
|
|
3027
|
-
* Clear the storage.
|
|
3028
|
-
*/
|
|
3029
|
-
clear() {
|
|
3030
|
-
this.internal.clear();
|
|
3031
|
-
}
|
|
3032
|
-
/**
|
|
3033
|
-
* Get the size of the storage.
|
|
3034
|
-
* @returns {number} The number of entries in the storage.
|
|
3035
|
-
*/
|
|
3036
|
-
get size() {
|
|
3037
|
-
return this.internal.size;
|
|
3038
|
-
}
|
|
3039
|
-
};
|
|
3040
|
-
|
|
3041
3388
|
// src/classes/player/Player.ts
|
|
3042
3389
|
var Player = class {
|
|
3043
3390
|
/**
|
|
3044
3391
|
* The data for the player.
|
|
3045
|
-
* @type {
|
|
3392
|
+
* @type {PlayerStorageAdapter}
|
|
3046
3393
|
* @readonly
|
|
3047
3394
|
*/
|
|
3048
|
-
data
|
|
3395
|
+
data;
|
|
3049
3396
|
/**
|
|
3050
3397
|
* The options for the player.
|
|
3051
3398
|
* @type {PlayerOptions}
|
|
@@ -3197,6 +3544,7 @@ var Player = class {
|
|
|
3197
3544
|
this.volume = options.volume ?? 100;
|
|
3198
3545
|
this.textId = options.textId;
|
|
3199
3546
|
this.node = (typeof this.options.node === "string" ? this.manager.nodeManager.get(this.options.node) : this.options.node) ?? this.manager.nodeManager.getLeastUsed();
|
|
3547
|
+
this.data = this.manager.options.playerOptions.storage;
|
|
3200
3548
|
validatePlayerOptions(this.options);
|
|
3201
3549
|
this.queue = Structures.Queue(this);
|
|
3202
3550
|
this.filterManager = Structures.FilterManager(this);
|
|
@@ -3212,6 +3560,14 @@ var Player = class {
|
|
|
3212
3560
|
current: (skipSource) => this.node.lyricsManager.current(this.guildId, skipSource),
|
|
3213
3561
|
get: (track, skipSource) => this.node.lyricsManager.get(track, skipSource)
|
|
3214
3562
|
};
|
|
3563
|
+
/**
|
|
3564
|
+
*
|
|
3565
|
+
* Check if the player is currently playing a track.
|
|
3566
|
+
* @returns {boolean} Whether the player is currently playing a track.
|
|
3567
|
+
*/
|
|
3568
|
+
isPlaying() {
|
|
3569
|
+
return this.playing && !this.paused;
|
|
3570
|
+
}
|
|
3215
3571
|
/**
|
|
3216
3572
|
*
|
|
3217
3573
|
* Search for a track or playlist.
|
|
@@ -3295,15 +3651,8 @@ var Player = class {
|
|
|
3295
3651
|
*/
|
|
3296
3652
|
async disconnect() {
|
|
3297
3653
|
if (!this.voiceId) return this;
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
d: {
|
|
3301
|
-
guild_id: this.guildId,
|
|
3302
|
-
channel_id: null,
|
|
3303
|
-
self_deaf: this.selfDeaf,
|
|
3304
|
-
self_mute: this.selfMute
|
|
3305
|
-
}
|
|
3306
|
-
});
|
|
3654
|
+
this.voiceId = void 0;
|
|
3655
|
+
await this.setVoice({ voiceId: void 0 });
|
|
3307
3656
|
this.manager.emit("debug" /* Debug */, 3 /* Player */, `[Player] -> [Disconnect] Player disconnected for guild: ${this.guildId}`);
|
|
3308
3657
|
this.connected = false;
|
|
3309
3658
|
return this;
|
|
@@ -3349,11 +3698,15 @@ var Player = class {
|
|
|
3349
3698
|
async play(options = {}) {
|
|
3350
3699
|
if (typeof options !== "object") throw new PlayerError("The play options must be an object.");
|
|
3351
3700
|
if (options.track) this.queue.current = await validateTrack(this, options.track);
|
|
3352
|
-
else if (!this.queue.current) this.queue.current = await validateTrack(this, this.queue.shift());
|
|
3701
|
+
else if (!this.queue.current) this.queue.current = await validateTrack(this, await this.queue.shift());
|
|
3353
3702
|
if (!this.queue.current) throw new PlayerError("No track to play.");
|
|
3354
3703
|
if (!isTrack(this.queue.current) && !isUnresolvedTrack(this.queue.current))
|
|
3355
3704
|
throw new PlayerError("The track must be a valid Track or UnresolvedTrack instance.");
|
|
3356
|
-
this.manager.emit(
|
|
3705
|
+
this.manager.emit(
|
|
3706
|
+
"debug" /* Debug */,
|
|
3707
|
+
3 /* Player */,
|
|
3708
|
+
`[Player] -> [Play] A new track is playing: ${this.queue.current.info.title}`
|
|
3709
|
+
);
|
|
3357
3710
|
const position = options.position ?? 0;
|
|
3358
3711
|
this.lastPosition = position;
|
|
3359
3712
|
this.lastPositionUpdate = Date.now();
|
|
@@ -3382,15 +3735,7 @@ var Player = class {
|
|
|
3382
3735
|
*/
|
|
3383
3736
|
async connect() {
|
|
3384
3737
|
if (!this.voiceId) return this;
|
|
3385
|
-
await this.
|
|
3386
|
-
op: 4,
|
|
3387
|
-
d: {
|
|
3388
|
-
guild_id: this.guildId,
|
|
3389
|
-
channel_id: this.voiceId,
|
|
3390
|
-
self_deaf: this.selfDeaf,
|
|
3391
|
-
self_mute: this.selfMute
|
|
3392
|
-
}
|
|
3393
|
-
});
|
|
3738
|
+
await this.setVoice();
|
|
3394
3739
|
this.manager.emit("debug" /* Debug */, 3 /* Player */, `[Player] -> [Connect] Player connected for guild: ${this.guildId}`);
|
|
3395
3740
|
this.connected = true;
|
|
3396
3741
|
return this;
|
|
@@ -3489,7 +3834,7 @@ var Player = class {
|
|
|
3489
3834
|
}
|
|
3490
3835
|
/**
|
|
3491
3836
|
* Set the voice of the player.
|
|
3492
|
-
* @param {
|
|
3837
|
+
* @param {NullableVoiceChannelUpdate} options The voice state to set.
|
|
3493
3838
|
* @returns {Promise<void>}
|
|
3494
3839
|
* @example
|
|
3495
3840
|
* ```ts
|
|
@@ -3497,27 +3842,17 @@ var Player = class {
|
|
|
3497
3842
|
* player.setVoice({ voiceId: "newVoiceId" });
|
|
3498
3843
|
* ```
|
|
3499
3844
|
*/
|
|
3500
|
-
async setVoice(
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
this.options.voiceId = voice.voiceId;
|
|
3505
|
-
}
|
|
3506
|
-
if (voice.selfDeaf) {
|
|
3507
|
-
this.selfDeaf = voice.selfDeaf;
|
|
3508
|
-
this.options.selfDeaf = voice.selfDeaf;
|
|
3509
|
-
}
|
|
3510
|
-
if (voice.selfMute) {
|
|
3511
|
-
this.selfMute = voice.selfMute;
|
|
3512
|
-
this.options.selfMute = voice.selfMute;
|
|
3513
|
-
}
|
|
3845
|
+
async setVoice(options = {}) {
|
|
3846
|
+
options.voiceId ??= this.voiceId;
|
|
3847
|
+
options.selfDeaf ??= this.selfDeaf;
|
|
3848
|
+
options.selfMute ??= this.selfMute;
|
|
3514
3849
|
await this.manager.options.sendPayload(this.guildId, {
|
|
3515
3850
|
op: 4,
|
|
3516
3851
|
d: {
|
|
3517
3852
|
guild_id: this.guildId,
|
|
3518
|
-
self_deaf:
|
|
3519
|
-
self_mute:
|
|
3520
|
-
channel_id:
|
|
3853
|
+
self_deaf: options.selfDeaf,
|
|
3854
|
+
self_mute: options.selfMute,
|
|
3855
|
+
channel_id: options.voiceId ?? null
|
|
3521
3856
|
}
|
|
3522
3857
|
});
|
|
3523
3858
|
this.manager.emit(
|
|
@@ -3576,6 +3911,12 @@ var Player = class {
|
|
|
3576
3911
|
* Update the player with new data.
|
|
3577
3912
|
* @param {NonGuildUpdatePlayerInfo} data The data to update the player with.
|
|
3578
3913
|
* @returns {Promise<LavalinkPlayer | null>} The updated player data.
|
|
3914
|
+
* @example
|
|
3915
|
+
* ```ts
|
|
3916
|
+
* const player = manager.getPlayer("guildId");
|
|
3917
|
+
* const updatedPlayer = await player.updatePlayer({ volume: 50 });
|
|
3918
|
+
* console.log(updatedPlayer); // the updated player data
|
|
3919
|
+
* ```
|
|
3579
3920
|
*/
|
|
3580
3921
|
async updatePlayer(data) {
|
|
3581
3922
|
return this.node.updatePlayer({
|
|
@@ -3623,7 +3964,7 @@ var Player = class {
|
|
|
3623
3964
|
var QueueStore = class {
|
|
3624
3965
|
/**
|
|
3625
3966
|
* Storage manager instance.
|
|
3626
|
-
* @type {
|
|
3967
|
+
* @type {QueueStorageAdapter}
|
|
3627
3968
|
* @private
|
|
3628
3969
|
* @readonly
|
|
3629
3970
|
* @internal
|
|
@@ -3632,7 +3973,7 @@ var QueueStore = class {
|
|
|
3632
3973
|
/**
|
|
3633
3974
|
*
|
|
3634
3975
|
* Constructor of the queue store.
|
|
3635
|
-
* @param {
|
|
3976
|
+
* @param {QueueStorageAdapter} storage Storage manager instance.
|
|
3636
3977
|
* @example
|
|
3637
3978
|
* ```ts
|
|
3638
3979
|
* const storage = new CustomStorage();
|
|
@@ -3734,16 +4075,15 @@ var QueueUtils = class {
|
|
|
3734
4075
|
* ```
|
|
3735
4076
|
*/
|
|
3736
4077
|
save() {
|
|
3737
|
-
const max = this.options.
|
|
4078
|
+
const max = this.options.maxHistory;
|
|
3738
4079
|
const length = this.queue.tracks.length;
|
|
3739
|
-
const json = this.queue.toJSON();
|
|
3740
4080
|
if (length > max) this.queue.history.splice(0, length - max);
|
|
3741
4081
|
this.queue.player.manager.emit(
|
|
3742
4082
|
"debug" /* Debug */,
|
|
3743
4083
|
5 /* Queue */,
|
|
3744
|
-
`[Queue] -> [Adapter] Saving queue for ${this.queue.player.guildId} | Object: ${stringify(
|
|
4084
|
+
`[Queue] -> [Adapter] Saving queue for ${this.queue.player.guildId} | Object: ${stringify(this.queue.toJSON())}`
|
|
3745
4085
|
);
|
|
3746
|
-
return this.store.set(this.queue.player.guildId,
|
|
4086
|
+
return this.store.set(this.queue.player.guildId, this.queue.toJSON());
|
|
3747
4087
|
}
|
|
3748
4088
|
/**
|
|
3749
4089
|
*
|
|
@@ -3765,6 +4105,8 @@ var QueueUtils = class {
|
|
|
3765
4105
|
/**
|
|
3766
4106
|
*
|
|
3767
4107
|
* Sync the queue.
|
|
4108
|
+
* @param {boolean} [override=true] Whether to override the current queue or not.
|
|
4109
|
+
* @param {boolean} [syncCurrent=false] Whether to sync the current track or not.
|
|
3768
4110
|
* @returns {Awaitable<void>}
|
|
3769
4111
|
* @example
|
|
3770
4112
|
* ```ts
|
|
@@ -3909,25 +4251,50 @@ var Queue = class {
|
|
|
3909
4251
|
isEmpty() {
|
|
3910
4252
|
return this.size === 0;
|
|
3911
4253
|
}
|
|
4254
|
+
/**
|
|
4255
|
+
*
|
|
4256
|
+
* Build a track from a Lavalink track or unresolved Lavalink track.
|
|
4257
|
+
* @param {LavalinkTrack | UnresolvedLavalinkTrack} track The track to build.
|
|
4258
|
+
* @param {TrackRequester} requester The requester of the track.
|
|
4259
|
+
* @returns {Promise<Track>} The built track.
|
|
4260
|
+
* @example
|
|
4261
|
+
* ```ts
|
|
4262
|
+
* const queue = player.queue;
|
|
4263
|
+
* const lavalinkTrack = {...} // some lavalink track
|
|
4264
|
+
* const track = await queue.build(lavalinkTrack, author);
|
|
4265
|
+
*
|
|
4266
|
+
* console.log(track.info.title); // The title of the track
|
|
4267
|
+
* ```
|
|
4268
|
+
*/
|
|
4269
|
+
async build(track, requester) {
|
|
4270
|
+
const requesterFn2 = this.player.manager.options.playerOptions.requesterFn;
|
|
4271
|
+
if (isUnresolvedTrack(track)) return new UnresolvedTrack(track, requesterFn2(requester)).resolve(this.player);
|
|
4272
|
+
if (isTrack(track)) return new Track(track, requesterFn2(requester));
|
|
4273
|
+
return track;
|
|
4274
|
+
}
|
|
3912
4275
|
/**
|
|
3913
4276
|
*
|
|
3914
4277
|
* Get the previous track of the queue.
|
|
3915
4278
|
* @param {boolean} [remove=false] Whether to remove the track from the previous queue.
|
|
3916
|
-
* @returns {Track | null} The previous track of the queue.
|
|
4279
|
+
* @returns {Promise<Track | null>} The previous track of the queue.
|
|
3917
4280
|
* @example
|
|
3918
4281
|
* ```ts
|
|
3919
4282
|
* const queue = player.queue;
|
|
3920
4283
|
*
|
|
3921
|
-
* console.log(queue.previous()); // null
|
|
4284
|
+
* console.log(await queue.previous()); // null
|
|
3922
4285
|
* queue.add(track);
|
|
3923
4286
|
* queue.add(track2);
|
|
3924
4287
|
*
|
|
3925
|
-
* console.log(queue.previous()); // track
|
|
3926
|
-
* console.log(queue.previous(true)); // track and remove it from the previous tracks
|
|
4288
|
+
* console.log(await queue.previous()); // track
|
|
4289
|
+
* console.log(await queue.previous(true)); // track and remove it from the previous tracks
|
|
3927
4290
|
* ```
|
|
3928
4291
|
*/
|
|
3929
|
-
previous(remove = false) {
|
|
3930
|
-
if (remove)
|
|
4292
|
+
async previous(remove = false) {
|
|
4293
|
+
if (remove) {
|
|
4294
|
+
const track = this.history.shift() ?? null;
|
|
4295
|
+
if (track) await this.utils.save();
|
|
4296
|
+
return track;
|
|
4297
|
+
}
|
|
3931
4298
|
return this.history[0] ?? null;
|
|
3932
4299
|
}
|
|
3933
4300
|
/**
|
|
@@ -3935,94 +4302,102 @@ var Queue = class {
|
|
|
3935
4302
|
* Add a track or tracks to the queue.
|
|
3936
4303
|
* @param {Track | Track[]} track The track or tracks to add.
|
|
3937
4304
|
* @param {number} [position] The position to add the track or tracks.
|
|
3938
|
-
* @returns {this} The queue instance.
|
|
4305
|
+
* @returns {Promise<this>} The queue instance.
|
|
3939
4306
|
* @example
|
|
3940
4307
|
* ```ts
|
|
3941
4308
|
* const queue = player.queue;
|
|
3942
4309
|
*
|
|
3943
4310
|
* console.log(queue.size); // 0
|
|
3944
4311
|
*
|
|
3945
|
-
* queue.add(track);
|
|
4312
|
+
* await queue.add(track);
|
|
3946
4313
|
* console.log(queue.size); // 1
|
|
3947
4314
|
*
|
|
3948
|
-
* queue.add([track1, track2]);
|
|
4315
|
+
* await queue.add([track1, track2]);
|
|
3949
4316
|
* console.log(queue.size); // 3
|
|
3950
4317
|
*
|
|
3951
|
-
* queue.add(track3, 1);
|
|
4318
|
+
* await queue.add(track3, 1);
|
|
3952
4319
|
* console.log(queue.size); // 4
|
|
3953
4320
|
* console.log(queue.tracks); // [track1, track3, track2, track]
|
|
3954
4321
|
* ```
|
|
3955
4322
|
*/
|
|
3956
|
-
add(track, position) {
|
|
4323
|
+
async add(track, position) {
|
|
3957
4324
|
const tracks = Array.isArray(track) ? track : [track];
|
|
3958
4325
|
if (typeof position === "number" && position >= 0 && position < this.tracks.length) return this.splice(position, 0, ...tracks);
|
|
3959
4326
|
this.tracks.push(...tracks);
|
|
3960
4327
|
this.player.manager.emit("queueUpdate" /* QueueUpdate */, this.player, this);
|
|
3961
4328
|
this.player.manager.emit("debug" /* Debug */, 5 /* Queue */, `[Queue] -> [Add] Added ${this.tracks.length} tracks to the queue.`);
|
|
4329
|
+
await this.utils.save();
|
|
3962
4330
|
return this;
|
|
3963
4331
|
}
|
|
3964
4332
|
/**
|
|
3965
4333
|
*
|
|
3966
4334
|
* Get the first track of the queue.
|
|
3967
|
-
* @returns {HoshimiTrack | null} The first track of the queue.
|
|
4335
|
+
* @returns {Promise<HoshimiTrack | null>} The first track of the queue.
|
|
3968
4336
|
* @example
|
|
3969
4337
|
* ```ts
|
|
3970
4338
|
* const queue = player.queue;
|
|
3971
4339
|
*
|
|
3972
|
-
* console.log(queue.shift()); // null
|
|
3973
|
-
* queue.add(track);
|
|
4340
|
+
* console.log(await queue.shift()); // null
|
|
4341
|
+
* await queue.add(track);
|
|
3974
4342
|
*
|
|
3975
|
-
* console.log(queue.shift()); // track
|
|
3976
|
-
* queue.add(track2);
|
|
4343
|
+
* console.log(await queue.shift()); // track
|
|
4344
|
+
* await queue.add(track2);
|
|
3977
4345
|
* ```
|
|
3978
4346
|
*/
|
|
3979
|
-
shift() {
|
|
3980
|
-
|
|
4347
|
+
async shift() {
|
|
4348
|
+
const track = this.tracks.shift() ?? null;
|
|
4349
|
+
if (track) await this.utils.save();
|
|
4350
|
+
return track;
|
|
3981
4351
|
}
|
|
3982
4352
|
/**
|
|
3983
4353
|
*
|
|
3984
4354
|
* Add tracks to the beginning of the queue.
|
|
3985
4355
|
* @param {Track[]} tracks The tracks to add.
|
|
3986
|
-
* @returns {this} The queue instance.
|
|
4356
|
+
* @returns {Promise<this>} The queue instance.
|
|
3987
4357
|
* @example
|
|
3988
4358
|
* ```ts
|
|
3989
4359
|
* const queue = player.queue;
|
|
3990
4360
|
*
|
|
3991
4361
|
* console.log(queue.size); // 0
|
|
3992
|
-
* queue.unshift(track);
|
|
4362
|
+
* await queue.unshift(track);
|
|
3993
4363
|
*
|
|
3994
4364
|
* console.log(queue.size); // 1
|
|
3995
|
-
* queue.unshift(
|
|
4365
|
+
* await queue.unshift(track1, track2);
|
|
3996
4366
|
*
|
|
3997
4367
|
* console.log(queue.size); // 3
|
|
3998
4368
|
* console.log(queue.tracks); // [track1, track2, track]
|
|
3999
4369
|
* ```
|
|
4000
4370
|
*/
|
|
4001
|
-
unshift(...tracks) {
|
|
4371
|
+
async unshift(...tracks) {
|
|
4002
4372
|
this.tracks.unshift(...tracks);
|
|
4003
|
-
this.player.manager.emit(
|
|
4373
|
+
this.player.manager.emit(
|
|
4374
|
+
"debug" /* Debug */,
|
|
4375
|
+
5 /* Queue */,
|
|
4376
|
+
`[Queue] -> [Unshift] Added ${this.tracks.length} tracks to the queue.`
|
|
4377
|
+
);
|
|
4378
|
+
await this.utils.save();
|
|
4004
4379
|
return this;
|
|
4005
4380
|
}
|
|
4006
4381
|
/**
|
|
4007
4382
|
*
|
|
4008
4383
|
* Shuffle the queue.
|
|
4009
|
-
* @returns {this} The queue instance.
|
|
4384
|
+
* @returns {Promise<this>} The queue instance.
|
|
4010
4385
|
* @example
|
|
4011
4386
|
* ```ts
|
|
4012
4387
|
* const queue = player.queue;
|
|
4013
4388
|
*
|
|
4014
4389
|
* console.log(queue.size); // 0
|
|
4015
|
-
* queue.add(track);
|
|
4016
|
-
* queue.add(
|
|
4390
|
+
* await queue.add(track);
|
|
4391
|
+
* await queue.add(track1, track2);
|
|
4017
4392
|
*
|
|
4018
4393
|
* console.log(queue.size); // 3
|
|
4019
4394
|
* console.log(queue.tracks); // [track, track1, track2]
|
|
4020
4395
|
*
|
|
4021
|
-
* queue.shuffle();
|
|
4396
|
+
* await queue.shuffle();
|
|
4022
4397
|
* console.log(queue.tracks); // [track2, track, track1]
|
|
4023
4398
|
* ```
|
|
4024
4399
|
*/
|
|
4025
|
-
shuffle() {
|
|
4400
|
+
async shuffle() {
|
|
4026
4401
|
if (this.size <= 1) return this;
|
|
4027
4402
|
if (this.size === 2) [this.tracks[0], this.tracks[1]] = [this.tracks[1], this.tracks[0]];
|
|
4028
4403
|
else {
|
|
@@ -4033,31 +4408,33 @@ var Queue = class {
|
|
|
4033
4408
|
}
|
|
4034
4409
|
this.player.manager.emit("queueUpdate" /* QueueUpdate */, this.player, this);
|
|
4035
4410
|
this.player.manager.emit("debug" /* Debug */, 5 /* Queue */, "[Queue] -> [Shuffle] Shuffled the queue.");
|
|
4411
|
+
await this.utils.save();
|
|
4036
4412
|
return this;
|
|
4037
4413
|
}
|
|
4038
4414
|
/**
|
|
4039
4415
|
*
|
|
4040
4416
|
* Clear the queue.
|
|
4041
|
-
* @returns {this} The queue instance.
|
|
4417
|
+
* @returns {Promise<this>} The queue instance.
|
|
4042
4418
|
* @example
|
|
4043
4419
|
* ```ts
|
|
4044
4420
|
* const queue = player.queue;
|
|
4045
4421
|
*
|
|
4046
4422
|
* console.log(queue.size); // 0
|
|
4047
|
-
* queue.add(track);
|
|
4048
|
-
* queue.add(
|
|
4423
|
+
* await queue.add(track);
|
|
4424
|
+
* await queue.add(track1, track2);
|
|
4049
4425
|
*
|
|
4050
4426
|
* console.log(queue.size); // 3
|
|
4051
|
-
* queue.clear();
|
|
4427
|
+
* await queue.clear();
|
|
4052
4428
|
* console.log(queue.size); // 0
|
|
4053
4429
|
* ```
|
|
4054
4430
|
*/
|
|
4055
|
-
clear() {
|
|
4431
|
+
async clear() {
|
|
4056
4432
|
this.tracks = [];
|
|
4057
4433
|
this.history = [];
|
|
4058
4434
|
this.current = null;
|
|
4059
4435
|
this.player.manager.emit("queueUpdate" /* QueueUpdate */, this.player, this);
|
|
4060
4436
|
this.player.manager.emit("debug" /* Debug */, 5 /* Queue */, "[Queue] -> [Clear] Cleared the queue.");
|
|
4437
|
+
await this.utils.save();
|
|
4061
4438
|
return this;
|
|
4062
4439
|
}
|
|
4063
4440
|
/**
|
|
@@ -4065,15 +4442,31 @@ var Queue = class {
|
|
|
4065
4442
|
* Move a track to a specific position in the queue.
|
|
4066
4443
|
* @param {Track} track The track to move.
|
|
4067
4444
|
* @param {number} to The position to move.
|
|
4068
|
-
* @returns {this} The queue instance.
|
|
4445
|
+
* @returns {Promise<this>} The queue instance.
|
|
4446
|
+
* @example
|
|
4447
|
+
* ```ts
|
|
4448
|
+
* const queue = player.queue;
|
|
4449
|
+
* await queue.add(track);
|
|
4450
|
+
* await queue.add(track1);
|
|
4451
|
+
* await queue.add(track2);
|
|
4452
|
+
*
|
|
4453
|
+
* console.log(queue.tracks); // [track, track1, track2]
|
|
4454
|
+
* await queue.move(track1, 0);
|
|
4455
|
+
* console.log(queue.tracks); // [track1, track, track2]
|
|
4456
|
+
* ```
|
|
4069
4457
|
*/
|
|
4070
|
-
move(track, to) {
|
|
4458
|
+
async move(track, to) {
|
|
4071
4459
|
const index = this.tracks.indexOf(track);
|
|
4072
4460
|
if (index === -1) return this;
|
|
4073
|
-
this.splice(index, 1);
|
|
4074
|
-
this.add(track, to - 1);
|
|
4461
|
+
await this.splice(index, 1);
|
|
4462
|
+
await this.add(track, to - 1);
|
|
4075
4463
|
this.player.manager.emit("queueUpdate" /* QueueUpdate */, this.player, this);
|
|
4076
|
-
this.player.manager.emit(
|
|
4464
|
+
this.player.manager.emit(
|
|
4465
|
+
"debug" /* Debug */,
|
|
4466
|
+
5 /* Queue */,
|
|
4467
|
+
`[Queue] -> [Move] Moved track ${track.info.title} to position ${to}.`
|
|
4468
|
+
);
|
|
4469
|
+
await this.utils.save();
|
|
4077
4470
|
return this;
|
|
4078
4471
|
}
|
|
4079
4472
|
/**
|
|
@@ -4082,23 +4475,42 @@ var Queue = class {
|
|
|
4082
4475
|
* @param {number} start The start index.
|
|
4083
4476
|
* @param {number} deleteCount The number of tracks to delete.
|
|
4084
4477
|
* @param {Track | Track[]} [tracks] The tracks to add.
|
|
4085
|
-
* @returns {this} The queue instance.
|
|
4478
|
+
* @returns {Promise<this>} The queue instance.
|
|
4479
|
+
* @example
|
|
4480
|
+
* ```ts
|
|
4481
|
+
* const queue = player.queue;
|
|
4482
|
+
* await queue.add(track);
|
|
4483
|
+
* await queue.add(track1);
|
|
4484
|
+
* await queue.add(track2);
|
|
4485
|
+
*
|
|
4486
|
+
* console.log(queue.tracks); // [track, track1, track2]
|
|
4487
|
+
* await queue.splice(1, 1);
|
|
4488
|
+
* console.log(queue.tracks); // [track, track2]
|
|
4489
|
+
* ```
|
|
4086
4490
|
*/
|
|
4087
|
-
splice(start, deleteCount, tracks) {
|
|
4088
|
-
if (!this.size && tracks) this.add(tracks);
|
|
4491
|
+
async splice(start, deleteCount, tracks) {
|
|
4492
|
+
if (!this.size && tracks) await this.add(tracks);
|
|
4089
4493
|
if (tracks) this.tracks.splice(start, deleteCount, ...Array.isArray(tracks) ? tracks : [tracks]);
|
|
4090
4494
|
else this.tracks.splice(start, deleteCount);
|
|
4091
4495
|
this.player.manager.emit("queueUpdate" /* QueueUpdate */, this.player, this);
|
|
4092
4496
|
this.player.manager.emit("debug" /* Debug */, 5 /* Queue */, `[Queue] -> [Splice] Removed ${deleteCount} tracks from the queue.`);
|
|
4497
|
+
await this.utils.save();
|
|
4093
4498
|
return this;
|
|
4094
4499
|
}
|
|
4095
4500
|
/**
|
|
4096
4501
|
*
|
|
4097
4502
|
* Convert the queue to a JSON object.
|
|
4098
4503
|
* @returns {QueueJson} The queue JSON object.
|
|
4504
|
+
* @example
|
|
4505
|
+
* ```ts
|
|
4506
|
+
* const queue = player.queue;
|
|
4507
|
+
* await queue.add(track);
|
|
4508
|
+
*
|
|
4509
|
+
* console.log(queue.toJSON()); // { tracks: [track], history: [], current: null }
|
|
4510
|
+
* ```
|
|
4099
4511
|
*/
|
|
4100
4512
|
toJSON() {
|
|
4101
|
-
const max = this.player.manager.options.queueOptions.
|
|
4513
|
+
const max = this.player.manager.options.queueOptions.maxHistory;
|
|
4102
4514
|
if (this.history.length > max) this.history.splice(max, this.history.length);
|
|
4103
4515
|
return {
|
|
4104
4516
|
tracks: this.tracks,
|
|
@@ -4137,7 +4549,7 @@ var Structures = {
|
|
|
4137
4549
|
var maxTracks = 10;
|
|
4138
4550
|
async function autoplayFn(player, lastTrack) {
|
|
4139
4551
|
if (!lastTrack) return;
|
|
4140
|
-
const isEnabled = !!player.data.get("enabledAutoplay") || player.manager.options.queueOptions.autoPlay;
|
|
4552
|
+
const isEnabled = !!await player.data.get("enabledAutoplay") || player.manager.options.queueOptions.autoPlay;
|
|
4141
4553
|
if (!isEnabled) return;
|
|
4142
4554
|
const filter = (tracks) => tracks.filter(
|
|
4143
4555
|
(track) => !(player.queue.history.some((t) => t.info.identifier === track.info.identifier) || lastTrack.info.identifier === track.info.identifier)
|
|
@@ -4178,8 +4590,54 @@ async function autoplayFn(player, lastTrack) {
|
|
|
4178
4590
|
}
|
|
4179
4591
|
}
|
|
4180
4592
|
|
|
4181
|
-
// src/classes/
|
|
4182
|
-
var
|
|
4593
|
+
// src/classes/storage/PlayerMemory.ts
|
|
4594
|
+
var PlayerMemoryStorage = class extends PlayerStorageAdapter {
|
|
4595
|
+
/**
|
|
4596
|
+
* The internal storage.
|
|
4597
|
+
* @type {Map<K, V>}
|
|
4598
|
+
* @private
|
|
4599
|
+
* @readonly
|
|
4600
|
+
* @internal
|
|
4601
|
+
*/
|
|
4602
|
+
internal = /* @__PURE__ */ new Map();
|
|
4603
|
+
get(key) {
|
|
4604
|
+
return this.internal.get(this.buildKey(this.namespace, key));
|
|
4605
|
+
}
|
|
4606
|
+
set(key, value) {
|
|
4607
|
+
this.internal.set(this.buildKey(this.namespace, key), value);
|
|
4608
|
+
}
|
|
4609
|
+
has(key) {
|
|
4610
|
+
return this.internal.has(this.buildKey(this.namespace, key));
|
|
4611
|
+
}
|
|
4612
|
+
delete(key) {
|
|
4613
|
+
return this.internal.delete(this.buildKey(this.namespace, key));
|
|
4614
|
+
}
|
|
4615
|
+
keys() {
|
|
4616
|
+
return [...this.internal.keys()];
|
|
4617
|
+
}
|
|
4618
|
+
values() {
|
|
4619
|
+
return [...this.internal.values()];
|
|
4620
|
+
}
|
|
4621
|
+
entries() {
|
|
4622
|
+
return [...this.internal.entries()];
|
|
4623
|
+
}
|
|
4624
|
+
all() {
|
|
4625
|
+
return Object.fromEntries([...this.internal.entries()].filter(([key]) => !key.startsWith("internal_")));
|
|
4626
|
+
}
|
|
4627
|
+
clear() {
|
|
4628
|
+
this.internal.clear();
|
|
4629
|
+
}
|
|
4630
|
+
size() {
|
|
4631
|
+
return this.internal.size;
|
|
4632
|
+
}
|
|
4633
|
+
buildKey(...parts) {
|
|
4634
|
+
const flattern = parts.flat();
|
|
4635
|
+
return flattern.join(":");
|
|
4636
|
+
}
|
|
4637
|
+
};
|
|
4638
|
+
|
|
4639
|
+
// src/classes/storage/QueueMemory.ts
|
|
4640
|
+
var QueueMemoryStorage = class extends QueueStorageAdapter {
|
|
4183
4641
|
/**
|
|
4184
4642
|
* Memory storage.
|
|
4185
4643
|
* @type {Map<string, QueueJson>}
|
|
@@ -4192,16 +4650,16 @@ var MemoryAdapter = class extends StorageAdapter {
|
|
|
4192
4650
|
return this.parse(this.storage.get(key));
|
|
4193
4651
|
}
|
|
4194
4652
|
set(key, value) {
|
|
4195
|
-
this.storage.set(key, this.stringify(value));
|
|
4653
|
+
this.storage.set(this.buildKey(this.namespace, key), this.stringify(value));
|
|
4196
4654
|
}
|
|
4197
4655
|
delete(key) {
|
|
4198
|
-
return this.storage.delete(key);
|
|
4656
|
+
return this.storage.delete(this.buildKey(this.namespace, key));
|
|
4199
4657
|
}
|
|
4200
4658
|
clear() {
|
|
4201
4659
|
this.storage.clear();
|
|
4202
4660
|
}
|
|
4203
4661
|
has(key) {
|
|
4204
|
-
return this.storage.has(key);
|
|
4662
|
+
return this.storage.has(this.buildKey(this.namespace, key));
|
|
4205
4663
|
}
|
|
4206
4664
|
parse(value) {
|
|
4207
4665
|
return value;
|
|
@@ -4209,6 +4667,10 @@ var MemoryAdapter = class extends StorageAdapter {
|
|
|
4209
4667
|
stringify(value) {
|
|
4210
4668
|
return value;
|
|
4211
4669
|
}
|
|
4670
|
+
buildKey(...parts) {
|
|
4671
|
+
const flattern = parts.flat();
|
|
4672
|
+
return flattern.join(":");
|
|
4673
|
+
}
|
|
4212
4674
|
};
|
|
4213
4675
|
|
|
4214
4676
|
// src/classes/Hoshimi.ts
|
|
@@ -4239,6 +4701,7 @@ var Hoshimi = class extends EventEmitter {
|
|
|
4239
4701
|
* The constructor for the manager.
|
|
4240
4702
|
* @param {HoshimiOptions} options The options for the manager.
|
|
4241
4703
|
* @throws {ManagerError} If the options are not provided.
|
|
4704
|
+
* @throws {OptionError} If the options are invalid.
|
|
4242
4705
|
* @example
|
|
4243
4706
|
* ```ts
|
|
4244
4707
|
* const manager = new Hoshimi({
|
|
@@ -4264,10 +4727,24 @@ var Hoshimi = class extends EventEmitter {
|
|
|
4264
4727
|
* resumeByLibrary: false,
|
|
4265
4728
|
* },
|
|
4266
4729
|
* queueOptions: {
|
|
4267
|
-
*
|
|
4268
|
-
*
|
|
4269
|
-
*
|
|
4730
|
+
* maxHistory: 25,
|
|
4731
|
+
* autoplayFn: autoplayFn,
|
|
4732
|
+
* autoPlay: false,
|
|
4733
|
+
* storage: new MemoryAdapter(),
|
|
4734
|
+
* requesterFn: defaultRequesterFn,
|
|
4270
4735
|
* },
|
|
4736
|
+
* playerOptions: {
|
|
4737
|
+
* onDisconnect: {
|
|
4738
|
+
* autoDestroy: false,
|
|
4739
|
+
* autoReconnect: false,
|
|
4740
|
+
* autoQueue: false,
|
|
4741
|
+
* },
|
|
4742
|
+
* onError: {
|
|
4743
|
+
* autoDestroy: false,
|
|
4744
|
+
* autoSkip: false,
|
|
4745
|
+
* autoStop: false,
|
|
4746
|
+
* },
|
|
4747
|
+
* },
|
|
4271
4748
|
* });
|
|
4272
4749
|
*
|
|
4273
4750
|
* console.log(manager); // The manager instance
|
|
@@ -4289,10 +4766,24 @@ var Hoshimi = class extends EventEmitter {
|
|
|
4289
4766
|
resumeTimeout: options.nodeOptions?.resumeTimeout ?? 1e4
|
|
4290
4767
|
},
|
|
4291
4768
|
queueOptions: {
|
|
4292
|
-
|
|
4769
|
+
maxHistory: options.queueOptions?.maxHistory ?? 25,
|
|
4293
4770
|
autoplayFn: options.queueOptions?.autoplayFn ?? autoplayFn,
|
|
4294
4771
|
autoPlay: options.queueOptions?.autoPlay ?? false,
|
|
4295
|
-
storage: options.queueOptions?.storage ?? new
|
|
4772
|
+
storage: options.queueOptions?.storage ?? new QueueMemoryStorage()
|
|
4773
|
+
},
|
|
4774
|
+
playerOptions: {
|
|
4775
|
+
requesterFn: options.playerOptions?.requesterFn ?? requesterFn,
|
|
4776
|
+
storage: options.playerOptions?.storage ?? new PlayerMemoryStorage(),
|
|
4777
|
+
onDisconnect: {
|
|
4778
|
+
autoDestroy: options.playerOptions?.onDisconnect?.autoDestroy ?? false,
|
|
4779
|
+
autoReconnect: options.playerOptions?.onDisconnect?.autoReconnect ?? false,
|
|
4780
|
+
autoQueue: options.playerOptions?.onDisconnect?.autoQueue ?? false
|
|
4781
|
+
},
|
|
4782
|
+
onError: {
|
|
4783
|
+
autoDestroy: options.playerOptions?.onError?.autoDestroy ?? false,
|
|
4784
|
+
autoSkip: options.playerOptions?.onError?.autoSkip ?? false,
|
|
4785
|
+
autoStop: options.playerOptions?.onError?.autoStop ?? false
|
|
4786
|
+
}
|
|
4296
4787
|
},
|
|
4297
4788
|
client: {
|
|
4298
4789
|
id: options.client?.id ?? "",
|
|
@@ -4404,37 +4895,98 @@ var Hoshimi = class extends EventEmitter {
|
|
|
4404
4895
|
this.emit("debug" /* Debug */, 3 /* Player */, "[Player] -> [Voice] The guild id is missing.");
|
|
4405
4896
|
return;
|
|
4406
4897
|
}
|
|
4407
|
-
if ("user_id" in data && data.user_id !== this.options.client?.id) {
|
|
4408
|
-
this.emit("debug" /* Debug */, 3 /* Player */, "[Player] -> [Voice] The user id does not match the client id.");
|
|
4409
|
-
return;
|
|
4410
|
-
}
|
|
4411
4898
|
const player = this.getPlayer(data.guild_id);
|
|
4412
4899
|
if (!player) {
|
|
4413
4900
|
this.emit("debug" /* Debug */, 3 /* Player */, "[Player] -> [Voice] The player is not found.");
|
|
4414
4901
|
return;
|
|
4415
4902
|
}
|
|
4416
4903
|
if ("session_id" in data) player.voice.sessionId = data.session_id;
|
|
4417
|
-
if ("token" in data
|
|
4418
|
-
|
|
4419
|
-
|
|
4420
|
-
|
|
4421
|
-
|
|
4904
|
+
if ("token" in data && "endpoint" in data) {
|
|
4905
|
+
if (!player.voice.sessionId) {
|
|
4906
|
+
this.emit(
|
|
4907
|
+
"debug" /* Debug */,
|
|
4908
|
+
3 /* Player */,
|
|
4909
|
+
`[Player] -> [Voice] The session id is missing for: ${data.guild_id}`
|
|
4910
|
+
);
|
|
4911
|
+
return;
|
|
4912
|
+
}
|
|
4913
|
+
await player.updatePlayer({
|
|
4422
4914
|
playerOptions: {
|
|
4423
|
-
voice:
|
|
4915
|
+
voice: {
|
|
4916
|
+
sessionId: player.voice.sessionId,
|
|
4917
|
+
token: data.token,
|
|
4918
|
+
endpoint: data.endpoint
|
|
4919
|
+
}
|
|
4424
4920
|
}
|
|
4425
4921
|
});
|
|
4426
4922
|
this.emit(
|
|
4427
4923
|
"debug" /* Debug */,
|
|
4428
4924
|
3 /* Player */,
|
|
4429
|
-
`[Player] -> [Voice] Updated the player voice for: ${data.guild_id} | Session: ${player.voice.sessionId} | Token: ${
|
|
4925
|
+
`[Player] -> [Voice] Updated the player voice for: ${data.guild_id} | Session: ${player.voice.sessionId} | Token: ${data.token} | Endpoint: ${data.endpoint}`
|
|
4430
4926
|
);
|
|
4431
4927
|
return;
|
|
4432
4928
|
}
|
|
4433
|
-
|
|
4929
|
+
if (data.user_id !== this.options.client.id) {
|
|
4930
|
+
this.emit("debug" /* Debug */, 3 /* Player */, "[Player] -> [Voice] The user id does not match the client id.");
|
|
4931
|
+
return;
|
|
4932
|
+
}
|
|
4933
|
+
if (data.channel_id !== null) {
|
|
4934
|
+
const voiceId = player.voiceId ?? player.options.voiceId;
|
|
4935
|
+
if (data.channel_id !== voiceId) {
|
|
4936
|
+
this.emit(
|
|
4937
|
+
"debug" /* Debug */,
|
|
4938
|
+
3 /* Player */,
|
|
4939
|
+
`[Player] -> [Voice] Updating the voice channel for: ${data.guild_id} | Old: ${voiceId} | New: ${data.channel_id}`
|
|
4940
|
+
);
|
|
4941
|
+
player.voice.sessionId = data.session_id ?? player.voice.sessionId;
|
|
4942
|
+
player.voiceId = data.channel_id;
|
|
4943
|
+
player.options.voiceId = data.channel_id;
|
|
4944
|
+
if (!player.connected) await player.connect();
|
|
4945
|
+
return;
|
|
4946
|
+
}
|
|
4947
|
+
} else {
|
|
4948
|
+
this.emit(
|
|
4949
|
+
"debug" /* Debug */,
|
|
4950
|
+
3 /* Player */,
|
|
4951
|
+
`[Player] -> [Voice] The channel id is missing for: ${data.guild_id}`
|
|
4952
|
+
);
|
|
4953
|
+
const { autoDestroy, autoReconnect, autoQueue } = this.options.playerOptions.onDisconnect;
|
|
4954
|
+
if (autoDestroy) {
|
|
4955
|
+
await player.destroy("Player-VoiceChannelLeft" /* VoiceChannelLeft */);
|
|
4956
|
+
return;
|
|
4957
|
+
}
|
|
4958
|
+
if (autoReconnect) {
|
|
4959
|
+
try {
|
|
4960
|
+
const position = player.position;
|
|
4961
|
+
const paused = player.paused;
|
|
4962
|
+
this.emit(
|
|
4963
|
+
"debug" /* Debug */,
|
|
4964
|
+
3 /* Player */,
|
|
4965
|
+
`[Player] -> [Voice] Attempting to reconnect the player for: ${data.guild_id}`
|
|
4966
|
+
);
|
|
4967
|
+
if (autoQueue && player.queue.current && !player.queue.isEmpty()) await player.connect();
|
|
4968
|
+
if (player.queue.current) return player.play({ track: player.queue.current, paused, position });
|
|
4969
|
+
if (!player.queue.isEmpty()) return player.play({ paused });
|
|
4970
|
+
this.emit(
|
|
4971
|
+
"debug" /* Debug */,
|
|
4972
|
+
3 /* Player */,
|
|
4973
|
+
`[Player] -> [Voice] No tracks to play after reconnect for: ${data.guild_id}`
|
|
4974
|
+
);
|
|
4975
|
+
} catch (error) {
|
|
4976
|
+
this.emit("playerError" /* PlayerError */, player, error);
|
|
4977
|
+
await player.destroy("Player-ReconnectFailed" /* ReconnectFailed */);
|
|
4978
|
+
}
|
|
4979
|
+
}
|
|
4980
|
+
player.voiceId = void 0;
|
|
4981
|
+
player.voice = {
|
|
4982
|
+
endpoint: null,
|
|
4983
|
+
sessionId: null,
|
|
4984
|
+
token: null
|
|
4985
|
+
};
|
|
4986
|
+
return;
|
|
4987
|
+
}
|
|
4434
4988
|
}
|
|
4435
4989
|
break;
|
|
4436
|
-
default:
|
|
4437
|
-
break;
|
|
4438
4990
|
}
|
|
4439
4991
|
}
|
|
4440
4992
|
/**
|
|
@@ -4539,6 +5091,7 @@ var Hoshimi = class extends EventEmitter {
|
|
|
4539
5091
|
1 /* Manager */,
|
|
4540
5092
|
`[Manager] -> [Search] Searching for: ${options.query} (${options.engine ?? "unknown"}) | Result: ${stringify(res)}`
|
|
4541
5093
|
);
|
|
5094
|
+
const requesterFn2 = this.options.playerOptions.requesterFn;
|
|
4542
5095
|
switch (res.loadType) {
|
|
4543
5096
|
case "empty" /* Empty */: {
|
|
4544
5097
|
return {
|
|
@@ -4564,7 +5117,7 @@ var Hoshimi = class extends EventEmitter {
|
|
|
4564
5117
|
exception: null,
|
|
4565
5118
|
playlist: res.data,
|
|
4566
5119
|
pluginInfo: res.data.pluginInfo,
|
|
4567
|
-
tracks: res.data.tracks.map((t) => new Track(t, options.requester))
|
|
5120
|
+
tracks: res.data.tracks.map((t) => new Track(t, requesterFn2(options.requester)))
|
|
4568
5121
|
};
|
|
4569
5122
|
}
|
|
4570
5123
|
case "search" /* Search */: {
|
|
@@ -4573,7 +5126,7 @@ var Hoshimi = class extends EventEmitter {
|
|
|
4573
5126
|
exception: null,
|
|
4574
5127
|
playlist: null,
|
|
4575
5128
|
pluginInfo: null,
|
|
4576
|
-
tracks: res.data.map((t) => new Track(t, options.requester))
|
|
5129
|
+
tracks: res.data.map((t) => new Track(t, requesterFn2(options.requester)))
|
|
4577
5130
|
};
|
|
4578
5131
|
}
|
|
4579
5132
|
case "track" /* Track */: {
|
|
@@ -4582,7 +5135,7 @@ var Hoshimi = class extends EventEmitter {
|
|
|
4582
5135
|
exception: null,
|
|
4583
5136
|
playlist: null,
|
|
4584
5137
|
pluginInfo: res.data.pluginInfo,
|
|
4585
|
-
tracks: [new Track(res.data, options.requester)]
|
|
5138
|
+
tracks: [new Track(res.data, requesterFn2(options.requester))]
|
|
4586
5139
|
};
|
|
4587
5140
|
}
|
|
4588
5141
|
}
|
|
@@ -4593,45 +5146,56 @@ function createHoshimi(...args) {
|
|
|
4593
5146
|
}
|
|
4594
5147
|
export {
|
|
4595
5148
|
AudioOutput,
|
|
5149
|
+
AudioOutputData,
|
|
4596
5150
|
DSPXPluginFilter,
|
|
4597
5151
|
DebugLevels,
|
|
5152
|
+
DefaultFilterPreset,
|
|
5153
|
+
DefaultPlayerFilters,
|
|
4598
5154
|
DestroyReasons,
|
|
4599
|
-
|
|
5155
|
+
EventNames,
|
|
4600
5156
|
FilterManager,
|
|
4601
5157
|
FilterType,
|
|
4602
5158
|
Hoshimi,
|
|
5159
|
+
HoshimiAgent,
|
|
4603
5160
|
HttpMethods,
|
|
4604
5161
|
HttpStatusCodes,
|
|
4605
5162
|
LavalinkPluginFilter,
|
|
4606
5163
|
LoadType,
|
|
4607
5164
|
LoopMode,
|
|
4608
5165
|
ManagerError,
|
|
4609
|
-
MemoryAdapter,
|
|
4610
5166
|
Node,
|
|
4611
5167
|
NodeDestroyReasons,
|
|
4612
5168
|
NodeError,
|
|
5169
|
+
NodeManagerError,
|
|
4613
5170
|
NodeSortTypes,
|
|
4614
5171
|
OpCodes,
|
|
4615
5172
|
OptionError,
|
|
4616
5173
|
Player,
|
|
4617
5174
|
PlayerError,
|
|
4618
5175
|
PlayerEventType,
|
|
5176
|
+
PlayerMemoryStorage,
|
|
5177
|
+
PlayerStorageAdapter,
|
|
4619
5178
|
PluginInfoType,
|
|
4620
5179
|
PluginNames,
|
|
4621
5180
|
Queue,
|
|
5181
|
+
QueueMemoryStorage,
|
|
5182
|
+
QueueStorageAdapter,
|
|
4622
5183
|
ResolveError,
|
|
4623
5184
|
Rest,
|
|
4624
5185
|
RestPathType,
|
|
5186
|
+
RestRoutes,
|
|
4625
5187
|
SearchEngines,
|
|
4626
5188
|
Severity,
|
|
4627
5189
|
SourceNames,
|
|
4628
5190
|
State,
|
|
4629
|
-
StorageAdapter,
|
|
4630
5191
|
StorageError,
|
|
4631
5192
|
Structures,
|
|
4632
5193
|
Track,
|
|
4633
5194
|
TrackEndReason,
|
|
4634
5195
|
UnresolvedTrack,
|
|
5196
|
+
UrlRegex,
|
|
5197
|
+
ValidEngines,
|
|
5198
|
+
ValidSources,
|
|
4635
5199
|
WebsocketCloseCodes,
|
|
4636
5200
|
createHoshimi
|
|
4637
5201
|
};
|