lavalink-client 2.7.0 → 2.7.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.
- package/README.md +3 -4
- package/dist/index.d.mts +12 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +65 -31
- package/dist/index.mjs +65 -31
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -119,8 +119,10 @@ This client powers various Discord bots:
|
|
|
119
119
|
- [iHorizon](https://github.com/ihrz/ihrz) (@iHorizon)
|
|
120
120
|
- **Bots Community (Users):**
|
|
121
121
|
- [Soundy](https://github.com/idMJA/Soundy) (@idMJA)
|
|
122
|
-
- [BeatBot
|
|
122
|
+
- [BeatBot](https://getbeatbot.vercel.app/) (@zenitsujs)
|
|
123
123
|
- [Atom Music](https://top.gg/bot/1320469557411971165) (@sakshamyep)
|
|
124
|
+
- [All Time Bot](https://top.gg/bot/1163027457671180418) (@PeterGamez)
|
|
125
|
+
- [BeatDock](https://github.com/lazaroagomez/BeatDock) (@lazaroagomez)
|
|
124
126
|
|
|
125
127
|
***
|
|
126
128
|
|
|
@@ -461,6 +463,3 @@ if (response.tracks.length > 0) {
|
|
|
461
463
|
</details>
|
|
462
464
|
|
|
463
465
|
</div>
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
package/dist/index.d.mts
CHANGED
|
@@ -2595,6 +2595,18 @@ declare class LavalinkNode {
|
|
|
2595
2595
|
* ```
|
|
2596
2596
|
*/
|
|
2597
2597
|
private reconnect;
|
|
2598
|
+
/**
|
|
2599
|
+
* Private function to reset the reconnection attempts
|
|
2600
|
+
* @returns
|
|
2601
|
+
*/
|
|
2602
|
+
private resetReconnectionAttempts;
|
|
2603
|
+
/**
|
|
2604
|
+
* Private function to reset timeouts/intervals for heartbeating/pinging
|
|
2605
|
+
* @param heartbeat
|
|
2606
|
+
* @param ping
|
|
2607
|
+
* @returns
|
|
2608
|
+
*/
|
|
2609
|
+
private resetAckTimeouts;
|
|
2598
2610
|
/** @private util function for handling opening events from websocket */
|
|
2599
2611
|
private open;
|
|
2600
2612
|
/** @private util function for handling closing events from websocket */
|
package/dist/index.d.ts
CHANGED
|
@@ -2595,6 +2595,18 @@ declare class LavalinkNode {
|
|
|
2595
2595
|
* ```
|
|
2596
2596
|
*/
|
|
2597
2597
|
private reconnect;
|
|
2598
|
+
/**
|
|
2599
|
+
* Private function to reset the reconnection attempts
|
|
2600
|
+
* @returns
|
|
2601
|
+
*/
|
|
2602
|
+
private resetReconnectionAttempts;
|
|
2603
|
+
/**
|
|
2604
|
+
* Private function to reset timeouts/intervals for heartbeating/pinging
|
|
2605
|
+
* @param heartbeat
|
|
2606
|
+
* @param ping
|
|
2607
|
+
* @returns
|
|
2608
|
+
*/
|
|
2609
|
+
private resetAckTimeouts;
|
|
2598
2610
|
/** @private util function for handling opening events from websocket */
|
|
2599
2611
|
private open;
|
|
2600
2612
|
/** @private util function for handling closing events from websocket */
|
package/dist/index.js
CHANGED
|
@@ -1354,7 +1354,7 @@ var LavalinkNode = class {
|
|
|
1354
1354
|
functionLayer: "LavalinkNode > nodeEvent > stats > heartBeat()"
|
|
1355
1355
|
});
|
|
1356
1356
|
}
|
|
1357
|
-
|
|
1357
|
+
this.resetAckTimeouts(false, true);
|
|
1358
1358
|
this.pingTimeout = setTimeout(() => {
|
|
1359
1359
|
this.pingTimeout = null;
|
|
1360
1360
|
if (!this.socket) {
|
|
@@ -1450,13 +1450,11 @@ var LavalinkNode = class {
|
|
|
1450
1450
|
this.socket?.close(1e3, "Node-Destroy");
|
|
1451
1451
|
this.socket?.removeAllListeners();
|
|
1452
1452
|
this.socket = null;
|
|
1453
|
-
this.
|
|
1454
|
-
clearTimeout(this.reconnectTimeout);
|
|
1453
|
+
this.resetReconnectionAttempts();
|
|
1455
1454
|
if (deleteNode) {
|
|
1456
1455
|
this.NodeManager.emit("destroy", this, destroyReason);
|
|
1457
1456
|
this.NodeManager.nodes.delete(this.id);
|
|
1458
|
-
|
|
1459
|
-
clearTimeout(this.pingTimeout);
|
|
1457
|
+
this.resetAckTimeouts(true, true);
|
|
1460
1458
|
} else {
|
|
1461
1459
|
this.NodeManager.emit("disconnect", this, { code: 1e3, reason: destroyReason });
|
|
1462
1460
|
}
|
|
@@ -1465,13 +1463,11 @@ var LavalinkNode = class {
|
|
|
1465
1463
|
this.socket?.close(1e3, "Node-Destroy");
|
|
1466
1464
|
this.socket?.removeAllListeners();
|
|
1467
1465
|
this.socket = null;
|
|
1468
|
-
this.
|
|
1469
|
-
clearTimeout(this.reconnectTimeout);
|
|
1466
|
+
this.resetReconnectionAttempts();
|
|
1470
1467
|
if (deleteNode) {
|
|
1471
1468
|
this.NodeManager.emit("destroy", this, destroyReason);
|
|
1472
1469
|
this.NodeManager.nodes.delete(this.id);
|
|
1473
|
-
|
|
1474
|
-
clearTimeout(this.pingTimeout);
|
|
1470
|
+
this.resetAckTimeouts(true, true);
|
|
1475
1471
|
} else {
|
|
1476
1472
|
this.NodeManager.emit("disconnect", this, { code: 1e3, reason: destroyReason });
|
|
1477
1473
|
}
|
|
@@ -1495,8 +1491,7 @@ var LavalinkNode = class {
|
|
|
1495
1491
|
this.socket?.close(1e3, "Node-Disconnect");
|
|
1496
1492
|
this.socket?.removeAllListeners();
|
|
1497
1493
|
this.socket = null;
|
|
1498
|
-
this.
|
|
1499
|
-
clearTimeout(this.reconnectTimeout);
|
|
1494
|
+
this.resetReconnectionAttempts();
|
|
1500
1495
|
this.NodeManager.emit("disconnect", this, { code: 1e3, reason: disconnectReason });
|
|
1501
1496
|
}
|
|
1502
1497
|
/**
|
|
@@ -1901,11 +1896,37 @@ var LavalinkNode = class {
|
|
|
1901
1896
|
this.reconnectAttempts++;
|
|
1902
1897
|
}, this.options.retryDelay || 1e3);
|
|
1903
1898
|
}
|
|
1899
|
+
/**
|
|
1900
|
+
* Private function to reset the reconnection attempts
|
|
1901
|
+
* @returns
|
|
1902
|
+
*/
|
|
1903
|
+
resetReconnectionAttempts() {
|
|
1904
|
+
this.reconnectAttempts = 1;
|
|
1905
|
+
clearTimeout(this.reconnectTimeout);
|
|
1906
|
+
this.reconnectTimeout = null;
|
|
1907
|
+
return;
|
|
1908
|
+
}
|
|
1909
|
+
/**
|
|
1910
|
+
* Private function to reset timeouts/intervals for heartbeating/pinging
|
|
1911
|
+
* @param heartbeat
|
|
1912
|
+
* @param ping
|
|
1913
|
+
* @returns
|
|
1914
|
+
*/
|
|
1915
|
+
resetAckTimeouts(heartbeat = true, ping = true) {
|
|
1916
|
+
if (ping) {
|
|
1917
|
+
if (this.pingTimeout) clearTimeout(this.pingTimeout);
|
|
1918
|
+
this.pingTimeout = null;
|
|
1919
|
+
}
|
|
1920
|
+
if (heartbeat) {
|
|
1921
|
+
if (this.heartBeatInterval) clearInterval(this.heartBeatInterval);
|
|
1922
|
+
this.heartBeatInterval = null;
|
|
1923
|
+
}
|
|
1924
|
+
return;
|
|
1925
|
+
}
|
|
1904
1926
|
/** @private util function for handling opening events from websocket */
|
|
1905
1927
|
async open() {
|
|
1906
1928
|
this.isAlive = true;
|
|
1907
|
-
this.
|
|
1908
|
-
if (this.reconnectTimeout) clearTimeout(this.reconnectTimeout);
|
|
1929
|
+
this.resetReconnectionAttempts();
|
|
1909
1930
|
if (this.options.enablePingOnStatsCheck) this.heartBeat();
|
|
1910
1931
|
if (this.heartBeatInterval) clearInterval(this.heartBeatInterval);
|
|
1911
1932
|
if (this.options.heartBeatInterval > 0) {
|
|
@@ -1930,7 +1951,7 @@ var LavalinkNode = class {
|
|
|
1930
1951
|
}
|
|
1931
1952
|
/** @private util function for handling closing events from websocket */
|
|
1932
1953
|
close(code, reason) {
|
|
1933
|
-
|
|
1954
|
+
this.resetAckTimeouts(true, true);
|
|
1934
1955
|
try {
|
|
1935
1956
|
if (this.socket) {
|
|
1936
1957
|
this.socket.removeAllListeners();
|
|
@@ -1946,7 +1967,6 @@ var LavalinkNode = class {
|
|
|
1946
1967
|
}
|
|
1947
1968
|
}
|
|
1948
1969
|
this.isAlive = false;
|
|
1949
|
-
if (this.heartBeatInterval) clearInterval(this.heartBeatInterval);
|
|
1950
1970
|
if (code === 1006 && !reason) reason = "Socket got terminated due to no ping connection";
|
|
1951
1971
|
if (code === 1e3 && reason === "Node-Disconnect") return;
|
|
1952
1972
|
this.NodeManager.emit("disconnect", this, { code, reason });
|
|
@@ -2031,6 +2051,7 @@ var LavalinkNode = class {
|
|
|
2031
2051
|
this.handleEvent(payload);
|
|
2032
2052
|
break;
|
|
2033
2053
|
case "ready":
|
|
2054
|
+
this.resetReconnectionAttempts();
|
|
2034
2055
|
this.sessionId = payload.sessionId;
|
|
2035
2056
|
this.resuming.enabled = payload.resumed;
|
|
2036
2057
|
if (payload.resumed === true) {
|
|
@@ -2709,7 +2730,13 @@ var bandCampSearch = async (player, query, requestUser) => {
|
|
|
2709
2730
|
"Cookie": "$Version=1"
|
|
2710
2731
|
}
|
|
2711
2732
|
});
|
|
2712
|
-
|
|
2733
|
+
if (!data.ok) throw new Error(`Bandcamp Error: ${data.statusText}`);
|
|
2734
|
+
let json = null;
|
|
2735
|
+
try {
|
|
2736
|
+
json = await data.json();
|
|
2737
|
+
} catch {
|
|
2738
|
+
throw new Error("Invalid JSON response from Bandcamp");
|
|
2739
|
+
}
|
|
2713
2740
|
tracks = json?.results?.filter((x) => !!x && typeof x === "object" && "type" in x && x.type === "t").map?.((item) => player.LavalinkManager.utils.buildUnresolvedTrack({
|
|
2714
2741
|
uri: item.url || item.uri,
|
|
2715
2742
|
artworkUrl: item.img,
|
|
@@ -2924,15 +2951,15 @@ var FilterManager = class {
|
|
|
2924
2951
|
const lavalinkFilterData = this.data.pluginFilters?.["lavalink-filter-plugin"] || { echo: { decay: this.data.pluginFilters?.echo?.decay && !this.data.pluginFilters?.echo?.echoLength ? this.data.pluginFilters.echo.decay : 0, delay: this.data.pluginFilters?.echo?.delay || 0 }, reverb: { gains: [], delays: [], ...this.data.pluginFilters.reverb } };
|
|
2925
2952
|
this.filters.lavalinkFilterPlugin.echo = lavalinkFilterData.echo.decay !== 0 || lavalinkFilterData.echo.delay !== 0;
|
|
2926
2953
|
this.filters.lavalinkFilterPlugin.reverb = lavalinkFilterData.reverb?.delays?.length !== 0 || lavalinkFilterData.reverb?.gains?.length !== 0;
|
|
2927
|
-
this.filters.lavalinkLavaDspxPlugin.highPass = Object.values(this.data.pluginFilters["high-pass"] || {}).length > 0;
|
|
2928
|
-
this.filters.lavalinkLavaDspxPlugin.lowPass = Object.values(this.data.pluginFilters["low-pass"] || {}).length > 0;
|
|
2929
|
-
this.filters.lavalinkLavaDspxPlugin.normalization = Object.values(this.data.pluginFilters
|
|
2930
|
-
this.filters.lavalinkLavaDspxPlugin.echo = Object.values(this.data.pluginFilters
|
|
2931
|
-
this.filters.lowPass = this.data.lowPass
|
|
2932
|
-
this.filters.karaoke = Object.values(this.data.karaoke).some((v) => v !== 0);
|
|
2954
|
+
this.filters.lavalinkLavaDspxPlugin.highPass = Object.values(this.data.pluginFilters?.["high-pass"] || {}).length > 0;
|
|
2955
|
+
this.filters.lavalinkLavaDspxPlugin.lowPass = Object.values(this.data.pluginFilters?.["low-pass"] || {}).length > 0;
|
|
2956
|
+
this.filters.lavalinkLavaDspxPlugin.normalization = Object.values(this.data.pluginFilters?.normalization || {}).length > 0;
|
|
2957
|
+
this.filters.lavalinkLavaDspxPlugin.echo = Object.values(this.data.pluginFilters?.echo || {}).length > 0 && typeof this.data.pluginFilters?.echo?.delay === "undefined";
|
|
2958
|
+
this.filters.lowPass = this.privateNot0(this.data.lowPass?.smoothing);
|
|
2959
|
+
this.filters.karaoke = Object.values(this.data.karaoke ?? {}).some((v) => v !== 0);
|
|
2933
2960
|
if ((this.filters.nightcore || this.filters.vaporwave) && oldFilterTimescale) {
|
|
2934
|
-
if (oldFilterTimescale.pitch !== this.data.timescale
|
|
2935
|
-
this.filters.custom = Object.values(this.data.timescale).some((v) => v !== 1);
|
|
2961
|
+
if (oldFilterTimescale.pitch !== this.data.timescale?.pitch || oldFilterTimescale.rate !== this.data.timescale?.rate || oldFilterTimescale.speed !== this.data.timescale?.speed) {
|
|
2962
|
+
this.filters.custom = Object.values(this.data.timescale || {}).some((v) => v !== 1);
|
|
2936
2963
|
this.filters.nightcore = false;
|
|
2937
2964
|
this.filters.vaporwave = false;
|
|
2938
2965
|
}
|
|
@@ -3745,8 +3772,11 @@ var Queue = class {
|
|
|
3745
3772
|
this.queueChanges.tracksAdd(this.guildId, (Array.isArray(TrackOrTracks) ? TrackOrTracks : [TrackOrTracks]).flat(2).filter((v) => this.managerUtils.isTrack(v) || this.managerUtils.isUnresolvedTrack(v)), index, oldStored, this.utils.toJSON());
|
|
3746
3773
|
} catch {
|
|
3747
3774
|
}
|
|
3748
|
-
|
|
3749
|
-
|
|
3775
|
+
const spliced = TrackOrTracks ? this.tracks.splice(
|
|
3776
|
+
index,
|
|
3777
|
+
amount,
|
|
3778
|
+
...(Array.isArray(TrackOrTracks) ? TrackOrTracks : [TrackOrTracks]).flat(2).filter((v) => this.managerUtils.isTrack(v) || this.managerUtils.isUnresolvedTrack(v))
|
|
3779
|
+
) : this.tracks.splice(index, amount);
|
|
3750
3780
|
if (typeof this.queueChanges?.tracksRemoved === "function") try {
|
|
3751
3781
|
this.queueChanges.tracksRemoved(this.guildId, spliced, index, oldStored, this.utils.toJSON());
|
|
3752
3782
|
} catch {
|
|
@@ -4311,6 +4341,7 @@ var Player = class {
|
|
|
4311
4341
|
else this.set("internal_autoplayStopPlaying", void 0);
|
|
4312
4342
|
const now = performance.now();
|
|
4313
4343
|
await this.node.updatePlayer({ guildId: this.guildId, playerOptions: { track: { encoded: null } } });
|
|
4344
|
+
this.paused = false;
|
|
4314
4345
|
this.ping.lavalink = Math.round((performance.now() - now) / 10) / 100;
|
|
4315
4346
|
return this;
|
|
4316
4347
|
}
|
|
@@ -5113,6 +5144,7 @@ var LavalinkManager = class extends import_events2.EventEmitter {
|
|
|
5113
5144
|
if (this.options?.advancedOptions?.debugOptions?.noAudio === true) console.debug(`Lavalink-Client-Debug | NO-AUDIO [::] sendRawData function, Function to assing sessionId provided, but no found in Payload: ${safeStringify(update, 2)}`);
|
|
5114
5145
|
}
|
|
5115
5146
|
player.voiceChannelId = update.channel_id;
|
|
5147
|
+
player.options.voiceChannelId = update.channel_id;
|
|
5116
5148
|
const selfMuteChanged = typeof update.self_mute === "boolean" && player.voiceState.selfMute !== update.self_mute;
|
|
5117
5149
|
const serverMuteChanged = typeof update.mute === "boolean" && player.voiceState.serverMute !== update.mute;
|
|
5118
5150
|
const selfDeafChanged = typeof update.self_deaf === "boolean" && player.voiceState.selfDeaf !== update.self_deaf;
|
|
@@ -5155,11 +5187,13 @@ var LavalinkManager = class extends import_events2.EventEmitter {
|
|
|
5155
5187
|
if (player.queue.tracks.length) {
|
|
5156
5188
|
return void await player.play({ paused: previousPaused });
|
|
5157
5189
|
}
|
|
5158
|
-
this.
|
|
5159
|
-
|
|
5160
|
-
|
|
5161
|
-
|
|
5162
|
-
|
|
5190
|
+
if (this.options?.advancedOptions?.enableDebugEvents) {
|
|
5191
|
+
this.emit("debug", "PlayerAutoReconnect" /* PlayerAutoReconnect */, {
|
|
5192
|
+
state: "log",
|
|
5193
|
+
message: `Auto reconnected, but nothing to play`,
|
|
5194
|
+
functionLayer: "LavalinkManager > sendRawData()"
|
|
5195
|
+
});
|
|
5196
|
+
}
|
|
5163
5197
|
return;
|
|
5164
5198
|
} catch (e) {
|
|
5165
5199
|
console.error(e);
|
package/dist/index.mjs
CHANGED
|
@@ -1294,7 +1294,7 @@ var LavalinkNode = class {
|
|
|
1294
1294
|
functionLayer: "LavalinkNode > nodeEvent > stats > heartBeat()"
|
|
1295
1295
|
});
|
|
1296
1296
|
}
|
|
1297
|
-
|
|
1297
|
+
this.resetAckTimeouts(false, true);
|
|
1298
1298
|
this.pingTimeout = setTimeout(() => {
|
|
1299
1299
|
this.pingTimeout = null;
|
|
1300
1300
|
if (!this.socket) {
|
|
@@ -1390,13 +1390,11 @@ var LavalinkNode = class {
|
|
|
1390
1390
|
this.socket?.close(1e3, "Node-Destroy");
|
|
1391
1391
|
this.socket?.removeAllListeners();
|
|
1392
1392
|
this.socket = null;
|
|
1393
|
-
this.
|
|
1394
|
-
clearTimeout(this.reconnectTimeout);
|
|
1393
|
+
this.resetReconnectionAttempts();
|
|
1395
1394
|
if (deleteNode) {
|
|
1396
1395
|
this.NodeManager.emit("destroy", this, destroyReason);
|
|
1397
1396
|
this.NodeManager.nodes.delete(this.id);
|
|
1398
|
-
|
|
1399
|
-
clearTimeout(this.pingTimeout);
|
|
1397
|
+
this.resetAckTimeouts(true, true);
|
|
1400
1398
|
} else {
|
|
1401
1399
|
this.NodeManager.emit("disconnect", this, { code: 1e3, reason: destroyReason });
|
|
1402
1400
|
}
|
|
@@ -1405,13 +1403,11 @@ var LavalinkNode = class {
|
|
|
1405
1403
|
this.socket?.close(1e3, "Node-Destroy");
|
|
1406
1404
|
this.socket?.removeAllListeners();
|
|
1407
1405
|
this.socket = null;
|
|
1408
|
-
this.
|
|
1409
|
-
clearTimeout(this.reconnectTimeout);
|
|
1406
|
+
this.resetReconnectionAttempts();
|
|
1410
1407
|
if (deleteNode) {
|
|
1411
1408
|
this.NodeManager.emit("destroy", this, destroyReason);
|
|
1412
1409
|
this.NodeManager.nodes.delete(this.id);
|
|
1413
|
-
|
|
1414
|
-
clearTimeout(this.pingTimeout);
|
|
1410
|
+
this.resetAckTimeouts(true, true);
|
|
1415
1411
|
} else {
|
|
1416
1412
|
this.NodeManager.emit("disconnect", this, { code: 1e3, reason: destroyReason });
|
|
1417
1413
|
}
|
|
@@ -1435,8 +1431,7 @@ var LavalinkNode = class {
|
|
|
1435
1431
|
this.socket?.close(1e3, "Node-Disconnect");
|
|
1436
1432
|
this.socket?.removeAllListeners();
|
|
1437
1433
|
this.socket = null;
|
|
1438
|
-
this.
|
|
1439
|
-
clearTimeout(this.reconnectTimeout);
|
|
1434
|
+
this.resetReconnectionAttempts();
|
|
1440
1435
|
this.NodeManager.emit("disconnect", this, { code: 1e3, reason: disconnectReason });
|
|
1441
1436
|
}
|
|
1442
1437
|
/**
|
|
@@ -1841,11 +1836,37 @@ var LavalinkNode = class {
|
|
|
1841
1836
|
this.reconnectAttempts++;
|
|
1842
1837
|
}, this.options.retryDelay || 1e3);
|
|
1843
1838
|
}
|
|
1839
|
+
/**
|
|
1840
|
+
* Private function to reset the reconnection attempts
|
|
1841
|
+
* @returns
|
|
1842
|
+
*/
|
|
1843
|
+
resetReconnectionAttempts() {
|
|
1844
|
+
this.reconnectAttempts = 1;
|
|
1845
|
+
clearTimeout(this.reconnectTimeout);
|
|
1846
|
+
this.reconnectTimeout = null;
|
|
1847
|
+
return;
|
|
1848
|
+
}
|
|
1849
|
+
/**
|
|
1850
|
+
* Private function to reset timeouts/intervals for heartbeating/pinging
|
|
1851
|
+
* @param heartbeat
|
|
1852
|
+
* @param ping
|
|
1853
|
+
* @returns
|
|
1854
|
+
*/
|
|
1855
|
+
resetAckTimeouts(heartbeat = true, ping = true) {
|
|
1856
|
+
if (ping) {
|
|
1857
|
+
if (this.pingTimeout) clearTimeout(this.pingTimeout);
|
|
1858
|
+
this.pingTimeout = null;
|
|
1859
|
+
}
|
|
1860
|
+
if (heartbeat) {
|
|
1861
|
+
if (this.heartBeatInterval) clearInterval(this.heartBeatInterval);
|
|
1862
|
+
this.heartBeatInterval = null;
|
|
1863
|
+
}
|
|
1864
|
+
return;
|
|
1865
|
+
}
|
|
1844
1866
|
/** @private util function for handling opening events from websocket */
|
|
1845
1867
|
async open() {
|
|
1846
1868
|
this.isAlive = true;
|
|
1847
|
-
this.
|
|
1848
|
-
if (this.reconnectTimeout) clearTimeout(this.reconnectTimeout);
|
|
1869
|
+
this.resetReconnectionAttempts();
|
|
1849
1870
|
if (this.options.enablePingOnStatsCheck) this.heartBeat();
|
|
1850
1871
|
if (this.heartBeatInterval) clearInterval(this.heartBeatInterval);
|
|
1851
1872
|
if (this.options.heartBeatInterval > 0) {
|
|
@@ -1870,7 +1891,7 @@ var LavalinkNode = class {
|
|
|
1870
1891
|
}
|
|
1871
1892
|
/** @private util function for handling closing events from websocket */
|
|
1872
1893
|
close(code, reason) {
|
|
1873
|
-
|
|
1894
|
+
this.resetAckTimeouts(true, true);
|
|
1874
1895
|
try {
|
|
1875
1896
|
if (this.socket) {
|
|
1876
1897
|
this.socket.removeAllListeners();
|
|
@@ -1886,7 +1907,6 @@ var LavalinkNode = class {
|
|
|
1886
1907
|
}
|
|
1887
1908
|
}
|
|
1888
1909
|
this.isAlive = false;
|
|
1889
|
-
if (this.heartBeatInterval) clearInterval(this.heartBeatInterval);
|
|
1890
1910
|
if (code === 1006 && !reason) reason = "Socket got terminated due to no ping connection";
|
|
1891
1911
|
if (code === 1e3 && reason === "Node-Disconnect") return;
|
|
1892
1912
|
this.NodeManager.emit("disconnect", this, { code, reason });
|
|
@@ -1971,6 +1991,7 @@ var LavalinkNode = class {
|
|
|
1971
1991
|
this.handleEvent(payload);
|
|
1972
1992
|
break;
|
|
1973
1993
|
case "ready":
|
|
1994
|
+
this.resetReconnectionAttempts();
|
|
1974
1995
|
this.sessionId = payload.sessionId;
|
|
1975
1996
|
this.resuming.enabled = payload.resumed;
|
|
1976
1997
|
if (payload.resumed === true) {
|
|
@@ -2649,7 +2670,13 @@ var bandCampSearch = async (player, query, requestUser) => {
|
|
|
2649
2670
|
"Cookie": "$Version=1"
|
|
2650
2671
|
}
|
|
2651
2672
|
});
|
|
2652
|
-
|
|
2673
|
+
if (!data.ok) throw new Error(`Bandcamp Error: ${data.statusText}`);
|
|
2674
|
+
let json = null;
|
|
2675
|
+
try {
|
|
2676
|
+
json = await data.json();
|
|
2677
|
+
} catch {
|
|
2678
|
+
throw new Error("Invalid JSON response from Bandcamp");
|
|
2679
|
+
}
|
|
2653
2680
|
tracks = json?.results?.filter((x) => !!x && typeof x === "object" && "type" in x && x.type === "t").map?.((item) => player.LavalinkManager.utils.buildUnresolvedTrack({
|
|
2654
2681
|
uri: item.url || item.uri,
|
|
2655
2682
|
artworkUrl: item.img,
|
|
@@ -2864,15 +2891,15 @@ var FilterManager = class {
|
|
|
2864
2891
|
const lavalinkFilterData = this.data.pluginFilters?.["lavalink-filter-plugin"] || { echo: { decay: this.data.pluginFilters?.echo?.decay && !this.data.pluginFilters?.echo?.echoLength ? this.data.pluginFilters.echo.decay : 0, delay: this.data.pluginFilters?.echo?.delay || 0 }, reverb: { gains: [], delays: [], ...this.data.pluginFilters.reverb } };
|
|
2865
2892
|
this.filters.lavalinkFilterPlugin.echo = lavalinkFilterData.echo.decay !== 0 || lavalinkFilterData.echo.delay !== 0;
|
|
2866
2893
|
this.filters.lavalinkFilterPlugin.reverb = lavalinkFilterData.reverb?.delays?.length !== 0 || lavalinkFilterData.reverb?.gains?.length !== 0;
|
|
2867
|
-
this.filters.lavalinkLavaDspxPlugin.highPass = Object.values(this.data.pluginFilters["high-pass"] || {}).length > 0;
|
|
2868
|
-
this.filters.lavalinkLavaDspxPlugin.lowPass = Object.values(this.data.pluginFilters["low-pass"] || {}).length > 0;
|
|
2869
|
-
this.filters.lavalinkLavaDspxPlugin.normalization = Object.values(this.data.pluginFilters
|
|
2870
|
-
this.filters.lavalinkLavaDspxPlugin.echo = Object.values(this.data.pluginFilters
|
|
2871
|
-
this.filters.lowPass = this.data.lowPass
|
|
2872
|
-
this.filters.karaoke = Object.values(this.data.karaoke).some((v) => v !== 0);
|
|
2894
|
+
this.filters.lavalinkLavaDspxPlugin.highPass = Object.values(this.data.pluginFilters?.["high-pass"] || {}).length > 0;
|
|
2895
|
+
this.filters.lavalinkLavaDspxPlugin.lowPass = Object.values(this.data.pluginFilters?.["low-pass"] || {}).length > 0;
|
|
2896
|
+
this.filters.lavalinkLavaDspxPlugin.normalization = Object.values(this.data.pluginFilters?.normalization || {}).length > 0;
|
|
2897
|
+
this.filters.lavalinkLavaDspxPlugin.echo = Object.values(this.data.pluginFilters?.echo || {}).length > 0 && typeof this.data.pluginFilters?.echo?.delay === "undefined";
|
|
2898
|
+
this.filters.lowPass = this.privateNot0(this.data.lowPass?.smoothing);
|
|
2899
|
+
this.filters.karaoke = Object.values(this.data.karaoke ?? {}).some((v) => v !== 0);
|
|
2873
2900
|
if ((this.filters.nightcore || this.filters.vaporwave) && oldFilterTimescale) {
|
|
2874
|
-
if (oldFilterTimescale.pitch !== this.data.timescale
|
|
2875
|
-
this.filters.custom = Object.values(this.data.timescale).some((v) => v !== 1);
|
|
2901
|
+
if (oldFilterTimescale.pitch !== this.data.timescale?.pitch || oldFilterTimescale.rate !== this.data.timescale?.rate || oldFilterTimescale.speed !== this.data.timescale?.speed) {
|
|
2902
|
+
this.filters.custom = Object.values(this.data.timescale || {}).some((v) => v !== 1);
|
|
2876
2903
|
this.filters.nightcore = false;
|
|
2877
2904
|
this.filters.vaporwave = false;
|
|
2878
2905
|
}
|
|
@@ -3685,8 +3712,11 @@ var Queue = class {
|
|
|
3685
3712
|
this.queueChanges.tracksAdd(this.guildId, (Array.isArray(TrackOrTracks) ? TrackOrTracks : [TrackOrTracks]).flat(2).filter((v) => this.managerUtils.isTrack(v) || this.managerUtils.isUnresolvedTrack(v)), index, oldStored, this.utils.toJSON());
|
|
3686
3713
|
} catch {
|
|
3687
3714
|
}
|
|
3688
|
-
|
|
3689
|
-
|
|
3715
|
+
const spliced = TrackOrTracks ? this.tracks.splice(
|
|
3716
|
+
index,
|
|
3717
|
+
amount,
|
|
3718
|
+
...(Array.isArray(TrackOrTracks) ? TrackOrTracks : [TrackOrTracks]).flat(2).filter((v) => this.managerUtils.isTrack(v) || this.managerUtils.isUnresolvedTrack(v))
|
|
3719
|
+
) : this.tracks.splice(index, amount);
|
|
3690
3720
|
if (typeof this.queueChanges?.tracksRemoved === "function") try {
|
|
3691
3721
|
this.queueChanges.tracksRemoved(this.guildId, spliced, index, oldStored, this.utils.toJSON());
|
|
3692
3722
|
} catch {
|
|
@@ -4251,6 +4281,7 @@ var Player = class {
|
|
|
4251
4281
|
else this.set("internal_autoplayStopPlaying", void 0);
|
|
4252
4282
|
const now = performance.now();
|
|
4253
4283
|
await this.node.updatePlayer({ guildId: this.guildId, playerOptions: { track: { encoded: null } } });
|
|
4284
|
+
this.paused = false;
|
|
4254
4285
|
this.ping.lavalink = Math.round((performance.now() - now) / 10) / 100;
|
|
4255
4286
|
return this;
|
|
4256
4287
|
}
|
|
@@ -5053,6 +5084,7 @@ var LavalinkManager = class extends EventEmitter2 {
|
|
|
5053
5084
|
if (this.options?.advancedOptions?.debugOptions?.noAudio === true) console.debug(`Lavalink-Client-Debug | NO-AUDIO [::] sendRawData function, Function to assing sessionId provided, but no found in Payload: ${safeStringify(update, 2)}`);
|
|
5054
5085
|
}
|
|
5055
5086
|
player.voiceChannelId = update.channel_id;
|
|
5087
|
+
player.options.voiceChannelId = update.channel_id;
|
|
5056
5088
|
const selfMuteChanged = typeof update.self_mute === "boolean" && player.voiceState.selfMute !== update.self_mute;
|
|
5057
5089
|
const serverMuteChanged = typeof update.mute === "boolean" && player.voiceState.serverMute !== update.mute;
|
|
5058
5090
|
const selfDeafChanged = typeof update.self_deaf === "boolean" && player.voiceState.selfDeaf !== update.self_deaf;
|
|
@@ -5095,11 +5127,13 @@ var LavalinkManager = class extends EventEmitter2 {
|
|
|
5095
5127
|
if (player.queue.tracks.length) {
|
|
5096
5128
|
return void await player.play({ paused: previousPaused });
|
|
5097
5129
|
}
|
|
5098
|
-
this.
|
|
5099
|
-
|
|
5100
|
-
|
|
5101
|
-
|
|
5102
|
-
|
|
5130
|
+
if (this.options?.advancedOptions?.enableDebugEvents) {
|
|
5131
|
+
this.emit("debug", "PlayerAutoReconnect" /* PlayerAutoReconnect */, {
|
|
5132
|
+
state: "log",
|
|
5133
|
+
message: `Auto reconnected, but nothing to play`,
|
|
5134
|
+
functionLayer: "LavalinkManager > sendRawData()"
|
|
5135
|
+
});
|
|
5136
|
+
}
|
|
5103
5137
|
return;
|
|
5104
5138
|
} catch (e) {
|
|
5105
5139
|
console.error(e);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lavalink-client",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.1",
|
|
4
4
|
"description": "Easy, flexible and feature-rich lavalink@v4 Client. Both for Beginners and Proficients.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -55,12 +55,12 @@
|
|
|
55
55
|
},
|
|
56
56
|
"homepage": "https://tomato6966.github.io/lavalink-client/",
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@eslint/eslintrc": "^3.3.
|
|
58
|
+
"@eslint/eslintrc": "^3.3.3",
|
|
59
59
|
"@eslint/js": "^9.39.1",
|
|
60
60
|
"@types/node": "^24.10.1",
|
|
61
61
|
"@types/ws": "^8.18.1",
|
|
62
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
63
|
-
"@typescript-eslint/parser": "^8.
|
|
62
|
+
"@typescript-eslint/eslint-plugin": "^8.48.0",
|
|
63
|
+
"@typescript-eslint/parser": "^8.48.0",
|
|
64
64
|
"eslint": "^9.39.1",
|
|
65
65
|
"tsup": "^8.5.1",
|
|
66
66
|
"typescript": "^5.9.3"
|