magmastream 2.9.0-dev.36 → 2.9.0-dev.37
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 +462 -371
- package/dist/structures/Enums.js +17 -0
- package/dist/structures/Manager.js +51 -8
- package/dist/structures/Node.js +3 -2
- package/dist/structures/Plugin.js +4 -1
- package/dist/structures/Utils.js +203 -313
- package/package.json +9 -8
package/dist/index.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ declare class Rest {
|
|
|
31
31
|
manager: Manager;
|
|
32
32
|
/** Whether the node is a NodeLink. */
|
|
33
33
|
isNodeLink: boolean;
|
|
34
|
-
constructor(node: Node
|
|
34
|
+
constructor(node: Node, manager: Manager);
|
|
35
35
|
/**
|
|
36
36
|
* Sets the session ID.
|
|
37
37
|
* This method is used to set the session ID after a resume operation is done.
|
|
@@ -137,218 +137,56 @@ interface playOptions {
|
|
|
137
137
|
};
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
-
/**
|
|
141
|
-
* State Storage Enum
|
|
142
|
-
*/
|
|
143
|
-
declare enum StateStorageType {
|
|
144
|
-
Memory = "memory",
|
|
145
|
-
Redis = "redis",
|
|
146
|
-
JSON = "json"
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* AutoPlay Platform Enum
|
|
150
|
-
*/
|
|
151
|
-
declare enum AutoPlayPlatform {
|
|
152
|
-
Spotify = "spotify",
|
|
153
|
-
Deezer = "deezer",
|
|
154
|
-
SoundCloud = "soundcloud",
|
|
155
|
-
Tidal = "tidal",
|
|
156
|
-
VKMusic = "vkmusic",
|
|
157
|
-
Qobuz = "qobuz",
|
|
158
|
-
YouTube = "youtube"
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* State Types Enum
|
|
162
|
-
*/
|
|
163
|
-
declare enum StateTypes {
|
|
164
|
-
Connected = "CONNECTED",
|
|
165
|
-
Connecting = "CONNECTING",
|
|
166
|
-
Disconnected = "DISCONNECTED",
|
|
167
|
-
Disconnecting = "DISCONNECTING",
|
|
168
|
-
Destroying = "DESTROYING"
|
|
169
|
-
}
|
|
170
|
-
/**
|
|
171
|
-
* Load Types Enum
|
|
172
|
-
*/
|
|
173
|
-
declare enum LoadTypes {
|
|
174
|
-
Track = "track",
|
|
175
|
-
Playlist = "playlist",
|
|
176
|
-
Search = "search",
|
|
177
|
-
Empty = "empty",
|
|
178
|
-
Error = "error"
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* Search Platform Enum
|
|
182
|
-
*/
|
|
183
|
-
declare enum SearchPlatform {
|
|
184
|
-
AppleMusic = "amsearch",
|
|
185
|
-
Bandcamp = "bcsearch",
|
|
186
|
-
Deezer = "dzsearch",
|
|
187
|
-
Jiosaavn = "jssearch",
|
|
188
|
-
Qobuz = "qbsearch",
|
|
189
|
-
SoundCloud = "scsearch",
|
|
190
|
-
Spotify = "spsearch",
|
|
191
|
-
Tidal = "tdsearch",
|
|
192
|
-
VKMusic = "vksearch",
|
|
193
|
-
YouTube = "ytsearch",
|
|
194
|
-
YouTubeMusic = "ytmsearch"
|
|
195
|
-
}
|
|
196
|
-
/**
|
|
197
|
-
* Player State Event Types Enum
|
|
198
|
-
*/
|
|
199
|
-
declare enum PlayerStateEventTypes {
|
|
200
|
-
AutoPlayChange = "playerAutoplay",
|
|
201
|
-
ConnectionChange = "playerConnection",
|
|
202
|
-
RepeatChange = "playerRepeat",
|
|
203
|
-
PauseChange = "playerPause",
|
|
204
|
-
QueueChange = "queueChange",
|
|
205
|
-
TrackChange = "trackChange",
|
|
206
|
-
VolumeChange = "volumeChange",
|
|
207
|
-
ChannelChange = "channelChange",
|
|
208
|
-
PlayerCreate = "playerCreate",
|
|
209
|
-
PlayerDestroy = "playerDestroy"
|
|
210
|
-
}
|
|
211
|
-
/**
|
|
212
|
-
* Track Source Types Enum
|
|
213
|
-
*/
|
|
214
|
-
declare enum TrackSourceTypes {
|
|
215
|
-
AppleMusic = "applemusic",
|
|
216
|
-
Bandcamp = "bandcamp",
|
|
217
|
-
Deezer = "deezer",
|
|
218
|
-
Jiosaavn = "jiosaavn",
|
|
219
|
-
SoundCloud = "soundcloud",
|
|
220
|
-
Spotify = "spotify",
|
|
221
|
-
Tidal = "tidal",
|
|
222
|
-
VKMusic = "vkmusic",
|
|
223
|
-
YouTube = "youtube"
|
|
224
|
-
}
|
|
225
|
-
/**
|
|
226
|
-
* Use Node Options Enum
|
|
227
|
-
*/
|
|
228
|
-
declare enum UseNodeOptions {
|
|
229
|
-
LeastLoad = "leastLoad",
|
|
230
|
-
LeastPlayers = "leastPlayers"
|
|
231
|
-
}
|
|
232
|
-
/**
|
|
233
|
-
* Track Partial Enum
|
|
234
|
-
*/
|
|
235
|
-
declare enum TrackPartial {
|
|
236
|
-
/** The base64 encoded string of the track */
|
|
237
|
-
Track = "track",
|
|
238
|
-
/** The title of the track */
|
|
239
|
-
Title = "title",
|
|
240
|
-
/** The track identifier */
|
|
241
|
-
Identifier = "identifier",
|
|
242
|
-
/** The author of the track */
|
|
243
|
-
Author = "author",
|
|
244
|
-
/** The length of the track in milliseconds */
|
|
245
|
-
Duration = "duration",
|
|
246
|
-
/** The ISRC of the track */
|
|
247
|
-
Isrc = "isrc",
|
|
248
|
-
/** Whether the track is seekable */
|
|
249
|
-
IsSeekable = "isSeekable",
|
|
250
|
-
/** Whether the track is a stream */
|
|
251
|
-
IsStream = "isStream",
|
|
252
|
-
/** The URI of the track */
|
|
253
|
-
Uri = "uri",
|
|
254
|
-
/** The artwork URL of the track */
|
|
255
|
-
ArtworkUrl = "artworkUrl",
|
|
256
|
-
/** The source name of the track */
|
|
257
|
-
SourceName = "sourceName",
|
|
258
|
-
/** The thumbnail of the track */
|
|
259
|
-
ThumbNail = "thumbnail",
|
|
260
|
-
/** The requester of the track */
|
|
261
|
-
Requester = "requester",
|
|
262
|
-
/** The plugin info of the track */
|
|
263
|
-
PluginInfo = "pluginInfo",
|
|
264
|
-
/** The custom data of the track */
|
|
265
|
-
CustomData = "customData"
|
|
266
|
-
}
|
|
267
|
-
declare enum ManagerEventTypes {
|
|
268
|
-
ChapterStarted = "chapterStarted",
|
|
269
|
-
ChaptersLoaded = "chaptersLoaded",
|
|
270
|
-
Debug = "debug",
|
|
271
|
-
LyricsFoundEvent = "lyricsFoundEvent",
|
|
272
|
-
LyricsLineEvent = "lyricsLineEvent",
|
|
273
|
-
LyricsNotFoundEvent = "lyricsNotFoundEvent",
|
|
274
|
-
NodeConnect = "nodeConnect",
|
|
275
|
-
NodeCreate = "nodeCreate",
|
|
276
|
-
NodeDestroy = "nodeDestroy",
|
|
277
|
-
NodeDisconnect = "nodeDisconnect",
|
|
278
|
-
NodeError = "nodeError",
|
|
279
|
-
NodeRaw = "nodeRaw",
|
|
280
|
-
NodeReconnect = "nodeReconnect",
|
|
281
|
-
PlayerCreate = "playerCreate",
|
|
282
|
-
PlayerDestroy = "playerDestroy",
|
|
283
|
-
PlayerDisconnect = "playerDisconnect",
|
|
284
|
-
PlayerMove = "playerMove",
|
|
285
|
-
PlayerRestored = "playerRestored",
|
|
286
|
-
PlayerStateUpdate = "playerStateUpdate",
|
|
287
|
-
QueueEnd = "queueEnd",
|
|
288
|
-
RestoreComplete = "restoreComplete",
|
|
289
|
-
SegmentSkipped = "segmentSkipped",
|
|
290
|
-
SegmentsLoaded = "segmentsLoaded",
|
|
291
|
-
SocketClosed = "socketClosed",
|
|
292
|
-
TrackEnd = "trackEnd",
|
|
293
|
-
TrackError = "trackError",
|
|
294
|
-
TrackStart = "trackStart",
|
|
295
|
-
TrackStuck = "trackStuck",
|
|
296
|
-
VoiceReceiverDisconnect = "voiceReceiverDisconnect",
|
|
297
|
-
VoiceReceiverConnect = "voiceReceiverConnect",
|
|
298
|
-
VoiceReceiverError = "voiceReceiverError",
|
|
299
|
-
VoiceReceiverStartSpeaking = "voiceReceiverStartSpeaking",
|
|
300
|
-
VoiceReceiverEndSpeaking = "voiceReceiverEndSpeaking"
|
|
301
|
-
}
|
|
302
|
-
/**
|
|
303
|
-
* Track End Reason Enum
|
|
304
|
-
*/
|
|
305
|
-
declare enum TrackEndReasonTypes {
|
|
306
|
-
Finished = "finished",
|
|
307
|
-
LoadFailed = "loadFailed",
|
|
308
|
-
Stopped = "stopped",
|
|
309
|
-
Replaced = "replaced",
|
|
310
|
-
Cleanup = "cleanup"
|
|
311
|
-
}
|
|
312
|
-
/**
|
|
313
|
-
* Severity Types Enum
|
|
314
|
-
*/
|
|
315
|
-
declare enum SeverityTypes {
|
|
316
|
-
Common = "common",
|
|
317
|
-
Suspicious = "suspicious",
|
|
318
|
-
Fault = "fault"
|
|
319
|
-
}
|
|
320
|
-
/**
|
|
321
|
-
* SponsorBlock Segment Enum
|
|
322
|
-
*/
|
|
323
|
-
declare enum SponsorBlockSegment {
|
|
324
|
-
Sponsor = "sponsor",
|
|
325
|
-
SelfPromo = "selfpromo",
|
|
326
|
-
Interaction = "interaction",
|
|
327
|
-
Intro = "intro",
|
|
328
|
-
Outro = "outro",
|
|
329
|
-
Preview = "preview",
|
|
330
|
-
MusicOfftopic = "music_offtopic",
|
|
331
|
-
Filler = "filler"
|
|
332
|
-
}
|
|
333
|
-
|
|
334
140
|
/**
|
|
335
141
|
* The player's queue, the `current` property is the currently playing track, think of the rest as the up-coming tracks.
|
|
336
142
|
*/
|
|
337
|
-
declare class
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
previous: Track[];
|
|
342
|
-
/** The Manager instance. */
|
|
343
|
-
manager: Manager;
|
|
344
|
-
/** The guild ID property. */
|
|
345
|
-
guildId: string;
|
|
143
|
+
declare class JsonQueue implements IQueue {
|
|
144
|
+
readonly guildId: string;
|
|
145
|
+
readonly manager: Manager;
|
|
146
|
+
private basePath;
|
|
346
147
|
/**
|
|
347
|
-
* Constructs a new Queue.
|
|
348
148
|
* @param guildId The guild ID.
|
|
349
|
-
* @param manager The
|
|
149
|
+
* @param manager The manager.
|
|
350
150
|
*/
|
|
351
151
|
constructor(guildId: string, manager: Manager);
|
|
152
|
+
/**
|
|
153
|
+
* @returns The queue path.
|
|
154
|
+
*/
|
|
155
|
+
private get queuePath();
|
|
156
|
+
/**
|
|
157
|
+
* @returns The current path.
|
|
158
|
+
*/
|
|
159
|
+
private get currentPath();
|
|
160
|
+
/**
|
|
161
|
+
* @returns The previous path.
|
|
162
|
+
*/
|
|
163
|
+
private get previousPath();
|
|
164
|
+
/**
|
|
165
|
+
* Ensures the directory exists.
|
|
166
|
+
*/
|
|
167
|
+
private ensureDir;
|
|
168
|
+
/**
|
|
169
|
+
* @returns The queue.
|
|
170
|
+
*/
|
|
171
|
+
private getQueue;
|
|
172
|
+
/**
|
|
173
|
+
* @param queue The queue.
|
|
174
|
+
*/
|
|
175
|
+
private setQueue;
|
|
176
|
+
/**
|
|
177
|
+
* @param filePath The file path.
|
|
178
|
+
* @returns The JSON data.
|
|
179
|
+
*/
|
|
180
|
+
private readJSON;
|
|
181
|
+
/**
|
|
182
|
+
* @param filePath The file path.
|
|
183
|
+
* @param data The data to write.
|
|
184
|
+
*/
|
|
185
|
+
private writeJSON;
|
|
186
|
+
/**
|
|
187
|
+
* @param filePath The file path.
|
|
188
|
+
*/
|
|
189
|
+
private deleteFile;
|
|
352
190
|
/**
|
|
353
191
|
* @returns The current track.
|
|
354
192
|
*/
|
|
@@ -361,11 +199,14 @@ declare class MemoryQueue extends Array<Track> implements IQueue {
|
|
|
361
199
|
* @returns The previous tracks.
|
|
362
200
|
*/
|
|
363
201
|
getPrevious(): Promise<Track[]>;
|
|
202
|
+
/**
|
|
203
|
+
* @param track The track to add.
|
|
204
|
+
*/
|
|
364
205
|
addPrevious(track: Track | Track[]): Promise<void>;
|
|
365
206
|
/**
|
|
366
|
-
* @param
|
|
207
|
+
* @param track The track to set.
|
|
367
208
|
*/
|
|
368
|
-
setPrevious(
|
|
209
|
+
setPrevious(track: Track | Track[]): Promise<void>;
|
|
369
210
|
/**
|
|
370
211
|
* @returns The newest track.
|
|
371
212
|
*/
|
|
@@ -375,98 +216,83 @@ declare class MemoryQueue extends Array<Track> implements IQueue {
|
|
|
375
216
|
*/
|
|
376
217
|
clearPrevious(): Promise<void>;
|
|
377
218
|
/**
|
|
378
|
-
* The total duration of the queue in milliseconds.
|
|
379
|
-
* This includes the duration of the currently playing track.
|
|
380
|
-
*/
|
|
381
|
-
duration(): Promise<number>;
|
|
382
|
-
/**
|
|
383
|
-
* The total size of tracks in the queue including the current track.
|
|
384
|
-
* This includes the current track if it is not null.
|
|
385
|
-
* @returns The total size of tracks in the queue including the current track.
|
|
386
|
-
*/
|
|
387
|
-
totalSize(): Promise<number>;
|
|
388
|
-
/**
|
|
389
|
-
* The size of tracks in the queue.
|
|
390
|
-
* This does not include the currently playing track.
|
|
391
|
-
* @returns The size of tracks in the queue.
|
|
392
|
-
*/
|
|
393
|
-
size(): Promise<number>;
|
|
394
|
-
/**
|
|
395
|
-
* Adds a track to the queue.
|
|
396
219
|
* @param track The track or tracks to add. Can be a single `Track` or an array of `Track`s.
|
|
397
220
|
* @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.
|
|
398
221
|
*/
|
|
399
222
|
add(track: Track | Track[], offset?: number): Promise<void>;
|
|
400
223
|
/**
|
|
401
|
-
* Removes track
|
|
402
|
-
* @param
|
|
403
|
-
*
|
|
404
|
-
* @param end Optional, end of the range of tracks to remove.
|
|
405
|
-
* @returns The removed track(s).
|
|
224
|
+
* Removes a track from the queue.
|
|
225
|
+
* @param position The position to remove the track at.
|
|
226
|
+
* @param end The end position to remove the track at.
|
|
406
227
|
*/
|
|
407
228
|
remove(position?: number): Promise<Track[]>;
|
|
408
229
|
remove(start: number, end: number): Promise<Track[]>;
|
|
409
230
|
/**
|
|
410
231
|
* Clears the queue.
|
|
411
|
-
* This will remove all tracks from the queue and emit a state update event.
|
|
412
232
|
*/
|
|
413
233
|
clear(): Promise<void>;
|
|
234
|
+
/**
|
|
235
|
+
* @returns The size of the queue.
|
|
236
|
+
*/
|
|
237
|
+
size(): Promise<number>;
|
|
238
|
+
/**
|
|
239
|
+
* @returns The total size of the queue.
|
|
240
|
+
*/
|
|
241
|
+
totalSize(): Promise<number>;
|
|
242
|
+
/**
|
|
243
|
+
* @returns The total duration of the queue.
|
|
244
|
+
*/
|
|
245
|
+
duration(): Promise<number>;
|
|
414
246
|
/**
|
|
415
247
|
* Shuffles the queue.
|
|
416
|
-
* This will randomize the order of the tracks in the queue and emit a state update event.
|
|
417
248
|
*/
|
|
418
249
|
shuffle(): Promise<void>;
|
|
419
250
|
/**
|
|
420
|
-
* Shuffles the queue
|
|
251
|
+
* Shuffles the queue by user.
|
|
421
252
|
*/
|
|
422
253
|
userBlockShuffle(): Promise<void>;
|
|
423
254
|
/**
|
|
424
|
-
* Shuffles the queue
|
|
255
|
+
* Shuffles the queue by round-robin.
|
|
425
256
|
*/
|
|
426
257
|
roundRobinShuffle(): Promise<void>;
|
|
427
258
|
/**
|
|
428
|
-
* Removes the first
|
|
259
|
+
* Removes the first track from the queue.
|
|
429
260
|
*/
|
|
430
261
|
dequeue(): Promise<Track | undefined>;
|
|
431
262
|
/**
|
|
432
|
-
* Adds
|
|
433
|
-
* @param track The track or tracks to add.
|
|
263
|
+
* Adds a track to the front of the queue.
|
|
434
264
|
*/
|
|
435
265
|
enqueueFront(track: Track | Track[]): Promise<void>;
|
|
436
266
|
/**
|
|
437
|
-
* @returns
|
|
267
|
+
* @returns The tracks in the queue.
|
|
438
268
|
*/
|
|
439
269
|
getTracks(): Promise<Track[]>;
|
|
440
270
|
/**
|
|
441
|
-
* @returns
|
|
271
|
+
* @returns The tracks in the queue from start to end.
|
|
442
272
|
*/
|
|
443
273
|
getSlice(start?: number, end?: number): Promise<Track[]>;
|
|
444
274
|
/**
|
|
445
275
|
* Modifies the queue at the specified index.
|
|
446
|
-
* @param start The index at which to start modifying the queue.
|
|
447
|
-
* @param deleteCount The number of elements to remove from the queue.
|
|
448
|
-
* @param items The elements to add to the queue.
|
|
449
|
-
* @returns The modified queue.
|
|
450
276
|
*/
|
|
451
277
|
modifyAt(start: number, deleteCount?: number, ...items: Track[]): Promise<Track[]>;
|
|
452
278
|
/**
|
|
453
|
-
*
|
|
279
|
+
* Maps the queue to a new array.
|
|
454
280
|
*/
|
|
455
281
|
mapAsync<T>(callback: (track: Track, index: number, array: Track[]) => T): Promise<T[]>;
|
|
456
282
|
/**
|
|
457
|
-
*
|
|
283
|
+
* Filters the queue.
|
|
458
284
|
*/
|
|
459
285
|
filterAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<Track[]>;
|
|
460
286
|
/**
|
|
461
|
-
*
|
|
287
|
+
* Finds the first track in the queue that satisfies the provided testing function.
|
|
462
288
|
*/
|
|
463
289
|
findAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<Track | undefined>;
|
|
464
290
|
/**
|
|
465
|
-
*
|
|
291
|
+
* Tests whether at least one element in the queue passes the test implemented by the provided function.
|
|
466
292
|
*/
|
|
467
293
|
someAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<boolean>;
|
|
468
294
|
/**
|
|
469
|
-
*
|
|
295
|
+
* Tests whether all elements in the queue pass the test implemented by the provided function.
|
|
470
296
|
*/
|
|
471
297
|
everyAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<boolean>;
|
|
472
298
|
}
|
|
@@ -474,43 +300,21 @@ declare class MemoryQueue extends Array<Track> implements IQueue {
|
|
|
474
300
|
/**
|
|
475
301
|
* The player's queue, the `current` property is the currently playing track, think of the rest as the up-coming tracks.
|
|
476
302
|
*/
|
|
477
|
-
declare class
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
/**
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
/**
|
|
485
|
-
|
|
486
|
-
*/
|
|
487
|
-
redisPrefix: string;
|
|
303
|
+
declare class MemoryQueue extends Array<Track> implements IQueue {
|
|
304
|
+
/** The current track */
|
|
305
|
+
current: Track | null;
|
|
306
|
+
/** The previous tracks */
|
|
307
|
+
previous: Track[];
|
|
308
|
+
/** The Manager instance. */
|
|
309
|
+
manager: Manager;
|
|
310
|
+
/** The guild ID property. */
|
|
311
|
+
guildId: string;
|
|
488
312
|
/**
|
|
489
|
-
* Constructs a new
|
|
313
|
+
* Constructs a new Queue.
|
|
490
314
|
* @param guildId The guild ID.
|
|
491
315
|
* @param manager The Manager instance.
|
|
492
316
|
*/
|
|
493
317
|
constructor(guildId: string, manager: Manager);
|
|
494
|
-
/**
|
|
495
|
-
* @returns The queue key.
|
|
496
|
-
*/
|
|
497
|
-
private get queueKey();
|
|
498
|
-
/**
|
|
499
|
-
* @returns The current key.
|
|
500
|
-
*/
|
|
501
|
-
private get currentKey();
|
|
502
|
-
/**
|
|
503
|
-
* @returns The previous key.
|
|
504
|
-
*/
|
|
505
|
-
private get previousKey();
|
|
506
|
-
/**
|
|
507
|
-
* Helper to serialize/deserialize Track
|
|
508
|
-
*/
|
|
509
|
-
private serialize;
|
|
510
|
-
/**
|
|
511
|
-
* Helper to serialize/deserialize Track
|
|
512
|
-
*/
|
|
513
|
-
private deserialize;
|
|
514
318
|
/**
|
|
515
319
|
* @returns The current track.
|
|
516
320
|
*/
|
|
@@ -523,14 +327,11 @@ declare class RedisQueue implements IQueue {
|
|
|
523
327
|
* @returns The previous tracks.
|
|
524
328
|
*/
|
|
525
329
|
getPrevious(): Promise<Track[]>;
|
|
526
|
-
/**
|
|
527
|
-
* @param track The track to add.
|
|
528
|
-
*/
|
|
529
330
|
addPrevious(track: Track | Track[]): Promise<void>;
|
|
530
331
|
/**
|
|
531
|
-
* @param
|
|
332
|
+
* @param tracks The tracks to set.
|
|
532
333
|
*/
|
|
533
|
-
setPrevious(
|
|
334
|
+
setPrevious(tracks: Track[]): Promise<void>;
|
|
534
335
|
/**
|
|
535
336
|
* @returns The newest track.
|
|
536
337
|
*/
|
|
@@ -540,83 +341,98 @@ declare class RedisQueue implements IQueue {
|
|
|
540
341
|
*/
|
|
541
342
|
clearPrevious(): Promise<void>;
|
|
542
343
|
/**
|
|
344
|
+
* The total duration of the queue in milliseconds.
|
|
345
|
+
* This includes the duration of the currently playing track.
|
|
346
|
+
*/
|
|
347
|
+
duration(): Promise<number>;
|
|
348
|
+
/**
|
|
349
|
+
* The total size of tracks in the queue including the current track.
|
|
350
|
+
* This includes the current track if it is not null.
|
|
351
|
+
* @returns The total size of tracks in the queue including the current track.
|
|
352
|
+
*/
|
|
353
|
+
totalSize(): Promise<number>;
|
|
354
|
+
/**
|
|
355
|
+
* The size of tracks in the queue.
|
|
356
|
+
* This does not include the currently playing track.
|
|
357
|
+
* @returns The size of tracks in the queue.
|
|
358
|
+
*/
|
|
359
|
+
size(): Promise<number>;
|
|
360
|
+
/**
|
|
361
|
+
* Adds a track to the queue.
|
|
543
362
|
* @param track The track or tracks to add. Can be a single `Track` or an array of `Track`s.
|
|
544
363
|
* @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.
|
|
545
364
|
*/
|
|
546
365
|
add(track: Track | Track[], offset?: number): Promise<void>;
|
|
547
366
|
/**
|
|
548
|
-
*
|
|
549
|
-
* @param
|
|
367
|
+
* Removes track(s) from the queue.
|
|
368
|
+
* @param startOrPosition If a single number is provided, it will be treated as the position of the track to remove.
|
|
369
|
+
* If two numbers are provided, they will be used as the start and end of a range of tracks to remove.
|
|
370
|
+
* @param end Optional, end of the range of tracks to remove.
|
|
371
|
+
* @returns The removed track(s).
|
|
550
372
|
*/
|
|
551
373
|
remove(position?: number): Promise<Track[]>;
|
|
552
374
|
remove(start: number, end: number): Promise<Track[]>;
|
|
553
375
|
/**
|
|
554
376
|
* Clears the queue.
|
|
377
|
+
* This will remove all tracks from the queue and emit a state update event.
|
|
555
378
|
*/
|
|
556
379
|
clear(): Promise<void>;
|
|
557
|
-
/**
|
|
558
|
-
* @returns The size of the queue.
|
|
559
|
-
*/
|
|
560
|
-
size(): Promise<number>;
|
|
561
|
-
/**
|
|
562
|
-
* @returns The total size of tracks in the queue including the current track.
|
|
563
|
-
*/
|
|
564
|
-
totalSize(): Promise<number>;
|
|
565
|
-
/**
|
|
566
|
-
* @returns The total duration of the queue in milliseconds.
|
|
567
|
-
* This includes the duration of the currently playing track.
|
|
568
|
-
*/
|
|
569
|
-
duration(): Promise<number>;
|
|
570
380
|
/**
|
|
571
381
|
* Shuffles the queue.
|
|
382
|
+
* This will randomize the order of the tracks in the queue and emit a state update event.
|
|
572
383
|
*/
|
|
573
384
|
shuffle(): Promise<void>;
|
|
574
385
|
/**
|
|
575
|
-
* Shuffles the queue
|
|
386
|
+
* Shuffles the queue to play tracks requested by each user one block at a time.
|
|
576
387
|
*/
|
|
577
388
|
userBlockShuffle(): Promise<void>;
|
|
578
389
|
/**
|
|
579
|
-
* Shuffles the queue
|
|
390
|
+
* Shuffles the queue to play tracks requested by each user one by one.
|
|
580
391
|
*/
|
|
581
392
|
roundRobinShuffle(): Promise<void>;
|
|
582
393
|
/**
|
|
583
|
-
* Removes the first
|
|
394
|
+
* Removes the first element from the queue.
|
|
584
395
|
*/
|
|
585
396
|
dequeue(): Promise<Track | undefined>;
|
|
586
397
|
/**
|
|
587
|
-
* Adds
|
|
398
|
+
* Adds the specified track or tracks to the front of the queue.
|
|
399
|
+
* @param track The track or tracks to add.
|
|
588
400
|
*/
|
|
589
401
|
enqueueFront(track: Track | Track[]): Promise<void>;
|
|
590
402
|
/**
|
|
591
|
-
* @returns
|
|
403
|
+
* @returns A shallow copy of the queue.
|
|
592
404
|
*/
|
|
593
405
|
getTracks(): Promise<Track[]>;
|
|
594
406
|
/**
|
|
595
|
-
* @returns
|
|
407
|
+
* @returns A shallow copy of the queue.
|
|
596
408
|
*/
|
|
597
409
|
getSlice(start?: number, end?: number): Promise<Track[]>;
|
|
598
410
|
/**
|
|
599
411
|
* Modifies the queue at the specified index.
|
|
412
|
+
* @param start The index at which to start modifying the queue.
|
|
413
|
+
* @param deleteCount The number of elements to remove from the queue.
|
|
414
|
+
* @param items The elements to add to the queue.
|
|
415
|
+
* @returns The modified queue.
|
|
600
416
|
*/
|
|
601
417
|
modifyAt(start: number, deleteCount?: number, ...items: Track[]): Promise<Track[]>;
|
|
602
418
|
/**
|
|
603
|
-
* @returns
|
|
419
|
+
* @returns A new array with the results of calling a provided function on every element in the queue.
|
|
604
420
|
*/
|
|
605
421
|
mapAsync<T>(callback: (track: Track, index: number, array: Track[]) => T): Promise<T[]>;
|
|
606
422
|
/**
|
|
607
|
-
* @returns
|
|
423
|
+
* @returns A new array with all elements that pass the test implemented by the provided function.
|
|
608
424
|
*/
|
|
609
425
|
filterAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<Track[]>;
|
|
610
426
|
/**
|
|
611
|
-
* @returns The first
|
|
427
|
+
* @returns The first element in the queue that satisfies the provided testing function.
|
|
612
428
|
*/
|
|
613
429
|
findAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<Track | undefined>;
|
|
614
430
|
/**
|
|
615
|
-
* @returns Whether
|
|
431
|
+
* @returns Whether at least one element in the queue satisfies the provided testing function.
|
|
616
432
|
*/
|
|
617
433
|
someAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<boolean>;
|
|
618
434
|
/**
|
|
619
|
-
* @returns Whether all
|
|
435
|
+
* @returns Whether all elements in the queue satisfy the provided testing function.
|
|
620
436
|
*/
|
|
621
437
|
everyAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<boolean>;
|
|
622
438
|
}
|
|
@@ -624,53 +440,43 @@ declare class RedisQueue implements IQueue {
|
|
|
624
440
|
/**
|
|
625
441
|
* The player's queue, the `current` property is the currently playing track, think of the rest as the up-coming tracks.
|
|
626
442
|
*/
|
|
627
|
-
declare class
|
|
443
|
+
declare class RedisQueue implements IQueue {
|
|
628
444
|
readonly guildId: string;
|
|
629
445
|
readonly manager: Manager;
|
|
630
|
-
private basePath;
|
|
631
|
-
/**
|
|
632
|
-
* @param guildId The guild ID.
|
|
633
|
-
* @param manager The manager.
|
|
634
|
-
*/
|
|
635
|
-
constructor(guildId: string, manager: Manager);
|
|
636
446
|
/**
|
|
637
|
-
*
|
|
638
|
-
*/
|
|
639
|
-
private get queuePath();
|
|
640
|
-
/**
|
|
641
|
-
* @returns The current path.
|
|
447
|
+
* The Redis instance.
|
|
642
448
|
*/
|
|
643
|
-
private
|
|
449
|
+
private redis;
|
|
644
450
|
/**
|
|
645
|
-
*
|
|
451
|
+
* The prefix for the Redis keys.
|
|
646
452
|
*/
|
|
647
|
-
|
|
453
|
+
redisPrefix: string;
|
|
648
454
|
/**
|
|
649
|
-
*
|
|
455
|
+
* Constructs a new RedisQueue.
|
|
456
|
+
* @param guildId The guild ID.
|
|
457
|
+
* @param manager The Manager instance.
|
|
650
458
|
*/
|
|
651
|
-
|
|
459
|
+
constructor(guildId: string, manager: Manager);
|
|
652
460
|
/**
|
|
653
|
-
* @returns The queue.
|
|
461
|
+
* @returns The queue key.
|
|
654
462
|
*/
|
|
655
|
-
private
|
|
463
|
+
private get queueKey();
|
|
656
464
|
/**
|
|
657
|
-
* @
|
|
465
|
+
* @returns The current key.
|
|
658
466
|
*/
|
|
659
|
-
private
|
|
467
|
+
private get currentKey();
|
|
660
468
|
/**
|
|
661
|
-
* @
|
|
662
|
-
* @returns The JSON data.
|
|
469
|
+
* @returns The previous key.
|
|
663
470
|
*/
|
|
664
|
-
private
|
|
471
|
+
private get previousKey();
|
|
665
472
|
/**
|
|
666
|
-
*
|
|
667
|
-
* @param data The data to write.
|
|
473
|
+
* Helper to serialize/deserialize Track
|
|
668
474
|
*/
|
|
669
|
-
private
|
|
475
|
+
private serialize;
|
|
670
476
|
/**
|
|
671
|
-
*
|
|
477
|
+
* Helper to serialize/deserialize Track
|
|
672
478
|
*/
|
|
673
|
-
private
|
|
479
|
+
private deserialize;
|
|
674
480
|
/**
|
|
675
481
|
* @returns The current track.
|
|
676
482
|
*/
|
|
@@ -705,7 +511,6 @@ declare class JsonQueue implements IQueue {
|
|
|
705
511
|
*/
|
|
706
512
|
add(track: Track | Track[], offset?: number): Promise<void>;
|
|
707
513
|
/**
|
|
708
|
-
* Removes a track from the queue.
|
|
709
514
|
* @param position The position to remove the track at.
|
|
710
515
|
* @param end The end position to remove the track at.
|
|
711
516
|
*/
|
|
@@ -720,11 +525,12 @@ declare class JsonQueue implements IQueue {
|
|
|
720
525
|
*/
|
|
721
526
|
size(): Promise<number>;
|
|
722
527
|
/**
|
|
723
|
-
* @returns The total size of the queue.
|
|
528
|
+
* @returns The total size of tracks in the queue including the current track.
|
|
724
529
|
*/
|
|
725
530
|
totalSize(): Promise<number>;
|
|
726
531
|
/**
|
|
727
|
-
* @returns The total duration of the queue.
|
|
532
|
+
* @returns The total duration of the queue in milliseconds.
|
|
533
|
+
* This includes the duration of the currently playing track.
|
|
728
534
|
*/
|
|
729
535
|
duration(): Promise<number>;
|
|
730
536
|
/**
|
|
@@ -732,11 +538,11 @@ declare class JsonQueue implements IQueue {
|
|
|
732
538
|
*/
|
|
733
539
|
shuffle(): Promise<void>;
|
|
734
540
|
/**
|
|
735
|
-
* Shuffles the queue
|
|
541
|
+
* Shuffles the queue, but keeps the tracks of the same user together.
|
|
736
542
|
*/
|
|
737
543
|
userBlockShuffle(): Promise<void>;
|
|
738
544
|
/**
|
|
739
|
-
* Shuffles the queue
|
|
545
|
+
* Shuffles the queue round-robin style.
|
|
740
546
|
*/
|
|
741
547
|
roundRobinShuffle(): Promise<void>;
|
|
742
548
|
/**
|
|
@@ -752,7 +558,7 @@ declare class JsonQueue implements IQueue {
|
|
|
752
558
|
*/
|
|
753
559
|
getTracks(): Promise<Track[]>;
|
|
754
560
|
/**
|
|
755
|
-
* @returns The tracks in the queue from start to end.
|
|
561
|
+
* @returns The tracks in the queue from the start to the end.
|
|
756
562
|
*/
|
|
757
563
|
getSlice(start?: number, end?: number): Promise<Track[]>;
|
|
758
564
|
/**
|
|
@@ -760,27 +566,261 @@ declare class JsonQueue implements IQueue {
|
|
|
760
566
|
*/
|
|
761
567
|
modifyAt(start: number, deleteCount?: number, ...items: Track[]): Promise<Track[]>;
|
|
762
568
|
/**
|
|
763
|
-
*
|
|
569
|
+
* @returns The tracks in the queue after the specified index.
|
|
764
570
|
*/
|
|
765
571
|
mapAsync<T>(callback: (track: Track, index: number, array: Track[]) => T): Promise<T[]>;
|
|
766
572
|
/**
|
|
767
|
-
*
|
|
573
|
+
* @returns The tracks in the queue that match the specified condition.
|
|
768
574
|
*/
|
|
769
575
|
filterAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<Track[]>;
|
|
770
576
|
/**
|
|
771
|
-
*
|
|
577
|
+
* @returns The first track in the queue that matches the specified condition.
|
|
772
578
|
*/
|
|
773
579
|
findAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<Track | undefined>;
|
|
774
580
|
/**
|
|
775
|
-
*
|
|
581
|
+
* @returns Whether any tracks in the queue match the specified condition.
|
|
776
582
|
*/
|
|
777
583
|
someAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<boolean>;
|
|
778
584
|
/**
|
|
779
|
-
*
|
|
585
|
+
* @returns Whether all tracks in the queue match the specified condition.
|
|
780
586
|
*/
|
|
781
587
|
everyAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<boolean>;
|
|
782
588
|
}
|
|
783
589
|
|
|
590
|
+
/**
|
|
591
|
+
* State Storage Enum
|
|
592
|
+
*/
|
|
593
|
+
declare enum StateStorageType {
|
|
594
|
+
Memory = "memory",
|
|
595
|
+
Redis = "redis",
|
|
596
|
+
JSON = "json"
|
|
597
|
+
}
|
|
598
|
+
/**
|
|
599
|
+
* AutoPlay Platform Enum
|
|
600
|
+
*/
|
|
601
|
+
declare enum AutoPlayPlatform {
|
|
602
|
+
Spotify = "spotify",
|
|
603
|
+
Deezer = "deezer",
|
|
604
|
+
SoundCloud = "soundcloud",
|
|
605
|
+
Tidal = "tidal",
|
|
606
|
+
VKMusic = "vkmusic",
|
|
607
|
+
Qobuz = "qobuz",
|
|
608
|
+
YouTube = "youtube"
|
|
609
|
+
}
|
|
610
|
+
/**
|
|
611
|
+
* State Types Enum
|
|
612
|
+
*/
|
|
613
|
+
declare enum StateTypes {
|
|
614
|
+
Connected = "CONNECTED",
|
|
615
|
+
Connecting = "CONNECTING",
|
|
616
|
+
Disconnected = "DISCONNECTED",
|
|
617
|
+
Disconnecting = "DISCONNECTING",
|
|
618
|
+
Destroying = "DESTROYING"
|
|
619
|
+
}
|
|
620
|
+
/**
|
|
621
|
+
* Load Types Enum
|
|
622
|
+
*/
|
|
623
|
+
declare enum LoadTypes {
|
|
624
|
+
Track = "track",
|
|
625
|
+
Playlist = "playlist",
|
|
626
|
+
Search = "search",
|
|
627
|
+
Empty = "empty",
|
|
628
|
+
Error = "error",
|
|
629
|
+
/** Nodelink */
|
|
630
|
+
Album = "album",
|
|
631
|
+
/** Nodelink */
|
|
632
|
+
Artist = "artist",
|
|
633
|
+
/** Nodelink */
|
|
634
|
+
Station = "station",
|
|
635
|
+
/** Nodelink */
|
|
636
|
+
Podcast = "podcast",
|
|
637
|
+
/** Nodelink */
|
|
638
|
+
Show = "show",
|
|
639
|
+
/** Nodelink */
|
|
640
|
+
Short = "short"
|
|
641
|
+
}
|
|
642
|
+
/**
|
|
643
|
+
* Search Platform Enum
|
|
644
|
+
*/
|
|
645
|
+
declare enum SearchPlatform {
|
|
646
|
+
AppleMusic = "amsearch",
|
|
647
|
+
Bandcamp = "bcsearch",
|
|
648
|
+
Deezer = "dzsearch",
|
|
649
|
+
Jiosaavn = "jssearch",
|
|
650
|
+
Qobuz = "qbsearch",
|
|
651
|
+
SoundCloud = "scsearch",
|
|
652
|
+
Spotify = "spsearch",
|
|
653
|
+
Tidal = "tdsearch",
|
|
654
|
+
VKMusic = "vksearch",
|
|
655
|
+
YouTube = "ytsearch",
|
|
656
|
+
YouTubeMusic = "ytmsearch"
|
|
657
|
+
}
|
|
658
|
+
/**
|
|
659
|
+
* Player State Event Types Enum
|
|
660
|
+
*/
|
|
661
|
+
declare enum PlayerStateEventTypes {
|
|
662
|
+
AutoPlayChange = "playerAutoplay",
|
|
663
|
+
ConnectionChange = "playerConnection",
|
|
664
|
+
RepeatChange = "playerRepeat",
|
|
665
|
+
PauseChange = "playerPause",
|
|
666
|
+
QueueChange = "queueChange",
|
|
667
|
+
TrackChange = "trackChange",
|
|
668
|
+
VolumeChange = "volumeChange",
|
|
669
|
+
ChannelChange = "channelChange",
|
|
670
|
+
PlayerCreate = "playerCreate",
|
|
671
|
+
PlayerDestroy = "playerDestroy"
|
|
672
|
+
}
|
|
673
|
+
/**
|
|
674
|
+
* Track Source Types Enum
|
|
675
|
+
*/
|
|
676
|
+
declare enum TrackSourceTypes {
|
|
677
|
+
AppleMusic = "applemusic",
|
|
678
|
+
Bandcamp = "bandcamp",
|
|
679
|
+
Deezer = "deezer",
|
|
680
|
+
Jiosaavn = "jiosaavn",
|
|
681
|
+
SoundCloud = "soundcloud",
|
|
682
|
+
Spotify = "spotify",
|
|
683
|
+
Tidal = "tidal",
|
|
684
|
+
VKMusic = "vkmusic",
|
|
685
|
+
YouTube = "youtube"
|
|
686
|
+
}
|
|
687
|
+
/**
|
|
688
|
+
* Use Node Options Enum
|
|
689
|
+
*/
|
|
690
|
+
declare enum UseNodeOptions {
|
|
691
|
+
LeastLoad = "leastLoad",
|
|
692
|
+
LeastPlayers = "leastPlayers"
|
|
693
|
+
}
|
|
694
|
+
/**
|
|
695
|
+
* Track Partial Enum
|
|
696
|
+
*/
|
|
697
|
+
declare enum TrackPartial {
|
|
698
|
+
/** The base64 encoded string of the track */
|
|
699
|
+
Track = "track",
|
|
700
|
+
/** The title of the track */
|
|
701
|
+
Title = "title",
|
|
702
|
+
/** The track identifier */
|
|
703
|
+
Identifier = "identifier",
|
|
704
|
+
/** The author of the track */
|
|
705
|
+
Author = "author",
|
|
706
|
+
/** The length of the track in milliseconds */
|
|
707
|
+
Duration = "duration",
|
|
708
|
+
/** The ISRC of the track */
|
|
709
|
+
Isrc = "isrc",
|
|
710
|
+
/** Whether the track is seekable */
|
|
711
|
+
IsSeekable = "isSeekable",
|
|
712
|
+
/** Whether the track is a stream */
|
|
713
|
+
IsStream = "isStream",
|
|
714
|
+
/** The URI of the track */
|
|
715
|
+
Uri = "uri",
|
|
716
|
+
/** The artwork URL of the track */
|
|
717
|
+
ArtworkUrl = "artworkUrl",
|
|
718
|
+
/** The source name of the track */
|
|
719
|
+
SourceName = "sourceName",
|
|
720
|
+
/** The thumbnail of the track */
|
|
721
|
+
ThumbNail = "thumbnail",
|
|
722
|
+
/** The requester of the track */
|
|
723
|
+
Requester = "requester",
|
|
724
|
+
/** The plugin info of the track */
|
|
725
|
+
PluginInfo = "pluginInfo",
|
|
726
|
+
/** The custom data of the track */
|
|
727
|
+
CustomData = "customData"
|
|
728
|
+
}
|
|
729
|
+
declare enum ManagerEventTypes {
|
|
730
|
+
ChapterStarted = "chapterStarted",
|
|
731
|
+
ChaptersLoaded = "chaptersLoaded",
|
|
732
|
+
Debug = "debug",
|
|
733
|
+
LyricsFoundEvent = "lyricsFoundEvent",
|
|
734
|
+
LyricsLineEvent = "lyricsLineEvent",
|
|
735
|
+
LyricsNotFoundEvent = "lyricsNotFoundEvent",
|
|
736
|
+
NodeConnect = "nodeConnect",
|
|
737
|
+
NodeCreate = "nodeCreate",
|
|
738
|
+
NodeDestroy = "nodeDestroy",
|
|
739
|
+
NodeDisconnect = "nodeDisconnect",
|
|
740
|
+
NodeError = "nodeError",
|
|
741
|
+
NodeRaw = "nodeRaw",
|
|
742
|
+
NodeReconnect = "nodeReconnect",
|
|
743
|
+
PlayerCreate = "playerCreate",
|
|
744
|
+
PlayerDestroy = "playerDestroy",
|
|
745
|
+
PlayerDisconnect = "playerDisconnect",
|
|
746
|
+
PlayerMove = "playerMove",
|
|
747
|
+
PlayerRestored = "playerRestored",
|
|
748
|
+
PlayerStateUpdate = "playerStateUpdate",
|
|
749
|
+
QueueEnd = "queueEnd",
|
|
750
|
+
RestoreComplete = "restoreComplete",
|
|
751
|
+
SegmentSkipped = "segmentSkipped",
|
|
752
|
+
SegmentsLoaded = "segmentsLoaded",
|
|
753
|
+
SocketClosed = "socketClosed",
|
|
754
|
+
TrackEnd = "trackEnd",
|
|
755
|
+
TrackError = "trackError",
|
|
756
|
+
TrackStart = "trackStart",
|
|
757
|
+
TrackStuck = "trackStuck",
|
|
758
|
+
/** Nodelink */
|
|
759
|
+
VoiceReceiverDisconnect = "voiceReceiverDisconnect",
|
|
760
|
+
/** Nodelink */
|
|
761
|
+
VoiceReceiverConnect = "voiceReceiverConnect",
|
|
762
|
+
/** Nodelink */
|
|
763
|
+
VoiceReceiverError = "voiceReceiverError",
|
|
764
|
+
/** Nodelink */
|
|
765
|
+
VoiceReceiverStartSpeaking = "voiceReceiverStartSpeaking",
|
|
766
|
+
/** Nodelink */
|
|
767
|
+
VoiceReceiverEndSpeaking = "voiceReceiverEndSpeaking"
|
|
768
|
+
}
|
|
769
|
+
/**
|
|
770
|
+
* Track End Reason Enum
|
|
771
|
+
*/
|
|
772
|
+
declare enum TrackEndReasonTypes {
|
|
773
|
+
Finished = "finished",
|
|
774
|
+
LoadFailed = "loadFailed",
|
|
775
|
+
Stopped = "stopped",
|
|
776
|
+
Replaced = "replaced",
|
|
777
|
+
Cleanup = "cleanup"
|
|
778
|
+
}
|
|
779
|
+
/**
|
|
780
|
+
* Severity Types Enum
|
|
781
|
+
*/
|
|
782
|
+
declare enum SeverityTypes {
|
|
783
|
+
Common = "common",
|
|
784
|
+
Suspicious = "suspicious",
|
|
785
|
+
Fault = "fault"
|
|
786
|
+
}
|
|
787
|
+
/**
|
|
788
|
+
* SponsorBlock Segment Enum
|
|
789
|
+
*/
|
|
790
|
+
declare enum SponsorBlockSegment {
|
|
791
|
+
Sponsor = "sponsor",
|
|
792
|
+
SelfPromo = "selfpromo",
|
|
793
|
+
Interaction = "interaction",
|
|
794
|
+
Intro = "intro",
|
|
795
|
+
Outro = "outro",
|
|
796
|
+
Preview = "preview",
|
|
797
|
+
MusicOfftopic = "music_offtopic",
|
|
798
|
+
Filler = "filler"
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
/**
|
|
802
|
+
* Base abstract class for all plugins.
|
|
803
|
+
* Users must extend this and implement load and unload methods.
|
|
804
|
+
*/
|
|
805
|
+
declare abstract class Plugin {
|
|
806
|
+
readonly name: string;
|
|
807
|
+
/**
|
|
808
|
+
* @param name The name of the plugin
|
|
809
|
+
*/
|
|
810
|
+
constructor(name: string);
|
|
811
|
+
/**
|
|
812
|
+
* Load the plugin.
|
|
813
|
+
* @param manager The MagmaStream Manager instance
|
|
814
|
+
*/
|
|
815
|
+
abstract load(manager: Manager): void;
|
|
816
|
+
/**
|
|
817
|
+
* Unload the plugin.
|
|
818
|
+
* Called on shutdown to gracefully cleanup resources or detach listeners.
|
|
819
|
+
* @param manager The MagmaStream Manager instance
|
|
820
|
+
*/
|
|
821
|
+
abstract unload(manager: Manager): void;
|
|
822
|
+
}
|
|
823
|
+
|
|
784
824
|
/**
|
|
785
825
|
* Manager Options
|
|
786
826
|
*/
|
|
@@ -805,7 +845,11 @@ interface ManagerOptions {
|
|
|
805
845
|
autoPlaySearchPlatforms?: AutoPlayPlatform[];
|
|
806
846
|
/** The client ID to use. */
|
|
807
847
|
clientId?: string;
|
|
808
|
-
/** Value to use for the `Client-Name` header.
|
|
848
|
+
/** Value to use for the `Client-Name` header.
|
|
849
|
+
* @default "Magmastream"
|
|
850
|
+
*
|
|
851
|
+
* For NodeLink, leave it empty.
|
|
852
|
+
*/
|
|
809
853
|
clientName?: string;
|
|
810
854
|
/** The array of shard IDs connected to this manager instance.
|
|
811
855
|
* @default 0
|
|
@@ -1252,6 +1296,35 @@ interface PlaylistSearchResult {
|
|
|
1252
1296
|
/** The playlist info */
|
|
1253
1297
|
playlist: PlaylistData;
|
|
1254
1298
|
}
|
|
1299
|
+
interface AlbumSearchResult {
|
|
1300
|
+
loadType: LoadTypes.Album;
|
|
1301
|
+
tracks: Track[];
|
|
1302
|
+
playlist: PlaylistData;
|
|
1303
|
+
}
|
|
1304
|
+
interface ArtistSearchResult {
|
|
1305
|
+
loadType: LoadTypes.Artist;
|
|
1306
|
+
tracks: Track[];
|
|
1307
|
+
playlist: PlaylistData;
|
|
1308
|
+
}
|
|
1309
|
+
interface StationSearchResult {
|
|
1310
|
+
loadType: LoadTypes.Station;
|
|
1311
|
+
tracks: Track[];
|
|
1312
|
+
playlist: PlaylistData;
|
|
1313
|
+
}
|
|
1314
|
+
interface PodcastSearchResult {
|
|
1315
|
+
loadType: LoadTypes.Podcast;
|
|
1316
|
+
tracks: Track[];
|
|
1317
|
+
playlist: PlaylistData;
|
|
1318
|
+
}
|
|
1319
|
+
interface ShowSearchResult {
|
|
1320
|
+
loadType: LoadTypes.Show;
|
|
1321
|
+
tracks: Track[];
|
|
1322
|
+
playlist: PlaylistData;
|
|
1323
|
+
}
|
|
1324
|
+
interface ShortSearchResult {
|
|
1325
|
+
loadType: LoadTypes.Short;
|
|
1326
|
+
tracks: [Track];
|
|
1327
|
+
}
|
|
1255
1328
|
/**
|
|
1256
1329
|
* Playlist Data
|
|
1257
1330
|
*/
|
|
@@ -1848,7 +1921,7 @@ type VoiceReceiverEvent = StartSpeakingEventVoiceReceiver | EndSpeakingEventVoic
|
|
|
1848
1921
|
/**
|
|
1849
1922
|
* Search Result Enum type
|
|
1850
1923
|
*/
|
|
1851
|
-
type SearchResult = TrackSearchResult | SearchSearchResult | PlaylistSearchResult | ErrorOrEmptySearchResult;
|
|
1924
|
+
type SearchResult = TrackSearchResult | SearchSearchResult | PlaylistSearchResult | ErrorOrEmptySearchResult | AlbumSearchResult | ArtistSearchResult | StationSearchResult | PodcastSearchResult | ShowSearchResult | ShortSearchResult;
|
|
1852
1925
|
/**
|
|
1853
1926
|
* Lyrics Event Enum type
|
|
1854
1927
|
*/
|
|
@@ -1858,7 +1931,7 @@ type LyricsEvent = LyricsFoundEvent | LyricsNotFoundEvent | LyricsLineEvent;
|
|
|
1858
1931
|
*/
|
|
1859
1932
|
type LyricsEventType = "LyricsFoundEvent" | "LyricsNotFoundEvent" | "LyricsLineEvent";
|
|
1860
1933
|
|
|
1861
|
-
declare class Node
|
|
1934
|
+
declare class Node {
|
|
1862
1935
|
manager: Manager;
|
|
1863
1936
|
options: NodeOptions;
|
|
1864
1937
|
/** The socket for the node. */
|
|
@@ -2091,9 +2164,10 @@ declare class Node$1 {
|
|
|
2091
2164
|
*
|
|
2092
2165
|
* @param {Track} track - The track to fetch the lyrics for.
|
|
2093
2166
|
* @param {boolean} [skipTrackSource=false] - Whether to skip using the track's source URL.
|
|
2167
|
+
* @param {string} [language="en"] - The language of the lyrics.
|
|
2094
2168
|
* @returns {Promise<Lyrics | NodeLinkGetLyrics>} A promise that resolves with the lyrics data.
|
|
2095
2169
|
*/
|
|
2096
|
-
getLyrics(track: Track, skipTrackSource?: boolean): Promise<Lyrics | NodeLinkGetLyrics>;
|
|
2170
|
+
getLyrics(track: Track, skipTrackSource?: boolean, language?: string): Promise<Lyrics | NodeLinkGetLyrics>;
|
|
2097
2171
|
/**
|
|
2098
2172
|
* Subscribes to lyrics for a player.
|
|
2099
2173
|
* @param {string} guildId - The ID of the guild to subscribe to lyrics for.
|
|
@@ -2244,12 +2318,13 @@ declare class Manager extends EventEmitter {
|
|
|
2244
2318
|
/** The map of players. */
|
|
2245
2319
|
readonly players: Collection<string, Player>;
|
|
2246
2320
|
/** The map of nodes. */
|
|
2247
|
-
readonly nodes: Collection<string, Node
|
|
2321
|
+
readonly nodes: Collection<string, Node>;
|
|
2248
2322
|
/** The options that were set. */
|
|
2249
2323
|
readonly options: ManagerOptions;
|
|
2250
2324
|
initiated: boolean;
|
|
2251
2325
|
redis?: Redis;
|
|
2252
2326
|
private _send?;
|
|
2327
|
+
private loadedPlugins;
|
|
2253
2328
|
/**
|
|
2254
2329
|
* Initiates the Manager class.
|
|
2255
2330
|
* @param options
|
|
@@ -2310,7 +2385,7 @@ declare class Manager extends EventEmitter {
|
|
|
2310
2385
|
* @param options - The options to create the node with.
|
|
2311
2386
|
* @returns The created node.
|
|
2312
2387
|
*/
|
|
2313
|
-
createNode(options: NodeOptions): Node
|
|
2388
|
+
createNode(options: NodeOptions): Node;
|
|
2314
2389
|
/**
|
|
2315
2390
|
* Destroys a node if it exists. Emits a debug event if the node is found and destroyed.
|
|
2316
2391
|
* @param identifier - The identifier of the node to destroy.
|
|
@@ -2371,7 +2446,7 @@ declare class Manager extends EventEmitter {
|
|
|
2371
2446
|
* If `enablePriorityMode` is false and `useNode` is not set, the node with the lowest load is chosen.
|
|
2372
2447
|
* @returns {Node} The node to use.
|
|
2373
2448
|
*/
|
|
2374
|
-
get useableNode(): Node
|
|
2449
|
+
get useableNode(): Node;
|
|
2375
2450
|
/**
|
|
2376
2451
|
* Handles the shutdown of the process by saving all active players' states and optionally cleaning up inactive players.
|
|
2377
2452
|
* This function is called when the process is about to exit.
|
|
@@ -2452,6 +2527,14 @@ declare class Manager extends EventEmitter {
|
|
|
2452
2527
|
* @param guildId The guild ID of the player to clean up.
|
|
2453
2528
|
*/
|
|
2454
2529
|
cleanupInactivePlayer(guildId: string): Promise<void>;
|
|
2530
|
+
/**
|
|
2531
|
+
* Loads the enabled plugins.
|
|
2532
|
+
*/
|
|
2533
|
+
private loadPlugins;
|
|
2534
|
+
/**
|
|
2535
|
+
* Unloads the enabled plugins.
|
|
2536
|
+
*/
|
|
2537
|
+
private unloadPlugins;
|
|
2455
2538
|
/**
|
|
2456
2539
|
* Clears all player states from the file system.
|
|
2457
2540
|
* This is done to prevent stale state files from accumulating on the file system.
|
|
@@ -2506,7 +2589,7 @@ declare class Player {
|
|
|
2506
2589
|
/** The volume for the player */
|
|
2507
2590
|
volume: number;
|
|
2508
2591
|
/** The Node for the Player. */
|
|
2509
|
-
node: Node
|
|
2592
|
+
node: Node;
|
|
2510
2593
|
/** The guild ID for the player. */
|
|
2511
2594
|
guildId: string;
|
|
2512
2595
|
/** The voice channel for the player. */
|
|
@@ -3232,15 +3315,6 @@ declare enum AvailableFilters {
|
|
|
3232
3315
|
Demon = "demon"
|
|
3233
3316
|
}
|
|
3234
3317
|
|
|
3235
|
-
declare class Plugin$1 {
|
|
3236
|
-
name: string;
|
|
3237
|
-
/**
|
|
3238
|
-
* @param name The name of the plugin
|
|
3239
|
-
*/
|
|
3240
|
-
constructor(name: string);
|
|
3241
|
-
load(manager: Manager): void;
|
|
3242
|
-
}
|
|
3243
|
-
|
|
3244
3318
|
declare abstract class TrackUtils {
|
|
3245
3319
|
static trackPartial: TrackPartial[] | null;
|
|
3246
3320
|
private static manager;
|
|
@@ -3305,6 +3379,23 @@ declare abstract class AutoPlayUtils {
|
|
|
3305
3379
|
* @returns An array of recommended tracks.
|
|
3306
3380
|
*/
|
|
3307
3381
|
static getRecommendedTracksFromSource(track: Track, platform: AutoPlayPlatform): Promise<Track[]>;
|
|
3382
|
+
/**
|
|
3383
|
+
* Searches for a track using the manager and returns resolved tracks.
|
|
3384
|
+
* @param query The search query (artist - title).
|
|
3385
|
+
* @param requester The requester who initiated the search.
|
|
3386
|
+
* @returns An array of resolved tracks, or an empty array if not found or error occurred.
|
|
3387
|
+
*/
|
|
3388
|
+
private static resolveTracksFromQuery;
|
|
3389
|
+
/**
|
|
3390
|
+
* Resolves the first available track from a search query using the specified source.
|
|
3391
|
+
* Useful for normalizing tracks that lack platform-specific metadata or URIs.
|
|
3392
|
+
*
|
|
3393
|
+
* @param query - The search query string (usually "Artist - Title").
|
|
3394
|
+
* @param source - The search platform to use (e.g., Spotify, Deezer, YouTube).
|
|
3395
|
+
* @param requester - The requester object, used for context or attribution.
|
|
3396
|
+
* @returns A single resolved {@link Track} object if found, or `null` if the search fails or returns no results.
|
|
3397
|
+
*/
|
|
3398
|
+
private static resolveFirstTrackFromQuery;
|
|
3308
3399
|
static buildTracksFromResponse<T>(recommendedResult: LavalinkResponse, requester?: T): Track[];
|
|
3309
3400
|
}
|
|
3310
3401
|
/** Gets or extends structures to extend the built in, or already extended, classes to add more functionality. */
|
|
@@ -3389,5 +3480,5 @@ declare class SeyfertManager extends Manager {
|
|
|
3389
3480
|
protected send(packet: GatewayVoiceStateUpdate): void;
|
|
3390
3481
|
}
|
|
3391
3482
|
|
|
3392
|
-
export { AutoPlayPlatform, AutoPlayUtils, AvailableFilters, DetritusManager, DiscordJSManager, ErisManager, Filters, JsonQueue, LoadTypes, Manager, ManagerEventTypes, MemoryQueue, Node
|
|
3393
|
-
export type { CPUStats, DiscordPacket, EndSpeakingEventVoiceReceiver, EndSpeakingEventVoiceReceiverData, EqualizerBand, ErrorOrEmptySearchResult, Exception, Extendable, FrameStats, IQueue, JsonConfig, LavaPlayer, LavalinkInfo, LavalinkResponse, LoadType, Lyrics, LyricsEvent, LyricsEventType, LyricsFoundEvent, LyricsLine, LyricsLineEvent, LyricsNotFoundEvent, ManagerEvents, ManagerInitOptions, ManagerOptions, MemoryStats, NodeLinkGetLyrics, NodeLinkGetLyricsEmpty, NodeLinkGetLyricsError, NodeLinkGetLyricsMultiple, NodeLinkGetLyricsSingle, NodeMessage, NodeOptions, NodeStats, Payload, PlayOptions, PlayerEvent, PlayerEventType, PlayerEvents, PlayerOptions, PlayerStateChangeData, PlayerStateUpdateEvent, PlayerUpdate, PlayerUpdateVoiceState, PlaylistData, PlaylistInfoData, PlaylistRawData, PlaylistSearchResult, RedisConfig, SearchQuery, SearchResult, SearchSearchResult, Severity, Sizes, SponsorBlockChapterStarted, SponsorBlockChaptersLoaded, SponsorBlockSegmentEventType, SponsorBlockSegmentEvents, SponsorBlockSegmentSkipped, SponsorBlockSegmentsLoaded, StartSpeakingEventVoiceReceiver, StartSpeakingEventVoiceReceiverData, StateStorageOptions, Track, TrackData, TrackDataInfo, TrackEndEvent, TrackEndReason, TrackExceptionEvent, TrackPluginInfo, TrackSearchResult, TrackSourceName, TrackStartEvent, TrackStuckEvent, UseNodeOption, VoicePacket, VoiceReceiverEvent, VoiceServer, VoiceServerUpdate, VoiceState, WebSocketClosedEvent };
|
|
3483
|
+
export { AutoPlayPlatform, AutoPlayUtils, AvailableFilters, DetritusManager, DiscordJSManager, ErisManager, Filters, JsonQueue, LoadTypes, Manager, ManagerEventTypes, MemoryQueue, Node, OceanicManager, Player, PlayerStateEventTypes, Plugin, RedisQueue, Rest, SearchPlatform, SeverityTypes, SeyfertManager, SponsorBlockSegment, StateStorageType, StateTypes, Structure, TrackEndReasonTypes, TrackPartial, TrackSourceTypes, TrackUtils, UseNodeOptions };
|
|
3484
|
+
export type { AlbumSearchResult, ArtistSearchResult, CPUStats, DiscordPacket, EndSpeakingEventVoiceReceiver, EndSpeakingEventVoiceReceiverData, EqualizerBand, ErrorOrEmptySearchResult, Exception, Extendable, FrameStats, IQueue, JsonConfig, LavaPlayer, LavalinkInfo, LavalinkResponse, LoadType, Lyrics, LyricsEvent, LyricsEventType, LyricsFoundEvent, LyricsLine, LyricsLineEvent, LyricsNotFoundEvent, ManagerEvents, ManagerInitOptions, ManagerOptions, MemoryStats, NodeLinkGetLyrics, NodeLinkGetLyricsEmpty, NodeLinkGetLyricsError, NodeLinkGetLyricsMultiple, NodeLinkGetLyricsSingle, NodeMessage, NodeOptions, NodeStats, Payload, PlayOptions, PlayerEvent, PlayerEventType, PlayerEvents, PlayerOptions, PlayerStateChangeData, PlayerStateUpdateEvent, PlayerUpdate, PlayerUpdateVoiceState, PlaylistData, PlaylistInfoData, PlaylistRawData, PlaylistSearchResult, PodcastSearchResult, RedisConfig, SearchQuery, SearchResult, SearchSearchResult, Severity, ShortSearchResult, ShowSearchResult, Sizes, SponsorBlockChapterStarted, SponsorBlockChaptersLoaded, SponsorBlockSegmentEventType, SponsorBlockSegmentEvents, SponsorBlockSegmentSkipped, SponsorBlockSegmentsLoaded, StartSpeakingEventVoiceReceiver, StartSpeakingEventVoiceReceiverData, StateStorageOptions, StationSearchResult, Track, TrackData, TrackDataInfo, TrackEndEvent, TrackEndReason, TrackExceptionEvent, TrackPluginInfo, TrackSearchResult, TrackSourceName, TrackStartEvent, TrackStuckEvent, UseNodeOption, VoicePacket, VoiceReceiverEvent, VoiceServer, VoiceServerUpdate, VoiceState, WebSocketClosedEvent };
|