-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.d.ts
1665 lines (1625 loc) · 59.1 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Generated by dts-bundle v0.7.3
// Dependencies for this module:
// @discordjs/voice
// ytdl-core
// soundcloud-downloader
// tiny-typed-emitter
// prism-media
// stream
// fs/promises
// axios
// m3u8stream
// soundcloud-downloader/src/info
// youtube-scrapper
declare module 'discord-media-player' {
/**
* The current installed version of the package
*/
export const version: string;
export * from "discord-media-player/dist/audio/AudioManager";
export * from "discord-media-player/dist/audio/AudioPlayer";
export * from "discord-media-player/dist/audio/AudioPlayerImpl";
export * from "discord-media-player/dist/cache/Cache";
export * from "discord-media-player/dist/cache/CacheManager";
export * from "discord-media-player/dist/cache/CacheManagerImpl";
export * from "discord-media-player/dist/cache/CacheWriter";
export * from "discord-media-player/dist/cache/CacheReader";
export * from "discord-media-player/dist/cache/PacketReader";
import * as _ErrorCode from "discord-media-player/dist/util/ErrorCode";
import * as _Filters from "discord-media-player/dist/util/Filters";
import * as _noop from "discord-media-player/dist/util/noop";
import * as _Resource from "discord-media-player/dist/util/Resource";
import * as _Skipper from "discord-media-player/dist/util/Skipper";
import * as _SourceType from "discord-media-player/dist/util/SourceType";
/**
* Package helper utility
*/
export namespace Util {
export import ErrorCode = _ErrorCode.ErrorCode;
export import Filters = _Filters.Filters;
export import noop = _noop.noop;
export import Resource = _Resource.Resource;
export import ResourceOptions = _Resource.ResourceOptions;
export import Skipper = _Skipper.Skipper;
export import SourceType = _SourceType.SourceType;
}
import * as _downloadMedia from "discord-media-player/dist/soundcloudUtil/downloadMedia";
import * as _transcoding from "discord-media-player/dist/soundcloudUtil/transcoding";
import * as _util from "discord-media-player/dist/soundcloudUtil/util";
/**
* Soundcloud (soundcloud-downloader) utility
*
* Copied from "https://www.npmjs.com/package/soundcloud-downloader"
*/
export namespace SoundcloudUtil {
export import downloadMedia = _downloadMedia.downloadMedia;
export import appendURL = _util.appendURL;
export import handleRequestErrs = _util.handleRequestErrs;
export import validateMedia = _util.validateMedia;
export import FORMATS = _transcoding.FORMATS;
export import STREAMING_PROTOCOLS = _transcoding.STREAMING_PROTOCOLS;
export import Transcoding = _transcoding.Transcoding;
}
export * as ValidationUtil from "discord-media-player/dist/validation";
export * from "discord-media-player/dist/queue";
}
declare module 'discord-media-player/dist/audio/AudioManager' {
import type { ErrorCode } from "discord-media-player/dist/util/ErrorCode";
import type { CacheManager } from "discord-media-player/dist/cache/CacheManager";
import type { VoiceConnection } from "@discordjs/voice";
import type { downloadOptions } from "ytdl-core";
import type { AudioPlayer } from "discord-media-player/dist/audio/AudioPlayer";
import SCDL from "soundcloud-downloader";
import { TypedEmitter } from "tiny-typed-emitter";
type createAudioPlayerType = () => AudioPlayer;
/**
* The options for AudioManager
*/
export interface AudioManagerOptions {
/**
* The audio cache manager
*/
cache?: CacheManager;
/**
* The directory where the audio cache is saved
*/
cacheDir?: string;
/**
* The timeout for cache deletion (in ms)
*/
cacheTimeout?: number;
/**
* Abort the player after reaching timeout on buffering (in ms), default to 7 seconds
*/
bufferTimeout?: number;
/**
* The downloadOptions (ytdl-core) when getting audio source from youtube
*/
youtubeOptions?: downloadOptions;
/**
* The soundcloud client (soundcloud-downloader) when getting audio source from soundcloud
*/
soundcloudClient?: typeof SCDL;
/**
* Custom method for creating audio player implementation
*/
createAudioPlayer?: createAudioPlayerType;
}
export interface AudioManagerEvents {
/**
* @param guildID The guildID of the linked connection in player
* @param urlOrLocation The audio url or location
*/
audioStart(guildID: string, urlOrLocation: string): void;
/**
* @param guildID The guildID of the linked connection in player
* @param urlOrLocation The audio url or location
*/
audioEnd(guildID: string, urlOrLocation: string): void;
/**
* @param guildID The guildID of the linked connection in player
* @param urlOrLocation The audio url or location
* @param errorCode The error code to identify error
*/
audioError(guildID: string, urlOrLocation: string, errorCode: ErrorCode): void;
}
/**
* The manager of the audio players
*/
export class AudioManager extends TypedEmitter<AudioManagerEvents> {
/**
* Emitted whenever an audio is started playing
*
* Listener must implement {@link AudioManagerEvents.audioStart | AudioStartCallback}
* @event
*/
static AUDIO_START: string;
/**
* Emitted whenever an audio is ended after playing
*
* Listener must implement {@link AudioManagerEvents.audioEnd | AudioEndCallback}
* @event
*/
static AUDIO_END: string;
/**
* Emitted whenever an error is thrown while getting audio source before playing
*
* Listener must implement {@link AudioManagerEvents.audioError | AudioErrorCallback}
* @event
*/
static AUDIO_ERROR: string;
/**
* The audio cache manager
*/
readonly cache?: CacheManager;
/**
* Abort the player after reaching timeout on buffering (in ms), default to 7 seconds
*/
readonly bufferTimeout?: number;
/**
* The soundcloud client (soundcloud-downloader) when getting audio source
*/
readonly soundcloud: typeof SCDL;
/**
* The downloadOptions (ytdl-core) when getting audio source
*/
readonly youtube: downloadOptions;
/**
* @param options The options to create new audio player manager
*/
constructor(options: AudioManagerOptions);
/**
* Get player from list if exist, otherwise create new
* @param connection The voice connection
* @returns The audio player
*/
getPlayer(connection: VoiceConnection): AudioPlayer;
/**
* Delete player from list and unlink it
* @param connection The voice connection
* @returns false if failed or doesn't exist, true if deleted
*/
deletePlayer(connection: VoiceConnection): boolean;
/**
* @internal
*/
_deletePlayerIfExist(guildID: string): void;
}
export {};
}
declare module 'discord-media-player/dist/audio/AudioPlayer' {
import type { Filters } from "discord-media-player/dist/util/Filters";
import type { AudioManager } from "discord-media-player/dist/audio/AudioManager";
import type { TypedEmitter } from "tiny-typed-emitter";
import type { VoiceConnection, AudioPlayerStatus } from "@discordjs/voice";
export interface PlayerEvents {
unlink(): void;
pause(): void;
unpause(): void;
end(): void;
}
/**
* The instance to manage and play audio to discord
*/
export interface AudioPlayer extends TypedEmitter<PlayerEvents> {
/**
* The manager of the audio player
*/
manager: AudioManager;
/**
* The linked connection guild id
*/
guildID: string;
/**
* The discord player status
*/
status: AudioPlayerStatus;
/**
* Whether or not the audio player is playing audio.
*/
playing: boolean;
/**
* For how long this player has been playing audio (in ms)
*/
playbackDuration: number;
/**
* Set the manager of the audio player
* @param manager The audio manager
*/
setManager(manager: AudioManager): void;
/**
* Link the voice connection to the audio player
* @param connection The voice connection
*/
link(connection: VoiceConnection): void;
/**
* Unlink the audio player from the previous voice connection
*/
unlink(): void;
/**
* Set filters into the audio player
* @param filter The filters
*/
setFilter(filter?: Filters): void;
/**
* Set volume of the audio
* @param volume The volume
*/
setVolume(volume: number): void;
/**
* Stop the audio
*/
stop(): boolean;
/**
* Loop the audio
*/
loop(): boolean;
/**
* Pause the audio
*/
pause(forcePauseUnpause?: boolean): boolean;
/**
* Filter the audio
*/
filter(): void;
/**
* Seek the audio
* @param seconds The position to seek to
*/
seek(seconds: number): Promise<void>;
/**
* Play an audio
* @param urlOrLocation The url or location of the audio source
* @param sourceType The source type to identify the source
*/
play(urlOrLocation: string, sourceType: number): Promise<void>;
/**
* Switch to playing cache instead of resource
*
* This method must not be used by user directly,
* it is used for custom player implementation to work
* with cache
*/
_switchCache(): void;
}
}
declare module 'discord-media-player/dist/audio/AudioPlayerImpl' {
import type { Filters } from "discord-media-player/dist/util/Filters";
import type { AudioManager } from "discord-media-player/dist/audio/AudioManager";
import type { SourceType } from "discord-media-player/dist/util/SourceType";
import type { AudioPlayer, PlayerEvents } from "discord-media-player/dist/audio/AudioPlayer";
import type { VoiceConnection } from "@discordjs/voice";
import { AudioPlayerStatus } from "@discordjs/voice";
import { TypedEmitter } from "tiny-typed-emitter";
/**
* The default implementation of {@link AudioPlayer | AudioPlayer}
*/
export class AudioPlayerImpl extends TypedEmitter<PlayerEvents> implements AudioPlayer {
/**
* Emitted when player is unlinked from connection
* @event
*/
static UNLINK: string;
/**
* Emitted whenever player is paused
* @event
*/
static PAUSE: string;
/**
* Emitted whenever player is unpaused
* @event
*/
static UNPAUSE: string;
/**
* Emitted whenever an audio is ended
* @event
*/
static END: string;
/**
* @internal
*/
manager: AudioManager;
/**
* @internal
*/
constructor();
/**
* @internal
*/
get guildID(): string;
/**
* @internal
*/
get status(): AudioPlayerStatus;
/**
* @internal
*/
get playing(): boolean;
/**
* @internal
*/
get playbackDuration(): number;
/**
* @internal
*/
setManager(manager: AudioManager): void;
/**
* @internal
*/
link(connection: VoiceConnection): void;
/**
* @internal
*/
unlink(): void;
/**
* @internal
*/
setFilter(filter: Filters): void;
/**
* @internal
*/
setVolume(volume: number): void;
/**
* @internal
*/
stop(): boolean;
/**
* @internal
*/
loop(): boolean;
/**
* @internal
*/
pause(pauseOrUnpause?: boolean): boolean;
/**
* @internal
*/
filter(): void;
/**
* @internal
*/
seek(seconds: number): Promise<void>;
/**
* @internal
*/
play(urlOrLocation: string, sourceType: SourceType): Promise<void>;
/**
* @internal
*/
_switchCache(): void;
}
}
declare module 'discord-media-player/dist/cache/Cache' {
import type { Resource } from "discord-media-player/dist/util/Resource";
import { opus } from "prism-media";
import { CacheReader } from "discord-media-player/dist/cache/CacheReader";
/**
* The options for cache instance
*/
export interface CacheOptions {
path?: string;
timeout?: number;
}
/**
* The cache instance to manage cache for a source
*/
export class Cache {
/**
* The timeout for deleting cache after inactivity
*/
timeout: number;
/**
* @param dir The directory of the cache
*/
constructor(dir: string);
/**
* The full path of base directory and directory
*/
get path(): string;
/**
* Set the options for cache
* @param options The cache options
*/
setOptions(options: CacheOptions): void;
/**
* Create a new cache
* @param identifier The audio identifier
* @param resource The audio resource
* @returns The OpusEncoder stream to compress and write cache
*/
create(identifier: string, resource: Resource): opus.Encoder;
/**
* Read an existing cache
* @param identifier The audio identifier
* @param startOnSeconds Start reading cache on specific second of audio
* @returns The OpusDecoder stream of audio
*/
read(identifier: string, startOnSeconds?: number): opus.Decoder;
/**
* Check if cache exist
* @param identifier The audio identifier
* @returns true if exist, otherwise false
*/
hasCache(identifier: string): boolean;
/**
* Get the audio resource from an existing cache
* @param identifier The audio identifier
* @returns The audio resource
*/
getResource(identifier: string): Resource;
/**
* Get the cache reader of decoder from cache
* @param decoder The opus decoder
* @returns The cache reader
*/
getReader(decoder: opus.Decoder): CacheReader;
}
}
declare module 'discord-media-player/dist/cache/CacheManager' {
import type { Cache } from "discord-media-player/dist/cache/Cache";
export interface CacheManager {
/**
* The base directory of the caches
*/
path: string;
/**
* The timeout for deleting cache after inactivity
*/
timeout: number;
/**
* Audio cache from youtube source
*/
readonly youtube: Cache;
/**
* Audio cache from soundcloud source
*/
readonly soundcloud: Cache;
/**
* Audio cache from local source
*/
readonly local: Cache;
/**
* Set the cache deletion timeout of the caches
* @param timeout The cache timeout
*/
setTimeout(timeout: number): void;
/**
* Set the base directory of the caches
* @param path The base directory
*/
setPath(path: string): void;
/**
* A function to force delete cache directory
*/
delete?(): void | Promise<void>;
}
}
declare module 'discord-media-player/dist/cache/CacheManagerImpl' {
import type { CacheManager } from "discord-media-player/dist/cache/CacheManager";
import { Cache } from "discord-media-player/dist/cache/Cache";
/**
* The default implementation of {@link CacheManager | CacheManager}
*/
export class CacheManagerImpl implements CacheManager {
/**
* @internal
*/
path: string;
/**
* @internal
*/
timeout: number;
/**
* @internal
*/
readonly youtube: Cache;
/**
* @internal
*/
readonly soundcloud: Cache;
/**
* @internal
*/
readonly local: Cache;
/**
* @internal
*/
readonly deleter: import("child_process").ChildProcess;
/**
* @internal
*/
constructor();
/**
* @internal
*/
setTimeout(timeout: number): void;
/**
* @internal
*/
setPath(path: string): void;
/**
* @internal
*/
delete(): Promise<void>;
}
}
declare module 'discord-media-player/dist/cache/CacheWriter' {
import type { opus } from "prism-media";
import type { Resource } from "discord-media-player/dist/util/Resource";
import type { TransformCallback } from "stream";
import { Transform } from "stream";
/**
* The instance to write audio into cache
*/
export class CacheWriter extends Transform {
/**
* The cache OpusEncoder stream
*/
get writeStream(): opus.Encoder;
/**
* Set the audio resource
* @param resource The audio resource
*/
setResource(resource: Resource): void;
/**
* @internal
*/
_transform(chunk: Buffer, _: BufferEncoding, cb: TransformCallback): void;
/**
* @internal
*/
_flush(cb: TransformCallback): void;
/**
* @internal
*/
pipe<T extends NodeJS.WritableStream>(destination: T, options?: {
end?: boolean;
}): T;
/**
* @internal
*/
unpipe<T extends NodeJS.WritableStream>(destination?: T): this;
}
}
declare module 'discord-media-player/dist/cache/CacheReader' {
import type { Packet } from "discord-media-player/dist/cache/PacketReader";
import type { FileHandle } from "fs/promises";
import { Readable } from "stream";
/**
* An instance to appropriately read opus packet
*/
export class CacheReader extends Readable {
/**
* How many packets has been read (in ms)
*/
packetRead: number;
/**
* @param packets The array of packets
* @param file The file to read
* @param ms Where to start reading (in ms)
*/
constructor(packets: Array<Packet>, file: Promise<FileHandle>, ms: number);
/**
* @internal
*/
_read(): Promise<void>;
}
}
declare module 'discord-media-player/dist/cache/PacketReader' {
import type { TransformCallback } from "stream";
import { Transform } from "stream";
/**
* The metadata of packets including packet size and packet frames count
*/
export interface Packet {
size: number;
frames: number;
}
/**
* An instance to mark the packet size and frames in packet
*/
export class PacketReader extends Transform {
/**
* @param packets The allocated array of packets
*/
constructor(packets: Array<Packet>);
/**
* @internal
*/
_transform(packet: Buffer, _: BufferEncoding, cb: TransformCallback): void;
}
}
declare module 'discord-media-player/dist/util/ErrorCode' {
/**
* The error codes of audio player
*/
export enum ErrorCode {
noFormatOrMedia = 0,
cannotOpenFile = 1,
youtubeNoPlayerResponse = 2,
youtubeUnplayable = 3,
youtubeLoginRequired = 4,
noResource = 5,
timedOut = 6
}
}
declare module 'discord-media-player/dist/util/Filters' {
/**
* https://ffmpeg.org/ffmpeg-filters.html#Audio-Filters
*
* { filterName: "filterValue" }
*
* Leave "filterValue" as blank "", if no value
*/
export interface Filters {
acompressor?: string;
aconstrast?: string;
acrossfade?: string;
acrossover?: string;
acrusher?: string;
adeclick?: string;
adeclip?: string;
adelay?: string;
adenorm?: string;
aecho?: string;
aemphasis?: string;
aexciter?: string;
afade?: string;
afftdn?: string;
afftfilt?: string;
afir?: string;
afreqshift?: string;
agate?: string;
aiir?: string;
allpass?: string;
anequalizer?: string;
anlmdn?: string;
apad?: string;
aphaser?: string;
aphaseshift?: string;
apulsator?: string;
aresample?: string;
arnndn?: string;
asetnsamples?: string;
asetrate?: string;
asoftclip?: string;
asubbost?: string;
asubcut?: string;
asupercut?: string;
asuperpass?: string;
asuperstop?: string;
atempo?: string;
bandpass?: string;
bandreject?: string;
bass?: string;
biquad?: string;
chorus?: string;
compand?: string;
compensationdelay?: string;
crossfeed?: string;
crystalizer?: string;
dcshift?: string;
deesser?: string;
dynaudnorm?: string;
earwax?: string;
equalizer?: string;
extrastereo?: string;
firequalizer?: string;
flanger?: string;
haas?: string;
headphone?: string;
highpass?: string;
highshelf?: string;
loudnorm?: string;
lowpass?: string;
lowshelf?: string;
mcompand?: string;
silenceremove?: string;
speechnorm?: string;
stereowiden?: string;
superequalizer?: string;
surround?: string;
treble?: string;
vibrato?: string;
}
}
declare module 'discord-media-player/dist/util/noop' {
/**
* Empty function (NO-OP)
*/
export function noop(): void;
}
declare module 'discord-media-player/dist/util/Resource' {
import type { Cache } from "discord-media-player/dist/cache/Cache";
import type { CacheWriter } from "discord-media-player/dist/cache/CacheWriter";
import type { AudioPlayer } from "discord-media-player/dist/audio/AudioPlayer";
import type { Readable, Transform, Duplex } from "stream";
/**
* Options for making audio resource
*/
export interface ResourceOptions {
/**
* The audio player that create the audio resource
*/
player: AudioPlayer;
/**
* The audio identifier
*/
identifier: string;
/**
* The audio decoder
*/
decoder: Transform | Duplex;
/**
* The audio source
*/
source: Readable;
/**
* The audio cache writer
*/
cacheWriter: CacheWriter;
/**
* The cache instance of audio source
*/
cache?: Cache;
/**
* true if the audio source is livestream, otherwise false
*/
isLive?: boolean;
/**
* The audio demuxer
*/
demuxer?: Transform;
}
/**
* The audio resource instance
*/
export class Resource {
/**
* The audio cached in seconds
*/
cachedSecond: number;
/**
* true if all audio is cached, otherwise false
*/
allCached: boolean;
/**
* true if the audio source is livestream, otherwise false
*/
readonly isLive: boolean;
/**
* The audio identifier
*/
readonly identifier: string;
/**
* The audio decoder
*/
readonly decoder: Transform | Duplex;
/**
* The audio source
*/
readonly source: Readable;
/**
* The cache instance of audio source
*/
readonly cache?: Cache;
/**
* The audio demuxer
*/
readonly demuxer?: Transform;
/**
* The audio cache writer
*/
readonly cacheWriter?: CacheWriter;
/**
* @param options The options to create audio resource
*/
constructor(options: ResourceOptions);
set player(player: AudioPlayer);
get player(): AudioPlayer;
set autoPaused(paused: boolean);
get autoPaused(): boolean;
}
}
declare module 'discord-media-player/dist/util/Skipper' {
import type { CacheWriter } from "discord-media-player/dist/cache/CacheWriter";
import { Writable } from "stream";
/**
* The instance for skipping the audio
*/
export class Skipper extends Writable {
/**
* @param seconds The amount to skip in second
* @param _cacheWriter The audio cache writer
*/
constructor(seconds: number, _cacheWriter: CacheWriter);
/**
* @internal
*/
_write(chunk: Buffer, _: BufferEncoding, cb: () => void): void;
/**
* @internal
*/
_final(cb: () => void): void;
}
}
declare module 'discord-media-player/dist/util/SourceType' {
/**
* The source type of the audio source
*/
export enum SourceType {
youtube = 0,
soundcloud = 1,
local = 2
}
}
declare module 'discord-media-player/dist/soundcloudUtil/downloadMedia' {
import type { AxiosInstance } from "axios";
import type { Transcoding } from "discord-media-player/dist/soundcloudUtil/transcoding";
import type { Readable } from "stream";
import m3u8stream from "m3u8stream";
/**
* Download a specific media transcoding from soundcloud
* @param media The audio media transcoding
* @param clientID The soundcloud client id
* @param axiosInstance The axios instance
* @returns The audio source stream
*
* Copied from "https://www.npmjs.com/package/soundcloud-downloader"
*/
export function downloadMedia(media: Transcoding, clientID: string, axiosInstance: AxiosInstance): Promise<Readable | m3u8stream.Stream>;
}
declare module 'discord-media-player/dist/soundcloudUtil/transcoding' {
/**
* The streaming protocols (protocol) of media transcoding
*
* Copied from "https://www.npmjs.com/package/soundcloud-downloader"
*/
export enum STREAMING_PROTOCOLS {
HLS = "hls",
PROGRESSIVE = "progressive"
}
/**
* The format (mime_type) of media transcoding
*
* Copied from "https://www.npmjs.com/package/soundcloud-downloader"
*/
export enum FORMATS {
MP3 = "audio/mpeg",
OPUS = "audio/ogg; codecs=\"opus\""
}
/**
* The interface of media transcoding
*
* Copied from "https://www.npmjs.com/package/soundcloud-downloader"
*/
export interface Transcoding {
url: string;
preset: string;
snipped: boolean;
format: {
protocol: STREAMING_PROTOCOLS;
mime_type: FORMATS;
};
}
}
declare module 'discord-media-player/dist/soundcloudUtil/util' {
import type { AxiosError } from "axios";
import type { Transcoding } from "discord-media-player/dist/soundcloudUtil/transcoding";
/**
* Handle axios error
* @param err The axios error
* @returns The handle'd axios error
*
* Copied from "https://www.npmjs.com/package/soundcloud-downloader"
*/
export function handleRequestErrs(err: AxiosError): AxiosError;
/**
* Append parameters into url
* @param baseURL The base url
* @param params The parameters
* @returns The appended url
*
* Copied from "https://www.npmjs.com/package/soundcloud-downloader"
*/
export function appendURL(baseURL: string, ...params: string[]): string;
/**
* Validate the media transcoding
* @param media The media transcoding
* @returns true if valid, otherwise false
*
* Copied from "https://www.npmjs.com/package/soundcloud-downloader"
*/
export function validateMedia(media: Transcoding): boolean;
}
declare module 'discord-media-player/dist/validation' {
export * from "discord-media-player/dist/validation/PlayerError";
export * as AudioManagerValidation from "discord-media-player/dist/validation/ManagerValidation";
export * as AudioPlayerValidation from "discord-media-player/dist/validation/PlayerValidation";
export * as CacheValidation from "discord-media-player/dist/validation/CacheValidation";
export * as CacheManagerValidation from "discord-media-player/dist/validation/CacheManagerValidation";
export * as CacheWriterValidation from "discord-media-player/dist/validation/CacheWriterValidation";
export * as ResourceValidation from "discord-media-player/dist/validation/ResourceValidation";
export * as SkipperValidation from "discord-media-player/dist/validation/SkipperValidation";
export * as QueueManagerValidation from "discord-media-player/dist/validation/QueueManagerValidation";
export * as QueueHandlerValidation from "discord-media-player/dist/validation/QueueHandlerValidation";
export * as QueueValidation from "discord-media-player/dist/validation/QueueValidation";
export * as TrackValidation from "discord-media-player/dist/validation/TrackValidation";
export * as PacketReaderValidation from "discord-media-player/dist/validation/PacketReaderValidation";
export * as CacheReaderValidation from "discord-media-player/dist/validation/CacheReaderValidation";
}
declare module 'discord-media-player/dist/queue' {
export * from "discord-media-player/dist/queue/QueueManager";
export * from "discord-media-player/dist/queue/QueueHandler";
export * from "discord-media-player/dist/queue/Queue";
export * from "discord-media-player/dist/queue/Track";
}
declare module 'discord-media-player/dist/validation/PlayerError' {
/**
* Validate the error of PlayerError
* @param error The error
*/
export function validateError(error: ErrorType): void;
/**
* THe error interface of PlayerError
*/
export interface ErrorType {
/**
* The message of the error
*/
message: string;
/**
* Error code of the error
*
* 0-99 For built-in player error
*
* 100-??? for custom player error
*/
code: number;