lavacord 2.0.0 → 2.0.2

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.
Files changed (40) hide show
  1. package/dist/cloudstorm.js.map +1 -0
  2. package/dist/detritus.js.map +1 -0
  3. package/dist/discord.js.js.map +1 -0
  4. package/dist/eris.js.map +1 -0
  5. package/dist/index.d.ts +5 -0
  6. package/dist/index.js +22 -0
  7. package/dist/index.js.map +1 -0
  8. package/dist/lib/LavalinkNode.d.ts +105 -0
  9. package/dist/lib/LavalinkNode.js +240 -0
  10. package/dist/lib/LavalinkNode.js.map +1 -0
  11. package/dist/lib/Manager.d.ts +137 -0
  12. package/dist/lib/Manager.js +239 -0
  13. package/dist/lib/Manager.js.map +1 -0
  14. package/dist/lib/Player.d.ts +139 -0
  15. package/dist/lib/Player.js +202 -0
  16. package/dist/lib/Player.js.map +1 -0
  17. package/dist/lib/Rest.d.ts +63 -0
  18. package/dist/lib/Rest.js +117 -0
  19. package/dist/lib/Rest.js.map +1 -0
  20. package/dist/lib/Types.d.ts +177 -0
  21. package/dist/lib/Types.js +3 -0
  22. package/dist/lib/Types.js.map +1 -0
  23. package/dist/oceanic.js.map +1 -0
  24. package/dist/tsconfig.tsbuildinfo +1 -0
  25. package/package.json +19 -8
  26. package/cloudstorm.js.map +0 -1
  27. package/detritus.js.map +0 -1
  28. package/discord.js.js.map +0 -1
  29. package/eris.js.map +0 -1
  30. package/oceanic.js.map +0 -1
  31. /package/{cloudstorm.d.ts → dist/cloudstorm.d.ts} +0 -0
  32. /package/{cloudstorm.js → dist/cloudstorm.js} +0 -0
  33. /package/{detritus.d.ts → dist/detritus.d.ts} +0 -0
  34. /package/{detritus.js → dist/detritus.js} +0 -0
  35. /package/{discord.js.d.ts → dist/discord.js.d.ts} +0 -0
  36. /package/{discord.js.js → dist/discord.js.js} +0 -0
  37. /package/{eris.d.ts → dist/eris.d.ts} +0 -0
  38. /package/{eris.js → dist/eris.js} +0 -0
  39. /package/{oceanic.d.ts → dist/oceanic.d.ts} +0 -0
  40. /package/{oceanic.js → dist/oceanic.js} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cloudstorm.js","sourceRoot":"","sources":["../src/cloudstorm.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,2CAAuD;AAKvD,0CAAwB;AAExB,MAAa,OAAQ,SAAQ,iBAAW;IACD;IAAnC,YAAmC,MAAc,EAAE,KAAiC,EAAE,OAAuB;QACzG,KAAK,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QADS,WAAM,GAAN,MAAM,CAAQ;QAG7C,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;YACZ,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,EAAE;gBACjB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,WAAW;oBAAE,OAAO,KAAK,CAAC;gBACnD,sCAAsC;gBACtC,MAAM,OAAO,GAAG,MAAM,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,MAAM,CAAC,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC;gBAE5G,MAAM,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;gBAE3G,IAAI,CAAC,EAAE;oBACH,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;oBACzC,OAAO,IAAI,CAAC;iBACf;qBAAM;oBACH,OAAO,KAAK,CAAC;iBAChB;YACL,CAAC,CAAC;SACL;QAED,MAAM,C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,YAAY,IAAI,EAAE;oBAAE,IAAI,CAAC,gBAAgB,CAAC,EAAE,GAAG,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACtJ,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AAxBD,0BAwBC"}
