magmastream 2.9.3-dev.2 → 2.9.3-dev.21
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 +196 -105
- package/dist/index.js +1 -1
- package/dist/statestorage/JsonQueue.js +28 -4
- package/dist/statestorage/MemoryQueue.js +51 -36
- package/dist/statestorage/RedisQueue.js +30 -9
- package/dist/structures/Enums.js +6 -0
- package/dist/structures/Filters.js +5 -4
- package/dist/structures/Manager.js +88 -71
- package/dist/structures/Node.js +91 -145
- package/dist/structures/Player.js +31 -124
- package/dist/structures/Rest.js +41 -21
- package/dist/structures/Utils.js +137 -76
- package/dist/wrappers/discord.js.js +19 -4
- package/dist/wrappers/discordeno.js +73 -0
- package/dist/wrappers/eris.js +20 -3
- package/dist/wrappers/oceanic.js +22 -4
- package/dist/wrappers/seyfert.js +25 -1
- package/package.json +30 -23
- package/dist/wrappers/detritus.js +0 -52
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { Collection } from '@discordjs/collection';
|
|
2
2
|
import { GatewayVoiceStateUpdate } from 'discord-api-types/v10';
|
|
3
3
|
import { EventEmitter } from 'events';
|
|
4
|
-
import { User, ClientUser, Message, Client } from 'discord.js';
|
|
5
|
-
import { User as User$1, Message as Message$1, Client as Client$2 } from 'oceanic.js';
|
|
6
|
-
import { User as User$2, Message as Message$2 } from '
|
|
7
|
-
import { User as User$3, Message as Message$3, Client as Client$1 } from 'eris';
|
|
8
|
-
import { User as User$4, ClientUser as ClientUser$1, Message as Message$4, Client as Client$3, WorkerClient } from 'seyfert';
|
|
4
|
+
import { User, ClientUser, Guild, Message, Client } from 'discord.js';
|
|
5
|
+
import { User as User$1, Guild as Guild$1, Message as Message$1, Client as Client$2 } from 'oceanic.js';
|
|
6
|
+
import { User as User$2, Guild as Guild$2, Message as Message$2, Bot } from '@discordeno/bot';
|
|
7
|
+
import { User as User$3, Guild as Guild$3, Message as Message$3, Client as Client$1 } from 'eris';
|
|
8
|
+
import { User as User$4, ClientUser as ClientUser$1, Guild as Guild$4, Message as Message$4, Client as Client$3, WorkerClient } from 'seyfert';
|
|
9
9
|
import WebSocket$1, { WebSocket } from 'ws';
|
|
10
10
|
import { Redis } from 'ioredis';
|
|
11
|
-
import { ClusterClient, ShardClient } from 'detritus-client';
|
|
12
11
|
|
|
13
12
|
/** Represents an equalizer band. */
|
|
14
13
|
interface Band {
|
|
@@ -170,7 +169,9 @@ declare enum TrackPartial {
|
|
|
170
169
|
/** The plugin info of the track */
|
|
171
170
|
PluginInfo = "pluginInfo",
|
|
172
171
|
/** The custom data of the track */
|
|
173
|
-
CustomData = "customData"
|
|
172
|
+
CustomData = "customData",
|
|
173
|
+
/** Whether the track got autoplayed */
|
|
174
|
+
IsAutoPlay = "isAutoplay"
|
|
174
175
|
}
|
|
175
176
|
/**
|
|
176
177
|
* Manager Event Types Enum
|
|
@@ -284,6 +285,7 @@ declare enum MagmaStreamErrorCode {
|
|
|
284
285
|
GENERAL_UNKNOWN = "MS_GENERAL_UNKNOWN",
|
|
285
286
|
GENERAL_TIMEOUT = "MS_GENERAL_TIMEOUT",
|
|
286
287
|
GENERAL_INVALID_MANAGER = "MS_GENERAL_INVALID_MANAGER",
|
|
288
|
+
INTENT_MISSING = "MS_INTENT_MISSING",
|
|
287
289
|
MANAGER_INIT_FAILED = "MS_MANAGER_INIT_FAILED",
|
|
288
290
|
MANAGER_INVALID_CONFIG = "MS_MANAGER_INVALID_CONFIG",
|
|
289
291
|
MANAGER_SHUTDOWN_FAILED = "MS_MANAGER_SHUTDOWN_FAILED",
|
|
@@ -320,6 +322,7 @@ declare enum MagmaStreamErrorCode {
|
|
|
320
322
|
UTILS_TRACK_PARTIAL_INVALID = "MS_UTILS_TRACK_PARTIAL_INVALID",
|
|
321
323
|
UTILS_TRACK_BUILD_FAILED = "MS_UTILS_TRACK_BUILD_FAILED",
|
|
322
324
|
UTILS_AUTOPLAY_BUILD_FAILED = "MS_UTILS_AUTOPLAY_BUILD_FAILED",
|
|
325
|
+
UTILS_PLAYER_SERIALIZE_FAILED = "MS_UTILS_PLAYER_SERIALIZE_FAILED",
|
|
323
326
|
PLUGIN_LOAD_FAILED = "MS_PLUGIN_LOAD_FAILED",
|
|
324
327
|
PLUGIN_RUNTIME_ERROR = "MS_PLUGIN_RUNTIME_ERROR"
|
|
325
328
|
}
|
|
@@ -335,6 +338,10 @@ declare class JsonQueue implements IQueue {
|
|
|
335
338
|
* The base path for the queue files.
|
|
336
339
|
*/
|
|
337
340
|
private basePath;
|
|
341
|
+
/**
|
|
342
|
+
* Whether the queue has been destroyed.
|
|
343
|
+
*/
|
|
344
|
+
private destroyed;
|
|
338
345
|
/**
|
|
339
346
|
* @param guildId The guild ID.
|
|
340
347
|
* @param manager The manager.
|
|
@@ -361,6 +368,11 @@ declare class JsonQueue implements IQueue {
|
|
|
361
368
|
* Removes the first track from the queue.
|
|
362
369
|
*/
|
|
363
370
|
dequeue(): Promise<Track | undefined>;
|
|
371
|
+
/**
|
|
372
|
+
* Destroys the queue and releases all resources.
|
|
373
|
+
* After calling this method, the queue must not be used again.
|
|
374
|
+
*/
|
|
375
|
+
destroy(): Promise<void>;
|
|
364
376
|
/**
|
|
365
377
|
* @returns The total duration of the queue.
|
|
366
378
|
*/
|
|
@@ -500,6 +512,10 @@ declare class MemoryQueue extends Array<Track> implements IQueue {
|
|
|
500
512
|
manager: Manager;
|
|
501
513
|
/** The guild ID property. */
|
|
502
514
|
guildId: string;
|
|
515
|
+
/**
|
|
516
|
+
* Whether the queue has been destroyed.
|
|
517
|
+
*/
|
|
518
|
+
private destroyed;
|
|
503
519
|
/**
|
|
504
520
|
* Constructs a new Queue.
|
|
505
521
|
* @param guildId The guild ID.
|
|
@@ -511,67 +527,72 @@ declare class MemoryQueue extends Array<Track> implements IQueue {
|
|
|
511
527
|
* @param track The track or tracks to add. Can be a single `Track` or an array of `Track`s.
|
|
512
528
|
* @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.
|
|
513
529
|
*/
|
|
514
|
-
add(track: Track | Track[], offset?: number):
|
|
530
|
+
add(track: Track | Track[], offset?: number): void;
|
|
515
531
|
/**
|
|
516
532
|
* Adds a track to the previous tracks.
|
|
517
533
|
* @param track The track or tracks to add. Can be a single `Track` or an array of `Track`s.
|
|
518
534
|
*/
|
|
519
|
-
addPrevious(track: Track | Track[]):
|
|
535
|
+
addPrevious(track: Track | Track[]): void;
|
|
520
536
|
/**
|
|
521
537
|
* Clears the queue.
|
|
522
538
|
* This will remove all tracks from the queue and emit a state update event.
|
|
523
539
|
*/
|
|
524
|
-
clear():
|
|
540
|
+
clear(): void;
|
|
525
541
|
/**
|
|
526
542
|
* Clears the previous tracks.
|
|
527
543
|
*/
|
|
528
|
-
clearPrevious():
|
|
544
|
+
clearPrevious(): void;
|
|
529
545
|
/**
|
|
530
546
|
* Removes the first element from the queue.
|
|
531
547
|
*/
|
|
532
|
-
dequeue():
|
|
548
|
+
dequeue(): Track | undefined;
|
|
549
|
+
/**
|
|
550
|
+
* Destroys the queue and releases all resources.
|
|
551
|
+
* After calling this method, the queue must not be used again.
|
|
552
|
+
*/
|
|
553
|
+
destroy(): void;
|
|
533
554
|
/**
|
|
534
555
|
* The total duration of the queue in milliseconds.
|
|
535
556
|
* This includes the duration of the currently playing track.
|
|
536
557
|
*/
|
|
537
|
-
duration():
|
|
558
|
+
duration(): number;
|
|
538
559
|
/**
|
|
539
560
|
* Adds the specified track or tracks to the front of the queue.
|
|
540
561
|
* @param track The track or tracks to add.
|
|
541
562
|
*/
|
|
542
|
-
enqueueFront(track: Track | Track[]):
|
|
563
|
+
enqueueFront(track: Track | Track[]): void;
|
|
543
564
|
/**
|
|
544
565
|
* @returns Whether all elements in the queue satisfy the provided testing function.
|
|
545
566
|
*/
|
|
546
|
-
everyAsync(callback: (track: Track, index: number, array: Track[]) => boolean):
|
|
567
|
+
everyAsync(callback: (track: Track, index: number, array: Track[]) => boolean): boolean;
|
|
547
568
|
/**
|
|
548
569
|
* @returns A new array with all elements that pass the test implemented by the provided function.
|
|
549
570
|
*/
|
|
550
|
-
filterAsync(callback: (track: Track, index: number, array: Track[]) => boolean):
|
|
571
|
+
filterAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Track[];
|
|
551
572
|
/**
|
|
552
573
|
* @returns The first element in the queue that satisfies the provided testing function.
|
|
553
574
|
*/
|
|
554
|
-
findAsync(callback: (track: Track, index: number, array: Track[]) => boolean):
|
|
575
|
+
findAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Track | undefined;
|
|
555
576
|
/**
|
|
556
577
|
* @returns The current track.
|
|
557
578
|
*/
|
|
558
|
-
getCurrent():
|
|
579
|
+
getCurrent(): Track | null;
|
|
559
580
|
/**
|
|
560
581
|
* @returns The previous tracks.
|
|
561
582
|
*/
|
|
562
|
-
getPrevious():
|
|
583
|
+
getPrevious(): Track[];
|
|
563
584
|
/**
|
|
564
585
|
* @returns The tracks in the queue from start to end.
|
|
565
586
|
*/
|
|
566
|
-
getSlice(start?: number, end?: number):
|
|
587
|
+
getSlice(start?: number, end?: number): Track[];
|
|
567
588
|
/**
|
|
568
589
|
* @returns The tracks in the queue.
|
|
569
590
|
*/
|
|
570
|
-
getTracks():
|
|
591
|
+
getTracks(): Track[];
|
|
571
592
|
/**
|
|
572
593
|
* @returns A new array with the results of calling a provided function on every element in the queue.
|
|
573
594
|
*/
|
|
574
|
-
mapAsync<T>(callback: (track: Track, index: number, array: Track[]) => T):
|
|
595
|
+
mapAsync<T>(callback: (track: Track, index: number, array: Track[]) => T): T[];
|
|
575
596
|
/**
|
|
576
597
|
* Modifies the queue at the specified index.
|
|
577
598
|
* @param start The index at which to start modifying the queue.
|
|
@@ -579,11 +600,11 @@ declare class MemoryQueue extends Array<Track> implements IQueue {
|
|
|
579
600
|
* @param items The elements to add to the queue.
|
|
580
601
|
* @returns The modified queue.
|
|
581
602
|
*/
|
|
582
|
-
modifyAt(start: number, deleteCount?: number, ...items: Track[]):
|
|
603
|
+
modifyAt(start: number, deleteCount?: number, ...items: Track[]): Track[];
|
|
583
604
|
/**
|
|
584
605
|
* @returns The newest track.
|
|
585
606
|
*/
|
|
586
|
-
popPrevious():
|
|
607
|
+
popPrevious(): Track | null;
|
|
587
608
|
/**
|
|
588
609
|
* Removes track(s) from the queue.
|
|
589
610
|
* @param startOrPosition If a single number is provided, it will be treated as the position of the track to remove.
|
|
@@ -591,45 +612,45 @@ declare class MemoryQueue extends Array<Track> implements IQueue {
|
|
|
591
612
|
* @param end Optional, end of the range of tracks to remove.
|
|
592
613
|
* @returns The removed track(s).
|
|
593
614
|
*/
|
|
594
|
-
remove(position?: number):
|
|
595
|
-
remove(start: number, end: number):
|
|
615
|
+
remove(position?: number): Track[];
|
|
616
|
+
remove(start: number, end: number): Track[];
|
|
596
617
|
/**
|
|
597
618
|
* Shuffles the queue to play tracks requested by each user one by one.
|
|
598
619
|
*/
|
|
599
|
-
roundRobinShuffle():
|
|
620
|
+
roundRobinShuffle(): void;
|
|
600
621
|
/**
|
|
601
622
|
* @param track The track to set.
|
|
602
623
|
*/
|
|
603
|
-
setCurrent(track: Track | null):
|
|
624
|
+
setCurrent(track: Track | null): void;
|
|
604
625
|
/**
|
|
605
626
|
* @param tracks The tracks to set.
|
|
606
627
|
*/
|
|
607
|
-
setPrevious(tracks: Track[]):
|
|
628
|
+
setPrevious(tracks: Track[]): void;
|
|
608
629
|
/**
|
|
609
630
|
* Shuffles the queue.
|
|
610
631
|
* This will randomize the order of the tracks in the queue and emit a state update event.
|
|
611
632
|
*/
|
|
612
|
-
shuffle():
|
|
633
|
+
shuffle(): void;
|
|
613
634
|
/**
|
|
614
635
|
* The size of tracks in the queue.
|
|
615
636
|
* This does not include the currently playing track.
|
|
616
637
|
* @returns The size of tracks in the queue.
|
|
617
638
|
*/
|
|
618
|
-
size():
|
|
639
|
+
size(): number;
|
|
619
640
|
/**
|
|
620
641
|
* @returns Whether at least one element in the queue satisfies the provided testing function.
|
|
621
642
|
*/
|
|
622
|
-
someAsync(callback: (track: Track, index: number, array: Track[]) => boolean):
|
|
643
|
+
someAsync(callback: (track: Track, index: number, array: Track[]) => boolean): boolean;
|
|
623
644
|
/**
|
|
624
645
|
* The total size of tracks in the queue including the current track.
|
|
625
646
|
* This includes the current track if it is not null.
|
|
626
647
|
* @returns The total size of tracks in the queue including the current track.
|
|
627
648
|
*/
|
|
628
|
-
totalSize():
|
|
649
|
+
totalSize(): number;
|
|
629
650
|
/**
|
|
630
651
|
* Shuffles the queue to play tracks requested by each user one block at a time.
|
|
631
652
|
*/
|
|
632
|
-
userBlockShuffle():
|
|
653
|
+
userBlockShuffle(): void;
|
|
633
654
|
}
|
|
634
655
|
|
|
635
656
|
/**
|
|
@@ -646,6 +667,10 @@ declare class RedisQueue implements IQueue {
|
|
|
646
667
|
* The Redis instance.
|
|
647
668
|
*/
|
|
648
669
|
private redis;
|
|
670
|
+
/**
|
|
671
|
+
* Whether the queue has been destroyed.
|
|
672
|
+
*/
|
|
673
|
+
private destroyed;
|
|
649
674
|
/**
|
|
650
675
|
* Constructs a new RedisQueue.
|
|
651
676
|
* @param guildId The guild ID.
|
|
@@ -675,6 +700,11 @@ declare class RedisQueue implements IQueue {
|
|
|
675
700
|
* Removes the first track from the queue.
|
|
676
701
|
*/
|
|
677
702
|
dequeue(): Promise<Track | undefined>;
|
|
703
|
+
/**
|
|
704
|
+
* Destroys the queue and releases all resources.
|
|
705
|
+
* After calling this method, the queue must not be used again.
|
|
706
|
+
*/
|
|
707
|
+
destroy(): Promise<void>;
|
|
678
708
|
/**
|
|
679
709
|
* @returns The total duration of the queue in milliseconds.
|
|
680
710
|
* This includes the duration of the currently playing track.
|
|
@@ -891,6 +921,22 @@ interface ManagerOptions {
|
|
|
891
921
|
* @param payload The payload to send.
|
|
892
922
|
*/
|
|
893
923
|
send?: (packet: DiscordPacket) => unknown;
|
|
924
|
+
/**
|
|
925
|
+
* Optional user cache getter.
|
|
926
|
+
* When resolving a user from a partial ID, this function will be called first.
|
|
927
|
+
* Should return the full user object if cached, or undefined if not.
|
|
928
|
+
* @param id The ID of the user to get.
|
|
929
|
+
* @returns The user object if cached, or undefined if not.
|
|
930
|
+
*/
|
|
931
|
+
getUser?: (id: string) => AnyUser | undefined;
|
|
932
|
+
/**
|
|
933
|
+
* Optional guild cache getter.
|
|
934
|
+
* When resolving a guild from a partial ID, this function will be called first.
|
|
935
|
+
* Should return the full guild object if cached, or undefined if not.
|
|
936
|
+
* @param id The ID of the guild to get.
|
|
937
|
+
* @returns The guild object if cached, or undefined if not.
|
|
938
|
+
*/
|
|
939
|
+
getGuild?: (id: string) => AnyGuild | undefined;
|
|
894
940
|
}
|
|
895
941
|
/**
|
|
896
942
|
* State Storage Options
|
|
@@ -977,6 +1023,10 @@ interface PortableMessage {
|
|
|
977
1023
|
* Any message
|
|
978
1024
|
*/
|
|
979
1025
|
type AnyMessage = PortableMessage | Message | Message$1 | Message$2 | Message$3 | Message$4;
|
|
1026
|
+
/**
|
|
1027
|
+
* Any guild
|
|
1028
|
+
*/
|
|
1029
|
+
type AnyGuild = Guild | Guild$1 | Guild$2 | Guild$3 | Guild$4<"cached">;
|
|
980
1030
|
/**
|
|
981
1031
|
* Discord Packet
|
|
982
1032
|
*/
|
|
@@ -1189,6 +1239,8 @@ interface Track {
|
|
|
1189
1239
|
pluginInfo: TrackPluginInfo;
|
|
1190
1240
|
/** Add your own data to the track. */
|
|
1191
1241
|
customData: Record<string, unknown>;
|
|
1242
|
+
/** If the track got added by autoplay. */
|
|
1243
|
+
readonly isAutoplay: boolean;
|
|
1192
1244
|
}
|
|
1193
1245
|
/**
|
|
1194
1246
|
* Track Plugin Info
|
|
@@ -1270,11 +1322,7 @@ interface LavaPlayer {
|
|
|
1270
1322
|
connected: boolean;
|
|
1271
1323
|
ping: number;
|
|
1272
1324
|
};
|
|
1273
|
-
voice:
|
|
1274
|
-
token: string;
|
|
1275
|
-
endpoint: string;
|
|
1276
|
-
sessionId: string;
|
|
1277
|
-
};
|
|
1325
|
+
voice: LavalinkVoiceStateResponse;
|
|
1278
1326
|
filters: Record<string, unknown>;
|
|
1279
1327
|
}
|
|
1280
1328
|
/**
|
|
@@ -1459,6 +1507,7 @@ interface VoiceState {
|
|
|
1459
1507
|
guildId: string;
|
|
1460
1508
|
event: VoiceServer;
|
|
1461
1509
|
sessionId?: string;
|
|
1510
|
+
channelId?: string;
|
|
1462
1511
|
}
|
|
1463
1512
|
/**
|
|
1464
1513
|
* Voice State
|
|
@@ -1878,15 +1927,29 @@ interface RestPlayOptions {
|
|
|
1878
1927
|
/** The audio effects. */
|
|
1879
1928
|
filters?: object;
|
|
1880
1929
|
/** voice payload. */
|
|
1881
|
-
voice?:
|
|
1882
|
-
token: string;
|
|
1883
|
-
sessionId: string;
|
|
1884
|
-
endpoint: string;
|
|
1885
|
-
};
|
|
1930
|
+
voice?: LavalinkVoiceStateUpdate;
|
|
1886
1931
|
/** Whether to not replace the track if a play payload is sent. */
|
|
1887
1932
|
noReplace?: boolean;
|
|
1888
1933
|
};
|
|
1889
1934
|
}
|
|
1935
|
+
/**
|
|
1936
|
+
* Lavalink voice state response
|
|
1937
|
+
*/
|
|
1938
|
+
type LavalinkVoiceStateResponse = {
|
|
1939
|
+
token: string;
|
|
1940
|
+
endpoint: string;
|
|
1941
|
+
sessionId: string;
|
|
1942
|
+
channelId: string | null;
|
|
1943
|
+
};
|
|
1944
|
+
/**
|
|
1945
|
+
* Lavalink voice state update
|
|
1946
|
+
*/
|
|
1947
|
+
type LavalinkVoiceStateUpdate = {
|
|
1948
|
+
token: string;
|
|
1949
|
+
endpoint: string;
|
|
1950
|
+
sessionId: string;
|
|
1951
|
+
channelId: string;
|
|
1952
|
+
};
|
|
1890
1953
|
/**
|
|
1891
1954
|
* ManagerInitOptions interface
|
|
1892
1955
|
*/
|
|
@@ -1947,33 +2010,34 @@ interface ReverbOptions {
|
|
|
1947
2010
|
* Queue interface
|
|
1948
2011
|
*/
|
|
1949
2012
|
interface IQueue {
|
|
1950
|
-
getCurrent(): Promise<Track | null>;
|
|
1951
|
-
setCurrent(track: Track | null): Promise<void>;
|
|
1952
|
-
getPrevious(): Promise<Track[]>;
|
|
1953
|
-
addPrevious(track: Track | Track[]): Promise<void>;
|
|
1954
|
-
setPrevious(track: Track | Track[]): Promise<void>;
|
|
2013
|
+
getCurrent(): Track | Promise<Track | null>;
|
|
2014
|
+
setCurrent(track: Track | null): void | Promise<void>;
|
|
2015
|
+
getPrevious(): Track[] | Promise<Track[]>;
|
|
2016
|
+
addPrevious(track: Track | Track[]): void | Promise<void>;
|
|
2017
|
+
setPrevious(track: Track | Track[]): void | Promise<void>;
|
|
1955
2018
|
/** Get newest track (index 0) */
|
|
1956
|
-
popPrevious(): Promise<Track | null>;
|
|
1957
|
-
clearPrevious(): Promise<void>;
|
|
1958
|
-
size(): Promise<number>;
|
|
1959
|
-
totalSize(): Promise<number>;
|
|
1960
|
-
duration(): Promise<number>;
|
|
1961
|
-
add(track: Track | Track[], offset?: number): Promise<void>;
|
|
1962
|
-
remove(start?: number, end?: number): Promise<Track[]>;
|
|
1963
|
-
clear(): Promise<void>;
|
|
1964
|
-
dequeue(): Promise<Track | undefined>;
|
|
1965
|
-
enqueueFront(track: Track | Track[]): Promise<void>;
|
|
1966
|
-
getTracks(): Promise<Track[]>;
|
|
1967
|
-
getSlice(start?: number, end?: number): Promise<Track[]>;
|
|
1968
|
-
modifyAt(start: number, deleteCount?: number, ...items: Track[]): Promise<Track[]>;
|
|
1969
|
-
shuffle(): Promise<void>;
|
|
1970
|
-
userBlockShuffle(): Promise<void>;
|
|
1971
|
-
roundRobinShuffle(): Promise<void>;
|
|
1972
|
-
mapAsync<T>(callback: (track: Track, index: number, array: Track[]) => T): Promise<T[]>;
|
|
1973
|
-
filterAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<Track[]>;
|
|
1974
|
-
findAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<Track | undefined>;
|
|
1975
|
-
someAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<boolean>;
|
|
1976
|
-
everyAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<boolean>;
|
|
2019
|
+
popPrevious(): Track | Promise<Track | null>;
|
|
2020
|
+
clearPrevious(): void | Promise<void>;
|
|
2021
|
+
size(): number | Promise<number>;
|
|
2022
|
+
totalSize(): number | Promise<number>;
|
|
2023
|
+
duration(): number | Promise<number>;
|
|
2024
|
+
add(track: Track | Track[], offset?: number): void | Promise<void>;
|
|
2025
|
+
remove(start?: number, end?: number): Track[] | Promise<Track[]>;
|
|
2026
|
+
clear(): void | Promise<void>;
|
|
2027
|
+
dequeue(): Track | Promise<Track | undefined>;
|
|
2028
|
+
enqueueFront(track: Track | Track[]): void | Promise<void>;
|
|
2029
|
+
getTracks(): Track[] | Promise<Track[]>;
|
|
2030
|
+
getSlice(start?: number, end?: number): Track[] | Promise<Track[]>;
|
|
2031
|
+
modifyAt(start: number, deleteCount?: number, ...items: Track[]): Track[] | Promise<Track[]>;
|
|
2032
|
+
shuffle(): void | Promise<void>;
|
|
2033
|
+
userBlockShuffle(): void | Promise<void>;
|
|
2034
|
+
roundRobinShuffle(): void | Promise<void>;
|
|
2035
|
+
mapAsync<T>(callback: (track: Track, index: number, array: Track[]) => T): T[] | Promise<T[]>;
|
|
2036
|
+
filterAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Track[] | Promise<Track[]>;
|
|
2037
|
+
findAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Track | Promise<Track | undefined>;
|
|
2038
|
+
someAsync(callback: (track: Track, index: number, array: Track[]) => boolean): boolean | Promise<boolean>;
|
|
2039
|
+
everyAsync(callback: (track: Track, index: number, array: Track[]) => boolean): boolean | Promise<boolean>;
|
|
2040
|
+
destroy(): void | Promise<void>;
|
|
1977
2041
|
}
|
|
1978
2042
|
/**
|
|
1979
2043
|
* Sizes Enum type
|
|
@@ -2304,15 +2368,6 @@ declare class Player {
|
|
|
2304
2368
|
* @returns {Promise<Player>} - The player instance after being moved.
|
|
2305
2369
|
*/
|
|
2306
2370
|
moveNode(identifier: string): Promise<Player>;
|
|
2307
|
-
/**
|
|
2308
|
-
* Transfers the player to a new server. If the player already exists on the new server
|
|
2309
|
-
* and force is false, this method will return the existing player. Otherwise, a new player
|
|
2310
|
-
* will be created and the current player will be destroyed.
|
|
2311
|
-
* @param {PlayerOptions} newOptions - The new options for the player.
|
|
2312
|
-
* @param {boolean} force - Whether to force the creation of a new player.
|
|
2313
|
-
* @returns {Promise<Player>} - The new player instance.
|
|
2314
|
-
*/
|
|
2315
|
-
switchGuild(newOptions: PlayerOptions, force?: boolean): Promise<Player>;
|
|
2316
2371
|
/**
|
|
2317
2372
|
* Retrieves the data associated with the player.
|
|
2318
2373
|
* @returns {Record<string, unknown>} - The data associated with the player.
|
|
@@ -2323,6 +2378,11 @@ declare class Player {
|
|
|
2323
2378
|
* @returns {NodeJS.Timeout | null} - The dynamic loop interval of the player.
|
|
2324
2379
|
*/
|
|
2325
2380
|
getDynamicLoopIntervalPublic(): NodeJS.Timeout | null;
|
|
2381
|
+
/**
|
|
2382
|
+
* Retrieves the data associated with the player.
|
|
2383
|
+
* @returns {Record<string, unknown>} - The data associated with the player.
|
|
2384
|
+
*/
|
|
2385
|
+
getSerializableData(): Record<string, unknown>;
|
|
2326
2386
|
/**
|
|
2327
2387
|
* Retrieves the current lyrics for the playing track.
|
|
2328
2388
|
* @param skipTrackSource - Indicates whether to skip the track source when fetching lyrics.
|
|
@@ -2487,7 +2547,6 @@ declare class Node {
|
|
|
2487
2547
|
private reconnectTimeout?;
|
|
2488
2548
|
private reconnectAttempts;
|
|
2489
2549
|
private redisPrefix?;
|
|
2490
|
-
private sessionIdsFilePath?;
|
|
2491
2550
|
private sessionIdsMap;
|
|
2492
2551
|
/**
|
|
2493
2552
|
* Creates an instance of Node.
|
|
@@ -2502,12 +2561,10 @@ declare class Node {
|
|
|
2502
2561
|
get connected(): boolean;
|
|
2503
2562
|
/** Returns the full address for this node, including the host and port. */
|
|
2504
2563
|
get address(): string;
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
*/
|
|
2510
|
-
createSessionIdsFile(): void;
|
|
2564
|
+
private getCompositeKey;
|
|
2565
|
+
private getRedisSessionIdsKey;
|
|
2566
|
+
private getNodeSessionsDir;
|
|
2567
|
+
private getNodeSessionPath;
|
|
2511
2568
|
/**
|
|
2512
2569
|
* Loads session IDs from the sessionIds.json file if it exists.
|
|
2513
2570
|
* The session IDs are used to resume sessions for each node.
|
|
@@ -2529,6 +2586,8 @@ declare class Node {
|
|
|
2529
2586
|
* be used with the same node identifier.
|
|
2530
2587
|
*/
|
|
2531
2588
|
updateSessionId(): Promise<void>;
|
|
2589
|
+
private updateSessionIdFile;
|
|
2590
|
+
private updateSessionIdRedis;
|
|
2532
2591
|
/**
|
|
2533
2592
|
* Connects to the Node.
|
|
2534
2593
|
*
|
|
@@ -2867,6 +2926,8 @@ declare class Manager extends EventEmitter {
|
|
|
2867
2926
|
initiated: boolean;
|
|
2868
2927
|
redis?: Redis;
|
|
2869
2928
|
private _send;
|
|
2929
|
+
private _getUser?;
|
|
2930
|
+
private _getGuild?;
|
|
2870
2931
|
private loadedPlugins;
|
|
2871
2932
|
/**
|
|
2872
2933
|
* Initiates the Manager class.
|
|
@@ -3089,20 +3150,24 @@ declare class Manager extends EventEmitter {
|
|
|
3089
3150
|
*/
|
|
3090
3151
|
private get priorityNode();
|
|
3091
3152
|
protected send(packet: GatewayVoiceStateUpdate): unknown;
|
|
3153
|
+
protected getUserFromCache(id: string): AnyUser | undefined;
|
|
3092
3154
|
sendPacket(packet: GatewayVoiceStateUpdate): unknown;
|
|
3093
3155
|
/**
|
|
3094
3156
|
* Resolves a PortableUser or ID to a real user object.
|
|
3095
3157
|
* Can be overridden by wrapper managers to return wrapper-specific User classes.
|
|
3096
3158
|
*/
|
|
3097
3159
|
resolveUser(user: AnyUser | string): Promise<AnyUser>;
|
|
3160
|
+
/**
|
|
3161
|
+
* Resolves a Guild ID to a real guild object.
|
|
3162
|
+
* Can be overridden by wrapper managers to return wrapper-specific Guild classes.
|
|
3163
|
+
*/
|
|
3164
|
+
resolveGuild(guildId: string): AnyGuild;
|
|
3098
3165
|
}
|
|
3099
3166
|
|
|
3100
3167
|
declare class Filters {
|
|
3101
3168
|
distortion: DistortionOptions | null;
|
|
3102
3169
|
equalizer: Band[];
|
|
3103
3170
|
karaoke: KaraokeOptions | null;
|
|
3104
|
-
manager: Manager;
|
|
3105
|
-
player: Player;
|
|
3106
3171
|
rotation: RotationOptions | null;
|
|
3107
3172
|
timescale: TimescaleOptions | null;
|
|
3108
3173
|
vibrato: VibratoOptions | null;
|
|
@@ -3110,6 +3175,8 @@ declare class Filters {
|
|
|
3110
3175
|
volume: number;
|
|
3111
3176
|
bassBoostlevel: number;
|
|
3112
3177
|
filtersStatus: Record<AvailableFilters, boolean>;
|
|
3178
|
+
manager: Manager;
|
|
3179
|
+
player: Player;
|
|
3113
3180
|
constructor(player: Player, manager: Manager);
|
|
3114
3181
|
/**
|
|
3115
3182
|
* Updates the player's audio filters.
|
|
@@ -3462,18 +3529,30 @@ declare abstract class TrackUtils {
|
|
|
3462
3529
|
static setTrackPartial(partial: TrackPartial[]): void;
|
|
3463
3530
|
/**
|
|
3464
3531
|
* Checks if the provided argument is a valid Track.
|
|
3465
|
-
*
|
|
3466
|
-
* @param trackOrTracks The Track or array of Tracks to check.
|
|
3532
|
+
* @param value The value to check.
|
|
3467
3533
|
* @returns {boolean} Whether the provided argument is a valid Track.
|
|
3468
3534
|
*/
|
|
3469
|
-
static
|
|
3535
|
+
static isTrack(track: unknown): track is Track;
|
|
3536
|
+
/**
|
|
3537
|
+
* Checks if the provided argument is a valid Track array.
|
|
3538
|
+
* @param value The value to check.
|
|
3539
|
+
* @returns {boolean} Whether the provided argument is a valid Track array.
|
|
3540
|
+
*/
|
|
3541
|
+
static isTrackArray(value: unknown): value is Track[];
|
|
3542
|
+
/**
|
|
3543
|
+
* Checks if the provided argument is a valid Track or Track array.
|
|
3544
|
+
* @param value The value to check.
|
|
3545
|
+
* @returns {boolean} Whether the provided argument is a valid Track or Track array.
|
|
3546
|
+
*/
|
|
3547
|
+
static validate(value: unknown): value is Track | Track[];
|
|
3470
3548
|
/**
|
|
3471
3549
|
* Builds a Track from the raw data from Lavalink and a optional requester.
|
|
3472
3550
|
* @param data The raw data from Lavalink to build the Track from.
|
|
3473
3551
|
* @param requester The user who requested the track, if any.
|
|
3552
|
+
* @param isAutoPlay Whether the track is autoplayed. Defaults to false.
|
|
3474
3553
|
* @returns The built Track.
|
|
3475
3554
|
*/
|
|
3476
|
-
static build<T = AnyUser>(data: TrackData, requester?: T): Track;
|
|
3555
|
+
static build<T = AnyUser>(data: TrackData, requester?: T, isAutoplay?: boolean): Track;
|
|
3477
3556
|
/**
|
|
3478
3557
|
* Validates a search result.
|
|
3479
3558
|
* @param result The search result to validate.
|
|
@@ -3550,7 +3629,7 @@ declare abstract class PlayerUtils {
|
|
|
3550
3629
|
* @param player The Player instance to serialize
|
|
3551
3630
|
* @returns The serialized Player instance
|
|
3552
3631
|
*/
|
|
3553
|
-
static serializePlayer(player: Player): Promise<Record<string, unknown
|
|
3632
|
+
static serializePlayer(player: Player): Promise<Record<string, unknown> | null>;
|
|
3554
3633
|
/**
|
|
3555
3634
|
* Gets the base directory for player data.
|
|
3556
3635
|
*/
|
|
@@ -3575,6 +3654,10 @@ declare abstract class PlayerUtils {
|
|
|
3575
3654
|
* Gets the path to the player's previous tracks file.
|
|
3576
3655
|
*/
|
|
3577
3656
|
static getPlayerPreviousPath(guildId: string): string;
|
|
3657
|
+
/**
|
|
3658
|
+
* Gets the Redis key for player storage.
|
|
3659
|
+
*/
|
|
3660
|
+
static getRedisKey(): string;
|
|
3578
3661
|
}
|
|
3579
3662
|
/** Gets or extends structures to extend the built in, or already extended, classes to add more functionality. */
|
|
3580
3663
|
declare abstract class Structure {
|
|
@@ -3608,6 +3691,20 @@ declare class MagmaStreamError<T = unknown> extends Error {
|
|
|
3608
3691
|
constructor({ code, message, cause, context }: MagmaStreamErrorOptions<T>);
|
|
3609
3692
|
}
|
|
3610
3693
|
|
|
3694
|
+
/**
|
|
3695
|
+
* Discordeno wrapper for Magmastream.
|
|
3696
|
+
*/
|
|
3697
|
+
declare class DiscordenoManager extends Manager {
|
|
3698
|
+
readonly client: Bot;
|
|
3699
|
+
constructor(client: Bot, options?: ManagerOptions);
|
|
3700
|
+
protected send(packet: GatewayVoiceStateUpdate): void;
|
|
3701
|
+
/**
|
|
3702
|
+
* Resolve a user by ID or partial info.
|
|
3703
|
+
* Uses user-provided cache getter if available, otherwise falls back to minimal info.
|
|
3704
|
+
*/
|
|
3705
|
+
resolveUser(user: AnyUser | string): Promise<User$2 | AnyUser>;
|
|
3706
|
+
}
|
|
3707
|
+
|
|
3611
3708
|
/**
|
|
3612
3709
|
* Discord.js wrapper for Magmastream.
|
|
3613
3710
|
*/
|
|
@@ -3616,6 +3713,7 @@ declare class DiscordJSManager extends Manager {
|
|
|
3616
3713
|
constructor(client: Client, options?: ManagerOptions);
|
|
3617
3714
|
protected send(packet: GatewayVoiceStateUpdate): void;
|
|
3618
3715
|
resolveUser(user: AnyUser | string): Promise<User | AnyUser>;
|
|
3716
|
+
resolveGuild(guildId: string): Guild | null;
|
|
3619
3717
|
}
|
|
3620
3718
|
|
|
3621
3719
|
/**
|
|
@@ -3626,16 +3724,7 @@ declare class ErisManager extends Manager {
|
|
|
3626
3724
|
constructor(client: Client$1, options?: ManagerOptions);
|
|
3627
3725
|
protected send(packet: GatewayVoiceStateUpdate): void;
|
|
3628
3726
|
resolveUser(user: AnyUser | string): Promise<User$3 | AnyUser>;
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
/**
|
|
3632
|
-
* Detritus wrapper for Magmastream.
|
|
3633
|
-
*/
|
|
3634
|
-
declare class DetritusManager extends Manager {
|
|
3635
|
-
readonly client: ClusterClient | ShardClient;
|
|
3636
|
-
constructor(client: ClusterClient | ShardClient, options?: ManagerOptions);
|
|
3637
|
-
protected send(packet: GatewayVoiceStateUpdate): void;
|
|
3638
|
-
resolveUser(user: AnyUser | string): Promise<AnyUser>;
|
|
3727
|
+
resolveGuild(guildId: string): Guild$3;
|
|
3639
3728
|
}
|
|
3640
3729
|
|
|
3641
3730
|
/**
|
|
@@ -3646,6 +3735,7 @@ declare class OceanicManager extends Manager {
|
|
|
3646
3735
|
constructor(client: Client$2, options?: ManagerOptions);
|
|
3647
3736
|
protected send(packet: GatewayVoiceStateUpdate): void;
|
|
3648
3737
|
resolveUser(user: AnyUser | string): Promise<User$1 | AnyUser>;
|
|
3738
|
+
resolveGuild(guildId: string): Guild$1;
|
|
3649
3739
|
}
|
|
3650
3740
|
|
|
3651
3741
|
/**
|
|
@@ -3678,7 +3768,8 @@ declare class SeyfertManager extends Manager {
|
|
|
3678
3768
|
constructor(client: Client$3 | WorkerClient, options?: ManagerOptions);
|
|
3679
3769
|
protected send(packet: GatewayVoiceStateUpdate): void;
|
|
3680
3770
|
resolveUser(user: AnyUser | string): Promise<User$4 | AnyUser>;
|
|
3771
|
+
resolveGuild(guildId: string): Guild$4<"cached">;
|
|
3681
3772
|
}
|
|
3682
3773
|
|
|
3683
|
-
export { AutoPlayPlatform, AutoPlayUtils, AvailableFilters,
|
|
3684
|
-
export type { AlbumSearchResult, AnyMessage, AnyUser, ArtistSearchResult, CPUStats, DiscordPacket, DistortionOptions, EndSpeakingEventVoiceReceiver, EndSpeakingEventVoiceReceiverData, EqualizerBand, ErrorOrEmptySearchResult, Exception, Extendable, FrameStats, IQueue, JsonConfig, KaraokeOptions, LavaPlayer, LavalinkInfo, LavalinkResponse, LoadType, Lyrics, LyricsEvent, LyricsEventType, LyricsFoundEvent, LyricsLine, LyricsLineEvent, LyricsNotFoundEvent, ManagerEvents, ManagerInitOptions, ManagerOptions, MemoryStats, NodeLinkGetLyrics, NodeLinkGetLyricsEmpty, NodeLinkGetLyricsError, NodeLinkGetLyricsMultiple, NodeLinkGetLyricsSingle, NodeMessage, NodeOptions, NodeStats, PlayOptions, PlayerEvent, PlayerEventType, PlayerEvents, PlayerOptions, PlayerStateUpdateEvent, PlayerUpdateVoiceState, PlaylistData, PlaylistInfoData, PlaylistRawData, PlaylistSearchResult, PodcastSearchResult, PortableMessage, PortableUser, RedisConfig, RestPlayOptions, ReverbOptions, RotationOptions, SearchQuery, SearchResult, SearchSearchResult, Severity, ShortSearchResult, ShowSearchResult, Sizes, SponsorBlockChapterStarted, SponsorBlockChaptersLoaded, SponsorBlockSegmentEventType, SponsorBlockSegmentEvents, SponsorBlockSegmentSkipped, SponsorBlockSegmentsLoaded, StartSpeakingEventVoiceReceiver, StartSpeakingEventVoiceReceiverData, StateStorageOptions, StationSearchResult, TimescaleOptions, Track, TrackData, TrackDataInfo, TrackEndEvent, TrackEndReason, TrackExceptionEvent, TrackPluginInfo, TrackSearchResult, TrackSourceName, TrackStartEvent, TrackStuckEvent, UseNodeOption, VibratoOptions, VoicePacket, VoiceReceiverEvent, VoiceServer, VoiceServerUpdate, VoiceState, WebSocketClosedEvent };
|
|
3774
|
+
export { AutoPlayPlatform, AutoPlayUtils, AvailableFilters, DiscordJSManager, DiscordenoManager, ErisManager, Filters, JSONUtils, JsonQueue, LoadTypes, MagmaStreamError, MagmaStreamErrorCode, MagmaStreamErrorNumbers, Manager, ManagerEventTypes, MemoryQueue, Node, OceanicManager, Player, PlayerStateEventTypes, PlayerUtils, Plugin, RedisQueue, Rest, SearchPlatform, SeverityTypes, SeyfertManager, SponsorBlockSegment, StateStorageType, StateTypes, Structure, TrackEndReasonTypes, TrackPartial, TrackSourceTypes, TrackUtils, UseNodeOptions };
|
|
3775
|
+
export type { AlbumSearchResult, AnyGuild, AnyMessage, AnyUser, ArtistSearchResult, CPUStats, DiscordPacket, DistortionOptions, EndSpeakingEventVoiceReceiver, EndSpeakingEventVoiceReceiverData, EqualizerBand, ErrorOrEmptySearchResult, Exception, Extendable, FrameStats, IQueue, JsonConfig, KaraokeOptions, LavaPlayer, LavalinkInfo, LavalinkResponse, LavalinkVoiceStateResponse, LavalinkVoiceStateUpdate, LoadType, Lyrics, LyricsEvent, LyricsEventType, LyricsFoundEvent, LyricsLine, LyricsLineEvent, LyricsNotFoundEvent, ManagerEvents, ManagerInitOptions, ManagerOptions, MemoryStats, NodeLinkGetLyrics, NodeLinkGetLyricsEmpty, NodeLinkGetLyricsError, NodeLinkGetLyricsMultiple, NodeLinkGetLyricsSingle, NodeMessage, NodeOptions, NodeStats, PlayOptions, PlayerEvent, PlayerEventType, PlayerEvents, PlayerOptions, PlayerStateUpdateEvent, PlayerUpdateVoiceState, PlaylistData, PlaylistInfoData, PlaylistRawData, PlaylistSearchResult, PodcastSearchResult, PortableMessage, PortableUser, RedisConfig, RestPlayOptions, ReverbOptions, RotationOptions, SearchQuery, SearchResult, SearchSearchResult, Severity, ShortSearchResult, ShowSearchResult, Sizes, SponsorBlockChapterStarted, SponsorBlockChaptersLoaded, SponsorBlockSegmentEventType, SponsorBlockSegmentEvents, SponsorBlockSegmentSkipped, SponsorBlockSegmentsLoaded, StartSpeakingEventVoiceReceiver, StartSpeakingEventVoiceReceiverData, StateStorageOptions, StationSearchResult, TimescaleOptions, Track, TrackData, TrackDataInfo, TrackEndEvent, TrackEndReason, TrackExceptionEvent, TrackPluginInfo, TrackSearchResult, TrackSourceName, TrackStartEvent, TrackStuckEvent, UseNodeOption, VibratoOptions, VoicePacket, VoiceReceiverEvent, VoiceServer, VoiceServerUpdate, VoiceState, WebSocketClosedEvent };
|
package/dist/index.js
CHANGED
|
@@ -11,9 +11,9 @@ tslib_1.__exportStar(require("./structures/Rest"), exports);
|
|
|
11
11
|
tslib_1.__exportStar(require("./structures/Utils"), exports);
|
|
12
12
|
tslib_1.__exportStar(require("./structures/MagmastreamError"), exports);
|
|
13
13
|
// wrappers
|
|
14
|
+
tslib_1.__exportStar(require("./wrappers/discordeno"), exports);
|
|
14
15
|
tslib_1.__exportStar(require("./wrappers/discord.js"), exports);
|
|
15
16
|
tslib_1.__exportStar(require("./wrappers/eris"), exports);
|
|
16
|
-
tslib_1.__exportStar(require("./wrappers/detritus"), exports);
|
|
17
17
|
tslib_1.__exportStar(require("./wrappers/oceanic"), exports);
|
|
18
18
|
tslib_1.__exportStar(require("./wrappers/seyfert"), exports);
|
|
19
19
|
// types
|