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,523 +0,0 @@
|
|
|
1
|
-
import type { Base64, InvalidLavalinkRestRequest, LavalinkPlayer, LavaSearchQuery, LavaSearchResponse, PlayerUpdateInfo, RoutePlanner, SearchQuery, SearchResult, Session } from "./Types/Utils";
|
|
2
|
-
import type { Player } from "./Player";
|
|
3
|
-
import type { DestroyReasonsType, DisconnectReasonsType } from "./Types/Player";
|
|
4
|
-
import type { Track } from "./Types/Track";
|
|
5
|
-
import type { NodeManager } from "./NodeManager";
|
|
6
|
-
import type { BaseNodeStats, LavalinkInfo, LavalinkNodeOptions, LyricsResult, ModifyRequest, NodeStats, SponsorBlockSegment } from "./Types/Node";
|
|
7
|
-
/**
|
|
8
|
-
* Lavalink Node creator class
|
|
9
|
-
*/
|
|
10
|
-
export declare class LavalinkNode {
|
|
11
|
-
private heartBeatPingTimestamp;
|
|
12
|
-
private heartBeatPongTimestamp;
|
|
13
|
-
get heartBeatPing(): number;
|
|
14
|
-
private heartBeatInterval?;
|
|
15
|
-
private pingTimeout?;
|
|
16
|
-
isAlive: boolean;
|
|
17
|
-
/** The provided Options of the Node */
|
|
18
|
-
options: LavalinkNodeOptions;
|
|
19
|
-
/** The amount of rest calls the node has made. */
|
|
20
|
-
calls: number;
|
|
21
|
-
/** Stats from lavalink, will be updated via an interval by lavalink. */
|
|
22
|
-
stats: NodeStats;
|
|
23
|
-
/** The current sessionId, only present when connected */
|
|
24
|
-
sessionId?: string | null;
|
|
25
|
-
/** Wether the node resuming is enabled or not */
|
|
26
|
-
resuming: {
|
|
27
|
-
enabled: boolean;
|
|
28
|
-
timeout: number | null;
|
|
29
|
-
};
|
|
30
|
-
/** Actual Lavalink Information of the Node */
|
|
31
|
-
info: LavalinkInfo | null;
|
|
32
|
-
/** The Node Manager of this Node */
|
|
33
|
-
private NodeManager;
|
|
34
|
-
/** The Reconnection Timeout */
|
|
35
|
-
private reconnectTimeout?;
|
|
36
|
-
/** The Reconnection Attempt counter */
|
|
37
|
-
private reconnectAttempts;
|
|
38
|
-
/** The Socket of the Lavalink */
|
|
39
|
-
private socket;
|
|
40
|
-
/** Version of what the Lavalink Server should be */
|
|
41
|
-
private version;
|
|
42
|
-
/**
|
|
43
|
-
* Create a new Node
|
|
44
|
-
* @param options Lavalink Node Options
|
|
45
|
-
* @param manager Node Manager
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
* @example
|
|
49
|
-
* ```ts
|
|
50
|
-
* // don't create a node manually, instead use:
|
|
51
|
-
*
|
|
52
|
-
* client.lavalink.nodeManager.createNode(options)
|
|
53
|
-
* ```
|
|
54
|
-
*/
|
|
55
|
-
constructor(options: LavalinkNodeOptions, manager: NodeManager);
|
|
56
|
-
/**
|
|
57
|
-
* Raw Request util function
|
|
58
|
-
* @param endpoint endpoint string
|
|
59
|
-
* @param modify modify the request
|
|
60
|
-
* @param extraQueryUrlParams UrlSearchParams to use in a encodedURI, useful for example for flowertts
|
|
61
|
-
* @returns object containing request and option information
|
|
62
|
-
*
|
|
63
|
-
* @example
|
|
64
|
-
* ```ts
|
|
65
|
-
* player.node.rawRequest(`/loadtracks?identifier=Never gonna give you up`, (options) => options.method = "GET");
|
|
66
|
-
* ```
|
|
67
|
-
*/
|
|
68
|
-
private rawRequest;
|
|
69
|
-
/**
|
|
70
|
-
* Makes an API call to the Node. Should only be used for manual parsing like for not supported plugins
|
|
71
|
-
* @param endpoint The endpoint that we will make the call to
|
|
72
|
-
* @param modify Used to modify the request before being sent
|
|
73
|
-
* @returns The returned data
|
|
74
|
-
*
|
|
75
|
-
* @example
|
|
76
|
-
* ```ts
|
|
77
|
-
* player.node.request(`/loadtracks?identifier=Never gonna give you up`, (options) => options.method = "GET", false);
|
|
78
|
-
* ```
|
|
79
|
-
*/
|
|
80
|
-
request(endpoint: string, modify: ModifyRequest | undefined, parseAsText: true): Promise<string>;
|
|
81
|
-
request(endpoint: string, modify?: ModifyRequest, parseAsText?: false): Promise<any>;
|
|
82
|
-
/**
|
|
83
|
-
* Search something raw on the node, please note only add tracks to players of that node
|
|
84
|
-
* @param query SearchQuery Object
|
|
85
|
-
* @param requestUser Request User for creating the player(s)
|
|
86
|
-
* @param throwOnEmpty Wether to throw on an empty result or not
|
|
87
|
-
* @returns Searchresult
|
|
88
|
-
*
|
|
89
|
-
* @example
|
|
90
|
-
* ```ts
|
|
91
|
-
* // use player.search() instead
|
|
92
|
-
* player.node.search({ query: "Never gonna give you up by Rick Astley", source: "soundcloud" }, interaction.user);
|
|
93
|
-
* player.node.search({ query: "https://deezer.com/track/123456789" }, interaction.user);
|
|
94
|
-
* ```
|
|
95
|
-
*/
|
|
96
|
-
search(query: SearchQuery, requestUser: unknown, throwOnEmpty?: boolean): Promise<SearchResult>;
|
|
97
|
-
/**
|
|
98
|
-
* Search something using the lavaSearchPlugin (filtered searches by types)
|
|
99
|
-
* @param query LavaSearchQuery Object
|
|
100
|
-
* @param requestUser Request User for creating the player(s)
|
|
101
|
-
* @param throwOnEmpty Wether to throw on an empty result or not
|
|
102
|
-
* @returns LavaSearchresult (SearchResult if link is provided)
|
|
103
|
-
*
|
|
104
|
-
* @example
|
|
105
|
-
* ```ts
|
|
106
|
-
* // use player.search() instead
|
|
107
|
-
* player.node.lavaSearch({ types: ["playlist", "album"], query: "Rick Astley", source: "spotify" }, interaction.user);
|
|
108
|
-
* ```
|
|
109
|
-
*/
|
|
110
|
-
lavaSearch(query: LavaSearchQuery, requestUser: unknown, throwOnEmpty?: boolean): Promise<LavaSearchResponse | SearchResult>;
|
|
111
|
-
/**
|
|
112
|
-
* Update the Player State on the Lavalink Server
|
|
113
|
-
* @param data data to send to lavalink and sync locally
|
|
114
|
-
* @returns result from lavalink
|
|
115
|
-
*
|
|
116
|
-
* @example
|
|
117
|
-
* ```ts
|
|
118
|
-
* // use player.search() instead
|
|
119
|
-
* player.node.updatePlayer({ guildId: player.guildId, playerOptions: { paused: true } }); // example to pause it
|
|
120
|
-
* ```
|
|
121
|
-
*/
|
|
122
|
-
updatePlayer(data: PlayerUpdateInfo): Promise<LavalinkPlayer>;
|
|
123
|
-
/**
|
|
124
|
-
* Destroys the Player on the Lavalink Server
|
|
125
|
-
* @param guildId
|
|
126
|
-
* @returns request result
|
|
127
|
-
*
|
|
128
|
-
* @example
|
|
129
|
-
* ```ts
|
|
130
|
-
* // use player.destroy() instead
|
|
131
|
-
* player.node.destroyPlayer(player.guildId);
|
|
132
|
-
* ```
|
|
133
|
-
*/
|
|
134
|
-
destroyPlayer(guildId: any): Promise<void>;
|
|
135
|
-
/**
|
|
136
|
-
* Connect to the Lavalink Node
|
|
137
|
-
* @param sessionId Provide the Session Id of the previous connection, to resume the node and it's player(s)
|
|
138
|
-
* @returns void
|
|
139
|
-
*
|
|
140
|
-
* @example
|
|
141
|
-
* ```ts
|
|
142
|
-
* player.node.connect(); // if provided on bootup in managerOptions#nodes, this will be called automatically when doing lavalink.init()
|
|
143
|
-
*
|
|
144
|
-
* // or connect from a resuming session:
|
|
145
|
-
* player.node.connect("sessionId");
|
|
146
|
-
* ```
|
|
147
|
-
*/
|
|
148
|
-
connect(sessionId?: string): void;
|
|
149
|
-
private heartBeat;
|
|
150
|
-
/**
|
|
151
|
-
* Get the id of the node
|
|
152
|
-
*
|
|
153
|
-
* @example
|
|
154
|
-
* ```ts
|
|
155
|
-
* const nodeId = player.node.id;
|
|
156
|
-
* console.log("node id is: ", nodeId)
|
|
157
|
-
* ```
|
|
158
|
-
*/
|
|
159
|
-
get id(): string;
|
|
160
|
-
/**
|
|
161
|
-
* Destroys the Node-Connection (Websocket) and all player's of the node
|
|
162
|
-
* @param destroyReason Destroy Reason to use when destroying the players
|
|
163
|
-
* @param deleteNode wether to delete the nodte from the nodes list too, if false it will emit a disconnect. @default true
|
|
164
|
-
* @param movePlayers whether to movePlayers to different eligible connected node. If false players won't be moved @default false
|
|
165
|
-
* @returns void
|
|
166
|
-
*
|
|
167
|
-
* @example
|
|
168
|
-
* Destroys node and its players
|
|
169
|
-
* ```ts
|
|
170
|
-
* player.node.destroy("custom Player Destroy Reason", true);
|
|
171
|
-
* ```
|
|
172
|
-
* destroys only the node and moves its players to different connected node.
|
|
173
|
-
* ```ts
|
|
174
|
-
* player.node.destroy("custom Player Destroy Reason", true, true);
|
|
175
|
-
* ```
|
|
176
|
-
*/
|
|
177
|
-
destroy(destroyReason?: DestroyReasonsType, deleteNode?: boolean, movePlayers?: boolean): void;
|
|
178
|
-
/**
|
|
179
|
-
* Disconnects the Node-Connection (Websocket)
|
|
180
|
-
* @param disconnectReason Disconnect Reason to use when disconnecting Node
|
|
181
|
-
* @returns void
|
|
182
|
-
*
|
|
183
|
-
* Also the node will not get re-connected again.
|
|
184
|
-
*
|
|
185
|
-
* @example
|
|
186
|
-
* ```ts
|
|
187
|
-
* player.node.destroy("custom Player Destroy Reason", true);
|
|
188
|
-
* ```
|
|
189
|
-
*/
|
|
190
|
-
disconnect(disconnectReason?: DisconnectReasonsType): void;
|
|
191
|
-
/**
|
|
192
|
-
* Returns if connected to the Node.
|
|
193
|
-
*
|
|
194
|
-
* @example
|
|
195
|
-
* ```ts
|
|
196
|
-
* const isConnected = player.node.connected;
|
|
197
|
-
* console.log("node is connected: ", isConnected ? "yes" : "no")
|
|
198
|
-
* ```
|
|
199
|
-
*/
|
|
200
|
-
get connected(): boolean;
|
|
201
|
-
/**
|
|
202
|
-
* Returns the current ConnectionStatus
|
|
203
|
-
*
|
|
204
|
-
* @example
|
|
205
|
-
* ```ts
|
|
206
|
-
* try {
|
|
207
|
-
* const statusOfConnection = player.node.connectionStatus;
|
|
208
|
-
* console.log("node's connection status is:", statusOfConnection)
|
|
209
|
-
* } catch (error) {
|
|
210
|
-
* console.error("no socket available?", error)
|
|
211
|
-
* }
|
|
212
|
-
* ```
|
|
213
|
-
*/
|
|
214
|
-
get connectionStatus(): string;
|
|
215
|
-
/**
|
|
216
|
-
* Gets all Players of a Node
|
|
217
|
-
* @returns array of players inside of lavalink
|
|
218
|
-
*
|
|
219
|
-
* @example
|
|
220
|
-
* ```ts
|
|
221
|
-
* const node = lavalink.nodes.get("NODEID");
|
|
222
|
-
* const playersOfLavalink = await node?.fetchAllPlayers();
|
|
223
|
-
* ```
|
|
224
|
-
*/
|
|
225
|
-
fetchAllPlayers(): Promise<LavalinkPlayer[] | InvalidLavalinkRestRequest | null>;
|
|
226
|
-
/**
|
|
227
|
-
* Gets specific Player Information
|
|
228
|
-
* @returns lavalink player object if player exists on lavalink
|
|
229
|
-
*
|
|
230
|
-
* @example
|
|
231
|
-
* ```ts
|
|
232
|
-
* const node = lavalink.nodes.get("NODEID");
|
|
233
|
-
* const playerInformation = await node?.fetchPlayer("guildId");
|
|
234
|
-
* ```
|
|
235
|
-
*/
|
|
236
|
-
fetchPlayer(guildId: string): Promise<LavalinkPlayer | InvalidLavalinkRestRequest | null>;
|
|
237
|
-
/**
|
|
238
|
-
* Updates the session with and enables/disables resuming and timeout
|
|
239
|
-
* @param resuming Whether resuming is enabled for this session or not
|
|
240
|
-
* @param timeout The timeout in seconds (default is 60s)
|
|
241
|
-
* @returns the result of the request
|
|
242
|
-
*
|
|
243
|
-
* @example
|
|
244
|
-
* ```ts
|
|
245
|
-
* const node = player.node || lavalink.nodes.get("NODEID");
|
|
246
|
-
* await node?.updateSession(true, 180e3); // will enable resuming for 180seconds
|
|
247
|
-
* ```
|
|
248
|
-
*/
|
|
249
|
-
updateSession(resuming?: boolean, timeout?: number): Promise<Session | InvalidLavalinkRestRequest | null>;
|
|
250
|
-
/**
|
|
251
|
-
* Decode Track or Tracks
|
|
252
|
-
*/
|
|
253
|
-
decode: {
|
|
254
|
-
/**
|
|
255
|
-
* Decode a single track into its info
|
|
256
|
-
* @param encoded valid encoded base64 string from a track
|
|
257
|
-
* @param requester the requesteruser for building the track
|
|
258
|
-
* @returns decoded track from lavalink
|
|
259
|
-
*
|
|
260
|
-
* @example
|
|
261
|
-
* ```ts
|
|
262
|
-
* const encodedBase64 = 'QAACDgMACk5vIERpZ2dpdHkAC0JsYWNrc3RyZWV0AAAAAAAEo4AABjkxNjQ5NgABAB9odHRwczovL2RlZXplci5jb20vdHJhY2svOTE2NDk2AQBpaHR0cHM6Ly9lLWNkbnMtaW1hZ2VzLmR6Y2RuLm5ldC9pbWFnZXMvY292ZXIvZGFlN2EyNjViNzlmYjcxMjc4Y2RlMjUwNDg0OWQ2ZjcvMTAwMHgxMDAwLTAwMDAwMC04MC0wLTAuanBnAQAMVVNJUjE5NjAwOTc4AAZkZWV6ZXIBAChObyBEaWdnaXR5OiBUaGUgVmVyeSBCZXN0IE9mIEJsYWNrc3RyZWV0AQAjaHR0cHM6Ly93d3cuZGVlemVyLmNvbS9hbGJ1bS8xMDMyNTQBACJodHRwczovL3d3dy5kZWV6ZXIuY29tL2FydGlzdC8xODYxAQBqaHR0cHM6Ly9lLWNkbnMtaW1hZ2VzLmR6Y2RuLm5ldC9pbWFnZXMvYXJ0aXN0L2YxNmNhYzM2ZmVjMzkxZjczN2I3ZDQ4MmY1YWM3M2UzLzEwMDB4MTAwMC0wMDAwMDAtODAtMC0wLmpwZwEAT2h0dHBzOi8vY2RuLXByZXZpZXctYS5kemNkbi5uZXQvc3RyZWFtL2MtYTE1Yjg1NzFhYTYyMDBjMDQ0YmY1OWM3NmVkOTEyN2MtNi5tcDMAAAAAAAAAAAA=';
|
|
263
|
-
* const track = await player.node.decode.singleTrack(encodedBase64, interaction.user);
|
|
264
|
-
* ```
|
|
265
|
-
*/
|
|
266
|
-
singleTrack: (encoded: Base64, requester: unknown) => Promise<Track>;
|
|
267
|
-
/**
|
|
268
|
-
* Decodes multiple tracks into their info
|
|
269
|
-
* @param encodeds valid encoded base64 string array from all tracks
|
|
270
|
-
* @param requester the requesteruser for building the tracks
|
|
271
|
-
* @returns array of all tracks you decoded
|
|
272
|
-
*
|
|
273
|
-
* @example
|
|
274
|
-
* ```ts
|
|
275
|
-
* const encodedBase64_1 = 'QAACDgMACk5vIERpZ2dpdHkAC0JsYWNrc3RyZWV0AAAAAAAEo4AABjkxNjQ5NgABAB9odHRwczovL2RlZXplci5jb20vdHJhY2svOTE2NDk2AQBpaHR0cHM6Ly9lLWNkbnMtaW1hZ2VzLmR6Y2RuLm5ldC9pbWFnZXMvY292ZXIvZGFlN2EyNjViNzlmYjcxMjc4Y2RlMjUwNDg0OWQ2ZjcvMTAwMHgxMDAwLTAwMDAwMC04MC0wLTAuanBnAQAMVVNJUjE5NjAwOTc4AAZkZWV6ZXIBAChObyBEaWdnaXR5OiBUaGUgVmVyeSBCZXN0IE9mIEJsYWNrc3RyZWV0AQAjaHR0cHM6Ly93d3cuZGVlemVyLmNvbS9hbGJ1bS8xMDMyNTQBACJodHRwczovL3d3dy5kZWV6ZXIuY29tL2FydGlzdC8xODYxAQBqaHR0cHM6Ly9lLWNkbnMtaW1hZ2VzLmR6Y2RuLm5ldC9pbWFnZXMvYXJ0aXN0L2YxNmNhYzM2ZmVjMzkxZjczN2I3ZDQ4MmY1YWM3M2UzLzEwMDB4MTAwMC0wMDAwMDAtODAtMC0wLmpwZwEAT2h0dHBzOi8vY2RuLXByZXZpZXctYS5kemNkbi5uZXQvc3RyZWFtL2MtYTE1Yjg1NzFhYTYyMDBjMDQ0YmY1OWM3NmVkOTEyN2MtNi5tcDMAAAAAAAAAAAA=';
|
|
276
|
-
* const encodedBase64_2 = 'QAABJAMAClRhbGsgYSBMb3QACjQwNHZpbmNlbnQAAAAAAAHr1gBxTzpodHRwczovL2FwaS12Mi5zb3VuZGNsb3VkLmNvbS9tZWRpYS9zb3VuZGNsb3VkOnRyYWNrczo4NTE0MjEwNzYvMzUyYTRiOTAtNzYxOS00M2E5LWJiOGItMjIxMzE0YzFjNjNhL3N0cmVhbS9obHMAAQAsaHR0cHM6Ly9zb3VuZGNsb3VkLmNvbS80MDR2aW5jZW50L3RhbGstYS1sb3QBADpodHRwczovL2kxLnNuZGNkbi5jb20vYXJ0d29ya3MtRTN1ek5Gc0Y4QzBXLTAtb3JpZ2luYWwuanBnAQAMUVpITkExOTg1Nzg0AApzb3VuZGNsb3VkAAAAAAAAAAA=';
|
|
277
|
-
* const tracks = await player.node.decode.multipleTracks([encodedBase64_1, encodedBase64_2], interaction.user);
|
|
278
|
-
* ```
|
|
279
|
-
*/
|
|
280
|
-
multipleTracks: (encodeds: Base64[], requester: unknown) => Promise<Track[]>;
|
|
281
|
-
};
|
|
282
|
-
lyrics: {
|
|
283
|
-
/**
|
|
284
|
-
* Get the lyrics of a track
|
|
285
|
-
* @param track the track to get the lyrics for
|
|
286
|
-
* @param skipTrackSource wether to skip the track source or not
|
|
287
|
-
* @returns the lyrics of the track
|
|
288
|
-
* @example
|
|
289
|
-
*
|
|
290
|
-
* ```ts
|
|
291
|
-
* const lyrics = await player.node.lyrics.get(track, true);
|
|
292
|
-
* // use it of player instead:
|
|
293
|
-
* // const lyrics = await player.getLyrics(track, true);
|
|
294
|
-
* ```
|
|
295
|
-
*/
|
|
296
|
-
get: (track: Track, skipTrackSource?: boolean) => Promise<LyricsResult | null>;
|
|
297
|
-
/**
|
|
298
|
-
* Get the lyrics of the current playing track
|
|
299
|
-
*
|
|
300
|
-
* @param guildId the guild id of the player
|
|
301
|
-
* @param skipTrackSource wether to skip the track source or not
|
|
302
|
-
* @returns the lyrics of the current playing track
|
|
303
|
-
* @example
|
|
304
|
-
* ```ts
|
|
305
|
-
* const lyrics = await player.node.lyrics.getCurrent(guildId);
|
|
306
|
-
* // use it of player instead:
|
|
307
|
-
* // const lyrics = await player.getCurrentLyrics();
|
|
308
|
-
* ```
|
|
309
|
-
*/
|
|
310
|
-
getCurrent: (guildId: string, skipTrackSource?: boolean) => Promise<LyricsResult | null>;
|
|
311
|
-
/**
|
|
312
|
-
* subscribe to lyrics updates for a guild
|
|
313
|
-
* @param guildId the guild id of the player
|
|
314
|
-
* @returns request data of the request
|
|
315
|
-
*
|
|
316
|
-
* @example
|
|
317
|
-
* ```ts
|
|
318
|
-
* await player.node.lyrics.subscribe(guildId);
|
|
319
|
-
* // use it of player instead:
|
|
320
|
-
* // const lyrics = await player.subscribeLyrics();
|
|
321
|
-
* ```
|
|
322
|
-
*/
|
|
323
|
-
subscribe: (guildId: string) => Promise<unknown>;
|
|
324
|
-
/**
|
|
325
|
-
* unsubscribe from lyrics updates for a guild
|
|
326
|
-
* @param guildId the guild id of the player
|
|
327
|
-
* @returns request data of the request
|
|
328
|
-
*
|
|
329
|
-
* @example
|
|
330
|
-
* ```ts
|
|
331
|
-
* await player.node.lyrics.unsubscribe(guildId);
|
|
332
|
-
* // use it of player instead:
|
|
333
|
-
* // const lyrics = await player.unsubscribeLyrics();
|
|
334
|
-
* ```
|
|
335
|
-
*/
|
|
336
|
-
unsubscribe: (guildId: string) => Promise<void>;
|
|
337
|
-
};
|
|
338
|
-
/**
|
|
339
|
-
* Request Lavalink statistics.
|
|
340
|
-
* @returns the lavalink node stats
|
|
341
|
-
*
|
|
342
|
-
* @example
|
|
343
|
-
* ```ts
|
|
344
|
-
* const lavalinkStats = await player.node.fetchStats();
|
|
345
|
-
* ```
|
|
346
|
-
*/
|
|
347
|
-
fetchStats(): Promise<BaseNodeStats>;
|
|
348
|
-
/**
|
|
349
|
-
* Request Lavalink version.
|
|
350
|
-
* @returns the current used lavalink version
|
|
351
|
-
*
|
|
352
|
-
* @example
|
|
353
|
-
* ```ts
|
|
354
|
-
* const lavalinkVersion = await player.node.fetchVersion();
|
|
355
|
-
* ```
|
|
356
|
-
*/
|
|
357
|
-
fetchVersion(): Promise<string>;
|
|
358
|
-
/**
|
|
359
|
-
* Request Lavalink information.
|
|
360
|
-
* @returns lavalink info object
|
|
361
|
-
*
|
|
362
|
-
* @example
|
|
363
|
-
* ```ts
|
|
364
|
-
* const lavalinkInfo = await player.node.fetchInfo();
|
|
365
|
-
* const availablePlugins:string[] = lavalinkInfo.plugins.map(plugin => plugin.name);
|
|
366
|
-
* const availableSources:string[] = lavalinkInfo.sourceManagers;
|
|
367
|
-
* ```
|
|
368
|
-
*/
|
|
369
|
-
fetchInfo(): Promise<LavalinkInfo>;
|
|
370
|
-
/**
|
|
371
|
-
* Lavalink's Route Planner Api
|
|
372
|
-
*/
|
|
373
|
-
routePlannerApi: {
|
|
374
|
-
/**
|
|
375
|
-
* Get routplanner Info from Lavalink for ip rotation
|
|
376
|
-
* @returns the status of the routeplanner
|
|
377
|
-
*
|
|
378
|
-
* @example
|
|
379
|
-
* ```ts
|
|
380
|
-
* const routePlannerStatus = await player.node.routePlannerApi.getStatus();
|
|
381
|
-
* const usedBlock = routePlannerStatus.details?.ipBlock;
|
|
382
|
-
* const currentIp = routePlannerStatus.currentAddress;
|
|
383
|
-
* ```
|
|
384
|
-
*/
|
|
385
|
-
getStatus: () => Promise<RoutePlanner>;
|
|
386
|
-
/**
|
|
387
|
-
* Release blacklisted IP address into pool of IPs for ip rotation
|
|
388
|
-
* @param address IP address
|
|
389
|
-
* @returns request data of the request
|
|
390
|
-
*
|
|
391
|
-
* @example
|
|
392
|
-
* ```ts
|
|
393
|
-
* await player.node.routePlannerApi.unmarkFailedAddress("ipv6address");
|
|
394
|
-
* ```
|
|
395
|
-
*/
|
|
396
|
-
unmarkFailedAddress: (address: string) => Promise<unknown>;
|
|
397
|
-
/**
|
|
398
|
-
* Release all blacklisted IP addresses into pool of IPs
|
|
399
|
-
* @returns request data of the request
|
|
400
|
-
*
|
|
401
|
-
* @example
|
|
402
|
-
* ```ts
|
|
403
|
-
* await player.node.routePlannerApi.unmarkAllFailedAddresses();
|
|
404
|
-
* ```
|
|
405
|
-
*/
|
|
406
|
-
unmarkAllFailedAddresses: () => Promise<unknown>;
|
|
407
|
-
};
|
|
408
|
-
/** @private Utils for validating the */
|
|
409
|
-
private validate;
|
|
410
|
-
/**
|
|
411
|
-
* Sync the data of the player you make an action to lavalink to
|
|
412
|
-
* @param data data to use to update the player
|
|
413
|
-
* @param res result data from lavalink, to override, if available
|
|
414
|
-
* @returns boolean
|
|
415
|
-
*/
|
|
416
|
-
private syncPlayerData;
|
|
417
|
-
/**
|
|
418
|
-
* Get the rest Adress for making requests
|
|
419
|
-
*/
|
|
420
|
-
private get restAddress();
|
|
421
|
-
/**
|
|
422
|
-
* Reconnect to the lavalink node
|
|
423
|
-
* @param instaReconnect @default false wether to instantly try to reconnect
|
|
424
|
-
* @returns void
|
|
425
|
-
*
|
|
426
|
-
* @example
|
|
427
|
-
* ```ts
|
|
428
|
-
* await player.node.reconnect();
|
|
429
|
-
* ```
|
|
430
|
-
*/
|
|
431
|
-
private reconnect;
|
|
432
|
-
/** @private util function for handling opening events from websocket */
|
|
433
|
-
private open;
|
|
434
|
-
/** @private util function for handling closing events from websocket */
|
|
435
|
-
private close;
|
|
436
|
-
/** @private util function for handling error events from websocket */
|
|
437
|
-
private error;
|
|
438
|
-
/** @private util function for handling message events from websocket */
|
|
439
|
-
private message;
|
|
440
|
-
/** @private middleware util function for handling all kind of events from websocket */
|
|
441
|
-
private handleEvent;
|
|
442
|
-
private getTrackOfPayload;
|
|
443
|
-
/** @private util function for handling trackStart event */
|
|
444
|
-
private trackStart;
|
|
445
|
-
/** @private util function for handling trackEnd event */
|
|
446
|
-
private trackEnd;
|
|
447
|
-
/** @private util function for handling trackStuck event */
|
|
448
|
-
private trackStuck;
|
|
449
|
-
/** @private util function for handling trackError event */
|
|
450
|
-
private trackError;
|
|
451
|
-
/** @private util function for handling socketClosed event */
|
|
452
|
-
private socketClosed;
|
|
453
|
-
/** @private util function for handling SponsorBlock Segmentloaded event */
|
|
454
|
-
private SponsorBlockSegmentLoaded;
|
|
455
|
-
/** @private util function for handling SponsorBlock SegmentSkipped event */
|
|
456
|
-
private SponsorBlockSegmentSkipped;
|
|
457
|
-
/** @private util function for handling SponsorBlock Chaptersloaded event */
|
|
458
|
-
private SponsorBlockChaptersLoaded;
|
|
459
|
-
/** @private util function for handling SponsorBlock Chaptersstarted event */
|
|
460
|
-
private SponsorBlockChapterStarted;
|
|
461
|
-
/**
|
|
462
|
-
* Get the current sponsorblocks for the sponsorblock plugin
|
|
463
|
-
* @param player passthrough the player
|
|
464
|
-
* @returns sponsorblock seggment from lavalink
|
|
465
|
-
*
|
|
466
|
-
* @example
|
|
467
|
-
* ```ts
|
|
468
|
-
* // use it on the player via player.getSponsorBlock();
|
|
469
|
-
* const sponsorBlockSegments = await player.node.getSponsorBlock(player);
|
|
470
|
-
* ```
|
|
471
|
-
*/
|
|
472
|
-
getSponsorBlock(player: Player): Promise<SponsorBlockSegment[]>;
|
|
473
|
-
/**
|
|
474
|
-
* Set the current sponsorblocks for the sponsorblock plugin
|
|
475
|
-
* @param player passthrough the player
|
|
476
|
-
* @returns void
|
|
477
|
-
*
|
|
478
|
-
* @example
|
|
479
|
-
* ```ts
|
|
480
|
-
* // use it on the player via player.setSponsorBlock();
|
|
481
|
-
* const sponsorBlockSegments = await player.node.setSponsorBlock(player, ["sponsor", "selfpromo"]);
|
|
482
|
-
* ```
|
|
483
|
-
*/
|
|
484
|
-
setSponsorBlock(player: Player, segments?: SponsorBlockSegment[]): Promise<void>;
|
|
485
|
-
/**
|
|
486
|
-
* Delete the sponsorblock plugins
|
|
487
|
-
* @param player passthrough the player
|
|
488
|
-
* @returns void
|
|
489
|
-
*
|
|
490
|
-
* @example
|
|
491
|
-
* ```ts
|
|
492
|
-
* // use it on the player via player.deleteSponsorBlock();
|
|
493
|
-
* const sponsorBlockSegments = await player.node.deleteSponsorBlock(player);
|
|
494
|
-
* ```
|
|
495
|
-
*/
|
|
496
|
-
deleteSponsorBlock(player: Player): Promise<void>;
|
|
497
|
-
/** private util function for handling the queue end event */
|
|
498
|
-
private queueEnd;
|
|
499
|
-
/**
|
|
500
|
-
* Emitted whenever a line of lyrics gets emitted
|
|
501
|
-
* @event
|
|
502
|
-
* @param {Player} player The player that emitted the event
|
|
503
|
-
* @param {Track} track The track that emitted the event
|
|
504
|
-
* @param {LyricsLineEvent} payload The payload of the event
|
|
505
|
-
*/
|
|
506
|
-
private LyricsLine;
|
|
507
|
-
/**
|
|
508
|
-
* Emitted whenever the lyrics for a track got found
|
|
509
|
-
* @event
|
|
510
|
-
* @param {Player} player The player that emitted the event
|
|
511
|
-
* @param {Track} track The track that emitted the event
|
|
512
|
-
* @param {LyricsFoundEvent} payload The payload of the event
|
|
513
|
-
*/
|
|
514
|
-
private LyricsFound;
|
|
515
|
-
/**
|
|
516
|
-
* Emitted whenever the lyrics for a track got not found
|
|
517
|
-
* @event
|
|
518
|
-
* @param {Player} player The player that emitted the event
|
|
519
|
-
* @param {Track} track The track that emitted the event
|
|
520
|
-
* @param {LyricsNotFoundEvent} payload The payload of the event
|
|
521
|
-
*/
|
|
522
|
-
private LyricsNotFound;
|
|
523
|
-
}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { EventEmitter } from "events";
|
|
2
|
-
import { LavalinkNode } from "./Node";
|
|
3
|
-
import { MiniMap } from "./Utils";
|
|
4
|
-
import type { LavalinkNodeIdentifier, LavalinkNodeOptions, NodeManagerEvents } from "./Types/Node";
|
|
5
|
-
import type { LavalinkManager } from "./LavalinkManager";
|
|
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
|
-
}
|