lavalink-client 2.5.6 → 2.5.8
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 +9 -2
- package/dist/index.d.mts +3036 -0
- package/dist/index.d.ts +3036 -0
- package/dist/index.js +4965 -0
- package/dist/index.mjs +4904 -0
- package/package.json +22 -25
- package/dist/cjs/index.d.ts +0 -16
- package/dist/cjs/index.js +0 -19
- package/dist/cjs/package.json +0 -3
- package/dist/cjs/structures/Constants.d.ts +0 -90
- package/dist/cjs/structures/Constants.js +0 -296
- package/dist/cjs/structures/CustomSearches/BandCampSearch.d.ts +0 -3
- package/dist/cjs/structures/CustomSearches/BandCampSearch.js +0 -39
- package/dist/cjs/structures/Filters.d.ts +0 -169
- package/dist/cjs/structures/Filters.js +0 -700
- package/dist/cjs/structures/LavalinkManager.d.ts +0 -232
- package/dist/cjs/structures/LavalinkManager.js +0 -621
- package/dist/cjs/structures/LavalinkManagerStatics.d.ts +0 -15
- package/dist/cjs/structures/LavalinkManagerStatics.js +0 -149
- package/dist/cjs/structures/Node.d.ts +0 -523
- package/dist/cjs/structures/Node.js +0 -1605
- package/dist/cjs/structures/NodeManager.d.ts +0 -100
- package/dist/cjs/structures/NodeManager.js +0 -224
- package/dist/cjs/structures/Player.d.ts +0 -223
- package/dist/cjs/structures/Player.js +0 -807
- package/dist/cjs/structures/Queue.d.ts +0 -186
- package/dist/cjs/structures/Queue.js +0 -390
- package/dist/cjs/structures/Types/Filters.d.ts +0 -190
- package/dist/cjs/structures/Types/Filters.js +0 -2
- package/dist/cjs/structures/Types/Manager.d.ts +0 -271
- package/dist/cjs/structures/Types/Manager.js +0 -2
- package/dist/cjs/structures/Types/Node.d.ts +0 -238
- package/dist/cjs/structures/Types/Node.js +0 -2
- package/dist/cjs/structures/Types/Player.d.ts +0 -114
- package/dist/cjs/structures/Types/Player.js +0 -2
- package/dist/cjs/structures/Types/Queue.d.ts +0 -34
- package/dist/cjs/structures/Types/Queue.js +0 -2
- package/dist/cjs/structures/Types/Track.d.ts +0 -134
- package/dist/cjs/structures/Types/Track.js +0 -2
- package/dist/cjs/structures/Types/Utils.d.ts +0 -440
- package/dist/cjs/structures/Types/Utils.js +0 -2
- package/dist/cjs/structures/Utils.d.ts +0 -116
- package/dist/cjs/structures/Utils.js +0 -567
- package/dist/esm/index.d.ts +0 -16
- package/dist/esm/index.js +0 -16
- package/dist/esm/package.json +0 -3
- package/dist/esm/structures/Constants.d.ts +0 -90
- package/dist/esm/structures/Constants.js +0 -293
- package/dist/esm/structures/CustomSearches/BandCampSearch.d.ts +0 -3
- package/dist/esm/structures/CustomSearches/BandCampSearch.js +0 -35
- package/dist/esm/structures/Filters.d.ts +0 -169
- package/dist/esm/structures/Filters.js +0 -696
- package/dist/esm/structures/LavalinkManager.d.ts +0 -232
- package/dist/esm/structures/LavalinkManager.js +0 -617
- package/dist/esm/structures/LavalinkManagerStatics.d.ts +0 -15
- package/dist/esm/structures/LavalinkManagerStatics.js +0 -146
- package/dist/esm/structures/Node.d.ts +0 -523
- package/dist/esm/structures/Node.js +0 -1600
- package/dist/esm/structures/NodeManager.d.ts +0 -100
- package/dist/esm/structures/NodeManager.js +0 -220
- package/dist/esm/structures/Player.d.ts +0 -223
- package/dist/esm/structures/Player.js +0 -803
- package/dist/esm/structures/Queue.d.ts +0 -186
- package/dist/esm/structures/Queue.js +0 -384
- package/dist/esm/structures/Types/Filters.d.ts +0 -190
- package/dist/esm/structures/Types/Filters.js +0 -1
- package/dist/esm/structures/Types/Manager.d.ts +0 -271
- package/dist/esm/structures/Types/Manager.js +0 -1
- package/dist/esm/structures/Types/Node.d.ts +0 -238
- package/dist/esm/structures/Types/Node.js +0 -1
- package/dist/esm/structures/Types/Player.d.ts +0 -114
- package/dist/esm/structures/Types/Player.js +0 -1
- package/dist/esm/structures/Types/Queue.d.ts +0 -34
- package/dist/esm/structures/Types/Queue.js +0 -1
- package/dist/esm/structures/Types/Track.d.ts +0 -134
- package/dist/esm/structures/Types/Track.js +0 -1
- package/dist/esm/structures/Types/Utils.d.ts +0 -440
- package/dist/esm/structures/Types/Utils.js +0 -1
- package/dist/esm/structures/Utils.d.ts +0 -116
- package/dist/esm/structures/Utils.js +0 -559
- package/dist/types/index.d.ts +0 -16
- package/dist/types/structures/Constants.d.ts +0 -90
- package/dist/types/structures/CustomSearches/BandCampSearch.d.ts +0 -3
- package/dist/types/structures/Filters.d.ts +0 -169
- package/dist/types/structures/LavalinkManager.d.ts +0 -232
- package/dist/types/structures/LavalinkManagerStatics.d.ts +0 -15
- package/dist/types/structures/Node.d.ts +0 -523
- package/dist/types/structures/NodeManager.d.ts +0 -100
- package/dist/types/structures/Player.d.ts +0 -223
- package/dist/types/structures/Queue.d.ts +0 -186
- package/dist/types/structures/Types/Filters.d.ts +0 -190
- package/dist/types/structures/Types/Manager.d.ts +0 -271
- package/dist/types/structures/Types/Node.d.ts +0 -238
- package/dist/types/structures/Types/Player.d.ts +0 -114
- package/dist/types/structures/Types/Queue.d.ts +0 -34
- package/dist/types/structures/Types/Track.d.ts +0 -134
- package/dist/types/structures/Types/Utils.d.ts +0 -440
- package/dist/types/structures/Utils.d.ts +0 -116
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { EventEmitter } from "events";
|
|
2
|
-
import { LavalinkNode } from "./Node.js";
|
|
3
|
-
import { MiniMap } from "./Utils.js";
|
|
4
|
-
import type { LavalinkNodeIdentifier, LavalinkNodeOptions, NodeManagerEvents } from "./Types/Node.js";
|
|
5
|
-
import type { LavalinkManager } from "./LavalinkManager.js";
|
|
6
|
-
export declare class NodeManager extends EventEmitter {
|
|
7
|
-
/**
|
|
8
|
-
* Emit an event
|
|
9
|
-
* @param event The event to emit
|
|
10
|
-
* @param args The arguments to pass to the event
|
|
11
|
-
* @returns
|
|
12
|
-
*/
|
|
13
|
-
emit<Event extends keyof NodeManagerEvents>(event: Event, ...args: Parameters<NodeManagerEvents[Event]>): boolean;
|
|
14
|
-
/**
|
|
15
|
-
* Add an event listener
|
|
16
|
-
* @param event The event to listen to
|
|
17
|
-
* @param listener The listener to add
|
|
18
|
-
* @returns
|
|
19
|
-
*/
|
|
20
|
-
on<Event extends keyof NodeManagerEvents>(event: Event, listener: NodeManagerEvents[Event]): this;
|
|
21
|
-
/**
|
|
22
|
-
* Add an event listener that only fires once
|
|
23
|
-
* @param event The event to listen to
|
|
24
|
-
* @param listener The listener to add
|
|
25
|
-
* @returns
|
|
26
|
-
*/
|
|
27
|
-
once<Event extends keyof NodeManagerEvents>(event: Event, listener: NodeManagerEvents[Event]): this;
|
|
28
|
-
/**
|
|
29
|
-
* Remove an event listener
|
|
30
|
-
* @param event The event to remove the listener from
|
|
31
|
-
* @param listener The listener to remove
|
|
32
|
-
* @returns
|
|
33
|
-
*/
|
|
34
|
-
off<Event extends keyof NodeManagerEvents>(event: Event, listener: NodeManagerEvents[Event]): this;
|
|
35
|
-
/**
|
|
36
|
-
* Remove an event listener
|
|
37
|
-
* @param event The event to remove the listener from
|
|
38
|
-
* @param listener The listener to remove
|
|
39
|
-
* @returns
|
|
40
|
-
*/
|
|
41
|
-
removeListener<Event extends keyof NodeManagerEvents>(event: Event, listener: NodeManagerEvents[Event]): this;
|
|
42
|
-
/**
|
|
43
|
-
* The LavalinkManager that created this NodeManager
|
|
44
|
-
*/
|
|
45
|
-
LavalinkManager: LavalinkManager;
|
|
46
|
-
/**
|
|
47
|
-
* A map of all nodes in the nodeManager
|
|
48
|
-
*/
|
|
49
|
-
nodes: MiniMap<string, LavalinkNode>;
|
|
50
|
-
/**
|
|
51
|
-
* @param LavalinkManager The LavalinkManager that created this NodeManager
|
|
52
|
-
*/
|
|
53
|
-
constructor(LavalinkManager: LavalinkManager);
|
|
54
|
-
/**
|
|
55
|
-
* Disconnects all Nodes from lavalink ws sockets
|
|
56
|
-
* @param deleteAllNodes if the nodes should also be deleted from nodeManager.nodes
|
|
57
|
-
* @param destroyPlayers if the players should be destroyed
|
|
58
|
-
* @returns amount of disconnected Nodes
|
|
59
|
-
*/
|
|
60
|
-
disconnectAll(deleteAllNodes?: boolean, destroyPlayers?: boolean): Promise<number>;
|
|
61
|
-
/**
|
|
62
|
-
* Connects all not connected nodes
|
|
63
|
-
* @returns Amount of connected Nodes
|
|
64
|
-
*/
|
|
65
|
-
connectAll(): Promise<number>;
|
|
66
|
-
/**
|
|
67
|
-
* Forcefully reconnects all nodes
|
|
68
|
-
* @returns amount of nodes
|
|
69
|
-
*/
|
|
70
|
-
reconnectAll(): Promise<number>;
|
|
71
|
-
/**
|
|
72
|
-
* Create a node and add it to the nodeManager
|
|
73
|
-
* @param options The options for the node
|
|
74
|
-
* @returns The node that was created
|
|
75
|
-
*/
|
|
76
|
-
createNode(options: LavalinkNodeOptions): LavalinkNode;
|
|
77
|
-
/**
|
|
78
|
-
* Get the nodes sorted for the least usage, by a sorttype
|
|
79
|
-
* @param sortType The type of sorting to use
|
|
80
|
-
* @returns
|
|
81
|
-
*/
|
|
82
|
-
leastUsedNodes(sortType?: "memory" | "cpuLavalink" | "cpuSystem" | "calls" | "playingPlayers" | "players"): LavalinkNode[];
|
|
83
|
-
/**
|
|
84
|
-
* Delete a node from the nodeManager and destroy it
|
|
85
|
-
* @param node The node to delete
|
|
86
|
-
* @param movePlayers whether to movePlayers to different connected node before deletion. @default false
|
|
87
|
-
* @returns
|
|
88
|
-
*
|
|
89
|
-
* @example
|
|
90
|
-
* Deletes the node
|
|
91
|
-
* ```ts
|
|
92
|
-
* client.lavalink.nodeManager.deleteNode("nodeId to delete");
|
|
93
|
-
* ```
|
|
94
|
-
* Moves players to a different node before deleting
|
|
95
|
-
* ```ts
|
|
96
|
-
* client.lavalink.nodeManager.deleteNode("nodeId to delete", true);
|
|
97
|
-
* ```
|
|
98
|
-
*/
|
|
99
|
-
deleteNode(node: LavalinkNodeIdentifier | LavalinkNode, movePlayers?: boolean): void;
|
|
100
|
-
}
|
|
@@ -1,224 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NodeManager = void 0;
|
|
4
|
-
const events_1 = require("events");
|
|
5
|
-
const Constants_1 = require("./Constants.js");
|
|
6
|
-
const Node_1 = require("./Node.js");
|
|
7
|
-
const Utils_1 = require("./Utils.js");
|
|
8
|
-
class NodeManager extends events_1.EventEmitter {
|
|
9
|
-
/**
|
|
10
|
-
* Emit an event
|
|
11
|
-
* @param event The event to emit
|
|
12
|
-
* @param args The arguments to pass to the event
|
|
13
|
-
* @returns
|
|
14
|
-
*/
|
|
15
|
-
emit(event, ...args) {
|
|
16
|
-
return super.emit(event, ...args);
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Add an event listener
|
|
20
|
-
* @param event The event to listen to
|
|
21
|
-
* @param listener The listener to add
|
|
22
|
-
* @returns
|
|
23
|
-
*/
|
|
24
|
-
on(event, listener) {
|
|
25
|
-
return super.on(event, listener);
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Add an event listener that only fires once
|
|
29
|
-
* @param event The event to listen to
|
|
30
|
-
* @param listener The listener to add
|
|
31
|
-
* @returns
|
|
32
|
-
*/
|
|
33
|
-
once(event, listener) {
|
|
34
|
-
return super.once(event, listener);
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Remove an event listener
|
|
38
|
-
* @param event The event to remove the listener from
|
|
39
|
-
* @param listener The listener to remove
|
|
40
|
-
* @returns
|
|
41
|
-
*/
|
|
42
|
-
off(event, listener) {
|
|
43
|
-
return super.off(event, listener);
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Remove an event listener
|
|
47
|
-
* @param event The event to remove the listener from
|
|
48
|
-
* @param listener The listener to remove
|
|
49
|
-
* @returns
|
|
50
|
-
*/
|
|
51
|
-
removeListener(event, listener) {
|
|
52
|
-
return super.removeListener(event, listener);
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* The LavalinkManager that created this NodeManager
|
|
56
|
-
*/
|
|
57
|
-
LavalinkManager;
|
|
58
|
-
/**
|
|
59
|
-
* A map of all nodes in the nodeManager
|
|
60
|
-
*/
|
|
61
|
-
nodes = new Utils_1.MiniMap();
|
|
62
|
-
/**
|
|
63
|
-
* @param LavalinkManager The LavalinkManager that created this NodeManager
|
|
64
|
-
*/
|
|
65
|
-
constructor(LavalinkManager) {
|
|
66
|
-
super();
|
|
67
|
-
this.LavalinkManager = LavalinkManager;
|
|
68
|
-
if (this.LavalinkManager.options.nodes)
|
|
69
|
-
this.LavalinkManager.options.nodes.forEach(node => {
|
|
70
|
-
this.createNode(node);
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Disconnects all Nodes from lavalink ws sockets
|
|
75
|
-
* @param deleteAllNodes if the nodes should also be deleted from nodeManager.nodes
|
|
76
|
-
* @param destroyPlayers if the players should be destroyed
|
|
77
|
-
* @returns amount of disconnected Nodes
|
|
78
|
-
*/
|
|
79
|
-
async disconnectAll(deleteAllNodes = false, destroyPlayers = true) {
|
|
80
|
-
if (!this.nodes.size)
|
|
81
|
-
throw new Error("There are no nodes to disconnect (no nodes in the nodemanager)");
|
|
82
|
-
if (!this.nodes.filter(v => v.connected).size)
|
|
83
|
-
throw new Error("There are no nodes to disconnect (all nodes disconnected)");
|
|
84
|
-
let counter = 0;
|
|
85
|
-
for (const node of this.nodes.values()) {
|
|
86
|
-
if (!node.connected)
|
|
87
|
-
continue;
|
|
88
|
-
if (destroyPlayers) {
|
|
89
|
-
await node.destroy(Constants_1.DestroyReasons.DisconnectAllNodes, deleteAllNodes);
|
|
90
|
-
}
|
|
91
|
-
else {
|
|
92
|
-
await node.disconnect(Constants_1.DisconnectReasons.DisconnectAllNodes);
|
|
93
|
-
}
|
|
94
|
-
counter++;
|
|
95
|
-
}
|
|
96
|
-
return counter;
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Connects all not connected nodes
|
|
100
|
-
* @returns Amount of connected Nodes
|
|
101
|
-
*/
|
|
102
|
-
async connectAll() {
|
|
103
|
-
if (!this.nodes.size)
|
|
104
|
-
throw new Error("There are no nodes to connect (no nodes in the nodemanager)");
|
|
105
|
-
if (!this.nodes.filter(v => !v.connected).size)
|
|
106
|
-
throw new Error("There are no nodes to connect (all nodes connected)");
|
|
107
|
-
let counter = 0;
|
|
108
|
-
for (const node of this.nodes.values()) {
|
|
109
|
-
if (node.connected)
|
|
110
|
-
continue;
|
|
111
|
-
await node.connect();
|
|
112
|
-
counter++;
|
|
113
|
-
}
|
|
114
|
-
return counter;
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Forcefully reconnects all nodes
|
|
118
|
-
* @returns amount of nodes
|
|
119
|
-
*/
|
|
120
|
-
async reconnectAll() {
|
|
121
|
-
if (!this.nodes.size)
|
|
122
|
-
throw new Error("There are no nodes to reconnect (no nodes in the nodemanager)");
|
|
123
|
-
let counter = 0;
|
|
124
|
-
for (const node of this.nodes.values()) {
|
|
125
|
-
const sessionId = node.sessionId ? `${node.sessionId}` : undefined;
|
|
126
|
-
await node.destroy(Constants_1.DestroyReasons.ReconnectAllNodes, false);
|
|
127
|
-
await node.connect(sessionId);
|
|
128
|
-
counter++;
|
|
129
|
-
}
|
|
130
|
-
return counter;
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* Create a node and add it to the nodeManager
|
|
134
|
-
* @param options The options for the node
|
|
135
|
-
* @returns The node that was created
|
|
136
|
-
*/
|
|
137
|
-
createNode(options) {
|
|
138
|
-
if (this.nodes.has(options.id || `${options.host}:${options.port}`))
|
|
139
|
-
return this.nodes.get(options.id || `${options.host}:${options.port}`);
|
|
140
|
-
const newNode = new Node_1.LavalinkNode(options, this);
|
|
141
|
-
this.nodes.set(newNode.id, newNode);
|
|
142
|
-
return newNode;
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* Get the nodes sorted for the least usage, by a sorttype
|
|
146
|
-
* @param sortType The type of sorting to use
|
|
147
|
-
* @returns
|
|
148
|
-
*/
|
|
149
|
-
leastUsedNodes(sortType = "players") {
|
|
150
|
-
const connectedNodes = Array.from(this.nodes.values()).filter((node) => node.connected);
|
|
151
|
-
switch (sortType) {
|
|
152
|
-
case "memory":
|
|
153
|
-
{
|
|
154
|
-
return connectedNodes
|
|
155
|
-
.sort((a, b) => (a.stats?.memory?.used || 0) - (b.stats?.memory?.used || 0)); // sort after memor
|
|
156
|
-
}
|
|
157
|
-
break;
|
|
158
|
-
case "cpuLavalink":
|
|
159
|
-
{
|
|
160
|
-
return connectedNodes
|
|
161
|
-
.sort((a, b) => (a.stats?.cpu?.lavalinkLoad || 0) - (b.stats?.cpu?.lavalinkLoad || 0)); // sort after memor
|
|
162
|
-
}
|
|
163
|
-
break;
|
|
164
|
-
case "cpuSystem":
|
|
165
|
-
{
|
|
166
|
-
return connectedNodes
|
|
167
|
-
.sort((a, b) => (a.stats?.cpu?.systemLoad || 0) - (b.stats?.cpu?.systemLoad || 0)); // sort after memor
|
|
168
|
-
}
|
|
169
|
-
break;
|
|
170
|
-
case "calls":
|
|
171
|
-
{
|
|
172
|
-
return connectedNodes
|
|
173
|
-
.sort((a, b) => a.calls - b.calls); // client sided sorting
|
|
174
|
-
}
|
|
175
|
-
break;
|
|
176
|
-
case "playingPlayers":
|
|
177
|
-
{
|
|
178
|
-
return connectedNodes
|
|
179
|
-
.sort((a, b) => (a.stats?.playingPlayers || 0) - (b.stats?.playingPlayers || 0));
|
|
180
|
-
}
|
|
181
|
-
break;
|
|
182
|
-
case "players":
|
|
183
|
-
{
|
|
184
|
-
return connectedNodes
|
|
185
|
-
.sort((a, b) => (a.stats?.players || 0) - (b.stats?.players || 0));
|
|
186
|
-
}
|
|
187
|
-
break;
|
|
188
|
-
default:
|
|
189
|
-
{
|
|
190
|
-
return connectedNodes
|
|
191
|
-
.sort((a, b) => (a.stats?.players || 0) - (b.stats?.players || 0));
|
|
192
|
-
}
|
|
193
|
-
break;
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
/**
|
|
197
|
-
* Delete a node from the nodeManager and destroy it
|
|
198
|
-
* @param node The node to delete
|
|
199
|
-
* @param movePlayers whether to movePlayers to different connected node before deletion. @default false
|
|
200
|
-
* @returns
|
|
201
|
-
*
|
|
202
|
-
* @example
|
|
203
|
-
* Deletes the node
|
|
204
|
-
* ```ts
|
|
205
|
-
* client.lavalink.nodeManager.deleteNode("nodeId to delete");
|
|
206
|
-
* ```
|
|
207
|
-
* Moves players to a different node before deleting
|
|
208
|
-
* ```ts
|
|
209
|
-
* client.lavalink.nodeManager.deleteNode("nodeId to delete", true);
|
|
210
|
-
* ```
|
|
211
|
-
*/
|
|
212
|
-
deleteNode(node, movePlayers = false) {
|
|
213
|
-
const decodeNode = typeof node === "string" ? this.nodes.get(node) : node || this.leastUsedNodes()[0];
|
|
214
|
-
if (!decodeNode)
|
|
215
|
-
throw new Error("Node was not found");
|
|
216
|
-
if (movePlayers)
|
|
217
|
-
decodeNode.destroy(Constants_1.DestroyReasons.NodeDeleted, true, true);
|
|
218
|
-
else
|
|
219
|
-
decodeNode.destroy(Constants_1.DestroyReasons.NodeDeleted);
|
|
220
|
-
this.nodes.delete(decodeNode.id);
|
|
221
|
-
return;
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
exports.NodeManager = NodeManager;
|
|
@@ -1,223 +0,0 @@
|
|
|
1
|
-
import { FilterManager } from "./Filters.js";
|
|
2
|
-
import { Queue } from "./Queue.js";
|
|
3
|
-
import type { DestroyReasons } from "./Constants.js";
|
|
4
|
-
import type { Track } from "./Types/Track.js";
|
|
5
|
-
import type { LavalinkNode } from "./Node.js";
|
|
6
|
-
import type { SponsorBlockSegment } from "./Types/Node.js";
|
|
7
|
-
import type { PlayerJson, PlayerOptions, PlayOptions, RepeatMode } from "./Types/Player.js";
|
|
8
|
-
import type { LavalinkManager } from "./LavalinkManager.js";
|
|
9
|
-
import type { LavalinkPlayerVoiceOptions, LavaSearchQuery, SearchQuery } from "./Types/Utils.js";
|
|
10
|
-
export declare class Player {
|
|
11
|
-
/** Filter Manager per player */
|
|
12
|
-
filterManager: FilterManager;
|
|
13
|
-
/** circular reference to the lavalink Manager from the Player for easier use */
|
|
14
|
-
LavalinkManager: LavalinkManager;
|
|
15
|
-
/** Player options currently used, mutation doesn't affect player's state */
|
|
16
|
-
options: PlayerOptions;
|
|
17
|
-
/** The lavalink node assigned the the player, don't change it manually */
|
|
18
|
-
node: LavalinkNode;
|
|
19
|
-
/** The queue from the player */
|
|
20
|
-
queue: Queue;
|
|
21
|
-
/** The Guild Id of the Player */
|
|
22
|
-
guildId: string;
|
|
23
|
-
/** The Voice Channel Id of the Player */
|
|
24
|
-
voiceChannelId: string | null;
|
|
25
|
-
/** The Text Channel Id of the Player */
|
|
26
|
-
textChannelId: string | null;
|
|
27
|
-
/** States if the Bot is supposed to be outputting audio */
|
|
28
|
-
playing: boolean;
|
|
29
|
-
/** States if the Bot is paused or not */
|
|
30
|
-
paused: boolean;
|
|
31
|
-
/** Repeat Mode of the Player */
|
|
32
|
-
repeatMode: RepeatMode;
|
|
33
|
-
/** Player's ping */
|
|
34
|
-
ping: {
|
|
35
|
-
lavalink: number;
|
|
36
|
-
ws: number;
|
|
37
|
-
};
|
|
38
|
-
/** The Display Volume */
|
|
39
|
-
volume: number;
|
|
40
|
-
/** The Volume Lavalink actually is outputting */
|
|
41
|
-
lavalinkVolume: number;
|
|
42
|
-
/** The current Positin of the player (Calculated) */
|
|
43
|
-
get position(): number;
|
|
44
|
-
/** The timestamp when the last position change update happened */
|
|
45
|
-
lastPositionChange: number;
|
|
46
|
-
/** The current Positin of the player (from Lavalink) */
|
|
47
|
-
lastPosition: number;
|
|
48
|
-
lastSavedPosition: number;
|
|
49
|
-
/** When the player was created [Timestamp in Ms] (from lavalink) */
|
|
50
|
-
createdTimeStamp: number;
|
|
51
|
-
/** The Player Connection's State (from Lavalink) */
|
|
52
|
-
connected: boolean | undefined;
|
|
53
|
-
/** Voice Server Data (from Lavalink) */
|
|
54
|
-
voice: LavalinkPlayerVoiceOptions;
|
|
55
|
-
voiceState: {
|
|
56
|
-
selfDeaf: boolean;
|
|
57
|
-
selfMute: boolean;
|
|
58
|
-
serverDeaf: boolean;
|
|
59
|
-
serverMute: boolean;
|
|
60
|
-
suppress: boolean;
|
|
61
|
-
};
|
|
62
|
-
/** Custom data for the player */
|
|
63
|
-
private readonly data;
|
|
64
|
-
/**
|
|
65
|
-
* Create a new Player
|
|
66
|
-
* @param options
|
|
67
|
-
* @param LavalinkManager
|
|
68
|
-
*/
|
|
69
|
-
constructor(options: PlayerOptions, LavalinkManager: LavalinkManager, dontEmitPlayerCreateEvent?: boolean);
|
|
70
|
-
/**
|
|
71
|
-
* Set custom data.
|
|
72
|
-
* @param key
|
|
73
|
-
* @param value
|
|
74
|
-
*/
|
|
75
|
-
set(key: string, value: unknown): this;
|
|
76
|
-
/**
|
|
77
|
-
* Get custom data.
|
|
78
|
-
* @param key
|
|
79
|
-
*/
|
|
80
|
-
get<T>(key: string): T;
|
|
81
|
-
/**
|
|
82
|
-
* CLears all the custom data.
|
|
83
|
-
*/
|
|
84
|
-
clearData(): this;
|
|
85
|
-
/**
|
|
86
|
-
* Get all custom Data
|
|
87
|
-
*/
|
|
88
|
-
getAllData(): Record<string, unknown>;
|
|
89
|
-
/**
|
|
90
|
-
* Play the next track from the queue / a specific track, with playoptions for Lavalink
|
|
91
|
-
* @param options
|
|
92
|
-
*/
|
|
93
|
-
play(options?: Partial<PlayOptions>): any;
|
|
94
|
-
/**
|
|
95
|
-
* Set the Volume for the Player
|
|
96
|
-
* @param volume The Volume in percent
|
|
97
|
-
* @param ignoreVolumeDecrementer If it should ignore the volumedecrementer option
|
|
98
|
-
*/
|
|
99
|
-
setVolume(volume: number, ignoreVolumeDecrementer?: boolean): Promise<this>;
|
|
100
|
-
/**
|
|
101
|
-
* Search for a track
|
|
102
|
-
* @param query The query to search for
|
|
103
|
-
* @param requestUser The user that requested the track
|
|
104
|
-
* @param throwOnEmpty If an error should be thrown if no track is found
|
|
105
|
-
* @returns The search result
|
|
106
|
-
*/
|
|
107
|
-
lavaSearch(query: LavaSearchQuery, requestUser: unknown, throwOnEmpty?: boolean): Promise<import("./Types/Utils.js").LavaSearchResponse | import("./Types/Utils.js").SearchResult>;
|
|
108
|
-
/**
|
|
109
|
-
* Set the SponsorBlock
|
|
110
|
-
* @param segments The segments to set
|
|
111
|
-
*/
|
|
112
|
-
setSponsorBlock(segments?: SponsorBlockSegment[]): Promise<void>;
|
|
113
|
-
/**
|
|
114
|
-
* Get the SponsorBlock
|
|
115
|
-
*/
|
|
116
|
-
getSponsorBlock(): Promise<SponsorBlockSegment[]>;
|
|
117
|
-
/**
|
|
118
|
-
* Delete the SponsorBlock
|
|
119
|
-
*/
|
|
120
|
-
deleteSponsorBlock(): Promise<void>;
|
|
121
|
-
/**
|
|
122
|
-
*
|
|
123
|
-
* @param query Query for your data
|
|
124
|
-
* @param requestUser
|
|
125
|
-
*/
|
|
126
|
-
search(query: SearchQuery, requestUser: unknown, throwOnEmpty?: boolean): Promise<import("./Types/Utils.js").UnresolvedSearchResult | import("./Types/Utils.js").SearchResult>;
|
|
127
|
-
/**
|
|
128
|
-
* Pause the player
|
|
129
|
-
*/
|
|
130
|
-
pause(): Promise<this>;
|
|
131
|
-
/**
|
|
132
|
-
* Resume the Player
|
|
133
|
-
*/
|
|
134
|
-
resume(): Promise<this>;
|
|
135
|
-
/**
|
|
136
|
-
* Seek to a specific Position
|
|
137
|
-
* @param position
|
|
138
|
-
*/
|
|
139
|
-
seek(position: number): Promise<this>;
|
|
140
|
-
/**
|
|
141
|
-
* Set the Repeatmode of the Player
|
|
142
|
-
* @param repeatMode
|
|
143
|
-
*/
|
|
144
|
-
setRepeatMode(repeatMode: RepeatMode): Promise<this>;
|
|
145
|
-
/**
|
|
146
|
-
* Skip the current song, or a specific amount of songs
|
|
147
|
-
* @param amount provide the index of the next track to skip to
|
|
148
|
-
*/
|
|
149
|
-
skip(skipTo?: number, throwError?: boolean): Promise<this>;
|
|
150
|
-
/**
|
|
151
|
-
* Clears the queue and stops playing. Does not destroy the Player and not leave the channel
|
|
152
|
-
* @returns
|
|
153
|
-
*/
|
|
154
|
-
stopPlaying(clearQueue?: boolean, executeAutoplay?: boolean): Promise<this>;
|
|
155
|
-
/**
|
|
156
|
-
* Connects the Player to the Voice Channel
|
|
157
|
-
* @returns
|
|
158
|
-
*/
|
|
159
|
-
connect(): Promise<this>;
|
|
160
|
-
changeVoiceState(data: {
|
|
161
|
-
voiceChannelId?: string;
|
|
162
|
-
selfDeaf?: boolean;
|
|
163
|
-
selfMute?: boolean;
|
|
164
|
-
}): Promise<this>;
|
|
165
|
-
/**
|
|
166
|
-
* Disconnects the Player from the Voice Channel, but keeps the player in the cache
|
|
167
|
-
* @param force If false it throws an error, if player thinks it's already disconnected
|
|
168
|
-
* @returns
|
|
169
|
-
*/
|
|
170
|
-
disconnect(force?: boolean): Promise<this>;
|
|
171
|
-
/**
|
|
172
|
-
* Destroy the player and disconnect from the voice channel
|
|
173
|
-
*/
|
|
174
|
-
destroy(reason?: DestroyReasons | string, disconnect?: boolean): Promise<this>;
|
|
175
|
-
/**
|
|
176
|
-
* Get the current lyrics of the track currently playing on the guild
|
|
177
|
-
* @param guildId The guild id to get the current lyrics for
|
|
178
|
-
* @param skipTrackSource If true, it will not try to get the lyrics from the track source
|
|
179
|
-
* @returns The current lyrics
|
|
180
|
-
* @example
|
|
181
|
-
* ```ts
|
|
182
|
-
* const lyrics = await player.getCurrentLyrics();
|
|
183
|
-
* ```
|
|
184
|
-
*/
|
|
185
|
-
getCurrentLyrics(skipTrackSource?: boolean): Promise<import("./Types/Node.js").LyricsResult>;
|
|
186
|
-
/**
|
|
187
|
-
* Get the lyrics of a specific track
|
|
188
|
-
* @param track The track to get the lyrics for
|
|
189
|
-
* @param skipTrackSource If true, it will not try to get the lyrics from the track source
|
|
190
|
-
* @returns The lyrics of the track
|
|
191
|
-
* @example
|
|
192
|
-
* ```ts
|
|
193
|
-
* const lyrics = await player.getLyrics(player.queue.tracks[0], true);
|
|
194
|
-
* ```
|
|
195
|
-
*/
|
|
196
|
-
getLyrics(track: Track, skipTrackSource?: boolean): Promise<import("./Types/Node.js").LyricsResult>;
|
|
197
|
-
/**
|
|
198
|
-
* Subscribe to the lyrics event on a specific guild to active live lyrics events
|
|
199
|
-
* @returns The unsubscribe function
|
|
200
|
-
* @example
|
|
201
|
-
* ```ts
|
|
202
|
-
* const lyrics = await player.subscribeLyrics();
|
|
203
|
-
* ```
|
|
204
|
-
*/
|
|
205
|
-
subscribeLyrics(): Promise<unknown>;
|
|
206
|
-
/**
|
|
207
|
-
* Unsubscribe from the lyrics event on a specific guild to disable live lyrics events
|
|
208
|
-
* @returns The unsubscribe function
|
|
209
|
-
* @example
|
|
210
|
-
* ```ts
|
|
211
|
-
* const lyrics = await player.unsubscribeLyrics();
|
|
212
|
-
* ```
|
|
213
|
-
*/
|
|
214
|
-
unsubscribeLyrics(): Promise<void>;
|
|
215
|
-
/**
|
|
216
|
-
* Move the player on a different Audio-Node
|
|
217
|
-
* @param newNode New Node / New Node Id
|
|
218
|
-
* @param checkSources If it should check if the sources are supported by the new node
|
|
219
|
-
*/
|
|
220
|
-
changeNode(newNode: LavalinkNode | string, checkSources?: boolean): Promise<string>;
|
|
221
|
-
/** Converts the Player including Queue to a Json state */
|
|
222
|
-
toJSON(): PlayerJson;
|
|
223
|
-
}
|