magmastream 2.9.0-dev.35 → 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 +680 -168
- package/dist/index.js +6 -1
- package/dist/statestorage/JsonQueue.js +436 -0
- package/dist/{structures/Queue.js → statestorage/MemoryQueue.js} +71 -16
- package/dist/{structures → statestorage}/RedisQueue.js +107 -2
- package/dist/structures/Enums.js +19 -1
- package/dist/structures/Manager.js +211 -68
- package/dist/structures/Node.js +15 -9
- package/dist/structures/Player.js +18 -10
- package/dist/structures/Plugin.js +4 -1
- package/dist/structures/Rest.js +2 -1
- package/dist/structures/Utils.js +208 -318
- package/dist/wrappers/seyfert.js +43 -0
- package/package.json +11 -10
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { Redis } from 'ioredis';
|
|
|
7
7
|
import { Client as Client$1 } from 'eris';
|
|
8
8
|
import { ClusterClient, ShardClient } from 'detritus-client';
|
|
9
9
|
import { Client as Client$2 } from 'oceanic.js';
|
|
10
|
+
import { Client as Client$3 } from 'seyfert';
|
|
10
11
|
|
|
11
12
|
/** Represents an equalizer band. */
|
|
12
13
|
interface Band {
|
|
@@ -30,7 +31,7 @@ declare class Rest {
|
|
|
30
31
|
manager: Manager;
|
|
31
32
|
/** Whether the node is a NodeLink. */
|
|
32
33
|
isNodeLink: boolean;
|
|
33
|
-
constructor(node: Node
|
|
34
|
+
constructor(node: Node, manager: Manager);
|
|
34
35
|
/**
|
|
35
36
|
* Sets the session ID.
|
|
36
37
|
* This method is used to set the session ID after a resume operation is done.
|
|
@@ -136,12 +137,463 @@ interface playOptions {
|
|
|
136
137
|
};
|
|
137
138
|
}
|
|
138
139
|
|
|
140
|
+
/**
|
|
141
|
+
* The player's queue, the `current` property is the currently playing track, think of the rest as the up-coming tracks.
|
|
142
|
+
*/
|
|
143
|
+
declare class JsonQueue implements IQueue {
|
|
144
|
+
readonly guildId: string;
|
|
145
|
+
readonly manager: Manager;
|
|
146
|
+
private basePath;
|
|
147
|
+
/**
|
|
148
|
+
* @param guildId The guild ID.
|
|
149
|
+
* @param manager The manager.
|
|
150
|
+
*/
|
|
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;
|
|
190
|
+
/**
|
|
191
|
+
* @returns The current track.
|
|
192
|
+
*/
|
|
193
|
+
getCurrent(): Promise<Track | null>;
|
|
194
|
+
/**
|
|
195
|
+
* @param track The track to set.
|
|
196
|
+
*/
|
|
197
|
+
setCurrent(track: Track | null): Promise<void>;
|
|
198
|
+
/**
|
|
199
|
+
* @returns The previous tracks.
|
|
200
|
+
*/
|
|
201
|
+
getPrevious(): Promise<Track[]>;
|
|
202
|
+
/**
|
|
203
|
+
* @param track The track to add.
|
|
204
|
+
*/
|
|
205
|
+
addPrevious(track: Track | Track[]): Promise<void>;
|
|
206
|
+
/**
|
|
207
|
+
* @param track The track to set.
|
|
208
|
+
*/
|
|
209
|
+
setPrevious(track: Track | Track[]): Promise<void>;
|
|
210
|
+
/**
|
|
211
|
+
* @returns The newest track.
|
|
212
|
+
*/
|
|
213
|
+
popPrevious(): Promise<Track | null>;
|
|
214
|
+
/**
|
|
215
|
+
* Clears the previous tracks.
|
|
216
|
+
*/
|
|
217
|
+
clearPrevious(): Promise<void>;
|
|
218
|
+
/**
|
|
219
|
+
* @param track The track or tracks to add. Can be a single `Track` or an array of `Track`s.
|
|
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.
|
|
221
|
+
*/
|
|
222
|
+
add(track: Track | Track[], offset?: number): Promise<void>;
|
|
223
|
+
/**
|
|
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.
|
|
227
|
+
*/
|
|
228
|
+
remove(position?: number): Promise<Track[]>;
|
|
229
|
+
remove(start: number, end: number): Promise<Track[]>;
|
|
230
|
+
/**
|
|
231
|
+
* Clears the queue.
|
|
232
|
+
*/
|
|
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>;
|
|
246
|
+
/**
|
|
247
|
+
* Shuffles the queue.
|
|
248
|
+
*/
|
|
249
|
+
shuffle(): Promise<void>;
|
|
250
|
+
/**
|
|
251
|
+
* Shuffles the queue by user.
|
|
252
|
+
*/
|
|
253
|
+
userBlockShuffle(): Promise<void>;
|
|
254
|
+
/**
|
|
255
|
+
* Shuffles the queue by round-robin.
|
|
256
|
+
*/
|
|
257
|
+
roundRobinShuffle(): Promise<void>;
|
|
258
|
+
/**
|
|
259
|
+
* Removes the first track from the queue.
|
|
260
|
+
*/
|
|
261
|
+
dequeue(): Promise<Track | undefined>;
|
|
262
|
+
/**
|
|
263
|
+
* Adds a track to the front of the queue.
|
|
264
|
+
*/
|
|
265
|
+
enqueueFront(track: Track | Track[]): Promise<void>;
|
|
266
|
+
/**
|
|
267
|
+
* @returns The tracks in the queue.
|
|
268
|
+
*/
|
|
269
|
+
getTracks(): Promise<Track[]>;
|
|
270
|
+
/**
|
|
271
|
+
* @returns The tracks in the queue from start to end.
|
|
272
|
+
*/
|
|
273
|
+
getSlice(start?: number, end?: number): Promise<Track[]>;
|
|
274
|
+
/**
|
|
275
|
+
* Modifies the queue at the specified index.
|
|
276
|
+
*/
|
|
277
|
+
modifyAt(start: number, deleteCount?: number, ...items: Track[]): Promise<Track[]>;
|
|
278
|
+
/**
|
|
279
|
+
* Maps the queue to a new array.
|
|
280
|
+
*/
|
|
281
|
+
mapAsync<T>(callback: (track: Track, index: number, array: Track[]) => T): Promise<T[]>;
|
|
282
|
+
/**
|
|
283
|
+
* Filters the queue.
|
|
284
|
+
*/
|
|
285
|
+
filterAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<Track[]>;
|
|
286
|
+
/**
|
|
287
|
+
* Finds the first track in the queue that satisfies the provided testing function.
|
|
288
|
+
*/
|
|
289
|
+
findAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<Track | undefined>;
|
|
290
|
+
/**
|
|
291
|
+
* Tests whether at least one element in the queue passes the test implemented by the provided function.
|
|
292
|
+
*/
|
|
293
|
+
someAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<boolean>;
|
|
294
|
+
/**
|
|
295
|
+
* Tests whether all elements in the queue pass the test implemented by the provided function.
|
|
296
|
+
*/
|
|
297
|
+
everyAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<boolean>;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* The player's queue, the `current` property is the currently playing track, think of the rest as the up-coming tracks.
|
|
302
|
+
*/
|
|
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;
|
|
312
|
+
/**
|
|
313
|
+
* Constructs a new Queue.
|
|
314
|
+
* @param guildId The guild ID.
|
|
315
|
+
* @param manager The Manager instance.
|
|
316
|
+
*/
|
|
317
|
+
constructor(guildId: string, manager: Manager);
|
|
318
|
+
/**
|
|
319
|
+
* @returns The current track.
|
|
320
|
+
*/
|
|
321
|
+
getCurrent(): Promise<Track | null>;
|
|
322
|
+
/**
|
|
323
|
+
* @param track The track to set.
|
|
324
|
+
*/
|
|
325
|
+
setCurrent(track: Track | null): Promise<void>;
|
|
326
|
+
/**
|
|
327
|
+
* @returns The previous tracks.
|
|
328
|
+
*/
|
|
329
|
+
getPrevious(): Promise<Track[]>;
|
|
330
|
+
addPrevious(track: Track | Track[]): Promise<void>;
|
|
331
|
+
/**
|
|
332
|
+
* @param tracks The tracks to set.
|
|
333
|
+
*/
|
|
334
|
+
setPrevious(tracks: Track[]): Promise<void>;
|
|
335
|
+
/**
|
|
336
|
+
* @returns The newest track.
|
|
337
|
+
*/
|
|
338
|
+
popPrevious(): Promise<Track | null>;
|
|
339
|
+
/**
|
|
340
|
+
* Clears the previous tracks.
|
|
341
|
+
*/
|
|
342
|
+
clearPrevious(): Promise<void>;
|
|
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.
|
|
362
|
+
* @param track The track or tracks to add. Can be a single `Track` or an array of `Track`s.
|
|
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.
|
|
364
|
+
*/
|
|
365
|
+
add(track: Track | Track[], offset?: number): Promise<void>;
|
|
366
|
+
/**
|
|
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).
|
|
372
|
+
*/
|
|
373
|
+
remove(position?: number): Promise<Track[]>;
|
|
374
|
+
remove(start: number, end: number): Promise<Track[]>;
|
|
375
|
+
/**
|
|
376
|
+
* Clears the queue.
|
|
377
|
+
* This will remove all tracks from the queue and emit a state update event.
|
|
378
|
+
*/
|
|
379
|
+
clear(): Promise<void>;
|
|
380
|
+
/**
|
|
381
|
+
* Shuffles the queue.
|
|
382
|
+
* This will randomize the order of the tracks in the queue and emit a state update event.
|
|
383
|
+
*/
|
|
384
|
+
shuffle(): Promise<void>;
|
|
385
|
+
/**
|
|
386
|
+
* Shuffles the queue to play tracks requested by each user one block at a time.
|
|
387
|
+
*/
|
|
388
|
+
userBlockShuffle(): Promise<void>;
|
|
389
|
+
/**
|
|
390
|
+
* Shuffles the queue to play tracks requested by each user one by one.
|
|
391
|
+
*/
|
|
392
|
+
roundRobinShuffle(): Promise<void>;
|
|
393
|
+
/**
|
|
394
|
+
* Removes the first element from the queue.
|
|
395
|
+
*/
|
|
396
|
+
dequeue(): Promise<Track | undefined>;
|
|
397
|
+
/**
|
|
398
|
+
* Adds the specified track or tracks to the front of the queue.
|
|
399
|
+
* @param track The track or tracks to add.
|
|
400
|
+
*/
|
|
401
|
+
enqueueFront(track: Track | Track[]): Promise<void>;
|
|
402
|
+
/**
|
|
403
|
+
* @returns A shallow copy of the queue.
|
|
404
|
+
*/
|
|
405
|
+
getTracks(): Promise<Track[]>;
|
|
406
|
+
/**
|
|
407
|
+
* @returns A shallow copy of the queue.
|
|
408
|
+
*/
|
|
409
|
+
getSlice(start?: number, end?: number): Promise<Track[]>;
|
|
410
|
+
/**
|
|
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.
|
|
416
|
+
*/
|
|
417
|
+
modifyAt(start: number, deleteCount?: number, ...items: Track[]): Promise<Track[]>;
|
|
418
|
+
/**
|
|
419
|
+
* @returns A new array with the results of calling a provided function on every element in the queue.
|
|
420
|
+
*/
|
|
421
|
+
mapAsync<T>(callback: (track: Track, index: number, array: Track[]) => T): Promise<T[]>;
|
|
422
|
+
/**
|
|
423
|
+
* @returns A new array with all elements that pass the test implemented by the provided function.
|
|
424
|
+
*/
|
|
425
|
+
filterAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<Track[]>;
|
|
426
|
+
/**
|
|
427
|
+
* @returns The first element in the queue that satisfies the provided testing function.
|
|
428
|
+
*/
|
|
429
|
+
findAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<Track | undefined>;
|
|
430
|
+
/**
|
|
431
|
+
* @returns Whether at least one element in the queue satisfies the provided testing function.
|
|
432
|
+
*/
|
|
433
|
+
someAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<boolean>;
|
|
434
|
+
/**
|
|
435
|
+
* @returns Whether all elements in the queue satisfy the provided testing function.
|
|
436
|
+
*/
|
|
437
|
+
everyAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<boolean>;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
/**
|
|
441
|
+
* The player's queue, the `current` property is the currently playing track, think of the rest as the up-coming tracks.
|
|
442
|
+
*/
|
|
443
|
+
declare class RedisQueue implements IQueue {
|
|
444
|
+
readonly guildId: string;
|
|
445
|
+
readonly manager: Manager;
|
|
446
|
+
/**
|
|
447
|
+
* The Redis instance.
|
|
448
|
+
*/
|
|
449
|
+
private redis;
|
|
450
|
+
/**
|
|
451
|
+
* The prefix for the Redis keys.
|
|
452
|
+
*/
|
|
453
|
+
redisPrefix: string;
|
|
454
|
+
/**
|
|
455
|
+
* Constructs a new RedisQueue.
|
|
456
|
+
* @param guildId The guild ID.
|
|
457
|
+
* @param manager The Manager instance.
|
|
458
|
+
*/
|
|
459
|
+
constructor(guildId: string, manager: Manager);
|
|
460
|
+
/**
|
|
461
|
+
* @returns The queue key.
|
|
462
|
+
*/
|
|
463
|
+
private get queueKey();
|
|
464
|
+
/**
|
|
465
|
+
* @returns The current key.
|
|
466
|
+
*/
|
|
467
|
+
private get currentKey();
|
|
468
|
+
/**
|
|
469
|
+
* @returns The previous key.
|
|
470
|
+
*/
|
|
471
|
+
private get previousKey();
|
|
472
|
+
/**
|
|
473
|
+
* Helper to serialize/deserialize Track
|
|
474
|
+
*/
|
|
475
|
+
private serialize;
|
|
476
|
+
/**
|
|
477
|
+
* Helper to serialize/deserialize Track
|
|
478
|
+
*/
|
|
479
|
+
private deserialize;
|
|
480
|
+
/**
|
|
481
|
+
* @returns The current track.
|
|
482
|
+
*/
|
|
483
|
+
getCurrent(): Promise<Track | null>;
|
|
484
|
+
/**
|
|
485
|
+
* @param track The track to set.
|
|
486
|
+
*/
|
|
487
|
+
setCurrent(track: Track | null): Promise<void>;
|
|
488
|
+
/**
|
|
489
|
+
* @returns The previous tracks.
|
|
490
|
+
*/
|
|
491
|
+
getPrevious(): Promise<Track[]>;
|
|
492
|
+
/**
|
|
493
|
+
* @param track The track to add.
|
|
494
|
+
*/
|
|
495
|
+
addPrevious(track: Track | Track[]): Promise<void>;
|
|
496
|
+
/**
|
|
497
|
+
* @param track The track to set.
|
|
498
|
+
*/
|
|
499
|
+
setPrevious(track: Track | Track[]): Promise<void>;
|
|
500
|
+
/**
|
|
501
|
+
* @returns The newest track.
|
|
502
|
+
*/
|
|
503
|
+
popPrevious(): Promise<Track | null>;
|
|
504
|
+
/**
|
|
505
|
+
* Clears the previous tracks.
|
|
506
|
+
*/
|
|
507
|
+
clearPrevious(): Promise<void>;
|
|
508
|
+
/**
|
|
509
|
+
* @param track The track or tracks to add. Can be a single `Track` or an array of `Track`s.
|
|
510
|
+
* @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.
|
|
511
|
+
*/
|
|
512
|
+
add(track: Track | Track[], offset?: number): Promise<void>;
|
|
513
|
+
/**
|
|
514
|
+
* @param position The position to remove the track at.
|
|
515
|
+
* @param end The end position to remove the track at.
|
|
516
|
+
*/
|
|
517
|
+
remove(position?: number): Promise<Track[]>;
|
|
518
|
+
remove(start: number, end: number): Promise<Track[]>;
|
|
519
|
+
/**
|
|
520
|
+
* Clears the queue.
|
|
521
|
+
*/
|
|
522
|
+
clear(): Promise<void>;
|
|
523
|
+
/**
|
|
524
|
+
* @returns The size of the queue.
|
|
525
|
+
*/
|
|
526
|
+
size(): Promise<number>;
|
|
527
|
+
/**
|
|
528
|
+
* @returns The total size of tracks in the queue including the current track.
|
|
529
|
+
*/
|
|
530
|
+
totalSize(): Promise<number>;
|
|
531
|
+
/**
|
|
532
|
+
* @returns The total duration of the queue in milliseconds.
|
|
533
|
+
* This includes the duration of the currently playing track.
|
|
534
|
+
*/
|
|
535
|
+
duration(): Promise<number>;
|
|
536
|
+
/**
|
|
537
|
+
* Shuffles the queue.
|
|
538
|
+
*/
|
|
539
|
+
shuffle(): Promise<void>;
|
|
540
|
+
/**
|
|
541
|
+
* Shuffles the queue, but keeps the tracks of the same user together.
|
|
542
|
+
*/
|
|
543
|
+
userBlockShuffle(): Promise<void>;
|
|
544
|
+
/**
|
|
545
|
+
* Shuffles the queue round-robin style.
|
|
546
|
+
*/
|
|
547
|
+
roundRobinShuffle(): Promise<void>;
|
|
548
|
+
/**
|
|
549
|
+
* Removes the first track from the queue.
|
|
550
|
+
*/
|
|
551
|
+
dequeue(): Promise<Track | undefined>;
|
|
552
|
+
/**
|
|
553
|
+
* Adds a track to the front of the queue.
|
|
554
|
+
*/
|
|
555
|
+
enqueueFront(track: Track | Track[]): Promise<void>;
|
|
556
|
+
/**
|
|
557
|
+
* @returns The tracks in the queue.
|
|
558
|
+
*/
|
|
559
|
+
getTracks(): Promise<Track[]>;
|
|
560
|
+
/**
|
|
561
|
+
* @returns The tracks in the queue from the start to the end.
|
|
562
|
+
*/
|
|
563
|
+
getSlice(start?: number, end?: number): Promise<Track[]>;
|
|
564
|
+
/**
|
|
565
|
+
* Modifies the queue at the specified index.
|
|
566
|
+
*/
|
|
567
|
+
modifyAt(start: number, deleteCount?: number, ...items: Track[]): Promise<Track[]>;
|
|
568
|
+
/**
|
|
569
|
+
* @returns The tracks in the queue after the specified index.
|
|
570
|
+
*/
|
|
571
|
+
mapAsync<T>(callback: (track: Track, index: number, array: Track[]) => T): Promise<T[]>;
|
|
572
|
+
/**
|
|
573
|
+
* @returns The tracks in the queue that match the specified condition.
|
|
574
|
+
*/
|
|
575
|
+
filterAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<Track[]>;
|
|
576
|
+
/**
|
|
577
|
+
* @returns The first track in the queue that matches the specified condition.
|
|
578
|
+
*/
|
|
579
|
+
findAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<Track | undefined>;
|
|
580
|
+
/**
|
|
581
|
+
* @returns Whether any tracks in the queue match the specified condition.
|
|
582
|
+
*/
|
|
583
|
+
someAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<boolean>;
|
|
584
|
+
/**
|
|
585
|
+
* @returns Whether all tracks in the queue match the specified condition.
|
|
586
|
+
*/
|
|
587
|
+
everyAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<boolean>;
|
|
588
|
+
}
|
|
589
|
+
|
|
139
590
|
/**
|
|
140
591
|
* State Storage Enum
|
|
141
592
|
*/
|
|
142
593
|
declare enum StateStorageType {
|
|
143
|
-
|
|
144
|
-
Redis = "redis"
|
|
594
|
+
Memory = "memory",
|
|
595
|
+
Redis = "redis",
|
|
596
|
+
JSON = "json"
|
|
145
597
|
}
|
|
146
598
|
/**
|
|
147
599
|
* AutoPlay Platform Enum
|
|
@@ -173,7 +625,19 @@ declare enum LoadTypes {
|
|
|
173
625
|
Playlist = "playlist",
|
|
174
626
|
Search = "search",
|
|
175
627
|
Empty = "empty",
|
|
176
|
-
Error = "error"
|
|
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"
|
|
177
641
|
}
|
|
178
642
|
/**
|
|
179
643
|
* Search Platform Enum
|
|
@@ -291,10 +755,15 @@ declare enum ManagerEventTypes {
|
|
|
291
755
|
TrackError = "trackError",
|
|
292
756
|
TrackStart = "trackStart",
|
|
293
757
|
TrackStuck = "trackStuck",
|
|
758
|
+
/** Nodelink */
|
|
294
759
|
VoiceReceiverDisconnect = "voiceReceiverDisconnect",
|
|
760
|
+
/** Nodelink */
|
|
295
761
|
VoiceReceiverConnect = "voiceReceiverConnect",
|
|
762
|
+
/** Nodelink */
|
|
296
763
|
VoiceReceiverError = "voiceReceiverError",
|
|
764
|
+
/** Nodelink */
|
|
297
765
|
VoiceReceiverStartSpeaking = "voiceReceiverStartSpeaking",
|
|
766
|
+
/** Nodelink */
|
|
298
767
|
VoiceReceiverEndSpeaking = "voiceReceiverEndSpeaking"
|
|
299
768
|
}
|
|
300
769
|
/**
|
|
@@ -330,90 +799,26 @@ declare enum SponsorBlockSegment {
|
|
|
330
799
|
}
|
|
331
800
|
|
|
332
801
|
/**
|
|
333
|
-
*
|
|
802
|
+
* Base abstract class for all plugins.
|
|
803
|
+
* Users must extend this and implement load and unload methods.
|
|
334
804
|
*/
|
|
335
|
-
declare class
|
|
336
|
-
|
|
337
|
-
current: Track | null;
|
|
338
|
-
/** The previous tracks */
|
|
339
|
-
previous: Track[];
|
|
340
|
-
/** The Manager instance. */
|
|
341
|
-
manager: Manager;
|
|
342
|
-
/** The guild ID property. */
|
|
343
|
-
guildId: string;
|
|
344
|
-
/**
|
|
345
|
-
* Constructs a new Queue.
|
|
346
|
-
* @param guildId The guild ID.
|
|
347
|
-
* @param manager The Manager instance.
|
|
348
|
-
*/
|
|
349
|
-
constructor(guildId: string, manager: Manager);
|
|
350
|
-
getCurrent(): Promise<Track | null>;
|
|
351
|
-
setCurrent(track: Track | null): Promise<void>;
|
|
352
|
-
getPrevious(): Promise<Track[]>;
|
|
353
|
-
addPrevious(track: Track | Track[]): Promise<void>;
|
|
354
|
-
setPrevious(tracks: Track[]): Promise<void>;
|
|
355
|
-
popPrevious(): Promise<Track | null>;
|
|
356
|
-
clearPrevious(): Promise<void>;
|
|
357
|
-
/**
|
|
358
|
-
* The total duration of the queue in milliseconds.
|
|
359
|
-
* This includes the duration of the currently playing track.
|
|
360
|
-
*/
|
|
361
|
-
duration(): Promise<number>;
|
|
362
|
-
/**
|
|
363
|
-
* The total size of tracks in the queue including the current track.
|
|
364
|
-
* This includes the current track if it is not null.
|
|
365
|
-
* @returns The total size of tracks in the queue including the current track.
|
|
366
|
-
*/
|
|
367
|
-
totalSize(): Promise<number>;
|
|
368
|
-
/**
|
|
369
|
-
* The size of tracks in the queue.
|
|
370
|
-
* This does not include the currently playing track.
|
|
371
|
-
* @returns The size of tracks in the queue.
|
|
372
|
-
*/
|
|
373
|
-
size(): Promise<number>;
|
|
374
|
-
/**
|
|
375
|
-
* Adds a track to the queue.
|
|
376
|
-
* @param track The track or tracks to add. Can be a single `Track` or an array of `Track`s.
|
|
377
|
-
* @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.
|
|
378
|
-
*/
|
|
379
|
-
add(track: Track | Track[], offset?: number): Promise<void>;
|
|
380
|
-
/**
|
|
381
|
-
* Removes track(s) from the queue.
|
|
382
|
-
* @param startOrPosition If a single number is provided, it will be treated as the position of the track to remove.
|
|
383
|
-
* If two numbers are provided, they will be used as the start and end of a range of tracks to remove.
|
|
384
|
-
* @param end Optional, end of the range of tracks to remove.
|
|
385
|
-
* @returns The removed track(s).
|
|
386
|
-
*/
|
|
387
|
-
remove(position?: number): Promise<Track[]>;
|
|
388
|
-
remove(start: number, end: number): Promise<Track[]>;
|
|
389
|
-
/**
|
|
390
|
-
* Clears the queue.
|
|
391
|
-
* This will remove all tracks from the queue and emit a state update event.
|
|
392
|
-
*/
|
|
393
|
-
clear(): Promise<void>;
|
|
805
|
+
declare abstract class Plugin {
|
|
806
|
+
readonly name: string;
|
|
394
807
|
/**
|
|
395
|
-
*
|
|
396
|
-
* This will randomize the order of the tracks in the queue and emit a state update event.
|
|
808
|
+
* @param name The name of the plugin
|
|
397
809
|
*/
|
|
398
|
-
|
|
810
|
+
constructor(name: string);
|
|
399
811
|
/**
|
|
400
|
-
*
|
|
812
|
+
* Load the plugin.
|
|
813
|
+
* @param manager The MagmaStream Manager instance
|
|
401
814
|
*/
|
|
402
|
-
|
|
815
|
+
abstract load(manager: Manager): void;
|
|
403
816
|
/**
|
|
404
|
-
*
|
|
817
|
+
* Unload the plugin.
|
|
818
|
+
* Called on shutdown to gracefully cleanup resources or detach listeners.
|
|
819
|
+
* @param manager The MagmaStream Manager instance
|
|
405
820
|
*/
|
|
406
|
-
|
|
407
|
-
dequeue(): Promise<Track | undefined>;
|
|
408
|
-
enqueueFront(track: Track | Track[]): Promise<void>;
|
|
409
|
-
getTracks(): Promise<Track[]>;
|
|
410
|
-
getSlice(start?: number, end?: number): Promise<Track[]>;
|
|
411
|
-
modifyAt(start: number, deleteCount?: number, ...items: Track[]): Promise<Track[]>;
|
|
412
|
-
mapAsync<T>(callback: (track: Track, index: number, array: Track[]) => T): Promise<T[]>;
|
|
413
|
-
filterAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<Track[]>;
|
|
414
|
-
findAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<Track | undefined>;
|
|
415
|
-
someAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<boolean>;
|
|
416
|
-
everyAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<boolean>;
|
|
821
|
+
abstract unload(manager: Manager): void;
|
|
417
822
|
}
|
|
418
823
|
|
|
419
824
|
/**
|
|
@@ -422,41 +827,61 @@ declare class Queue extends Array<Track> implements IQueue {
|
|
|
422
827
|
interface ManagerOptions {
|
|
423
828
|
/** The state storage options.
|
|
424
829
|
*
|
|
425
|
-
* @default { type: StateStorageType.Collection }
|
|
830
|
+
* @default { type: StateStorageType.Collection, deleteInactivePlayers: true }
|
|
426
831
|
*/
|
|
427
832
|
stateStorage?: StateStorageOptions;
|
|
428
|
-
/** Enable priority mode over least player count or load balancing?
|
|
833
|
+
/** Enable priority mode over least player count or load balancing?
|
|
834
|
+
* @default false
|
|
835
|
+
*/
|
|
429
836
|
enablePriorityMode?: boolean;
|
|
430
|
-
/** Automatically play the next track when the current one ends.
|
|
837
|
+
/** Automatically play the next track when the current one ends.
|
|
838
|
+
* @default true
|
|
839
|
+
*/
|
|
431
840
|
playNextOnEnd?: boolean;
|
|
432
841
|
/** An array of search platforms to use for autoplay. First to last matters
|
|
433
842
|
* Use enum `AutoPlayPlatform`.
|
|
843
|
+
* @default [AutoPlayPlatform.YouTube]
|
|
434
844
|
*/
|
|
435
845
|
autoPlaySearchPlatforms?: AutoPlayPlatform[];
|
|
436
846
|
/** The client ID to use. */
|
|
437
847
|
clientId?: string;
|
|
438
|
-
/** 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
|
+
*/
|
|
439
853
|
clientName?: string;
|
|
440
|
-
/** The array of shard IDs connected to this manager instance.
|
|
854
|
+
/** The array of shard IDs connected to this manager instance.
|
|
855
|
+
* @default 0
|
|
856
|
+
*/
|
|
441
857
|
clusterId?: number;
|
|
442
858
|
/** List of plugins to load. */
|
|
443
859
|
enabledPlugins?: Plugin[];
|
|
444
860
|
/** The default search platform to use.
|
|
445
|
-
* Use enum `SearchPlatform`.
|
|
861
|
+
* Use enum `SearchPlatform`.
|
|
862
|
+
* @default SearchPlatform.YouTube
|
|
863
|
+
*/
|
|
446
864
|
defaultSearchPlatform?: SearchPlatform;
|
|
447
865
|
/** The last.fm API key.
|
|
448
866
|
* If you need to create one go here: https://www.last.fm/api/account/create.
|
|
449
867
|
* If you already have one, get it from here: https://www.last.fm/api/accounts. */
|
|
450
868
|
lastFmApiKey?: string;
|
|
451
|
-
/** The maximum number of previous tracks to store.
|
|
869
|
+
/** The maximum number of previous tracks to store.
|
|
870
|
+
* @default 20
|
|
871
|
+
*/
|
|
452
872
|
maxPreviousTracks?: number;
|
|
453
873
|
/** The array of nodes to connect to. */
|
|
454
874
|
nodes?: NodeOptions[];
|
|
455
|
-
/** Whether the YouTube video titles should be replaced if the Author does not exactly match.
|
|
875
|
+
/** Whether the YouTube video titles should be replaced if the Author does not exactly match.
|
|
876
|
+
* @default false
|
|
877
|
+
*/
|
|
456
878
|
normalizeYouTubeTitles?: boolean;
|
|
457
879
|
/** An array of track properties to keep. `track` will always be present. */
|
|
458
880
|
trackPartial?: TrackPartial[];
|
|
459
|
-
/** Use the least amount of players or least load?
|
|
881
|
+
/** Use the least amount of players or least load?
|
|
882
|
+
* Use enum `UseNodeOptions`.
|
|
883
|
+
* @default UseNodeOptions.LeastPlayers
|
|
884
|
+
*/
|
|
460
885
|
useNode?: UseNodeOptions.LeastLoad | UseNodeOptions.LeastPlayers;
|
|
461
886
|
/**
|
|
462
887
|
* Function to send data to the websocket.
|
|
@@ -471,6 +896,8 @@ interface ManagerOptions {
|
|
|
471
896
|
interface StateStorageOptions {
|
|
472
897
|
type: StateStorageType;
|
|
473
898
|
redisConfig?: RedisConfig;
|
|
899
|
+
jsonConfig?: JsonConfig;
|
|
900
|
+
deleteInactivePlayers?: boolean;
|
|
474
901
|
}
|
|
475
902
|
/**
|
|
476
903
|
* Payload
|
|
@@ -485,6 +912,57 @@ interface Payload {
|
|
|
485
912
|
self_deaf: boolean;
|
|
486
913
|
};
|
|
487
914
|
}
|
|
915
|
+
/**
|
|
916
|
+
* Node Options
|
|
917
|
+
*/
|
|
918
|
+
interface NodeOptions {
|
|
919
|
+
/** The host for the node. */
|
|
920
|
+
host: string;
|
|
921
|
+
/** The port for the node.
|
|
922
|
+
* @default 2333
|
|
923
|
+
*/
|
|
924
|
+
port?: number;
|
|
925
|
+
/** The password for the node.
|
|
926
|
+
* @default "youshallnotpass"
|
|
927
|
+
*/
|
|
928
|
+
password?: string;
|
|
929
|
+
/** Whether the host uses SSL.
|
|
930
|
+
* @default false
|
|
931
|
+
*/
|
|
932
|
+
useSSL?: boolean;
|
|
933
|
+
/** The identifier for the node.
|
|
934
|
+
* @default host
|
|
935
|
+
*/
|
|
936
|
+
identifier?: string;
|
|
937
|
+
/** The maxRetryAttempts for the node.
|
|
938
|
+
* @default 30
|
|
939
|
+
*/
|
|
940
|
+
maxRetryAttempts?: number;
|
|
941
|
+
/** The retryDelayMs for the node.
|
|
942
|
+
* @default 60000
|
|
943
|
+
*/
|
|
944
|
+
retryDelayMs?: number;
|
|
945
|
+
/** Whether to resume the previous session.
|
|
946
|
+
* @default false
|
|
947
|
+
*/
|
|
948
|
+
enableSessionResumeOption?: boolean;
|
|
949
|
+
/** The time the lavalink server will wait before it removes the player.
|
|
950
|
+
* @default 1000
|
|
951
|
+
*/
|
|
952
|
+
sessionTimeoutMs?: number;
|
|
953
|
+
/** The timeout used for api calls.
|
|
954
|
+
* @default 10000
|
|
955
|
+
*/
|
|
956
|
+
apiRequestTimeoutMs?: number;
|
|
957
|
+
/** Priority of the node.
|
|
958
|
+
* @default 0
|
|
959
|
+
*/
|
|
960
|
+
nodePriority?: number;
|
|
961
|
+
/** Whether the node is a NodeLink.
|
|
962
|
+
* @default false
|
|
963
|
+
*/
|
|
964
|
+
isNodeLink?: boolean;
|
|
965
|
+
}
|
|
488
966
|
/**
|
|
489
967
|
* Discord Packet
|
|
490
968
|
*/
|
|
@@ -546,6 +1024,12 @@ interface RedisConfig {
|
|
|
546
1024
|
db?: number;
|
|
547
1025
|
prefix?: string;
|
|
548
1026
|
}
|
|
1027
|
+
/**
|
|
1028
|
+
* JSON Configuration
|
|
1029
|
+
*/
|
|
1030
|
+
interface JsonConfig {
|
|
1031
|
+
path: string;
|
|
1032
|
+
}
|
|
549
1033
|
/**
|
|
550
1034
|
* Player State Update Event
|
|
551
1035
|
*/
|
|
@@ -812,6 +1296,35 @@ interface PlaylistSearchResult {
|
|
|
812
1296
|
/** The playlist info */
|
|
813
1297
|
playlist: PlaylistData;
|
|
814
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
|
+
}
|
|
815
1328
|
/**
|
|
816
1329
|
* Playlist Data
|
|
817
1330
|
*/
|
|
@@ -900,7 +1413,7 @@ interface VoiceServer {
|
|
|
900
1413
|
}
|
|
901
1414
|
interface Extendable {
|
|
902
1415
|
Player: typeof Player;
|
|
903
|
-
Queue: typeof
|
|
1416
|
+
Queue: typeof MemoryQueue | typeof RedisQueue | typeof JsonQueue;
|
|
904
1417
|
Node: typeof Node;
|
|
905
1418
|
}
|
|
906
1419
|
/**
|
|
@@ -1052,62 +1565,6 @@ interface PlayerUpdate {
|
|
|
1052
1565
|
ping: number;
|
|
1053
1566
|
};
|
|
1054
1567
|
}
|
|
1055
|
-
/**
|
|
1056
|
-
* Node Options
|
|
1057
|
-
*/
|
|
1058
|
-
interface NodeOptions {
|
|
1059
|
-
/** The host for the node. */
|
|
1060
|
-
host: string;
|
|
1061
|
-
/** The port for the node. */
|
|
1062
|
-
port?: number;
|
|
1063
|
-
/** The password for the node. */
|
|
1064
|
-
password?: string;
|
|
1065
|
-
/** Whether the host uses SSL. */
|
|
1066
|
-
useSSL?: boolean;
|
|
1067
|
-
/** The identifier for the node. */
|
|
1068
|
-
identifier?: string;
|
|
1069
|
-
/** The maxRetryAttempts for the node. */
|
|
1070
|
-
maxRetryAttempts?: number;
|
|
1071
|
-
/** The retryDelayMs for the node. */
|
|
1072
|
-
retryDelayMs?: number;
|
|
1073
|
-
/** Whether to resume the previous session. */
|
|
1074
|
-
enableSessionResumeOption?: boolean;
|
|
1075
|
-
/** The time the lavalink server will wait before it removes the player. */
|
|
1076
|
-
sessionTimeoutMs?: number;
|
|
1077
|
-
/** The timeout used for api calls. */
|
|
1078
|
-
apiRequestTimeoutMs?: number;
|
|
1079
|
-
/** Priority of the node. */
|
|
1080
|
-
nodePriority?: number;
|
|
1081
|
-
/** Whether the node is a NodeLink. */
|
|
1082
|
-
isNodeLink?: boolean;
|
|
1083
|
-
}
|
|
1084
|
-
/**
|
|
1085
|
-
* NodeOptions interface
|
|
1086
|
-
*/
|
|
1087
|
-
interface NodeOptions {
|
|
1088
|
-
/** The host for the node. */
|
|
1089
|
-
host: string;
|
|
1090
|
-
/** The port for the node. */
|
|
1091
|
-
port?: number;
|
|
1092
|
-
/** The password for the node. */
|
|
1093
|
-
password?: string;
|
|
1094
|
-
/** Whether the host uses SSL. */
|
|
1095
|
-
useSSL?: boolean;
|
|
1096
|
-
/** The identifier for the node. */
|
|
1097
|
-
identifier?: string;
|
|
1098
|
-
/** The maxRetryAttempts for the node. */
|
|
1099
|
-
maxRetryAttempts?: number;
|
|
1100
|
-
/** The retryDelayMs for the node. */
|
|
1101
|
-
retryDelayMs?: number;
|
|
1102
|
-
/** Whether to resume the previous session. */
|
|
1103
|
-
enableSessionResumeOption?: boolean;
|
|
1104
|
-
/** The time the lavalink server will wait before it removes the player. */
|
|
1105
|
-
sessionTimeoutMs?: number;
|
|
1106
|
-
/** The timeout used for api calls. */
|
|
1107
|
-
apiRequestTimeoutMs?: number;
|
|
1108
|
-
/** Priority of the node. */
|
|
1109
|
-
nodePriority?: number;
|
|
1110
|
-
}
|
|
1111
1568
|
/**
|
|
1112
1569
|
* NodeStats interface
|
|
1113
1570
|
*/
|
|
@@ -1464,7 +1921,7 @@ type VoiceReceiverEvent = StartSpeakingEventVoiceReceiver | EndSpeakingEventVoic
|
|
|
1464
1921
|
/**
|
|
1465
1922
|
* Search Result Enum type
|
|
1466
1923
|
*/
|
|
1467
|
-
type SearchResult = TrackSearchResult | SearchSearchResult | PlaylistSearchResult | ErrorOrEmptySearchResult;
|
|
1924
|
+
type SearchResult = TrackSearchResult | SearchSearchResult | PlaylistSearchResult | ErrorOrEmptySearchResult | AlbumSearchResult | ArtistSearchResult | StationSearchResult | PodcastSearchResult | ShowSearchResult | ShortSearchResult;
|
|
1468
1925
|
/**
|
|
1469
1926
|
* Lyrics Event Enum type
|
|
1470
1927
|
*/
|
|
@@ -1474,7 +1931,7 @@ type LyricsEvent = LyricsFoundEvent | LyricsNotFoundEvent | LyricsLineEvent;
|
|
|
1474
1931
|
*/
|
|
1475
1932
|
type LyricsEventType = "LyricsFoundEvent" | "LyricsNotFoundEvent" | "LyricsLineEvent";
|
|
1476
1933
|
|
|
1477
|
-
declare class Node
|
|
1934
|
+
declare class Node {
|
|
1478
1935
|
manager: Manager;
|
|
1479
1936
|
options: NodeOptions;
|
|
1480
1937
|
/** The socket for the node. */
|
|
@@ -1707,9 +2164,10 @@ declare class Node$1 {
|
|
|
1707
2164
|
*
|
|
1708
2165
|
* @param {Track} track - The track to fetch the lyrics for.
|
|
1709
2166
|
* @param {boolean} [skipTrackSource=false] - Whether to skip using the track's source URL.
|
|
2167
|
+
* @param {string} [language="en"] - The language of the lyrics.
|
|
1710
2168
|
* @returns {Promise<Lyrics | NodeLinkGetLyrics>} A promise that resolves with the lyrics data.
|
|
1711
2169
|
*/
|
|
1712
|
-
getLyrics(track: Track, skipTrackSource?: boolean): Promise<Lyrics | NodeLinkGetLyrics>;
|
|
2170
|
+
getLyrics(track: Track, skipTrackSource?: boolean, language?: string): Promise<Lyrics | NodeLinkGetLyrics>;
|
|
1713
2171
|
/**
|
|
1714
2172
|
* Subscribes to lyrics for a player.
|
|
1715
2173
|
* @param {string} guildId - The ID of the guild to subscribe to lyrics for.
|
|
@@ -1860,12 +2318,13 @@ declare class Manager extends EventEmitter {
|
|
|
1860
2318
|
/** The map of players. */
|
|
1861
2319
|
readonly players: Collection<string, Player>;
|
|
1862
2320
|
/** The map of nodes. */
|
|
1863
|
-
readonly nodes: Collection<string, Node
|
|
2321
|
+
readonly nodes: Collection<string, Node>;
|
|
1864
2322
|
/** The options that were set. */
|
|
1865
2323
|
readonly options: ManagerOptions;
|
|
1866
2324
|
initiated: boolean;
|
|
1867
2325
|
redis?: Redis;
|
|
1868
2326
|
private _send?;
|
|
2327
|
+
private loadedPlugins;
|
|
1869
2328
|
/**
|
|
1870
2329
|
* Initiates the Manager class.
|
|
1871
2330
|
* @param options
|
|
@@ -1926,7 +2385,7 @@ declare class Manager extends EventEmitter {
|
|
|
1926
2385
|
* @param options - The options to create the node with.
|
|
1927
2386
|
* @returns The created node.
|
|
1928
2387
|
*/
|
|
1929
|
-
createNode(options: NodeOptions): Node
|
|
2388
|
+
createNode(options: NodeOptions): Node;
|
|
1930
2389
|
/**
|
|
1931
2390
|
* Destroys a node if it exists. Emits a debug event if the node is found and destroyed.
|
|
1932
2391
|
* @param identifier - The identifier of the node to destroy.
|
|
@@ -1987,7 +2446,7 @@ declare class Manager extends EventEmitter {
|
|
|
1987
2446
|
* If `enablePriorityMode` is false and `useNode` is not set, the node with the lowest load is chosen.
|
|
1988
2447
|
* @returns {Node} The node to use.
|
|
1989
2448
|
*/
|
|
1990
|
-
get useableNode(): Node
|
|
2449
|
+
get useableNode(): Node;
|
|
1991
2450
|
/**
|
|
1992
2451
|
* Handles the shutdown of the process by saving all active players' states and optionally cleaning up inactive players.
|
|
1993
2452
|
* This function is called when the process is about to exit.
|
|
@@ -2058,15 +2517,29 @@ declare class Manager extends EventEmitter {
|
|
|
2058
2517
|
*/
|
|
2059
2518
|
serializePlayer(player: Player): Promise<Record<string, unknown>>;
|
|
2060
2519
|
/**
|
|
2061
|
-
*
|
|
2520
|
+
* Cleans up inactive players by removing their state files from the file system.
|
|
2521
|
+
* This is done to prevent stale state files from accumulating on the file system.
|
|
2522
|
+
*/
|
|
2523
|
+
cleanupInactivePlayers(): Promise<void>;
|
|
2524
|
+
/**
|
|
2525
|
+
* Cleans up an inactive player by removing its state files from the file system.
|
|
2062
2526
|
* This is done to prevent stale state files from accumulating on the file system.
|
|
2527
|
+
* @param guildId The guild ID of the player to clean up.
|
|
2528
|
+
*/
|
|
2529
|
+
cleanupInactivePlayer(guildId: string): Promise<void>;
|
|
2530
|
+
/**
|
|
2531
|
+
* Loads the enabled plugins.
|
|
2532
|
+
*/
|
|
2533
|
+
private loadPlugins;
|
|
2534
|
+
/**
|
|
2535
|
+
* Unloads the enabled plugins.
|
|
2063
2536
|
*/
|
|
2064
|
-
private
|
|
2537
|
+
private unloadPlugins;
|
|
2065
2538
|
/**
|
|
2066
2539
|
* Clears all player states from the file system.
|
|
2067
2540
|
* This is done to prevent stale state files from accumulating on the file system.
|
|
2068
2541
|
*/
|
|
2069
|
-
private
|
|
2542
|
+
private clearAllStoredPlayers;
|
|
2070
2543
|
/**
|
|
2071
2544
|
* Returns the nodes that has the least load.
|
|
2072
2545
|
* The load is calculated by dividing the lavalink load by the number of cores.
|
|
@@ -2116,7 +2589,7 @@ declare class Player {
|
|
|
2116
2589
|
/** The volume for the player */
|
|
2117
2590
|
volume: number;
|
|
2118
2591
|
/** The Node for the Player. */
|
|
2119
|
-
node: Node
|
|
2592
|
+
node: Node;
|
|
2120
2593
|
/** The guild ID for the player. */
|
|
2121
2594
|
guildId: string;
|
|
2122
2595
|
/** The voice channel for the player. */
|
|
@@ -2842,15 +3315,6 @@ declare enum AvailableFilters {
|
|
|
2842
3315
|
Demon = "demon"
|
|
2843
3316
|
}
|
|
2844
3317
|
|
|
2845
|
-
declare class Plugin$1 {
|
|
2846
|
-
name: string;
|
|
2847
|
-
/**
|
|
2848
|
-
* @param name The name of the plugin
|
|
2849
|
-
*/
|
|
2850
|
-
constructor(name: string);
|
|
2851
|
-
load(manager: Manager): void;
|
|
2852
|
-
}
|
|
2853
|
-
|
|
2854
3318
|
declare abstract class TrackUtils {
|
|
2855
3319
|
static trackPartial: TrackPartial[] | null;
|
|
2856
3320
|
private static manager;
|
|
@@ -2915,6 +3379,23 @@ declare abstract class AutoPlayUtils {
|
|
|
2915
3379
|
* @returns An array of recommended tracks.
|
|
2916
3380
|
*/
|
|
2917
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;
|
|
2918
3399
|
static buildTracksFromResponse<T>(recommendedResult: LavalinkResponse, requester?: T): Track[];
|
|
2919
3400
|
}
|
|
2920
3401
|
/** Gets or extends structures to extend the built in, or already extended, classes to add more functionality. */
|
|
@@ -2968,5 +3449,36 @@ declare class OceanicManager extends Manager {
|
|
|
2968
3449
|
protected send(packet: GatewayVoiceStateUpdate): void;
|
|
2969
3450
|
}
|
|
2970
3451
|
|
|
2971
|
-
|
|
2972
|
-
|
|
3452
|
+
/**
|
|
3453
|
+
* Seyfert wrapper for Magmastream.
|
|
3454
|
+
*
|
|
3455
|
+
* @note This wrapper does require the manual implementation of the "raw" and "ready" events, to call the `updateVoiceState` and `init` methods respectively.
|
|
3456
|
+
*
|
|
3457
|
+
* @example
|
|
3458
|
+
* ```typescript
|
|
3459
|
+
* const client = new Client();
|
|
3460
|
+
* const manager = new SeyfertManager(client, options);
|
|
3461
|
+
*
|
|
3462
|
+
* client.events.values.RAW = {
|
|
3463
|
+
* data: { name: "raw" },
|
|
3464
|
+
* run: async (data) => {
|
|
3465
|
+
* await manager.updateVoiceState(data);
|
|
3466
|
+
* }
|
|
3467
|
+
* }
|
|
3468
|
+
*
|
|
3469
|
+
* client.events.values.READY = {
|
|
3470
|
+
* data: { name: "ready" },
|
|
3471
|
+
* run: async (user, client) => {
|
|
3472
|
+
* await manager.init({ clientId: client.botId });
|
|
3473
|
+
* }
|
|
3474
|
+
* }
|
|
3475
|
+
* ```
|
|
3476
|
+
*/
|
|
3477
|
+
declare class SeyfertManager extends Manager {
|
|
3478
|
+
readonly client: Client$3;
|
|
3479
|
+
constructor(client: Client$3, options?: ManagerOptions);
|
|
3480
|
+
protected send(packet: GatewayVoiceStateUpdate): void;
|
|
3481
|
+
}
|
|
3482
|
+
|
|
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 };
|