lavalink-client 2.9.2 → 2.9.4
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 → index.d.cts} +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +49 -14
- package/dist/index.mjs +42 -7
- package/package.json +7 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { EventEmitter } from 'events';
|
|
2
|
-
import { ReadableStream } from 'stream/web';
|
|
1
|
+
import { EventEmitter } from 'node:events';
|
|
2
|
+
import { ReadableStream } from 'node:stream/web';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Debug events for more detailed logging
|
|
@@ -803,6 +803,8 @@ interface LavalinkPlayerVoice {
|
|
|
803
803
|
endpoint: string;
|
|
804
804
|
/** The Voice SessionId */
|
|
805
805
|
sessionId: string;
|
|
806
|
+
/** The Voice Channel Id */
|
|
807
|
+
channelId?: string;
|
|
806
808
|
/** Whether or not the player is connected */
|
|
807
809
|
connected?: boolean;
|
|
808
810
|
/** The Ping to the voice server */
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { EventEmitter } from 'events';
|
|
2
|
-
import { ReadableStream } from 'stream/web';
|
|
1
|
+
import { EventEmitter } from 'node:events';
|
|
2
|
+
import { ReadableStream } from 'node:stream/web';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Debug events for more detailed logging
|
|
@@ -803,6 +803,8 @@ interface LavalinkPlayerVoice {
|
|
|
803
803
|
endpoint: string;
|
|
804
804
|
/** The Voice SessionId */
|
|
805
805
|
sessionId: string;
|
|
806
|
+
/** The Voice Channel Id */
|
|
807
|
+
channelId?: string;
|
|
806
808
|
/** Whether or not the player is connected */
|
|
807
809
|
connected?: boolean;
|
|
808
810
|
/** The Ping to the voice server */
|
package/dist/index.js
CHANGED
|
@@ -63,7 +63,7 @@ __export(index_exports, {
|
|
|
63
63
|
module.exports = __toCommonJS(index_exports);
|
|
64
64
|
|
|
65
65
|
// src/structures/LavalinkManager.ts
|
|
66
|
-
var
|
|
66
|
+
var import_node_events2 = require("events");
|
|
67
67
|
|
|
68
68
|
// src/structures/Constants.ts
|
|
69
69
|
var DebugEvents = /* @__PURE__ */ ((DebugEvents2) => {
|
|
@@ -404,11 +404,11 @@ var NodeLinkExclusiveEvents = [
|
|
|
404
404
|
];
|
|
405
405
|
|
|
406
406
|
// src/structures/NodeManager.ts
|
|
407
|
-
var
|
|
407
|
+
var import_node_events = require("events");
|
|
408
408
|
|
|
409
409
|
// src/structures/Node.ts
|
|
410
|
-
var
|
|
411
|
-
var import_ws = __toESM(require("ws"));
|
|
410
|
+
var import_node_path = require("path");
|
|
411
|
+
var import_ws = __toESM(require("ws"), 1);
|
|
412
412
|
|
|
413
413
|
// src/structures/Types/Node.ts
|
|
414
414
|
var ReconnectionState = /* @__PURE__ */ ((ReconnectionState2) => {
|
|
@@ -2623,7 +2623,7 @@ var LavalinkNode = class _LavalinkNode {
|
|
|
2623
2623
|
player.connected = payload.state.connected;
|
|
2624
2624
|
player.ping.ws = payload.state.ping >= 0 ? payload.state.ping : player.ping.ws <= 0 && player.connected ? null : player.ping.ws || 0;
|
|
2625
2625
|
if (!player.createdTimeStamp && payload.state.time) player.createdTimeStamp = payload.state.time;
|
|
2626
|
-
if (player.filterManager.filterUpdatedState === true && ((player.queue.current?.info?.duration || 0) <= (player.LavalinkManager.options.advancedOptions.maxFilterFixDuration || 6e5) || player.queue.current?.info?.uri && (0,
|
|
2626
|
+
if (player.filterManager.filterUpdatedState === true && ((player.queue.current?.info?.duration || 0) <= (player.LavalinkManager.options.advancedOptions.maxFilterFixDuration || 6e5) || player.queue.current?.info?.uri && (0, import_node_path.isAbsolute)(player.queue.current?.info?.uri))) {
|
|
2627
2627
|
player.filterManager.filterUpdatedState = false;
|
|
2628
2628
|
this._emitDebugEvent("PlayerUpdateFilterFixApply" /* PlayerUpdateFilterFixApply */, {
|
|
2629
2629
|
state: "log",
|
|
@@ -3428,7 +3428,7 @@ var NodeLinkNode = class extends LavalinkNode {
|
|
|
3428
3428
|
LavalinkNode._NodeLinkClass = NodeLinkNode;
|
|
3429
3429
|
|
|
3430
3430
|
// src/structures/NodeManager.ts
|
|
3431
|
-
var NodeManager = class extends
|
|
3431
|
+
var NodeManager = class extends import_node_events.EventEmitter {
|
|
3432
3432
|
/**
|
|
3433
3433
|
* Emit an event
|
|
3434
3434
|
* @param event The event to emit
|
|
@@ -5302,7 +5302,8 @@ var Player = class {
|
|
|
5302
5302
|
voice = {
|
|
5303
5303
|
endpoint: null,
|
|
5304
5304
|
sessionId: null,
|
|
5305
|
-
token: null
|
|
5305
|
+
token: null,
|
|
5306
|
+
channelId: void 0
|
|
5306
5307
|
};
|
|
5307
5308
|
voiceState = {
|
|
5308
5309
|
selfDeaf: false,
|
|
@@ -6030,7 +6031,8 @@ var Player = class {
|
|
|
6030
6031
|
voice: {
|
|
6031
6032
|
token: this.voice.token,
|
|
6032
6033
|
endpoint: this.voice.endpoint,
|
|
6033
|
-
sessionId: this.voice.sessionId
|
|
6034
|
+
sessionId: this.voice.sessionId,
|
|
6035
|
+
channelId: this.voice.channelId
|
|
6034
6036
|
}
|
|
6035
6037
|
}
|
|
6036
6038
|
});
|
|
@@ -6108,7 +6110,7 @@ var Player = class {
|
|
|
6108
6110
|
};
|
|
6109
6111
|
|
|
6110
6112
|
// src/structures/LavalinkManager.ts
|
|
6111
|
-
var LavalinkManager = class extends
|
|
6113
|
+
var LavalinkManager = class extends import_node_events2.EventEmitter {
|
|
6112
6114
|
/**
|
|
6113
6115
|
* Emit an event
|
|
6114
6116
|
* @param event The event to emit
|
|
@@ -6596,17 +6598,43 @@ var LavalinkManager = class extends import_events2.EventEmitter {
|
|
|
6596
6598
|
if ("token" in update) {
|
|
6597
6599
|
if (!player.node?.sessionId) throw new Error("Lavalink Node is either not ready or not up to date");
|
|
6598
6600
|
const sessionId2Use = player.voice?.sessionId || ("sessionId" in update ? update.sessionId : void 0);
|
|
6601
|
+
const channelId2Use = player.voice?.channelId || ("channel_id" in update ? update.channel_id : void 0);
|
|
6599
6602
|
if (!sessionId2Use) {
|
|
6600
6603
|
this.emit("debug", "NoAudioDebug" /* NoAudioDebug */, {
|
|
6601
6604
|
state: "error",
|
|
6602
|
-
message: `Can't send updatePlayer for voice token session - Missing sessionId :: ${safeStringify({ voice: { token: update.token, endpoint: update.endpoint, sessionId: sessionId2Use }, update, playerVoice: player.voice }, 2)}`,
|
|
6605
|
+
message: `Can't send updatePlayer for voice token session - Missing sessionId :: ${safeStringify({ voice: { token: update.token, endpoint: update.endpoint, sessionId: sessionId2Use, channelId: channelId2Use }, update, playerVoice: player.voice }, 2)}`,
|
|
6603
6606
|
functionLayer: "LavalinkManager > sendRawData()"
|
|
6604
6607
|
});
|
|
6605
6608
|
if (this.options?.advancedOptions?.debugOptions?.noAudio === true)
|
|
6606
6609
|
console.debug(
|
|
6607
6610
|
"Lavalink-Client-Debug | NO-AUDIO [::] sendRawData function, Can't send updatePlayer for voice token session - Missing sessionId",
|
|
6608
6611
|
{
|
|
6609
|
-
voice: {
|
|
6612
|
+
voice: {
|
|
6613
|
+
token: update.token,
|
|
6614
|
+
endpoint: update.endpoint,
|
|
6615
|
+
sessionId: sessionId2Use,
|
|
6616
|
+
channelId: channelId2Use
|
|
6617
|
+
},
|
|
6618
|
+
update,
|
|
6619
|
+
playerVoice: player.voice
|
|
6620
|
+
}
|
|
6621
|
+
);
|
|
6622
|
+
} else if (!channelId2Use) {
|
|
6623
|
+
this.emit("debug", "NoAudioDebug" /* NoAudioDebug */, {
|
|
6624
|
+
state: "error",
|
|
6625
|
+
message: `Can't send updatePlayer for voice token session - Missing channelId :: ${safeStringify({ voice: { token: update.token, endpoint: update.endpoint, sessionId: sessionId2Use, channelId: channelId2Use }, update, playerVoice: player.voice }, 2)}`,
|
|
6626
|
+
functionLayer: "LavalinkManager > sendRawData()"
|
|
6627
|
+
});
|
|
6628
|
+
if (this.options?.advancedOptions?.debugOptions?.noAudio === true)
|
|
6629
|
+
console.debug(
|
|
6630
|
+
"Lavalink-Client-Debug | NO-AUDIO [::] sendRawData function, Can't send updatePlayer for voice token session - Missing channelId",
|
|
6631
|
+
{
|
|
6632
|
+
voice: {
|
|
6633
|
+
token: update.token,
|
|
6634
|
+
endpoint: update.endpoint,
|
|
6635
|
+
sessionId: sessionId2Use,
|
|
6636
|
+
channelId: channelId2Use
|
|
6637
|
+
},
|
|
6610
6638
|
update,
|
|
6611
6639
|
playerVoice: player.voice
|
|
6612
6640
|
}
|
|
@@ -6618,20 +6646,26 @@ var LavalinkManager = class extends import_events2.EventEmitter {
|
|
|
6618
6646
|
voice: {
|
|
6619
6647
|
token: update.token,
|
|
6620
6648
|
endpoint: update.endpoint,
|
|
6621
|
-
sessionId: sessionId2Use
|
|
6649
|
+
sessionId: sessionId2Use,
|
|
6650
|
+
channelId: channelId2Use
|
|
6622
6651
|
}
|
|
6623
6652
|
}
|
|
6624
6653
|
});
|
|
6625
6654
|
this._emitDebugEvent("NoAudioDebug" /* NoAudioDebug */, {
|
|
6626
6655
|
state: "log",
|
|
6627
|
-
message: `Sent updatePlayer for voice token session :: ${safeStringify({ voice: { token: update.token, endpoint: update.endpoint, sessionId: sessionId2Use }, update, playerVoice: player.voice }, 2)}`,
|
|
6656
|
+
message: `Sent updatePlayer for voice token session :: ${safeStringify({ voice: { token: update.token, endpoint: update.endpoint, sessionId: sessionId2Use, channelId: channelId2Use }, update, playerVoice: player.voice }, 2)}`,
|
|
6628
6657
|
functionLayer: "LavalinkManager > sendRawData()"
|
|
6629
6658
|
});
|
|
6630
6659
|
if (this.options?.advancedOptions?.debugOptions?.noAudio === true)
|
|
6631
6660
|
console.debug(
|
|
6632
6661
|
"Lavalink-Client-Debug | NO-AUDIO [::] sendRawData function, Sent updatePlayer for voice token session",
|
|
6633
6662
|
{
|
|
6634
|
-
voice: {
|
|
6663
|
+
voice: {
|
|
6664
|
+
token: update.token,
|
|
6665
|
+
endpoint: update.endpoint,
|
|
6666
|
+
sessionId: sessionId2Use,
|
|
6667
|
+
channelId: channelId2Use
|
|
6668
|
+
},
|
|
6635
6669
|
playerVoice: player.voice,
|
|
6636
6670
|
update
|
|
6637
6671
|
}
|
|
@@ -6666,6 +6700,7 @@ var LavalinkManager = class extends import_events2.EventEmitter {
|
|
|
6666
6700
|
if (player.voiceChannelId !== update.channel_id)
|
|
6667
6701
|
this.emit("playerMove", player, player.voiceChannelId, update.channel_id);
|
|
6668
6702
|
player.voice.sessionId = update.session_id || player.voice.sessionId;
|
|
6703
|
+
player.voice.channelId = update.channel_id;
|
|
6669
6704
|
if (!player.voice.sessionId) {
|
|
6670
6705
|
this._emitDebugEvent("NoAudioDebug" /* NoAudioDebug */, {
|
|
6671
6706
|
state: "warn",
|
package/dist/index.mjs
CHANGED
|
@@ -5238,7 +5238,8 @@ var Player = class {
|
|
|
5238
5238
|
voice = {
|
|
5239
5239
|
endpoint: null,
|
|
5240
5240
|
sessionId: null,
|
|
5241
|
-
token: null
|
|
5241
|
+
token: null,
|
|
5242
|
+
channelId: void 0
|
|
5242
5243
|
};
|
|
5243
5244
|
voiceState = {
|
|
5244
5245
|
selfDeaf: false,
|
|
@@ -5966,7 +5967,8 @@ var Player = class {
|
|
|
5966
5967
|
voice: {
|
|
5967
5968
|
token: this.voice.token,
|
|
5968
5969
|
endpoint: this.voice.endpoint,
|
|
5969
|
-
sessionId: this.voice.sessionId
|
|
5970
|
+
sessionId: this.voice.sessionId,
|
|
5971
|
+
channelId: this.voice.channelId
|
|
5970
5972
|
}
|
|
5971
5973
|
}
|
|
5972
5974
|
});
|
|
@@ -6532,17 +6534,43 @@ var LavalinkManager = class extends EventEmitter2 {
|
|
|
6532
6534
|
if ("token" in update) {
|
|
6533
6535
|
if (!player.node?.sessionId) throw new Error("Lavalink Node is either not ready or not up to date");
|
|
6534
6536
|
const sessionId2Use = player.voice?.sessionId || ("sessionId" in update ? update.sessionId : void 0);
|
|
6537
|
+
const channelId2Use = player.voice?.channelId || ("channel_id" in update ? update.channel_id : void 0);
|
|
6535
6538
|
if (!sessionId2Use) {
|
|
6536
6539
|
this.emit("debug", "NoAudioDebug" /* NoAudioDebug */, {
|
|
6537
6540
|
state: "error",
|
|
6538
|
-
message: `Can't send updatePlayer for voice token session - Missing sessionId :: ${safeStringify({ voice: { token: update.token, endpoint: update.endpoint, sessionId: sessionId2Use }, update, playerVoice: player.voice }, 2)}`,
|
|
6541
|
+
message: `Can't send updatePlayer for voice token session - Missing sessionId :: ${safeStringify({ voice: { token: update.token, endpoint: update.endpoint, sessionId: sessionId2Use, channelId: channelId2Use }, update, playerVoice: player.voice }, 2)}`,
|
|
6539
6542
|
functionLayer: "LavalinkManager > sendRawData()"
|
|
6540
6543
|
});
|
|
6541
6544
|
if (this.options?.advancedOptions?.debugOptions?.noAudio === true)
|
|
6542
6545
|
console.debug(
|
|
6543
6546
|
"Lavalink-Client-Debug | NO-AUDIO [::] sendRawData function, Can't send updatePlayer for voice token session - Missing sessionId",
|
|
6544
6547
|
{
|
|
6545
|
-
voice: {
|
|
6548
|
+
voice: {
|
|
6549
|
+
token: update.token,
|
|
6550
|
+
endpoint: update.endpoint,
|
|
6551
|
+
sessionId: sessionId2Use,
|
|
6552
|
+
channelId: channelId2Use
|
|
6553
|
+
},
|
|
6554
|
+
update,
|
|
6555
|
+
playerVoice: player.voice
|
|
6556
|
+
}
|
|
6557
|
+
);
|
|
6558
|
+
} else if (!channelId2Use) {
|
|
6559
|
+
this.emit("debug", "NoAudioDebug" /* NoAudioDebug */, {
|
|
6560
|
+
state: "error",
|
|
6561
|
+
message: `Can't send updatePlayer for voice token session - Missing channelId :: ${safeStringify({ voice: { token: update.token, endpoint: update.endpoint, sessionId: sessionId2Use, channelId: channelId2Use }, update, playerVoice: player.voice }, 2)}`,
|
|
6562
|
+
functionLayer: "LavalinkManager > sendRawData()"
|
|
6563
|
+
});
|
|
6564
|
+
if (this.options?.advancedOptions?.debugOptions?.noAudio === true)
|
|
6565
|
+
console.debug(
|
|
6566
|
+
"Lavalink-Client-Debug | NO-AUDIO [::] sendRawData function, Can't send updatePlayer for voice token session - Missing channelId",
|
|
6567
|
+
{
|
|
6568
|
+
voice: {
|
|
6569
|
+
token: update.token,
|
|
6570
|
+
endpoint: update.endpoint,
|
|
6571
|
+
sessionId: sessionId2Use,
|
|
6572
|
+
channelId: channelId2Use
|
|
6573
|
+
},
|
|
6546
6574
|
update,
|
|
6547
6575
|
playerVoice: player.voice
|
|
6548
6576
|
}
|
|
@@ -6554,20 +6582,26 @@ var LavalinkManager = class extends EventEmitter2 {
|
|
|
6554
6582
|
voice: {
|
|
6555
6583
|
token: update.token,
|
|
6556
6584
|
endpoint: update.endpoint,
|
|
6557
|
-
sessionId: sessionId2Use
|
|
6585
|
+
sessionId: sessionId2Use,
|
|
6586
|
+
channelId: channelId2Use
|
|
6558
6587
|
}
|
|
6559
6588
|
}
|
|
6560
6589
|
});
|
|
6561
6590
|
this._emitDebugEvent("NoAudioDebug" /* NoAudioDebug */, {
|
|
6562
6591
|
state: "log",
|
|
6563
|
-
message: `Sent updatePlayer for voice token session :: ${safeStringify({ voice: { token: update.token, endpoint: update.endpoint, sessionId: sessionId2Use }, update, playerVoice: player.voice }, 2)}`,
|
|
6592
|
+
message: `Sent updatePlayer for voice token session :: ${safeStringify({ voice: { token: update.token, endpoint: update.endpoint, sessionId: sessionId2Use, channelId: channelId2Use }, update, playerVoice: player.voice }, 2)}`,
|
|
6564
6593
|
functionLayer: "LavalinkManager > sendRawData()"
|
|
6565
6594
|
});
|
|
6566
6595
|
if (this.options?.advancedOptions?.debugOptions?.noAudio === true)
|
|
6567
6596
|
console.debug(
|
|
6568
6597
|
"Lavalink-Client-Debug | NO-AUDIO [::] sendRawData function, Sent updatePlayer for voice token session",
|
|
6569
6598
|
{
|
|
6570
|
-
voice: {
|
|
6599
|
+
voice: {
|
|
6600
|
+
token: update.token,
|
|
6601
|
+
endpoint: update.endpoint,
|
|
6602
|
+
sessionId: sessionId2Use,
|
|
6603
|
+
channelId: channelId2Use
|
|
6604
|
+
},
|
|
6571
6605
|
playerVoice: player.voice,
|
|
6572
6606
|
update
|
|
6573
6607
|
}
|
|
@@ -6602,6 +6636,7 @@ var LavalinkManager = class extends EventEmitter2 {
|
|
|
6602
6636
|
if (player.voiceChannelId !== update.channel_id)
|
|
6603
6637
|
this.emit("playerMove", player, player.voiceChannelId, update.channel_id);
|
|
6604
6638
|
player.voice.sessionId = update.session_id || player.voice.sessionId;
|
|
6639
|
+
player.voice.channelId = update.channel_id;
|
|
6605
6640
|
if (!player.voice.sessionId) {
|
|
6606
6641
|
this._emitDebugEvent("NoAudioDebug" /* NoAudioDebug */, {
|
|
6607
6642
|
state: "warn",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lavalink-client",
|
|
3
|
-
"version": "2.9.
|
|
3
|
+
"version": "2.9.4",
|
|
4
4
|
"description": "Easy, flexible and feature-rich lavalink@v4 Client. Both for Beginners and Proficients. - Supports NodeLink@v3 too.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"advanced",
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"files": [
|
|
33
33
|
"dist"
|
|
34
34
|
],
|
|
35
|
+
"type": "module",
|
|
35
36
|
"main": "./dist/index.js",
|
|
36
37
|
"module": "./dist/index.mjs",
|
|
37
38
|
"types": "./dist/index.d.ts",
|
|
@@ -57,13 +58,14 @@
|
|
|
57
58
|
},
|
|
58
59
|
"dependencies": {
|
|
59
60
|
"tslib": "^2.8.1",
|
|
60
|
-
"ws": "^8.
|
|
61
|
+
"ws": "^8.19.0"
|
|
61
62
|
},
|
|
62
63
|
"devDependencies": {
|
|
63
|
-
"@types/
|
|
64
|
+
"@types/bun": "latest",
|
|
65
|
+
"@types/node": "^24.10.15",
|
|
64
66
|
"@types/ws": "^8.18.1",
|
|
65
67
|
"oxfmt": "^0.28.0",
|
|
66
|
-
"oxlint": "^1.
|
|
68
|
+
"oxlint": "^1.50.0",
|
|
67
69
|
"tsup": "^8.5.1",
|
|
68
70
|
"typescript": "^5.9.3"
|
|
69
71
|
},
|
|
@@ -71,6 +73,7 @@
|
|
|
71
73
|
"bun": ">=1.1.27",
|
|
72
74
|
"node": ">=18.0.0"
|
|
73
75
|
},
|
|
76
|
+
"packageManager": "bun@1.3.9",
|
|
74
77
|
"pnpm": {
|
|
75
78
|
"onlyBuiltDependencies": [
|
|
76
79
|
"esbuild"
|