discord-player 5.3.0-dev.1 → 5.3.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
@@ -5,1189 +5,1154 @@ import { TypedEmitter } from 'tiny-typed-emitter';
5
5
  import { AudioPlayerError, AudioResource, VoiceConnection, AudioPlayer, StreamType, AudioPlayerStatus } from '@discordjs/voice';
6
6
  import { downloadOptions } from 'ytdl-core';
7
7
 
8
- declare class Playlist {
9
- readonly player: Player;
10
- tracks: Track[];
11
- title: string;
12
- description: string;
13
- thumbnail: string;
14
- type: "album" | "playlist";
15
- source: TrackSource;
16
- author: {
17
- name: string;
18
- url: string;
19
- };
20
- id: string;
21
- url: string;
22
- readonly rawPlaylist?: any;
23
- /**
24
- * Playlist constructor
25
- * @param {Player} player The player
26
- * @param {PlaylistInitData} data The data
27
- */
28
- constructor(player: Player, data: PlaylistInitData);
29
- [Symbol.iterator](): Generator<Track, void, undefined>;
30
- /**
31
- * JSON representation of this playlist
32
- * @param {boolean} [withTracks=true] If it should build json with tracks
33
- * @returns {PlaylistJSON}
34
- */
35
- toJSON(withTracks?: boolean): PlaylistJSON;
8
+ declare class Playlist {
9
+ readonly player: Player;
10
+ tracks: Track[];
11
+ title: string;
12
+ description: string;
13
+ thumbnail: string;
14
+ type: "album" | "playlist";
15
+ source: TrackSource;
16
+ author: {
17
+ name: string;
18
+ url: string;
19
+ };
20
+ id: string;
21
+ url: string;
22
+ readonly rawPlaylist?: any;
23
+ /**
24
+ * Playlist constructor
25
+ * @param {Player} player The player
26
+ * @param {PlaylistInitData} data The data
27
+ */
28
+ constructor(player: Player, data: PlaylistInitData);
29
+ [Symbol.iterator](): Generator<Track, void, undefined>;
30
+ /**
31
+ * JSON representation of this playlist
32
+ * @param {boolean} [withTracks=true] If it should build json with tracks
33
+ * @returns {PlaylistJSON}
34
+ */
35
+ toJSON(withTracks?: boolean): PlaylistJSON;
36
36
  }
37
37
 
38
- declare class Track {
39
- player: Player;
40
- title: string;
41
- description: string;
42
- author: string;
43
- url: string;
44
- thumbnail: string;
45
- duration: string;
46
- views: number;
47
- requestedBy: User;
48
- playlist?: Playlist;
49
- readonly raw: RawTrackData;
50
- readonly id: string;
51
- /**
52
- * Track constructor
53
- * @param {Player} player The player that instantiated this Track
54
- * @param {RawTrackData} data Track data
55
- */
56
- constructor(player: Player, data: RawTrackData);
57
- private _patch;
58
- /**
59
- * The queue in which this track is located
60
- * @type {Queue}
61
- */
62
- get queue(): Queue;
63
- /**
64
- * The track duration in millisecond
65
- * @type {number}
66
- */
67
- get durationMS(): number;
68
- /**
69
- * Returns source of this track
70
- * @type {TrackSource}
71
- */
72
- get source(): TrackSource;
73
- /**
74
- * String representation of this track
75
- * @returns {string}
76
- */
77
- toString(): string;
78
- /**
79
- * Raw JSON representation of this track
80
- * @returns {TrackJSON}
81
- */
82
- toJSON(hidePlaylist?: boolean): TrackJSON;
38
+ declare class Track {
39
+ player: Player;
40
+ title: string;
41
+ description: string;
42
+ author: string;
43
+ url: string;
44
+ thumbnail: string;
45
+ duration: string;
46
+ views: number;
47
+ requestedBy: User;
48
+ playlist?: Playlist;
49
+ readonly raw: RawTrackData;
50
+ readonly id: string;
51
+ /**
52
+ * Track constructor
53
+ * @param {Player} player The player that instantiated this Track
54
+ * @param {RawTrackData} data Track data
55
+ */
56
+ constructor(player: Player, data: RawTrackData);
57
+ private _patch;
58
+ /**
59
+ * The queue in which this track is located
60
+ * @type {Queue}
61
+ */
62
+ get queue(): Queue;
63
+ /**
64
+ * The track duration in millisecond
65
+ * @type {number}
66
+ */
67
+ get durationMS(): number;
68
+ /**
69
+ * Returns source of this track
70
+ * @type {TrackSource}
71
+ */
72
+ get source(): TrackSource;
73
+ /**
74
+ * String representation of this track
75
+ * @returns {string}
76
+ */
77
+ toString(): string;
78
+ /**
79
+ * Raw JSON representation of this track
80
+ * @returns {TrackJSON}
81
+ */
82
+ toJSON(hidePlaylist?: boolean): TrackJSON;
83
83
  }
84
84
 
85
- interface VoiceEvents {
86
- error: (error: AudioPlayerError) => any;
87
- debug: (message: string) => any;
88
- start: (resource: AudioResource<Track>) => any;
89
- finish: (resource: AudioResource<Track>) => any;
90
- }
91
- declare class StreamDispatcher extends TypedEmitter<VoiceEvents> {
92
- readonly connectionTimeout: number;
93
- readonly voiceConnection: VoiceConnection;
94
- readonly audioPlayer: AudioPlayer;
95
- channel: VoiceChannel | StageChannel;
96
- audioResource?: AudioResource<Track>;
97
- private readyLock;
98
- paused: boolean;
99
- /**
100
- * Creates new connection object
101
- * @param {VoiceConnection} connection The connection
102
- * @param {VoiceChannel|StageChannel} channel The connected channel
103
- * @private
104
- */
105
- constructor(connection: VoiceConnection, channel: VoiceChannel | StageChannel, connectionTimeout?: number);
106
- /**
107
- * Creates stream
108
- * @param {Readable|Duplex|string} src The stream source
109
- * @param {object} [ops={}] Options
110
- * @returns {AudioResource}
111
- */
112
- createStream(src: Readable | Duplex | string, ops?: {
113
- type?: StreamType;
114
- data?: any;
115
- disableVolume?: boolean;
116
- }): AudioResource<Track>;
117
- /**
118
- * The player status
119
- * @type {AudioPlayerStatus}
120
- */
121
- get status(): AudioPlayerStatus;
122
- /**
123
- * Disconnects from voice
124
- * @returns {void}
125
- */
126
- disconnect(): void;
127
- /**
128
- * Stops the player
129
- * @returns {void}
130
- */
131
- end(): void;
132
- /**
133
- * Pauses the stream playback
134
- * @param {boolean} [interpolateSilence=false] If true, the player will play 5 packets of silence after pausing to prevent audio glitches.
135
- * @returns {boolean}
136
- */
137
- pause(interpolateSilence?: boolean): boolean;
138
- /**
139
- * Resumes the stream playback
140
- * @returns {boolean}
141
- */
142
- resume(): boolean;
143
- /**
144
- * Play stream
145
- * @param {AudioResource<Track>} [resource=this.audioResource] The audio resource to play
146
- * @returns {Promise<StreamDispatcher>}
147
- */
148
- playStream(resource?: AudioResource<Track>): Promise<this>;
149
- /**
150
- * Sets playback volume
151
- * @param {number} value The volume amount
152
- * @returns {boolean}
153
- */
154
- setVolume(value: number): boolean;
155
- /**
156
- * The current volume
157
- * @type {number}
158
- */
159
- get volume(): number;
160
- /**
161
- * The playback time
162
- * @type {number}
163
- */
164
- get streamTime(): number;
85
+ interface VoiceEvents {
86
+ error: (error: AudioPlayerError) => any;
87
+ debug: (message: string) => any;
88
+ start: (resource: AudioResource<Track>) => any;
89
+ finish: (resource: AudioResource<Track>) => any;
90
+ }
91
+ declare class StreamDispatcher extends TypedEmitter<VoiceEvents> {
92
+ readonly connectionTimeout: number;
93
+ readonly voiceConnection: VoiceConnection;
94
+ readonly audioPlayer: AudioPlayer;
95
+ channel: VoiceChannel | StageChannel;
96
+ audioResource?: AudioResource<Track>;
97
+ private readyLock;
98
+ paused: boolean;
99
+ /**
100
+ * Creates new connection object
101
+ * @param {VoiceConnection} connection The connection
102
+ * @param {VoiceChannel|StageChannel} channel The connected channel
103
+ * @private
104
+ */
105
+ constructor(connection: VoiceConnection, channel: VoiceChannel | StageChannel, connectionTimeout?: number);
106
+ /**
107
+ * Creates stream
108
+ * @param {Readable|Duplex|string} src The stream source
109
+ * @param {object} [ops] Options
110
+ * @returns {AudioResource}
111
+ */
112
+ createStream(src: Readable | Duplex | string, ops?: {
113
+ type?: StreamType;
114
+ data?: any;
115
+ disableVolume?: boolean;
116
+ }): AudioResource<Track>;
117
+ /**
118
+ * The player status
119
+ * @type {AudioPlayerStatus}
120
+ */
121
+ get status(): AudioPlayerStatus;
122
+ /**
123
+ * Disconnects from voice
124
+ * @returns {void}
125
+ */
126
+ disconnect(): void;
127
+ /**
128
+ * Stops the player
129
+ * @returns {void}
130
+ */
131
+ end(): void;
132
+ /**
133
+ * Pauses the stream playback
134
+ * @param {boolean} [interpolateSilence=false] If true, the player will play 5 packets of silence after pausing to prevent audio glitches.
135
+ * @returns {boolean}
136
+ */
137
+ pause(interpolateSilence?: boolean): boolean;
138
+ /**
139
+ * Resumes the stream playback
140
+ * @returns {boolean}
141
+ */
142
+ resume(): boolean;
143
+ /**
144
+ * Play stream
145
+ * @param {AudioResource<Track>} [resource=this.audioResource] The audio resource to play
146
+ * @returns {Promise<StreamDispatcher>}
147
+ */
148
+ playStream(resource?: AudioResource<Track>): Promise<this>;
149
+ /**
150
+ * Sets playback volume
151
+ * @param {number} value The volume amount
152
+ * @returns {boolean}
153
+ */
154
+ setVolume(value: number): boolean;
155
+ /**
156
+ * The current volume
157
+ * @type {number}
158
+ */
159
+ get volume(): number;
160
+ /**
161
+ * The playback time
162
+ * @type {number}
163
+ */
164
+ get streamTime(): number;
165
+ }
166
+
167
+ declare class VoiceUtils {
168
+ cache: Collection<Snowflake, StreamDispatcher>;
169
+ /**
170
+ * The voice utils
171
+ * @private
172
+ */
173
+ constructor();
174
+ /**
175
+ * Joins a voice channel, creating basic stream dispatch manager
176
+ * @param {StageChannel|VoiceChannel} channel The voice channel
177
+ * @param {object} [options] Join options
178
+ * @returns {Promise<StreamDispatcher>}
179
+ */
180
+ connect(channel: VoiceChannel | StageChannel, options?: {
181
+ deaf?: boolean;
182
+ maxTime?: number;
183
+ }): Promise<StreamDispatcher>;
184
+ /**
185
+ * Joins a voice channel
186
+ * @param {StageChannel|VoiceChannel} [channel] The voice/stage channel to join
187
+ * @param {object} [options] Join options
188
+ * @returns {VoiceConnection}
189
+ */
190
+ join(channel: VoiceChannel | StageChannel, options?: {
191
+ deaf?: boolean;
192
+ maxTime?: number;
193
+ }): Promise<VoiceConnection>;
194
+ /**
195
+ * Disconnects voice connection
196
+ * @param {VoiceConnection} connection The voice connection
197
+ * @returns {void}
198
+ */
199
+ disconnect(connection: VoiceConnection | StreamDispatcher): void;
200
+ /**
201
+ * Returns Discord Player voice connection
202
+ * @param {Snowflake} guild The guild id
203
+ * @returns {StreamDispatcher}
204
+ */
205
+ getConnection(guild: Snowflake): StreamDispatcher;
165
206
  }
166
207
 
167
- declare class VoiceUtils {
168
- cache: Collection<Snowflake, StreamDispatcher>;
169
- /**
170
- * The voice utils
171
- * @private
172
- */
173
- constructor();
174
- /**
175
- * Joins a voice channel, creating basic stream dispatch manager
176
- * @param {StageChannel|VoiceChannel} channel The voice channel
177
- * @param {object} [options={}] Join options
178
- * @returns {Promise<StreamDispatcher>}
179
- */
180
- connect(channel: VoiceChannel | StageChannel, options?: {
181
- deaf?: boolean;
182
- maxTime?: number;
183
- }): Promise<StreamDispatcher>;
184
- /**
185
- * Joins a voice channel
186
- * @param {StageChannel|VoiceChannel} [channel] The voice/stage channel to join
187
- * @param {object} [options={}] Join options
188
- * @returns {VoiceConnection}
189
- */
190
- join(channel: VoiceChannel | StageChannel, options?: {
191
- deaf?: boolean;
192
- maxTime?: number;
193
- }): Promise<VoiceConnection>;
194
- enterReady(conn: VoiceConnection, options?: {
195
- maxTime?: number;
196
- }): Promise<VoiceConnection>;
197
- /**
198
- * Disconnects voice connection
199
- * @param {VoiceConnection} connection The voice connection
200
- * @returns {void}
201
- */
202
- disconnect(connection: VoiceConnection | StreamDispatcher): void;
203
- /**
204
- * Returns Discord Player voice connection
205
- * @param {Snowflake} guild The guild id
206
- * @returns {StreamDispatcher}
207
- */
208
- getConnection(guild: Snowflake): StreamDispatcher;
208
+ declare class ExtractorModel {
209
+ name: string;
210
+ private _raw;
211
+ /**
212
+ * Model for raw Discord Player extractors
213
+ * @param {string} extractorName Name of the extractor
214
+ * @param {object} data Extractor object
215
+ */
216
+ constructor(extractorName: string, data: any);
217
+ /**
218
+ * Method to handle requests from `Player.play()`
219
+ * @param {string} query Query to handle
220
+ * @returns {Promise<ExtractorModelData>}
221
+ */
222
+ handle(query: string): Promise<ExtractorModelData>;
223
+ /**
224
+ * Method used by Discord Player to validate query with this extractor
225
+ * @param {string} query The query to validate
226
+ * @returns {boolean}
227
+ */
228
+ validate(query: string): boolean;
229
+ /**
230
+ * The extractor version
231
+ * @type {string}
232
+ */
233
+ get version(): string;
209
234
  }
210
235
 
211
- declare class ExtractorModel {
212
- name: string;
213
- private _raw;
214
- /**
215
- * Model for raw Discord Player extractors
216
- * @param {string} extractorName Name of the extractor
217
- * @param {object} data Extractor object
218
- */
219
- constructor(extractorName: string, data: any);
220
- /**
221
- * Method to handle requests from `Player.play()`
222
- * @param {string} query Query to handle
223
- * @returns {Promise<ExtractorModelData>}
224
- */
225
- handle(query: string): Promise<ExtractorModelData>;
226
- /**
227
- * Method used by Discord Player to validate query with this extractor
228
- * @param {string} query The query to validate
229
- * @returns {boolean}
230
- */
231
- validate(query: string): boolean;
232
- /**
233
- * The extractor version
234
- * @type {string}
235
- */
236
- get version(): string;
236
+ declare class Player extends TypedEmitter<PlayerEvents> {
237
+ readonly client: Client;
238
+ readonly options: PlayerInitOptions;
239
+ readonly queues: Collection<string, Queue<unknown>>;
240
+ readonly voiceUtils: VoiceUtils;
241
+ readonly extractors: Collection<string, ExtractorModel>;
242
+ requiredEvents: string[];
243
+ /**
244
+ * Creates new Discord Player
245
+ * @param {Client} client The Discord Client
246
+ * @param {PlayerInitOptions} [options] The player init options
247
+ */
248
+ constructor(client: Client, options?: PlayerInitOptions);
249
+ /**
250
+ * Handles voice state update
251
+ * @param {VoiceState} oldState The old voice state
252
+ * @param {VoiceState} newState The new voice state
253
+ * @returns {void}
254
+ * @private
255
+ */
256
+ private _handleVoiceState;
257
+ /**
258
+ * Creates a queue for a guild if not available, else returns existing queue
259
+ * @param {GuildResolvable} guild The guild
260
+ * @param {PlayerOptions} queueInitOptions Queue init options
261
+ * @returns {Queue}
262
+ */
263
+ createQueue<T = unknown>(guild: GuildResolvable, queueInitOptions?: PlayerOptions & {
264
+ metadata?: T;
265
+ }): Queue<T>;
266
+ /**
267
+ * Returns the queue if available
268
+ * @param {GuildResolvable} guild The guild id
269
+ * @returns {Queue}
270
+ */
271
+ getQueue<T = unknown>(guild: GuildResolvable): Queue<T>;
272
+ /**
273
+ * Deletes a queue and returns deleted queue object
274
+ * @param {GuildResolvable} guild The guild id to remove
275
+ * @returns {Queue}
276
+ */
277
+ deleteQueue<T = unknown>(guild: GuildResolvable): Queue<T>;
278
+ /**
279
+ * @typedef {object} PlayerSearchResult
280
+ * @property {Playlist} [playlist] The playlist (if any)
281
+ * @property {Track[]} tracks The tracks
282
+ */
283
+ /**
284
+ * Search tracks
285
+ * @param {string|Track} query The search query
286
+ * @param {SearchOptions} options The search options
287
+ * @returns {Promise<PlayerSearchResult>}
288
+ */
289
+ search(query: string | Track, options: SearchOptions): Promise<PlayerSearchResult>;
290
+ /**
291
+ * Registers extractor
292
+ * @param {string} extractorName The extractor name
293
+ * @param {ExtractorModel|any} extractor The extractor object
294
+ * @param {boolean} [force=false] Overwrite existing extractor with this name (if available)
295
+ * @returns {ExtractorModel}
296
+ */
297
+ use(extractorName: string, extractor: ExtractorModel | any, force?: boolean): ExtractorModel;
298
+ /**
299
+ * Removes registered extractor
300
+ * @param {string} extractorName The extractor name
301
+ * @returns {ExtractorModel}
302
+ */
303
+ unuse(extractorName: string): ExtractorModel;
304
+ /**
305
+ * Generates a report of the dependencies used by the `@discordjs/voice` module. Useful for debugging.
306
+ * @returns {string}
307
+ */
308
+ scanDeps(): string;
309
+ emit<U extends keyof PlayerEvents>(eventName: U, ...args: Parameters<PlayerEvents[U]>): boolean;
310
+ /**
311
+ * Resolves queue
312
+ * @param {GuildResolvable|Queue} queueLike Queue like object
313
+ * @returns {Queue}
314
+ */
315
+ resolveQueue<T>(queueLike: GuildResolvable | Queue): Queue<T>;
316
+ [Symbol.iterator](): Generator<Queue<unknown>, void, undefined>;
317
+ /**
318
+ * Creates `Playlist` instance
319
+ * @param data The data to initialize a playlist
320
+ */
321
+ createPlaylist(data: PlaylistInitData): Playlist;
237
322
  }
238
323
 
239
- declare class Player extends TypedEmitter<PlayerEvents> {
240
- readonly client: Client;
241
- readonly options: PlayerInitOptions;
242
- readonly queues: Collection<string, Queue<unknown>>;
243
- readonly voiceUtils: VoiceUtils;
244
- readonly extractors: Collection<string, ExtractorModel>;
245
- requiredEvents: string[];
246
- /**
247
- * Creates new Discord Player
248
- * @param {Client} client The Discord Client
249
- * @param {PlayerInitOptions} [options={}] The player init options
250
- */
251
- constructor(client: Client, options?: PlayerInitOptions);
252
- /**
253
- * Handles voice state update
254
- * @param {VoiceState} oldState The old voice state
255
- * @param {VoiceState} newState The new voice state
256
- * @returns {void}
257
- * @private
258
- */
259
- private _handleVoiceState;
260
- /**
261
- * Creates a queue for a guild if not available, else returns existing queue
262
- * @param {GuildResolvable} guild The guild
263
- * @param {PlayerOptions} queueInitOptions Queue init options
264
- * @returns {Queue}
265
- */
266
- createQueue<T = unknown>(guild: GuildResolvable, queueInitOptions?: PlayerOptions & {
267
- metadata?: T;
268
- }): Queue<T>;
269
- /**
270
- * Returns the queue if available
271
- * @param {GuildResolvable} guild The guild id
272
- * @returns {Queue}
273
- */
274
- getQueue<T = unknown>(guild: GuildResolvable): Queue<T>;
275
- /**
276
- * Deletes a queue and returns deleted queue object
277
- * @param {GuildResolvable} guild The guild id to remove
278
- * @returns {Queue}
279
- */
280
- deleteQueue<T = unknown>(guild: GuildResolvable): Queue<T>;
281
- /**
282
- * @typedef {object} PlayerSearchResult
283
- * @property {Playlist} [playlist] The playlist (if any)
284
- * @property {Track[]} tracks The tracks
285
- */
286
- /**
287
- * Search tracks
288
- * @param {string|Track} query The search query
289
- * @param {SearchOptions} options The search options
290
- * @returns {Promise<PlayerSearchResult>}
291
- */
292
- search(query: string | Track, options: SearchOptions): Promise<PlayerSearchResult>;
293
- /**
294
- * Registers extractor
295
- * @param {string} extractorName The extractor name
296
- * @param {ExtractorModel|any} extractor The extractor object
297
- * @param {boolean} [force=false] Overwrite existing extractor with this name (if available)
298
- * @returns {ExtractorModel}
299
- */
300
- use(extractorName: string, extractor: ExtractorModel | any, force?: boolean): ExtractorModel;
301
- /**
302
- * Removes registered extractor
303
- * @param {string} extractorName The extractor name
304
- * @returns {ExtractorModel}
305
- */
306
- unuse(extractorName: string): ExtractorModel;
307
- /**
308
- * Generates a report of the dependencies used by the `@discordjs/voice` module. Useful for debugging.
309
- * @returns {string}
310
- */
311
- scanDeps(): string;
312
- emit<U extends keyof PlayerEvents>(eventName: U, ...args: Parameters<PlayerEvents[U]>): boolean;
313
- /**
314
- * Resolves queue
315
- * @param {GuildResolvable|Queue} queueLike Queue like object
316
- * @returns {Queue}
317
- */
318
- resolveQueue<T>(queueLike: GuildResolvable | Queue): Queue<T>;
319
- [Symbol.iterator](): Generator<Queue<unknown>, void, undefined>;
324
+ declare class Queue<T = unknown> {
325
+ #private;
326
+ readonly guild: Guild;
327
+ readonly player: Player;
328
+ connection: StreamDispatcher;
329
+ tracks: Track[];
330
+ previousTracks: Track[];
331
+ options: PlayerOptions;
332
+ playing: boolean;
333
+ metadata?: T;
334
+ repeatMode: QueueRepeatMode;
335
+ readonly id: string;
336
+ private _streamTime;
337
+ _cooldownsTimeout: Collection<string, NodeJS.Timeout>;
338
+ private _activeFilters;
339
+ private _filtersUpdate;
340
+ onBeforeCreateStream: (track: Track, source: TrackSource, queue: Queue) => Promise<Readable | undefined>;
341
+ /**
342
+ * Queue constructor
343
+ * @param {Player} player The player that instantiated this queue
344
+ * @param {Guild} guild The guild that instantiated this queue
345
+ * @param {PlayerOptions} [options] Player options for the queue
346
+ */
347
+ constructor(player: Player, guild: Guild, options?: PlayerOptions);
348
+ /**
349
+ * Returns current track
350
+ * @type {Track}
351
+ */
352
+ get current(): Track;
353
+ /**
354
+ * If this queue is destroyed
355
+ * @type {boolean}
356
+ */
357
+ get destroyed(): boolean;
358
+ /**
359
+ * Returns current track
360
+ * @returns {Track}
361
+ */
362
+ nowPlaying(): Track;
363
+ /**
364
+ * Connects to a voice channel
365
+ * @param {GuildChannelResolvable} channel The voice/stage channel
366
+ * @returns {Promise<Queue>}
367
+ */
368
+ connect(channel: GuildChannelResolvable): Promise<this>;
369
+ /**
370
+ * Destroys this queue
371
+ * @param {boolean} [disconnect=this.options.leaveOnStop] If it should leave on destroy
372
+ * @returns {void}
373
+ */
374
+ destroy(disconnect?: boolean): void;
375
+ /**
376
+ * Skips current track
377
+ * @returns {boolean}
378
+ */
379
+ skip(): boolean;
380
+ /**
381
+ * Adds single track to the queue
382
+ * @param {Track} track The track to add
383
+ * @returns {void}
384
+ */
385
+ addTrack(track: Track): void;
386
+ /**
387
+ * Adds multiple tracks to the queue
388
+ * @param {Track[]} tracks Array of tracks to add
389
+ */
390
+ addTracks(tracks: Track[]): void;
391
+ /**
392
+ * Sets paused state
393
+ * @param {boolean} paused The paused state
394
+ * @returns {boolean}
395
+ */
396
+ setPaused(paused?: boolean): boolean;
397
+ /**
398
+ * Sets bitrate
399
+ * @param {number|auto} bitrate bitrate to set
400
+ * @returns {void}
401
+ */
402
+ setBitrate(bitrate: number | "auto"): void;
403
+ /**
404
+ * Sets volume
405
+ * @param {number} amount The volume amount
406
+ * @returns {boolean}
407
+ */
408
+ setVolume(amount: number): boolean;
409
+ /**
410
+ * Sets repeat mode
411
+ * @param {QueueRepeatMode} mode The repeat mode
412
+ * @returns {boolean}
413
+ */
414
+ setRepeatMode(mode: QueueRepeatMode): boolean;
415
+ /**
416
+ * The current volume amount
417
+ * @type {number}
418
+ */
419
+ get volume(): number;
420
+ set volume(amount: number);
421
+ /**
422
+ * The stream time of this queue
423
+ * @type {number}
424
+ */
425
+ get streamTime(): number;
426
+ set streamTime(time: number);
427
+ /**
428
+ * Returns enabled filters
429
+ * @returns {AudioFilters}
430
+ */
431
+ getFiltersEnabled(): (keyof QueueFilters)[];
432
+ /**
433
+ * Returns disabled filters
434
+ * @returns {AudioFilters}
435
+ */
436
+ getFiltersDisabled(): (keyof QueueFilters)[];
437
+ /**
438
+ * Sets filters
439
+ * @param {QueueFilters} filters Queue filters
440
+ * @returns {Promise<void>}
441
+ */
442
+ setFilters(filters?: QueueFilters): Promise<void>;
443
+ /**
444
+ * Seeks to the given time
445
+ * @param {number} position The position
446
+ * @returns {boolean}
447
+ */
448
+ seek(position: number): Promise<boolean>;
449
+ /**
450
+ * Plays previous track
451
+ * @returns {Promise<void>}
452
+ */
453
+ back(): Promise<void>;
454
+ /**
455
+ * Clear this queue
456
+ */
457
+ clear(): void;
458
+ /**
459
+ * Stops the player
460
+ * @returns {void}
461
+ */
462
+ stop(): void;
463
+ /**
464
+ * Shuffles this queue
465
+ * @returns {boolean}
466
+ */
467
+ shuffle(): boolean;
468
+ /**
469
+ * Removes a track from the queue
470
+ * @param {Track|string|number} track The track to remove
471
+ * @returns {Track}
472
+ */
473
+ remove(track: Track | string | number): Track;
474
+ /**
475
+ * Returns the index of the specified track. If found, returns the track index else returns -1.
476
+ * @param {number|Track|string} track The track
477
+ * @returns {number}
478
+ */
479
+ getTrackPosition(track: number | Track | string): number;
480
+ /**
481
+ * Jumps to particular track
482
+ * @param {Track|number} track The track
483
+ * @returns {void}
484
+ */
485
+ jump(track: Track | number): void;
486
+ /**
487
+ * Jumps to particular track, removing other tracks on the way
488
+ * @param {Track|number} track The track
489
+ * @returns {void}
490
+ */
491
+ skipTo(track: Track | number): void;
492
+ /**
493
+ * Inserts the given track to specified index
494
+ * @param {Track} track The track to insert
495
+ * @param {number} [index=0] The index where this track should be
496
+ */
497
+ insert(track: Track, index?: number): void;
498
+ /**
499
+ * @typedef {object} PlayerTimestamp
500
+ * @property {string} current The current progress
501
+ * @property {string} end The total time
502
+ * @property {number} progress Progress in %
503
+ */
504
+ /**
505
+ * Returns player stream timestamp
506
+ * @returns {PlayerTimestamp}
507
+ */
508
+ getPlayerTimestamp(): {
509
+ current: string;
510
+ end: string;
511
+ progress: number;
512
+ };
513
+ /**
514
+ * Creates progress bar string
515
+ * @param {PlayerProgressbarOptions} options The progress bar options
516
+ * @returns {string}
517
+ */
518
+ createProgressBar(options?: PlayerProgressbarOptions): string;
519
+ /**
520
+ * Total duration
521
+ * @type {Number}
522
+ */
523
+ get totalTime(): number;
524
+ /**
525
+ * Play stream in a voice/stage channel
526
+ * @param {Track} [src] The track to play (if empty, uses first track from the queue)
527
+ * @param {PlayOptions} [options] The options
528
+ * @returns {Promise<void>}
529
+ */
530
+ play(src?: Track, options?: PlayOptions): Promise<void>;
531
+ /**
532
+ * Private method to handle autoplay
533
+ * @param {Track} track The source track to find its similar track for autoplay
534
+ * @returns {Promise<void>}
535
+ * @private
536
+ */
537
+ private _handleAutoplay;
538
+ [Symbol.iterator](): Generator<Track, void, undefined>;
539
+ /**
540
+ * JSON representation of this queue
541
+ * @returns {object}
542
+ */
543
+ toJSON(): {
544
+ id: string;
545
+ guild: string;
546
+ voiceChannel: string;
547
+ options: PlayerOptions;
548
+ tracks: TrackJSON[];
549
+ };
550
+ /**
551
+ * String representation of this queue
552
+ * @returns {string}
553
+ */
554
+ toString(): string;
320
555
  }
321
556
 
322
- declare class Queue<T = unknown> {
323
- #private;
324
- readonly guild: Guild;
325
- readonly player: Player;
326
- connection: StreamDispatcher;
327
- tracks: Track[];
328
- previousTracks: Track[];
329
- options: PlayerOptions;
330
- playing: boolean;
331
- metadata?: T;
332
- repeatMode: QueueRepeatMode;
333
- readonly id: string;
334
- private _streamTime;
335
- _cooldownsTimeout: Collection<string, NodeJS.Timeout>;
336
- private _activeFilters;
337
- private _filtersUpdate;
338
- onBeforeCreateStream: (track: Track, source: TrackSource, queue: Queue) => Promise<Readable | undefined>;
339
- /**
340
- * Queue constructor
341
- * @param {Player} player The player that instantiated this queue
342
- * @param {Guild} guild The guild that instantiated this queue
343
- * @param {PlayerOptions} [options={}] Player options for the queue
344
- */
345
- constructor(player: Player, guild: Guild, options?: PlayerOptions);
346
- /**
347
- * Returns current track
348
- * @type {Track}
349
- */
350
- get current(): Track;
351
- /**
352
- * If this queue is destroyed
353
- * @type {boolean}
354
- */
355
- get destroyed(): boolean;
356
- /**
357
- * Returns current track
358
- * @returns {Track}
359
- */
360
- nowPlaying(): Track;
361
- /**
362
- * Connects to a voice channel
363
- * @param {GuildChannelResolvable} channel The voice/stage channel
364
- * @returns {Promise<Queue>}
365
- */
366
- connect(channel: GuildChannelResolvable): Promise<this>;
367
- /**
368
- * Destroys this queue
369
- * @param {boolean} [disconnect=this.options.leaveOnStop] If it should leave on destroy
370
- * @returns {void}
371
- */
372
- destroy(disconnect?: boolean): void;
373
- /**
374
- * Skips current track
375
- * @returns {boolean}
376
- */
377
- skip(): boolean;
378
- /**
379
- * Adds single track to the queue
380
- * @param {Track} track The track to add
381
- * @returns {void}
382
- */
383
- addTrack(track: Track): void;
384
- /**
385
- * Adds multiple tracks to the queue
386
- * @param {Track[]} tracks Array of tracks to add
387
- */
388
- addTracks(tracks: Track[]): void;
389
- /**
390
- * Sets paused state
391
- * @param {boolean} paused The paused state
392
- * @returns {boolean}
393
- */
394
- setPaused(paused?: boolean): boolean;
395
- /**
396
- * Sets bitrate
397
- * @param {number|auto} bitrate bitrate to set
398
- * @returns {void}
399
- */
400
- setBitrate(bitrate: number | "auto"): void;
401
- /**
402
- * Sets volume
403
- * @param {number} amount The volume amount
404
- * @returns {boolean}
405
- */
406
- setVolume(amount: number): boolean;
407
- /**
408
- * Sets repeat mode
409
- * @param {QueueRepeatMode} mode The repeat mode
410
- * @returns {boolean}
411
- */
412
- setRepeatMode(mode: QueueRepeatMode): boolean;
413
- /**
414
- * The current volume amount
415
- * @type {number}
416
- */
417
- get volume(): number;
418
- set volume(amount: number);
419
- /**
420
- * The stream time of this queue
421
- * @type {number}
422
- */
423
- get streamTime(): number;
424
- set streamTime(time: number);
425
- /**
426
- * Returns enabled filters
427
- * @returns {AudioFilters}
428
- */
429
- getFiltersEnabled(): (keyof QueueFilters)[];
430
- /**
431
- * Returns disabled filters
432
- * @returns {AudioFilters}
433
- */
434
- getFiltersDisabled(): (keyof QueueFilters)[];
435
- /**
436
- * Sets filters
437
- * @param {QueueFilters} filters Queue filters
438
- * @returns {Promise<void>}
439
- */
440
- setFilters(filters?: QueueFilters): Promise<void>;
441
- /**
442
- * Seeks to the given time
443
- * @param {number} position The position
444
- * @returns {boolean}
445
- */
446
- seek(position: number): Promise<boolean>;
447
- /**
448
- * Plays previous track
449
- * @returns {Promise<void>}
450
- */
451
- back(): Promise<void>;
452
- /**
453
- * Clear this queue
454
- */
455
- clear(): void;
456
- /**
457
- * Stops the player
458
- * @returns {void}
459
- */
460
- stop(): void;
461
- /**
462
- * Shuffles this queue
463
- * @returns {boolean}
464
- */
465
- shuffle(): boolean;
466
- /**
467
- * Removes a track from the queue
468
- * @param {Track|string|number} track The track to remove
469
- * @returns {Track}
470
- */
471
- remove(track: Track | string | number): Track;
472
- /**
473
- * Returns the index of the specified track. If found, returns the track index else returns -1.
474
- * @param {number|Track|string} track The track
475
- * @returns {number}
476
- */
477
- getTrackPosition(track: number | Track | string): number;
478
- /**
479
- * Jumps to particular track
480
- * @param {Track|number} track The track
481
- * @returns {void}
482
- */
483
- jump(track: Track | number): void;
484
- /**
485
- * Jumps to particular track, removing other tracks on the way
486
- * @param {Track|number} track The track
487
- * @returns {void}
488
- */
489
- skipTo(track: Track | number): void;
490
- /**
491
- * Inserts the given track to specified index
492
- * @param {Track} track The track to insert
493
- * @param {number} [index=0] The index where this track should be
494
- */
495
- insert(track: Track, index?: number): void;
496
- /**
497
- * @typedef {object} PlayerTimestamp
498
- * @property {string} current The current progress
499
- * @property {string} end The total time
500
- * @property {number} progress Progress in %
501
- */
502
- /**
503
- * Returns player stream timestamp
504
- * @returns {PlayerTimestamp}
505
- */
506
- getPlayerTimestamp(): {
507
- current: string;
508
- end: string;
509
- progress: number;
510
- };
511
- /**
512
- * Creates progress bar string
513
- * @param {PlayerProgressbarOptions} options The progress bar options
514
- * @returns {string}
515
- */
516
- createProgressBar(options?: PlayerProgressbarOptions): string;
517
- /**
518
- * Total duration
519
- * @type {Number}
520
- */
521
- get totalTime(): number;
522
- /**
523
- * Play stream in a voice/stage channel
524
- * @param {Track} [src] The track to play (if empty, uses first track from the queue)
525
- * @param {PlayOptions} [options={}] The options
526
- * @returns {Promise<void>}
527
- */
528
- play(src?: Track, options?: PlayOptions): Promise<void>;
529
- /**
530
- * Private method to handle autoplay
531
- * @param {Track} track The source track to find its similar track for autoplay
532
- * @returns {Promise<void>}
533
- * @private
534
- */
535
- private _handleAutoplay;
536
- [Symbol.iterator](): Generator<Track, void, undefined>;
537
- /**
538
- * JSON representation of this queue
539
- * @returns {object}
540
- */
541
- toJSON(): {
542
- id: string;
543
- guild: string;
544
- voiceChannel: string;
545
- options: PlayerOptions;
546
- tracks: TrackJSON[];
547
- };
548
- /**
549
- * String representation of this queue
550
- * @returns {string}
551
- */
552
- toString(): string;
557
+ declare type FiltersName = keyof QueueFilters;
558
+ interface PlayerSearchResult {
559
+ playlist: Playlist | null;
560
+ tracks: Track[];
561
+ }
562
+ /**
563
+ * @typedef {AudioFilters} QueueFilters
564
+ */
565
+ interface QueueFilters {
566
+ bassboost_low?: boolean;
567
+ bassboost?: boolean;
568
+ bassboost_high?: boolean;
569
+ "8D"?: boolean;
570
+ vaporwave?: boolean;
571
+ nightcore?: boolean;
572
+ phaser?: boolean;
573
+ tremolo?: boolean;
574
+ vibrato?: boolean;
575
+ reverse?: boolean;
576
+ treble?: boolean;
577
+ normalizer?: boolean;
578
+ normalizer2?: boolean;
579
+ surrounding?: boolean;
580
+ pulsator?: boolean;
581
+ subboost?: boolean;
582
+ karaoke?: boolean;
583
+ flanger?: boolean;
584
+ gate?: boolean;
585
+ haas?: boolean;
586
+ mcompand?: boolean;
587
+ mono?: boolean;
588
+ mstlr?: boolean;
589
+ mstrr?: boolean;
590
+ compressor?: boolean;
591
+ expander?: boolean;
592
+ softlimiter?: boolean;
593
+ chorus?: boolean;
594
+ chorus2d?: boolean;
595
+ chorus3d?: boolean;
596
+ fadein?: boolean;
597
+ dim?: boolean;
598
+ earrape?: boolean;
599
+ }
600
+ /**
601
+ * The track source:
602
+ * - soundcloud
603
+ * - youtube
604
+ * - spotify
605
+ * - arbitrary
606
+ * @typedef {string} TrackSource
607
+ */
608
+ declare type TrackSource = "soundcloud" | "youtube" | "spotify" | "arbitrary";
609
+ /**
610
+ * @typedef {object} RawTrackData
611
+ * @property {string} title The title
612
+ * @property {string} description The description
613
+ * @property {string} author The author
614
+ * @property {string} url The url
615
+ * @property {string} thumbnail The thumbnail
616
+ * @property {string} duration The duration
617
+ * @property {number} views The views
618
+ * @property {User} requestedBy The user who requested this track
619
+ * @property {Playlist} [playlist] The playlist
620
+ * @property {TrackSource} [source="arbitrary"] The source
621
+ * @property {any} [engine] The engine
622
+ * @property {boolean} [live] If this track is live
623
+ * @property {any} [raw] The raw data
624
+ */
625
+ interface RawTrackData {
626
+ title: string;
627
+ description: string;
628
+ author: string;
629
+ url: string;
630
+ thumbnail: string;
631
+ duration: string;
632
+ views: number;
633
+ requestedBy: User;
634
+ playlist?: Playlist;
635
+ source?: TrackSource;
636
+ engine?: any;
637
+ live?: boolean;
638
+ raw?: any;
639
+ }
640
+ /**
641
+ * @typedef {object} TimeData
642
+ * @property {number} days Time in days
643
+ * @property {number} hours Time in hours
644
+ * @property {number} minutes Time in minutes
645
+ * @property {number} seconds Time in seconds
646
+ */
647
+ interface TimeData {
648
+ days: number;
649
+ hours: number;
650
+ minutes: number;
651
+ seconds: number;
652
+ }
653
+ /**
654
+ * @typedef {object} PlayerProgressbarOptions
655
+ * @property {boolean} [timecodes] If it should render time codes
656
+ * @property {boolean} [queue] If it should create progress bar for the whole queue
657
+ * @property {number} [length] The bar length
658
+ * @property {string} [line] The bar track
659
+ * @property {string} [indicator] The indicator
660
+ */
661
+ interface PlayerProgressbarOptions {
662
+ timecodes?: boolean;
663
+ length?: number;
664
+ line?: string;
665
+ indicator?: string;
666
+ queue?: boolean;
667
+ }
668
+ /**
669
+ * @typedef {object} PlayerOptions
670
+ * @property {boolean} [leaveOnEnd=true] If it should leave on end
671
+ * @property {boolean} [leaveOnStop=true] If it should leave on stop
672
+ * @property {boolean} [leaveOnEmpty=true] If it should leave on empty
673
+ * @property {number} [leaveOnEmptyCooldown=1000] The cooldown in ms
674
+ * @property {boolean} [autoSelfDeaf=true] If it should set the bot in deaf mode
675
+ * @property {YTDLDownloadOptions} [ytdlOptions] The youtube download options
676
+ * @property {number} [initialVolume=100] The initial player volume
677
+ * @property {number} [bufferingTimeout=3000] Buffering timeout for the stream
678
+ * @property {boolean} [spotifyBridge=true] If player should bridge spotify source to youtube
679
+ * @property {boolean} [disableVolume=false] If player should disable inline volume
680
+ * @property {number} [volumeSmoothness=0] The volume transition smoothness between volume changes (lower the value to get better result)
681
+ * Setting this or leaving this empty will disable this effect. Example: `volumeSmoothness: 0.1`
682
+ * @property {Function} [onBeforeCreateStream] Runs before creating stream
683
+ */
684
+ interface PlayerOptions {
685
+ leaveOnEnd?: boolean;
686
+ leaveOnStop?: boolean;
687
+ leaveOnEmpty?: boolean;
688
+ leaveOnEmptyCooldown?: number;
689
+ autoSelfDeaf?: boolean;
690
+ ytdlOptions?: downloadOptions;
691
+ initialVolume?: number;
692
+ bufferingTimeout?: number;
693
+ spotifyBridge?: boolean;
694
+ disableVolume?: boolean;
695
+ volumeSmoothness?: number;
696
+ onBeforeCreateStream?: (track: Track, source: TrackSource, queue: Queue) => Promise<Readable>;
697
+ }
698
+ /**
699
+ * @typedef {object} ExtractorModelData
700
+ * @property {object} [playlist] The playlist info (if any)
701
+ * @property {string} [playlist.title] The playlist title
702
+ * @property {string} [playlist.description] The playlist description
703
+ * @property {string} [playlist.thumbnail] The playlist thumbnail
704
+ * @property {album|playlist} [playlist.type] The playlist type: `album` | `playlist`
705
+ * @property {TrackSource} [playlist.source] The playlist source
706
+ * @property {object} [playlist.author] The playlist author
707
+ * @property {string} [playlist.author.name] The author name
708
+ * @property {string} [playlist.author.url] The author url
709
+ * @property {string} [playlist.id] The playlist id
710
+ * @property {string} [playlist.url] The playlist url
711
+ * @property {any} [playlist.rawPlaylist] The raw data
712
+ * @property {ExtractorData[]} data The data
713
+ */
714
+ /**
715
+ * @typedef {object} ExtractorData
716
+ * @property {string} title The title
717
+ * @property {number} duration The duration
718
+ * @property {string} thumbnail The thumbnail
719
+ * @property {string|Readable|Duplex} engine The stream engine
720
+ * @property {number} views The views count
721
+ * @property {string} author The author
722
+ * @property {string} description The description
723
+ * @property {string} url The url
724
+ * @property {string} [version] The extractor version
725
+ * @property {TrackSource} [source="arbitrary"] The source
726
+ */
727
+ interface ExtractorModelData {
728
+ playlist?: {
729
+ title: string;
730
+ description: string;
731
+ thumbnail: string;
732
+ type: "album" | "playlist";
733
+ source: TrackSource;
734
+ author: {
735
+ name: string;
736
+ url: string;
737
+ };
738
+ id: string;
739
+ url: string;
740
+ rawPlaylist?: any;
741
+ };
742
+ data: {
743
+ title: string;
744
+ duration: number;
745
+ thumbnail: string;
746
+ engine: string | Readable | Duplex;
747
+ views: number;
748
+ author: string;
749
+ description: string;
750
+ url: string;
751
+ version?: string;
752
+ source?: TrackSource;
753
+ }[];
754
+ }
755
+ /**
756
+ * The search query type
757
+ * This can be one of:
758
+ * - AUTO
759
+ * - YOUTUBE
760
+ * - YOUTUBE_PLAYLIST
761
+ * - SOUNDCLOUD_TRACK
762
+ * - SOUNDCLOUD_PLAYLIST
763
+ * - SOUNDCLOUD
764
+ * - SPOTIFY_SONG
765
+ * - SPOTIFY_ALBUM
766
+ * - SPOTIFY_PLAYLIST
767
+ * - FACEBOOK
768
+ * - VIMEO
769
+ * - ARBITRARY
770
+ * - REVERBNATION
771
+ * - YOUTUBE_SEARCH
772
+ * - YOUTUBE_VIDEO
773
+ * - SOUNDCLOUD_SEARCH
774
+ * @typedef {number} QueryType
775
+ */
776
+ declare enum QueryType {
777
+ AUTO = 0,
778
+ YOUTUBE = 1,
779
+ YOUTUBE_PLAYLIST = 2,
780
+ SOUNDCLOUD_TRACK = 3,
781
+ SOUNDCLOUD_PLAYLIST = 4,
782
+ SOUNDCLOUD = 5,
783
+ SPOTIFY_SONG = 6,
784
+ SPOTIFY_ALBUM = 7,
785
+ SPOTIFY_PLAYLIST = 8,
786
+ FACEBOOK = 9,
787
+ VIMEO = 10,
788
+ ARBITRARY = 11,
789
+ REVERBNATION = 12,
790
+ YOUTUBE_SEARCH = 13,
791
+ YOUTUBE_VIDEO = 14,
792
+ SOUNDCLOUD_SEARCH = 15
793
+ }
794
+ /**
795
+ * Emitted when bot gets disconnected from a voice channel
796
+ * @event Player#botDisconnect
797
+ * @param {Queue} queue The queue
798
+ */
799
+ /**
800
+ * Emitted when the voice channel is empty
801
+ * @event Player#channelEmpty
802
+ * @param {Queue} queue The queue
803
+ */
804
+ /**
805
+ * Emitted when bot connects to a voice channel
806
+ * @event Player#connectionCreate
807
+ * @param {Queue} queue The queue
808
+ * @param {StreamDispatcher} connection The discord player connection object
809
+ */
810
+ /**
811
+ * Debug information
812
+ * @event Player#debug
813
+ * @param {Queue} queue The queue
814
+ * @param {string} message The message
815
+ */
816
+ /**
817
+ * Emitted on error
818
+ * <warn>This event should handled properly otherwise it may crash your process!</warn>
819
+ * @event Player#error
820
+ * @param {Queue} queue The queue
821
+ * @param {Error} error The error
822
+ */
823
+ /**
824
+ * Emitted on connection error. Sometimes stream errors are emitted here as well.
825
+ * @event Player#connectionError
826
+ * @param {Queue} queue The queue
827
+ * @param {Error} error The error
828
+ */
829
+ /**
830
+ * Emitted when queue ends
831
+ * @event Player#queueEnd
832
+ * @param {Queue} queue The queue
833
+ */
834
+ /**
835
+ * Emitted when a single track is added
836
+ * @event Player#trackAdd
837
+ * @param {Queue} queue The queue
838
+ * @param {Track} track The track
839
+ */
840
+ /**
841
+ * Emitted when multiple tracks are added
842
+ * @event Player#tracksAdd
843
+ * @param {Queue} queue The queue
844
+ * @param {Track[]} tracks The tracks
845
+ */
846
+ /**
847
+ * Emitted when a track starts playing
848
+ * @event Player#trackStart
849
+ * @param {Queue} queue The queue
850
+ * @param {Track} track The track
851
+ */
852
+ /**
853
+ * Emitted when a track ends
854
+ * @event Player#trackEnd
855
+ * @param {Queue} queue The queue
856
+ * @param {Track} track The track
857
+ */
858
+ interface PlayerEvents {
859
+ botDisconnect: (queue: Queue) => any;
860
+ channelEmpty: (queue: Queue) => any;
861
+ connectionCreate: (queue: Queue, connection: StreamDispatcher) => any;
862
+ debug: (queue: Queue, message: string) => any;
863
+ error: (queue: Queue, error: Error) => any;
864
+ connectionError: (queue: Queue, error: Error) => any;
865
+ queueEnd: (queue: Queue) => any;
866
+ trackAdd: (queue: Queue, track: Track) => any;
867
+ tracksAdd: (queue: Queue, track: Track[]) => any;
868
+ trackStart: (queue: Queue, track: Track) => any;
869
+ trackEnd: (queue: Queue, track: Track) => any;
870
+ }
871
+ /**
872
+ * @typedef {object} PlayOptions
873
+ * @property {boolean} [filtersUpdate=false] If this play was triggered for filters update
874
+ * @property {string[]} [encoderArgs=[]] FFmpeg args passed to encoder
875
+ * @property {number} [seek] Time to seek to before playing
876
+ * @property {boolean} [immediate=false] If it should start playing the provided track immediately
877
+ */
878
+ interface PlayOptions {
879
+ filtersUpdate?: boolean;
880
+ encoderArgs?: string[];
881
+ seek?: number;
882
+ immediate?: boolean;
883
+ }
884
+ /**
885
+ * @typedef {object} SearchOptions
886
+ * @property {UserResolvable} requestedBy The user who requested this search
887
+ * @property {QueryType|string} [searchEngine=QueryType.AUTO] The query search engine, can be extractor name to target specific one (custom)
888
+ * @property {boolean} [blockExtractor=false] If it should block custom extractors
889
+ */
890
+ interface SearchOptions {
891
+ requestedBy: UserResolvable;
892
+ searchEngine?: QueryType | string;
893
+ blockExtractor?: boolean;
894
+ }
895
+ /**
896
+ * The queue repeat mode. This can be one of:
897
+ * - OFF
898
+ * - TRACK
899
+ * - QUEUE
900
+ * - AUTOPLAY
901
+ * @typedef {number} QueueRepeatMode
902
+ */
903
+ declare enum QueueRepeatMode {
904
+ OFF = 0,
905
+ TRACK = 1,
906
+ QUEUE = 2,
907
+ AUTOPLAY = 3
908
+ }
909
+ /**
910
+ * @typedef {object} PlaylistInitData
911
+ * @property {Track[]} tracks The tracks of this playlist
912
+ * @property {string} title The playlist title
913
+ * @property {string} description The description
914
+ * @property {string} thumbnail The thumbnail
915
+ * @property {album|playlist} type The playlist type: `album` | `playlist`
916
+ * @property {TrackSource} source The playlist source
917
+ * @property {object} author The playlist author
918
+ * @property {string} [author.name] The author name
919
+ * @property {string} [author.url] The author url
920
+ * @property {string} id The playlist id
921
+ * @property {string} url The playlist url
922
+ * @property {any} [rawPlaylist] The raw playlist data
923
+ */
924
+ interface PlaylistInitData {
925
+ tracks: Track[];
926
+ title: string;
927
+ description: string;
928
+ thumbnail: string;
929
+ type: "album" | "playlist";
930
+ source: TrackSource;
931
+ author: {
932
+ name: string;
933
+ url: string;
934
+ };
935
+ id: string;
936
+ url: string;
937
+ rawPlaylist?: any;
938
+ }
939
+ /**
940
+ * @typedef {object} TrackJSON
941
+ * @property {string} title The track title
942
+ * @property {string} description The track description
943
+ * @property {string} author The author
944
+ * @property {string} url The url
945
+ * @property {string} thumbnail The thumbnail
946
+ * @property {string} duration The duration
947
+ * @property {number} durationMS The duration in ms
948
+ * @property {number} views The views count
949
+ * @property {Snowflake} requestedBy The id of the user who requested this track
950
+ * @property {PlaylistJSON} [playlist] The playlist info (if any)
951
+ */
952
+ interface TrackJSON {
953
+ id: Snowflake;
954
+ title: string;
955
+ description: string;
956
+ author: string;
957
+ url: string;
958
+ thumbnail: string;
959
+ duration: string;
960
+ durationMS: number;
961
+ views: number;
962
+ requestedBy: Snowflake;
963
+ playlist?: PlaylistJSON;
964
+ }
965
+ /**
966
+ * @typedef {object} PlaylistJSON
967
+ * @property {string} id The playlist id
968
+ * @property {string} url The playlist url
969
+ * @property {string} title The playlist title
970
+ * @property {string} description The playlist description
971
+ * @property {string} thumbnail The thumbnail
972
+ * @property {album|playlist} type The playlist type: `album` | `playlist`
973
+ * @property {TrackSource} source The track source
974
+ * @property {object} author The playlist author
975
+ * @property {string} [author.name] The author name
976
+ * @property {string} [author.url] The author url
977
+ * @property {TrackJSON[]} tracks The tracks data (if any)
978
+ */
979
+ interface PlaylistJSON {
980
+ id: string;
981
+ url: string;
982
+ title: string;
983
+ description: string;
984
+ thumbnail: string;
985
+ type: "album" | "playlist";
986
+ source: TrackSource;
987
+ author: {
988
+ name: string;
989
+ url: string;
990
+ };
991
+ tracks: TrackJSON[];
992
+ }
993
+ /**
994
+ * @typedef {object} PlayerInitOptions
995
+ * @property {boolean} [autoRegisterExtractor=true] If it should automatically register `@discord-player/extractor`
996
+ * @property {YTDLDownloadOptions} [ytdlOptions] The options passed to `ytdl-core`
997
+ * @property {number} [connectionTimeout=20000] The voice connection timeout
998
+ */
999
+ interface PlayerInitOptions {
1000
+ autoRegisterExtractor?: boolean;
1001
+ ytdlOptions?: downloadOptions;
1002
+ connectionTimeout?: number;
553
1003
  }
554
1004
 
555
- declare type FiltersName = keyof QueueFilters;
556
- interface PlayerSearchResult {
557
- playlist: Playlist | null;
558
- tracks: Track[];
559
- }
560
- /**
561
- * @typedef {AudioFilters} QueueFilters
562
- */
563
- interface QueueFilters {
564
- bassboost_low?: boolean;
565
- bassboost?: boolean;
566
- bassboost_high?: boolean;
567
- "8D"?: boolean;
568
- vaporwave?: boolean;
569
- nightcore?: boolean;
570
- phaser?: boolean;
571
- tremolo?: boolean;
572
- vibrato?: boolean;
573
- reverse?: boolean;
574
- treble?: boolean;
575
- normalizer?: boolean;
576
- normalizer2?: boolean;
577
- surrounding?: boolean;
578
- pulsator?: boolean;
579
- subboost?: boolean;
580
- karaoke?: boolean;
581
- flanger?: boolean;
582
- gate?: boolean;
583
- haas?: boolean;
584
- mcompand?: boolean;
585
- mono?: boolean;
586
- mstlr?: boolean;
587
- mstrr?: boolean;
588
- compressor?: boolean;
589
- expander?: boolean;
590
- softlimiter?: boolean;
591
- chorus?: boolean;
592
- chorus2d?: boolean;
593
- chorus3d?: boolean;
594
- fadein?: boolean;
595
- dim?: boolean;
596
- earrape?: boolean;
597
- }
598
- /**
599
- * The track source:
600
- * - soundcloud
601
- * - youtube
602
- * - spotify
603
- * - arbitrary
604
- * @typedef {string} TrackSource
605
- */
606
- declare type TrackSource = "soundcloud" | "youtube" | "spotify" | "arbitrary";
607
- /**
608
- * @typedef {object} RawTrackData
609
- * @property {string} title The title
610
- * @property {string} description The description
611
- * @property {string} author The author
612
- * @property {string} url The url
613
- * @property {string} thumbnail The thumbnail
614
- * @property {string} duration The duration
615
- * @property {number} views The views
616
- * @property {User} requestedBy The user who requested this track
617
- * @property {Playlist} [playlist] The playlist
618
- * @property {TrackSource} [source="arbitrary"] The source
619
- * @property {any} [engine] The engine
620
- * @property {boolean} [live] If this track is live
621
- * @property {any} [raw] The raw data
622
- */
623
- interface RawTrackData {
624
- title: string;
625
- description: string;
626
- author: string;
627
- url: string;
628
- thumbnail: string;
629
- duration: string;
630
- views: number;
631
- requestedBy: User;
632
- playlist?: Playlist;
633
- source?: TrackSource;
634
- engine?: any;
635
- live?: boolean;
636
- raw?: any;
637
- }
638
- /**
639
- * @typedef {object} TimeData
640
- * @property {number} days Time in days
641
- * @property {number} hours Time in hours
642
- * @property {number} minutes Time in minutes
643
- * @property {number} seconds Time in seconds
644
- */
645
- interface TimeData {
646
- days: number;
647
- hours: number;
648
- minutes: number;
649
- seconds: number;
650
- }
651
- /**
652
- * @typedef {object} PlayerProgressbarOptions
653
- * @property {boolean} [timecodes] If it should render time codes
654
- * @property {boolean} [queue] If it should create progress bar for the whole queue
655
- * @property {number} [length] The bar length
656
- * @property {string} [line] The bar track
657
- * @property {string} [indicator] The indicator
658
- */
659
- interface PlayerProgressbarOptions {
660
- timecodes?: boolean;
661
- length?: number;
662
- line?: string;
663
- indicator?: string;
664
- queue?: boolean;
665
- }
666
- /**
667
- * @typedef {object} PlayerOptions
668
- * @property {boolean} [leaveOnEnd=true] If it should leave on end
669
- * @property {boolean} [leaveOnStop=true] If it should leave on stop
670
- * @property {boolean} [leaveOnEmpty=true] If it should leave on empty
671
- * @property {number} [leaveOnEmptyCooldown=1000] The cooldown in ms
672
- * @property {boolean} [autoSelfDeaf=true] If it should set the bot in deaf mode
673
- * @property {YTDLDownloadOptions} [ytdlOptions={}] The youtube download options
674
- * @property {number} [initialVolume=100] The initial player volume
675
- * @property {number} [bufferingTimeout=3000] Buffering timeout for the stream
676
- * @property {boolean} [spotifyBridge=true] If player should bridge spotify source to youtube
677
- * @property {boolean} [disableVolume=false] If player should disable inline volume
678
- * @property {boolean} [volumeSmoothness=0] The volume transition smoothness between volume changes (lower the value to get better result)
679
- * Setting this or leaving this empty will disable this effect. Example: `volumeSmoothness: 0.1`
680
- * @property {Function} [onBeforeCreateStream] Runs before creating stream
681
- */
682
- interface PlayerOptions {
683
- leaveOnEnd?: boolean;
684
- leaveOnStop?: boolean;
685
- leaveOnEmpty?: boolean;
686
- leaveOnEmptyCooldown?: number;
687
- autoSelfDeaf?: boolean;
688
- ytdlOptions?: downloadOptions;
689
- initialVolume?: number;
690
- bufferingTimeout?: number;
691
- spotifyBridge?: boolean;
692
- disableVolume?: boolean;
693
- volumeSmoothness?: number;
694
- onBeforeCreateStream?: (track: Track, source: TrackSource, queue: Queue) => Promise<Readable>;
695
- }
696
- /**
697
- * @typedef {object} ExtractorModelData
698
- * @property {object} [playlist] The playlist info (if any)
699
- * @property {string} [playlist.title] The playlist title
700
- * @property {string} [playlist.description] The playlist description
701
- * @property {string} [playlist.thumbnail] The playlist thumbnail
702
- * @property {album|playlist} [playlist.type] The playlist type: `album` | `playlist`
703
- * @property {TrackSource} [playlist.source] The playlist source
704
- * @property {object} [playlist.author] The playlist author
705
- * @property {string} [playlist.author.name] The author name
706
- * @property {string} [playlist.author.url] The author url
707
- * @property {string} [playlist.id] The playlist id
708
- * @property {string} [playlist.url] The playlist url
709
- * @property {any} [playlist.rawPlaylist] The raw data
710
- * @property {ExtractorData[]} data The data
711
- */
712
- /**
713
- * @typedef {object} ExtractorData
714
- * @property {string} title The title
715
- * @property {number} duration The duration
716
- * @property {string} thumbnail The thumbnail
717
- * @property {string|Readable|Duplex} engine The stream engine
718
- * @property {number} views The views count
719
- * @property {string} author The author
720
- * @property {string} description The description
721
- * @property {string} url The url
722
- * @property {string} [version] The extractor version
723
- * @property {TrackSource} [source="arbitrary"] The source
724
- */
725
- interface ExtractorModelData {
726
- playlist?: {
727
- title: string;
728
- description: string;
729
- thumbnail: string;
730
- type: "album" | "playlist";
731
- source: TrackSource;
732
- author: {
733
- name: string;
734
- url: string;
735
- };
736
- id: string;
737
- url: string;
738
- rawPlaylist?: any;
739
- };
740
- data: {
741
- title: string;
742
- duration: number;
743
- thumbnail: string;
744
- engine: string | Readable | Duplex;
745
- views: number;
746
- author: string;
747
- description: string;
748
- url: string;
749
- version?: string;
750
- source?: TrackSource;
751
- }[];
752
- }
753
- /**
754
- * The search query type
755
- * This can be one of:
756
- * - AUTO
757
- * - YOUTUBE
758
- * - YOUTUBE_PLAYLIST
759
- * - SOUNDCLOUD_TRACK
760
- * - SOUNDCLOUD_PLAYLIST
761
- * - SOUNDCLOUD
762
- * - SPOTIFY_SONG
763
- * - SPOTIFY_ALBUM
764
- * - SPOTIFY_PLAYLIST
765
- * - FACEBOOK
766
- * - VIMEO
767
- * - ARBITRARY
768
- * - REVERBNATION
769
- * - YOUTUBE_SEARCH
770
- * - YOUTUBE_VIDEO
771
- * - SOUNDCLOUD_SEARCH
772
- * @typedef {number} QueryType
773
- */
774
- declare enum QueryType {
775
- AUTO = 0,
776
- YOUTUBE = 1,
777
- YOUTUBE_PLAYLIST = 2,
778
- SOUNDCLOUD_TRACK = 3,
779
- SOUNDCLOUD_PLAYLIST = 4,
780
- SOUNDCLOUD = 5,
781
- SPOTIFY_SONG = 6,
782
- SPOTIFY_ALBUM = 7,
783
- SPOTIFY_PLAYLIST = 8,
784
- FACEBOOK = 9,
785
- VIMEO = 10,
786
- ARBITRARY = 11,
787
- REVERBNATION = 12,
788
- YOUTUBE_SEARCH = 13,
789
- YOUTUBE_VIDEO = 14,
790
- SOUNDCLOUD_SEARCH = 15
791
- }
792
- /**
793
- * Emitted when bot gets disconnected from a voice channel
794
- * @event Player#botDisconnect
795
- * @param {Queue} queue The queue
796
- */
797
- /**
798
- * Emitted when the voice channel is empty
799
- * @event Player#channelEmpty
800
- * @param {Queue} queue The queue
801
- */
802
- /**
803
- * Emitted when bot connects to a voice channel
804
- * @event Player#connectionCreate
805
- * @param {Queue} queue The queue
806
- * @param {StreamDispatcher} connection The discord player connection object
807
- */
808
- /**
809
- * Debug information
810
- * @event Player#debug
811
- * @param {Queue} queue The queue
812
- * @param {string} message The message
813
- */
814
- /**
815
- * Emitted on error
816
- * <warn>This event should handled properly otherwise it may crash your process!</warn>
817
- * @event Player#error
818
- * @param {Queue} queue The queue
819
- * @param {Error} error The error
820
- */
821
- /**
822
- * Emitted on connection error. Sometimes stream errors are emitted here as well.
823
- * @event Player#connectionError
824
- * @param {Queue} queue The queue
825
- * @param {Error} error The error
826
- */
827
- /**
828
- * Emitted when queue ends
829
- * @event Player#queueEnd
830
- * @param {Queue} queue The queue
831
- */
832
- /**
833
- * Emitted when a single track is added
834
- * @event Player#trackAdd
835
- * @param {Queue} queue The queue
836
- * @param {Track} track The track
837
- */
838
- /**
839
- * Emitted when multiple tracks are added
840
- * @event Player#tracksAdd
841
- * @param {Queue} queue The queue
842
- * @param {Track[]} tracks The tracks
843
- */
844
- /**
845
- * Emitted when a track starts playing
846
- * @event Player#trackStart
847
- * @param {Queue} queue The queue
848
- * @param {Track} track The track
849
- */
850
- /**
851
- * Emitted when a track ends
852
- * @event Player#trackEnd
853
- * @param {Queue} queue The queue
854
- * @param {Track} track The track
855
- */
856
- interface PlayerEvents {
857
- botDisconnect: (queue: Queue) => any;
858
- channelEmpty: (queue: Queue) => any;
859
- connectionCreate: (queue: Queue, connection: StreamDispatcher) => any;
860
- debug: (queue: Queue, message: string) => any;
861
- error: (queue: Queue, error: Error) => any;
862
- connectionError: (queue: Queue, error: Error) => any;
863
- queueEnd: (queue: Queue) => any;
864
- trackAdd: (queue: Queue, track: Track) => any;
865
- tracksAdd: (queue: Queue, track: Track[]) => any;
866
- trackStart: (queue: Queue, track: Track) => any;
867
- trackEnd: (queue: Queue, track: Track) => any;
868
- }
869
- /**
870
- * @typedef {object} PlayOptions
871
- * @property {boolean} [filtersUpdate=false] If this play was triggered for filters update
872
- * @property {string[]} [encoderArgs=[]] FFmpeg args passed to encoder
873
- * @property {number} [seek] Time to seek to before playing
874
- * @property {boolean} [immediate=false] If it should start playing the provided track immediately
875
- */
876
- interface PlayOptions {
877
- filtersUpdate?: boolean;
878
- encoderArgs?: string[];
879
- seek?: number;
880
- immediate?: boolean;
881
- }
882
- /**
883
- * @typedef {object} SearchOptions
884
- * @property {UserResolvable} requestedBy The user who requested this search
885
- * @property {QueryType|string} [searchEngine=QueryType.AUTO] The query search engine, can be extractor name to target specific one (custom)
886
- * @property {boolean} [blockExtractor=false] If it should block custom extractors
887
- */
888
- interface SearchOptions {
889
- requestedBy: UserResolvable;
890
- searchEngine?: QueryType | string;
891
- blockExtractor?: boolean;
892
- }
893
- /**
894
- * The queue repeat mode. This can be one of:
895
- * - OFF
896
- * - TRACK
897
- * - QUEUE
898
- * - AUTOPLAY
899
- * @typedef {number} QueueRepeatMode
900
- */
901
- declare enum QueueRepeatMode {
902
- OFF = 0,
903
- TRACK = 1,
904
- QUEUE = 2,
905
- AUTOPLAY = 3
906
- }
907
- /**
908
- * @typedef {object} PlaylistInitData
909
- * @property {Track[]} tracks The tracks of this playlist
910
- * @property {string} title The playlist title
911
- * @property {string} description The description
912
- * @property {string} thumbnail The thumbnail
913
- * @property {album|playlist} type The playlist type: `album` | `playlist`
914
- * @property {TrackSource} source The playlist source
915
- * @property {object} author The playlist author
916
- * @property {string} [author.name] The author name
917
- * @property {string} [author.url] The author url
918
- * @property {string} id The playlist id
919
- * @property {string} url The playlist url
920
- * @property {any} [rawPlaylist] The raw playlist data
921
- */
922
- interface PlaylistInitData {
923
- tracks: Track[];
924
- title: string;
925
- description: string;
926
- thumbnail: string;
927
- type: "album" | "playlist";
928
- source: TrackSource;
929
- author: {
930
- name: string;
931
- url: string;
932
- };
933
- id: string;
934
- url: string;
935
- rawPlaylist?: any;
936
- }
937
- /**
938
- * @typedef {object} TrackJSON
939
- * @property {string} title The track title
940
- * @property {string} description The track description
941
- * @property {string} author The author
942
- * @property {string} url The url
943
- * @property {string} thumbnail The thumbnail
944
- * @property {string} duration The duration
945
- * @property {number} durationMS The duration in ms
946
- * @property {number} views The views count
947
- * @property {Snowflake} requestedBy The id of the user who requested this track
948
- * @property {PlaylistJSON} [playlist] The playlist info (if any)
949
- */
950
- interface TrackJSON {
951
- id: Snowflake;
952
- title: string;
953
- description: string;
954
- author: string;
955
- url: string;
956
- thumbnail: string;
957
- duration: string;
958
- durationMS: number;
959
- views: number;
960
- requestedBy: Snowflake;
961
- playlist?: PlaylistJSON;
962
- }
963
- /**
964
- * @typedef {object} PlaylistJSON
965
- * @property {string} id The playlist id
966
- * @property {string} url The playlist url
967
- * @property {string} title The playlist title
968
- * @property {string} description The playlist description
969
- * @property {string} thumbnail The thumbnail
970
- * @property {album|playlist} type The playlist type: `album` | `playlist`
971
- * @property {TrackSource} source The track source
972
- * @property {object} author The playlist author
973
- * @property {string} [author.name] The author name
974
- * @property {string} [author.url] The author url
975
- * @property {TrackJSON[]} tracks The tracks data (if any)
976
- */
977
- interface PlaylistJSON {
978
- id: string;
979
- url: string;
980
- title: string;
981
- description: string;
982
- thumbnail: string;
983
- type: "album" | "playlist";
984
- source: TrackSource;
985
- author: {
986
- name: string;
987
- url: string;
988
- };
989
- tracks: TrackJSON[];
990
- }
991
- /**
992
- * @typedef {object} PlayerInitOptions
993
- * @property {boolean} [autoRegisterExtractor=true] If it should automatically register `@discord-player/extractor`
994
- * @property {YTDLDownloadOptions} [ytdlOptions={}] The options passed to `ytdl-core`
995
- * @property {number} [connectionTimeout=20000] The voice connection timeout
996
- */
997
- interface PlayerInitOptions {
998
- autoRegisterExtractor?: boolean;
999
- ytdlOptions?: downloadOptions;
1000
- connectionTimeout?: number;
1005
+ declare class AudioFilters {
1006
+ constructor();
1007
+ static get filters(): Record<FiltersName, string>;
1008
+ static get<K extends FiltersName>(name: K): Record<keyof QueueFilters, string>[K];
1009
+ static has<K extends FiltersName>(name: K): boolean;
1010
+ static [Symbol.iterator](): IterableIterator<{
1011
+ name: FiltersName;
1012
+ value: string;
1013
+ }>;
1014
+ static get names(): (keyof QueueFilters)[];
1015
+ static get length(): number;
1016
+ static toString(): string;
1017
+ /**
1018
+ * Create ffmpeg args from the specified filters name
1019
+ * @param filter The filter name
1020
+ * @returns
1021
+ */
1022
+ static create(filters?: FiltersName[]): string;
1023
+ /**
1024
+ * Defines audio filter
1025
+ * @param filterName The name of the filter
1026
+ * @param value The ffmpeg args
1027
+ */
1028
+ static define(filterName: string, value: string): void;
1029
+ /**
1030
+ * Defines multiple audio filters
1031
+ * @param filtersArray Array of filters containing the filter name and ffmpeg args
1032
+ */
1033
+ static defineBulk(filtersArray: {
1034
+ name: string;
1035
+ value: string;
1036
+ }[]): void;
1001
1037
  }
1002
1038
 
1003
- /**
1004
- * The available audio filters
1005
- * @typedef {object} AudioFilters
1006
- * @property {string} bassboost_low The bassboost filter (+15dB)
1007
- * @property {string} bassboost The bassboost filter (+20dB)
1008
- * @property {string} bassboost_high The bassboost filter (+30dB)
1009
- * @property {string} 8D The 8D filter
1010
- * @property {string} vaporwave The vaporwave filter
1011
- * @property {string} nightcore The nightcore filter
1012
- * @property {string} phaser The phaser filter
1013
- * @property {string} tremolo The tremolo filter
1014
- * @property {string} vibrato The vibrato filter
1015
- * @property {string} reverse The reverse filter
1016
- * @property {string} treble The treble filter
1017
- * @property {string} normalizer The normalizer filter (dynamic audio normalizer based)
1018
- * @property {string} normalizer2 The normalizer filter (audio compressor based)
1019
- * @property {string} surrounding The surrounding filter
1020
- * @property {string} pulsator The pulsator filter
1021
- * @property {string} subboost The subboost filter
1022
- * @property {string} karaoke The kakaoke filter
1023
- * @property {string} flanger The flanger filter
1024
- * @property {string} gate The gate filter
1025
- * @property {string} haas The haas filter
1026
- * @property {string} mcompand The mcompand filter
1027
- * @property {string} mono The mono filter
1028
- * @property {string} mstlr The mstlr filter
1029
- * @property {string} mstrr The mstrr filter
1030
- * @property {string} compressor The compressor filter
1031
- * @property {string} expander The expander filter
1032
- * @property {string} softlimiter The softlimiter filter
1033
- * @property {string} chorus The chorus filter
1034
- * @property {string} chorus2d The chorus2d filter
1035
- * @property {string} chorus3d The chorus3d filter
1036
- * @property {string} fadein The fadein filter
1037
- * @property {string} dim The dim filter
1038
- * @property {string} earrape The earrape filter
1039
- */
1040
- declare const FilterList: {
1041
- bassboost_low: string;
1042
- bassboost: string;
1043
- bassboost_high: string;
1044
- "8D": string;
1045
- vaporwave: string;
1046
- nightcore: string;
1047
- phaser: string;
1048
- tremolo: string;
1049
- vibrato: string;
1050
- reverse: string;
1051
- treble: string;
1052
- normalizer: string;
1053
- normalizer2: string;
1054
- surrounding: string;
1055
- pulsator: string;
1056
- subboost: string;
1057
- karaoke: string;
1058
- flanger: string;
1059
- gate: string;
1060
- haas: string;
1061
- mcompand: string;
1062
- mono: string;
1063
- mstlr: string;
1064
- mstrr: string;
1065
- compressor: string;
1066
- expander: string;
1067
- softlimiter: string;
1068
- chorus: string;
1069
- chorus2d: string;
1070
- chorus3d: string;
1071
- fadein: string;
1072
- dim: string;
1073
- earrape: string;
1074
- [Symbol.iterator](): IterableIterator<{
1075
- name: FiltersName;
1076
- value: string;
1077
- }>;
1078
- readonly names: (keyof QueueFilters)[];
1079
- readonly length: number;
1080
- toString(): string;
1081
- create(filter?: FiltersName[]): string;
1082
- define(filterName: string, value: string): void;
1083
- defineBulk(filterArray: {
1084
- name: string;
1085
- value: string;
1086
- }[]): void;
1087
- };
1039
+ declare enum ErrorStatusCode {
1040
+ STREAM_ERROR = "StreamError",
1041
+ AUDIO_PLAYER_ERROR = "AudioPlayerError",
1042
+ PLAYER_ERROR = "PlayerError",
1043
+ NO_AUDIO_RESOURCE = "NoAudioResource",
1044
+ UNKNOWN_GUILD = "UnknownGuild",
1045
+ INVALID_ARG_TYPE = "InvalidArgType",
1046
+ UNKNOWN_EXTRACTOR = "UnknownExtractor",
1047
+ INVALID_EXTRACTOR = "InvalidExtractor",
1048
+ INVALID_CHANNEL_TYPE = "InvalidChannelType",
1049
+ INVALID_TRACK = "InvalidTrack",
1050
+ UNKNOWN_REPEAT_MODE = "UnknownRepeatMode",
1051
+ TRACK_NOT_FOUND = "TrackNotFound",
1052
+ NO_CONNECTION = "NoConnection",
1053
+ DESTROYED_QUEUE = "DestroyedQueue"
1054
+ }
1055
+ declare class PlayerError extends Error {
1056
+ message: string;
1057
+ statusCode: ErrorStatusCode;
1058
+ createdAt: Date;
1059
+ constructor(message: string, code?: ErrorStatusCode);
1060
+ get createdTimestamp(): number;
1061
+ valueOf(): ErrorStatusCode;
1062
+ toJSON(): {
1063
+ stack: string;
1064
+ code: ErrorStatusCode;
1065
+ message: string;
1066
+ created: number;
1067
+ };
1068
+ toString(): string;
1069
+ }
1088
1070
 
1089
- declare enum ErrorStatusCode {
1090
- STREAM_ERROR = "StreamError",
1091
- AUDIO_PLAYER_ERROR = "AudioPlayerError",
1092
- PLAYER_ERROR = "PlayerError",
1093
- NO_AUDIO_RESOURCE = "NoAudioResource",
1094
- UNKNOWN_GUILD = "UnknownGuild",
1095
- INVALID_ARG_TYPE = "InvalidArgType",
1096
- UNKNOWN_EXTRACTOR = "UnknownExtractor",
1097
- INVALID_EXTRACTOR = "InvalidExtractor",
1098
- INVALID_CHANNEL_TYPE = "InvalidChannelType",
1099
- INVALID_TRACK = "InvalidTrack",
1100
- UNKNOWN_REPEAT_MODE = "UnknownRepeatMode",
1101
- TRACK_NOT_FOUND = "TrackNotFound",
1102
- NO_CONNECTION = "NoConnection",
1103
- DESTROYED_QUEUE = "DestroyedQueue"
1104
- }
1105
- declare class PlayerError extends Error {
1106
- message: string;
1107
- statusCode: ErrorStatusCode;
1108
- createdAt: Date;
1109
- constructor(message: string, code?: ErrorStatusCode);
1110
- get createdTimestamp(): number;
1111
- valueOf(): ErrorStatusCode;
1112
- toJSON(): {
1113
- stack: string;
1114
- code: ErrorStatusCode;
1115
- message: string;
1116
- created: number;
1117
- };
1118
- toString(): string;
1071
+ declare class QueryResolver {
1072
+ /**
1073
+ * Query resolver
1074
+ */
1075
+ private constructor();
1076
+ /**
1077
+ * Resolves the given search query
1078
+ * @param {string} query The query
1079
+ * @returns {QueryType}
1080
+ */
1081
+ static resolve(query: string): QueryType;
1082
+ /**
1083
+ * Parses vimeo id from url
1084
+ * @param {string} query The query
1085
+ * @returns {string}
1086
+ */
1087
+ static getVimeoID(query: string): string;
1119
1088
  }
1120
1089
 
1121
- declare class QueryResolver {
1122
- /**
1123
- * Query resolver
1124
- */
1125
- private constructor();
1126
- /**
1127
- * Resolves the given search query
1128
- * @param {string} query The query
1129
- * @returns {QueryType}
1130
- */
1131
- static resolve(query: string): QueryType;
1132
- /**
1133
- * Parses vimeo id from url
1134
- * @param {string} query The query
1135
- * @returns {string}
1136
- */
1137
- static getVimeoID(query: string): string;
1090
+ declare class Util {
1091
+ /**
1092
+ * Utils
1093
+ */
1094
+ private constructor();
1095
+ /**
1096
+ * Creates duration string
1097
+ * @param {object} durObj The duration object
1098
+ * @returns {string}
1099
+ */
1100
+ static durationString(durObj: Record<string, number>): string;
1101
+ /**
1102
+ * Parses milliseconds to consumable time object
1103
+ * @param {number} milliseconds The time in ms
1104
+ * @returns {TimeData}
1105
+ */
1106
+ static parseMS(milliseconds: number): TimeData;
1107
+ /**
1108
+ * Builds time code
1109
+ * @param {TimeData} duration The duration object
1110
+ * @returns {string}
1111
+ */
1112
+ static buildTimeCode(duration: TimeData): string;
1113
+ /**
1114
+ * Picks last item of the given array
1115
+ * @param {any[]} arr The array
1116
+ * @returns {any}
1117
+ */
1118
+ static last<T = any>(arr: T[]): T;
1119
+ /**
1120
+ * Checks if the voice channel is empty
1121
+ * @param {VoiceChannel|StageChannel} channel The voice channel
1122
+ * @returns {boolean}
1123
+ */
1124
+ static isVoiceEmpty(channel: VoiceChannel | StageChannel): boolean;
1125
+ /**
1126
+ * Safer require
1127
+ * @param {string} id Node require id
1128
+ * @returns {any}
1129
+ */
1130
+ static require(id: string): any;
1131
+ /**
1132
+ * Asynchronous timeout
1133
+ * @param {number} time The time in ms to wait
1134
+ * @returns {Promise<unknown>}
1135
+ */
1136
+ static wait(time: number): Promise<unknown>;
1137
+ static noop(): void;
1138
+ static getFetch(): Promise<any>;
1138
1139
  }
1139
1140
 
1140
- declare class Util {
1141
- /**
1142
- * Utils
1143
- */
1144
- private constructor();
1145
- /**
1146
- * Creates duration string
1147
- * @param {object} durObj The duration object
1148
- * @returns {string}
1149
- */
1150
- static durationString(durObj: Record<string, number>): string;
1151
- /**
1152
- * Parses milliseconds to consumable time object
1153
- * @param {number} milliseconds The time in ms
1154
- * @returns {TimeData}
1155
- */
1156
- static parseMS(milliseconds: number): TimeData;
1157
- /**
1158
- * Builds time code
1159
- * @param {TimeData} duration The duration object
1160
- * @returns {string}
1161
- */
1162
- static buildTimeCode(duration: TimeData): string;
1163
- /**
1164
- * Picks last item of the given array
1165
- * @param {any[]} arr The array
1166
- * @returns {any}
1167
- */
1168
- static last<T = any>(arr: T[]): T;
1169
- /**
1170
- * Checks if the voice channel is empty
1171
- * @param {VoiceChannel|StageChannel} channel The voice channel
1172
- * @returns {boolean}
1173
- */
1174
- static isVoiceEmpty(channel: VoiceChannel | StageChannel): boolean;
1175
- /**
1176
- * Safer require
1177
- * @param {string} id Node require id
1178
- * @returns {any}
1179
- */
1180
- static require(id: string): any;
1181
- /**
1182
- * Asynchronous timeout
1183
- * @param {number} time The time in ms to wait
1184
- * @returns {Promise<unknown>}
1185
- */
1186
- static wait(time: number): Promise<unknown>;
1187
- static noop(): void;
1188
- static getFetch(): Promise<any>;
1141
+ interface FFmpegStreamOptions {
1142
+ fmt?: string;
1143
+ encoderArgs?: string[];
1144
+ seek?: number;
1145
+ skip?: boolean;
1189
1146
  }
1147
+ declare function FFMPEG_ARGS_STRING(stream: string, fmt?: string): string[];
1148
+ declare function FFMPEG_ARGS_PIPED(fmt?: string): string[];
1149
+ /**
1150
+ * Creates FFmpeg stream
1151
+ * @param stream The source stream
1152
+ * @param options FFmpeg stream options
1153
+ */
1154
+ declare function createFFmpegStream(stream: Readable | Duplex | string, options?: FFmpegStreamOptions): Readable | Duplex;
1190
1155
 
1191
1156
  declare const version: string;
1192
1157
 
1193
- export { FilterList as AudioFilters, ErrorStatusCode, ExtractorModel, ExtractorModelData, FiltersName, PlayOptions, Player, PlayerError, PlayerEvents, PlayerInitOptions, PlayerOptions, PlayerProgressbarOptions, PlayerSearchResult, Playlist, PlaylistInitData, PlaylistJSON, QueryResolver, QueryType, Queue, QueueFilters, QueueRepeatMode, RawTrackData, SearchOptions, StreamDispatcher, TimeData, Track, TrackJSON, TrackSource, Util, VoiceEvents, VoiceUtils, version };
1158
+ export { AudioFilters, ErrorStatusCode, ExtractorModel, ExtractorModelData, FFMPEG_ARGS_PIPED, FFMPEG_ARGS_STRING, FFmpegStreamOptions, FiltersName, PlayOptions, Player, PlayerError, PlayerEvents, PlayerInitOptions, PlayerOptions, PlayerProgressbarOptions, PlayerSearchResult, Playlist, PlaylistInitData, PlaylistJSON, QueryResolver, QueryType, Queue, QueueFilters, QueueRepeatMode, RawTrackData, SearchOptions, StreamDispatcher, TimeData, Track, TrackJSON, TrackSource, Util, VoiceEvents, VoiceUtils, createFFmpegStream, version };