discord-player 6.6.3 → 6.6.5-dev.0

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
@@ -31,6 +31,7 @@ interface CreateStreamOps {
31
31
  volume?: number;
32
32
  disableResampler?: boolean;
33
33
  sampleRate?: number;
34
+ skipFFmpeg?: boolean;
34
35
  }
35
36
  interface VoiceEvents {
36
37
  error: (error: AudioPlayerError) => any;
@@ -145,6 +146,7 @@ declare class StreamDispatcher extends EventEmitter<VoiceEvents> {
145
146
  /**
146
147
  * Play stream
147
148
  * @param {AudioResource<Track>} [resource=this.audioResource] The audio resource to play
149
+ * @param {boolean} [opus=false] Whether or not to use opus
148
150
  * @returns {Promise<StreamDispatcher>}
149
151
  */
150
152
  playStream(resource?: AudioResource<Track>): Promise<this | undefined>;
@@ -172,7 +174,7 @@ interface VoiceReceiverOptions {
172
174
  silenceDuration?: number;
173
175
  crc?: boolean;
174
176
  }
175
- type RawTrackInit = Partial<Omit<RawTrackData, 'author' | 'playlist' | 'source' | 'engine' | 'raw' | 'queryType' | 'description' | 'views'>>;
177
+ declare type RawTrackInit = Partial<Omit<RawTrackData, 'author' | 'playlist' | 'source' | 'engine' | 'raw' | 'queryType' | 'description' | 'views'>>;
176
178
  declare class VoiceReceiverNode {
177
179
  dispatcher: StreamDispatcher;
178
180
  constructor(dispatcher: StreamDispatcher);
@@ -252,7 +254,7 @@ interface AsyncQueueAcquisitionOptions {
252
254
  */
253
255
  signal?: AbortSignal;
254
256
  }
255
- type AsyncQueueExceptionHandler = (exception: Error) => void;
257
+ declare type AsyncQueueExceptionHandler = (exception: Error) => void;
256
258
  declare class AsyncQueue {
257
259
  /**
258
260
  * The queued entries
@@ -513,8 +515,8 @@ declare function FFMPEG_ARGS_PIPED(fmt?: string): string[];
513
515
  */
514
516
  declare function createFFmpegStream(stream: Readable | Duplex | string, options?: FFmpegStreamOptions): Readable;
515
517
 
516
- type Filters = keyof typeof AudioFilters.filters;
517
- type EQPreset = {
518
+ declare type Filters = keyof typeof AudioFilters.filters;
519
+ declare type EQPreset = {
518
520
  Flat: EqualizerBand[];
519
521
  Classical: EqualizerBand[];
520
522
  Club: EqualizerBand[];
@@ -539,6 +541,10 @@ declare class FFmpegFilterer<Meta = unknown> {
539
541
  #private;
540
542
  af: GuildQueueAudioFilters<Meta>;
541
543
  constructor(af: GuildQueueAudioFilters<Meta>);
544
+ /**
545
+ * Indicates whether ffmpeg may be skipped
546
+ */
547
+ get skippable(): boolean;
542
548
  /**
543
549
  * Set input args for FFmpeg
544
550
  */
@@ -736,6 +742,11 @@ interface GuildNodeInit<Meta = unknown> {
736
742
  maxHistorySize?: number;
737
743
  preferBridgedMetadata: boolean;
738
744
  pauseOnEmpty?: boolean;
745
+ disableVolume: boolean;
746
+ disableEqualizer: boolean;
747
+ disableFilterer: boolean;
748
+ disableBiquad: boolean;
749
+ disableResampler: boolean;
739
750
  }
740
751
  interface VoiceConnectConfig {
741
752
  deaf?: boolean;
@@ -747,9 +758,9 @@ interface PostProcessedResult {
747
758
  stream: Readable;
748
759
  type: StreamType;
749
760
  }
750
- type OnBeforeCreateStreamHandler = (track: Track, queryType: SearchQueryType, queue: GuildQueue) => Promise<Readable | null>;
751
- type OnAfterCreateStreamHandler = (stream: Readable, queue: GuildQueue) => Promise<PostProcessedResult | null>;
752
- type PlayerTriggeredReason = 'filters' | 'normal';
761
+ declare type OnBeforeCreateStreamHandler = (track: Track, queryType: SearchQueryType, queue: GuildQueue) => Promise<Readable | null>;
762
+ declare type OnAfterCreateStreamHandler = (stream: Readable, queue: GuildQueue) => Promise<PostProcessedResult | null>;
763
+ declare type PlayerTriggeredReason = 'filters' | 'normal';
753
764
  declare const GuildQueueEvent: {
754
765
  /**
755
766
  * Emitted when audio track is added to the queue
@@ -1267,11 +1278,23 @@ declare class GuildQueue<Meta = unknown> {
1267
1278
  get hasDebugger(): boolean;
1268
1279
  }
1269
1280
 
1270
- type TrackResolvable = Track | string | number;
1271
- type WithMetadata<T extends object, M> = T & {
1281
+ declare enum SerializedType {
1282
+ Track = "track",
1283
+ Playlist = "playlist"
1284
+ }
1285
+ declare type Encodable = SerializedTrack | SerializedPlaylist;
1286
+ declare function serialize(data: Track | Playlist | any): any;
1287
+ declare function deserialize(player: Player, data: Encodable): Track<unknown> | Playlist;
1288
+ declare function encode(data: Encodable): string;
1289
+ declare function decode(data: string): any;
1290
+ declare function tryIntoThumbnailString(data: any): any;
1291
+
1292
+ declare type TrackResolvable = Track | string | number;
1293
+ declare type WithMetadata<T extends object, M> = T & {
1272
1294
  metadata: M;
1273
1295
  requestMetadata(): Promise<M>;
1274
1296
  };
1297
+ declare type SerializedTrack = ReturnType<Track['serialize']>;
1275
1298
  declare class Track<T = unknown> {
1276
1299
  readonly player: Player;
1277
1300
  title: string;
@@ -1335,6 +1358,32 @@ declare class Track<T = unknown> {
1335
1358
  * Raw JSON representation of this track
1336
1359
  */
1337
1360
  toJSON(hidePlaylist?: boolean): TrackJSON;
1361
+ /**
1362
+ * Serialized track data that can be reconstructed
1363
+ */
1364
+ serialize(): {
1365
+ title: string;
1366
+ description: string;
1367
+ author: string;
1368
+ url: string;
1369
+ thumbnail: any;
1370
+ duration: string;
1371
+ views: number;
1372
+ requested_by: unknown;
1373
+ source: TrackSource;
1374
+ live: boolean;
1375
+ query_type: SearchQueryType | null | undefined;
1376
+ extractor: string | null;
1377
+ metadata: T | null;
1378
+ $type: SerializedType;
1379
+ $encoder_version: string;
1380
+ };
1381
+ /**
1382
+ * Construct a track from serialized data
1383
+ * @param player Player instance
1384
+ * @param data Serialized data
1385
+ */
1386
+ static fromSerialized(player: Player, data: ReturnType<Track['serialize']>): Track<unknown>;
1338
1387
  /**
1339
1388
  * Get belonging queues of this track
1340
1389
  */
@@ -1347,6 +1396,7 @@ declare class Track<T = unknown> {
1347
1396
  play<T = unknown>(channel: GuildVoiceChannelResolvable, options?: PlayerNodeInitializerOptions<T>): Promise<PlayerNodeInitializationResult<T>>;
1348
1397
  }
1349
1398
 
1399
+ declare type SerializedPlaylist = ReturnType<Playlist['serialize']>;
1350
1400
  declare class Playlist {
1351
1401
  readonly player: Player;
1352
1402
  tracks: Track[];
@@ -1383,6 +1433,51 @@ declare class Playlist {
1383
1433
  * @returns {PlaylistJSON}
1384
1434
  */
1385
1435
  toJSON(withTracks?: boolean): PlaylistJSON;
1436
+ /**
1437
+ * Serialize this playlist into reconstructable data
1438
+ */
1439
+ serialize(): {
1440
+ tracks: {
1441
+ title: string;
1442
+ description: string;
1443
+ author: string;
1444
+ url: string;
1445
+ thumbnail: any;
1446
+ duration: string; /**
1447
+ * Play this playlist to the given voice channel. If queue exists and another track is being played, this playlist will be added to the queue.
1448
+ * @param channel Voice channel on which this playlist shall be played
1449
+ * @param options Node initialization options
1450
+ */
1451
+ views: number;
1452
+ requested_by: unknown;
1453
+ source: TrackSource;
1454
+ live: boolean;
1455
+ query_type: SearchQueryType | null | undefined;
1456
+ extractor: string | null;
1457
+ metadata: unknown;
1458
+ $type: SerializedType;
1459
+ $encoder_version: string;
1460
+ }[];
1461
+ title: string;
1462
+ description: string;
1463
+ thumbnail: any;
1464
+ type: "playlist" | "album";
1465
+ source: TrackSource;
1466
+ author: {
1467
+ name: string;
1468
+ url: string;
1469
+ };
1470
+ id: string;
1471
+ url: string;
1472
+ $type: SerializedType;
1473
+ $encoder_version: string;
1474
+ };
1475
+ /**
1476
+ * Deserialize this playlist from serialized data
1477
+ * @param player Player instance
1478
+ * @param data Serialized data
1479
+ */
1480
+ static fromSerialized(player: Player, data: SerializedPlaylist): Playlist;
1386
1481
  /**
1387
1482
  * Play this playlist to the given voice channel. If queue exists and another track is being played, this playlist will be added to the queue.
1388
1483
  * @param channel Voice channel on which this playlist shall be played
@@ -1479,8 +1574,12 @@ interface ExtractorExecutionResult<T = unknown> {
1479
1574
  error: Error | null;
1480
1575
  result: T;
1481
1576
  }
1482
- type ExtractorExecutionFN<T = unknown> = (extractor: BaseExtractor) => Promise<T | boolean>;
1577
+ declare type ExtractorExecutionFN<T = unknown> = (extractor: BaseExtractor) => Promise<T | boolean>;
1483
1578
 
1579
+ declare type ExtractorStreamable = Readable | string | {
1580
+ $fmt: string;
1581
+ stream: Readable;
1582
+ };
1484
1583
  declare class BaseExtractor<T extends object = object> {
1485
1584
  context: ExtractorExecutionContext;
1486
1585
  options: T;
@@ -1525,7 +1624,7 @@ declare class BaseExtractor<T extends object = object> {
1525
1624
  * Stream the given track
1526
1625
  * @param info The track to stream
1527
1626
  */
1528
- stream(info: Track): Promise<Readable | string>;
1627
+ stream(info: Track): Promise<ExtractorStreamable>;
1529
1628
  /**
1530
1629
  * Handle the given query
1531
1630
  * @param query The query to handle
@@ -1563,8 +1662,12 @@ declare class BaseExtractor<T extends object = object> {
1563
1662
  * IP rotator instance, if available
1564
1663
  */
1565
1664
  get routePlanner(): IPRotator | null;
1665
+ /**
1666
+ * A flag to indicate `Demuxable` stream support for `opus`/`ogg/opus`/`webm/opus` formats.
1667
+ */
1668
+ get supportsDemux(): boolean;
1566
1669
  }
1567
- type NextFunction = (error?: Error | null, stream?: Readable) => void;
1670
+ declare type NextFunction = (error?: Error | null, stream?: Readable) => void;
1568
1671
  interface ExtractorInfo {
1569
1672
  playlist: Playlist | null;
1570
1673
  tracks: Track[];
@@ -1642,7 +1745,7 @@ declare class SearchResult {
1642
1745
  playlist: PlaylistJSON | null;
1643
1746
  tracks: TrackJSON[];
1644
1747
  extractor: string | null;
1645
- requestedBy: {} | null;
1748
+ requestedBy: unknown;
1646
1749
  };
1647
1750
  }
1648
1751
 
@@ -1774,7 +1877,7 @@ interface PlayerNodeInitializationResult<T = unknown> {
1774
1877
  searchResult: SearchResult;
1775
1878
  queue: GuildQueue<T>;
1776
1879
  }
1777
- type TrackLike = string | Track | SearchResult | Track[] | Playlist;
1880
+ declare type TrackLike = string | Track | SearchResult | Track[] | Playlist;
1778
1881
  interface PlayerNodeInitializerOptions<T> extends SearchOptions {
1779
1882
  nodeOptions?: GuildNodeCreateOptions<T>;
1780
1883
  connectionOptions?: VoiceConnectConfig;
@@ -1782,7 +1885,7 @@ interface PlayerNodeInitializerOptions<T> extends SearchOptions {
1782
1885
  signal?: AbortSignal;
1783
1886
  afterSearch?: (result: SearchResult) => Promise<SearchResult>;
1784
1887
  }
1785
- type VoiceStateHandler = (player: Player, queue: GuildQueue, oldVoiceState: VoiceState, newVoiceState: VoiceState) => Awaited<void>;
1888
+ declare type VoiceStateHandler = (player: Player, queue: GuildQueue, oldVoiceState: VoiceState, newVoiceState: VoiceState) => Awaited<void>;
1786
1889
  declare class Player extends PlayerEventsEmitter<PlayerEvents> {
1787
1890
  #private;
1788
1891
  static readonly version: string;
@@ -1955,11 +2058,11 @@ declare class Player extends PlayerEventsEmitter<PlayerEvents> {
1955
2058
 
1956
2059
  interface GuildNodeCreateOptions<T = unknown> {
1957
2060
  strategy?: QueueStrategy;
1958
- volume?: number | boolean;
1959
- equalizer?: EqualizerBand[] | boolean;
1960
- a_filter?: PCMFilters[] | boolean;
1961
- biquad?: BiquadFilters | boolean;
1962
- resampler?: number | boolean;
2061
+ volume?: number;
2062
+ equalizer?: EqualizerBand[];
2063
+ a_filter?: PCMFilters[];
2064
+ biquad?: BiquadFilters;
2065
+ resampler?: number;
1963
2066
  disableHistory?: boolean;
1964
2067
  skipOnNoStream?: boolean;
1965
2068
  onBeforeCreateStream?: OnBeforeCreateStreamHandler;
@@ -1981,8 +2084,13 @@ interface GuildNodeCreateOptions<T = unknown> {
1981
2084
  maxSize?: number;
1982
2085
  maxHistorySize?: number;
1983
2086
  preferBridgedMetadata?: boolean;
2087
+ disableVolume?: boolean;
2088
+ disableEqualizer?: boolean;
2089
+ disableFilterer?: boolean;
2090
+ disableBiquad?: boolean;
2091
+ disableResampler?: boolean;
1984
2092
  }
1985
- type NodeResolvable = GuildQueue | GuildResolvable;
2093
+ declare type NodeResolvable = GuildQueue | GuildResolvable;
1986
2094
  declare class GuildNodeManager<Meta = unknown> {
1987
2095
  player: Player;
1988
2096
  cache: Collection<string, GuildQueue<unknown>>;
@@ -2020,13 +2128,13 @@ declare class GuildNodeManager<Meta = unknown> {
2020
2128
  resolveId(node: NodeResolvable): string | null;
2021
2129
  }
2022
2130
 
2023
- type FiltersName = keyof QueueFilters;
2131
+ declare type FiltersName = keyof QueueFilters;
2024
2132
  interface PlayerSearchResult {
2025
2133
  playlist: Playlist | null;
2026
2134
  tracks: Track[];
2027
2135
  }
2028
2136
  /**
2029
- * @typedef {AudioFilters} QueueFilters
2137
+ * Represents FFmpeg filters
2030
2138
  */
2031
2139
  interface QueueFilters {
2032
2140
  bassboost_low?: boolean;
@@ -2072,71 +2180,112 @@ interface QueueFilters {
2072
2180
  * - spotify
2073
2181
  * - apple_music
2074
2182
  * - arbitrary
2075
- * @typedef {string} TrackSource
2076
- */
2077
- type TrackSource = 'soundcloud' | 'youtube' | 'spotify' | 'apple_music' | 'arbitrary';
2078
- /**
2079
- * @typedef {object} RawTrackData
2080
- * @property {string} title The title
2081
- * @property {string} description The description
2082
- * @property {string} author The author
2083
- * @property {string} url The url
2084
- * @property {string} thumbnail The thumbnail
2085
- * @property {string} duration The duration
2086
- * @property {number} views The views
2087
- * @property {User} requestedBy The user who requested this track
2088
- * @property {Playlist} [playlist] The playlist
2089
- * @property {TrackSource} [source="arbitrary"] The source
2090
- * @property {any} [engine] The engine
2091
- * @property {boolean} [live] If this track is live
2092
- * @property {any} [raw] The raw data
2093
2183
  */
2184
+ declare type TrackSource = 'soundcloud' | 'youtube' | 'spotify' | 'apple_music' | 'arbitrary';
2094
2185
  interface RawTrackData {
2186
+ /**
2187
+ * The title
2188
+ */
2095
2189
  title: string;
2190
+ /**
2191
+ * The description
2192
+ */
2096
2193
  description: string;
2194
+ /**
2195
+ * The author
2196
+ */
2097
2197
  author: string;
2198
+ /**
2199
+ * The url
2200
+ */
2098
2201
  url: string;
2202
+ /**
2203
+ * The thumbnail
2204
+ */
2099
2205
  thumbnail: string;
2206
+ /**
2207
+ * The duration
2208
+ */
2100
2209
  duration: string;
2210
+ /**
2211
+ * The duration in ms
2212
+ */
2101
2213
  views: number;
2214
+ /**
2215
+ * The user who requested this track
2216
+ */
2102
2217
  requestedBy?: User | null;
2218
+ /**
2219
+ * The playlist
2220
+ */
2103
2221
  playlist?: Playlist;
2222
+ /**
2223
+ * The source
2224
+ */
2104
2225
  source?: TrackSource;
2226
+ /**
2227
+ * The engine
2228
+ */
2105
2229
  engine?: any;
2230
+ /**
2231
+ * If this track is live
2232
+ */
2106
2233
  live?: boolean;
2234
+ /**
2235
+ * The raw data
2236
+ */
2107
2237
  raw?: any;
2238
+ /**
2239
+ * The query type
2240
+ */
2108
2241
  queryType?: SearchQueryType;
2109
2242
  }
2110
- /**
2111
- * @typedef {object} TimeData
2112
- * @property {number} days Time in days
2113
- * @property {number} hours Time in hours
2114
- * @property {number} minutes Time in minutes
2115
- * @property {number} seconds Time in seconds
2116
- */
2117
2243
  interface TimeData {
2244
+ /**
2245
+ * Time in days
2246
+ */
2118
2247
  days: number;
2248
+ /**
2249
+ * Time in hours
2250
+ */
2119
2251
  hours: number;
2252
+ /**
2253
+ * Time in minutes
2254
+ */
2120
2255
  minutes: number;
2256
+ /**
2257
+ * Time in seconds
2258
+ */
2121
2259
  seconds: number;
2122
2260
  }
2123
- /**
2124
- * @typedef {object} PlayerProgressbarOptions
2125
- * @property {boolean} [timecodes] If it should render time codes
2126
- * @property {boolean} [queue] If it should create progress bar for the whole queue
2127
- * @property {number} [length] The bar length
2128
- * @property {string} [leftChar] The elapsed time track
2129
- * @property {string} [rightChar] The remaining time track
2130
- * @property {string} [separator] The separation between timestamp and line
2131
- * @property {string} [indicator] The indicator
2132
- */
2133
2261
  interface PlayerProgressbarOptions {
2262
+ /**
2263
+ * If it should render time codes
2264
+ */
2134
2265
  timecodes?: boolean;
2266
+ /**
2267
+ * If it should create progress bar for the whole queue
2268
+ */
2135
2269
  length?: number;
2270
+ /**
2271
+ * The bar length
2272
+ */
2136
2273
  leftChar?: string;
2274
+ /**
2275
+ * The elapsed time track
2276
+ */
2137
2277
  rightChar?: string;
2278
+ /**
2279
+ * The remaining time track
2280
+ */
2138
2281
  separator?: string;
2282
+ /**
2283
+ * The separation between timestamp and line
2284
+ */
2139
2285
  indicator?: string;
2286
+ /**
2287
+ * The indicator
2288
+ */
2140
2289
  queue?: boolean;
2141
2290
  }
2142
2291
  /**
@@ -2192,7 +2341,7 @@ declare const QueryType: {
2192
2341
  readonly FILE: "file";
2193
2342
  readonly AUTO_SEARCH: "autoSearch";
2194
2343
  };
2195
- type SearchQueryType = keyof typeof QueryType | (typeof QueryType)[keyof typeof QueryType];
2344
+ declare type SearchQueryType = keyof typeof QueryType | (typeof QueryType)[keyof typeof QueryType];
2196
2345
  interface PlayerEvents {
2197
2346
  debug: (message: string) => any;
2198
2347
  error: (error: Error) => any;
@@ -2203,35 +2352,49 @@ declare enum PlayerEvent {
2203
2352
  error = "error",
2204
2353
  voiceStateUpdate = "voiceStateUpdate"
2205
2354
  }
2206
- /**
2207
- * @typedef {object} PlayOptions
2208
- * @property {boolean} [filtersUpdate=false] If this play was triggered for filters update
2209
- * @property {string[]} [encoderArgs=[]] FFmpeg args passed to encoder
2210
- * @property {number} [seek] Time to seek to before playing
2211
- * @property {boolean} [immediate=false] If it should start playing the provided track immediately
2212
- */
2213
2355
  interface PlayOptions {
2356
+ /**
2357
+ * If this play was triggered for filters update
2358
+ */
2214
2359
  filtersUpdate?: boolean;
2360
+ /**
2361
+ * FFmpeg args passed to encoder
2362
+ */
2215
2363
  encoderArgs?: string[];
2364
+ /**
2365
+ * Time to seek to before playing
2366
+ */
2216
2367
  seek?: number;
2368
+ /**
2369
+ * If it should start playing the provided track immediately
2370
+ */
2217
2371
  immediate?: boolean;
2218
2372
  }
2219
- type QueryExtractorSearch = `ext:${string}`;
2220
- /**
2221
- * @typedef {object} SearchOptions
2222
- * @property {UserResolvable} requestedBy The user who requested this search
2223
- * @property {typeof QueryType|string} [searchEngine='auto'] The query search engine, can be extractor name to target specific one (custom)
2224
- * @property {string[]} [blockExtractors[]] List of the extractors to block
2225
- * @property {boolean} [ignoreCache] If it should ignore query cache lookup
2226
- * @property {SearchQueryType} [fallbackSearchEngine='autoSearch'] Fallback search engine to use
2227
- * @property {any} [requestOptions] The request options
2228
- */
2373
+ declare type QueryExtractorSearch = `ext:${string}`;
2229
2374
  interface SearchOptions {
2375
+ /**
2376
+ * The user who requested this search
2377
+ */
2230
2378
  requestedBy?: UserResolvable;
2379
+ /**
2380
+ * The query search engine, can be extractor name to target specific one (custom)
2381
+ */
2231
2382
  searchEngine?: SearchQueryType | QueryExtractorSearch;
2383
+ /**
2384
+ * List of the extractors to block
2385
+ */
2232
2386
  blockExtractors?: string[];
2387
+ /**
2388
+ * If it should ignore query cache lookup
2389
+ */
2233
2390
  ignoreCache?: boolean;
2391
+ /**
2392
+ * Fallback search engine to use
2393
+ */
2234
2394
  requestOptions?: any;
2395
+ /**
2396
+ * Fallback search engine to use
2397
+ */
2235
2398
  fallbackSearchEngine?: (typeof QueryType)[keyof typeof QueryType];
2236
2399
  }
2237
2400
  /**
@@ -2240,124 +2403,218 @@ interface SearchOptions {
2240
2403
  * - TRACK
2241
2404
  * - QUEUE
2242
2405
  * - AUTOPLAY
2243
- * @typedef {number} QueueRepeatMode
2244
2406
  */
2245
2407
  declare enum QueueRepeatMode {
2408
+ /**
2409
+ * Disable repeat mode.
2410
+ */
2246
2411
  OFF = 0,
2412
+ /**
2413
+ * Repeat the current track.
2414
+ */
2247
2415
  TRACK = 1,
2416
+ /**
2417
+ * Repeat the entire queue.
2418
+ */
2248
2419
  QUEUE = 2,
2420
+ /**
2421
+ * When last track ends, play similar tracks in the future if queue is empty.
2422
+ */
2249
2423
  AUTOPLAY = 3
2250
2424
  }
2251
- /**
2252
- * @typedef {object} PlaylistInitData
2253
- * @property {Track[]} tracks The tracks of this playlist
2254
- * @property {string} title The playlist title
2255
- * @property {string} description The description
2256
- * @property {string} thumbnail The thumbnail
2257
- * @property {album|playlist} type The playlist type: `album` | `playlist`
2258
- * @property {TrackSource} source The playlist source
2259
- * @property {object} author The playlist author
2260
- * @property {string} [author.name] The author name
2261
- * @property {string} [author.url] The author url
2262
- * @property {string} id The playlist id
2263
- * @property {string} url The playlist url
2264
- * @property {any} [rawPlaylist] The raw playlist data
2265
- */
2266
2425
  interface PlaylistInitData {
2426
+ /**
2427
+ * The tracks of this playlist
2428
+ */
2267
2429
  tracks: Track[];
2430
+ /**
2431
+ * The playlist title
2432
+ */
2268
2433
  title: string;
2434
+ /**
2435
+ * The description
2436
+ */
2269
2437
  description: string;
2438
+ /**
2439
+ * The thumbnail
2440
+ */
2270
2441
  thumbnail: string;
2442
+ /**
2443
+ * The playlist type: `album` | `playlist`
2444
+ */
2271
2445
  type: 'album' | 'playlist';
2446
+ /**
2447
+ * The playlist source
2448
+ */
2272
2449
  source: TrackSource;
2450
+ /**
2451
+ * The playlist author
2452
+ */
2273
2453
  author: {
2454
+ /**
2455
+ * The author name
2456
+ */
2274
2457
  name: string;
2458
+ /**
2459
+ * The author url
2460
+ */
2275
2461
  url: string;
2276
2462
  };
2463
+ /**
2464
+ * The playlist id
2465
+ */
2277
2466
  id: string;
2467
+ /**
2468
+ * The playlist url
2469
+ */
2278
2470
  url: string;
2471
+ /**
2472
+ * The raw playlist data
2473
+ */
2279
2474
  rawPlaylist?: any;
2280
2475
  }
2281
- /**
2282
- * @typedef {object} TrackJSON
2283
- * @property {string} title The track title
2284
- * @property {string} description The track description
2285
- * @property {string} author The author
2286
- * @property {string} url The url
2287
- * @property {string} thumbnail The thumbnail
2288
- * @property {string} duration The duration
2289
- * @property {number} durationMS The duration in ms
2290
- * @property {number} views The views count
2291
- * @property {Snowflake} requestedBy The id of the user who requested this track
2292
- * @property {PlaylistJSON} [playlist] The playlist info (if any)
2293
- */
2294
2476
  interface TrackJSON {
2295
- id: Snowflake;
2477
+ /**
2478
+ * The track id
2479
+ */
2480
+ id: string;
2481
+ /**
2482
+ * The track title
2483
+ */
2296
2484
  title: string;
2485
+ /**
2486
+ * The track description
2487
+ */
2297
2488
  description: string;
2489
+ /**
2490
+ * The track author
2491
+ */
2298
2492
  author: string;
2493
+ /**
2494
+ * The track url
2495
+ */
2299
2496
  url: string;
2497
+ /**
2498
+ * The track thumbnail
2499
+ */
2300
2500
  thumbnail: string;
2501
+ /**
2502
+ * The track duration
2503
+ */
2301
2504
  duration: string;
2505
+ /**
2506
+ * The track duration in ms
2507
+ */
2302
2508
  durationMS: number;
2509
+ /**
2510
+ * The track views
2511
+ */
2303
2512
  views: number;
2304
- requestedBy: Snowflake;
2513
+ /**
2514
+ * The user id who requested this track
2515
+ */
2516
+ requestedBy: string;
2517
+ /**
2518
+ * The playlist info (if any)
2519
+ */
2305
2520
  playlist?: PlaylistJSON;
2306
2521
  }
2307
- /**
2308
- * @typedef {object} PlaylistJSON
2309
- * @property {string} id The playlist id
2310
- * @property {string} url The playlist url
2311
- * @property {string} title The playlist title
2312
- * @property {string} description The playlist description
2313
- * @property {string} thumbnail The thumbnail
2314
- * @property {album|playlist} type The playlist type: `album` | `playlist`
2315
- * @property {TrackSource} source The track source
2316
- * @property {object} author The playlist author
2317
- * @property {string} [author.name] The author name
2318
- * @property {string} [author.url] The author url
2319
- * @property {TrackJSON[]} tracks The tracks data (if any)
2320
- */
2321
2522
  interface PlaylistJSON {
2523
+ /**
2524
+ * The playlist id
2525
+ */
2322
2526
  id: string;
2527
+ /**
2528
+ * The playlist url
2529
+ */
2323
2530
  url: string;
2531
+ /**
2532
+ * The playlist title
2533
+ */
2324
2534
  title: string;
2535
+ /**
2536
+ * The playlist description
2537
+ */
2325
2538
  description: string;
2539
+ /**
2540
+ * The thumbnail
2541
+ */
2326
2542
  thumbnail: string;
2543
+ /**
2544
+ * The playlist type: `album` | `playlist`
2545
+ */
2327
2546
  type: 'album' | 'playlist';
2547
+ /**
2548
+ * The track source
2549
+ */
2328
2550
  source: TrackSource;
2551
+ /**
2552
+ * The playlist author
2553
+ */
2329
2554
  author: {
2555
+ /**
2556
+ * The author name
2557
+ */
2330
2558
  name: string;
2559
+ /**
2560
+ * The author url
2561
+ */
2331
2562
  url: string;
2332
2563
  };
2564
+ /**
2565
+ * The tracks data (if any)
2566
+ */
2333
2567
  tracks: TrackJSON[];
2334
2568
  }
2335
- /**
2336
- * @typedef {object} PlayerInitOptions
2337
- * @property {YTDLDownloadOptions} [ytdlOptions] The options passed to `ytdl-core`
2338
- * @property {number} [connectionTimeout=20000] The voice connection timeout
2339
- * @property {boolean} [lagMonitor=30000] Time in ms to re-monitor event loop lag
2340
- * @property {boolean} [lockVoiceStateHandler] Prevent voice state handler from being overridden
2341
- * @property {string[]} [blockExtractors] List of extractors to disable querying metadata from
2342
- * @property {string[]} [blockStreamFrom] List of extractors to disable streaming from
2343
- * @property {QueryCache | null} [queryCache] Query cache provider
2344
- * @property {boolean} [ignoreInstance] Ignore player instance
2345
- * @property {boolean} [useLegacyFFmpeg] Use legacy version of ffmpeg
2346
- * @property {BridgeProvider} [bridgeProvider] Set bridge provider
2347
- * @property {object} [ipconfig] IP rotator config
2348
- */
2349
2569
  interface PlayerInitOptions {
2570
+ /**
2571
+ * The options passed to `ytdl-core`.
2572
+ */
2350
2573
  ytdlOptions?: downloadOptions;
2574
+ /**
2575
+ * The voice connection timeout
2576
+ */
2351
2577
  connectionTimeout?: number;
2578
+ /**
2579
+ * Time in ms to re-monitor event loop lag
2580
+ */
2352
2581
  lagMonitor?: number;
2582
+ /**
2583
+ * Prevent voice state handler from being overridden
2584
+ */
2353
2585
  lockVoiceStateHandler?: boolean;
2586
+ /**
2587
+ * List of extractors to disable querying metadata from
2588
+ */
2354
2589
  blockExtractors?: string[];
2590
+ /**
2591
+ * List of extractors to disable streaming from
2592
+ */
2355
2593
  blockStreamFrom?: string[];
2594
+ /**
2595
+ * Query cache provider
2596
+ */
2356
2597
  queryCache?: QueryCacheProvider<any> | null;
2598
+ /**
2599
+ * Ignore player instance
2600
+ */
2357
2601
  ignoreInstance?: boolean;
2602
+ /**
2603
+ * Use legacy version of ffmpeg
2604
+ */
2358
2605
  useLegacyFFmpeg?: boolean;
2606
+ /**
2607
+ * Set bridge provider
2608
+ */
2359
2609
  bridgeProvider?: BridgeProvider;
2610
+ /**
2611
+ * IP rotator config
2612
+ */
2360
2613
  ipconfig?: IPRotationConfig;
2614
+ /**
2615
+ * Skip ffmpeg process when possible
2616
+ */
2617
+ skipFFmpeg?: boolean;
2361
2618
  }
2362
2619
 
2363
2620
  declare class AudioFilters {
@@ -2532,13 +2789,13 @@ declare function useQueue<Meta = unknown>(node: NodeResolvable): GuildQueue<Meta
2532
2789
  * Fetch main player instance
2533
2790
  * @deprecated
2534
2791
  */
2535
- declare function useMasterPlayer(): Player | null;
2792
+ declare function useMasterPlayer(): Player;
2536
2793
  /**
2537
2794
  * Fetch main player instance
2538
2795
  */
2539
- declare function useMainPlayer(): Player | null;
2796
+ declare function useMainPlayer(): Player;
2540
2797
 
2541
- type SetterFN$1<T, P> = (previous: P) => T;
2798
+ declare type SetterFN$1<T, P> = (previous: P) => T;
2542
2799
  /**
2543
2800
  * Fetch or manipulate guild queue metadata
2544
2801
  * @param node Guild queue node resolvable
@@ -2576,7 +2833,7 @@ declare function onAfterCreateStream(handler: OnAfterCreateStreamHandler): void;
2576
2833
  */
2577
2834
  declare function onBeforeCreateStream(handler: OnBeforeCreateStreamHandler): void;
2578
2835
 
2579
- type SetterFN = (previous: number) => number;
2836
+ declare type SetterFN = (previous: number) => number;
2580
2837
  /**
2581
2838
  * Fetch or manipulate player volume
2582
2839
  * @param node Guild queue node resolvable
@@ -2592,9 +2849,9 @@ interface HookDeclarationContext {
2592
2849
  getPlayer: typeof getPlayer;
2593
2850
  instances: typeof instances;
2594
2851
  }
2595
- type HookDeclaration<T extends (...args: any[]) => any> = (context: HookDeclarationContext) => T;
2852
+ declare type HookDeclaration<T extends (...args: any[]) => any> = (context: HookDeclarationContext) => T;
2596
2853
  declare function createHook<T extends HookDeclaration<(...args: any[]) => any>>(hook: T): ReturnType<T>;
2597
2854
 
2598
2855
  declare const version: string;
2599
2856
 
2600
- export { AFilterGraph, AsyncQueue, AsyncQueueAcquisitionOptions, AsyncQueueEntry, AsyncQueueExceptionHandler, AudioFilters, BaseExtractor, CreateStreamOps, DiscordPlayerQueryResultCache, EqualizerConfigurationPreset, ExtractorExecutionContext, ExtractorExecutionEvents, ExtractorExecutionFN, ExtractorExecutionResult, ExtractorInfo, ExtractorSearchContext, FFMPEG_ARGS_PIPED, FFMPEG_ARGS_STRING, FFMPEG_SRATE_REGEX, FFmpegFilterer, FFmpegStreamOptions, FilterGraph, FiltersName, GuildNodeCreateOptions, GuildNodeInit, GuildNodeManager, GuildQueue, GuildQueueAFiltersCache, GuildQueueAudioFilters, GuildQueueEvent, GuildQueueEvents, GuildQueueHistory, GuildQueuePlayerNode, GuildQueueStatistics, GuildQueueStatisticsMetadata, HookDeclaration, HookDeclarationContext, IPBlock, IPRotationConfig, IPRotator, NextFunction, NodeResolvable, OnAfterCreateStreamHandler, OnBeforeCreateStreamHandler, PlayOptions, Player, PlayerEvent, PlayerEvents, PlayerEventsEmitter, PlayerInitOptions, PlayerNodeInitializationResult, PlayerNodeInitializerOptions, PlayerProgressbarOptions, PlayerSearchResult, PlayerTimestamp, PlayerTriggeredReason, Playlist, PlaylistInitData, PlaylistJSON, PostProcessedResult, QueryCache, QueryCacheOptions, QueryCacheProvider, QueryCacheResolverContext, QueryExtractorSearch, QueryResolver, QueryType, QueueFilters, QueueRepeatMode, RawTrackData, RawTrackInit, ResolvedQuery, ResourcePlayOptions, SearchOptions, SearchQueryType, SearchResult, SearchResultData, StreamConfig, StreamDispatcher, TimeData, TimelineDispatcherOptions, Track, TrackJSON, TrackLike, TrackResolvable, TrackSource, TypeUtil, Util, VALIDATE_QUEUE_CAP, VoiceConnectConfig, VoiceEvents, VoiceReceiverNode, VoiceReceiverOptions, VoiceStateHandler, VoiceUtils, WithMetadata, createFFmpegStream, createHook, onAfterCreateStream, onBeforeCreateStream, useHistory, useMainPlayer, useMasterPlayer, useMetadata, usePlayer, useQueue, useTimeline, useVolume, version };
2857
+ export { AFilterGraph, AsyncQueue, AsyncQueueAcquisitionOptions, AsyncQueueEntry, AsyncQueueExceptionHandler, AudioFilters, BaseExtractor, CreateStreamOps, DiscordPlayerQueryResultCache, Encodable, EqualizerConfigurationPreset, ExtractorExecutionContext, ExtractorExecutionEvents, ExtractorExecutionFN, ExtractorExecutionResult, ExtractorInfo, ExtractorSearchContext, ExtractorStreamable, FFMPEG_ARGS_PIPED, FFMPEG_ARGS_STRING, FFMPEG_SRATE_REGEX, FFmpegFilterer, FFmpegStreamOptions, FilterGraph, FiltersName, GuildNodeCreateOptions, GuildNodeInit, GuildNodeManager, GuildQueue, GuildQueueAFiltersCache, GuildQueueAudioFilters, GuildQueueEvent, GuildQueueEvents, GuildQueueHistory, GuildQueuePlayerNode, GuildQueueStatistics, GuildQueueStatisticsMetadata, HookDeclaration, HookDeclarationContext, IPBlock, IPRotationConfig, IPRotator, NextFunction, NodeResolvable, OnAfterCreateStreamHandler, OnBeforeCreateStreamHandler, PlayOptions, Player, PlayerEvent, PlayerEvents, PlayerEventsEmitter, PlayerInitOptions, PlayerNodeInitializationResult, PlayerNodeInitializerOptions, PlayerProgressbarOptions, PlayerSearchResult, PlayerTimestamp, PlayerTriggeredReason, Playlist, PlaylistInitData, PlaylistJSON, PostProcessedResult, QueryCache, QueryCacheOptions, QueryCacheProvider, QueryCacheResolverContext, QueryExtractorSearch, QueryResolver, QueryType, QueueFilters, QueueRepeatMode, RawTrackData, RawTrackInit, ResolvedQuery, ResourcePlayOptions, SearchOptions, SearchQueryType, SearchResult, SearchResultData, SerializedPlaylist, SerializedTrack, SerializedType, StreamConfig, StreamDispatcher, TimeData, TimelineDispatcherOptions, Track, TrackJSON, TrackLike, TrackResolvable, TrackSource, TypeUtil, Util, VALIDATE_QUEUE_CAP, VoiceConnectConfig, VoiceEvents, VoiceReceiverNode, VoiceReceiverOptions, VoiceStateHandler, VoiceUtils, WithMetadata, createFFmpegStream, createHook, decode, deserialize, encode, onAfterCreateStream, onBeforeCreateStream, serialize, tryIntoThumbnailString, useHistory, useMainPlayer, useMasterPlayer, useMetadata, usePlayer, useQueue, useTimeline, useVolume, version };