magmastream 2.9.0-dev.27 → 2.9.0-dev.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1622 -1245
- package/dist/index.js +8 -0
- package/dist/structures/Enums.js +200 -0
- package/dist/structures/Manager.js +92 -175
- package/dist/structures/Node.js +64 -80
- package/dist/structures/Player.js +74 -107
- package/dist/structures/Queue.js +24 -24
- package/dist/structures/RedisQueue.js +21 -21
- package/dist/structures/Rest.js +6 -6
- package/dist/structures/Types.js +3 -0
- package/dist/structures/Utils.js +152 -138
- package/dist/utils/managerCheck.js +8 -8
- package/dist/wrappers/detritus.js +36 -0
- package/dist/wrappers/discord.js.js +29 -0
- package/dist/wrappers/eris.js +29 -0
- package/dist/wrappers/oceanic.js +29 -0
- package/package.json +7 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import { User, ClientUser, Message } from 'discord.js';
|
|
2
|
-
import WebSocket from 'ws';
|
|
3
1
|
import { Collection } from '@discordjs/collection';
|
|
2
|
+
import { GatewayVoiceStateUpdate } from 'discord-api-types/v10';
|
|
4
3
|
import { EventEmitter } from 'events';
|
|
4
|
+
import WebSocket from 'ws';
|
|
5
|
+
import { User, ClientUser, Message, Client } from 'discord.js';
|
|
5
6
|
import { Redis } from 'ioredis';
|
|
7
|
+
import { Client as Client$1 } from 'eris';
|
|
8
|
+
import { ClusterClient, ShardClient } from 'detritus-client';
|
|
9
|
+
import { Client as Client$2 } from 'oceanic.js';
|
|
6
10
|
|
|
7
11
|
/** Represents an equalizer band. */
|
|
8
12
|
interface Band {
|
|
@@ -24,7 +28,7 @@ declare class Rest {
|
|
|
24
28
|
private readonly url;
|
|
25
29
|
/** The Manager instance. */
|
|
26
30
|
manager: Manager;
|
|
27
|
-
constructor(node: Node, manager: Manager);
|
|
31
|
+
constructor(node: Node$1, manager: Manager);
|
|
28
32
|
/**
|
|
29
33
|
* Sets the session ID.
|
|
30
34
|
* This method is used to set the session ID after a resume operation is done.
|
|
@@ -130,6 +134,180 @@ interface playOptions {
|
|
|
130
134
|
};
|
|
131
135
|
}
|
|
132
136
|
|
|
137
|
+
/**
|
|
138
|
+
* State Storage Enum
|
|
139
|
+
*/
|
|
140
|
+
declare enum StateStorageType {
|
|
141
|
+
Collection = "collection",
|
|
142
|
+
Redis = "redis"
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* AutoPlay Platform Enum
|
|
146
|
+
*/
|
|
147
|
+
declare enum AutoPlayPlatform {
|
|
148
|
+
Spotify = "spotify",
|
|
149
|
+
Deezer = "deezer",
|
|
150
|
+
SoundCloud = "soundcloud",
|
|
151
|
+
Tidal = "tidal",
|
|
152
|
+
VKMusic = "vkmusic",
|
|
153
|
+
Qobuz = "qobuz",
|
|
154
|
+
YouTube = "youtube"
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* State Types Enum
|
|
158
|
+
*/
|
|
159
|
+
declare enum StateTypes {
|
|
160
|
+
Connected = "CONNECTED",
|
|
161
|
+
Connecting = "CONNECTING",
|
|
162
|
+
Disconnected = "DISCONNECTED",
|
|
163
|
+
Disconnecting = "DISCONNECTING",
|
|
164
|
+
Destroying = "DESTROYING"
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Load Types Enum
|
|
168
|
+
*/
|
|
169
|
+
declare enum LoadTypes {
|
|
170
|
+
Track = "track",
|
|
171
|
+
Playlist = "playlist",
|
|
172
|
+
Search = "search",
|
|
173
|
+
Empty = "empty",
|
|
174
|
+
Error = "error"
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Search Platform Enum
|
|
178
|
+
*/
|
|
179
|
+
declare enum SearchPlatform {
|
|
180
|
+
AppleMusic = "amsearch",
|
|
181
|
+
Bandcamp = "bcsearch",
|
|
182
|
+
Deezer = "dzsearch",
|
|
183
|
+
Jiosaavn = "jssearch",
|
|
184
|
+
Qobuz = "qbsearch",
|
|
185
|
+
SoundCloud = "scsearch",
|
|
186
|
+
Spotify = "spsearch",
|
|
187
|
+
Tidal = "tdsearch",
|
|
188
|
+
VKMusic = "vksearch",
|
|
189
|
+
YouTube = "ytsearch",
|
|
190
|
+
YouTubeMusic = "ytmsearch"
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Player State Event Types Enum
|
|
194
|
+
*/
|
|
195
|
+
declare enum PlayerStateEventTypes {
|
|
196
|
+
AutoPlayChange = "playerAutoplay",
|
|
197
|
+
ConnectionChange = "playerConnection",
|
|
198
|
+
RepeatChange = "playerRepeat",
|
|
199
|
+
PauseChange = "playerPause",
|
|
200
|
+
QueueChange = "queueChange",
|
|
201
|
+
TrackChange = "trackChange",
|
|
202
|
+
VolumeChange = "volumeChange",
|
|
203
|
+
ChannelChange = "channelChange",
|
|
204
|
+
PlayerCreate = "playerCreate",
|
|
205
|
+
PlayerDestroy = "playerDestroy"
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Track Source Types Enum
|
|
209
|
+
*/
|
|
210
|
+
declare enum TrackSourceTypes {
|
|
211
|
+
AppleMusic = "applemusic",
|
|
212
|
+
Bandcamp = "bandcamp",
|
|
213
|
+
Deezer = "deezer",
|
|
214
|
+
Jiosaavn = "jiosaavn",
|
|
215
|
+
SoundCloud = "soundcloud",
|
|
216
|
+
Spotify = "spotify",
|
|
217
|
+
Tidal = "tidal",
|
|
218
|
+
VKMusic = "vkmusic",
|
|
219
|
+
YouTube = "youtube"
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Use Node Options Enum
|
|
223
|
+
*/
|
|
224
|
+
declare enum UseNodeOptions {
|
|
225
|
+
LeastLoad = "leastLoad",
|
|
226
|
+
LeastPlayers = "leastPlayers"
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Track Partial Enum
|
|
230
|
+
*/
|
|
231
|
+
declare enum TrackPartial {
|
|
232
|
+
/** The base64 encoded string of the track */
|
|
233
|
+
Track = "track",
|
|
234
|
+
/** The title of the track */
|
|
235
|
+
Title = "title",
|
|
236
|
+
/** The track identifier */
|
|
237
|
+
Identifier = "identifier",
|
|
238
|
+
/** The author of the track */
|
|
239
|
+
Author = "author",
|
|
240
|
+
/** The length of the track in milliseconds */
|
|
241
|
+
Duration = "duration",
|
|
242
|
+
/** The ISRC of the track */
|
|
243
|
+
Isrc = "isrc",
|
|
244
|
+
/** Whether the track is seekable */
|
|
245
|
+
IsSeekable = "isSeekable",
|
|
246
|
+
/** Whether the track is a stream */
|
|
247
|
+
IsStream = "isStream",
|
|
248
|
+
/** The URI of the track */
|
|
249
|
+
Uri = "uri",
|
|
250
|
+
/** The artwork URL of the track */
|
|
251
|
+
ArtworkUrl = "artworkUrl",
|
|
252
|
+
/** The source name of the track */
|
|
253
|
+
SourceName = "sourceName",
|
|
254
|
+
/** The thumbnail of the track */
|
|
255
|
+
ThumbNail = "thumbnail",
|
|
256
|
+
/** The requester of the track */
|
|
257
|
+
Requester = "requester",
|
|
258
|
+
/** The plugin info of the track */
|
|
259
|
+
PluginInfo = "pluginInfo",
|
|
260
|
+
/** The custom data of the track */
|
|
261
|
+
CustomData = "customData"
|
|
262
|
+
}
|
|
263
|
+
declare enum ManagerEventTypes {
|
|
264
|
+
ChapterStarted = "chapterStarted",
|
|
265
|
+
ChaptersLoaded = "chaptersLoaded",
|
|
266
|
+
Debug = "debug",
|
|
267
|
+
NodeConnect = "nodeConnect",
|
|
268
|
+
NodeCreate = "nodeCreate",
|
|
269
|
+
NodeDestroy = "nodeDestroy",
|
|
270
|
+
NodeDisconnect = "nodeDisconnect",
|
|
271
|
+
NodeError = "nodeError",
|
|
272
|
+
NodeRaw = "nodeRaw",
|
|
273
|
+
NodeReconnect = "nodeReconnect",
|
|
274
|
+
PlayerCreate = "playerCreate",
|
|
275
|
+
PlayerDestroy = "playerDestroy",
|
|
276
|
+
PlayerDisconnect = "playerDisconnect",
|
|
277
|
+
PlayerMove = "playerMove",
|
|
278
|
+
PlayerRestored = "playerRestored",
|
|
279
|
+
PlayerStateUpdate = "playerStateUpdate",
|
|
280
|
+
QueueEnd = "queueEnd",
|
|
281
|
+
RestoreComplete = "restoreComplete",
|
|
282
|
+
SegmentSkipped = "segmentSkipped",
|
|
283
|
+
SegmentsLoaded = "segmentsLoaded",
|
|
284
|
+
SocketClosed = "socketClosed",
|
|
285
|
+
TrackEnd = "trackEnd",
|
|
286
|
+
TrackError = "trackError",
|
|
287
|
+
TrackStart = "trackStart",
|
|
288
|
+
TrackStuck = "trackStuck"
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Track End Reason Enum
|
|
292
|
+
*/
|
|
293
|
+
declare enum TrackEndReasonTypes {
|
|
294
|
+
Finished = "finished",
|
|
295
|
+
LoadFailed = "loadFailed",
|
|
296
|
+
Stopped = "stopped",
|
|
297
|
+
Replaced = "replaced",
|
|
298
|
+
Cleanup = "cleanup"
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Severity Types Enum
|
|
302
|
+
*/
|
|
303
|
+
declare enum SeverityTypes {
|
|
304
|
+
Common = "common",
|
|
305
|
+
Suspicious = "suspicious",
|
|
306
|
+
Fault = "fault"
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* SponsorBlock Segment Enum
|
|
310
|
+
*/
|
|
133
311
|
declare enum SponsorBlockSegment {
|
|
134
312
|
Sponsor = "sponsor",
|
|
135
313
|
SelfPromo = "selfpromo",
|
|
@@ -140,632 +318,359 @@ declare enum SponsorBlockSegment {
|
|
|
140
318
|
MusicOfftopic = "music_offtopic",
|
|
141
319
|
Filler = "filler"
|
|
142
320
|
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* The player's queue, the `current` property is the currently playing track, think of the rest as the up-coming tracks.
|
|
324
|
+
*/
|
|
325
|
+
declare class Queue extends Array<Track> implements IQueue {
|
|
326
|
+
/** The current track */
|
|
327
|
+
current: Track | null;
|
|
328
|
+
/** The previous tracks */
|
|
329
|
+
previous: Track[];
|
|
330
|
+
/** The Manager instance. */
|
|
150
331
|
manager: Manager;
|
|
151
|
-
/** The
|
|
152
|
-
|
|
153
|
-
/** The REST instance. */
|
|
154
|
-
readonly rest: Rest;
|
|
155
|
-
/** Actual Lavalink information of the node. */
|
|
156
|
-
info: LavalinkInfo | null;
|
|
157
|
-
private static _manager;
|
|
158
|
-
private reconnectTimeout?;
|
|
159
|
-
private reconnectAttempts;
|
|
332
|
+
/** The guild ID property. */
|
|
333
|
+
guildId: string;
|
|
160
334
|
/**
|
|
161
|
-
*
|
|
162
|
-
* @param
|
|
335
|
+
* Constructs a new Queue.
|
|
336
|
+
* @param guildId The guild ID.
|
|
337
|
+
* @param manager The Manager instance.
|
|
163
338
|
*/
|
|
164
|
-
constructor(
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
339
|
+
constructor(guildId: string, manager: Manager);
|
|
340
|
+
getCurrent(): Promise<Track | null>;
|
|
341
|
+
setCurrent(track: Track | null): Promise<void>;
|
|
342
|
+
getPrevious(): Promise<Track[]>;
|
|
343
|
+
addPrevious(track: Track | Track[]): Promise<void>;
|
|
344
|
+
setPrevious(tracks: Track[]): Promise<void>;
|
|
345
|
+
popPrevious(): Promise<Track | null>;
|
|
346
|
+
clearPrevious(): Promise<void>;
|
|
171
347
|
/**
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
* the node when resuming a session.
|
|
348
|
+
* The total duration of the queue in milliseconds.
|
|
349
|
+
* This includes the duration of the currently playing track.
|
|
175
350
|
*/
|
|
176
|
-
|
|
351
|
+
duration(): Promise<number>;
|
|
177
352
|
/**
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
* The session IDs are stored in the sessionIds.json file as a composite key
|
|
182
|
-
* of the node identifier and cluster ID. This allows multiple clusters to
|
|
183
|
-
* be used with the same node identifier.
|
|
353
|
+
* The total size of tracks in the queue including the current track.
|
|
354
|
+
* This includes the current track if it is not null.
|
|
355
|
+
* @returns The total size of tracks in the queue including the current track.
|
|
184
356
|
*/
|
|
185
|
-
|
|
357
|
+
totalSize(): Promise<number>;
|
|
186
358
|
/**
|
|
187
|
-
*
|
|
188
|
-
*
|
|
189
|
-
*
|
|
190
|
-
* writes the new session ID to the sessionIds.json file.
|
|
191
|
-
*
|
|
192
|
-
* @remarks
|
|
193
|
-
* The session ID is stored in the sessionIds.json file as a composite key
|
|
194
|
-
* of the node identifier and cluster ID. This allows multiple clusters to
|
|
195
|
-
* be used with the same node identifier.
|
|
359
|
+
* The size of tracks in the queue.
|
|
360
|
+
* This does not include the currently playing track.
|
|
361
|
+
* @returns The size of tracks in the queue.
|
|
196
362
|
*/
|
|
197
|
-
|
|
363
|
+
size(): Promise<number>;
|
|
198
364
|
/**
|
|
199
|
-
*
|
|
200
|
-
*
|
|
201
|
-
* @
|
|
202
|
-
* If the node is already connected, this method will do nothing.
|
|
203
|
-
* If the node has a session ID, it will be sent in the headers of the WebSocket connection.
|
|
204
|
-
* If the node has no session ID but the `enableSessionResumeOption` option is true, it will use the session ID
|
|
205
|
-
* stored in the sessionIds.json file if it exists.
|
|
365
|
+
* Adds a track to the queue.
|
|
366
|
+
* @param track The track or tracks to add. Can be a single `Track` or an array of `Track`s.
|
|
367
|
+
* @param [offset=null] The position to add the track(s) at. If not provided, the track(s) will be added at the end of the queue.
|
|
206
368
|
*/
|
|
207
|
-
|
|
369
|
+
add(track: Track | Track[], offset?: number): Promise<void>;
|
|
208
370
|
/**
|
|
209
|
-
*
|
|
210
|
-
*
|
|
211
|
-
*
|
|
212
|
-
*
|
|
213
|
-
*
|
|
214
|
-
* Finally, it emits a "nodeDestroy" event and removes the node from the manager.
|
|
215
|
-
*
|
|
216
|
-
* @returns {Promise<void>} A promise that resolves when the node and its resources have been destroyed.
|
|
217
|
-
*/
|
|
218
|
-
destroy(): Promise<void>;
|
|
219
|
-
/**
|
|
220
|
-
* Attempts to reconnect to the node if the connection is lost.
|
|
221
|
-
*
|
|
222
|
-
* This method is called when the WebSocket connection is closed
|
|
223
|
-
* unexpectedly. It will attempt to reconnect to the node after a
|
|
224
|
-
* specified delay, and will continue to do so until the maximum
|
|
225
|
-
* number of retry attempts is reached or the node is manually destroyed.
|
|
226
|
-
* If the maximum number of retry attempts is reached, an error event
|
|
227
|
-
* will be emitted and the node will be destroyed.
|
|
228
|
-
*
|
|
229
|
-
* @returns {Promise<void>} - Resolves when the reconnection attempt is scheduled.
|
|
230
|
-
* @emits {debug} - Emits a debug event indicating the node is attempting to reconnect.
|
|
231
|
-
* @emits {nodeReconnect} - Emits a nodeReconnect event when the node is attempting to reconnect.
|
|
232
|
-
* @emits {nodeError} - Emits an error event if the maximum number of retry attempts is reached.
|
|
233
|
-
* @emits {nodeDestroy} - Emits a nodeDestroy event if the maximum number of retry attempts is reached.
|
|
371
|
+
* Removes track(s) from the queue.
|
|
372
|
+
* @param startOrPosition If a single number is provided, it will be treated as the position of the track to remove.
|
|
373
|
+
* If two numbers are provided, they will be used as the start and end of a range of tracks to remove.
|
|
374
|
+
* @param end Optional, end of the range of tracks to remove.
|
|
375
|
+
* @returns The removed track(s).
|
|
234
376
|
*/
|
|
235
|
-
|
|
377
|
+
remove(position?: number): Promise<Track[]>;
|
|
378
|
+
remove(start: number, end: number): Promise<Track[]>;
|
|
236
379
|
/**
|
|
237
|
-
*
|
|
238
|
-
*
|
|
239
|
-
* This method is called when the WebSocket connection is established.
|
|
240
|
-
* It clears any existing reconnect timeouts, emits a debug event
|
|
241
|
-
* indicating the node is connected, and emits a "nodeConnect" event
|
|
242
|
-
* with the node as the argument.
|
|
380
|
+
* Clears the queue.
|
|
381
|
+
* This will remove all tracks from the queue and emit a state update event.
|
|
243
382
|
*/
|
|
244
|
-
|
|
383
|
+
clear(): Promise<void>;
|
|
245
384
|
/**
|
|
246
|
-
*
|
|
247
|
-
*
|
|
248
|
-
* This method is called when the WebSocket connection is closed.
|
|
249
|
-
* It emits a "nodeDisconnect" event with the node and the close event as arguments,
|
|
250
|
-
* and a debug event indicating the node is disconnected.
|
|
251
|
-
* It then attempts to move all players connected to that node to a useable one.
|
|
252
|
-
* If the close event was not initiated by the user, it will also attempt to reconnect.
|
|
253
|
-
*
|
|
254
|
-
* @param {number} code The close code of the WebSocket connection.
|
|
255
|
-
* @param {string} reason The reason for the close event.
|
|
256
|
-
* @returns {Promise<void>} A promise that resolves when the disconnection is handled.
|
|
385
|
+
* Shuffles the queue.
|
|
386
|
+
* This will randomize the order of the tracks in the queue and emit a state update event.
|
|
257
387
|
*/
|
|
258
|
-
|
|
388
|
+
shuffle(): Promise<void>;
|
|
259
389
|
/**
|
|
260
|
-
*
|
|
261
|
-
*
|
|
262
|
-
* This method is called when an error occurs on the WebSocket connection.
|
|
263
|
-
* It emits a "nodeError" event with the node and the error as arguments and
|
|
264
|
-
* a debug event indicating the error on the node.
|
|
265
|
-
* @param {Error} error The error that occurred.
|
|
390
|
+
* Shuffles the queue to play tracks requested by each user one block at a time.
|
|
266
391
|
*/
|
|
267
|
-
|
|
392
|
+
userBlockShuffle(): Promise<void>;
|
|
268
393
|
/**
|
|
269
|
-
*
|
|
270
|
-
* @param {Buffer | string} d The message received from the WebSocket connection.
|
|
271
|
-
* @returns {Promise<void>} A promise that resolves when the message is handled.
|
|
272
|
-
* @emits {debug} - Emits a debug event with the message received from the WebSocket connection.
|
|
273
|
-
* @emits {nodeError} - Emits a nodeError event if an unexpected op is received.
|
|
274
|
-
* @emits {nodeRaw} - Emits a nodeRaw event with the raw message received from the WebSocket connection.
|
|
275
|
-
* @private
|
|
394
|
+
* Shuffles the queue to play tracks requested by each user one by one.
|
|
276
395
|
*/
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
396
|
+
roundRobinShuffle(): Promise<void>;
|
|
397
|
+
dequeue(): Promise<Track | undefined>;
|
|
398
|
+
enqueueFront(track: Track | Track[]): Promise<void>;
|
|
399
|
+
getTracks(): Promise<Track[]>;
|
|
400
|
+
getSlice(start?: number, end?: number): Promise<Track[]>;
|
|
401
|
+
modifyAt(start: number, deleteCount?: number, ...items: Track[]): Promise<Track[]>;
|
|
402
|
+
mapAsync<T>(callback: (track: Track, index: number, array: Track[]) => T): Promise<T[]>;
|
|
403
|
+
filterAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<Track[]>;
|
|
404
|
+
findAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<Track | undefined>;
|
|
405
|
+
someAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<boolean>;
|
|
406
|
+
everyAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<boolean>;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* Manager Options
|
|
411
|
+
*/
|
|
412
|
+
interface ManagerOptions {
|
|
413
|
+
/** The state storage options.
|
|
414
|
+
*
|
|
415
|
+
* @default { type: StateStorageType.Collection }
|
|
283
416
|
*/
|
|
284
|
-
|
|
285
|
-
/**
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
*
|
|
417
|
+
stateStorage?: StateStorageOptions;
|
|
418
|
+
/** Enable priority mode over least player count or load balancing? */
|
|
419
|
+
enablePriorityMode?: boolean;
|
|
420
|
+
/** Automatically play the next track when the current one ends. */
|
|
421
|
+
playNextOnEnd?: boolean;
|
|
422
|
+
/** An array of search platforms to use for autoplay. First to last matters
|
|
423
|
+
* Use enum `AutoPlayPlatform`.
|
|
291
424
|
*/
|
|
292
|
-
|
|
425
|
+
autoPlaySearchPlatforms?: AutoPlayPlatform[];
|
|
426
|
+
/** The client ID to use. */
|
|
427
|
+
clientId?: string;
|
|
428
|
+
/** Value to use for the `Client-Name` header. */
|
|
429
|
+
clientName?: string;
|
|
430
|
+
/** The array of shard IDs connected to this manager instance. */
|
|
431
|
+
clusterId?: number;
|
|
432
|
+
/** List of plugins to load. */
|
|
433
|
+
enabledPlugins?: Plugin[];
|
|
434
|
+
/** The default search platform to use.
|
|
435
|
+
* Use enum `SearchPlatform`. */
|
|
436
|
+
defaultSearchPlatform?: SearchPlatform;
|
|
437
|
+
/** The last.fm API key.
|
|
438
|
+
* If you need to create one go here: https://www.last.fm/api/account/create.
|
|
439
|
+
* If you already have one, get it from here: https://www.last.fm/api/accounts. */
|
|
440
|
+
lastFmApiKey?: string;
|
|
441
|
+
/** The maximum number of previous tracks to store. */
|
|
442
|
+
maxPreviousTracks?: number;
|
|
443
|
+
/** The array of nodes to connect to. */
|
|
444
|
+
nodes?: NodeOptions[];
|
|
445
|
+
/** Whether the YouTube video titles should be replaced if the Author does not exactly match. */
|
|
446
|
+
normalizeYouTubeTitles?: boolean;
|
|
447
|
+
/** An array of track properties to keep. `track` will always be present. */
|
|
448
|
+
trackPartial?: TrackPartial[];
|
|
449
|
+
/** Use the least amount of players or least load? */
|
|
450
|
+
useNode?: UseNodeOptions.LeastLoad | UseNodeOptions.LeastPlayers;
|
|
293
451
|
/**
|
|
294
|
-
*
|
|
295
|
-
* @param
|
|
296
|
-
* @param
|
|
297
|
-
* @param {TrackEndEvent} payload - The payload of the event emitted by the node.
|
|
298
|
-
* @private
|
|
452
|
+
* Function to send data to the websocket.
|
|
453
|
+
* @param id The ID of the node to send the data to.
|
|
454
|
+
* @param payload The payload to send.
|
|
299
455
|
*/
|
|
300
|
-
|
|
456
|
+
send?: (packet: DiscordPacket) => unknown;
|
|
457
|
+
}
|
|
458
|
+
/**
|
|
459
|
+
* State Storage Options
|
|
460
|
+
*/
|
|
461
|
+
interface StateStorageOptions {
|
|
462
|
+
type: StateStorageType;
|
|
463
|
+
redisConfig?: RedisConfig;
|
|
464
|
+
}
|
|
465
|
+
/**
|
|
466
|
+
* Payload
|
|
467
|
+
*/
|
|
468
|
+
interface Payload {
|
|
469
|
+
/** The OP code */
|
|
470
|
+
op: number;
|
|
471
|
+
d: {
|
|
472
|
+
guild_id: string;
|
|
473
|
+
channel_id: string | null;
|
|
474
|
+
self_mute: boolean;
|
|
475
|
+
self_deaf: boolean;
|
|
476
|
+
};
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* Discord Packet
|
|
480
|
+
*/
|
|
481
|
+
interface DiscordPacket {
|
|
301
482
|
/**
|
|
302
|
-
*
|
|
303
|
-
* This method is responsible for selecting an appropriate method of autoplay
|
|
304
|
-
* and executing it. If autoplay is not enabled or all attempts have failed,
|
|
305
|
-
* it will return false.
|
|
306
|
-
* @param {Player} player - The player to handle autoplay for.
|
|
307
|
-
* @param {number} attempt - The current attempt number of the autoplay.
|
|
308
|
-
* @returns {Promise<boolean>} A promise that resolves to a boolean indicating if autoplay was successful.
|
|
309
|
-
* @private
|
|
483
|
+
* opcode for the payload
|
|
310
484
|
*/
|
|
311
|
-
|
|
485
|
+
op: number;
|
|
312
486
|
/**
|
|
313
|
-
*
|
|
314
|
-
* Shifts the queue to the next track and emits a track end event.
|
|
315
|
-
* If there is no next track, handles the queue end scenario.
|
|
316
|
-
* If autoplay is enabled, plays the next track.
|
|
317
|
-
*
|
|
318
|
-
* @param {Player} player - The player instance associated with the track.
|
|
319
|
-
* @param {Track} track - The track that failed.
|
|
320
|
-
* @param {TrackEndEvent} payload - The event payload containing details about the track end.
|
|
321
|
-
* @returns {Promise<void>} A promise that resolves when the track failure has been processed.
|
|
322
|
-
* @private
|
|
487
|
+
* event data
|
|
323
488
|
*/
|
|
324
|
-
|
|
489
|
+
d: any;
|
|
325
490
|
/**
|
|
326
|
-
*
|
|
327
|
-
* Shifts the queue to the next track and emits a track end event.
|
|
328
|
-
* If there is no next track, handles the queue end scenario.
|
|
329
|
-
* If autoplay is enabled, plays the next track.
|
|
330
|
-
*
|
|
331
|
-
* @param {Player} player - The player instance associated with the track.
|
|
332
|
-
* @param {Track} track - The track that is repeated.
|
|
333
|
-
* @param {TrackEndEvent} payload - The event payload containing details about the track end.
|
|
334
|
-
* @returns {Promise<void>} A promise that resolves when the repeated track has been processed.
|
|
335
|
-
* @private
|
|
491
|
+
* sequence number, used for resuming sessions and heartbeats
|
|
336
492
|
*/
|
|
337
|
-
|
|
493
|
+
s?: number;
|
|
338
494
|
/**
|
|
339
|
-
*
|
|
340
|
-
* Updates the queue by shifting the current track to the previous track
|
|
341
|
-
* and plays the next track if autoplay is enabled.
|
|
342
|
-
*
|
|
343
|
-
* @param {Player} player - The player associated with the track.
|
|
344
|
-
* @param {Track} track - The track that has ended.
|
|
345
|
-
* @param {TrackEndEvent} payload - The event payload containing additional data about the track end event.
|
|
346
|
-
* @returns {void}
|
|
347
|
-
* @private
|
|
495
|
+
* the event name for this payload
|
|
348
496
|
*/
|
|
349
|
-
|
|
497
|
+
t?: string;
|
|
498
|
+
}
|
|
499
|
+
/**
|
|
500
|
+
* Player Update Voice State
|
|
501
|
+
*/
|
|
502
|
+
interface PlayerUpdateVoiceState {
|
|
350
503
|
/**
|
|
351
|
-
*
|
|
352
|
-
* If autoplay is enabled, attempts to play the next track in the queue using the autoplay logic.
|
|
353
|
-
* If all attempts fail, resets the player state and emits the `queueEnd` event.
|
|
354
|
-
* @param {Player} player - The player associated with the track.
|
|
355
|
-
* @param {Track} track - The track that has ended.
|
|
356
|
-
* @param {TrackEndEvent} payload - The event payload containing additional data about the track end event.
|
|
357
|
-
* @returns {Promise<void>} A promise that resolves when the queue end processing is complete.
|
|
504
|
+
* The session id of the voice connection
|
|
358
505
|
*/
|
|
359
|
-
|
|
506
|
+
sessionId: string;
|
|
360
507
|
/**
|
|
361
|
-
*
|
|
362
|
-
* This method uses the `lavalyrics-plugin` to fetch the lyrics.
|
|
363
|
-
* If the plugin is not available, it will throw a RangeError.
|
|
364
|
-
*
|
|
365
|
-
* @param {Track} track - The track to fetch the lyrics for.
|
|
366
|
-
* @param {boolean} [skipTrackSource=false] - Whether to skip using the track's source URL.
|
|
367
|
-
* @returns {Promise<Lyrics>} A promise that resolves with the lyrics data.
|
|
508
|
+
* Event data
|
|
368
509
|
*/
|
|
369
|
-
|
|
510
|
+
event: VoiceServerUpdate;
|
|
511
|
+
}
|
|
512
|
+
/**
|
|
513
|
+
* Voice Server Update
|
|
514
|
+
*/
|
|
515
|
+
interface VoiceServerUpdate {
|
|
370
516
|
/**
|
|
371
|
-
*
|
|
372
|
-
* Stops the current track and emits a `trackStuck` event.
|
|
373
|
-
*
|
|
374
|
-
* @param {Player} player - The player associated with the track that became stuck.
|
|
375
|
-
* @param {Track} track - The track that became stuck.
|
|
376
|
-
* @param {TrackStuckEvent} payload - The event payload containing additional data about the track stuck event.
|
|
377
|
-
* @returns {void}
|
|
378
|
-
* @protected
|
|
517
|
+
* The token for the session
|
|
379
518
|
*/
|
|
380
|
-
|
|
519
|
+
token: string;
|
|
381
520
|
/**
|
|
382
|
-
*
|
|
383
|
-
* Stops the current track and emits a `trackError` event.
|
|
384
|
-
*
|
|
385
|
-
* @param {Player} player - The player associated with the track that had an error.
|
|
386
|
-
* @param {Track} track - The track that had an error.
|
|
387
|
-
* @param {TrackExceptionEvent} payload - The event payload containing additional data about the track error event.
|
|
388
|
-
* @returns {void}
|
|
389
|
-
* @protected
|
|
521
|
+
* Guild if of the voice connection
|
|
390
522
|
*/
|
|
391
|
-
|
|
523
|
+
guild_id: string;
|
|
392
524
|
/**
|
|
393
|
-
*
|
|
394
|
-
* The payload of the event will contain the close code and reason if provided.
|
|
395
|
-
* @param {Player} player - The player associated with the WebSocket connection.
|
|
396
|
-
* @param {WebSocketClosedEvent} payload - The event payload containing additional data about the WebSocket close event.
|
|
525
|
+
* The endpoint lavalink will connect to
|
|
397
526
|
*/
|
|
398
|
-
|
|
399
|
-
/**
|
|
400
|
-
* Emitted when the segments for a track are loaded.
|
|
401
|
-
* The payload of the event will contain the segments.
|
|
402
|
-
* @param {Player} player - The player associated with the segments.
|
|
403
|
-
* @param {Track} track - The track associated with the segments.
|
|
404
|
-
* @param {SponsorBlockSegmentsLoaded} payload - The event payload containing additional data about the segments loaded event.
|
|
405
|
-
*/
|
|
406
|
-
private sponsorBlockSegmentLoaded;
|
|
407
|
-
/**
|
|
408
|
-
* Emitted when a segment of a track is skipped using the sponsorblock plugin.
|
|
409
|
-
* The payload of the event will contain the skipped segment.
|
|
410
|
-
* @param {Player} player - The player associated with the skipped segment.
|
|
411
|
-
* @param {Track} track - The track associated with the skipped segment.
|
|
412
|
-
* @param {SponsorBlockSegmentSkipped} payload - The event payload containing additional data about the segment skipped event.
|
|
413
|
-
*/
|
|
414
|
-
private sponsorBlockSegmentSkipped;
|
|
415
|
-
/**
|
|
416
|
-
* Emitted when chapters for a track are loaded using the sponsorblock plugin.
|
|
417
|
-
* The payload of the event will contain the chapters.
|
|
418
|
-
* @param {Player} player - The player associated with the chapters.
|
|
419
|
-
* @param {Track} track - The track associated with the chapters.
|
|
420
|
-
* @param {SponsorBlockChaptersLoaded} payload - The event payload containing additional data about the chapters loaded event.
|
|
421
|
-
*/
|
|
422
|
-
private sponsorBlockChaptersLoaded;
|
|
423
|
-
/**
|
|
424
|
-
* Emitted when a chapter of a track is started using the sponsorblock plugin.
|
|
425
|
-
* The payload of the event will contain the started chapter.
|
|
426
|
-
* @param {Player} player - The player associated with the started chapter.
|
|
427
|
-
* @param {Track} track - The track associated with the started chapter.
|
|
428
|
-
* @param {SponsorBlockChapterStarted} payload - The event payload containing additional data about the chapter started event.
|
|
429
|
-
*/
|
|
430
|
-
private sponsorBlockChapterStarted;
|
|
431
|
-
/**
|
|
432
|
-
* Fetches Lavalink node information.
|
|
433
|
-
* @returns {Promise<LavalinkInfo>} A promise that resolves to the Lavalink node information.
|
|
434
|
-
*/
|
|
435
|
-
fetchInfo(): Promise<LavalinkInfo>;
|
|
436
|
-
/**
|
|
437
|
-
* Gets the current sponsorblock segments for a player.
|
|
438
|
-
* @param {Player} player - The player to get the sponsorblocks for.
|
|
439
|
-
* @returns {Promise<SponsorBlockSegment[]>} A promise that resolves to the sponsorblock segments.
|
|
440
|
-
* @throws {RangeError} If the sponsorblock-plugin is not available in the Lavalink node.
|
|
441
|
-
*/
|
|
442
|
-
getSponsorBlock(player: Player): Promise<SponsorBlockSegment[]>;
|
|
443
|
-
/**
|
|
444
|
-
* Sets the sponsorblock segments for a player.
|
|
445
|
-
* @param {Player} player - The player to set the sponsor blocks for.
|
|
446
|
-
* @param {SponsorBlockSegment[]} segments - The sponsorblock segments to set. Defaults to `[SponsorBlockSegment.Sponsor, SponsorBlockSegment.SelfPromo]` if not provided.
|
|
447
|
-
* @returns {Promise<void>} The promise is resolved when the operation is complete.
|
|
448
|
-
* @throws {RangeError} If the sponsorblock-plugin is not available in the Lavalink node.
|
|
449
|
-
* @throws {RangeError} If no segments are provided.
|
|
450
|
-
* @throws {SyntaxError} If an invalid sponsorblock is provided.
|
|
451
|
-
* @example
|
|
452
|
-
* ```ts
|
|
453
|
-
* // use it on the player via player.setSponsorBlock();
|
|
454
|
-
* player.setSponsorBlock([SponsorBlockSegment.Sponsor, SponsorBlockSegment.SelfPromo]);
|
|
455
|
-
* ```
|
|
456
|
-
*/
|
|
457
|
-
setSponsorBlock(player: Player, segments?: SponsorBlockSegment[]): Promise<void>;
|
|
458
|
-
/**
|
|
459
|
-
* Deletes the sponsorblock segments for a player.
|
|
460
|
-
* @param {Player} player - The player to delete the sponsorblocks for.
|
|
461
|
-
* @returns {Promise<void>} The promise is resolved when the operation is complete.
|
|
462
|
-
* @throws {RangeError} If the sponsorblock-plugin is not available in the Lavalink node.
|
|
463
|
-
*/
|
|
464
|
-
deleteSponsorBlock(player: Player): Promise<void>;
|
|
465
|
-
/**
|
|
466
|
-
* Creates a README.md or README.txt file in the magmastream directory
|
|
467
|
-
* if it doesn't already exist. This file is used to store player data
|
|
468
|
-
* for autoresume and other features.
|
|
469
|
-
* @private
|
|
470
|
-
*/
|
|
471
|
-
private createReadmeFile;
|
|
527
|
+
endpoint: string;
|
|
472
528
|
}
|
|
473
|
-
|
|
474
|
-
|
|
529
|
+
/**
|
|
530
|
+
* Redis Configuration
|
|
531
|
+
*/
|
|
532
|
+
interface RedisConfig {
|
|
475
533
|
host: string;
|
|
476
|
-
|
|
477
|
-
port?: number;
|
|
478
|
-
/** The password for the node. */
|
|
534
|
+
port: string;
|
|
479
535
|
password?: string;
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
/** The identifier for the node. */
|
|
483
|
-
identifier?: string;
|
|
484
|
-
/** The maxRetryAttempts for the node. */
|
|
485
|
-
maxRetryAttempts?: number;
|
|
486
|
-
/** The retryDelayMs for the node. */
|
|
487
|
-
retryDelayMs?: number;
|
|
488
|
-
/** Whether to resume the previous session. */
|
|
489
|
-
enableSessionResumeOption?: boolean;
|
|
490
|
-
/** The time the lavalink server will wait before it removes the player. */
|
|
491
|
-
sessionTimeoutMs?: number;
|
|
492
|
-
/** The timeout used for api calls. */
|
|
493
|
-
apiRequestTimeoutMs?: number;
|
|
494
|
-
/** Priority of the node. */
|
|
495
|
-
nodePriority?: number;
|
|
536
|
+
db?: number;
|
|
537
|
+
prefix?: string;
|
|
496
538
|
}
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
uptime: number;
|
|
504
|
-
/** The memory stats for the node. */
|
|
505
|
-
memory: MemoryStats;
|
|
506
|
-
/** The cpu stats for the node. */
|
|
507
|
-
cpu: CPUStats;
|
|
508
|
-
/** The frame stats for the node. */
|
|
509
|
-
frameStats: FrameStats;
|
|
539
|
+
/**
|
|
540
|
+
* Player State Update Event
|
|
541
|
+
*/
|
|
542
|
+
interface PlayerStateUpdateEvent {
|
|
543
|
+
changeType: PlayerStateEventTypes;
|
|
544
|
+
details?: AutoplayChangeEvent | ConnectionChangeEvent | RepeatChangeEvent | PauseChangeEvent | QueueChangeEvent | TrackChangeEvent | VolumeChangeEvent | ChannelChangeEvent;
|
|
510
545
|
}
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
allocated: number;
|
|
518
|
-
/** The reservable memory. */
|
|
519
|
-
reservable: number;
|
|
546
|
+
/**
|
|
547
|
+
* Autoplay Change Event
|
|
548
|
+
*/
|
|
549
|
+
interface AutoplayChangeEvent {
|
|
550
|
+
previousAutoplay: boolean;
|
|
551
|
+
currentAutoplay: boolean;
|
|
520
552
|
}
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
553
|
+
/**
|
|
554
|
+
* Connection Change Event
|
|
555
|
+
*/
|
|
556
|
+
interface ConnectionChangeEvent {
|
|
557
|
+
changeType: "connect" | "disconnect";
|
|
558
|
+
previousConnection: boolean;
|
|
559
|
+
currentConnection: boolean;
|
|
528
560
|
}
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
561
|
+
/**
|
|
562
|
+
* Repeat Change Event
|
|
563
|
+
*/
|
|
564
|
+
interface RepeatChangeEvent {
|
|
565
|
+
changeType: "dynamic" | "track" | "queue" | null;
|
|
566
|
+
previousRepeat: string | null;
|
|
567
|
+
currentRepeat: string | null;
|
|
536
568
|
}
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
preRelease: string;
|
|
544
|
-
};
|
|
545
|
-
buildTime: number;
|
|
546
|
-
git: {
|
|
547
|
-
branch: string;
|
|
548
|
-
commit: string;
|
|
549
|
-
commitTime: number;
|
|
550
|
-
};
|
|
551
|
-
jvm: string;
|
|
552
|
-
lavaplayer: string;
|
|
553
|
-
sourceManagers: string[];
|
|
554
|
-
filters: string[];
|
|
555
|
-
plugins: {
|
|
556
|
-
name: string;
|
|
557
|
-
version: string;
|
|
558
|
-
}[];
|
|
569
|
+
/**
|
|
570
|
+
* Pause Change Event
|
|
571
|
+
*/
|
|
572
|
+
interface PauseChangeEvent {
|
|
573
|
+
previousPause: boolean | null;
|
|
574
|
+
currentPause: boolean | null;
|
|
559
575
|
}
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
576
|
+
/**
|
|
577
|
+
* Queue Change Event
|
|
578
|
+
*/
|
|
579
|
+
interface QueueChangeEvent {
|
|
580
|
+
changeType: "add" | "remove" | "clear" | "shuffle" | "roundRobin" | "userBlock" | "autoPlayAdd";
|
|
581
|
+
tracks?: Track[];
|
|
565
582
|
}
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
583
|
+
/**
|
|
584
|
+
* Track Change Event
|
|
585
|
+
*/
|
|
586
|
+
interface TrackChangeEvent {
|
|
587
|
+
changeType: "start" | "end" | "previous" | "timeUpdate" | "autoPlay";
|
|
588
|
+
track: Track;
|
|
589
|
+
previousTime?: number | null;
|
|
590
|
+
currentTime?: number | null;
|
|
572
591
|
}
|
|
573
|
-
|
|
574
592
|
/**
|
|
575
|
-
*
|
|
593
|
+
* Volume Change Event
|
|
576
594
|
*/
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
/** The previous tracks */
|
|
581
|
-
previous: Track[];
|
|
582
|
-
/** The Manager instance. */
|
|
583
|
-
manager: Manager;
|
|
584
|
-
/** The guild ID property. */
|
|
585
|
-
guildId: string;
|
|
586
|
-
/**
|
|
587
|
-
* Constructs a new Queue.
|
|
588
|
-
* @param guildId The guild ID.
|
|
589
|
-
* @param manager The Manager instance.
|
|
590
|
-
*/
|
|
591
|
-
constructor(guildId: string, manager: Manager);
|
|
592
|
-
getCurrent(): Promise<Track | null>;
|
|
593
|
-
setCurrent(track: Track | null): Promise<void>;
|
|
594
|
-
getPrevious(): Promise<Track[]>;
|
|
595
|
-
addPrevious(track: Track | Track[]): Promise<void>;
|
|
596
|
-
setPrevious(tracks: Track[]): Promise<void>;
|
|
597
|
-
popPrevious(): Promise<Track | null>;
|
|
598
|
-
clearPrevious(): Promise<void>;
|
|
599
|
-
/**
|
|
600
|
-
* The total duration of the queue in milliseconds.
|
|
601
|
-
* This includes the duration of the currently playing track.
|
|
602
|
-
*/
|
|
603
|
-
duration(): Promise<number>;
|
|
604
|
-
/**
|
|
605
|
-
* The total size of tracks in the queue including the current track.
|
|
606
|
-
* This includes the current track if it is not null.
|
|
607
|
-
* @returns The total size of tracks in the queue including the current track.
|
|
608
|
-
*/
|
|
609
|
-
totalSize(): Promise<number>;
|
|
610
|
-
/**
|
|
611
|
-
* The size of tracks in the queue.
|
|
612
|
-
* This does not include the currently playing track.
|
|
613
|
-
* @returns The size of tracks in the queue.
|
|
614
|
-
*/
|
|
615
|
-
size(): Promise<number>;
|
|
616
|
-
/**
|
|
617
|
-
* Adds a track to the queue.
|
|
618
|
-
* @param track The track or tracks to add. Can be a single `Track` or an array of `Track`s.
|
|
619
|
-
* @param [offset=null] The position to add the track(s) at. If not provided, the track(s) will be added at the end of the queue.
|
|
620
|
-
*/
|
|
621
|
-
add(track: Track | Track[], offset?: number): Promise<void>;
|
|
622
|
-
/**
|
|
623
|
-
* Removes track(s) from the queue.
|
|
624
|
-
* @param startOrPosition If a single number is provided, it will be treated as the position of the track to remove.
|
|
625
|
-
* If two numbers are provided, they will be used as the start and end of a range of tracks to remove.
|
|
626
|
-
* @param end Optional, end of the range of tracks to remove.
|
|
627
|
-
* @returns The removed track(s).
|
|
628
|
-
*/
|
|
629
|
-
remove(position?: number): Promise<Track[]>;
|
|
630
|
-
remove(start: number, end: number): Promise<Track[]>;
|
|
631
|
-
/**
|
|
632
|
-
* Clears the queue.
|
|
633
|
-
* This will remove all tracks from the queue and emit a state update event.
|
|
634
|
-
*/
|
|
635
|
-
clear(): Promise<void>;
|
|
636
|
-
/**
|
|
637
|
-
* Shuffles the queue.
|
|
638
|
-
* This will randomize the order of the tracks in the queue and emit a state update event.
|
|
639
|
-
*/
|
|
640
|
-
shuffle(): Promise<void>;
|
|
641
|
-
/**
|
|
642
|
-
* Shuffles the queue to play tracks requested by each user one block at a time.
|
|
643
|
-
*/
|
|
644
|
-
userBlockShuffle(): Promise<void>;
|
|
645
|
-
/**
|
|
646
|
-
* Shuffles the queue to play tracks requested by each user one by one.
|
|
647
|
-
*/
|
|
648
|
-
roundRobinShuffle(): Promise<void>;
|
|
649
|
-
dequeue(): Promise<Track | undefined>;
|
|
650
|
-
enqueueFront(track: Track | Track[]): Promise<void>;
|
|
651
|
-
getTracks(): Promise<Track[]>;
|
|
652
|
-
getSlice(start?: number, end?: number): Promise<Track[]>;
|
|
653
|
-
modifyAt(start: number, deleteCount?: number, ...items: Track[]): Promise<Track[]>;
|
|
654
|
-
mapAsync<T>(callback: (track: Track, index: number, array: Track[]) => T): Promise<T[]>;
|
|
655
|
-
filterAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<Track[]>;
|
|
656
|
-
findAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<Track | undefined>;
|
|
657
|
-
someAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<boolean>;
|
|
658
|
-
everyAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<boolean>;
|
|
659
|
-
}
|
|
660
|
-
|
|
661
|
-
declare abstract class TrackUtils {
|
|
662
|
-
static trackPartial: TrackPartial[] | null;
|
|
663
|
-
private static manager;
|
|
664
|
-
/**
|
|
665
|
-
* Initializes the TrackUtils class with the given manager.
|
|
666
|
-
* @param manager The manager instance to use.
|
|
667
|
-
* @hidden
|
|
668
|
-
*/
|
|
669
|
-
static init(manager: Manager): void;
|
|
670
|
-
/**
|
|
671
|
-
* Sets the partial properties for the Track class. If a Track has some of its properties removed by the partial,
|
|
672
|
-
* it will be considered a partial Track.
|
|
673
|
-
* @param {TrackPartial} partial The array of string property names to remove from the Track class.
|
|
674
|
-
*/
|
|
675
|
-
static setTrackPartial(partial: TrackPartial[]): void;
|
|
676
|
-
/**
|
|
677
|
-
* Checks if the provided argument is a valid Track.
|
|
678
|
-
* If provided an array then every element will be checked.
|
|
679
|
-
* @param trackOrTracks The Track or array of Tracks to check.
|
|
680
|
-
* @returns {boolean} Whether the provided argument is a valid Track.
|
|
681
|
-
*/
|
|
682
|
-
static validate(trackOrTracks: unknown): boolean;
|
|
683
|
-
/**
|
|
684
|
-
* Builds a Track from the raw data from Lavalink and a optional requester.
|
|
685
|
-
* @param data The raw data from Lavalink to build the Track from.
|
|
686
|
-
* @param requester The user who requested the track, if any.
|
|
687
|
-
* @returns The built Track.
|
|
688
|
-
*/
|
|
689
|
-
static build<T = User | ClientUser>(data: TrackData, requester?: T): Track;
|
|
690
|
-
}
|
|
691
|
-
declare abstract class AutoPlayUtils {
|
|
692
|
-
private static manager;
|
|
693
|
-
/**
|
|
694
|
-
* Initializes the AutoPlayUtils class with the given manager.
|
|
695
|
-
* @param manager The manager instance to use.
|
|
696
|
-
* @hidden
|
|
697
|
-
*/
|
|
698
|
-
static init(manager: Manager): void;
|
|
699
|
-
/**
|
|
700
|
-
* Gets recommended tracks for the given track.
|
|
701
|
-
* @param track The track to get recommended tracks for.
|
|
702
|
-
* @returns An array of recommended tracks.
|
|
703
|
-
*/
|
|
704
|
-
static getRecommendedTracks(track: Track): Promise<Track[]>;
|
|
705
|
-
/**
|
|
706
|
-
* Gets recommended tracks from Last.fm for the given track.
|
|
707
|
-
* @param track The track to get recommended tracks for.
|
|
708
|
-
* @param apiKey The API key for Last.fm.
|
|
709
|
-
* @returns An array of recommended tracks.
|
|
710
|
-
*/
|
|
711
|
-
static getRecommendedTracksFromLastFm(track: Track, apiKey: string): Promise<Track[]>;
|
|
712
|
-
/**
|
|
713
|
-
* Gets recommended tracks from the given source.
|
|
714
|
-
* @param track The track to get recommended tracks for.
|
|
715
|
-
* @param platform The source to get recommended tracks from.
|
|
716
|
-
* @returns An array of recommended tracks.
|
|
717
|
-
*/
|
|
718
|
-
static getRecommendedTracksFromSource(track: Track, platform: string): Promise<Track[]>;
|
|
595
|
+
interface VolumeChangeEvent {
|
|
596
|
+
previousVolume: number | null;
|
|
597
|
+
currentVolume: number | null;
|
|
719
598
|
}
|
|
720
|
-
/**
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
static extend<K extends keyof Extendable, T extends Extendable[K]>(name: K, extender: (target: Extendable[K]) => T): T;
|
|
728
|
-
/**
|
|
729
|
-
* Get a structure from available structures by name.
|
|
730
|
-
* @param name
|
|
731
|
-
*/
|
|
732
|
-
static get<K extends keyof Extendable>(name: K): Extendable[K];
|
|
599
|
+
/**
|
|
600
|
+
* Channel Change Event
|
|
601
|
+
*/
|
|
602
|
+
interface ChannelChangeEvent {
|
|
603
|
+
changeType: "text" | "voice";
|
|
604
|
+
previousChannel: string | null;
|
|
605
|
+
currentChannel: string | null;
|
|
733
606
|
}
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
607
|
+
/**
|
|
608
|
+
* Track
|
|
609
|
+
*/
|
|
610
|
+
interface Track {
|
|
611
|
+
/** The base64 encoded track. */
|
|
612
|
+
readonly track: string;
|
|
613
|
+
/** The artwork url of the track. */
|
|
614
|
+
readonly artworkUrl: string;
|
|
615
|
+
/** The track source name. */
|
|
616
|
+
readonly sourceName: TrackSourceName;
|
|
617
|
+
/** The title of the track. */
|
|
618
|
+
title: string;
|
|
619
|
+
/** The identifier of the track. */
|
|
620
|
+
readonly identifier: string;
|
|
621
|
+
/** The author of the track. */
|
|
622
|
+
author: string;
|
|
623
|
+
/** The duration of the track. */
|
|
624
|
+
readonly duration: number;
|
|
625
|
+
/** The ISRC of the track. */
|
|
626
|
+
readonly isrc: string;
|
|
627
|
+
/** If the track is seekable. */
|
|
628
|
+
readonly isSeekable: boolean;
|
|
629
|
+
/** If the track is a stream.. */
|
|
630
|
+
readonly isStream: boolean;
|
|
631
|
+
/** The uri of the track. */
|
|
632
|
+
readonly uri: string;
|
|
633
|
+
/** The thumbnail of the track or null if it's a unsupported source. */
|
|
634
|
+
readonly thumbnail: string | null;
|
|
635
|
+
/** The user that requested the track. */
|
|
636
|
+
requester?: User | ClientUser;
|
|
637
|
+
/** Displays the track thumbnail with optional size or null if it's a unsupported source. */
|
|
638
|
+
displayThumbnail(size?: Sizes): string;
|
|
639
|
+
/** Additional track info provided by plugins. */
|
|
640
|
+
pluginInfo: TrackPluginInfo;
|
|
641
|
+
/** Add your own data to the track. */
|
|
642
|
+
customData: Record<string, unknown>;
|
|
741
643
|
}
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
644
|
+
/**
|
|
645
|
+
* Track Plugin Info
|
|
646
|
+
*/
|
|
647
|
+
interface TrackPluginInfo {
|
|
648
|
+
albumName?: string;
|
|
649
|
+
albumUrl?: string;
|
|
650
|
+
artistArtworkUrl?: string;
|
|
651
|
+
artistUrl?: string;
|
|
652
|
+
isPreview?: string;
|
|
653
|
+
previewUrl?: string;
|
|
749
654
|
}
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
Stopped = "stopped",
|
|
759
|
-
Replaced = "replaced",
|
|
760
|
-
Cleanup = "cleanup"
|
|
655
|
+
/**
|
|
656
|
+
* Search Query
|
|
657
|
+
*/
|
|
658
|
+
interface SearchQuery {
|
|
659
|
+
/** The source to search from. */
|
|
660
|
+
source?: SearchPlatform;
|
|
661
|
+
/** The query to search for. */
|
|
662
|
+
query: string;
|
|
761
663
|
}
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
664
|
+
/**
|
|
665
|
+
* Lavalink Response
|
|
666
|
+
*/
|
|
667
|
+
interface LavalinkResponse {
|
|
668
|
+
loadType: LoadTypes;
|
|
669
|
+
data: TrackData[] | PlaylistRawData;
|
|
767
670
|
}
|
|
768
|
-
|
|
671
|
+
/**
|
|
672
|
+
* Track Data
|
|
673
|
+
*/
|
|
769
674
|
interface TrackData {
|
|
770
675
|
/** The track information. */
|
|
771
676
|
encoded: string;
|
|
@@ -774,6 +679,22 @@ interface TrackData {
|
|
|
774
679
|
/** Additional track info provided by plugins. */
|
|
775
680
|
pluginInfo: Record<string, string>;
|
|
776
681
|
}
|
|
682
|
+
/**
|
|
683
|
+
* Playlist Raw Data
|
|
684
|
+
*/
|
|
685
|
+
interface PlaylistRawData {
|
|
686
|
+
info: {
|
|
687
|
+
/** The playlist name. */
|
|
688
|
+
name: string;
|
|
689
|
+
};
|
|
690
|
+
/** Addition info provided by plugins. */
|
|
691
|
+
pluginInfo: object;
|
|
692
|
+
/** The tracks of the playlist */
|
|
693
|
+
tracks: TrackData[];
|
|
694
|
+
}
|
|
695
|
+
/**
|
|
696
|
+
* Track Data Info
|
|
697
|
+
*/
|
|
777
698
|
interface TrackDataInfo {
|
|
778
699
|
identifier: string;
|
|
779
700
|
isSeekable: boolean;
|
|
@@ -786,83 +707,205 @@ interface TrackDataInfo {
|
|
|
786
707
|
artworkUrl?: string;
|
|
787
708
|
sourceName?: TrackSourceName;
|
|
788
709
|
}
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
Jiosaavn = "jiosaavn",
|
|
794
|
-
SoundCloud = "soundcloud",
|
|
795
|
-
Spotify = "spotify",
|
|
796
|
-
Tidal = "tidal",
|
|
797
|
-
VKMusic = "vkmusic",
|
|
798
|
-
YouTube = "youtube"
|
|
799
|
-
}
|
|
800
|
-
type TrackSourceName = keyof typeof TrackSourceTypes;
|
|
801
|
-
interface Extendable {
|
|
802
|
-
Player: typeof Player;
|
|
803
|
-
Queue: typeof Queue;
|
|
804
|
-
Node: typeof Node;
|
|
805
|
-
}
|
|
806
|
-
interface VoiceServer {
|
|
807
|
-
token: string;
|
|
808
|
-
guild_id: string;
|
|
809
|
-
endpoint: string;
|
|
810
|
-
}
|
|
811
|
-
interface VoiceState {
|
|
812
|
-
op: "voiceUpdate";
|
|
710
|
+
/**
|
|
711
|
+
* LavaPlayer
|
|
712
|
+
*/
|
|
713
|
+
interface LavaPlayer {
|
|
813
714
|
guildId: string;
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
715
|
+
track: TrackData;
|
|
716
|
+
volume: number;
|
|
717
|
+
paused: boolean;
|
|
718
|
+
state: {
|
|
719
|
+
time: number;
|
|
720
|
+
position: number;
|
|
721
|
+
connected: boolean;
|
|
722
|
+
ping: number;
|
|
723
|
+
};
|
|
724
|
+
voice: {
|
|
725
|
+
token: string;
|
|
726
|
+
endpoint: string;
|
|
727
|
+
sessionId: string;
|
|
728
|
+
};
|
|
729
|
+
filters: Record<string, unknown>;
|
|
730
|
+
}
|
|
731
|
+
/**
|
|
732
|
+
* Search Result
|
|
733
|
+
*/
|
|
734
|
+
interface SearchResult {
|
|
735
|
+
/** The load type of the result. */
|
|
736
|
+
loadType: LoadTypes;
|
|
737
|
+
/** The array of tracks from the result. */
|
|
738
|
+
tracks: Track[];
|
|
739
|
+
/** The playlist info if the load type is 'playlist'. */
|
|
740
|
+
playlist?: PlaylistData;
|
|
741
|
+
}
|
|
742
|
+
/**
|
|
743
|
+
* Playlist Data
|
|
744
|
+
*/
|
|
745
|
+
interface PlaylistData {
|
|
746
|
+
/** The playlist name. */
|
|
747
|
+
name: string;
|
|
748
|
+
/** Requester of playlist. */
|
|
749
|
+
requester: User | ClientUser;
|
|
750
|
+
/** More playlist information. */
|
|
751
|
+
playlistInfo: PlaylistInfoData[];
|
|
752
|
+
/** The length of the playlist. */
|
|
753
|
+
duration: number;
|
|
754
|
+
/** The songs of the playlist. */
|
|
755
|
+
tracks: Track[];
|
|
756
|
+
}
|
|
757
|
+
/**
|
|
758
|
+
* Playlist Info Data
|
|
759
|
+
*/
|
|
760
|
+
interface PlaylistInfoData {
|
|
761
|
+
/** Url to playlist. */
|
|
762
|
+
url: string;
|
|
763
|
+
/** Type is always playlist in that case. */
|
|
764
|
+
type: string;
|
|
765
|
+
/** ArtworkUrl of playlist */
|
|
766
|
+
artworkUrl: string;
|
|
767
|
+
/** Number of total tracks in playlist */
|
|
768
|
+
totalTracks: number;
|
|
769
|
+
/** Author of playlist */
|
|
770
|
+
author: string;
|
|
771
|
+
}
|
|
772
|
+
/**
|
|
773
|
+
* Manager Events
|
|
774
|
+
*/
|
|
775
|
+
interface ManagerEvents {
|
|
776
|
+
[ManagerEventTypes.ChapterStarted]: [player: Player, track: Track, payload: SponsorBlockChapterStarted];
|
|
777
|
+
[ManagerEventTypes.ChaptersLoaded]: [player: Player, track: Track, payload: SponsorBlockChaptersLoaded];
|
|
778
|
+
[ManagerEventTypes.Debug]: [info: string];
|
|
779
|
+
[ManagerEventTypes.NodeConnect]: [node: Node];
|
|
780
|
+
[ManagerEventTypes.NodeCreate]: [node: Node];
|
|
781
|
+
[ManagerEventTypes.NodeDestroy]: [node: Node];
|
|
782
|
+
[ManagerEventTypes.NodeDisconnect]: [node: Node, reason: {
|
|
783
|
+
code?: number;
|
|
784
|
+
reason?: string;
|
|
785
|
+
}];
|
|
786
|
+
[ManagerEventTypes.NodeError]: [node: Node, error: Error];
|
|
787
|
+
[ManagerEventTypes.NodeRaw]: [payload: unknown];
|
|
788
|
+
[ManagerEventTypes.NodeReconnect]: [node: Node];
|
|
789
|
+
[ManagerEventTypes.PlayerCreate]: [player: Player];
|
|
790
|
+
[ManagerEventTypes.PlayerDestroy]: [player: Player];
|
|
791
|
+
[ManagerEventTypes.PlayerDisconnect]: [player: Player, oldChannel: string];
|
|
792
|
+
[ManagerEventTypes.PlayerMove]: [player: Player, initChannel: string, newChannel: string];
|
|
793
|
+
[ManagerEventTypes.PlayerRestored]: [player: Player, node: Node];
|
|
794
|
+
[ManagerEventTypes.PlayerStateUpdate]: [oldPlayer: Player, newPlayer: Player, changeType: PlayerStateUpdateEvent];
|
|
795
|
+
[ManagerEventTypes.QueueEnd]: [player: Player, track: Track, payload: TrackEndEvent];
|
|
796
|
+
[ManagerEventTypes.RestoreComplete]: [node: Node];
|
|
797
|
+
[ManagerEventTypes.SegmentSkipped]: [player: Player, track: Track, payload: SponsorBlockSegmentSkipped];
|
|
798
|
+
[ManagerEventTypes.SegmentsLoaded]: [player: Player, track: Track, payload: SponsorBlockSegmentsLoaded];
|
|
799
|
+
[ManagerEventTypes.SocketClosed]: [player: Player, payload: WebSocketClosedEvent];
|
|
800
|
+
[ManagerEventTypes.TrackEnd]: [player: Player, track: Track, payload: TrackEndEvent];
|
|
801
|
+
[ManagerEventTypes.TrackError]: [player: Player, track: Track, payload: TrackExceptionEvent];
|
|
802
|
+
[ManagerEventTypes.TrackStart]: [player: Player, track: Track, payload: TrackStartEvent];
|
|
803
|
+
[ManagerEventTypes.TrackStuck]: [player: Player, track: Track, payload: TrackStuckEvent];
|
|
822
804
|
}
|
|
805
|
+
/**
|
|
806
|
+
* Voice Packet
|
|
807
|
+
*/
|
|
823
808
|
interface VoicePacket {
|
|
824
809
|
t?: "VOICE_SERVER_UPDATE" | "VOICE_STATE_UPDATE";
|
|
825
810
|
d: VoiceState | VoiceServer;
|
|
826
811
|
}
|
|
812
|
+
/**
|
|
813
|
+
* Voice Server
|
|
814
|
+
*/
|
|
815
|
+
interface VoiceServer {
|
|
816
|
+
token: string;
|
|
817
|
+
guild_id: string;
|
|
818
|
+
endpoint: string;
|
|
819
|
+
}
|
|
820
|
+
interface Extendable {
|
|
821
|
+
Player: typeof Player;
|
|
822
|
+
Queue: typeof Queue;
|
|
823
|
+
Node: typeof Node;
|
|
824
|
+
}
|
|
825
|
+
/**
|
|
826
|
+
* Voice State
|
|
827
|
+
*/
|
|
828
|
+
interface VoiceState {
|
|
829
|
+
op: "voiceUpdate";
|
|
830
|
+
guildId: string;
|
|
831
|
+
event: VoiceServer;
|
|
832
|
+
sessionId?: string;
|
|
833
|
+
}
|
|
834
|
+
/**
|
|
835
|
+
* Voice State
|
|
836
|
+
*/
|
|
837
|
+
interface VoiceState {
|
|
838
|
+
guild_id: string;
|
|
839
|
+
user_id: string;
|
|
840
|
+
session_id: string;
|
|
841
|
+
channel_id: string;
|
|
842
|
+
}
|
|
843
|
+
/**
|
|
844
|
+
* Node Message
|
|
845
|
+
*/
|
|
827
846
|
interface NodeMessage extends NodeStats {
|
|
828
847
|
type: PlayerEventType;
|
|
829
848
|
op: "stats" | "playerUpdate" | "event";
|
|
830
849
|
guildId: string;
|
|
831
850
|
}
|
|
851
|
+
/**
|
|
852
|
+
* PlayerEvent interface
|
|
853
|
+
*/
|
|
832
854
|
interface PlayerEvent {
|
|
833
855
|
op: "event";
|
|
834
856
|
type: PlayerEventType;
|
|
835
857
|
guildId: string;
|
|
836
858
|
}
|
|
859
|
+
/**
|
|
860
|
+
* Exception interface
|
|
861
|
+
*/
|
|
837
862
|
interface Exception {
|
|
838
863
|
message: string;
|
|
839
864
|
severity: SeverityTypes;
|
|
840
865
|
cause: string;
|
|
841
866
|
}
|
|
867
|
+
/**
|
|
868
|
+
* TrackStartEvent interface
|
|
869
|
+
*/
|
|
842
870
|
interface TrackStartEvent extends PlayerEvent {
|
|
843
871
|
type: "TrackStartEvent";
|
|
844
872
|
track: TrackData;
|
|
845
873
|
}
|
|
874
|
+
/**
|
|
875
|
+
* TrackEndEvent interface
|
|
876
|
+
*/
|
|
846
877
|
interface TrackEndEvent extends PlayerEvent {
|
|
847
878
|
type: "TrackEndEvent";
|
|
848
879
|
track: TrackData;
|
|
849
880
|
reason: TrackEndReasonTypes;
|
|
850
881
|
}
|
|
882
|
+
/**
|
|
883
|
+
* TrackExceptionEvent interface
|
|
884
|
+
*/
|
|
851
885
|
interface TrackExceptionEvent extends PlayerEvent {
|
|
852
886
|
exception?: Exception;
|
|
853
887
|
guildId: string;
|
|
854
888
|
type: "TrackExceptionEvent";
|
|
855
889
|
}
|
|
890
|
+
/**
|
|
891
|
+
* TrackStuckEvent interface
|
|
892
|
+
*/
|
|
856
893
|
interface TrackStuckEvent extends PlayerEvent {
|
|
857
894
|
type: "TrackStuckEvent";
|
|
858
895
|
thresholdMs: number;
|
|
859
896
|
}
|
|
897
|
+
/**
|
|
898
|
+
* WebSocketClosedEvent interface
|
|
899
|
+
*/
|
|
860
900
|
interface WebSocketClosedEvent extends PlayerEvent {
|
|
861
901
|
type: "WebSocketClosedEvent";
|
|
862
902
|
code: number;
|
|
863
903
|
reason: string;
|
|
864
904
|
byRemote: boolean;
|
|
865
905
|
}
|
|
906
|
+
/**
|
|
907
|
+
* SponsorBlockSegmentsLoaded interface
|
|
908
|
+
*/
|
|
866
909
|
interface SponsorBlockSegmentsLoaded extends PlayerEvent {
|
|
867
910
|
type: "SegmentsLoaded";
|
|
868
911
|
segments: {
|
|
@@ -871,6 +914,9 @@ interface SponsorBlockSegmentsLoaded extends PlayerEvent {
|
|
|
871
914
|
end: number;
|
|
872
915
|
}[];
|
|
873
916
|
}
|
|
917
|
+
/**
|
|
918
|
+
* SponsorBlockSegmentSkipped interface
|
|
919
|
+
*/
|
|
874
920
|
interface SponsorBlockSegmentSkipped extends PlayerEvent {
|
|
875
921
|
type: "SegmentSkipped";
|
|
876
922
|
segment: {
|
|
@@ -879,6 +925,9 @@ interface SponsorBlockSegmentSkipped extends PlayerEvent {
|
|
|
879
925
|
end: number;
|
|
880
926
|
};
|
|
881
927
|
}
|
|
928
|
+
/**
|
|
929
|
+
* SponsorBlockChapterStarted interface
|
|
930
|
+
*/
|
|
882
931
|
interface SponsorBlockChapterStarted extends PlayerEvent {
|
|
883
932
|
type: "ChapterStarted";
|
|
884
933
|
/** The chapter which started */
|
|
@@ -890,6 +939,9 @@ interface SponsorBlockChapterStarted extends PlayerEvent {
|
|
|
890
939
|
duration: number;
|
|
891
940
|
};
|
|
892
941
|
}
|
|
942
|
+
/**
|
|
943
|
+
* SponsorBlockChaptersLoaded interface
|
|
944
|
+
*/
|
|
893
945
|
interface SponsorBlockChaptersLoaded extends PlayerEvent {
|
|
894
946
|
type: "ChaptersLoaded";
|
|
895
947
|
/** All chapters loaded */
|
|
@@ -901,6 +953,9 @@ interface SponsorBlockChaptersLoaded extends PlayerEvent {
|
|
|
901
953
|
duration: number;
|
|
902
954
|
}[];
|
|
903
955
|
}
|
|
956
|
+
/**
|
|
957
|
+
* PlayerUpdate interface
|
|
958
|
+
*/
|
|
904
959
|
interface PlayerUpdate {
|
|
905
960
|
op: "playerUpdate";
|
|
906
961
|
/** The guild id of the player. */
|
|
@@ -916,576 +971,869 @@ interface PlayerUpdate {
|
|
|
916
971
|
ping: number;
|
|
917
972
|
};
|
|
918
973
|
}
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
/**
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
someAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<boolean>;
|
|
946
|
-
everyAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<boolean>;
|
|
974
|
+
/**
|
|
975
|
+
* Node Options
|
|
976
|
+
*/
|
|
977
|
+
interface NodeOptions {
|
|
978
|
+
/** The host for the node. */
|
|
979
|
+
host: string;
|
|
980
|
+
/** The port for the node. */
|
|
981
|
+
port?: number;
|
|
982
|
+
/** The password for the node. */
|
|
983
|
+
password?: string;
|
|
984
|
+
/** Whether the host uses SSL. */
|
|
985
|
+
useSSL?: boolean;
|
|
986
|
+
/** The identifier for the node. */
|
|
987
|
+
identifier?: string;
|
|
988
|
+
/** The maxRetryAttempts for the node. */
|
|
989
|
+
maxRetryAttempts?: number;
|
|
990
|
+
/** The retryDelayMs for the node. */
|
|
991
|
+
retryDelayMs?: number;
|
|
992
|
+
/** Whether to resume the previous session. */
|
|
993
|
+
enableSessionResumeOption?: boolean;
|
|
994
|
+
/** The time the lavalink server will wait before it removes the player. */
|
|
995
|
+
sessionTimeoutMs?: number;
|
|
996
|
+
/** The timeout used for api calls. */
|
|
997
|
+
apiRequestTimeoutMs?: number;
|
|
998
|
+
/** Priority of the node. */
|
|
999
|
+
nodePriority?: number;
|
|
947
1000
|
}
|
|
948
|
-
|
|
949
1001
|
/**
|
|
950
|
-
*
|
|
1002
|
+
* NodeOptions interface
|
|
951
1003
|
*/
|
|
952
|
-
|
|
953
|
-
/** The
|
|
954
|
-
readonly players: Collection<string, Player>;
|
|
955
|
-
/** The map of nodes. */
|
|
956
|
-
readonly nodes: Collection<string, Node>;
|
|
957
|
-
/** The options that were set. */
|
|
958
|
-
readonly options: ManagerOptions;
|
|
959
|
-
initiated: boolean;
|
|
960
|
-
redis?: Redis;
|
|
961
|
-
/**
|
|
962
|
-
* Initiates the Manager class.
|
|
963
|
-
* @param options
|
|
964
|
-
* @param options.enabledPlugins - An array of enabledPlugins to load.
|
|
965
|
-
* @param options.nodes - An array of node options to create nodes from.
|
|
966
|
-
* @param options.playNextOnEnd - Whether to automatically play the first track in the queue when the player is created.
|
|
967
|
-
* @param options.autoPlaySearchPlatforms - The search platform autoplay will use. Fallback to Youtube if not found.
|
|
968
|
-
* @param options.enablePriorityMode - Whether to use the priority when selecting a node to play on.
|
|
969
|
-
* @param options.clientName - The name of the client to send to Lavalink.
|
|
970
|
-
* @param options.defaultSearchPlatform - The default search platform to use when searching for tracks.
|
|
971
|
-
* @param options.useNode - The strategy to use when selecting a node to play on.
|
|
972
|
-
* @param options.trackPartial - The partial track search results to use when searching for tracks. This partials will always be presented on each track.
|
|
973
|
-
* @param options.eventBatchDuration - The duration to wait before processing the collected player state events.
|
|
974
|
-
* @param options.eventBatchInterval - The interval to wait before processing the collected player state events.
|
|
975
|
-
*/
|
|
976
|
-
constructor(options: ManagerOptions);
|
|
977
|
-
/**
|
|
978
|
-
* Initiates the Manager.
|
|
979
|
-
* @param clientId - The Discord client ID (required).
|
|
980
|
-
* @param clusterId - The cluster ID which runs the current process (required).
|
|
981
|
-
* @returns The manager instance.
|
|
982
|
-
*/
|
|
983
|
-
init(clientId: string, clusterId?: number): this;
|
|
984
|
-
/**
|
|
985
|
-
* Searches the enabled sources based off the URL or the `source` property.
|
|
986
|
-
* @param query
|
|
987
|
-
* @param requester
|
|
988
|
-
* @returns The search result.
|
|
989
|
-
*/
|
|
990
|
-
search<T = unknown>(query: string | SearchQuery, requester?: T): Promise<SearchResult>;
|
|
991
|
-
/**
|
|
992
|
-
* Returns a player or undefined if it does not exist.
|
|
993
|
-
* @param guildId The guild ID of the player to retrieve.
|
|
994
|
-
* @returns The player if it exists, undefined otherwise.
|
|
995
|
-
*/
|
|
996
|
-
getPlayer(guildId: string): Player | undefined;
|
|
997
|
-
/**
|
|
998
|
-
* @deprecated - Will be removed with v2.10.0 use {@link getPlayer} instead
|
|
999
|
-
* Returns a player or undefined if it does not exist.
|
|
1000
|
-
* @param guildId The guild ID of the player to retrieve.
|
|
1001
|
-
* @returns The player if it exists, undefined otherwise.
|
|
1002
|
-
*/
|
|
1003
|
-
get(guildId: string): Promise<Player | undefined>;
|
|
1004
|
-
/**
|
|
1005
|
-
* Creates a player or returns one if it already exists.
|
|
1006
|
-
* @param options The options to create the player with.
|
|
1007
|
-
* @returns The created player.
|
|
1008
|
-
*/
|
|
1009
|
-
create(options: PlayerOptions): Player;
|
|
1010
|
-
/**
|
|
1011
|
-
* Destroys a player.
|
|
1012
|
-
* @param guildId The guild ID of the player to destroy.
|
|
1013
|
-
* @returns A promise that resolves when the player has been destroyed.
|
|
1014
|
-
*/
|
|
1015
|
-
destroy(guildId: string): Promise<void>;
|
|
1016
|
-
/**
|
|
1017
|
-
* Creates a new node or returns an existing one if it already exists.
|
|
1018
|
-
* @param options - The options to create the node with.
|
|
1019
|
-
* @returns The created node.
|
|
1020
|
-
*/
|
|
1021
|
-
createNode(options: NodeOptions): Node;
|
|
1022
|
-
/**
|
|
1023
|
-
* Destroys a node if it exists. Emits a debug event if the node is found and destroyed.
|
|
1024
|
-
* @param identifier - The identifier of the node to destroy.
|
|
1025
|
-
* @returns {void}
|
|
1026
|
-
* @emits {debug} - Emits a debug message indicating the node is being destroyed.
|
|
1027
|
-
*/
|
|
1028
|
-
destroyNode(identifier: string): Promise<void>;
|
|
1029
|
-
/**
|
|
1030
|
-
* Attaches an event listener to the manager.
|
|
1031
|
-
* @param event The event to listen for.
|
|
1032
|
-
* @param listener The function to call when the event is emitted.
|
|
1033
|
-
* @returns The manager instance for chaining.
|
|
1034
|
-
*/
|
|
1035
|
-
on<T extends keyof ManagerEvents>(event: T, listener: (...args: ManagerEvents[T]) => void): this;
|
|
1036
|
-
/**
|
|
1037
|
-
* Updates the voice state of a player based on the provided data.
|
|
1038
|
-
* @param data - The data containing voice state information, which can be a VoicePacket, VoiceServer, or VoiceState.
|
|
1039
|
-
* @returns A promise that resolves when the voice state update is handled.
|
|
1040
|
-
* @emits {debug} - Emits a debug message indicating the voice state is being updated.
|
|
1041
|
-
*/
|
|
1042
|
-
updateVoiceState(data: VoicePacket | VoiceServer | VoiceState): Promise<void>;
|
|
1043
|
-
/**
|
|
1044
|
-
* Decodes an array of base64 encoded tracks and returns an array of TrackData.
|
|
1045
|
-
* Emits a debug event with the tracks being decoded.
|
|
1046
|
-
* @param tracks - An array of base64 encoded track strings.
|
|
1047
|
-
* @returns A promise that resolves to an array of TrackData objects.
|
|
1048
|
-
* @throws Will throw an error if no nodes are available or if the API request fails.
|
|
1049
|
-
*/
|
|
1050
|
-
decodeTracks(tracks: string[]): Promise<TrackData[]>;
|
|
1051
|
-
/**
|
|
1052
|
-
* Decodes a base64 encoded track and returns a TrackData.
|
|
1053
|
-
* @param track - The base64 encoded track string.
|
|
1054
|
-
* @returns A promise that resolves to a TrackData object.
|
|
1055
|
-
* @throws Will throw an error if no nodes are available or if the API request fails.
|
|
1056
|
-
*/
|
|
1057
|
-
decodeTrack(track: string): Promise<TrackData>;
|
|
1058
|
-
/**
|
|
1059
|
-
* Saves player states to the JSON file.
|
|
1060
|
-
* @param {string} guildId - The guild ID of the player to save
|
|
1061
|
-
*/
|
|
1062
|
-
savePlayerState(guildId: string): Promise<void>;
|
|
1063
|
-
/**
|
|
1064
|
-
* Sleeps for a specified amount of time.
|
|
1065
|
-
* @param ms The amount of time to sleep in milliseconds.
|
|
1066
|
-
* @returns A promise that resolves after the specified amount of time.
|
|
1067
|
-
*/
|
|
1068
|
-
private sleep;
|
|
1069
|
-
/**
|
|
1070
|
-
* Loads player states from the JSON file.
|
|
1071
|
-
* @param nodeId The ID of the node to load player states from.
|
|
1072
|
-
* @returns A promise that resolves when the player states have been loaded.
|
|
1073
|
-
*/
|
|
1074
|
-
loadPlayerStates(nodeId: string): Promise<void>;
|
|
1075
|
-
/**
|
|
1076
|
-
* Returns the node to use based on the configured `useNode` and `enablePriorityMode` options.
|
|
1077
|
-
* If `enablePriorityMode` is true, the node is chosen based on priority, otherwise it is chosen based on the `useNode` option.
|
|
1078
|
-
* If `useNode` is "leastLoad", the node with the lowest load is chosen, if it is "leastPlayers", the node with the fewest players is chosen.
|
|
1079
|
-
* If `enablePriorityMode` is false and `useNode` is not set, the node with the lowest load is chosen.
|
|
1080
|
-
* @returns {Node} The node to use.
|
|
1081
|
-
*/
|
|
1082
|
-
get useableNode(): Node;
|
|
1083
|
-
/**
|
|
1084
|
-
* Handles the shutdown of the process by saving all active players' states and optionally cleaning up inactive players.
|
|
1085
|
-
* This function is called when the process is about to exit.
|
|
1086
|
-
* It iterates through all players and calls {@link savePlayerState} to save their states.
|
|
1087
|
-
* Optionally, it also calls {@link cleanupInactivePlayers} to remove any stale player state files.
|
|
1088
|
-
* After saving and cleaning up, it exits the process.
|
|
1089
|
-
*/
|
|
1090
|
-
handleShutdown(): Promise<void>;
|
|
1091
|
-
/**
|
|
1092
|
-
* Parses a YouTube title into a clean title and author.
|
|
1093
|
-
* @param title - The original title of the YouTube video.
|
|
1094
|
-
* @param originalAuthor - The original author of the YouTube video.
|
|
1095
|
-
* @returns An object with the clean title and author.
|
|
1096
|
-
*/
|
|
1097
|
-
private parseYouTubeTitle;
|
|
1098
|
-
/**
|
|
1099
|
-
* Balances brackets in a given string by ensuring all opened brackets are closed correctly.
|
|
1100
|
-
* @param str - The input string that may contain unbalanced brackets.
|
|
1101
|
-
* @returns A new string with balanced brackets.
|
|
1102
|
-
*/
|
|
1103
|
-
private balanceBrackets;
|
|
1104
|
-
/**
|
|
1105
|
-
* Escapes a string by replacing special regex characters with their escaped counterparts.
|
|
1106
|
-
* @param string - The string to escape.
|
|
1107
|
-
* @returns The escaped string.
|
|
1108
|
-
*/
|
|
1109
|
-
private escapeRegExp;
|
|
1110
|
-
/**
|
|
1111
|
-
* Checks if the given data is a voice update.
|
|
1112
|
-
* @param data The data to check.
|
|
1113
|
-
* @returns Whether the data is a voice update.
|
|
1114
|
-
*/
|
|
1115
|
-
private isVoiceUpdate;
|
|
1116
|
-
/**
|
|
1117
|
-
* Determines if the provided update is a valid voice update.
|
|
1118
|
-
* A valid update must contain either a token or a session_id.
|
|
1119
|
-
*
|
|
1120
|
-
* @param update - The voice update data to validate, which can be a VoicePacket, VoiceServer, or VoiceState.
|
|
1121
|
-
* @returns {boolean} - True if the update is valid, otherwise false.
|
|
1122
|
-
*/
|
|
1123
|
-
private isValidUpdate;
|
|
1124
|
-
/**
|
|
1125
|
-
* Handles a voice server update by updating the player's voice state and sending the voice state to the Lavalink node.
|
|
1126
|
-
* @param player The player for which the voice state is being updated.
|
|
1127
|
-
* @param update The voice server data received from Discord.
|
|
1128
|
-
* @returns A promise that resolves when the voice state update is handled.
|
|
1129
|
-
* @emits {debug} - Emits a debug message indicating the voice state is being updated.
|
|
1130
|
-
*/
|
|
1131
|
-
private handleVoiceServerUpdate;
|
|
1132
|
-
/**
|
|
1133
|
-
* Handles a voice state update by updating the player's voice channel and session ID if provided, or by disconnecting and destroying the player if the channel ID is null.
|
|
1134
|
-
* @param player The player for which the voice state is being updated.
|
|
1135
|
-
* @param update The voice state data received from Discord.
|
|
1136
|
-
* @emits {playerMove} - Emits a player move event if the channel ID is provided and the player is currently connected to a different voice channel.
|
|
1137
|
-
* @emits {playerDisconnect} - Emits a player disconnect event if the channel ID is null.
|
|
1138
|
-
*/
|
|
1139
|
-
private handleVoiceStateUpdate;
|
|
1140
|
-
/**
|
|
1141
|
-
* Gets each player's JSON file
|
|
1142
|
-
* @param {string} guildId - The guild ID
|
|
1143
|
-
* @returns {string} The path to the player's JSON file
|
|
1144
|
-
*/
|
|
1145
|
-
private getPlayerFilePath;
|
|
1146
|
-
/**
|
|
1147
|
-
* Serializes a Player instance to avoid circular references.
|
|
1148
|
-
* @param player The Player instance to serialize
|
|
1149
|
-
* @returns The serialized Player instance
|
|
1150
|
-
*/
|
|
1151
|
-
serializePlayer(player: Player): Record<string, unknown>;
|
|
1152
|
-
/**
|
|
1153
|
-
* Checks for players that are no longer active and deletes their saved state files.
|
|
1154
|
-
* This is done to prevent stale state files from accumulating on the file system.
|
|
1155
|
-
*/
|
|
1156
|
-
private cleanupInactivePlayers;
|
|
1157
|
-
/**
|
|
1158
|
-
* Returns the nodes that has the least load.
|
|
1159
|
-
* The load is calculated by dividing the lavalink load by the number of cores.
|
|
1160
|
-
* The result is multiplied by 100 to get a percentage.
|
|
1161
|
-
* @returns {Collection<string, Node>}
|
|
1162
|
-
*/
|
|
1163
|
-
private get leastLoadNode();
|
|
1164
|
-
/**
|
|
1165
|
-
* Returns the nodes that have the least amount of players.
|
|
1166
|
-
* Filters out disconnected nodes and sorts the remaining nodes
|
|
1167
|
-
* by the number of players in ascending order.
|
|
1168
|
-
* @returns {Collection<string, Node>} A collection of nodes sorted by player count.
|
|
1169
|
-
*/
|
|
1170
|
-
private get leastPlayersNode();
|
|
1171
|
-
/**
|
|
1172
|
-
* Returns a node based on priority.
|
|
1173
|
-
* The nodes are sorted by priority in descending order, and then a random number
|
|
1174
|
-
* between 0 and 1 is generated. The node that has a cumulative weight greater than or equal to the
|
|
1175
|
-
* random number is returned.
|
|
1176
|
-
* If no node has a cumulative weight greater than or equal to the random number, the node with the
|
|
1177
|
-
* lowest load is returned.
|
|
1178
|
-
* @returns {Node} The node to use.
|
|
1179
|
-
*/
|
|
1180
|
-
private get priorityNode();
|
|
1181
|
-
}
|
|
1182
|
-
interface Payload {
|
|
1183
|
-
/** The OP code */
|
|
1184
|
-
op: number;
|
|
1185
|
-
d: {
|
|
1186
|
-
guild_id: string;
|
|
1187
|
-
channel_id: string | null;
|
|
1188
|
-
self_mute: boolean;
|
|
1189
|
-
self_deaf: boolean;
|
|
1190
|
-
};
|
|
1191
|
-
}
|
|
1192
|
-
interface ManagerOptions {
|
|
1193
|
-
/** The state storage options.
|
|
1194
|
-
*
|
|
1195
|
-
* @default { type: StateStorageType.Collection }
|
|
1196
|
-
*/
|
|
1197
|
-
stateStorage?: StateStorageOptions;
|
|
1198
|
-
/** Enable priority mode over least player count or load balancing? */
|
|
1199
|
-
enablePriorityMode?: boolean;
|
|
1200
|
-
/** Automatically play the next track when the current one ends. */
|
|
1201
|
-
playNextOnEnd?: boolean;
|
|
1202
|
-
/** An array of search platforms to use for autoplay. First to last matters
|
|
1203
|
-
* Use enum `AutoPlayPlatform`.
|
|
1204
|
-
*/
|
|
1205
|
-
autoPlaySearchPlatforms?: AutoPlayPlatform[];
|
|
1206
|
-
/** The client ID to use. */
|
|
1207
|
-
clientId?: string;
|
|
1208
|
-
/** Value to use for the `Client-Name` header. */
|
|
1209
|
-
clientName?: string;
|
|
1210
|
-
/** The array of shard IDs connected to this manager instance. */
|
|
1211
|
-
clusterId?: number;
|
|
1212
|
-
/** List of plugins to load. */
|
|
1213
|
-
enabledPlugins?: Plugin[];
|
|
1214
|
-
/** The default search platform to use.
|
|
1215
|
-
* Use enum `SearchPlatform`. */
|
|
1216
|
-
defaultSearchPlatform?: SearchPlatform;
|
|
1217
|
-
/** The last.fm API key.
|
|
1218
|
-
* If you need to create one go here: https://www.last.fm/api/account/create.
|
|
1219
|
-
* If you already have one, get it from here: https://www.last.fm/api/accounts. */
|
|
1220
|
-
lastFmApiKey?: string;
|
|
1221
|
-
/** The maximum number of previous tracks to store. */
|
|
1222
|
-
maxPreviousTracks?: number;
|
|
1223
|
-
/** The array of nodes to connect to. */
|
|
1224
|
-
nodes?: NodeOptions[];
|
|
1225
|
-
/** Whether the YouTube video titles should be replaced if the Author does not exactly match. */
|
|
1226
|
-
normalizeYouTubeTitles?: boolean;
|
|
1227
|
-
/** An array of track properties to keep. `track` will always be present. */
|
|
1228
|
-
trackPartial?: TrackPartial[];
|
|
1229
|
-
/** Use the least amount of players or least load? */
|
|
1230
|
-
useNode?: UseNodeOptions.LeastLoad | UseNodeOptions.LeastPlayers;
|
|
1231
|
-
/**
|
|
1232
|
-
* Function to send data to the websocket.
|
|
1233
|
-
* @param id The ID of the node to send the data to.
|
|
1234
|
-
* @param payload The payload to send.
|
|
1235
|
-
*/
|
|
1236
|
-
send(id: string, payload: Payload): void;
|
|
1237
|
-
}
|
|
1238
|
-
interface RedisConfig {
|
|
1004
|
+
interface NodeOptions {
|
|
1005
|
+
/** The host for the node. */
|
|
1239
1006
|
host: string;
|
|
1240
|
-
port
|
|
1007
|
+
/** The port for the node. */
|
|
1008
|
+
port?: number;
|
|
1009
|
+
/** The password for the node. */
|
|
1241
1010
|
password?: string;
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1011
|
+
/** Whether the host uses SSL. */
|
|
1012
|
+
useSSL?: boolean;
|
|
1013
|
+
/** The identifier for the node. */
|
|
1014
|
+
identifier?: string;
|
|
1015
|
+
/** The maxRetryAttempts for the node. */
|
|
1016
|
+
maxRetryAttempts?: number;
|
|
1017
|
+
/** The retryDelayMs for the node. */
|
|
1018
|
+
retryDelayMs?: number;
|
|
1019
|
+
/** Whether to resume the previous session. */
|
|
1020
|
+
enableSessionResumeOption?: boolean;
|
|
1021
|
+
/** The time the lavalink server will wait before it removes the player. */
|
|
1022
|
+
sessionTimeoutMs?: number;
|
|
1023
|
+
/** The timeout used for api calls. */
|
|
1024
|
+
apiRequestTimeoutMs?: number;
|
|
1025
|
+
/** Priority of the node. */
|
|
1026
|
+
nodePriority?: number;
|
|
1252
1027
|
}
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
IsStream = "isStream",
|
|
1270
|
-
/** The URI of the track */
|
|
1271
|
-
Uri = "uri",
|
|
1272
|
-
/** The artwork URL of the track */
|
|
1273
|
-
ArtworkUrl = "artworkUrl",
|
|
1274
|
-
/** The source name of the track */
|
|
1275
|
-
SourceName = "sourceName",
|
|
1276
|
-
/** The thumbnail of the track */
|
|
1277
|
-
ThumbNail = "thumbnail",
|
|
1278
|
-
/** The requester of the track */
|
|
1279
|
-
Requester = "requester",
|
|
1280
|
-
/** The plugin info of the track */
|
|
1281
|
-
PluginInfo = "pluginInfo",
|
|
1282
|
-
/** The custom data of the track */
|
|
1283
|
-
CustomData = "customData"
|
|
1284
|
-
}
|
|
1285
|
-
declare enum UseNodeOptions {
|
|
1286
|
-
LeastLoad = "leastLoad",
|
|
1287
|
-
LeastPlayers = "leastPlayers"
|
|
1288
|
-
}
|
|
1289
|
-
type UseNodeOption = keyof typeof UseNodeOptions;
|
|
1290
|
-
declare enum SearchPlatform {
|
|
1291
|
-
AppleMusic = "amsearch",
|
|
1292
|
-
Bandcamp = "bcsearch",
|
|
1293
|
-
Deezer = "dzsearch",
|
|
1294
|
-
Jiosaavn = "jssearch",
|
|
1295
|
-
Qobuz = "qbsearch",
|
|
1296
|
-
SoundCloud = "scsearch",
|
|
1297
|
-
Spotify = "spsearch",
|
|
1298
|
-
Tidal = "tdsearch",
|
|
1299
|
-
VKMusic = "vksearch",
|
|
1300
|
-
YouTube = "ytsearch",
|
|
1301
|
-
YouTubeMusic = "ytmsearch"
|
|
1302
|
-
}
|
|
1303
|
-
declare enum AutoPlayPlatform {
|
|
1304
|
-
Spotify = "spotify",
|
|
1305
|
-
Deezer = "deezer",
|
|
1306
|
-
SoundCloud = "soundcloud",
|
|
1307
|
-
Tidal = "tidal",
|
|
1308
|
-
VKMusic = "vkmusic",
|
|
1309
|
-
Qobuz = "qobuz",
|
|
1310
|
-
YouTube = "youtube"
|
|
1028
|
+
/**
|
|
1029
|
+
* NodeStats interface
|
|
1030
|
+
*/
|
|
1031
|
+
interface NodeStats {
|
|
1032
|
+
/** The amount of players on the node. */
|
|
1033
|
+
players: number;
|
|
1034
|
+
/** The amount of playing players on the node. */
|
|
1035
|
+
playingPlayers: number;
|
|
1036
|
+
/** The uptime for the node. */
|
|
1037
|
+
uptime: number;
|
|
1038
|
+
/** The memory stats for the node. */
|
|
1039
|
+
memory: MemoryStats;
|
|
1040
|
+
/** The cpu stats for the node. */
|
|
1041
|
+
cpu: CPUStats;
|
|
1042
|
+
/** The frame stats for the node. */
|
|
1043
|
+
frameStats: FrameStats;
|
|
1311
1044
|
}
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1045
|
+
/**
|
|
1046
|
+
* NodeStats interface
|
|
1047
|
+
*/
|
|
1048
|
+
interface NodeStats {
|
|
1049
|
+
/** The amount of players on the node. */
|
|
1050
|
+
players: number;
|
|
1051
|
+
/** The amount of playing players on the node. */
|
|
1052
|
+
playingPlayers: number;
|
|
1053
|
+
/** The uptime for the node. */
|
|
1054
|
+
uptime: number;
|
|
1055
|
+
/** The memory stats for the node. */
|
|
1056
|
+
memory: MemoryStats;
|
|
1057
|
+
/** The cpu stats for the node. */
|
|
1058
|
+
cpu: CPUStats;
|
|
1059
|
+
/** The frame stats for the node. */
|
|
1060
|
+
frameStats: FrameStats;
|
|
1323
1061
|
}
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1062
|
+
/**
|
|
1063
|
+
* MemoryStats interface
|
|
1064
|
+
*/
|
|
1065
|
+
interface MemoryStats {
|
|
1066
|
+
/** The free memory of the allocated amount. */
|
|
1067
|
+
free: number;
|
|
1068
|
+
/** The used memory of the allocated amount. */
|
|
1069
|
+
used: number;
|
|
1070
|
+
/** The total allocated memory. */
|
|
1071
|
+
allocated: number;
|
|
1072
|
+
/** The reservable memory. */
|
|
1073
|
+
reservable: number;
|
|
1327
1074
|
}
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1075
|
+
/**
|
|
1076
|
+
* CPUStats interface
|
|
1077
|
+
*/
|
|
1078
|
+
interface CPUStats {
|
|
1079
|
+
/** The core amount the host machine has. */
|
|
1080
|
+
cores: number;
|
|
1081
|
+
/** The system load. */
|
|
1082
|
+
systemLoad: number;
|
|
1083
|
+
/** The lavalink load. */
|
|
1084
|
+
lavalinkLoad: number;
|
|
1331
1085
|
}
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1086
|
+
/**
|
|
1087
|
+
* FrameStats interface
|
|
1088
|
+
*/
|
|
1089
|
+
interface FrameStats {
|
|
1090
|
+
/** The amount of sent frames. */
|
|
1091
|
+
sent?: number;
|
|
1092
|
+
/** The amount of nulled frames. */
|
|
1093
|
+
nulled?: number;
|
|
1094
|
+
/** The amount of deficit frames. */
|
|
1095
|
+
deficit?: number;
|
|
1336
1096
|
}
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1097
|
+
/**
|
|
1098
|
+
* LavalinkInfo interface
|
|
1099
|
+
*/
|
|
1100
|
+
interface LavalinkInfo {
|
|
1101
|
+
version: {
|
|
1102
|
+
semver: string;
|
|
1103
|
+
major: number;
|
|
1104
|
+
minor: number;
|
|
1105
|
+
patch: number;
|
|
1106
|
+
preRelease: string;
|
|
1107
|
+
};
|
|
1108
|
+
buildTime: number;
|
|
1109
|
+
git: {
|
|
1110
|
+
branch: string;
|
|
1111
|
+
commit: string;
|
|
1112
|
+
commitTime: number;
|
|
1113
|
+
};
|
|
1114
|
+
jvm: string;
|
|
1115
|
+
lavaplayer: string;
|
|
1116
|
+
sourceManagers: string[];
|
|
1117
|
+
filters: string[];
|
|
1118
|
+
plugins: {
|
|
1119
|
+
name: string;
|
|
1120
|
+
version: string;
|
|
1121
|
+
}[];
|
|
1341
1122
|
}
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1123
|
+
/**
|
|
1124
|
+
* LyricsLine interface
|
|
1125
|
+
*/
|
|
1126
|
+
interface LyricsLine {
|
|
1127
|
+
timestamp: number;
|
|
1128
|
+
duration: number;
|
|
1129
|
+
line: string;
|
|
1130
|
+
plugin: object;
|
|
1345
1131
|
}
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1132
|
+
/**
|
|
1133
|
+
* Lyrics interface
|
|
1134
|
+
*/
|
|
1135
|
+
interface Lyrics {
|
|
1136
|
+
source: string;
|
|
1137
|
+
provider: string;
|
|
1138
|
+
text?: string;
|
|
1139
|
+
lines: LyricsLine[];
|
|
1140
|
+
plugin: object[];
|
|
1349
1141
|
}
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1142
|
+
/**
|
|
1143
|
+
* PlayerOptions interface
|
|
1144
|
+
*/
|
|
1145
|
+
interface PlayerOptions {
|
|
1146
|
+
/** The guild ID the Player belongs to. */
|
|
1147
|
+
guildId: string;
|
|
1148
|
+
/** The text channel the Player belongs to. */
|
|
1149
|
+
textChannelId: string;
|
|
1150
|
+
/** The voice channel the Player belongs to. */
|
|
1151
|
+
voiceChannelId?: string;
|
|
1152
|
+
/** The node the Player uses. */
|
|
1153
|
+
node?: string;
|
|
1154
|
+
/** The initial volume the Player will use. */
|
|
1155
|
+
volume?: number;
|
|
1156
|
+
/** If the player should mute itself. */
|
|
1157
|
+
selfMute?: boolean;
|
|
1158
|
+
/** If the player should deaf itself. */
|
|
1159
|
+
selfDeafen?: boolean;
|
|
1355
1160
|
}
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1161
|
+
/**
|
|
1162
|
+
* PlayOptions interface
|
|
1163
|
+
*/
|
|
1164
|
+
interface PlayOptions {
|
|
1165
|
+
/** The position to start the track. */
|
|
1166
|
+
readonly startTime?: number;
|
|
1167
|
+
/** The position to end the track. */
|
|
1168
|
+
readonly endTime?: number;
|
|
1169
|
+
/** Whether to not replace the track if a play payload is sent. */
|
|
1170
|
+
readonly noReplace?: boolean;
|
|
1359
1171
|
}
|
|
1360
|
-
interface
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
currentChannel: string | null;
|
|
1172
|
+
interface ManagerInitOptions {
|
|
1173
|
+
clientId?: string;
|
|
1174
|
+
clusterId?: number;
|
|
1364
1175
|
}
|
|
1365
|
-
interface
|
|
1366
|
-
/** The
|
|
1367
|
-
|
|
1368
|
-
/** The
|
|
1369
|
-
|
|
1176
|
+
interface EqualizerBand {
|
|
1177
|
+
/** The band number being 0 to 14. */
|
|
1178
|
+
band: number;
|
|
1179
|
+
/** The gain amount being -0.25 to 1.00, 0.25 being double. */
|
|
1180
|
+
gain: number;
|
|
1370
1181
|
}
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1182
|
+
/**
|
|
1183
|
+
* PlayerStore interface
|
|
1184
|
+
*/
|
|
1185
|
+
interface PlayerStore {
|
|
1186
|
+
get(guildId: string): Promise<Player | undefined>;
|
|
1187
|
+
set(guildId: string, player: Player): Promise<void>;
|
|
1188
|
+
delete(guildId: string): Promise<void>;
|
|
1189
|
+
keys(): Promise<string[]>;
|
|
1190
|
+
has(guildId: string): Promise<boolean>;
|
|
1191
|
+
filter(predicate: (player: Player, guildId: string) => boolean | Promise<boolean>): Promise<Map<string, Player>>;
|
|
1192
|
+
find(predicate: (player: Player, guildId: string) => boolean | Promise<boolean>): Promise<Player | undefined>;
|
|
1193
|
+
map<T>(callback: (player: Player, guildId: string) => T | Promise<T>): Promise<T[]>;
|
|
1194
|
+
forEach(callback: (player: Player, guildId: string) => void | Promise<void>): Promise<void>;
|
|
1195
|
+
some(predicate: (player: Player, guildId: string) => boolean | Promise<boolean>): Promise<boolean>;
|
|
1196
|
+
every(predicate: (player: Player, guildId: string) => boolean | Promise<boolean>): Promise<boolean>;
|
|
1197
|
+
size(): Promise<number>;
|
|
1198
|
+
clear(): Promise<void>;
|
|
1199
|
+
entries(): AsyncIterableIterator<[string, Player]>;
|
|
1374
1200
|
}
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
/** The playlist name. */
|
|
1407
|
-
name: string;
|
|
1408
|
-
/** Requester of playlist. */
|
|
1409
|
-
requester: User | ClientUser;
|
|
1410
|
-
/** More playlist information. */
|
|
1411
|
-
playlistInfo: PlaylistInfoData[];
|
|
1412
|
-
/** The length of the playlist. */
|
|
1413
|
-
duration: number;
|
|
1414
|
-
/** The songs of the playlist. */
|
|
1415
|
-
tracks: Track[];
|
|
1416
|
-
}
|
|
1417
|
-
declare enum ManagerEventTypes {
|
|
1418
|
-
ChapterStarted = "chapterStarted",
|
|
1419
|
-
ChaptersLoaded = "chaptersLoaded",
|
|
1420
|
-
Debug = "debug",
|
|
1421
|
-
NodeConnect = "nodeConnect",
|
|
1422
|
-
NodeCreate = "nodeCreate",
|
|
1423
|
-
NodeDestroy = "nodeDestroy",
|
|
1424
|
-
NodeDisconnect = "nodeDisconnect",
|
|
1425
|
-
NodeError = "nodeError",
|
|
1426
|
-
NodeRaw = "nodeRaw",
|
|
1427
|
-
NodeReconnect = "nodeReconnect",
|
|
1428
|
-
PlayerCreate = "playerCreate",
|
|
1429
|
-
PlayerDestroy = "playerDestroy",
|
|
1430
|
-
PlayerDisconnect = "playerDisconnect",
|
|
1431
|
-
PlayerMove = "playerMove",
|
|
1432
|
-
PlayerRestored = "playerRestored",
|
|
1433
|
-
PlayerStateUpdate = "playerStateUpdate",
|
|
1434
|
-
QueueEnd = "queueEnd",
|
|
1435
|
-
RestoreComplete = "restoreComplete",
|
|
1436
|
-
SegmentSkipped = "segmentSkipped",
|
|
1437
|
-
SegmentsLoaded = "segmentsLoaded",
|
|
1438
|
-
SocketClosed = "socketClosed",
|
|
1439
|
-
TrackEnd = "trackEnd",
|
|
1440
|
-
TrackError = "trackError",
|
|
1441
|
-
TrackStart = "trackStart",
|
|
1442
|
-
TrackStuck = "trackStuck"
|
|
1201
|
+
/**
|
|
1202
|
+
* Queue interface
|
|
1203
|
+
*/
|
|
1204
|
+
interface IQueue {
|
|
1205
|
+
getCurrent(): Promise<Track | null>;
|
|
1206
|
+
setCurrent(track: Track | null): Promise<void>;
|
|
1207
|
+
getPrevious(): Promise<Track[]>;
|
|
1208
|
+
addPrevious(track: Track | Track[]): Promise<void>;
|
|
1209
|
+
setPrevious(track: Track | Track[]): Promise<void>;
|
|
1210
|
+
/** Get newest track (index 0) */
|
|
1211
|
+
popPrevious(): Promise<Track | null>;
|
|
1212
|
+
clearPrevious(): Promise<void>;
|
|
1213
|
+
size(): Promise<number>;
|
|
1214
|
+
totalSize(): Promise<number>;
|
|
1215
|
+
duration(): Promise<number>;
|
|
1216
|
+
add(track: Track | Track[], offset?: number): Promise<void>;
|
|
1217
|
+
remove(start?: number, end?: number): Promise<Track[]>;
|
|
1218
|
+
clear(): Promise<void>;
|
|
1219
|
+
dequeue(): Promise<Track | undefined>;
|
|
1220
|
+
enqueueFront(track: Track | Track[]): Promise<void>;
|
|
1221
|
+
getTracks(): Promise<Track[]>;
|
|
1222
|
+
getSlice(start?: number, end?: number): Promise<Track[]>;
|
|
1223
|
+
modifyAt(start: number, deleteCount?: number, ...items: Track[]): Promise<Track[]>;
|
|
1224
|
+
shuffle(): Promise<void>;
|
|
1225
|
+
userBlockShuffle(): Promise<void>;
|
|
1226
|
+
roundRobinShuffle(): Promise<void>;
|
|
1227
|
+
mapAsync<T>(callback: (track: Track, index: number, array: Track[]) => T): Promise<T[]>;
|
|
1228
|
+
filterAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<Track[]>;
|
|
1229
|
+
findAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<Track | undefined>;
|
|
1230
|
+
someAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<boolean>;
|
|
1231
|
+
everyAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<boolean>;
|
|
1443
1232
|
}
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1233
|
+
/**
|
|
1234
|
+
* Sizes Enum type
|
|
1235
|
+
*/
|
|
1236
|
+
type Sizes = "0" | "1" | "2" | "3" | "default" | "mqdefault" | "hqdefault" | "maxresdefault";
|
|
1237
|
+
/**
|
|
1238
|
+
* Track Source Name Enum type
|
|
1239
|
+
*/
|
|
1240
|
+
type TrackSourceName = keyof typeof TrackSourceTypes;
|
|
1241
|
+
/**
|
|
1242
|
+
* Use Node Option Enum type
|
|
1243
|
+
*/
|
|
1244
|
+
type UseNodeOption = keyof typeof UseNodeOptions;
|
|
1245
|
+
/**
|
|
1246
|
+
* Track End Reason Enum type
|
|
1247
|
+
*/
|
|
1248
|
+
type TrackEndReason = keyof typeof TrackEndReasonTypes;
|
|
1249
|
+
/**
|
|
1250
|
+
* Player Event Type Enum type
|
|
1251
|
+
*/
|
|
1252
|
+
type PlayerEventType = "TrackStartEvent" | "TrackEndEvent" | "TrackExceptionEvent" | "TrackStuckEvent" | "WebSocketClosedEvent" | "SegmentSkipped" | "SegmentsLoaded" | "ChaptersLoaded" | "ChapterStarted";
|
|
1253
|
+
/**
|
|
1254
|
+
* Severity Types Enum type
|
|
1255
|
+
*/
|
|
1256
|
+
type Severity = keyof typeof SeverityTypes;
|
|
1257
|
+
/**
|
|
1258
|
+
* SponsorBlock Segment Events Enum type
|
|
1259
|
+
*/
|
|
1260
|
+
type SponsorBlockSegmentEvents = SponsorBlockSegmentSkipped | SponsorBlockSegmentsLoaded | SponsorBlockChapterStarted | SponsorBlockChaptersLoaded;
|
|
1261
|
+
/**
|
|
1262
|
+
* SponsorBlock Segment Event Type Enum type
|
|
1263
|
+
*/
|
|
1264
|
+
type SponsorBlockSegmentEventType = "SegmentSkipped" | "SegmentsLoaded" | "ChapterStarted" | "ChaptersLoaded";
|
|
1265
|
+
/**
|
|
1266
|
+
* Player Events Enum type
|
|
1267
|
+
*/
|
|
1268
|
+
type PlayerEvents = TrackStartEvent | TrackEndEvent | TrackStuckEvent | TrackExceptionEvent | WebSocketClosedEvent | SponsorBlockSegmentEvents;
|
|
1269
|
+
/**
|
|
1270
|
+
* Load Type Enum type
|
|
1271
|
+
*/
|
|
1272
|
+
type LoadType = keyof typeof LoadTypes;
|
|
1273
|
+
|
|
1274
|
+
declare class Node$1 {
|
|
1275
|
+
manager: Manager;
|
|
1276
|
+
options: NodeOptions;
|
|
1277
|
+
/** The socket for the node. */
|
|
1278
|
+
socket: WebSocket | null;
|
|
1279
|
+
/** The stats for the node. */
|
|
1280
|
+
stats: NodeStats;
|
|
1281
|
+
/** The manager for the node */
|
|
1282
|
+
/** The node's session ID. */
|
|
1283
|
+
sessionId: string | null;
|
|
1284
|
+
/** The REST instance. */
|
|
1285
|
+
readonly rest: Rest;
|
|
1286
|
+
/** Actual Lavalink information of the node. */
|
|
1287
|
+
info: LavalinkInfo | null;
|
|
1288
|
+
private reconnectTimeout?;
|
|
1289
|
+
private reconnectAttempts;
|
|
1290
|
+
/**
|
|
1291
|
+
* Creates an instance of Node.
|
|
1292
|
+
* @param options
|
|
1293
|
+
*/
|
|
1294
|
+
constructor(manager: Manager, options: NodeOptions);
|
|
1295
|
+
/** Returns if connected to the Node. */
|
|
1296
|
+
get connected(): boolean;
|
|
1297
|
+
/** Returns the address for this node. */
|
|
1298
|
+
get address(): string;
|
|
1299
|
+
/**
|
|
1300
|
+
* Creates the sessionIds.json file if it doesn't exist. This file is used to
|
|
1301
|
+
* store the session IDs for each node. The session IDs are used to identify
|
|
1302
|
+
* the node when resuming a session.
|
|
1303
|
+
*/
|
|
1304
|
+
createSessionIdsFile(): void;
|
|
1305
|
+
/**
|
|
1306
|
+
* Loads session IDs from the sessionIds.json file if it exists.
|
|
1307
|
+
* The session IDs are used to resume sessions for each node.
|
|
1308
|
+
*
|
|
1309
|
+
* The session IDs are stored in the sessionIds.json file as a composite key
|
|
1310
|
+
* of the node identifier and cluster ID. This allows multiple clusters to
|
|
1311
|
+
* be used with the same node identifier.
|
|
1312
|
+
*/
|
|
1313
|
+
loadSessionIds(): void;
|
|
1314
|
+
/**
|
|
1315
|
+
* Updates the session ID in the sessionIds.json file.
|
|
1316
|
+
*
|
|
1317
|
+
* This method is called after the session ID has been updated, and it
|
|
1318
|
+
* writes the new session ID to the sessionIds.json file.
|
|
1319
|
+
*
|
|
1320
|
+
* @remarks
|
|
1321
|
+
* The session ID is stored in the sessionIds.json file as a composite key
|
|
1322
|
+
* of the node identifier and cluster ID. This allows multiple clusters to
|
|
1323
|
+
* be used with the same node identifier.
|
|
1324
|
+
*/
|
|
1325
|
+
updateSessionId(): void;
|
|
1326
|
+
/**
|
|
1327
|
+
* Connects to the Node.
|
|
1328
|
+
*
|
|
1329
|
+
* @remarks
|
|
1330
|
+
* If the node is already connected, this method will do nothing.
|
|
1331
|
+
* If the node has a session ID, it will be sent in the headers of the WebSocket connection.
|
|
1332
|
+
* If the node has no session ID but the `enableSessionResumeOption` option is true, it will use the session ID
|
|
1333
|
+
* stored in the sessionIds.json file if it exists.
|
|
1334
|
+
*/
|
|
1335
|
+
connect(): void;
|
|
1336
|
+
/**
|
|
1337
|
+
* Destroys the node and cleans up associated resources.
|
|
1338
|
+
*
|
|
1339
|
+
* This method emits a debug event indicating that the node is being destroyed and attempts
|
|
1340
|
+
* to automatically move all players connected to the node to a usable one. It then closes
|
|
1341
|
+
* the WebSocket connection, removes all event listeners, and clears the reconnect timeout.
|
|
1342
|
+
* Finally, it emits a "nodeDestroy" event and removes the node from the manager.
|
|
1343
|
+
*
|
|
1344
|
+
* @returns {Promise<void>} A promise that resolves when the node and its resources have been destroyed.
|
|
1345
|
+
*/
|
|
1346
|
+
destroy(): Promise<void>;
|
|
1347
|
+
/**
|
|
1348
|
+
* Attempts to reconnect to the node if the connection is lost.
|
|
1349
|
+
*
|
|
1350
|
+
* This method is called when the WebSocket connection is closed
|
|
1351
|
+
* unexpectedly. It will attempt to reconnect to the node after a
|
|
1352
|
+
* specified delay, and will continue to do so until the maximum
|
|
1353
|
+
* number of retry attempts is reached or the node is manually destroyed.
|
|
1354
|
+
* If the maximum number of retry attempts is reached, an error event
|
|
1355
|
+
* will be emitted and the node will be destroyed.
|
|
1356
|
+
*
|
|
1357
|
+
* @returns {Promise<void>} - Resolves when the reconnection attempt is scheduled.
|
|
1358
|
+
* @emits {debug} - Emits a debug event indicating the node is attempting to reconnect.
|
|
1359
|
+
* @emits {nodeReconnect} - Emits a nodeReconnect event when the node is attempting to reconnect.
|
|
1360
|
+
* @emits {nodeError} - Emits an error event if the maximum number of retry attempts is reached.
|
|
1361
|
+
* @emits {nodeDestroy} - Emits a nodeDestroy event if the maximum number of retry attempts is reached.
|
|
1362
|
+
*/
|
|
1363
|
+
private reconnect;
|
|
1364
|
+
/**
|
|
1365
|
+
* Handles the "open" event emitted by the WebSocket connection.
|
|
1366
|
+
*
|
|
1367
|
+
* This method is called when the WebSocket connection is established.
|
|
1368
|
+
* It clears any existing reconnect timeouts, emits a debug event
|
|
1369
|
+
* indicating the node is connected, and emits a "nodeConnect" event
|
|
1370
|
+
* with the node as the argument.
|
|
1371
|
+
*/
|
|
1372
|
+
protected open(): void;
|
|
1373
|
+
/**
|
|
1374
|
+
* Handles the "close" event emitted by the WebSocket connection.
|
|
1375
|
+
*
|
|
1376
|
+
* This method is called when the WebSocket connection is closed.
|
|
1377
|
+
* It emits a "nodeDisconnect" event with the node and the close event as arguments,
|
|
1378
|
+
* and a debug event indicating the node is disconnected.
|
|
1379
|
+
* It then attempts to move all players connected to that node to a useable one.
|
|
1380
|
+
* If the close event was not initiated by the user, it will also attempt to reconnect.
|
|
1381
|
+
*
|
|
1382
|
+
* @param {number} code The close code of the WebSocket connection.
|
|
1383
|
+
* @param {string} reason The reason for the close event.
|
|
1384
|
+
* @returns {Promise<void>} A promise that resolves when the disconnection is handled.
|
|
1385
|
+
*/
|
|
1386
|
+
protected close(code: number, reason: string): Promise<void>;
|
|
1387
|
+
/**
|
|
1388
|
+
* Handles the "error" event emitted by the WebSocket connection.
|
|
1389
|
+
*
|
|
1390
|
+
* This method is called when an error occurs on the WebSocket connection.
|
|
1391
|
+
* It emits a "nodeError" event with the node and the error as arguments and
|
|
1392
|
+
* a debug event indicating the error on the node.
|
|
1393
|
+
* @param {Error} error The error that occurred.
|
|
1394
|
+
*/
|
|
1395
|
+
protected error(error: Error): void;
|
|
1396
|
+
/**
|
|
1397
|
+
* Handles incoming messages from the Lavalink WebSocket connection.
|
|
1398
|
+
* @param {Buffer | string} d The message received from the WebSocket connection.
|
|
1399
|
+
* @returns {Promise<void>} A promise that resolves when the message is handled.
|
|
1400
|
+
* @emits {debug} - Emits a debug event with the message received from the WebSocket connection.
|
|
1401
|
+
* @emits {nodeError} - Emits a nodeError event if an unexpected op is received.
|
|
1402
|
+
* @emits {nodeRaw} - Emits a nodeRaw event with the raw message received from the WebSocket connection.
|
|
1403
|
+
* @private
|
|
1404
|
+
*/
|
|
1405
|
+
protected message(d: Buffer | string): Promise<void>;
|
|
1406
|
+
/**
|
|
1407
|
+
* Handles an event emitted from the Lavalink node.
|
|
1408
|
+
* @param {PlayerEvent & PlayerEvents} payload The event emitted from the node.
|
|
1409
|
+
* @returns {Promise<void>} A promise that resolves when the event has been handled.
|
|
1410
|
+
* @private
|
|
1411
|
+
*/
|
|
1412
|
+
protected handleEvent(payload: PlayerEvent & PlayerEvents): Promise<void>;
|
|
1413
|
+
/**
|
|
1414
|
+
* Emitted when a new track starts playing.
|
|
1415
|
+
* @param {Player} player The player that started playing the track.
|
|
1416
|
+
* @param {Track} track The track that started playing.
|
|
1417
|
+
* @param {TrackStartEvent} payload The payload of the event emitted by the node.
|
|
1418
|
+
* @private
|
|
1419
|
+
*/
|
|
1420
|
+
protected trackStart(player: Player, track: Track, payload: TrackStartEvent): void;
|
|
1421
|
+
/**
|
|
1422
|
+
* Emitted when a track ends playing.
|
|
1423
|
+
* @param {Player} player - The player that the track ended on.
|
|
1424
|
+
* @param {Track} track - The track that ended.
|
|
1425
|
+
* @param {TrackEndEvent} payload - The payload of the event emitted by the node.
|
|
1426
|
+
* @private
|
|
1427
|
+
*/
|
|
1428
|
+
protected trackEnd(player: Player, track: Track, payload: TrackEndEvent): Promise<void>;
|
|
1429
|
+
/**
|
|
1430
|
+
* Handles autoplay logic for a player.
|
|
1431
|
+
* This method is responsible for selecting an appropriate method of autoplay
|
|
1432
|
+
* and executing it. If autoplay is not enabled or all attempts have failed,
|
|
1433
|
+
* it will return false.
|
|
1434
|
+
* @param {Player} player - The player to handle autoplay for.
|
|
1435
|
+
* @param {number} attempt - The current attempt number of the autoplay.
|
|
1436
|
+
* @returns {Promise<boolean>} A promise that resolves to a boolean indicating if autoplay was successful.
|
|
1437
|
+
* @private
|
|
1438
|
+
*/
|
|
1439
|
+
private handleAutoplay;
|
|
1440
|
+
/**
|
|
1441
|
+
* Handles the scenario when a track fails to play or load.
|
|
1442
|
+
* Shifts the queue to the next track and emits a track end event.
|
|
1443
|
+
* If there is no next track, handles the queue end scenario.
|
|
1444
|
+
* If autoplay is enabled, plays the next track.
|
|
1445
|
+
*
|
|
1446
|
+
* @param {Player} player - The player instance associated with the track.
|
|
1447
|
+
* @param {Track} track - The track that failed.
|
|
1448
|
+
* @param {TrackEndEvent} payload - The event payload containing details about the track end.
|
|
1449
|
+
* @returns {Promise<void>} A promise that resolves when the track failure has been processed.
|
|
1450
|
+
* @private
|
|
1451
|
+
*/
|
|
1452
|
+
private handleFailedTrack;
|
|
1453
|
+
/**
|
|
1454
|
+
* Handles the scenario when a track is repeated.
|
|
1455
|
+
* Shifts the queue to the next track and emits a track end event.
|
|
1456
|
+
* If there is no next track, handles the queue end scenario.
|
|
1457
|
+
* If autoplay is enabled, plays the next track.
|
|
1458
|
+
*
|
|
1459
|
+
* @param {Player} player - The player instance associated with the track.
|
|
1460
|
+
* @param {Track} track - The track that is repeated.
|
|
1461
|
+
* @param {TrackEndEvent} payload - The event payload containing details about the track end.
|
|
1462
|
+
* @returns {Promise<void>} A promise that resolves when the repeated track has been processed.
|
|
1463
|
+
* @private
|
|
1464
|
+
*/
|
|
1465
|
+
private handleRepeatedTrack;
|
|
1466
|
+
/**
|
|
1467
|
+
* Plays the next track in the queue.
|
|
1468
|
+
* Updates the queue by shifting the current track to the previous track
|
|
1469
|
+
* and plays the next track if autoplay is enabled.
|
|
1470
|
+
*
|
|
1471
|
+
* @param {Player} player - The player associated with the track.
|
|
1472
|
+
* @param {Track} track - The track that has ended.
|
|
1473
|
+
* @param {TrackEndEvent} payload - The event payload containing additional data about the track end event.
|
|
1474
|
+
* @returns {void}
|
|
1475
|
+
* @private
|
|
1476
|
+
*/
|
|
1477
|
+
private playNextTrack;
|
|
1478
|
+
/**
|
|
1479
|
+
* Handles the event when a queue ends.
|
|
1480
|
+
* If autoplay is enabled, attempts to play the next track in the queue using the autoplay logic.
|
|
1481
|
+
* If all attempts fail, resets the player state and emits the `queueEnd` event.
|
|
1482
|
+
* @param {Player} player - The player associated with the track.
|
|
1483
|
+
* @param {Track} track - The track that has ended.
|
|
1484
|
+
* @param {TrackEndEvent} payload - The event payload containing additional data about the track end event.
|
|
1485
|
+
* @returns {Promise<void>} A promise that resolves when the queue end processing is complete.
|
|
1486
|
+
*/
|
|
1487
|
+
queueEnd(player: Player, track: Track, payload: TrackEndEvent): Promise<void>;
|
|
1488
|
+
/**
|
|
1489
|
+
* Fetches the lyrics of a track from the Lavalink node.
|
|
1490
|
+
* This method uses the `lavalyrics-plugin` to fetch the lyrics.
|
|
1491
|
+
* If the plugin is not available, it will throw a RangeError.
|
|
1492
|
+
*
|
|
1493
|
+
* @param {Track} track - The track to fetch the lyrics for.
|
|
1494
|
+
* @param {boolean} [skipTrackSource=false] - Whether to skip using the track's source URL.
|
|
1495
|
+
* @returns {Promise<Lyrics>} A promise that resolves with the lyrics data.
|
|
1496
|
+
*/
|
|
1497
|
+
getLyrics(track: Track, skipTrackSource?: boolean): Promise<Lyrics>;
|
|
1498
|
+
/**
|
|
1499
|
+
* Handles the event when a track becomes stuck during playback.
|
|
1500
|
+
* Stops the current track and emits a `trackStuck` event.
|
|
1501
|
+
*
|
|
1502
|
+
* @param {Player} player - The player associated with the track that became stuck.
|
|
1503
|
+
* @param {Track} track - The track that became stuck.
|
|
1504
|
+
* @param {TrackStuckEvent} payload - The event payload containing additional data about the track stuck event.
|
|
1505
|
+
* @returns {void}
|
|
1506
|
+
* @protected
|
|
1507
|
+
*/
|
|
1508
|
+
protected trackStuck(player: Player, track: Track, payload: TrackStuckEvent): Promise<void>;
|
|
1509
|
+
/**
|
|
1510
|
+
* Handles the event when a track has an error during playback.
|
|
1511
|
+
* Stops the current track and emits a `trackError` event.
|
|
1512
|
+
*
|
|
1513
|
+
* @param {Player} player - The player associated with the track that had an error.
|
|
1514
|
+
* @param {Track} track - The track that had an error.
|
|
1515
|
+
* @param {TrackExceptionEvent} payload - The event payload containing additional data about the track error event.
|
|
1516
|
+
* @returns {void}
|
|
1517
|
+
* @protected
|
|
1518
|
+
*/
|
|
1519
|
+
protected trackError(player: Player, track: Track, payload: TrackExceptionEvent): Promise<void>;
|
|
1520
|
+
/**
|
|
1521
|
+
* Emitted when the WebSocket connection for a player closes.
|
|
1522
|
+
* The payload of the event will contain the close code and reason if provided.
|
|
1523
|
+
* @param {Player} player - The player associated with the WebSocket connection.
|
|
1524
|
+
* @param {WebSocketClosedEvent} payload - The event payload containing additional data about the WebSocket close event.
|
|
1525
|
+
*/
|
|
1526
|
+
protected socketClosed(player: Player, payload: WebSocketClosedEvent): void;
|
|
1527
|
+
/**
|
|
1528
|
+
* Emitted when the segments for a track are loaded.
|
|
1529
|
+
* The payload of the event will contain the segments.
|
|
1530
|
+
* @param {Player} player - The player associated with the segments.
|
|
1531
|
+
* @param {Track} track - The track associated with the segments.
|
|
1532
|
+
* @param {SponsorBlockSegmentsLoaded} payload - The event payload containing additional data about the segments loaded event.
|
|
1533
|
+
*/
|
|
1534
|
+
private sponsorBlockSegmentLoaded;
|
|
1535
|
+
/**
|
|
1536
|
+
* Emitted when a segment of a track is skipped using the sponsorblock plugin.
|
|
1537
|
+
* The payload of the event will contain the skipped segment.
|
|
1538
|
+
* @param {Player} player - The player associated with the skipped segment.
|
|
1539
|
+
* @param {Track} track - The track associated with the skipped segment.
|
|
1540
|
+
* @param {SponsorBlockSegmentSkipped} payload - The event payload containing additional data about the segment skipped event.
|
|
1541
|
+
*/
|
|
1542
|
+
private sponsorBlockSegmentSkipped;
|
|
1543
|
+
/**
|
|
1544
|
+
* Emitted when chapters for a track are loaded using the sponsorblock plugin.
|
|
1545
|
+
* The payload of the event will contain the chapters.
|
|
1546
|
+
* @param {Player} player - The player associated with the chapters.
|
|
1547
|
+
* @param {Track} track - The track associated with the chapters.
|
|
1548
|
+
* @param {SponsorBlockChaptersLoaded} payload - The event payload containing additional data about the chapters loaded event.
|
|
1549
|
+
*/
|
|
1550
|
+
private sponsorBlockChaptersLoaded;
|
|
1551
|
+
/**
|
|
1552
|
+
* Emitted when a chapter of a track is started using the sponsorblock plugin.
|
|
1553
|
+
* The payload of the event will contain the started chapter.
|
|
1554
|
+
* @param {Player} player - The player associated with the started chapter.
|
|
1555
|
+
* @param {Track} track - The track associated with the started chapter.
|
|
1556
|
+
* @param {SponsorBlockChapterStarted} payload - The event payload containing additional data about the chapter started event.
|
|
1557
|
+
*/
|
|
1558
|
+
private sponsorBlockChapterStarted;
|
|
1559
|
+
/**
|
|
1560
|
+
* Fetches Lavalink node information.
|
|
1561
|
+
* @returns {Promise<LavalinkInfo>} A promise that resolves to the Lavalink node information.
|
|
1562
|
+
*/
|
|
1563
|
+
fetchInfo(): Promise<LavalinkInfo>;
|
|
1564
|
+
/**
|
|
1565
|
+
* Gets the current sponsorblock segments for a player.
|
|
1566
|
+
* @param {Player} player - The player to get the sponsorblocks for.
|
|
1567
|
+
* @returns {Promise<SponsorBlockSegment[]>} A promise that resolves to the sponsorblock segments.
|
|
1568
|
+
* @throws {RangeError} If the sponsorblock-plugin is not available in the Lavalink node.
|
|
1569
|
+
*/
|
|
1570
|
+
getSponsorBlock(player: Player): Promise<SponsorBlockSegment[]>;
|
|
1571
|
+
/**
|
|
1572
|
+
* Sets the sponsorblock segments for a player.
|
|
1573
|
+
* @param {Player} player - The player to set the sponsor blocks for.
|
|
1574
|
+
* @param {SponsorBlockSegment[]} segments - The sponsorblock segments to set. Defaults to `[SponsorBlockSegment.Sponsor, SponsorBlockSegment.SelfPromo]` if not provided.
|
|
1575
|
+
* @returns {Promise<void>} The promise is resolved when the operation is complete.
|
|
1576
|
+
* @throws {RangeError} If the sponsorblock-plugin is not available in the Lavalink node.
|
|
1577
|
+
* @throws {RangeError} If no segments are provided.
|
|
1578
|
+
* @throws {SyntaxError} If an invalid sponsorblock is provided.
|
|
1579
|
+
* @example
|
|
1580
|
+
* ```ts
|
|
1581
|
+
* // use it on the player via player.setSponsorBlock();
|
|
1582
|
+
* player.setSponsorBlock([SponsorBlockSegment.Sponsor, SponsorBlockSegment.SelfPromo]);
|
|
1583
|
+
* ```
|
|
1584
|
+
*/
|
|
1585
|
+
setSponsorBlock(player: Player, segments?: SponsorBlockSegment[]): Promise<void>;
|
|
1586
|
+
/**
|
|
1587
|
+
* Deletes the sponsorblock segments for a player.
|
|
1588
|
+
* @param {Player} player - The player to delete the sponsorblocks for.
|
|
1589
|
+
* @returns {Promise<void>} The promise is resolved when the operation is complete.
|
|
1590
|
+
* @throws {RangeError} If the sponsorblock-plugin is not available in the Lavalink node.
|
|
1591
|
+
*/
|
|
1592
|
+
deleteSponsorBlock(player: Player): Promise<void>;
|
|
1593
|
+
/**
|
|
1594
|
+
* Creates a README.md or README.txt file in the magmastream directory
|
|
1595
|
+
* if it doesn't already exist. This file is used to store player data
|
|
1596
|
+
* for autoresume and other features.
|
|
1597
|
+
* @private
|
|
1598
|
+
*/
|
|
1599
|
+
private createReadmeFile;
|
|
1473
1600
|
}
|
|
1474
|
-
|
|
1601
|
+
|
|
1602
|
+
/**
|
|
1603
|
+
* The main hub for interacting with Lavalink and using Magmastream,
|
|
1604
|
+
*/
|
|
1605
|
+
declare class Manager extends EventEmitter {
|
|
1606
|
+
/** The map of players. */
|
|
1607
|
+
readonly players: Collection<string, Player>;
|
|
1608
|
+
/** The map of nodes. */
|
|
1609
|
+
readonly nodes: Collection<string, Node$1>;
|
|
1610
|
+
/** The options that were set. */
|
|
1611
|
+
readonly options: ManagerOptions;
|
|
1612
|
+
initiated: boolean;
|
|
1613
|
+
redis?: Redis;
|
|
1614
|
+
private _send?;
|
|
1615
|
+
/**
|
|
1616
|
+
* Initiates the Manager class.
|
|
1617
|
+
* @param options
|
|
1618
|
+
* @param options.enabledPlugins - An array of enabledPlugins to load.
|
|
1619
|
+
* @param options.nodes - An array of node options to create nodes from.
|
|
1620
|
+
* @param options.playNextOnEnd - Whether to automatically play the first track in the queue when the player is created.
|
|
1621
|
+
* @param options.autoPlaySearchPlatforms - The search platform autoplay will use. Fallback to Youtube if not found.
|
|
1622
|
+
* @param options.enablePriorityMode - Whether to use the priority when selecting a node to play on.
|
|
1623
|
+
* @param options.clientName - The name of the client to send to Lavalink.
|
|
1624
|
+
* @param options.defaultSearchPlatform - The default search platform to use when searching for tracks.
|
|
1625
|
+
* @param options.useNode - The strategy to use when selecting a node to play on.
|
|
1626
|
+
* @param options.trackPartial - The partial track search results to use when searching for tracks. This partials will always be presented on each track.
|
|
1627
|
+
* @param options.eventBatchDuration - The duration to wait before processing the collected player state events.
|
|
1628
|
+
* @param options.eventBatchInterval - The interval to wait before processing the collected player state events.
|
|
1629
|
+
*/
|
|
1630
|
+
constructor(options: ManagerOptions);
|
|
1631
|
+
/**
|
|
1632
|
+
* Initiates the Manager.
|
|
1633
|
+
* @param clientId - The Discord client ID (only required when not using any of the magmastream wrappers).
|
|
1634
|
+
* @param clusterId - The cluster ID which runs the current process (required).
|
|
1635
|
+
* @returns The manager instance.
|
|
1636
|
+
*/
|
|
1637
|
+
init(options?: ManagerInitOptions): this;
|
|
1638
|
+
/**
|
|
1639
|
+
* Searches the enabled sources based off the URL or the `source` property.
|
|
1640
|
+
* @param query
|
|
1641
|
+
* @param requester
|
|
1642
|
+
* @returns The search result.
|
|
1643
|
+
*/
|
|
1644
|
+
search<T = unknown>(query: string | SearchQuery, requester?: T): Promise<SearchResult>;
|
|
1645
|
+
/**
|
|
1646
|
+
* Returns a player or undefined if it does not exist.
|
|
1647
|
+
* @param guildId The guild ID of the player to retrieve.
|
|
1648
|
+
* @returns The player if it exists, undefined otherwise.
|
|
1649
|
+
*/
|
|
1650
|
+
getPlayer(guildId: string): Player | undefined;
|
|
1651
|
+
/**
|
|
1652
|
+
* @deprecated - Will be removed with v2.10.0 use {@link getPlayer} instead
|
|
1653
|
+
* Returns a player or undefined if it does not exist.
|
|
1654
|
+
* @param guildId The guild ID of the player to retrieve.
|
|
1655
|
+
* @returns The player if it exists, undefined otherwise.
|
|
1656
|
+
*/
|
|
1475
1657
|
get(guildId: string): Promise<Player | undefined>;
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1658
|
+
/**
|
|
1659
|
+
* Creates a player or returns one if it already exists.
|
|
1660
|
+
* @param options The options to create the player with.
|
|
1661
|
+
* @returns The created player.
|
|
1662
|
+
*/
|
|
1663
|
+
create(options: PlayerOptions): Player;
|
|
1664
|
+
/**
|
|
1665
|
+
* Destroys a player.
|
|
1666
|
+
* @param guildId The guild ID of the player to destroy.
|
|
1667
|
+
* @returns A promise that resolves when the player has been destroyed.
|
|
1668
|
+
*/
|
|
1669
|
+
destroy(guildId: string): Promise<void>;
|
|
1670
|
+
/**
|
|
1671
|
+
* Creates a new node or returns an existing one if it already exists.
|
|
1672
|
+
* @param options - The options to create the node with.
|
|
1673
|
+
* @returns The created node.
|
|
1674
|
+
*/
|
|
1675
|
+
createNode(options: NodeOptions): Node$1;
|
|
1676
|
+
/**
|
|
1677
|
+
* Destroys a node if it exists. Emits a debug event if the node is found and destroyed.
|
|
1678
|
+
* @param identifier - The identifier of the node to destroy.
|
|
1679
|
+
* @returns {void}
|
|
1680
|
+
* @emits {debug} - Emits a debug message indicating the node is being destroyed.
|
|
1681
|
+
*/
|
|
1682
|
+
destroyNode(identifier: string): Promise<void>;
|
|
1683
|
+
/**
|
|
1684
|
+
* Attaches an event listener to the manager.
|
|
1685
|
+
* @param event The event to listen for.
|
|
1686
|
+
* @param listener The function to call when the event is emitted.
|
|
1687
|
+
* @returns The manager instance for chaining.
|
|
1688
|
+
*/
|
|
1689
|
+
on<T extends keyof ManagerEvents>(event: T, listener: (...args: ManagerEvents[T]) => void): this;
|
|
1690
|
+
/**
|
|
1691
|
+
* Updates the voice state of a player based on the provided data.
|
|
1692
|
+
* @param data - The data containing voice state information, which can be a VoicePacket, VoiceServer, or VoiceState.
|
|
1693
|
+
* @returns A promise that resolves when the voice state update is handled.
|
|
1694
|
+
* @emits {debug} - Emits a debug message indicating the voice state is being updated.
|
|
1695
|
+
*/
|
|
1696
|
+
updateVoiceState(data: VoicePacket | VoiceServer | VoiceState): Promise<void>;
|
|
1697
|
+
/**
|
|
1698
|
+
* Decodes an array of base64 encoded tracks and returns an array of TrackData.
|
|
1699
|
+
* Emits a debug event with the tracks being decoded.
|
|
1700
|
+
* @param tracks - An array of base64 encoded track strings.
|
|
1701
|
+
* @returns A promise that resolves to an array of TrackData objects.
|
|
1702
|
+
* @throws Will throw an error if no nodes are available or if the API request fails.
|
|
1703
|
+
*/
|
|
1704
|
+
decodeTracks(tracks: string[]): Promise<TrackData[]>;
|
|
1705
|
+
/**
|
|
1706
|
+
* Decodes a base64 encoded track and returns a TrackData.
|
|
1707
|
+
* @param track - The base64 encoded track string.
|
|
1708
|
+
* @returns A promise that resolves to a TrackData object.
|
|
1709
|
+
* @throws Will throw an error if no nodes are available or if the API request fails.
|
|
1710
|
+
*/
|
|
1711
|
+
decodeTrack(track: string): Promise<TrackData>;
|
|
1712
|
+
/**
|
|
1713
|
+
* Saves player states to the JSON file.
|
|
1714
|
+
* @param {string} guildId - The guild ID of the player to save
|
|
1715
|
+
*/
|
|
1716
|
+
savePlayerState(guildId: string): Promise<void>;
|
|
1717
|
+
/**
|
|
1718
|
+
* Sleeps for a specified amount of time.
|
|
1719
|
+
* @param ms The amount of time to sleep in milliseconds.
|
|
1720
|
+
* @returns A promise that resolves after the specified amount of time.
|
|
1721
|
+
*/
|
|
1722
|
+
private sleep;
|
|
1723
|
+
/**
|
|
1724
|
+
* Loads player states from the JSON file.
|
|
1725
|
+
* @param nodeId The ID of the node to load player states from.
|
|
1726
|
+
* @returns A promise that resolves when the player states have been loaded.
|
|
1727
|
+
*/
|
|
1728
|
+
loadPlayerStates(nodeId: string): Promise<void>;
|
|
1729
|
+
/**
|
|
1730
|
+
* Returns the node to use based on the configured `useNode` and `enablePriorityMode` options.
|
|
1731
|
+
* If `enablePriorityMode` is true, the node is chosen based on priority, otherwise it is chosen based on the `useNode` option.
|
|
1732
|
+
* If `useNode` is "leastLoad", the node with the lowest load is chosen, if it is "leastPlayers", the node with the fewest players is chosen.
|
|
1733
|
+
* If `enablePriorityMode` is false and `useNode` is not set, the node with the lowest load is chosen.
|
|
1734
|
+
* @returns {Node} The node to use.
|
|
1735
|
+
*/
|
|
1736
|
+
get useableNode(): Node$1;
|
|
1737
|
+
/**
|
|
1738
|
+
* Handles the shutdown of the process by saving all active players' states and optionally cleaning up inactive players.
|
|
1739
|
+
* This function is called when the process is about to exit.
|
|
1740
|
+
* It iterates through all players and calls {@link savePlayerState} to save their states.
|
|
1741
|
+
* Optionally, it also calls {@link cleanupInactivePlayers} to remove any stale player state files.
|
|
1742
|
+
* After saving and cleaning up, it exits the process.
|
|
1743
|
+
*/
|
|
1744
|
+
handleShutdown(): Promise<void>;
|
|
1745
|
+
/**
|
|
1746
|
+
* Parses a YouTube title into a clean title and author.
|
|
1747
|
+
* @param title - The original title of the YouTube video.
|
|
1748
|
+
* @param originalAuthor - The original author of the YouTube video.
|
|
1749
|
+
* @returns An object with the clean title and author.
|
|
1750
|
+
*/
|
|
1751
|
+
private parseYouTubeTitle;
|
|
1752
|
+
/**
|
|
1753
|
+
* Balances brackets in a given string by ensuring all opened brackets are closed correctly.
|
|
1754
|
+
* @param str - The input string that may contain unbalanced brackets.
|
|
1755
|
+
* @returns A new string with balanced brackets.
|
|
1756
|
+
*/
|
|
1757
|
+
private balanceBrackets;
|
|
1758
|
+
/**
|
|
1759
|
+
* Escapes a string by replacing special regex characters with their escaped counterparts.
|
|
1760
|
+
* @param string - The string to escape.
|
|
1761
|
+
* @returns The escaped string.
|
|
1762
|
+
*/
|
|
1763
|
+
private escapeRegExp;
|
|
1764
|
+
/**
|
|
1765
|
+
* Checks if the given data is a voice update.
|
|
1766
|
+
* @param data The data to check.
|
|
1767
|
+
* @returns Whether the data is a voice update.
|
|
1768
|
+
*/
|
|
1769
|
+
private isVoiceUpdate;
|
|
1770
|
+
/**
|
|
1771
|
+
* Determines if the provided update is a valid voice update.
|
|
1772
|
+
* A valid update must contain either a token or a session_id.
|
|
1773
|
+
*
|
|
1774
|
+
* @param update - The voice update data to validate, which can be a VoicePacket, VoiceServer, or VoiceState.
|
|
1775
|
+
* @returns {boolean} - True if the update is valid, otherwise false.
|
|
1776
|
+
*/
|
|
1777
|
+
private isValidUpdate;
|
|
1778
|
+
/**
|
|
1779
|
+
* Handles a voice server update by updating the player's voice state and sending the voice state to the Lavalink node.
|
|
1780
|
+
* @param player The player for which the voice state is being updated.
|
|
1781
|
+
* @param update The voice server data received from Discord.
|
|
1782
|
+
* @returns A promise that resolves when the voice state update is handled.
|
|
1783
|
+
* @emits {debug} - Emits a debug message indicating the voice state is being updated.
|
|
1784
|
+
*/
|
|
1785
|
+
private handleVoiceServerUpdate;
|
|
1786
|
+
/**
|
|
1787
|
+
* Handles a voice state update by updating the player's voice channel and session ID if provided, or by disconnecting and destroying the player if the channel ID is null.
|
|
1788
|
+
* @param player The player for which the voice state is being updated.
|
|
1789
|
+
* @param update The voice state data received from Discord.
|
|
1790
|
+
* @emits {playerMove} - Emits a player move event if the channel ID is provided and the player is currently connected to a different voice channel.
|
|
1791
|
+
* @emits {playerDisconnect} - Emits a player disconnect event if the channel ID is null.
|
|
1792
|
+
*/
|
|
1793
|
+
private handleVoiceStateUpdate;
|
|
1794
|
+
/**
|
|
1795
|
+
* Gets each player's JSON file
|
|
1796
|
+
* @param {string} guildId - The guild ID
|
|
1797
|
+
* @returns {string} The path to the player's JSON file
|
|
1798
|
+
*/
|
|
1799
|
+
private getPlayerFilePath;
|
|
1800
|
+
/**
|
|
1801
|
+
* Serializes a Player instance to avoid circular references.
|
|
1802
|
+
* @param player The Player instance to serialize
|
|
1803
|
+
* @returns The serialized Player instance
|
|
1804
|
+
*/
|
|
1805
|
+
serializePlayer(player: Player): Record<string, unknown>;
|
|
1806
|
+
/**
|
|
1807
|
+
* Checks for players that are no longer active and deletes their saved state files.
|
|
1808
|
+
* This is done to prevent stale state files from accumulating on the file system.
|
|
1809
|
+
*/
|
|
1810
|
+
private cleanupInactivePlayers;
|
|
1811
|
+
/**
|
|
1812
|
+
* Returns the nodes that has the least load.
|
|
1813
|
+
* The load is calculated by dividing the lavalink load by the number of cores.
|
|
1814
|
+
* The result is multiplied by 100 to get a percentage.
|
|
1815
|
+
* @returns {Collection<string, Node>}
|
|
1816
|
+
*/
|
|
1817
|
+
private get leastLoadNode();
|
|
1818
|
+
/**
|
|
1819
|
+
* Returns the nodes that have the least amount of players.
|
|
1820
|
+
* Filters out disconnected nodes and sorts the remaining nodes
|
|
1821
|
+
* by the number of players in ascending order.
|
|
1822
|
+
* @returns {Collection<string, Node>} A collection of nodes sorted by player count.
|
|
1823
|
+
*/
|
|
1824
|
+
private get leastPlayersNode();
|
|
1825
|
+
/**
|
|
1826
|
+
* Returns a node based on priority.
|
|
1827
|
+
* The nodes are sorted by priority in descending order, and then a random number
|
|
1828
|
+
* between 0 and 1 is generated. The node that has a cumulative weight greater than or equal to the
|
|
1829
|
+
* random number is returned.
|
|
1830
|
+
* If no node has a cumulative weight greater than or equal to the random number, the node with the
|
|
1831
|
+
* lowest load is returned.
|
|
1832
|
+
* @returns {Node} The node to use.
|
|
1833
|
+
*/
|
|
1834
|
+
private get priorityNode();
|
|
1835
|
+
protected send(packet: GatewayVoiceStateUpdate): unknown;
|
|
1836
|
+
sendPacket(packet: GatewayVoiceStateUpdate): unknown;
|
|
1489
1837
|
}
|
|
1490
1838
|
|
|
1491
1839
|
declare class Player {
|
|
@@ -1509,7 +1857,7 @@ declare class Player {
|
|
|
1509
1857
|
/** The volume for the player */
|
|
1510
1858
|
volume: number;
|
|
1511
1859
|
/** The Node for the Player. */
|
|
1512
|
-
node: Node;
|
|
1860
|
+
node: Node$1;
|
|
1513
1861
|
/** The guild ID for the player. */
|
|
1514
1862
|
guildId: string;
|
|
1515
1863
|
/** The voice channel for the player. */
|
|
@@ -1530,17 +1878,22 @@ declare class Player {
|
|
|
1530
1878
|
isAutoplay: boolean;
|
|
1531
1879
|
/** The number of times to try autoplay before emitting queueEnd. */
|
|
1532
1880
|
autoplayTries: number;
|
|
1533
|
-
private static _manager;
|
|
1534
1881
|
private readonly data;
|
|
1535
|
-
private volumeFadeInProgress;
|
|
1536
1882
|
private dynamicLoopInterval;
|
|
1537
1883
|
dynamicRepeatIntervalMs: number | null;
|
|
1884
|
+
private static _manager;
|
|
1538
1885
|
/**
|
|
1539
1886
|
* Creates a new player, returns one if it already exists.
|
|
1540
1887
|
* @param options The player options.
|
|
1541
1888
|
* @see https://docs.magmastream.com/main/introduction/getting-started
|
|
1542
1889
|
*/
|
|
1543
1890
|
constructor(options: PlayerOptions);
|
|
1891
|
+
/**
|
|
1892
|
+
* Initializes the static properties of the Player class.
|
|
1893
|
+
* @hidden
|
|
1894
|
+
* @param manager The Manager to use.
|
|
1895
|
+
*/
|
|
1896
|
+
static init(manager: Manager): void;
|
|
1544
1897
|
/**
|
|
1545
1898
|
* Set custom data.
|
|
1546
1899
|
* @param key - The key to set the data for.
|
|
@@ -1554,12 +1907,6 @@ declare class Player {
|
|
|
1554
1907
|
* @returns {T} - The data associated with the key, cast to the specified type.
|
|
1555
1908
|
*/
|
|
1556
1909
|
get<T>(key: string): T;
|
|
1557
|
-
/**
|
|
1558
|
-
* Initializes the static properties of the Player class.
|
|
1559
|
-
* @hidden
|
|
1560
|
-
* @param manager The Manager to use.
|
|
1561
|
-
*/
|
|
1562
|
-
static init(manager: Manager): void;
|
|
1563
1910
|
/**
|
|
1564
1911
|
* Same as Manager#search() but a shortcut on the player itself.
|
|
1565
1912
|
* @param query
|
|
@@ -1571,11 +1918,10 @@ declare class Player {
|
|
|
1571
1918
|
* @throws {RangeError} If no voice channel has been set.
|
|
1572
1919
|
* @returns {void}
|
|
1573
1920
|
*/
|
|
1574
|
-
connect(): void
|
|
1921
|
+
connect(): Promise<void>;
|
|
1575
1922
|
/**
|
|
1576
1923
|
* Disconnects the player from the voice channel.
|
|
1577
|
-
* @
|
|
1578
|
-
* @returns {this} - The current instance of the Player class for method chaining.
|
|
1924
|
+
* @returns {this} The player instance.
|
|
1579
1925
|
*/
|
|
1580
1926
|
disconnect(): Promise<this>;
|
|
1581
1927
|
/**
|
|
@@ -1648,7 +1994,6 @@ declare class Player {
|
|
|
1648
1994
|
/**
|
|
1649
1995
|
* Sets the volume of the player.
|
|
1650
1996
|
* @param {number} volume - The new volume. Must be between 0 and 1000.
|
|
1651
|
-
* @param {GradualOptions} options - The options to use for the gradual change.
|
|
1652
1997
|
* @returns {Promise<Player>} - The updated player.
|
|
1653
1998
|
* @throws {TypeError} If the volume is not a number.
|
|
1654
1999
|
* @throws {RangeError} If the volume is not between 0 and 1000.
|
|
@@ -1657,7 +2002,7 @@ declare class Player {
|
|
|
1657
2002
|
* player.setVolume(50);
|
|
1658
2003
|
* player.setVolume(50, { gradual: true, interval: 50, step: 5 });
|
|
1659
2004
|
*/
|
|
1660
|
-
setVolume(volume: number
|
|
2005
|
+
setVolume(volume: number): Promise<this>;
|
|
1661
2006
|
/**
|
|
1662
2007
|
* Sets the sponsorblock for the player. This will set the sponsorblock segments for the player to the given segments.
|
|
1663
2008
|
* @param {SponsorBlockSegment[]} segments - The sponsorblock segments to set. Defaults to `[SponsorBlockSegment.Sponsor, SponsorBlockSegment.SelfPromo]` if not provided.
|
|
@@ -1775,87 +2120,6 @@ declare class Player {
|
|
|
1775
2120
|
*/
|
|
1776
2121
|
private sleep;
|
|
1777
2122
|
}
|
|
1778
|
-
interface PlayerOptions {
|
|
1779
|
-
/** The guild ID the Player belongs to. */
|
|
1780
|
-
guildId: string;
|
|
1781
|
-
/** The text channel the Player belongs to. */
|
|
1782
|
-
textChannelId: string;
|
|
1783
|
-
/** The voice channel the Player belongs to. */
|
|
1784
|
-
voiceChannelId?: string;
|
|
1785
|
-
/** The node the Player uses. */
|
|
1786
|
-
node?: string;
|
|
1787
|
-
/** The initial volume the Player will use. */
|
|
1788
|
-
volume?: number;
|
|
1789
|
-
/** If the player should mute itself. */
|
|
1790
|
-
selfMute?: boolean;
|
|
1791
|
-
/** If the player should deaf itself. */
|
|
1792
|
-
selfDeafen?: boolean;
|
|
1793
|
-
}
|
|
1794
|
-
interface GradualOptions {
|
|
1795
|
-
/** If the change should be gradual. */
|
|
1796
|
-
gradual?: boolean;
|
|
1797
|
-
/** The duration of the gradual change. */
|
|
1798
|
-
interval?: number;
|
|
1799
|
-
/** The step of the gradual change. */
|
|
1800
|
-
step?: number;
|
|
1801
|
-
}
|
|
1802
|
-
/** If track partials are set some of these will be `undefined` as they were removed. */
|
|
1803
|
-
interface Track {
|
|
1804
|
-
/** The base64 encoded track. */
|
|
1805
|
-
readonly track: string;
|
|
1806
|
-
/** The artwork url of the track. */
|
|
1807
|
-
readonly artworkUrl: string;
|
|
1808
|
-
/** The track source name. */
|
|
1809
|
-
readonly sourceName: TrackSourceName;
|
|
1810
|
-
/** The title of the track. */
|
|
1811
|
-
title: string;
|
|
1812
|
-
/** The identifier of the track. */
|
|
1813
|
-
readonly identifier: string;
|
|
1814
|
-
/** The author of the track. */
|
|
1815
|
-
author: string;
|
|
1816
|
-
/** The duration of the track. */
|
|
1817
|
-
readonly duration: number;
|
|
1818
|
-
/** The ISRC of the track. */
|
|
1819
|
-
readonly isrc: string;
|
|
1820
|
-
/** If the track is seekable. */
|
|
1821
|
-
readonly isSeekable: boolean;
|
|
1822
|
-
/** If the track is a stream.. */
|
|
1823
|
-
readonly isStream: boolean;
|
|
1824
|
-
/** The uri of the track. */
|
|
1825
|
-
readonly uri: string;
|
|
1826
|
-
/** The thumbnail of the track or null if it's a unsupported source. */
|
|
1827
|
-
readonly thumbnail: string | null;
|
|
1828
|
-
/** The user that requested the track. */
|
|
1829
|
-
requester?: User | ClientUser;
|
|
1830
|
-
/** Displays the track thumbnail with optional size or null if it's a unsupported source. */
|
|
1831
|
-
displayThumbnail(size?: Sizes): string;
|
|
1832
|
-
/** Additional track info provided by plugins. */
|
|
1833
|
-
pluginInfo: TrackPluginInfo;
|
|
1834
|
-
/** Add your own data to the track. */
|
|
1835
|
-
customData: Record<string, unknown>;
|
|
1836
|
-
}
|
|
1837
|
-
interface TrackPluginInfo {
|
|
1838
|
-
albumName?: string;
|
|
1839
|
-
albumUrl?: string;
|
|
1840
|
-
artistArtworkUrl?: string;
|
|
1841
|
-
artistUrl?: string;
|
|
1842
|
-
isPreview?: string;
|
|
1843
|
-
previewUrl?: string;
|
|
1844
|
-
}
|
|
1845
|
-
interface PlayOptions {
|
|
1846
|
-
/** The position to start the track. */
|
|
1847
|
-
readonly startTime?: number;
|
|
1848
|
-
/** The position to end the track. */
|
|
1849
|
-
readonly endTime?: number;
|
|
1850
|
-
/** Whether to not replace the track if a play payload is sent. */
|
|
1851
|
-
readonly noReplace?: boolean;
|
|
1852
|
-
}
|
|
1853
|
-
interface EqualizerBand {
|
|
1854
|
-
/** The band number being 0 to 14. */
|
|
1855
|
-
band: number;
|
|
1856
|
-
/** The gain amount being -0.25 to 1.00, 0.25 being double. */
|
|
1857
|
-
gain: number;
|
|
1858
|
-
}
|
|
1859
2123
|
|
|
1860
2124
|
declare class Filters {
|
|
1861
2125
|
distortion: distortionOptions | null;
|
|
@@ -2271,7 +2535,7 @@ declare enum AvailableFilters {
|
|
|
2271
2535
|
Demon = "demon"
|
|
2272
2536
|
}
|
|
2273
2537
|
|
|
2274
|
-
declare class Plugin {
|
|
2538
|
+
declare class Plugin$1 {
|
|
2275
2539
|
name: string;
|
|
2276
2540
|
/**
|
|
2277
2541
|
* @param name The name of the plugin
|
|
@@ -2280,5 +2544,118 @@ declare class Plugin {
|
|
|
2280
2544
|
load(manager: Manager): void;
|
|
2281
2545
|
}
|
|
2282
2546
|
|
|
2283
|
-
|
|
2284
|
-
|
|
2547
|
+
declare abstract class TrackUtils {
|
|
2548
|
+
static trackPartial: TrackPartial[] | null;
|
|
2549
|
+
private static manager;
|
|
2550
|
+
/**
|
|
2551
|
+
* Initializes the TrackUtils class with the given manager.
|
|
2552
|
+
* @param manager The manager instance to use.
|
|
2553
|
+
* @hidden
|
|
2554
|
+
*/
|
|
2555
|
+
static init(manager: Manager): void;
|
|
2556
|
+
/**
|
|
2557
|
+
* Sets the partial properties for the Track class. If a Track has some of its properties removed by the partial,
|
|
2558
|
+
* it will be considered a partial Track.
|
|
2559
|
+
* @param {TrackPartial} partial The array of string property names to remove from the Track class.
|
|
2560
|
+
*/
|
|
2561
|
+
static setTrackPartial(partial: TrackPartial[]): void;
|
|
2562
|
+
/**
|
|
2563
|
+
* Checks if the provided argument is a valid Track.
|
|
2564
|
+
* If provided an array then every element will be checked.
|
|
2565
|
+
* @param trackOrTracks The Track or array of Tracks to check.
|
|
2566
|
+
* @returns {boolean} Whether the provided argument is a valid Track.
|
|
2567
|
+
*/
|
|
2568
|
+
static validate(trackOrTracks: unknown): boolean;
|
|
2569
|
+
/**
|
|
2570
|
+
* Builds a Track from the raw data from Lavalink and a optional requester.
|
|
2571
|
+
* @param data The raw data from Lavalink to build the Track from.
|
|
2572
|
+
* @param requester The user who requested the track, if any.
|
|
2573
|
+
* @returns The built Track.
|
|
2574
|
+
*/
|
|
2575
|
+
static build<T = User | ClientUser>(data: TrackData, requester?: T): Track;
|
|
2576
|
+
}
|
|
2577
|
+
declare abstract class AutoPlayUtils {
|
|
2578
|
+
private static manager;
|
|
2579
|
+
/**
|
|
2580
|
+
* Initializes the AutoPlayUtils class with the given manager.
|
|
2581
|
+
* @param manager The manager instance to use.
|
|
2582
|
+
* @hidden
|
|
2583
|
+
*/
|
|
2584
|
+
static init(manager: Manager): void;
|
|
2585
|
+
/**
|
|
2586
|
+
* Gets recommended tracks for the given track.
|
|
2587
|
+
* @param track The track to get recommended tracks for.
|
|
2588
|
+
* @returns An array of recommended tracks.
|
|
2589
|
+
*/
|
|
2590
|
+
static getRecommendedTracks(track: Track): Promise<Track[]>;
|
|
2591
|
+
/**
|
|
2592
|
+
* Gets recommended tracks from Last.fm for the given track.
|
|
2593
|
+
* @param track The track to get recommended tracks for.
|
|
2594
|
+
* @param apiKey The API key for Last.fm.
|
|
2595
|
+
* @returns An array of recommended tracks.
|
|
2596
|
+
*/
|
|
2597
|
+
static getRecommendedTracksFromLastFm(track: Track, apiKey: string): Promise<Track[]>;
|
|
2598
|
+
/**
|
|
2599
|
+
* Gets recommended tracks from the given source.
|
|
2600
|
+
* @param track The track to get recommended tracks for.
|
|
2601
|
+
* @param platform The source to get recommended tracks from.
|
|
2602
|
+
* @returns An array of recommended tracks.
|
|
2603
|
+
*/
|
|
2604
|
+
static getRecommendedTracksFromSource(track: Track, platform: string): Promise<Track[]>;
|
|
2605
|
+
static fetchSecretArray(): Promise<Buffer<ArrayBuffer>>;
|
|
2606
|
+
static transformSecret(buffer: Buffer): Buffer<ArrayBuffer>;
|
|
2607
|
+
static generateTotp(secretBuffer: Buffer): string;
|
|
2608
|
+
}
|
|
2609
|
+
/** Gets or extends structures to extend the built in, or already extended, classes to add more functionality. */
|
|
2610
|
+
declare abstract class Structure {
|
|
2611
|
+
/**
|
|
2612
|
+
* Extends a class.
|
|
2613
|
+
* @param name
|
|
2614
|
+
* @param extender
|
|
2615
|
+
*/
|
|
2616
|
+
static extend<K extends keyof Extendable, T extends Extendable[K]>(name: K, extender: (target: Extendable[K]) => T): T;
|
|
2617
|
+
/**
|
|
2618
|
+
* Get a structure from available structures by name.
|
|
2619
|
+
* @param name
|
|
2620
|
+
*/
|
|
2621
|
+
static get<K extends keyof Extendable>(name: K): Extendable[K];
|
|
2622
|
+
}
|
|
2623
|
+
|
|
2624
|
+
/**
|
|
2625
|
+
* Discord.js wrapper for Magmastream.
|
|
2626
|
+
*/
|
|
2627
|
+
declare class DiscordJSManager extends Manager {
|
|
2628
|
+
readonly client: Client;
|
|
2629
|
+
constructor(client: Client, options?: ManagerOptions);
|
|
2630
|
+
protected send(packet: GatewayVoiceStateUpdate): void;
|
|
2631
|
+
}
|
|
2632
|
+
|
|
2633
|
+
/**
|
|
2634
|
+
* Eris wrapper for Magmastream.
|
|
2635
|
+
*/
|
|
2636
|
+
declare class ErisManager extends Manager {
|
|
2637
|
+
readonly client: Client$1;
|
|
2638
|
+
constructor(client: Client$1, options?: ManagerOptions);
|
|
2639
|
+
protected send(packet: GatewayVoiceStateUpdate): void;
|
|
2640
|
+
}
|
|
2641
|
+
|
|
2642
|
+
/**
|
|
2643
|
+
* Detritus wrapper for Magmastream.
|
|
2644
|
+
*/
|
|
2645
|
+
declare class DetritusManager extends Manager {
|
|
2646
|
+
readonly client: ClusterClient | ShardClient;
|
|
2647
|
+
constructor(client: ClusterClient | ShardClient, options?: ManagerOptions);
|
|
2648
|
+
protected send(packet: GatewayVoiceStateUpdate): void;
|
|
2649
|
+
}
|
|
2650
|
+
|
|
2651
|
+
/**
|
|
2652
|
+
* Oceanic wrapper for Magmastream.
|
|
2653
|
+
*/
|
|
2654
|
+
declare class OceanicManager extends Manager {
|
|
2655
|
+
readonly client: Client$2;
|
|
2656
|
+
constructor(client: Client$2, options?: ManagerOptions);
|
|
2657
|
+
protected send(packet: GatewayVoiceStateUpdate): void;
|
|
2658
|
+
}
|
|
2659
|
+
|
|
2660
|
+
export { AutoPlayPlatform, AutoPlayUtils, AvailableFilters, DetritusManager, DiscordJSManager, ErisManager, Filters, LoadTypes, Manager, ManagerEventTypes, Node$1 as Node, OceanicManager, Player, PlayerStateEventTypes, Plugin$1 as Plugin, Queue, Rest, SearchPlatform, SeverityTypes, SponsorBlockSegment, StateStorageType, StateTypes, Structure, TrackEndReasonTypes, TrackPartial, TrackSourceTypes, TrackUtils, UseNodeOptions };
|
|
2661
|
+
export type { CPUStats, DiscordPacket, EqualizerBand, Exception, Extendable, FrameStats, IQueue, LavaPlayer, LavalinkInfo, LavalinkResponse, LoadType, Lyrics, LyricsLine, ManagerEvents, ManagerInitOptions, ManagerOptions, MemoryStats, NodeMessage, NodeOptions, NodeStats, Payload, PlayOptions, PlayerEvent, PlayerEventType, PlayerEvents, PlayerOptions, PlayerStateUpdateEvent, PlayerStore, PlayerUpdate, PlayerUpdateVoiceState, PlaylistData, PlaylistInfoData, PlaylistRawData, RedisConfig, SearchQuery, SearchResult, Severity, Sizes, SponsorBlockChapterStarted, SponsorBlockChaptersLoaded, SponsorBlockSegmentEventType, SponsorBlockSegmentEvents, SponsorBlockSegmentSkipped, SponsorBlockSegmentsLoaded, StateStorageOptions, Track, TrackData, TrackDataInfo, TrackEndEvent, TrackEndReason, TrackExceptionEvent, TrackPluginInfo, TrackSourceName, TrackStartEvent, TrackStuckEvent, UseNodeOption, VoicePacket, VoiceServer, VoiceServerUpdate, VoiceState, WebSocketClosedEvent };
|