lavalink-client 2.7.3 → 2.7.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 +6 -2
- package/dist/index.d.ts +6 -2
- package/dist/index.js +11 -4
- package/dist/index.mjs +11 -4
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -983,11 +983,15 @@ declare class Player {
|
|
|
983
983
|
*/
|
|
984
984
|
changeNode(newNode: LavalinkNode | string, checkSources?: boolean): Promise<string>;
|
|
985
985
|
/**
|
|
986
|
-
* Move the player to a different node. If no node is provided, it will find the least used node that is not the same as the current node.
|
|
986
|
+
* (Wrapper-FN for changeNode) Move the player to a different node. If no node is provided, it will find the least used node that is not the same as the current node.
|
|
987
987
|
* @param node the id of the node to move to
|
|
988
988
|
* @returns the player
|
|
989
989
|
* @throws RangeError if there is no available nodes.
|
|
990
990
|
* @throws Error if the node to move to is the same as the current node.
|
|
991
|
+
* @example
|
|
992
|
+
* ```ts
|
|
993
|
+
* const newNodeMovedTo = await player.moveNode(); // no need to specify the new node, it will find a least used node automatically, but you can ofc. use a custom node id.
|
|
994
|
+
* ```
|
|
991
995
|
*/
|
|
992
996
|
moveNode(node?: string): Promise<string | this>;
|
|
993
997
|
/** Converts the Player including Queue to a Json state */
|
|
@@ -2361,7 +2365,7 @@ declare class LavalinkNode {
|
|
|
2361
2365
|
*
|
|
2362
2366
|
* @example
|
|
2363
2367
|
* ```ts
|
|
2364
|
-
* player.node.
|
|
2368
|
+
* player.node.disconnect("Forcefully disconnect the connection to the node.");
|
|
2365
2369
|
* ```
|
|
2366
2370
|
*/
|
|
2367
2371
|
disconnect(disconnectReason?: DisconnectReasonsType): void;
|
package/dist/index.d.ts
CHANGED
|
@@ -983,11 +983,15 @@ declare class Player {
|
|
|
983
983
|
*/
|
|
984
984
|
changeNode(newNode: LavalinkNode | string, checkSources?: boolean): Promise<string>;
|
|
985
985
|
/**
|
|
986
|
-
* Move the player to a different node. If no node is provided, it will find the least used node that is not the same as the current node.
|
|
986
|
+
* (Wrapper-FN for changeNode) Move the player to a different node. If no node is provided, it will find the least used node that is not the same as the current node.
|
|
987
987
|
* @param node the id of the node to move to
|
|
988
988
|
* @returns the player
|
|
989
989
|
* @throws RangeError if there is no available nodes.
|
|
990
990
|
* @throws Error if the node to move to is the same as the current node.
|
|
991
|
+
* @example
|
|
992
|
+
* ```ts
|
|
993
|
+
* const newNodeMovedTo = await player.moveNode(); // no need to specify the new node, it will find a least used node automatically, but you can ofc. use a custom node id.
|
|
994
|
+
* ```
|
|
991
995
|
*/
|
|
992
996
|
moveNode(node?: string): Promise<string | this>;
|
|
993
997
|
/** Converts the Player including Queue to a Json state */
|
|
@@ -2361,7 +2365,7 @@ declare class LavalinkNode {
|
|
|
2361
2365
|
*
|
|
2362
2366
|
* @example
|
|
2363
2367
|
* ```ts
|
|
2364
|
-
* player.node.
|
|
2368
|
+
* player.node.disconnect("Forcefully disconnect the connection to the node.");
|
|
2365
2369
|
* ```
|
|
2366
2370
|
*/
|
|
2367
2371
|
disconnect(disconnectReason?: DisconnectReasonsType): void;
|
package/dist/index.js
CHANGED
|
@@ -1422,6 +1422,7 @@ var LavalinkNode = class {
|
|
|
1422
1422
|
* ```
|
|
1423
1423
|
*/
|
|
1424
1424
|
destroy(destroyReason, deleteNode = true, movePlayers = false) {
|
|
1425
|
+
this.reconnectionState = "IDLE" /* IDLE */;
|
|
1425
1426
|
const players = this.NodeManager.LavalinkManager.players.filter((p) => p.node.id === this.id);
|
|
1426
1427
|
if (players.size) {
|
|
1427
1428
|
const enableDebugEvents = this.NodeManager.LavalinkManager.options?.advancedOptions?.enableDebugEvents;
|
|
@@ -1497,7 +1498,7 @@ var LavalinkNode = class {
|
|
|
1497
1498
|
*
|
|
1498
1499
|
* @example
|
|
1499
1500
|
* ```ts
|
|
1500
|
-
* player.node.
|
|
1501
|
+
* player.node.disconnect("Forcefully disconnect the connection to the node.");
|
|
1501
1502
|
* ```
|
|
1502
1503
|
*/
|
|
1503
1504
|
disconnect(disconnectReason) {
|
|
@@ -1505,6 +1506,7 @@ var LavalinkNode = class {
|
|
|
1505
1506
|
this.socket?.close(1e3, "Node-Disconnect");
|
|
1506
1507
|
this.socket?.removeAllListeners();
|
|
1507
1508
|
this.socket = null;
|
|
1509
|
+
this.reconnectionState = "IDLE" /* IDLE */;
|
|
1508
1510
|
this.resetReconnectionAttempts();
|
|
1509
1511
|
this.NodeManager.emit("disconnect", this, { code: 1e3, reason: disconnectReason });
|
|
1510
1512
|
}
|
|
@@ -1969,10 +1971,10 @@ var LavalinkNode = class {
|
|
|
1969
1971
|
});
|
|
1970
1972
|
this.heartBeatInterval = setInterval(() => {
|
|
1971
1973
|
if (!this.socket) return console.error("Node-Heartbeat-Interval - Socket not available - maybe reconnecting?");
|
|
1972
|
-
if (!this.isAlive) this.close(500, "Node-Heartbeat-Timeout");
|
|
1974
|
+
if (!this.isAlive) return this.close(500, "Node-Heartbeat-Timeout");
|
|
1973
1975
|
this.isAlive = false;
|
|
1974
1976
|
this.heartBeatPingTimestamp = performance.now();
|
|
1975
|
-
this.socket
|
|
1977
|
+
this.socket?.ping?.();
|
|
1976
1978
|
}, this.options.heartBeatInterval || 3e4);
|
|
1977
1979
|
}
|
|
1978
1980
|
this.info = await this.fetchInfo().catch((e) => (console.error(e, "ON-OPEN-FETCH"), null));
|
|
@@ -2021,6 +2023,7 @@ var LavalinkNode = class {
|
|
|
2021
2023
|
error(error) {
|
|
2022
2024
|
if (!error) return;
|
|
2023
2025
|
this.NodeManager.emit("error", this, error);
|
|
2026
|
+
this.reconnectionState = "IDLE" /* IDLE */;
|
|
2024
2027
|
this.reconnect();
|
|
2025
2028
|
if (this.options.closeOnError) {
|
|
2026
2029
|
if (this.heartBeatInterval) clearInterval(this.heartBeatInterval);
|
|
@@ -4639,11 +4642,15 @@ var Player = class {
|
|
|
4639
4642
|
}
|
|
4640
4643
|
}
|
|
4641
4644
|
/**
|
|
4642
|
-
* Move the player to a different node. If no node is provided, it will find the least used node that is not the same as the current node.
|
|
4645
|
+
* (Wrapper-FN for changeNode) Move the player to a different node. If no node is provided, it will find the least used node that is not the same as the current node.
|
|
4643
4646
|
* @param node the id of the node to move to
|
|
4644
4647
|
* @returns the player
|
|
4645
4648
|
* @throws RangeError if there is no available nodes.
|
|
4646
4649
|
* @throws Error if the node to move to is the same as the current node.
|
|
4650
|
+
* @example
|
|
4651
|
+
* ```ts
|
|
4652
|
+
* const newNodeMovedTo = await player.moveNode(); // no need to specify the new node, it will find a least used node automatically, but you can ofc. use a custom node id.
|
|
4653
|
+
* ```
|
|
4647
4654
|
*/
|
|
4648
4655
|
async moveNode(node) {
|
|
4649
4656
|
try {
|
package/dist/index.mjs
CHANGED
|
@@ -1361,6 +1361,7 @@ var LavalinkNode = class {
|
|
|
1361
1361
|
* ```
|
|
1362
1362
|
*/
|
|
1363
1363
|
destroy(destroyReason, deleteNode = true, movePlayers = false) {
|
|
1364
|
+
this.reconnectionState = "IDLE" /* IDLE */;
|
|
1364
1365
|
const players = this.NodeManager.LavalinkManager.players.filter((p) => p.node.id === this.id);
|
|
1365
1366
|
if (players.size) {
|
|
1366
1367
|
const enableDebugEvents = this.NodeManager.LavalinkManager.options?.advancedOptions?.enableDebugEvents;
|
|
@@ -1436,7 +1437,7 @@ var LavalinkNode = class {
|
|
|
1436
1437
|
*
|
|
1437
1438
|
* @example
|
|
1438
1439
|
* ```ts
|
|
1439
|
-
* player.node.
|
|
1440
|
+
* player.node.disconnect("Forcefully disconnect the connection to the node.");
|
|
1440
1441
|
* ```
|
|
1441
1442
|
*/
|
|
1442
1443
|
disconnect(disconnectReason) {
|
|
@@ -1444,6 +1445,7 @@ var LavalinkNode = class {
|
|
|
1444
1445
|
this.socket?.close(1e3, "Node-Disconnect");
|
|
1445
1446
|
this.socket?.removeAllListeners();
|
|
1446
1447
|
this.socket = null;
|
|
1448
|
+
this.reconnectionState = "IDLE" /* IDLE */;
|
|
1447
1449
|
this.resetReconnectionAttempts();
|
|
1448
1450
|
this.NodeManager.emit("disconnect", this, { code: 1e3, reason: disconnectReason });
|
|
1449
1451
|
}
|
|
@@ -1908,10 +1910,10 @@ var LavalinkNode = class {
|
|
|
1908
1910
|
});
|
|
1909
1911
|
this.heartBeatInterval = setInterval(() => {
|
|
1910
1912
|
if (!this.socket) return console.error("Node-Heartbeat-Interval - Socket not available - maybe reconnecting?");
|
|
1911
|
-
if (!this.isAlive) this.close(500, "Node-Heartbeat-Timeout");
|
|
1913
|
+
if (!this.isAlive) return this.close(500, "Node-Heartbeat-Timeout");
|
|
1912
1914
|
this.isAlive = false;
|
|
1913
1915
|
this.heartBeatPingTimestamp = performance.now();
|
|
1914
|
-
this.socket
|
|
1916
|
+
this.socket?.ping?.();
|
|
1915
1917
|
}, this.options.heartBeatInterval || 3e4);
|
|
1916
1918
|
}
|
|
1917
1919
|
this.info = await this.fetchInfo().catch((e) => (console.error(e, "ON-OPEN-FETCH"), null));
|
|
@@ -1960,6 +1962,7 @@ var LavalinkNode = class {
|
|
|
1960
1962
|
error(error) {
|
|
1961
1963
|
if (!error) return;
|
|
1962
1964
|
this.NodeManager.emit("error", this, error);
|
|
1965
|
+
this.reconnectionState = "IDLE" /* IDLE */;
|
|
1963
1966
|
this.reconnect();
|
|
1964
1967
|
if (this.options.closeOnError) {
|
|
1965
1968
|
if (this.heartBeatInterval) clearInterval(this.heartBeatInterval);
|
|
@@ -4578,11 +4581,15 @@ var Player = class {
|
|
|
4578
4581
|
}
|
|
4579
4582
|
}
|
|
4580
4583
|
/**
|
|
4581
|
-
* Move the player to a different node. If no node is provided, it will find the least used node that is not the same as the current node.
|
|
4584
|
+
* (Wrapper-FN for changeNode) Move the player to a different node. If no node is provided, it will find the least used node that is not the same as the current node.
|
|
4582
4585
|
* @param node the id of the node to move to
|
|
4583
4586
|
* @returns the player
|
|
4584
4587
|
* @throws RangeError if there is no available nodes.
|
|
4585
4588
|
* @throws Error if the node to move to is the same as the current node.
|
|
4589
|
+
* @example
|
|
4590
|
+
* ```ts
|
|
4591
|
+
* const newNodeMovedTo = await player.moveNode(); // no need to specify the new node, it will find a least used node automatically, but you can ofc. use a custom node id.
|
|
4592
|
+
* ```
|
|
4586
4593
|
*/
|
|
4587
4594
|
async moveNode(node) {
|
|
4588
4595
|
try {
|
package/package.json
CHANGED