magmastream 2.9.3-dev.7 → 2.9.3-dev.9
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/structures/Manager.js +15 -17
- package/dist/structures/Node.js +1 -1
- package/dist/structures/Utils.js +8 -7
- package/package.json +23 -20
|
@@ -177,11 +177,15 @@ class Manager extends events_1.EventEmitter {
|
|
|
177
177
|
db: config.db ?? 0,
|
|
178
178
|
});
|
|
179
179
|
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
180
|
+
const results = await Promise.allSettled([...this.nodes.values()].map(async (node) => {
|
|
181
|
+
await node.connect();
|
|
182
|
+
return node;
|
|
183
|
+
}));
|
|
184
|
+
for (let i = 0; i < results.length; i++) {
|
|
185
|
+
const result = results[i];
|
|
186
|
+
const node = [...this.nodes.values()][i];
|
|
187
|
+
if (result.status === "rejected") {
|
|
188
|
+
const err = result.reason;
|
|
185
189
|
const error = err instanceof MagmastreamError_1.MagmaStreamError
|
|
186
190
|
? err
|
|
187
191
|
: new MagmastreamError_1.MagmaStreamError({
|
|
@@ -277,9 +281,7 @@ class Manager extends events_1.EventEmitter {
|
|
|
277
281
|
result.playlist.tracks = result.playlist.tracks.map(processTrack);
|
|
278
282
|
}
|
|
279
283
|
}
|
|
280
|
-
const summary = "tracks" in result
|
|
281
|
-
? result.tracks.map((t) => Object.fromEntries(Object.entries(t).filter(([key]) => key !== "requester")))
|
|
282
|
-
: [];
|
|
284
|
+
const summary = "tracks" in result ? result.tracks.map((t) => Object.fromEntries(Object.entries(t).filter(([key]) => key !== "requester"))) : [];
|
|
283
285
|
this.emit(Enums_1.ManagerEventTypes.Debug, `[MANAGER] Result search for ${_query.query}: ${Utils_1.JSONUtils.safe(summary, 2)}`);
|
|
284
286
|
return result;
|
|
285
287
|
}
|
|
@@ -468,7 +470,7 @@ class Manager extends events_1.EventEmitter {
|
|
|
468
470
|
try {
|
|
469
471
|
const redisKey = `${this.options.stateStorage.redisConfig.prefix?.endsWith(":")
|
|
470
472
|
? this.options.stateStorage.redisConfig.prefix
|
|
471
|
-
: this.options.stateStorage.redisConfig.prefix ?? "magmastream:"}playerstore:${guildId}`;
|
|
473
|
+
: (this.options.stateStorage.redisConfig.prefix ?? "magmastream:")}playerstore:${guildId}`;
|
|
472
474
|
await this.redis.set(redisKey, JSON.stringify(serializedPlayer));
|
|
473
475
|
this.emit(Enums_1.ManagerEventTypes.Debug, `[MANAGER] Player state saved to Redis: ${guildId}`);
|
|
474
476
|
}
|
|
@@ -722,7 +724,7 @@ class Manager extends events_1.EventEmitter {
|
|
|
722
724
|
// Get all keys matching our pattern
|
|
723
725
|
const redisKeyPattern = `${this.options.stateStorage.redisConfig.prefix?.endsWith(":")
|
|
724
726
|
? this.options.stateStorage.redisConfig.prefix
|
|
725
|
-
: this.options.stateStorage.redisConfig.prefix ?? "magmastream:"}playerstore:*`;
|
|
727
|
+
: (this.options.stateStorage.redisConfig.prefix ?? "magmastream:")}playerstore:*`;
|
|
726
728
|
const keys = await this.redis.keys(redisKeyPattern);
|
|
727
729
|
for (const key of keys) {
|
|
728
730
|
try {
|
|
@@ -916,11 +918,7 @@ class Manager extends events_1.EventEmitter {
|
|
|
916
918
|
* @returns {Node} The node to use.
|
|
917
919
|
*/
|
|
918
920
|
get useableNode() {
|
|
919
|
-
return this.options.enablePriorityMode
|
|
920
|
-
? this.priorityNode
|
|
921
|
-
: this.options.useNode === Enums_1.UseNodeOptions.LeastLoad
|
|
922
|
-
? this.leastLoadNode.first()
|
|
923
|
-
: this.leastPlayersNode.first();
|
|
921
|
+
return this.options.enablePriorityMode ? this.priorityNode : this.options.useNode === Enums_1.UseNodeOptions.LeastLoad ? this.leastLoadNode.first() : this.leastPlayersNode.first();
|
|
924
922
|
}
|
|
925
923
|
/**
|
|
926
924
|
* Handles the shutdown of the process by saving all active players' states and optionally cleaning up inactive players.
|
|
@@ -1157,7 +1155,7 @@ class Manager extends events_1.EventEmitter {
|
|
|
1157
1155
|
{
|
|
1158
1156
|
const prefix = this.options.stateStorage.redisConfig.prefix?.endsWith(":")
|
|
1159
1157
|
? this.options.stateStorage.redisConfig.prefix
|
|
1160
|
-
: this.options.stateStorage.redisConfig.prefix ?? "magmastream:";
|
|
1158
|
+
: (this.options.stateStorage.redisConfig.prefix ?? "magmastream:");
|
|
1161
1159
|
const pattern = `${prefix}queue:*:current`;
|
|
1162
1160
|
try {
|
|
1163
1161
|
const stream = this.redis.scanStream({
|
|
@@ -1342,7 +1340,7 @@ class Manager extends events_1.EventEmitter {
|
|
|
1342
1340
|
case Enums_1.StateStorageType.Redis: {
|
|
1343
1341
|
const prefix = this.options.stateStorage.redisConfig.prefix?.endsWith(":")
|
|
1344
1342
|
? this.options.stateStorage.redisConfig.prefix
|
|
1345
|
-
: this.options.stateStorage.redisConfig.prefix ?? "magmastream:";
|
|
1343
|
+
: (this.options.stateStorage.redisConfig.prefix ?? "magmastream:");
|
|
1346
1344
|
const patterns = [`${prefix}playerstore:*`, `${prefix}queue:*`];
|
|
1347
1345
|
try {
|
|
1348
1346
|
for (const pattern of patterns) {
|
package/dist/structures/Node.js
CHANGED
|
@@ -108,7 +108,7 @@ class Node {
|
|
|
108
108
|
case Enums_1.StateStorageType.Redis:
|
|
109
109
|
this.redisPrefix = this.manager.options.stateStorage.redisConfig.prefix?.endsWith(":")
|
|
110
110
|
? this.manager.options.stateStorage.redisConfig.prefix
|
|
111
|
-
: this.manager.options.stateStorage.redisConfig.prefix ?? "magmastream:";
|
|
111
|
+
: (this.manager.options.stateStorage.redisConfig.prefix ?? "magmastream:");
|
|
112
112
|
break;
|
|
113
113
|
}
|
|
114
114
|
}
|
package/dist/structures/Utils.js
CHANGED
|
@@ -544,8 +544,7 @@ class AutoPlayUtils {
|
|
|
544
544
|
return typeof data === "object" && data !== null && "encoded" in data && "info" in data;
|
|
545
545
|
}
|
|
546
546
|
static isTrackDataArray(data) {
|
|
547
|
-
return (Array.isArray(data) &&
|
|
548
|
-
data.every((track) => typeof track === "object" && track !== null && "encoded" in track && "info" in track && typeof track.encoded === "string"));
|
|
547
|
+
return (Array.isArray(data) && data.every((track) => typeof track === "object" && track !== null && "encoded" in track && "info" in track && typeof track.encoded === "string"));
|
|
549
548
|
}
|
|
550
549
|
static buildTracksFromResponse(recommendedResult, requester) {
|
|
551
550
|
if (!recommendedResult)
|
|
@@ -661,12 +660,14 @@ class PlayerUtils {
|
|
|
661
660
|
return null;
|
|
662
661
|
if (key === "node")
|
|
663
662
|
return safeNode;
|
|
664
|
-
if (key === "filters"
|
|
663
|
+
if (key === "filters") {
|
|
664
|
+
const filters = { ...value };
|
|
665
|
+
delete filters.player;
|
|
665
666
|
return {
|
|
666
|
-
distortion:
|
|
667
|
-
equalizer:
|
|
668
|
-
karaoke:
|
|
669
|
-
rotation:
|
|
667
|
+
distortion: filters["distortion"] ?? null,
|
|
668
|
+
equalizer: filters["equalizer"] ?? [],
|
|
669
|
+
karaoke: filters["karaoke"] ?? null,
|
|
670
|
+
rotation: filters["rotation"] ?? null,
|
|
670
671
|
timescale: value["timescale"] ?? null,
|
|
671
672
|
vibrato: value["vibrato"] ?? null,
|
|
672
673
|
reverb: value["reverb"] ?? null,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "magmastream",
|
|
3
|
-
"version": "2.9.3-dev.
|
|
3
|
+
"version": "2.9.3-dev.9",
|
|
4
4
|
"description": "A user-friendly Lavalink client designed for NodeJS.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -10,45 +10,48 @@
|
|
|
10
10
|
"scripts": {
|
|
11
11
|
"build": "tsc",
|
|
12
12
|
"types": "rtb --dist dist",
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
13
|
+
"format": "prettier --write .",
|
|
14
|
+
"format:check": "prettier --check .",
|
|
15
|
+
"lint": "eslint \"src/**/*.{ts,js}\"",
|
|
16
|
+
"lint:fix": "eslint --fix \"src/**/*.{ts,js}\"",
|
|
17
|
+
"ci": "run-s format:check lint build types",
|
|
18
|
+
"release:dev": "npm run format && npm run lint:fix && npm run ci && npm version prerelease --preid=dev && npm publish --tag dev"
|
|
17
19
|
},
|
|
18
20
|
"devDependencies": {
|
|
19
21
|
"@favware/rollup-type-bundler": "^4.0.0",
|
|
20
|
-
"@types/jsdom": "^
|
|
21
|
-
"@types/lodash": "^4.17.
|
|
22
|
-
"@types/node": "^
|
|
22
|
+
"@types/jsdom": "^27.0.0",
|
|
23
|
+
"@types/lodash": "^4.17.23",
|
|
24
|
+
"@types/node": "^25.0.9",
|
|
23
25
|
"@types/ws": "^8.18.1",
|
|
24
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
25
|
-
"@typescript-eslint/parser": "^8.
|
|
26
|
-
"eslint": "^9.
|
|
26
|
+
"@typescript-eslint/eslint-plugin": "^8.53.0",
|
|
27
|
+
"@typescript-eslint/parser": "^8.53.0",
|
|
28
|
+
"eslint": "^9.39.2",
|
|
27
29
|
"npm-run-all": "^4.1.5",
|
|
28
|
-
"
|
|
30
|
+
"prettier": "^3.8.0",
|
|
31
|
+
"typedoc": "^0.28.16",
|
|
29
32
|
"typedoc-plugin-no-inherit": "^1.6.1",
|
|
30
|
-
"typescript": "^5.
|
|
33
|
+
"typescript": "^5.9.3"
|
|
31
34
|
},
|
|
32
35
|
"dependencies": {
|
|
33
36
|
"@discordjs/collection": "^2.1.1",
|
|
34
|
-
"axios": "^1.
|
|
37
|
+
"axios": "^1.13.2",
|
|
35
38
|
"events": "^3.3.0",
|
|
36
|
-
"ioredis": "^5.
|
|
37
|
-
"jsdom": "^
|
|
39
|
+
"ioredis": "^5.9.2",
|
|
40
|
+
"jsdom": "^27.4.0",
|
|
38
41
|
"lodash": "^4.17.21",
|
|
39
42
|
"safe-stable-stringify": "^2.5.0",
|
|
40
43
|
"tslib": "^2.8.1",
|
|
41
|
-
"ws": "^8.
|
|
44
|
+
"ws": "^8.19.0"
|
|
42
45
|
},
|
|
43
46
|
"optionalDependencies": {
|
|
44
47
|
"detritus-client": "0.16.x",
|
|
45
48
|
"discord.js": "14.x",
|
|
46
49
|
"eris": "0.18.x",
|
|
47
|
-
"oceanic.js": "1.
|
|
48
|
-
"seyfert": "
|
|
50
|
+
"oceanic.js": "^1.13.0",
|
|
51
|
+
"seyfert": "4.0.x"
|
|
49
52
|
},
|
|
50
53
|
"engines": {
|
|
51
|
-
"node": ">=
|
|
54
|
+
"node": ">=20.19.0"
|
|
52
55
|
},
|
|
53
56
|
"eslintConfig": {
|
|
54
57
|
"root": true,
|