lavalink-client 2.2.0 → 2.2.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.
- package/README.md +116 -15
- package/dist/cjs/structures/Filters.d.ts +1 -1
- package/dist/cjs/structures/Filters.js +9 -9
- package/dist/cjs/structures/LavalinkManager.d.ts +24 -7
- package/dist/cjs/structures/LavalinkManager.js +15 -2
- package/dist/cjs/structures/LavalinkManagerStatics.d.ts +3 -0
- package/dist/cjs/structures/LavalinkManagerStatics.js +4 -1
- package/dist/cjs/structures/Node.d.ts +307 -22
- package/dist/cjs/structures/Node.js +328 -72
- package/dist/cjs/structures/NodeManager.js +3 -1
- package/dist/cjs/structures/Player.d.ts +44 -8
- package/dist/cjs/structures/Player.js +27 -18
- package/dist/cjs/structures/Queue.d.ts +47 -0
- package/dist/cjs/structures/Queue.js +104 -1
- package/dist/cjs/structures/Track.d.ts +1 -0
- package/dist/cjs/structures/Utils.d.ts +3 -0
- package/dist/cjs/structures/Utils.js +6 -4
- package/dist/esm/structures/Filters.d.ts +1 -1
- package/dist/esm/structures/Filters.js +9 -9
- package/dist/esm/structures/LavalinkManager.d.ts +24 -7
- package/dist/esm/structures/LavalinkManager.js +15 -2
- package/dist/esm/structures/LavalinkManagerStatics.d.ts +3 -0
- package/dist/esm/structures/LavalinkManagerStatics.js +4 -1
- package/dist/esm/structures/Node.d.ts +307 -22
- package/dist/esm/structures/Node.js +328 -72
- package/dist/esm/structures/NodeManager.js +3 -1
- package/dist/esm/structures/Player.d.ts +44 -8
- package/dist/esm/structures/Player.js +27 -18
- package/dist/esm/structures/Queue.d.ts +47 -0
- package/dist/esm/structures/Queue.js +104 -1
- package/dist/esm/structures/Track.d.ts +1 -0
- package/dist/esm/structures/Utils.d.ts +3 -0
- package/dist/esm/structures/Utils.js +6 -4
- package/dist/types/structures/Filters.d.ts +1 -1
- package/dist/types/structures/LavalinkManager.d.ts +24 -7
- package/dist/types/structures/LavalinkManagerStatics.d.ts +3 -0
- package/dist/types/structures/Node.d.ts +307 -22
- package/dist/types/structures/Player.d.ts +44 -8
- package/dist/types/structures/Queue.d.ts +47 -0
- package/dist/types/structures/Track.d.ts +1 -0
- package/dist/types/structures/Utils.d.ts +3 -0
- package/package.json +2 -3
|
@@ -7,9 +7,13 @@ import { Base64, InvalidLavalinkRestRequest, LavalinkPlayer, LavaSearchQuery, La
|
|
|
7
7
|
/** Ability to manipulate fetch requests */
|
|
8
8
|
export type ModifyRequest = (options: RequestInit & {
|
|
9
9
|
path: string;
|
|
10
|
+
extraQueryUrlParams?: URLSearchParams;
|
|
10
11
|
}) => void;
|
|
11
12
|
export declare const validSponsorBlocks: string[];
|
|
12
13
|
export type SponsorBlockSegment = "sponsor" | "selfpromo" | "interaction" | "intro" | "outro" | "preview" | "music_offtopic" | "filler";
|
|
14
|
+
/**
|
|
15
|
+
* Node Options for creating a lavalink node
|
|
16
|
+
*/
|
|
13
17
|
export interface LavalinkNodeOptions {
|
|
14
18
|
/** The Lavalink Server-Ip / Domain-URL */
|
|
15
19
|
host: string;
|
|
@@ -32,6 +36,9 @@ export interface LavalinkNodeOptions {
|
|
|
32
36
|
/** signal for cancelling requests - default: AbortSignal.timeout(options.requestSignalTimeoutMS || 10000) - put <= 0 to disable */
|
|
33
37
|
requestSignalTimeoutMS?: number;
|
|
34
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* Memory Stats object from lavalink
|
|
41
|
+
*/
|
|
35
42
|
export interface MemoryStats {
|
|
36
43
|
/** The free memory of the allocated amount. */
|
|
37
44
|
free: number;
|
|
@@ -42,6 +49,9 @@ export interface MemoryStats {
|
|
|
42
49
|
/** The reservable memory. */
|
|
43
50
|
reservable: number;
|
|
44
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* CPU Stats object from lavalink
|
|
54
|
+
*/
|
|
45
55
|
export interface CPUStats {
|
|
46
56
|
/** The core amount the host machine has. */
|
|
47
57
|
cores: number;
|
|
@@ -50,6 +60,9 @@ export interface CPUStats {
|
|
|
50
60
|
/** The lavalink load. */
|
|
51
61
|
lavalinkLoad: number;
|
|
52
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* FrameStats Object from lavalink
|
|
65
|
+
*/
|
|
53
66
|
export interface FrameStats {
|
|
54
67
|
/** The amount of sent frames. */
|
|
55
68
|
sent?: number;
|
|
@@ -58,6 +71,9 @@ export interface FrameStats {
|
|
|
58
71
|
/** The amount of deficit frames. */
|
|
59
72
|
deficit?: number;
|
|
60
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* BaseNodeStats object from Lavalink
|
|
76
|
+
*/
|
|
61
77
|
export interface BaseNodeStats {
|
|
62
78
|
/** The amount of players on the node. */
|
|
63
79
|
players: number;
|
|
@@ -72,10 +88,16 @@ export interface BaseNodeStats {
|
|
|
72
88
|
/** The frame stats for the node. */
|
|
73
89
|
frameStats: FrameStats;
|
|
74
90
|
}
|
|
91
|
+
/**
|
|
92
|
+
* Interface for nodeStats from lavalink
|
|
93
|
+
*/
|
|
75
94
|
export interface NodeStats extends BaseNodeStats {
|
|
76
95
|
/** The frame stats for the node. */
|
|
77
96
|
frameStats: FrameStats;
|
|
78
97
|
}
|
|
98
|
+
/**
|
|
99
|
+
* Entire lavalink information object from lavalink
|
|
100
|
+
*/
|
|
79
101
|
export interface LavalinkInfo {
|
|
80
102
|
/** The version of this Lavalink server */
|
|
81
103
|
version: VersionObject;
|
|
@@ -94,6 +116,9 @@ export interface LavalinkInfo {
|
|
|
94
116
|
/** The enabled plugins for this server */
|
|
95
117
|
plugins: PluginObject[];
|
|
96
118
|
}
|
|
119
|
+
/**
|
|
120
|
+
* Lavalink's version object from lavalink
|
|
121
|
+
*/
|
|
97
122
|
export interface VersionObject {
|
|
98
123
|
/** The full version string of this Lavalink server */
|
|
99
124
|
semver: string;
|
|
@@ -108,6 +133,9 @@ export interface VersionObject {
|
|
|
108
133
|
/** The build metadata according to semver as a . separated list of identifiers */
|
|
109
134
|
build?: string;
|
|
110
135
|
}
|
|
136
|
+
/**
|
|
137
|
+
* Git information object from lavalink
|
|
138
|
+
*/
|
|
111
139
|
export interface GitObject {
|
|
112
140
|
/** The branch this Lavalink server was built on */
|
|
113
141
|
branch: string;
|
|
@@ -116,18 +144,26 @@ export interface GitObject {
|
|
|
116
144
|
/** The millisecond unix timestamp for when the commit was created */
|
|
117
145
|
commitTime: string;
|
|
118
146
|
}
|
|
147
|
+
/**
|
|
148
|
+
* Lavalink's plugins object from lavalink's plugin
|
|
149
|
+
*/
|
|
119
150
|
export interface PluginObject {
|
|
120
151
|
/** The name of the plugin */
|
|
121
152
|
name: string;
|
|
122
153
|
/** The version of the plugin */
|
|
123
154
|
version: string;
|
|
124
155
|
}
|
|
156
|
+
/**
|
|
157
|
+
* Lavalink Node creator class
|
|
158
|
+
*/
|
|
125
159
|
export declare class LavalinkNode {
|
|
126
160
|
/** The provided Options of the Node */
|
|
127
161
|
options: LavalinkNodeOptions;
|
|
128
162
|
/** The amount of rest calls the node has made. */
|
|
129
163
|
calls: number;
|
|
164
|
+
/** Stats from lavalink, will be updated via an interval by lavalink. */
|
|
130
165
|
stats: NodeStats;
|
|
166
|
+
/** The current sessionId, only present when connected */
|
|
131
167
|
sessionId?: string | null;
|
|
132
168
|
/** Wether the node resuming is enabled or not */
|
|
133
169
|
resuming: {
|
|
@@ -150,69 +186,199 @@ export declare class LavalinkNode {
|
|
|
150
186
|
* Create a new Node
|
|
151
187
|
* @param options Lavalink Node Options
|
|
152
188
|
* @param manager Node Manager
|
|
189
|
+
*
|
|
190
|
+
*
|
|
191
|
+
* @example
|
|
192
|
+
* ```ts
|
|
193
|
+
* // don't create a node manually, instead use:
|
|
194
|
+
*
|
|
195
|
+
* client.lavalink.nodeManager.createNode(options)
|
|
196
|
+
* ```
|
|
153
197
|
*/
|
|
154
198
|
constructor(options: LavalinkNodeOptions, manager: NodeManager);
|
|
199
|
+
/**
|
|
200
|
+
* Parse url params correctly for lavalink requests, including support for urls and uris.
|
|
201
|
+
* @param url input url object
|
|
202
|
+
* @param extraQueryUrlParams UrlSearchParams to use in a encodedURI, useful for example for flowertts
|
|
203
|
+
* @returns the url as a valid string
|
|
204
|
+
*
|
|
205
|
+
* @example
|
|
206
|
+
* ```ts
|
|
207
|
+
* player.node.getRequestingUrl(new URL(`http://localhost:2333/v4/loadtracks?identifier=Never gonna give you up`));
|
|
208
|
+
* ```
|
|
209
|
+
*/
|
|
210
|
+
private getRequestingUrl;
|
|
155
211
|
/**
|
|
156
212
|
* Raw Request util function
|
|
157
213
|
* @param endpoint endpoint string
|
|
158
214
|
* @param modify modify the request
|
|
159
|
-
* @
|
|
215
|
+
* @param extraQueryUrlParams UrlSearchParams to use in a encodedURI, useful for example for flowertts
|
|
216
|
+
* @returns object containing request and option information
|
|
217
|
+
*
|
|
218
|
+
* @example
|
|
219
|
+
* ```ts
|
|
220
|
+
* player.node.rawRequest(`/loadtracks?identifier=Never gonna give you up`, (options) => options.method = "GET");
|
|
221
|
+
* ```
|
|
160
222
|
*/
|
|
161
223
|
private rawRequest;
|
|
162
224
|
/**
|
|
163
|
-
* Makes an API call to the Node
|
|
225
|
+
* Makes an API call to the Node. Should only be used for manual parsing like for not supported plugins
|
|
164
226
|
* @param endpoint The endpoint that we will make the call to
|
|
165
227
|
* @param modify Used to modify the request before being sent
|
|
166
228
|
* @returns The returned data
|
|
229
|
+
*
|
|
230
|
+
* @example
|
|
231
|
+
* ```ts
|
|
232
|
+
* player.node.request(`/loadtracks?identifier=Never gonna give you up`, (options) => options.method = "GET", false);
|
|
233
|
+
* ```
|
|
167
234
|
*/
|
|
168
235
|
request(endpoint: string, modify?: ModifyRequest, parseAsText?: boolean): Promise<any>;
|
|
169
236
|
/**
|
|
170
237
|
* Search something raw on the node, please note only add tracks to players of that node
|
|
171
238
|
* @param query SearchQuery Object
|
|
172
239
|
* @param requestUser Request User for creating the player(s)
|
|
240
|
+
* @param throwOnEmpty Wether to throw on an empty result or not
|
|
173
241
|
* @returns Searchresult
|
|
242
|
+
*
|
|
243
|
+
* @example
|
|
244
|
+
* ```ts
|
|
245
|
+
* // use player.search() instead
|
|
246
|
+
* player.node.search({ query: "Never gonna give you up by Rick Astley", source: "soundcloud" }, interaction.user);
|
|
247
|
+
* player.node.search({ query: "https://deezer.com/track/123456789" }, interaction.user);
|
|
248
|
+
* ```
|
|
249
|
+
*/
|
|
250
|
+
search(query: SearchQuery, requestUser: unknown, throwOnEmpty?: boolean): Promise<SearchResult>;
|
|
251
|
+
/**
|
|
252
|
+
* Search something using the lavaSearchPlugin (filtered searches by types)
|
|
253
|
+
* @param query LavaSearchQuery Object
|
|
254
|
+
* @param requestUser Request User for creating the player(s)
|
|
255
|
+
* @param throwOnEmpty Wether to throw on an empty result or not
|
|
256
|
+
* @returns LavaSearchresult
|
|
257
|
+
*
|
|
258
|
+
* @example
|
|
259
|
+
* ```ts
|
|
260
|
+
* // use player.search() instead
|
|
261
|
+
* player.node.lavaSearch({ types: ["playlist", "album"], query: "Rick Astley", source: "spotify" }, interaction.user);
|
|
262
|
+
* ```
|
|
174
263
|
*/
|
|
175
|
-
search(query: SearchQuery, requestUser: unknown): Promise<SearchResult>;
|
|
176
264
|
lavaSearch(query: LavaSearchQuery, requestUser: unknown, throwOnEmpty?: boolean): Promise<SearchResult | LavaSearchResponse>;
|
|
177
265
|
/**
|
|
178
266
|
* Update the Player State on the Lavalink Server
|
|
179
|
-
* @param data
|
|
180
|
-
* @returns
|
|
267
|
+
* @param data data to send to lavalink and sync locally
|
|
268
|
+
* @returns result from lavalink
|
|
269
|
+
*
|
|
270
|
+
* @example
|
|
271
|
+
* ```ts
|
|
272
|
+
* // use player.search() instead
|
|
273
|
+
* player.node.updatePlayer({ guildId: player.guildId, playerOptions: { paused: true } }); // example to pause it
|
|
274
|
+
* ```
|
|
181
275
|
*/
|
|
182
276
|
updatePlayer(data: PlayerUpdateInfo): Promise<LavalinkPlayer>;
|
|
183
277
|
/**
|
|
184
278
|
* Destroys the Player on the Lavalink Server
|
|
185
279
|
* @param guildId
|
|
186
|
-
* @returns
|
|
280
|
+
* @returns request result
|
|
281
|
+
*
|
|
282
|
+
* @example
|
|
283
|
+
* ```ts
|
|
284
|
+
* // use player.destroy() instead
|
|
285
|
+
* player.node.destroyPlayer(player.guildId);
|
|
286
|
+
* ```
|
|
187
287
|
*/
|
|
188
288
|
destroyPlayer(guildId: any): Promise<any>;
|
|
189
289
|
/**
|
|
190
290
|
* Connect to the Lavalink Node
|
|
191
291
|
* @param sessionId Provide the Session Id of the previous connection, to resume the node and it's player(s)
|
|
192
|
-
* @returns
|
|
292
|
+
* @returns void
|
|
293
|
+
*
|
|
294
|
+
* @example
|
|
295
|
+
* ```ts
|
|
296
|
+
* player.node.connect(); // if provided on bootup in managerOptions#nodes, this will be called automatically when doing lavalink.init()
|
|
297
|
+
*
|
|
298
|
+
* // or connect from a resuming session:
|
|
299
|
+
* player.node.connect("sessionId");
|
|
300
|
+
* ```
|
|
193
301
|
*/
|
|
194
302
|
connect(sessionId?: string): void;
|
|
195
|
-
/**
|
|
303
|
+
/**
|
|
304
|
+
* Get the id of the node
|
|
305
|
+
*
|
|
306
|
+
* @example
|
|
307
|
+
* ```ts
|
|
308
|
+
* const nodeId = player.node.id;
|
|
309
|
+
* console.log("node id is: ", nodeId)
|
|
310
|
+
* ```
|
|
311
|
+
*/
|
|
196
312
|
get id(): string;
|
|
197
313
|
/**
|
|
198
314
|
* Destroys the Node-Connection (Websocket) and all player's of the node
|
|
199
|
-
* @
|
|
315
|
+
* @param destroyReason Destroyreason to use when destroying the players
|
|
316
|
+
* @param deleteNode wether to delete the nodte from the nodes list too, if false it will emit a disconnect. @default true
|
|
317
|
+
* @returns void
|
|
318
|
+
*
|
|
319
|
+
* @example
|
|
320
|
+
* ```ts
|
|
321
|
+
* player.node.destroy("custom Player Destroy Reason", true);
|
|
322
|
+
* ```
|
|
200
323
|
*/
|
|
201
324
|
destroy(destroyReason?: DestroyReasonsType, deleteNode?: boolean): void;
|
|
202
|
-
/**
|
|
325
|
+
/**
|
|
326
|
+
* Returns if connected to the Node.
|
|
327
|
+
*
|
|
328
|
+
* @example
|
|
329
|
+
* ```ts
|
|
330
|
+
* const isConnected = player.node.connected;
|
|
331
|
+
* console.log("node is connected: ", isConnected ? "yes" : "no")
|
|
332
|
+
* ```
|
|
333
|
+
*/
|
|
203
334
|
get connected(): boolean;
|
|
335
|
+
/**
|
|
336
|
+
* Returns the current ConnectionStatus
|
|
337
|
+
*
|
|
338
|
+
* @example
|
|
339
|
+
* ```ts
|
|
340
|
+
* try {
|
|
341
|
+
* const statusOfConnection = player.node.connectionStatus;
|
|
342
|
+
* console.log("node's connection status is:", statusOfConnection)
|
|
343
|
+
* } catch (error) {
|
|
344
|
+
* console.error("no socket available?", error)
|
|
345
|
+
* }
|
|
346
|
+
* ```
|
|
347
|
+
*/
|
|
348
|
+
get connectionStatus(): string;
|
|
204
349
|
/**
|
|
205
350
|
* Gets all Players of a Node
|
|
351
|
+
* @returns array of players inside of lavalink
|
|
352
|
+
*
|
|
353
|
+
* @example
|
|
354
|
+
* ```ts
|
|
355
|
+
* const node = lavalink.nodes.get("NODEID");
|
|
356
|
+
* const playersOfLavalink = await node?.fetchAllPlayers();
|
|
357
|
+
* ```
|
|
206
358
|
*/
|
|
207
359
|
fetchAllPlayers(): Promise<LavalinkPlayer[]>;
|
|
208
360
|
/**
|
|
209
361
|
* Gets specific Player Information
|
|
362
|
+
* @returns lavalink player object if player exists on lavalink
|
|
363
|
+
*
|
|
364
|
+
* @example
|
|
365
|
+
* ```ts
|
|
366
|
+
* const node = lavalink.nodes.get("NODEID");
|
|
367
|
+
* const playerInformation = await node?.fetchPlayer("guildId");
|
|
368
|
+
* ```
|
|
210
369
|
*/
|
|
211
370
|
fetchPlayer(guildId: string): Promise<LavalinkPlayer | InvalidLavalinkRestRequest>;
|
|
212
371
|
/**
|
|
213
372
|
* Updates the session with and enables/disables resuming and timeout
|
|
214
373
|
* @param resuming Whether resuming is enabled for this session or not
|
|
215
374
|
* @param timeout The timeout in seconds (default is 60s)
|
|
375
|
+
* @returns the result of the request
|
|
376
|
+
*
|
|
377
|
+
* @example
|
|
378
|
+
* ```ts
|
|
379
|
+
* const node = player.node || lavalink.nodes.get("NODEID");
|
|
380
|
+
* await node?.updateSession(true, 180e3); // will enable resuming for 180seconds
|
|
381
|
+
* ```
|
|
216
382
|
*/
|
|
217
383
|
updateSession(resuming?: boolean, timeout?: number): Promise<InvalidLavalinkRestRequest | Session>;
|
|
218
384
|
/**
|
|
@@ -220,31 +386,63 @@ export declare class LavalinkNode {
|
|
|
220
386
|
*/
|
|
221
387
|
decode: {
|
|
222
388
|
/**
|
|
223
|
-
* Decode a single track into its info
|
|
224
|
-
* @param encoded
|
|
225
|
-
* @
|
|
389
|
+
* Decode a single track into its info
|
|
390
|
+
* @param encoded valid encoded base64 string from a track
|
|
391
|
+
* @param requester the requesteruser for building the track
|
|
392
|
+
* @returns decoded track from lavalink
|
|
393
|
+
*
|
|
394
|
+
* @example
|
|
395
|
+
* ```ts
|
|
396
|
+
* const encodedBase64 = 'QAACDgMACk5vIERpZ2dpdHkAC0JsYWNrc3RyZWV0AAAAAAAEo4AABjkxNjQ5NgABAB9odHRwczovL2RlZXplci5jb20vdHJhY2svOTE2NDk2AQBpaHR0cHM6Ly9lLWNkbnMtaW1hZ2VzLmR6Y2RuLm5ldC9pbWFnZXMvY292ZXIvZGFlN2EyNjViNzlmYjcxMjc4Y2RlMjUwNDg0OWQ2ZjcvMTAwMHgxMDAwLTAwMDAwMC04MC0wLTAuanBnAQAMVVNJUjE5NjAwOTc4AAZkZWV6ZXIBAChObyBEaWdnaXR5OiBUaGUgVmVyeSBCZXN0IE9mIEJsYWNrc3RyZWV0AQAjaHR0cHM6Ly93d3cuZGVlemVyLmNvbS9hbGJ1bS8xMDMyNTQBACJodHRwczovL3d3dy5kZWV6ZXIuY29tL2FydGlzdC8xODYxAQBqaHR0cHM6Ly9lLWNkbnMtaW1hZ2VzLmR6Y2RuLm5ldC9pbWFnZXMvYXJ0aXN0L2YxNmNhYzM2ZmVjMzkxZjczN2I3ZDQ4MmY1YWM3M2UzLzEwMDB4MTAwMC0wMDAwMDAtODAtMC0wLmpwZwEAT2h0dHBzOi8vY2RuLXByZXZpZXctYS5kemNkbi5uZXQvc3RyZWFtL2MtYTE1Yjg1NzFhYTYyMDBjMDQ0YmY1OWM3NmVkOTEyN2MtNi5tcDMAAAAAAAAAAAA=';
|
|
397
|
+
* const track = await player.node.decode.singleTrack(encodedBase64, interaction.user);
|
|
398
|
+
* ```
|
|
226
399
|
*/
|
|
227
400
|
singleTrack: (encoded: Base64, requester: unknown) => Promise<Track>;
|
|
228
401
|
/**
|
|
402
|
+
* Decodes multiple tracks into their info
|
|
403
|
+
* @param encodeds valid encoded base64 string array from all tracks
|
|
404
|
+
* @param requester the requesteruser for building the tracks
|
|
405
|
+
* @returns array of all tracks you decoded
|
|
229
406
|
*
|
|
230
|
-
* @
|
|
231
|
-
*
|
|
407
|
+
* @example
|
|
408
|
+
* ```ts
|
|
409
|
+
* const encodedBase64_1 = 'QAACDgMACk5vIERpZ2dpdHkAC0JsYWNrc3RyZWV0AAAAAAAEo4AABjkxNjQ5NgABAB9odHRwczovL2RlZXplci5jb20vdHJhY2svOTE2NDk2AQBpaHR0cHM6Ly9lLWNkbnMtaW1hZ2VzLmR6Y2RuLm5ldC9pbWFnZXMvY292ZXIvZGFlN2EyNjViNzlmYjcxMjc4Y2RlMjUwNDg0OWQ2ZjcvMTAwMHgxMDAwLTAwMDAwMC04MC0wLTAuanBnAQAMVVNJUjE5NjAwOTc4AAZkZWV6ZXIBAChObyBEaWdnaXR5OiBUaGUgVmVyeSBCZXN0IE9mIEJsYWNrc3RyZWV0AQAjaHR0cHM6Ly93d3cuZGVlemVyLmNvbS9hbGJ1bS8xMDMyNTQBACJodHRwczovL3d3dy5kZWV6ZXIuY29tL2FydGlzdC8xODYxAQBqaHR0cHM6Ly9lLWNkbnMtaW1hZ2VzLmR6Y2RuLm5ldC9pbWFnZXMvYXJ0aXN0L2YxNmNhYzM2ZmVjMzkxZjczN2I3ZDQ4MmY1YWM3M2UzLzEwMDB4MTAwMC0wMDAwMDAtODAtMC0wLmpwZwEAT2h0dHBzOi8vY2RuLXByZXZpZXctYS5kemNkbi5uZXQvc3RyZWFtL2MtYTE1Yjg1NzFhYTYyMDBjMDQ0YmY1OWM3NmVkOTEyN2MtNi5tcDMAAAAAAAAAAAA=';
|
|
410
|
+
* const encodedBase64_2 = 'QAABJAMAClRhbGsgYSBMb3QACjQwNHZpbmNlbnQAAAAAAAHr1gBxTzpodHRwczovL2FwaS12Mi5zb3VuZGNsb3VkLmNvbS9tZWRpYS9zb3VuZGNsb3VkOnRyYWNrczo4NTE0MjEwNzYvMzUyYTRiOTAtNzYxOS00M2E5LWJiOGItMjIxMzE0YzFjNjNhL3N0cmVhbS9obHMAAQAsaHR0cHM6Ly9zb3VuZGNsb3VkLmNvbS80MDR2aW5jZW50L3RhbGstYS1sb3QBADpodHRwczovL2kxLnNuZGNkbi5jb20vYXJ0d29ya3MtRTN1ek5Gc0Y4QzBXLTAtb3JpZ2luYWwuanBnAQAMUVpITkExOTg1Nzg0AApzb3VuZGNsb3VkAAAAAAAAAAA=';
|
|
411
|
+
* const tracks = await player.node.decode.multipleTracks([encodedBase64_1, encodedBase64_2], interaction.user);
|
|
412
|
+
* ```
|
|
232
413
|
*/
|
|
233
414
|
multipleTracks: (encodeds: Base64[], requester: unknown) => Promise<Track[]>;
|
|
234
415
|
};
|
|
235
416
|
/**
|
|
236
417
|
* Request Lavalink statistics.
|
|
237
|
-
* @returns
|
|
418
|
+
* @returns the lavalink node stats
|
|
419
|
+
*
|
|
420
|
+
* @example
|
|
421
|
+
* ```ts
|
|
422
|
+
* const lavalinkStats = await player.node.fetchStats();
|
|
423
|
+
* ```
|
|
238
424
|
*/
|
|
239
425
|
fetchStats(): Promise<BaseNodeStats>;
|
|
240
426
|
/**
|
|
241
427
|
* Request Lavalink version.
|
|
242
|
-
* @returns
|
|
428
|
+
* @returns the current used lavalink version
|
|
429
|
+
*
|
|
430
|
+
* @example
|
|
431
|
+
* ```ts
|
|
432
|
+
* const lavalinkVersion = await player.node.fetchVersion();
|
|
433
|
+
* ```
|
|
243
434
|
*/
|
|
244
435
|
fetchVersion(): Promise<string>;
|
|
245
436
|
/**
|
|
246
437
|
* Request Lavalink information.
|
|
247
|
-
* @returns
|
|
438
|
+
* @returns lavalink info object
|
|
439
|
+
*
|
|
440
|
+
* @example
|
|
441
|
+
* ```ts
|
|
442
|
+
* const lavalinkInfo = await player.node.fetchInfo();
|
|
443
|
+
* const availablePlugins:string[] = lavalinkInfo.plugins.map(plugin => plugin.name);
|
|
444
|
+
* const availableSources:string[] = lavalinkInfo.sourceManagers;
|
|
445
|
+
* ```
|
|
248
446
|
*/
|
|
249
447
|
fetchInfo(): Promise<LavalinkInfo>;
|
|
250
448
|
/**
|
|
@@ -252,40 +450,127 @@ export declare class LavalinkNode {
|
|
|
252
450
|
*/
|
|
253
451
|
routePlannerApi: {
|
|
254
452
|
/**
|
|
255
|
-
* Get routplanner Info from Lavalink
|
|
453
|
+
* Get routplanner Info from Lavalink for ip rotation
|
|
454
|
+
* @returns the status of the routeplanner
|
|
455
|
+
*
|
|
456
|
+
* @example
|
|
457
|
+
* ```ts
|
|
458
|
+
* const routePlannerStatus = await player.node.routePlannerApi.getStatus();
|
|
459
|
+
* const usedBlock = routePlannerStatus.details?.ipBlock;
|
|
460
|
+
* const currentIp = routePlannerStatus.currentAddress;
|
|
461
|
+
* ```
|
|
256
462
|
*/
|
|
257
463
|
getStatus: () => Promise<RoutePlanner>;
|
|
258
464
|
/**
|
|
259
|
-
* Release blacklisted IP address into pool of IPs
|
|
465
|
+
* Release blacklisted IP address into pool of IPs for ip rotation
|
|
260
466
|
* @param address IP address
|
|
467
|
+
* @returns request data of the request
|
|
468
|
+
*
|
|
469
|
+
* @example
|
|
470
|
+
* ```ts
|
|
471
|
+
* await player.node.routePlannerApi.unmarkFailedAddress("ipv6address");
|
|
472
|
+
* ```
|
|
261
473
|
*/
|
|
262
474
|
unmarkFailedAddress: (address: string) => Promise<void>;
|
|
263
475
|
/**
|
|
264
476
|
* Release all blacklisted IP addresses into pool of IPs
|
|
477
|
+
* @returns request data of the request
|
|
478
|
+
*
|
|
479
|
+
* @example
|
|
480
|
+
* ```ts
|
|
481
|
+
* await player.node.routePlannerApi.unmarkAllFailedAddresses();
|
|
482
|
+
* ```
|
|
265
483
|
*/
|
|
266
484
|
unmarkAllFailedAddresses: () => Promise<any>;
|
|
267
485
|
};
|
|
268
|
-
/**
|
|
486
|
+
/** @private Utils for validating the */
|
|
269
487
|
private validate;
|
|
488
|
+
/**
|
|
489
|
+
* Sync the data of the player you make an action to lavalink to
|
|
490
|
+
* @param data data to use to update the player
|
|
491
|
+
* @param res result data from lavalink, to override, if available
|
|
492
|
+
* @returns boolean
|
|
493
|
+
*/
|
|
270
494
|
private syncPlayerData;
|
|
495
|
+
/**
|
|
496
|
+
* Get the rest Adress for making requests
|
|
497
|
+
*/
|
|
271
498
|
private get restAddress();
|
|
499
|
+
/**
|
|
500
|
+
* Reconnect to the lavalink node
|
|
501
|
+
* @param instaReconnect @default false wether to instantly try to reconnect
|
|
502
|
+
* @returns void
|
|
503
|
+
*
|
|
504
|
+
* @example
|
|
505
|
+
* ```ts
|
|
506
|
+
* await player.node.reconnect();
|
|
507
|
+
* ```
|
|
508
|
+
*/
|
|
272
509
|
private reconnect;
|
|
510
|
+
/** @private util function for handling opening events from websocket */
|
|
273
511
|
private open;
|
|
512
|
+
/** @private util function for handling closing events from websocket */
|
|
274
513
|
private close;
|
|
514
|
+
/** @private util function for handling error events from websocket */
|
|
275
515
|
private error;
|
|
516
|
+
/** @private util function for handling message events from websocket */
|
|
276
517
|
private message;
|
|
518
|
+
/** @private middleware util function for handling all kind of events from websocket */
|
|
277
519
|
private handleEvent;
|
|
520
|
+
/** @private util function for handling trackStart event */
|
|
278
521
|
private trackStart;
|
|
522
|
+
/** @private util function for handling trackEnd event */
|
|
279
523
|
private trackEnd;
|
|
524
|
+
/** @private util function for handling trackStuck event */
|
|
280
525
|
private trackStuck;
|
|
526
|
+
/** @private util function for handling trackError event */
|
|
281
527
|
private trackError;
|
|
528
|
+
/** @private util function for handling socketClosed event */
|
|
282
529
|
private socketClosed;
|
|
530
|
+
/** @private util function for handling SponsorBlock Segmentloaded event */
|
|
283
531
|
private SponsorBlockSegmentLoaded;
|
|
284
|
-
private
|
|
532
|
+
/** @private util function for handling SponsorBlock SegmentSkipped event */
|
|
533
|
+
private SponsorBlockSegmentSkipped;
|
|
534
|
+
/** @private util function for handling SponsorBlock Chaptersloaded event */
|
|
285
535
|
private SponsorBlockChaptersLoaded;
|
|
536
|
+
/** @private util function for handling SponsorBlock Chaptersstarted event */
|
|
286
537
|
private SponsorBlockChapterStarted;
|
|
538
|
+
/**
|
|
539
|
+
* Get the current sponsorblocks for the sponsorblock plugin
|
|
540
|
+
* @param player passthrough the player
|
|
541
|
+
* @returns sponsorblock seggment from lavalink
|
|
542
|
+
*
|
|
543
|
+
* @example
|
|
544
|
+
* ```ts
|
|
545
|
+
* // use it on the player via player.getSponsorBlock();
|
|
546
|
+
* const sponsorBlockSegments = await player.node.getSponsorBlock(player);
|
|
547
|
+
* ```
|
|
548
|
+
*/
|
|
287
549
|
getSponsorBlock(player: Player): Promise<SponsorBlockSegment[]>;
|
|
550
|
+
/**
|
|
551
|
+
* Set the current sponsorblocks for the sponsorblock plugin
|
|
552
|
+
* @param player passthrough the player
|
|
553
|
+
* @returns void
|
|
554
|
+
*
|
|
555
|
+
* @example
|
|
556
|
+
* ```ts
|
|
557
|
+
* // use it on the player via player.setSponsorBlock();
|
|
558
|
+
* const sponsorBlockSegments = await player.node.setSponsorBlock(player, ["sponsor", "selfpromo"]);
|
|
559
|
+
* ```
|
|
560
|
+
*/
|
|
288
561
|
setSponsorBlock(player: Player, segments?: SponsorBlockSegment[]): Promise<void>;
|
|
562
|
+
/**
|
|
563
|
+
* Delete the sponsorblock plugins
|
|
564
|
+
* @param player passthrough the player
|
|
565
|
+
* @returns void
|
|
566
|
+
*
|
|
567
|
+
* @example
|
|
568
|
+
* ```ts
|
|
569
|
+
* // use it on the player via player.deleteSponsorBlock();
|
|
570
|
+
* const sponsorBlockSegments = await player.node.deleteSponsorBlock(player);
|
|
571
|
+
* ```
|
|
572
|
+
*/
|
|
289
573
|
deleteSponsorBlock(player: Player): Promise<void>;
|
|
574
|
+
/** private util function for handling the queue end event */
|
|
290
575
|
private queueEnd;
|
|
291
576
|
}
|