magmastream 2.9.0-dev.34 → 2.9.0-dev.36

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 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 {
@@ -140,8 +141,9 @@ interface playOptions {
140
141
  * State Storage Enum
141
142
  */
142
143
  declare enum StateStorageType {
143
- Collection = "collection",
144
- Redis = "redis"
144
+ Memory = "memory",
145
+ Redis = "redis",
146
+ JSON = "json"
145
147
  }
146
148
  /**
147
149
  * AutoPlay Platform Enum
@@ -332,7 +334,7 @@ declare enum SponsorBlockSegment {
332
334
  /**
333
335
  * The player's queue, the `current` property is the currently playing track, think of the rest as the up-coming tracks.
334
336
  */
335
- declare class Queue extends Array<Track> implements IQueue {
337
+ declare class MemoryQueue extends Array<Track> implements IQueue {
336
338
  /** The current track */
337
339
  current: Track | null;
338
340
  /** The previous tracks */
@@ -347,12 +349,30 @@ declare class Queue extends Array<Track> implements IQueue {
347
349
  * @param manager The Manager instance.
348
350
  */
349
351
  constructor(guildId: string, manager: Manager);
352
+ /**
353
+ * @returns The current track.
354
+ */
350
355
  getCurrent(): Promise<Track | null>;
356
+ /**
357
+ * @param track The track to set.
358
+ */
351
359
  setCurrent(track: Track | null): Promise<void>;
360
+ /**
361
+ * @returns The previous tracks.
362
+ */
352
363
  getPrevious(): Promise<Track[]>;
353
364
  addPrevious(track: Track | Track[]): Promise<void>;
365
+ /**
366
+ * @param tracks The tracks to set.
367
+ */
354
368
  setPrevious(tracks: Track[]): Promise<void>;
369
+ /**
370
+ * @returns The newest track.
371
+ */
355
372
  popPrevious(): Promise<Track | null>;
373
+ /**
374
+ * Clears the previous tracks.
375
+ */
356
376
  clearPrevious(): Promise<void>;
357
377
  /**
358
378
  * The total duration of the queue in milliseconds.
@@ -404,15 +424,360 @@ declare class Queue extends Array<Track> implements IQueue {
404
424
  * Shuffles the queue to play tracks requested by each user one by one.
405
425
  */
406
426
  roundRobinShuffle(): Promise<void>;
427
+ /**
428
+ * Removes the first element from the queue.
429
+ */
407
430
  dequeue(): Promise<Track | undefined>;
431
+ /**
432
+ * Adds the specified track or tracks to the front of the queue.
433
+ * @param track The track or tracks to add.
434
+ */
408
435
  enqueueFront(track: Track | Track[]): Promise<void>;
436
+ /**
437
+ * @returns A shallow copy of the queue.
438
+ */
409
439
  getTracks(): Promise<Track[]>;
440
+ /**
441
+ * @returns A shallow copy of the queue.
442
+ */
410
443
  getSlice(start?: number, end?: number): Promise<Track[]>;
444
+ /**
445
+ * 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
+ */
411
451
  modifyAt(start: number, deleteCount?: number, ...items: Track[]): Promise<Track[]>;
452
+ /**
453
+ * @returns A new array with the results of calling a provided function on every element in the queue.
454
+ */
412
455
  mapAsync<T>(callback: (track: Track, index: number, array: Track[]) => T): Promise<T[]>;
456
+ /**
457
+ * @returns A new array with all elements that pass the test implemented by the provided function.
458
+ */
413
459
  filterAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<Track[]>;
460
+ /**
461
+ * @returns The first element in the queue that satisfies the provided testing function.
462
+ */
414
463
  findAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<Track | undefined>;
464
+ /**
465
+ * @returns Whether at least one element in the queue satisfies the provided testing function.
466
+ */
415
467
  someAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<boolean>;
468
+ /**
469
+ * @returns Whether all elements in the queue satisfy the provided testing function.
470
+ */
471
+ everyAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<boolean>;
472
+ }
473
+
474
+ /**
475
+ * The player's queue, the `current` property is the currently playing track, think of the rest as the up-coming tracks.
476
+ */
477
+ declare class RedisQueue implements IQueue {
478
+ readonly guildId: string;
479
+ readonly manager: Manager;
480
+ /**
481
+ * The Redis instance.
482
+ */
483
+ private redis;
484
+ /**
485
+ * The prefix for the Redis keys.
486
+ */
487
+ redisPrefix: string;
488
+ /**
489
+ * Constructs a new RedisQueue.
490
+ * @param guildId The guild ID.
491
+ * @param manager The Manager instance.
492
+ */
493
+ 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
+ /**
515
+ * @returns The current track.
516
+ */
517
+ getCurrent(): Promise<Track | null>;
518
+ /**
519
+ * @param track The track to set.
520
+ */
521
+ setCurrent(track: Track | null): Promise<void>;
522
+ /**
523
+ * @returns The previous tracks.
524
+ */
525
+ getPrevious(): Promise<Track[]>;
526
+ /**
527
+ * @param track The track to add.
528
+ */
529
+ addPrevious(track: Track | Track[]): Promise<void>;
530
+ /**
531
+ * @param track The track to set.
532
+ */
533
+ setPrevious(track: Track | Track[]): Promise<void>;
534
+ /**
535
+ * @returns The newest track.
536
+ */
537
+ popPrevious(): Promise<Track | null>;
538
+ /**
539
+ * Clears the previous tracks.
540
+ */
541
+ clearPrevious(): Promise<void>;
542
+ /**
543
+ * @param track The track or tracks to add. Can be a single `Track` or an array of `Track`s.
544
+ * @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
+ */
546
+ add(track: Track | Track[], offset?: number): Promise<void>;
547
+ /**
548
+ * @param position The position to remove the track at.
549
+ * @param end The end position to remove the track at.
550
+ */
551
+ remove(position?: number): Promise<Track[]>;
552
+ remove(start: number, end: number): Promise<Track[]>;
553
+ /**
554
+ * Clears the queue.
555
+ */
556
+ 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
+ /**
571
+ * Shuffles the queue.
572
+ */
573
+ shuffle(): Promise<void>;
574
+ /**
575
+ * Shuffles the queue, but keeps the tracks of the same user together.
576
+ */
577
+ userBlockShuffle(): Promise<void>;
578
+ /**
579
+ * Shuffles the queue round-robin style.
580
+ */
581
+ roundRobinShuffle(): Promise<void>;
582
+ /**
583
+ * Removes the first track from the queue.
584
+ */
585
+ dequeue(): Promise<Track | undefined>;
586
+ /**
587
+ * Adds a track to the front of the queue.
588
+ */
589
+ enqueueFront(track: Track | Track[]): Promise<void>;
590
+ /**
591
+ * @returns The tracks in the queue.
592
+ */
593
+ getTracks(): Promise<Track[]>;
594
+ /**
595
+ * @returns The tracks in the queue from the start to the end.
596
+ */
597
+ getSlice(start?: number, end?: number): Promise<Track[]>;
598
+ /**
599
+ * Modifies the queue at the specified index.
600
+ */
601
+ modifyAt(start: number, deleteCount?: number, ...items: Track[]): Promise<Track[]>;
602
+ /**
603
+ * @returns The tracks in the queue after the specified index.
604
+ */
605
+ mapAsync<T>(callback: (track: Track, index: number, array: Track[]) => T): Promise<T[]>;
606
+ /**
607
+ * @returns The tracks in the queue that match the specified condition.
608
+ */
609
+ filterAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<Track[]>;
610
+ /**
611
+ * @returns The first track in the queue that matches the specified condition.
612
+ */
613
+ findAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<Track | undefined>;
614
+ /**
615
+ * @returns Whether any tracks in the queue match the specified condition.
616
+ */
617
+ someAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<boolean>;
618
+ /**
619
+ * @returns Whether all tracks in the queue match the specified condition.
620
+ */
621
+ everyAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<boolean>;
622
+ }
623
+
624
+ /**
625
+ * The player's queue, the `current` property is the currently playing track, think of the rest as the up-coming tracks.
626
+ */
627
+ declare class JsonQueue implements IQueue {
628
+ readonly guildId: string;
629
+ 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
+ /**
637
+ * @returns The queue path.
638
+ */
639
+ private get queuePath();
640
+ /**
641
+ * @returns The current path.
642
+ */
643
+ private get currentPath();
644
+ /**
645
+ * @returns The previous path.
646
+ */
647
+ private get previousPath();
648
+ /**
649
+ * Ensures the directory exists.
650
+ */
651
+ private ensureDir;
652
+ /**
653
+ * @returns The queue.
654
+ */
655
+ private getQueue;
656
+ /**
657
+ * @param queue The queue.
658
+ */
659
+ private setQueue;
660
+ /**
661
+ * @param filePath The file path.
662
+ * @returns The JSON data.
663
+ */
664
+ private readJSON;
665
+ /**
666
+ * @param filePath The file path.
667
+ * @param data The data to write.
668
+ */
669
+ private writeJSON;
670
+ /**
671
+ * @param filePath The file path.
672
+ */
673
+ private deleteFile;
674
+ /**
675
+ * @returns The current track.
676
+ */
677
+ getCurrent(): Promise<Track | null>;
678
+ /**
679
+ * @param track The track to set.
680
+ */
681
+ setCurrent(track: Track | null): Promise<void>;
682
+ /**
683
+ * @returns The previous tracks.
684
+ */
685
+ getPrevious(): Promise<Track[]>;
686
+ /**
687
+ * @param track The track to add.
688
+ */
689
+ addPrevious(track: Track | Track[]): Promise<void>;
690
+ /**
691
+ * @param track The track to set.
692
+ */
693
+ setPrevious(track: Track | Track[]): Promise<void>;
694
+ /**
695
+ * @returns The newest track.
696
+ */
697
+ popPrevious(): Promise<Track | null>;
698
+ /**
699
+ * Clears the previous tracks.
700
+ */
701
+ clearPrevious(): Promise<void>;
702
+ /**
703
+ * @param track The track or tracks to add. Can be a single `Track` or an array of `Track`s.
704
+ * @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.
705
+ */
706
+ add(track: Track | Track[], offset?: number): Promise<void>;
707
+ /**
708
+ * Removes a track from the queue.
709
+ * @param position The position to remove the track at.
710
+ * @param end The end position to remove the track at.
711
+ */
712
+ remove(position?: number): Promise<Track[]>;
713
+ remove(start: number, end: number): Promise<Track[]>;
714
+ /**
715
+ * Clears the queue.
716
+ */
717
+ clear(): Promise<void>;
718
+ /**
719
+ * @returns The size of the queue.
720
+ */
721
+ size(): Promise<number>;
722
+ /**
723
+ * @returns The total size of the queue.
724
+ */
725
+ totalSize(): Promise<number>;
726
+ /**
727
+ * @returns The total duration of the queue.
728
+ */
729
+ duration(): Promise<number>;
730
+ /**
731
+ * Shuffles the queue.
732
+ */
733
+ shuffle(): Promise<void>;
734
+ /**
735
+ * Shuffles the queue by user.
736
+ */
737
+ userBlockShuffle(): Promise<void>;
738
+ /**
739
+ * Shuffles the queue by round-robin.
740
+ */
741
+ roundRobinShuffle(): Promise<void>;
742
+ /**
743
+ * Removes the first track from the queue.
744
+ */
745
+ dequeue(): Promise<Track | undefined>;
746
+ /**
747
+ * Adds a track to the front of the queue.
748
+ */
749
+ enqueueFront(track: Track | Track[]): Promise<void>;
750
+ /**
751
+ * @returns The tracks in the queue.
752
+ */
753
+ getTracks(): Promise<Track[]>;
754
+ /**
755
+ * @returns The tracks in the queue from start to end.
756
+ */
757
+ getSlice(start?: number, end?: number): Promise<Track[]>;
758
+ /**
759
+ * Modifies the queue at the specified index.
760
+ */
761
+ modifyAt(start: number, deleteCount?: number, ...items: Track[]): Promise<Track[]>;
762
+ /**
763
+ * Maps the queue to a new array.
764
+ */
765
+ mapAsync<T>(callback: (track: Track, index: number, array: Track[]) => T): Promise<T[]>;
766
+ /**
767
+ * Filters the queue.
768
+ */
769
+ filterAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<Track[]>;
770
+ /**
771
+ * Finds the first track in the queue that satisfies the provided testing function.
772
+ */
773
+ findAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<Track | undefined>;
774
+ /**
775
+ * Tests whether at least one element in the queue passes the test implemented by the provided function.
776
+ */
777
+ someAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<boolean>;
778
+ /**
779
+ * Tests whether all elements in the queue pass the test implemented by the provided function.
780
+ */
416
781
  everyAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<boolean>;
417
782
  }
418
783
 
@@ -422,41 +787,57 @@ declare class Queue extends Array<Track> implements IQueue {
422
787
  interface ManagerOptions {
423
788
  /** The state storage options.
424
789
  *
425
- * @default { type: StateStorageType.Collection }
790
+ * @default { type: StateStorageType.Collection, deleteInactivePlayers: true }
426
791
  */
427
792
  stateStorage?: StateStorageOptions;
428
- /** Enable priority mode over least player count or load balancing? */
793
+ /** Enable priority mode over least player count or load balancing?
794
+ * @default false
795
+ */
429
796
  enablePriorityMode?: boolean;
430
- /** Automatically play the next track when the current one ends. */
797
+ /** Automatically play the next track when the current one ends.
798
+ * @default true
799
+ */
431
800
  playNextOnEnd?: boolean;
432
801
  /** An array of search platforms to use for autoplay. First to last matters
433
802
  * Use enum `AutoPlayPlatform`.
803
+ * @default [AutoPlayPlatform.YouTube]
434
804
  */
435
805
  autoPlaySearchPlatforms?: AutoPlayPlatform[];
436
806
  /** The client ID to use. */
437
807
  clientId?: string;
438
808
  /** Value to use for the `Client-Name` header. */
439
809
  clientName?: string;
440
- /** The array of shard IDs connected to this manager instance. */
810
+ /** The array of shard IDs connected to this manager instance.
811
+ * @default 0
812
+ */
441
813
  clusterId?: number;
442
814
  /** List of plugins to load. */
443
815
  enabledPlugins?: Plugin[];
444
816
  /** The default search platform to use.
445
- * Use enum `SearchPlatform`. */
817
+ * Use enum `SearchPlatform`.
818
+ * @default SearchPlatform.YouTube
819
+ */
446
820
  defaultSearchPlatform?: SearchPlatform;
447
821
  /** The last.fm API key.
448
822
  * If you need to create one go here: https://www.last.fm/api/account/create.
449
823
  * If you already have one, get it from here: https://www.last.fm/api/accounts. */
450
824
  lastFmApiKey?: string;
451
- /** The maximum number of previous tracks to store. */
825
+ /** The maximum number of previous tracks to store.
826
+ * @default 20
827
+ */
452
828
  maxPreviousTracks?: number;
453
829
  /** The array of nodes to connect to. */
454
830
  nodes?: NodeOptions[];
455
- /** Whether the YouTube video titles should be replaced if the Author does not exactly match. */
831
+ /** Whether the YouTube video titles should be replaced if the Author does not exactly match.
832
+ * @default false
833
+ */
456
834
  normalizeYouTubeTitles?: boolean;
457
835
  /** An array of track properties to keep. `track` will always be present. */
458
836
  trackPartial?: TrackPartial[];
459
- /** Use the least amount of players or least load? */
837
+ /** Use the least amount of players or least load?
838
+ * Use enum `UseNodeOptions`.
839
+ * @default UseNodeOptions.LeastPlayers
840
+ */
460
841
  useNode?: UseNodeOptions.LeastLoad | UseNodeOptions.LeastPlayers;
461
842
  /**
462
843
  * Function to send data to the websocket.
@@ -471,6 +852,8 @@ interface ManagerOptions {
471
852
  interface StateStorageOptions {
472
853
  type: StateStorageType;
473
854
  redisConfig?: RedisConfig;
855
+ jsonConfig?: JsonConfig;
856
+ deleteInactivePlayers?: boolean;
474
857
  }
475
858
  /**
476
859
  * Payload
@@ -485,6 +868,57 @@ interface Payload {
485
868
  self_deaf: boolean;
486
869
  };
487
870
  }
871
+ /**
872
+ * Node Options
873
+ */
874
+ interface NodeOptions {
875
+ /** The host for the node. */
876
+ host: string;
877
+ /** The port for the node.
878
+ * @default 2333
879
+ */
880
+ port?: number;
881
+ /** The password for the node.
882
+ * @default "youshallnotpass"
883
+ */
884
+ password?: string;
885
+ /** Whether the host uses SSL.
886
+ * @default false
887
+ */
888
+ useSSL?: boolean;
889
+ /** The identifier for the node.
890
+ * @default host
891
+ */
892
+ identifier?: string;
893
+ /** The maxRetryAttempts for the node.
894
+ * @default 30
895
+ */
896
+ maxRetryAttempts?: number;
897
+ /** The retryDelayMs for the node.
898
+ * @default 60000
899
+ */
900
+ retryDelayMs?: number;
901
+ /** Whether to resume the previous session.
902
+ * @default false
903
+ */
904
+ enableSessionResumeOption?: boolean;
905
+ /** The time the lavalink server will wait before it removes the player.
906
+ * @default 1000
907
+ */
908
+ sessionTimeoutMs?: number;
909
+ /** The timeout used for api calls.
910
+ * @default 10000
911
+ */
912
+ apiRequestTimeoutMs?: number;
913
+ /** Priority of the node.
914
+ * @default 0
915
+ */
916
+ nodePriority?: number;
917
+ /** Whether the node is a NodeLink.
918
+ * @default false
919
+ */
920
+ isNodeLink?: boolean;
921
+ }
488
922
  /**
489
923
  * Discord Packet
490
924
  */
@@ -547,39 +981,76 @@ interface RedisConfig {
547
981
  prefix?: string;
548
982
  }
549
983
  /**
550
- * Player State Update Event
984
+ * JSON Configuration
551
985
  */
552
- interface PlayerStateUpdateEvent {
553
- changeType: PlayerStateEventTypes;
554
- details?: AutoplayChangeEvent | ConnectionChangeEvent | RepeatChangeEvent | PauseChangeEvent | QueueChangeEvent | TrackChangeEvent | VolumeChangeEvent | ChannelChangeEvent;
986
+ interface JsonConfig {
987
+ path: string;
555
988
  }
989
+ /**
990
+ * Player State Update Event
991
+ */
992
+ type PlayerStateUpdateEvent = {
993
+ changeType: PlayerStateEventTypes.TrackChange;
994
+ details: TrackChangeEvent;
995
+ } | {
996
+ changeType: PlayerStateEventTypes.PauseChange;
997
+ details: PauseChangeEvent;
998
+ } | {
999
+ changeType: PlayerStateEventTypes.QueueChange;
1000
+ details: QueueChangeEvent;
1001
+ } | {
1002
+ changeType: PlayerStateEventTypes.ConnectionChange;
1003
+ details: ConnectionChangeEvent;
1004
+ } | {
1005
+ changeType: PlayerStateEventTypes.AutoPlayChange;
1006
+ details: AutoplayChangeEvent;
1007
+ } | {
1008
+ changeType: PlayerStateEventTypes.ChannelChange;
1009
+ details: ChannelChangeEvent;
1010
+ } | {
1011
+ changeType: PlayerStateEventTypes.VolumeChange;
1012
+ details: VolumeChangeEvent;
1013
+ } | {
1014
+ changeType: PlayerStateEventTypes.RepeatChange;
1015
+ details: RepeatChangeEvent;
1016
+ };
1017
+ /**
1018
+ * Player State Change Data
1019
+ */
1020
+ type PlayerStateChangeData = AutoplayChangeEvent | ConnectionChangeEvent | RepeatChangeEvent | PauseChangeEvent | QueueChangeEvent | TrackChangeEvent | VolumeChangeEvent | ChannelChangeEvent;
556
1021
  /**
557
1022
  * Autoplay Change Event
558
1023
  */
559
1024
  interface AutoplayChangeEvent {
560
- previousAutoplay: boolean;
561
- currentAutoplay: boolean;
1025
+ type: "autoplay";
1026
+ action: "toggle";
1027
+ previousAutoplay: boolean | null;
1028
+ currentAutoplay: boolean | null;
562
1029
  }
563
1030
  /**
564
1031
  * Connection Change Event
565
1032
  */
566
1033
  interface ConnectionChangeEvent {
567
- changeType: "connect" | "disconnect";
568
- previousConnection: boolean;
569
- currentConnection: boolean;
1034
+ type: "connection";
1035
+ action: "connect" | "disconnect";
1036
+ previousConnection: boolean | null;
1037
+ currentConnection: boolean | null;
570
1038
  }
571
1039
  /**
572
1040
  * Repeat Change Event
573
1041
  */
574
1042
  interface RepeatChangeEvent {
575
- changeType: "dynamic" | "track" | "queue" | null;
576
- previousRepeat: string | null;
577
- currentRepeat: string | null;
1043
+ type: "repeat";
1044
+ action: "dynamic" | "track" | "queue" | "none";
1045
+ previousRepeat: "dynamic" | "track" | "queue" | null;
1046
+ currentRepeat: "dynamic" | "track" | "queue" | null;
578
1047
  }
579
1048
  /**
580
1049
  * Pause Change Event
581
1050
  */
582
1051
  interface PauseChangeEvent {
1052
+ type: "pause";
1053
+ action: "pause" | "resume" | "toggle";
583
1054
  previousPause: boolean | null;
584
1055
  currentPause: boolean | null;
585
1056
  }
@@ -587,14 +1058,18 @@ interface PauseChangeEvent {
587
1058
  * Queue Change Event
588
1059
  */
589
1060
  interface QueueChangeEvent {
590
- changeType: "add" | "remove" | "clear" | "shuffle" | "roundRobin" | "userBlock" | "autoPlayAdd";
1061
+ type: "queue";
1062
+ action: "add" | "remove" | "clear" | "shuffle" | "roundRobin" | "userBlock" | "autoPlayAdd";
1063
+ previousQueueLength: number | null;
1064
+ currentQueueLength: number | null;
591
1065
  tracks?: Track[];
592
1066
  }
593
1067
  /**
594
1068
  * Track Change Event
595
1069
  */
596
1070
  interface TrackChangeEvent {
597
- changeType: "start" | "end" | "previous" | "timeUpdate" | "autoPlay";
1071
+ type: "track";
1072
+ action: "start" | "end" | "previous" | "timeUpdate" | "autoPlay";
598
1073
  track: Track;
599
1074
  previousTime?: number | null;
600
1075
  currentTime?: number | null;
@@ -603,6 +1078,8 @@ interface TrackChangeEvent {
603
1078
  * Volume Change Event
604
1079
  */
605
1080
  interface VolumeChangeEvent {
1081
+ type: "volume";
1082
+ action: "adjust";
606
1083
  previousVolume: number | null;
607
1084
  currentVolume: number | null;
608
1085
  }
@@ -610,7 +1087,8 @@ interface VolumeChangeEvent {
610
1087
  * Channel Change Event
611
1088
  */
612
1089
  interface ChannelChangeEvent {
613
- changeType: "text" | "voice";
1090
+ type: "channel";
1091
+ action: "text" | "voice";
614
1092
  previousChannel: string | null;
615
1093
  currentChannel: string | null;
616
1094
  }
@@ -862,7 +1340,7 @@ interface VoiceServer {
862
1340
  }
863
1341
  interface Extendable {
864
1342
  Player: typeof Player;
865
- Queue: typeof Queue;
1343
+ Queue: typeof MemoryQueue | typeof RedisQueue | typeof JsonQueue;
866
1344
  Node: typeof Node;
867
1345
  }
868
1346
  /**
@@ -1014,62 +1492,6 @@ interface PlayerUpdate {
1014
1492
  ping: number;
1015
1493
  };
1016
1494
  }
1017
- /**
1018
- * Node Options
1019
- */
1020
- interface NodeOptions {
1021
- /** The host for the node. */
1022
- host: string;
1023
- /** The port for the node. */
1024
- port?: number;
1025
- /** The password for the node. */
1026
- password?: string;
1027
- /** Whether the host uses SSL. */
1028
- useSSL?: boolean;
1029
- /** The identifier for the node. */
1030
- identifier?: string;
1031
- /** The maxRetryAttempts for the node. */
1032
- maxRetryAttempts?: number;
1033
- /** The retryDelayMs for the node. */
1034
- retryDelayMs?: number;
1035
- /** Whether to resume the previous session. */
1036
- enableSessionResumeOption?: boolean;
1037
- /** The time the lavalink server will wait before it removes the player. */
1038
- sessionTimeoutMs?: number;
1039
- /** The timeout used for api calls. */
1040
- apiRequestTimeoutMs?: number;
1041
- /** Priority of the node. */
1042
- nodePriority?: number;
1043
- /** Whether the node is a NodeLink. */
1044
- isNodeLink?: boolean;
1045
- }
1046
- /**
1047
- * NodeOptions interface
1048
- */
1049
- interface NodeOptions {
1050
- /** The host for the node. */
1051
- host: string;
1052
- /** The port for the node. */
1053
- port?: number;
1054
- /** The password for the node. */
1055
- password?: string;
1056
- /** Whether the host uses SSL. */
1057
- useSSL?: boolean;
1058
- /** The identifier for the node. */
1059
- identifier?: string;
1060
- /** The maxRetryAttempts for the node. */
1061
- maxRetryAttempts?: number;
1062
- /** The retryDelayMs for the node. */
1063
- retryDelayMs?: number;
1064
- /** Whether to resume the previous session. */
1065
- enableSessionResumeOption?: boolean;
1066
- /** The time the lavalink server will wait before it removes the player. */
1067
- sessionTimeoutMs?: number;
1068
- /** The timeout used for api calls. */
1069
- apiRequestTimeoutMs?: number;
1070
- /** Priority of the node. */
1071
- nodePriority?: number;
1072
- }
1073
1495
  /**
1074
1496
  * NodeStats interface
1075
1497
  */
@@ -1599,7 +2021,7 @@ declare class Node$1 {
1599
2021
  * @param {TrackEndEvent} payload - The payload of the event emitted by the node.
1600
2022
  * @private
1601
2023
  */
1602
- protected trackEnd(player: Player, track: Track, payload: TrackEndEvent): Promise<void>;
2024
+ trackEnd(player: Player, track: Track, payload: TrackEndEvent): Promise<void>;
1603
2025
  /**
1604
2026
  * Handles autoplay logic for a player.
1605
2027
  * This method is responsible for selecting an appropriate method of autoplay
@@ -1816,7 +2238,7 @@ declare class Node$1 {
1816
2238
  }
1817
2239
 
1818
2240
  /**
1819
- * The main hub for interacting with Lavalink and using Magmastream,
2241
+ * The main hub for interacting with Lavalink and using Magmastream.
1820
2242
  */
1821
2243
  declare class Manager extends EventEmitter {
1822
2244
  /** The map of players. */
@@ -2018,17 +2440,23 @@ declare class Manager extends EventEmitter {
2018
2440
  * @param player The Player instance to serialize
2019
2441
  * @returns The serialized Player instance
2020
2442
  */
2021
- serializePlayer(player: Player): Record<string, unknown>;
2443
+ serializePlayer(player: Player): Promise<Record<string, unknown>>;
2444
+ /**
2445
+ * Cleans up inactive players by removing their state files from the file system.
2446
+ * This is done to prevent stale state files from accumulating on the file system.
2447
+ */
2448
+ cleanupInactivePlayers(): Promise<void>;
2022
2449
  /**
2023
- * Checks for players that are no longer active and deletes their saved state files.
2450
+ * Cleans up an inactive player by removing its state files from the file system.
2024
2451
  * This is done to prevent stale state files from accumulating on the file system.
2452
+ * @param guildId The guild ID of the player to clean up.
2025
2453
  */
2026
- private cleanupInactivePlayers;
2454
+ cleanupInactivePlayer(guildId: string): Promise<void>;
2027
2455
  /**
2028
2456
  * Clears all player states from the file system.
2029
2457
  * This is done to prevent stale state files from accumulating on the file system.
2030
2458
  */
2031
- private clearAllPlayerStates;
2459
+ private clearAllStoredPlayers;
2032
2460
  /**
2033
2461
  * Returns the nodes that has the least load.
2034
2462
  * The load is calculated by dividing the lavalink load by the number of cores.
@@ -2930,5 +3358,36 @@ declare class OceanicManager extends Manager {
2930
3358
  protected send(packet: GatewayVoiceStateUpdate): void;
2931
3359
  }
2932
3360
 
2933
- export { AutoPlayPlatform, AutoPlayUtils, AvailableFilters, DetritusManager, DiscordJSManager, ErisManager, Filters, LoadTypes, Manager, ManagerEventTypes, Node$1 as Node, OceanicManager, Player, PlayerStateEventTypes, Plugin$1 as Plugin, Queue, Rest, SearchPlatform, SeverityTypes, SponsorBlockSegment, StateStorageType, StateTypes, Structure, TrackEndReasonTypes, TrackPartial, TrackSourceTypes, TrackUtils, UseNodeOptions };
2934
- export type { CPUStats, DiscordPacket, EndSpeakingEventVoiceReceiver, EndSpeakingEventVoiceReceiverData, EqualizerBand, ErrorOrEmptySearchResult, Exception, Extendable, FrameStats, IQueue, 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, 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 };
3361
+ /**
3362
+ * Seyfert wrapper for Magmastream.
3363
+ *
3364
+ * @note This wrapper does require the manual implementation of the "raw" and "ready" events, to call the `updateVoiceState` and `init` methods respectively.
3365
+ *
3366
+ * @example
3367
+ * ```typescript
3368
+ * const client = new Client();
3369
+ * const manager = new SeyfertManager(client, options);
3370
+ *
3371
+ * client.events.values.RAW = {
3372
+ * data: { name: "raw" },
3373
+ * run: async (data) => {
3374
+ * await manager.updateVoiceState(data);
3375
+ * }
3376
+ * }
3377
+ *
3378
+ * client.events.values.READY = {
3379
+ * data: { name: "ready" },
3380
+ * run: async (user, client) => {
3381
+ * await manager.init({ clientId: client.botId });
3382
+ * }
3383
+ * }
3384
+ * ```
3385
+ */
3386
+ declare class SeyfertManager extends Manager {
3387
+ readonly client: Client$3;
3388
+ constructor(client: Client$3, options?: ManagerOptions);
3389
+ protected send(packet: GatewayVoiceStateUpdate): void;
3390
+ }
3391
+
3392
+ export { AutoPlayPlatform, AutoPlayUtils, AvailableFilters, DetritusManager, DiscordJSManager, ErisManager, Filters, JsonQueue, LoadTypes, Manager, ManagerEventTypes, MemoryQueue, Node$1 as Node, OceanicManager, Player, PlayerStateEventTypes, Plugin$1 as Plugin, RedisQueue, Rest, SearchPlatform, SeverityTypes, SeyfertManager, SponsorBlockSegment, StateStorageType, StateTypes, Structure, TrackEndReasonTypes, TrackPartial, TrackSourceTypes, TrackUtils, UseNodeOptions };
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 };