@@ -0,0 +1,5 @@
1
+ export * from "./lib/LavalinkNode";
2
+ export * from "./lib/Player";
3
+ export * from "./lib/Manager";
4
+ export * from "./lib/Rest";
5
+ export * from "./lib/Types";
package/dist/index.js ADDED
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./lib/LavalinkNode"), exports);
18
+ __exportStar(require("./lib/Player"), exports);
19
+ __exportStar(require("./lib/Manager"), exports);
20
+ __exportStar(require("./lib/Rest"), exports);
21
+ __exportStar(require("./lib/Types"), exports);
22
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,+CAA6B;AAC7B,gDAA8B;AAC9B,6CAA2B;AAC3B,8CAA4B"}
@@ -0,0 +1,105 @@
1
+ import WebSocket from "ws";
2
+ import type { Manager } from "./Manager";
3
+ import type { LavalinkNodeOptions } from "./Types";
4
+ import type { Stats } from "lavalink-types";
5
+ /**
6
+ * The class for handling everything to do with connecting to Lavalink
7
+ */
8
+ export declare class LavalinkNode {
9
+ manager: Manager;
10
+ /**
11
+ * The id of the LavalinkNode so Nodes are better organized
12
+ */
13
+ id: string;
14
+ /**
15
+ * The host of the LavalinkNode, this could be a ip or domain.
16
+ */
17
+ host: string;
18
+ /**
19
+ * The port of the LavalinkNode
20
+ */
21
+ port: number | string;
22
+ /**
23
+ * The interval that the node will try to reconnect to lavalink at in milliseconds
24
+ */
25
+ reconnectInterval: number;
26
+ /**
27
+ * The password of the lavalink node
28
+ */
29
+ password: string;
30
+ /**
31
+ * The WebSocket instance for this LavalinkNode
32
+ */
33
+ ws: WebSocket | null;
34
+ /**
35
+ * The statistics of the LavalinkNode
36
+ */
37
+ stats: Stats;
38
+ /**
39
+ * The resume key to send to the LavalinkNode so you can resume properly
40
+ */
41
+ resumeKey?: string;
42
+ /**
43
+ * The resume timeout
44
+ */
45
+ resumeTimeout: number;
46
+ /**
47
+ * Extra info attached to your node, not required and is not sent to lavalink, purely for you.
48
+ */
49
+ state?: any;
50
+ /**
51
+ * The major version of the LavaLink node as indicated by /version
52
+ */
53
+ version?: number;
54
+ /**
55
+ * The session ID sent by LavaLink on connect. Used for some REST routes
56
+ */
57
+ sessionId?: string;
58
+ /**
59
+ * The reconnect timeout
60
+ * @private
61
+ */
62
+ private _reconnect?;
63
+ /**
64
+ * The base of the connection to lavalink
65
+ * @param manager The manager that created the LavalinkNode
66
+ * @param options The options of the LavalinkNode {@link LavalinkNodeOptions}
67
+ */
68
+ constructor(manager: Manager, options: LavalinkNodeOptions);
69
+ /**
70
+ * Connects the node to Lavalink
71
+ */
72
+ connect(): Promise<WebSocket>;
73
+ /**
74
+ * Destroys the connection to the Lavalink Websocket
75
+ */
76
+ destroy(): boolean;
77
+ /**
78
+ * Whether or not the node is connected
79
+ */
80
+ get connected(): boolean;
81
+ /**
82
+ * A private function for handling the open event from WebSocket
83
+ */
84
+ private onOpen;
85
+ /**
86
+ * Private function for handling the message event from WebSocket
87
+ * @param data The data that came from lavalink
88
+ */
89
+ private onMessage;
90
+ /**
91
+ * Private function for handling the error event from WebSocket
92
+ * @param error WebSocket error
93
+ */
94
+ private onError;
95
+ /**
96
+ * Private function for handling the close event from WebSocket
97
+ * @param code WebSocket close code
98
+ * @param reason WebSocket close reason
99
+ */
100
+ private onClose;
101
+ /**
102
+ * Handles reconnecting if something happens and the node discounnects
103
+ */
104
+ private reconnect;
105
+ }
@@ -0,0 +1,240 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.LavalinkNode = void 0;
7
+ const ws_1 = __importDefault(require("ws"));
8
+ const Rest_1 = require("./Rest");
9
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
10
+ const { version } = require("../../package.json");
11
+ /**
12
+ * The class for handling everything to do with connecting to Lavalink
13
+ */
14
+ class LavalinkNode {
15
+ manager;
16
+ /**
17
+ * The id of the LavalinkNode so Nodes are better organized
18
+ */
19
+ id;
20
+ /**
21
+ * The host of the LavalinkNode, this could be a ip or domain.
22
+ */
23
+ host = "localhost";
24
+ /**
25
+ * The port of the LavalinkNode
26
+ */
27
+ port = 2333;
28
+ /**
29
+ * The interval that the node will try to reconnect to lavalink at in milliseconds
30
+ */
31
+ reconnectInterval = 10000;
32
+ /**
33
+ * The password of the lavalink node
34
+ */
35
+ password = "youshallnotpass";
36
+ /**
37
+ * The WebSocket instance for this LavalinkNode
38
+ */
39
+ ws = null;
40
+ /**
41
+ * The statistics of the LavalinkNode
42
+ */
43
+ stats;
44
+ /**
45
+ * The resume key to send to the LavalinkNode so you can resume properly
46
+ */
47
+ resumeKey;
48
+ /**
49
+ * The resume timeout
50
+ */
51
+ resumeTimeout = 120;
52
+ /**
53
+ * Extra info attached to your node, not required and is not sent to lavalink, purely for you.
54
+ */
55
+ state;
56
+ /**
57
+ * The major version of the LavaLink node as indicated by /version
58
+ */
59
+ version;
60
+ /**
61
+ * The session ID sent by LavaLink on connect. Used for some REST routes
62
+ */
63
+ sessionId;
64
+ /**
65
+ * The reconnect timeout
66
+ * @private
67
+ */
68
+ _reconnect;
69
+ /**
70
+ * The base of the connection to lavalink
71
+ * @param manager The manager that created the LavalinkNode
72
+ * @param options The options of the LavalinkNode {@link LavalinkNodeOptions}
73
+ */
74
+ constructor(manager, options) {
75
+ this.manager = manager;
76
+ this.id = options.id;
77
+ if (options.host)
78
+ Object.defineProperty(this, "host", { value: options.host });
79
+ if (options.port)
80
+ Object.defineProperty(this, "port", { value: options.port });
81
+ if (options.password)
82
+ Object.defineProperty(this, "password", { value: options.password });
83
+ if (options.reconnectInterval)
84
+ this.reconnectInterval = options.reconnectInterval;
85
+ if (options.resumeKey)
86
+ this.resumeKey = options.resumeKey;
87
+ if (options.resumeTimeout)
88
+ this.resumeTimeout = options.resumeTimeout;
89
+ if (options.state)
90
+ this.state = options.state;
91
+ this.stats = {
92
+ players: 0,
93
+ playingPlayers: 0,
94
+ uptime: 0,
95
+ memory: {
96
+ free: 0,
97
+ used: 0,
98
+ allocated: 0,
99
+ reservable: 0
100
+ },
101
+ cpu: {
102
+ cores: 0,
103
+ systemLoad: 0,
104
+ lavalinkLoad: 0
105
+ },
106
+ frameStats: {
107
+ sent: 0,
108
+ nulled: 0,
109
+ deficit: 0
110
+ }
111
+ };
112
+ }
113
+ /**
114
+ * Connects the node to Lavalink
115
+ */
116
+ async connect() {
117
+ this.ws = await new Promise((resolve, reject) => {
118
+ if (this.connected)
119
+ this.ws.close();
120
+ return Rest_1.Rest.version(this)
121
+ .then(nodeVersion => {
122
+ const major = typeof nodeVersion === "string" && nodeVersion.indexOf(".") !== -1 ? nodeVersion.split(".")[0] : undefined;
123
+ if (!major || isNaN(Number(major)))
124
+ return reject(new Error("Node didn't respond to /version with a major.minor.patch version string"));
125
+ const numMajor = Number(major);
126
+ this.version = numMajor;
127
+ const headers = {
128
+ Authorization: this.password,
129
+ "User-Id": this.manager.user,
130
+ "Client-Name": `Lavacord/${version}`
131
+ };
132
+ if (this.resumeKey)
133
+ headers["Resume-Key"] = this.resumeKey;
134
+ const ws = new ws_1.default(`ws://${this.host}:${this.port}/v${numMajor}/websocket`, { headers });
135
+ const onEvent = (event) => {
136
+ ws.removeAllListeners();
137
+ reject(event);
138
+ };
139
+ const onOpen = () => {
140
+ this.onOpen();
141
+ ws.removeListener("open", onOpen);
142
+ ws.removeListener("error", onEvent);
143
+ ws.removeListener("close", onEvent);
144
+ resolve(ws);
145
+ };
146
+ ws
147
+ .once("open", onOpen)
148
+ .once("error", onEvent)
149
+ .once("close", onEvent);
150
+ }).catch(reject);
151
+ });
152
+ this.ws
153
+ .on("message", data => this.onMessage(data))
154
+ .on("error", error => this.onError(error))
155
+ .on("close", (code, reason) => this.onClose(code, reason));
156
+ return this.ws;
157
+ }
158
+ /**
159
+ * Destroys the connection to the Lavalink Websocket
160
+ */
161
+ destroy() {
162
+ if (!this.connected)
163
+ return false;
164
+ this.ws.close(1000, "destroy");
165
+ return true;
166
+ }
167
+ /**
168
+ * Whether or not the node is connected
169
+ */
170
+ get connected() {
171
+ if (!this.ws)
172
+ return false;
173
+ return this.ws.readyState === ws_1.default.OPEN;
174
+ }
175
+ /**
176
+ * A private function for handling the open event from WebSocket
177
+ */
178
+ onOpen() {
179
+ if (this._reconnect)
180
+ clearTimeout(this._reconnect);
181
+ this.manager.emit("ready", this);
182
+ }
183
+ /**
184
+ * Private function for handling the message event from WebSocket
185
+ * @param data The data that came from lavalink
186
+ */
187
+ onMessage(data) {
188
+ if (Array.isArray(data))
189
+ data = Buffer.concat(data);
190
+ else if (data instanceof ArrayBuffer)
191
+ data = Buffer.from(data);
192
+ const msg = JSON.parse(data.toString());
193
+ if (msg.op === "ready") {
194
+ this.sessionId = msg.sessionId;
195
+ if (this.resumeKey)
196
+ Rest_1.Rest.updateSession(this);
197
+ }
198
+ else if (msg.op && msg.op === "stats") {
199
+ this.stats = { ...msg };
200
+ delete this.stats.op;
201
+ }
202
+ else if ((msg.op === "event" || msg.op === "playerUpdate") && this.manager.players.has(msg.guildId)) {
203
+ this.manager.players.get(msg.guildId).emit(msg.op, msg);
204
+ }
205
+ this.manager.emit("raw", msg, this);
206
+ }
207
+ /**
208
+ * Private function for handling the error event from WebSocket
209
+ * @param error WebSocket error
210
+ */
211
+ onError(error) {
212
+ if (!error)
213
+ return;
214
+ this.manager.emit("error", error, this);
215
+ this.reconnect();
216
+ }
217
+ /**
218
+ * Private function for handling the close event from WebSocket
219
+ * @param code WebSocket close code
220
+ * @param reason WebSocket close reason
221
+ */
222
+ onClose(code, reason) {
223
+ this.manager.emit("disconnect", code, reason.toString(), this);
224
+ if (code !== 1000 || reason.toString() !== "destroy")
225
+ return this.reconnect();
226
+ }
227
+ /**
228
+ * Handles reconnecting if something happens and the node discounnects
229
+ */
230
+ reconnect() {
231
+ this._reconnect = setTimeout(() => {
232
+ this.ws.removeAllListeners();
233
+ this.ws = null;
234
+ this.manager.emit("reconnecting", this);
235
+ this.connect();
236
+ }, this.reconnectInterval);
237
+ }
238
+ }
239
+ exports.LavalinkNode = LavalinkNode;
240
+ //# sourceMappingURL=LavalinkNode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LavalinkNode.js","sourceRoot":"","sources":["../../src/lib/LavalinkNode.ts"],"names":[],"mappings":";;;;;;AAAA,4CAA2B;AAC3B,iCAA8B;AAM9B,8DAA8D;AAC9D,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAElD;;GAEG;AACH,MAAa,YAAY;IA8DK;IA5D1B;;OAEG;IACI,EAAE,CAAS;IAClB;;OAEG;IACI,IAAI,GAAG,WAAW,CAAC;IAC1B;;OAEG;IACI,IAAI,GAAoB,IAAI,CAAC;IACpC;;OAEG;IACI,iBAAi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;YAC9B,IAAI,CAAC,EAAG,CAAC,kBAAkB,EAAE,CAAC;YAC9B,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC;YAEf,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;YACxC,IAAI,CAAC,OAAO,EAAE,CAAC;QACnB,CAAC,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC;IAC/B,CAAC;CACJ;AArOD,oCAqOC"}
@@ -0,0 +1,137 @@
1
+ import { EventEmitter } from "events";
2
+ import { LavalinkNode } from "./LavalinkNode";
3
+ import { Player } from "./Player";
4
+ import WebSocket from "ws";
5
+ import type { JoinData, VoiceServerUpdate, VoiceStateUpdate, DiscordPacket, ManagerOptions, JoinOptions, LavalinkNodeOptions } from "./Types";
6
+ /**
7
+ * The class that handles everything to do with Lavalink. it is the hub of the library basically
8
+ */
9
+ export declare class Manager extends EventEmitter {
10
+ /**
11
+ * A [**Map**](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) of Lavalink Nodes
12
+ */
13
+ nodes: Map<string, LavalinkNode>;
14
+ /**
15
+ * A [**Map**](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) of all the players
16
+ */
17
+ players: Map<string, Player>;
18
+ /**
19
+ * A [**Map**](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) of all the VOICE_SERVER_UPDATE States
20
+ */
21
+ voiceServers: Map<string, VoiceServerUpdate>;
22
+ /**
23
+ * A [**Map**](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) of all the VOICE_STATE_UPDATE States
24
+ */
25
+ voiceStates: Map<string, VoiceStateUpdate>;
26
+ /**
27
+ * The user id of the bot this Manager is managing
28
+ */
29
+ user: string;
30
+ /**
31
+ * The send function needs for the library to function
32
+ */
33
+ send?: (packet: DiscordPacket) => unknown;
34
+ /**
35
+ * The Player the manager will use when creating new Players
36
+ */
37
+ private Player;
38
+ /**
39
+ * An Set of all the expecting connections guild id's
40
+ */
41
+ private expecting;
42
+ /**
43
+ * The constructor of the Manager
44
+ * @param nodes A Array of {@link LavalinkNodeOptions} that the Manager will connect to
45
+ * @param options The options for the Manager {@link ManagerOptions}
46
+ */
47
+ constructor(nodes: Array<LavalinkNodeOptions>, options: ManagerOptions);
48
+ /**
49
+ * Connects all the {@link LavalinkNode} to the respective Lavalink instance
50
+ */
51
+ connect(): Promise<Array<WebSocket | boolean>>;
52
+ /**
53
+ * Disconnects everything, basically destorying the manager.
54
+ * Stops all players, leaves all voice channels then disconnects all LavalinkNodes
55
+ */
56
+ disconnect(): Promise<Array<boolean>>;
57
+ /**
58
+ * Creating a {@link LavalinkNode} and adds it to the the nodes Map
59
+ * @param options The node options of the node you're creating
60
+ */
61
+ createNode(options: LavalinkNodeOptions): LavalinkNode;
62
+ /**
63
+ * Disconnects and Deletes the specified node
64
+ * @param id The id of the node you want to remove
65
+ */
66
+ removeNode(id: string): boolean;
67
+ /**
68
+ * Connects the bot to the selected voice channel
69
+ * @param data The Join Data
70
+ * @param joinOptions Selfmute and Selfdeaf options, if you want the bot to be deafen or muted upon joining
71
+ */
72
+ join(data: JoinData, joinOptions?: JoinOptions): Promise<Player>;
73
+ /**
74
+ * Leaves the specified voice channel
75
+ * @param guild The guild you want the bot to leave the voice channel of
76
+ */
77
+ leave(guild: string): Promise<boolean>;
78
+ /**
79
+ * Switch a player from one node to another, this is to implement fallback
80
+ * @param player The player you want to switch nodes with
81
+ * @param node The node you want to switch to
82
+ */
83
+ switch(player: Player, node: LavalinkNode): Promise<Player>;
84
+ /**
85
+ * For handling voiceServerUpdate from the user's library of choice
86
+ * @param data The data directly from discord
87
+ */
88
+ voiceServerUpdate(data: VoiceServerUpdate): Promise<boolean>;
89
+ /**
90
+ * For handling voiceStateUpdate from the user's library of choice
91
+ * @param data The data directly from discord
92
+ */
93
+ voiceStateUpdate(data: VoiceStateUpdate): Promise<boolean>;
94
+ /**
95
+ * Just a utility method to easily send OPCode 4 websocket events to discord
96
+ * @param guild The guild is
97
+ * @param channel Voice channel id, or null to leave a voice channel
98
+ * @param param2 Selfmute and Selfdeaf options, if you want the bot to be deafen or muted upon joining
99
+ */
100
+ sendWS(guild: string, channel: string | null, { selfmute, selfdeaf }?: JoinOptions): any;
101
+ /**
102
+ * Gets all connected nodes, sorts them by cou load of the node
103
+ */
104
+ get idealNodes(): Array<LavalinkNode>;
105
+ /**
106
+ * Handles the data of voiceServerUpdate & voiceStateUpdate to see if a connection is possible with the data we have and if it is then make the connection to lavalink
107
+ * @param guildId The guild id that we're trying to attempt to connect to
108
+ */
109
+ private _attemptConnection;
110
+ /**
111
+ * This creates the {@link Player}
112
+ * @param data The Join Data, this is called by {@link Manager.join}
113
+ */
114
+ private spawnPlayer;
115
+ }
116
+ export interface ManagerEvents {
117
+ ready: [LavalinkNode];
118
+ raw: [unknown, LavalinkNode];
119
+ error: [unknown, LavalinkNode];
120
+ disconnect: [number, string, LavalinkNode];
121
+ reconnecting: [LavalinkNode];
122
+ }
123
+ export interface Manager {
124
+ addListener<E extends keyof ManagerEvents>(event: E, listener: (...args: ManagerEvents[E]) => any): this;
125
+ emit<E extends keyof ManagerEvents>(event: E, ...args: ManagerEvents[E]): boolean;
126
+ eventNames(): Array<keyof ManagerEvents>;
127
+ listenerCount(event: keyof ManagerEvents): number;
128
+ listeners(event: keyof ManagerEvents): Array<(...args: Array<any>) => any>;
129
+ off<E extends keyof ManagerEvents>(event: E, listener: (...args: ManagerEvents[E]) => any): this;
130
+ on<E extends keyof ManagerEvents>(event: E, listener: (...args: ManagerEvents[E]) => any): this;
131
+ once<E extends keyof ManagerEvents>(event: E, listener: (...args: ManagerEvents[E]) => any): this;
132
+ prependListener<E extends keyof ManagerEvents>(event: E, listener: (...args: ManagerEvents[E]) => any): this;
133
+ prependOnceListener<E extends keyof ManagerEvents>(event: E, listener: (...args: ManagerEvents[E]) => any): this;
134
+ rawListeners(event: keyof ManagerEvents): Array<(...args: Array<any>) => any>;
135
+ removeAllListeners(event?: keyof ManagerEvents): this;
136
+ removeListener<E extends keyof ManagerEvents>(event: E, listener: (...args: ManagerEvents[E]) => any): this;
137
+ }