lavalink-client 2.4.0 → 2.4.1
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.
|
@@ -486,25 +486,37 @@ class LavalinkManager extends events_1.EventEmitter {
|
|
|
486
486
|
if ("token" in update) {
|
|
487
487
|
if (!player.node?.sessionId)
|
|
488
488
|
throw new Error("Lavalink Node is either not ready or not up to date");
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
playerOptions: {
|
|
492
|
-
voice: {
|
|
493
|
-
token: update.token,
|
|
494
|
-
endpoint: update.endpoint,
|
|
495
|
-
sessionId: player.voice?.sessionId,
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
});
|
|
499
|
-
if (this.options?.advancedOptions?.enableDebugEvents) {
|
|
489
|
+
const sessionId2Use = player.voice?.sessionId || ("sessionId" in update ? update.sessionId : undefined);
|
|
490
|
+
if (!sessionId2Use) {
|
|
500
491
|
this.emit("debug", Constants_1.DebugEvents.NoAudioDebug, {
|
|
501
|
-
state: "
|
|
502
|
-
message: `
|
|
492
|
+
state: "error",
|
|
493
|
+
message: `Can't send updatePlayer for voice token session - Missing sessionId :: ${JSON.stringify({ voice: { token: update.token, endpoint: update.endpoint, sessionId: sessionId2Use, }, update, playerVoice: player.voice }, null, 2)}`,
|
|
503
494
|
functionLayer: "LavalinkManager > sendRawData()",
|
|
504
495
|
});
|
|
496
|
+
if (this.options?.advancedOptions?.debugOptions?.noAudio === true)
|
|
497
|
+
console.debug("Lavalink-Client-Debug | NO-AUDIO [::] sendRawData function, Sent updatePlayer for voice token session", { voice: { token: update.token, endpoint: update.endpoint, sessionId: sessionId2Use, }, playerVoice: player.voice, update });
|
|
498
|
+
}
|
|
499
|
+
else {
|
|
500
|
+
await player.node.updatePlayer({
|
|
501
|
+
guildId: player.guildId,
|
|
502
|
+
playerOptions: {
|
|
503
|
+
voice: {
|
|
504
|
+
token: update.token,
|
|
505
|
+
endpoint: update.endpoint,
|
|
506
|
+
sessionId: sessionId2Use,
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
});
|
|
510
|
+
if (this.options?.advancedOptions?.enableDebugEvents) {
|
|
511
|
+
this.emit("debug", Constants_1.DebugEvents.NoAudioDebug, {
|
|
512
|
+
state: "log",
|
|
513
|
+
message: `Sent updatePlayer for voice token session :: ${JSON.stringify({ voice: { token: update.token, endpoint: update.endpoint, sessionId: sessionId2Use, }, update, playerVoice: player.voice }, null, 2)}`,
|
|
514
|
+
functionLayer: "LavalinkManager > sendRawData()",
|
|
515
|
+
});
|
|
516
|
+
}
|
|
517
|
+
if (this.options?.advancedOptions?.debugOptions?.noAudio === true)
|
|
518
|
+
console.debug("Lavalink-Client-Debug | NO-AUDIO [::] sendRawData function, Can't send updatePlayer for voice token session - Missing sessionId", { voice: { token: update.token, endpoint: update.endpoint, sessionId: sessionId2Use, } });
|
|
505
519
|
}
|
|
506
|
-
if (this.options?.advancedOptions?.debugOptions?.noAudio === true)
|
|
507
|
-
console.debug("Lavalink-Client-Debug | NO-AUDIO [::] sendRawData function, Sent updatePlayer for voice token session", { voice: { token: update.token, endpoint: update.endpoint, sessionId: player.voice?.sessionId, } });
|
|
508
520
|
return;
|
|
509
521
|
}
|
|
510
522
|
/* voice state update */
|
|
@@ -526,7 +538,18 @@ class LavalinkManager extends events_1.EventEmitter {
|
|
|
526
538
|
if (update.channel_id) {
|
|
527
539
|
if (player.voiceChannelId !== update.channel_id)
|
|
528
540
|
this.emit("playerMove", player, player.voiceChannelId, update.channel_id);
|
|
529
|
-
player.voice.sessionId = update.session_id;
|
|
541
|
+
player.voice.sessionId = update.session_id || player.voice.sessionId;
|
|
542
|
+
if (!player.voice.sessionId) {
|
|
543
|
+
if (this.options?.advancedOptions?.enableDebugEvents) {
|
|
544
|
+
this.emit("debug", Constants_1.DebugEvents.NoAudioDebug, {
|
|
545
|
+
state: "warn",
|
|
546
|
+
message: `Function to assing sessionId provided, but no found in Payload: ${JSON.stringify({ update, playerVoice: player.voice }, null, 2)}`,
|
|
547
|
+
functionLayer: "LavalinkManager > sendRawData()",
|
|
548
|
+
});
|
|
549
|
+
}
|
|
550
|
+
if (this.options?.advancedOptions?.debugOptions?.noAudio === true)
|
|
551
|
+
console.debug(`Lavalink-Client-Debug | NO-AUDIO [::] sendRawData function, Function to assing sessionId provided, but no found in Payload: ${JSON.stringify(update, null, 2)}`);
|
|
552
|
+
}
|
|
530
553
|
player.voiceChannelId = update.channel_id;
|
|
531
554
|
const selfMuteChanged = typeof update.self_mute === "boolean" && player.voiceState.selfMute !== update.self_mute;
|
|
532
555
|
const serverMuteChanged = typeof update.mute === "boolean" && player.voiceState.serverMute !== update.mute;
|
|
@@ -483,25 +483,37 @@ export class LavalinkManager extends EventEmitter {
|
|
|
483
483
|
if ("token" in update) {
|
|
484
484
|
if (!player.node?.sessionId)
|
|
485
485
|
throw new Error("Lavalink Node is either not ready or not up to date");
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
playerOptions: {
|
|
489
|
-
voice: {
|
|
490
|
-
token: update.token,
|
|
491
|
-
endpoint: update.endpoint,
|
|
492
|
-
sessionId: player.voice?.sessionId,
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
});
|
|
496
|
-
if (this.options?.advancedOptions?.enableDebugEvents) {
|
|
486
|
+
const sessionId2Use = player.voice?.sessionId || ("sessionId" in update ? update.sessionId : undefined);
|
|
487
|
+
if (!sessionId2Use) {
|
|
497
488
|
this.emit("debug", DebugEvents.NoAudioDebug, {
|
|
498
|
-
state: "
|
|
499
|
-
message: `
|
|
489
|
+
state: "error",
|
|
490
|
+
message: `Can't send updatePlayer for voice token session - Missing sessionId :: ${JSON.stringify({ voice: { token: update.token, endpoint: update.endpoint, sessionId: sessionId2Use, }, update, playerVoice: player.voice }, null, 2)}`,
|
|
500
491
|
functionLayer: "LavalinkManager > sendRawData()",
|
|
501
492
|
});
|
|
493
|
+
if (this.options?.advancedOptions?.debugOptions?.noAudio === true)
|
|
494
|
+
console.debug("Lavalink-Client-Debug | NO-AUDIO [::] sendRawData function, Sent updatePlayer for voice token session", { voice: { token: update.token, endpoint: update.endpoint, sessionId: sessionId2Use, }, playerVoice: player.voice, update });
|
|
495
|
+
}
|
|
496
|
+
else {
|
|
497
|
+
await player.node.updatePlayer({
|
|
498
|
+
guildId: player.guildId,
|
|
499
|
+
playerOptions: {
|
|
500
|
+
voice: {
|
|
501
|
+
token: update.token,
|
|
502
|
+
endpoint: update.endpoint,
|
|
503
|
+
sessionId: sessionId2Use,
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
});
|
|
507
|
+
if (this.options?.advancedOptions?.enableDebugEvents) {
|
|
508
|
+
this.emit("debug", DebugEvents.NoAudioDebug, {
|
|
509
|
+
state: "log",
|
|
510
|
+
message: `Sent updatePlayer for voice token session :: ${JSON.stringify({ voice: { token: update.token, endpoint: update.endpoint, sessionId: sessionId2Use, }, update, playerVoice: player.voice }, null, 2)}`,
|
|
511
|
+
functionLayer: "LavalinkManager > sendRawData()",
|
|
512
|
+
});
|
|
513
|
+
}
|
|
514
|
+
if (this.options?.advancedOptions?.debugOptions?.noAudio === true)
|
|
515
|
+
console.debug("Lavalink-Client-Debug | NO-AUDIO [::] sendRawData function, Can't send updatePlayer for voice token session - Missing sessionId", { voice: { token: update.token, endpoint: update.endpoint, sessionId: sessionId2Use, } });
|
|
502
516
|
}
|
|
503
|
-
if (this.options?.advancedOptions?.debugOptions?.noAudio === true)
|
|
504
|
-
console.debug("Lavalink-Client-Debug | NO-AUDIO [::] sendRawData function, Sent updatePlayer for voice token session", { voice: { token: update.token, endpoint: update.endpoint, sessionId: player.voice?.sessionId, } });
|
|
505
517
|
return;
|
|
506
518
|
}
|
|
507
519
|
/* voice state update */
|
|
@@ -523,7 +535,18 @@ export class LavalinkManager extends EventEmitter {
|
|
|
523
535
|
if (update.channel_id) {
|
|
524
536
|
if (player.voiceChannelId !== update.channel_id)
|
|
525
537
|
this.emit("playerMove", player, player.voiceChannelId, update.channel_id);
|
|
526
|
-
player.voice.sessionId = update.session_id;
|
|
538
|
+
player.voice.sessionId = update.session_id || player.voice.sessionId;
|
|
539
|
+
if (!player.voice.sessionId) {
|
|
540
|
+
if (this.options?.advancedOptions?.enableDebugEvents) {
|
|
541
|
+
this.emit("debug", DebugEvents.NoAudioDebug, {
|
|
542
|
+
state: "warn",
|
|
543
|
+
message: `Function to assing sessionId provided, but no found in Payload: ${JSON.stringify({ update, playerVoice: player.voice }, null, 2)}`,
|
|
544
|
+
functionLayer: "LavalinkManager > sendRawData()",
|
|
545
|
+
});
|
|
546
|
+
}
|
|
547
|
+
if (this.options?.advancedOptions?.debugOptions?.noAudio === true)
|
|
548
|
+
console.debug(`Lavalink-Client-Debug | NO-AUDIO [::] sendRawData function, Function to assing sessionId provided, but no found in Payload: ${JSON.stringify(update, null, 2)}`);
|
|
549
|
+
}
|
|
527
550
|
player.voiceChannelId = update.channel_id;
|
|
528
551
|
const selfMuteChanged = typeof update.self_mute === "boolean" && player.voiceState.selfMute !== update.self_mute;
|
|
529
552
|
const serverMuteChanged = typeof update.mute === "boolean" && player.voiceState.serverMute !== update.mute;
|
package/package.json
CHANGED
|
@@ -1,29 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lavalink-client",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.1",
|
|
4
4
|
"description": "Easy, flexible and feature-rich lavalink@v4 Client. Both for Beginners and Proficients.",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
7
7
|
"types": "dist/types/index.d.js",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"build": "npm run tool:clean && npm run build:all && npm run tool:fixbuild",
|
|
10
|
-
|
|
11
10
|
"build:bun": "bun run tool:clean && bun run build:all:bun && bun run tool:fixbuild",
|
|
12
11
|
"build:all:bun": "bun run build:cjs && bun run build:esm && bun run build:types",
|
|
13
|
-
|
|
14
12
|
"build:all": "npm run build:cjs && npm run build:esm && npm run build:types",
|
|
15
13
|
"build:cjs": "tsc -p tools/config/tsconfig.cjs.json && tsc-alias -p tools/config/tsconfig.cjs.json",
|
|
16
14
|
"build:esm": "tsc -p tools/config/tsconfig.esm.json && tsc-alias -p tools/config/tsconfig.esm.json",
|
|
17
15
|
"build:types": "tsc -p tools/config/tsconfig.types.json && tsc-alias -p tools/config/tsconfig.types.json",
|
|
18
|
-
|
|
19
16
|
"tool:clean": "node tools/cleanup.js",
|
|
20
17
|
"tool:fixbuild": "node tools/fixup.js",
|
|
21
|
-
|
|
22
18
|
"lint": "eslint .",
|
|
23
19
|
"lint:fix": "npm run lint -- --fix",
|
|
24
|
-
|
|
25
20
|
"test": "node -v",
|
|
26
|
-
|
|
27
21
|
"prepublishOnly": "npm run build",
|
|
28
22
|
"prepare": "npm run build"
|
|
29
23
|
},
|