discord-player 6.0.0-dev.4 → 6.0.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
@@ -8,1773 +8,1960 @@ import * as _discord_player_equalizer from '@discord-player/equalizer';
8
8
  import { PCMFilters, EqualizerBand, BiquadFilters, FiltersChain } from '@discord-player/equalizer';
9
9
  export { AF_NIGHTCORE_RATE, AF_VAPORWAVE_RATE, BASS_EQ_BANDS, FilterType as BiquadFilterType, BiquadFilters, FiltersChain, AudioFilters as PCMAudioFilters, PCMFilters, Q_BUTTERWORTH, VolumeTransformer } from '@discord-player/equalizer';
10
10
  import { RequestOptions } from 'http';
11
- import Fuse from 'fuse.js';
12
11
  import { downloadOptions } from 'ytdl-core';
13
12
 
14
- declare class PlayerEventsEmitter<L extends ListenerSignature<L> = DefaultListener> extends EventEmitter<L> {
15
- requiredEvents: Array<keyof L>;
16
- constructor(requiredEvents?: Array<keyof L>);
17
- emit<K extends keyof L>(name: K, ...args: Parameters<L[K]>): boolean;
13
+ declare class PlayerEventsEmitter<L extends ListenerSignature<L> = DefaultListener> extends EventEmitter<L> {
14
+ requiredEvents: Array<keyof L>;
15
+ constructor(requiredEvents?: Array<keyof L>);
16
+ emit<K extends keyof L>(name: K, ...args: Parameters<L[K]>): boolean;
18
17
  }
19
18
 
20
- declare class Playlist {
21
- readonly player: Player;
22
- tracks: Track[];
23
- title: string;
24
- description: string;
25
- thumbnail: string;
26
- type: 'album' | 'playlist';
27
- source: TrackSource;
28
- author: {
29
- name: string;
30
- url: string;
31
- };
32
- id: string;
33
- url: string;
34
- readonly rawPlaylist?: any;
35
- /**
36
- * Playlist constructor
37
- * @param {Player} player The player
38
- * @param {PlaylistInitData} data The data
39
- */
40
- constructor(player: Player, data: PlaylistInitData);
41
- [Symbol.iterator](): Generator<Track, void, undefined>;
42
- /**
43
- * JSON representation of this playlist
44
- * @param {boolean} [withTracks=true] If it should build json with tracks
45
- * @returns {PlaylistJSON}
46
- */
47
- toJSON(withTracks?: boolean): PlaylistJSON;
19
+ declare class Playlist {
20
+ readonly player: Player;
21
+ tracks: Track[];
22
+ title: string;
23
+ description: string;
24
+ thumbnail: string;
25
+ type: 'album' | 'playlist';
26
+ source: TrackSource;
27
+ author: {
28
+ name: string;
29
+ url: string;
30
+ };
31
+ id: string;
32
+ url: string;
33
+ readonly rawPlaylist?: any;
34
+ /**
35
+ * Playlist constructor
36
+ * @param {Player} player The player
37
+ * @param {PlaylistInitData} data The data
38
+ */
39
+ constructor(player: Player, data: PlaylistInitData);
40
+ [Symbol.iterator](): Generator<Track, void, undefined>;
41
+ /**
42
+ * Estimated duration of this playlist
43
+ */
44
+ get estimatedDuration(): number;
45
+ /**
46
+ * Formatted estimated duration of this playlist
47
+ */
48
+ get durationFormatted(): string;
49
+ /**
50
+ * JSON representation of this playlist
51
+ * @param {boolean} [withTracks=true] If it should build json with tracks
52
+ * @returns {PlaylistJSON}
53
+ */
54
+ toJSON(withTracks?: boolean): PlaylistJSON;
48
55
  }
49
56
 
50
- declare class ExtractorExecutionContext {
51
- player: Player;
52
- store: Collection<string, BaseExtractor>;
53
- constructor(player: Player);
54
- loadDefault(): Promise<{
55
- success: boolean;
56
- error: Error;
57
- } | {
58
- success: boolean;
59
- error: null;
60
- }>;
61
- isRegistered(identifier: string): boolean;
62
- get size(): number;
63
- get(identifier: string): BaseExtractor | undefined;
64
- register(_extractor: typeof BaseExtractor): Promise<void>;
65
- unregister<K extends string | BaseExtractor>(_extractor: K): Promise<void>;
66
- unregisterAll(): Promise<void>;
67
- run<T = unknown>(fn: ExtractorExecutionFN<T>, filterBlocked?: boolean): Promise<ExtractorExecutionResult<T> | null>;
68
- }
69
- interface ExtractorExecutionResult<T = unknown> {
70
- extractor: BaseExtractor;
71
- result: T;
72
- }
57
+ declare class ExtractorExecutionContext {
58
+ player: Player;
59
+ store: Collection<string, BaseExtractor>;
60
+ constructor(player: Player);
61
+ loadDefault(): Promise<{
62
+ success: boolean;
63
+ error: Error;
64
+ } | {
65
+ success: boolean;
66
+ error: null;
67
+ }>;
68
+ isRegistered(identifier: string): boolean;
69
+ get size(): number;
70
+ get(identifier: string): BaseExtractor | undefined;
71
+ register(_extractor: typeof BaseExtractor): Promise<void>;
72
+ unregister<K extends string | BaseExtractor>(_extractor: K): Promise<void>;
73
+ unregisterAll(): Promise<void>;
74
+ run<T = unknown>(fn: ExtractorExecutionFN<T>, filterBlocked?: boolean): Promise<ExtractorExecutionResult<T> | null>;
75
+ }
76
+ interface ExtractorExecutionResult<T = unknown> {
77
+ extractor: BaseExtractor;
78
+ result: T;
79
+ }
73
80
  type ExtractorExecutionFN<T = unknown> = (extractor: BaseExtractor) => Promise<T | boolean>;
74
81
 
75
- declare class BaseExtractor {
76
- context: ExtractorExecutionContext;
77
- /**
78
- * Identifier for this extractor
79
- */
80
- static identifier: string;
81
- /**
82
- * Extractor constructor
83
- * @param context Context that instantiated this extractor
84
- */
85
- constructor(context: ExtractorExecutionContext);
86
- /**
87
- * Identifier of this extractor
88
- */
89
- get identifier(): string;
90
- /**
91
- * This method will be executed when this extractor is activated
92
- */
93
- activate(): Promise<void>;
94
- /**
95
- * This method will be executed when this extractor is deactivated
96
- */
97
- deactivate(): Promise<void>;
98
- /**
99
- * Validate incoming query
100
- * @param query The query to validate
101
- */
102
- validate(query: string, type?: SearchQueryType | null): Promise<boolean>;
103
- /**
104
- * Stream the given track
105
- * @param info The track to stream
106
- */
107
- stream(info: Track): Promise<Readable | string>;
108
- /**
109
- * Handle the given query
110
- * @param query The query to handle
111
- */
112
- handle(query: string, context: ExtractorSearchContext): Promise<ExtractorInfo>;
113
- /**
114
- * A stream middleware to handle streams before passing it to the player
115
- * @param stream The incoming stream
116
- * @param next The next function
117
- */
118
- handlePostStream(stream: Readable, next: NextFunction): void;
119
- /**
120
- * Dispatch an event to the player
121
- * @param event The event to dispatch
122
- * @param args The data to dispatch
123
- */
124
- emit<K extends keyof PlayerEvents>(event: K, ...args: Parameters<PlayerEvents[K]>): boolean;
125
- /**
126
- * Create extractor response
127
- * @param playlist The playlist
128
- * @param tracks The track array
129
- */
130
- createResponse(playlist?: Playlist | null, tracks?: Track[]): ExtractorInfo;
131
- /**
132
- * Write debug message
133
- * @param message The debug message
134
- */
135
- debug(message: string): boolean;
136
- }
137
- type NextFunction = (error?: Error | null, stream?: Readable) => void;
138
- interface ExtractorInfo {
139
- playlist: Playlist | null;
140
- tracks: Track[];
141
- }
142
- interface ExtractorSearchContext {
143
- type?: SearchQueryType | null;
144
- requestedBy?: User | null;
145
- requestOptions?: RequestOptions;
82
+ declare class BaseExtractor {
83
+ context: ExtractorExecutionContext;
84
+ /**
85
+ * Identifier for this extractor
86
+ */
87
+ static identifier: string;
88
+ /**
89
+ * Extractor constructor
90
+ * @param context Context that instantiated this extractor
91
+ */
92
+ constructor(context: ExtractorExecutionContext);
93
+ /**
94
+ * Identifier of this extractor
95
+ */
96
+ get identifier(): string;
97
+ /**
98
+ * This method will be executed when this extractor is activated
99
+ */
100
+ activate(): Promise<void>;
101
+ /**
102
+ * This method will be executed when this extractor is deactivated
103
+ */
104
+ deactivate(): Promise<void>;
105
+ /**
106
+ * Validate incoming query
107
+ * @param query The query to validate
108
+ */
109
+ validate(query: string, type?: SearchQueryType | null): Promise<boolean>;
110
+ /**
111
+ * Stream the given track
112
+ * @param info The track to stream
113
+ */
114
+ stream(info: Track): Promise<Readable | string>;
115
+ /**
116
+ * Handle the given query
117
+ * @param query The query to handle
118
+ */
119
+ handle(query: string, context: ExtractorSearchContext): Promise<ExtractorInfo>;
120
+ /**
121
+ * A stream middleware to handle streams before passing it to the player
122
+ * @param stream The incoming stream
123
+ * @param next The next function
124
+ */
125
+ handlePostStream(stream: Readable, next: NextFunction): void;
126
+ /**
127
+ * Dispatch an event to the player
128
+ * @param event The event to dispatch
129
+ * @param args The data to dispatch
130
+ */
131
+ emit<K extends keyof PlayerEvents>(event: K, ...args: Parameters<PlayerEvents[K]>): boolean;
132
+ /**
133
+ * Create extractor response
134
+ * @param playlist The playlist
135
+ * @param tracks The track array
136
+ */
137
+ createResponse(playlist?: Playlist | null, tracks?: Track[]): ExtractorInfo;
138
+ /**
139
+ * Write debug message
140
+ * @param message The debug message
141
+ */
142
+ debug(message: string): boolean;
143
+ }
144
+ type NextFunction = (error?: Error | null, stream?: Readable) => void;
145
+ interface ExtractorInfo {
146
+ playlist: Playlist | null;
147
+ tracks: Track[];
148
+ }
149
+ interface ExtractorSearchContext {
150
+ type?: SearchQueryType | null;
151
+ requestedBy?: User | null;
152
+ requestOptions?: RequestOptions;
146
153
  }
147
154
 
148
- type TrackResolvable = Track | string | number;
149
- declare class Track {
150
- player: Player;
151
- title: string;
152
- description: string;
153
- author: string;
154
- url: string;
155
- thumbnail: string;
156
- duration: string;
157
- views: number;
158
- requestedBy: User | null;
159
- playlist?: Playlist;
160
- queryType: SearchQueryType | null | undefined;
161
- raw: RawTrackData;
162
- extractor: BaseExtractor | null;
163
- readonly id: string;
164
- /**
165
- * Track constructor
166
- * @param {Player} player The player that instantiated this Track
167
- * @param {RawTrackData} data Track data
168
- */
169
- constructor(player: Player, data: RawTrackData);
170
- private _patch;
171
- /**
172
- * The queue in which this track is located
173
- * @type {Queue}
174
- */
175
- get queue(): GuildQueue;
176
- /**
177
- * The track duration in millisecond
178
- * @type {number}
179
- */
180
- get durationMS(): number;
181
- /**
182
- * Returns source of this track
183
- * @type {TrackSource}
184
- */
185
- get source(): TrackSource;
186
- /**
187
- * String representation of this track
188
- * @returns {string}
189
- */
190
- toString(): string;
191
- /**
192
- * Raw JSON representation of this track
193
- * @returns {TrackJSON}
194
- */
195
- toJSON(hidePlaylist?: boolean): TrackJSON;
155
+ type TrackResolvable = Track | string | number;
156
+ declare class Track {
157
+ player: Player;
158
+ title: string;
159
+ description: string;
160
+ author: string;
161
+ url: string;
162
+ thumbnail: string;
163
+ duration: string;
164
+ views: number;
165
+ requestedBy: User | null;
166
+ playlist?: Playlist;
167
+ queryType: SearchQueryType | null | undefined;
168
+ raw: RawTrackData;
169
+ extractor: BaseExtractor | null;
170
+ readonly id: string;
171
+ /**
172
+ * Track constructor
173
+ * @param {Player} player The player that instantiated this Track
174
+ * @param {RawTrackData} data Track data
175
+ */
176
+ constructor(player: Player, data: RawTrackData);
177
+ private _patch;
178
+ /**
179
+ * The queue in which this track is located
180
+ * @type {Queue}
181
+ */
182
+ get queue(): GuildQueue;
183
+ /**
184
+ * The track duration in millisecond
185
+ * @type {number}
186
+ */
187
+ get durationMS(): number;
188
+ /**
189
+ * Returns source of this track
190
+ * @type {TrackSource}
191
+ */
192
+ get source(): TrackSource;
193
+ /**
194
+ * String representation of this track
195
+ * @returns {string}
196
+ */
197
+ toString(): string;
198
+ /**
199
+ * Raw JSON representation of this track
200
+ * @returns {TrackJSON}
201
+ */
202
+ toJSON(hidePlaylist?: boolean): TrackJSON;
196
203
  }
197
204
 
198
- interface CreateStreamOps {
199
- type?: StreamType;
200
- data?: any;
201
- disableVolume?: boolean;
202
- disableEqualizer?: boolean;
203
- disableBiquad?: boolean;
204
- eq?: EqualizerBand[];
205
- biquadFilter?: BiquadFilters;
206
- disableFilters?: boolean;
207
- defaultFilters?: PCMFilters[];
208
- volume?: number;
209
- disableResampler?: boolean;
210
- sampleRate?: number;
211
- }
212
- interface VoiceEvents {
213
- error: (error: AudioPlayerError) => any;
214
- debug: (message: string) => any;
215
- start: (resource: AudioResource<Track>) => any;
216
- finish: (resource: AudioResource<Track>) => any;
217
- dsp: (filters: PCMFilters[]) => any;
218
- eqBands: (filters: EqualizerBand[]) => any;
219
- sampleRate: (filters: number) => any;
220
- biquad: (filters: BiquadFilters) => any;
221
- volume: (volume: number) => any;
222
- }
223
- declare class StreamDispatcher extends EventEmitter<VoiceEvents> {
224
- queue: GuildQueue;
225
- readonly connectionTimeout: number;
226
- readonly voiceConnection: VoiceConnection;
227
- readonly audioPlayer: AudioPlayer;
228
- receiver: VoiceReceiverNode;
229
- channel: VoiceChannel | StageChannel;
230
- audioResource?: AudioResource<Track> | null;
231
- private readyLock;
232
- dsp: FiltersChain;
233
- /**
234
- * Creates new connection object
235
- * @param {VoiceConnection} connection The connection
236
- * @param {VoiceChannel|StageChannel} channel The connected channel
237
- * @private
238
- */
239
- constructor(connection: VoiceConnection, channel: VoiceChannel | StageChannel, queue: GuildQueue, connectionTimeout?: number);
240
- /**
241
- * Check if the player has been paused manually
242
- */
243
- get paused(): boolean;
244
- set paused(val: boolean);
245
- /**
246
- * Whether or not the player is currently paused automatically or manually.
247
- */
248
- isPaused(): boolean;
249
- /**
250
- * Whether or not the player is currently buffering
251
- */
252
- isBuffering(): boolean;
253
- /**
254
- * Whether or not the player is currently playing
255
- */
256
- isPlaying(): boolean;
257
- /**
258
- * Whether or not the player is currently idle
259
- */
260
- isIdle(): boolean;
261
- /**
262
- * Creates stream
263
- * @param {Readable} src The stream source
264
- * @param {object} [ops] Options
265
- * @returns {AudioResource}
266
- */
267
- createStream(src: Readable, ops?: CreateStreamOps): Promise<AudioResource<Track>>;
268
- get resampler(): _discord_player_equalizer.PCMResampler | null;
269
- get filters(): _discord_player_equalizer.AudioFilter | null;
270
- get biquad(): _discord_player_equalizer.BiquadStream | null;
271
- get equalizer(): _discord_player_equalizer.EqualizerStream | null;
272
- /**
273
- * The player status
274
- * @type {AudioPlayerStatus}
275
- */
276
- get status(): AudioPlayerStatus;
277
- /**
278
- * Disconnects from voice
279
- * @returns {void}
280
- */
281
- disconnect(): void;
282
- /**
283
- * Stops the player
284
- * @returns {void}
285
- */
286
- end(): void;
287
- /**
288
- * Pauses the stream playback
289
- * @param {boolean} [interpolateSilence=false] If true, the player will play 5 packets of silence after pausing to prevent audio glitches.
290
- * @returns {boolean}
291
- */
292
- pause(interpolateSilence?: boolean): boolean;
293
- /**
294
- * Resumes the stream playback
295
- * @returns {boolean}
296
- */
297
- resume(): boolean;
298
- /**
299
- * Play stream
300
- * @param {AudioResource<Track>} [resource=this.audioResource] The audio resource to play
301
- * @returns {Promise<StreamDispatcher>}
302
- */
303
- playStream(resource?: AudioResource<Track>): Promise<this | undefined>;
304
- /**
305
- * Sets playback volume
306
- * @param {number} value The volume amount
307
- * @returns {boolean}
308
- */
309
- setVolume(value: number): boolean;
310
- /**
311
- * The current volume
312
- * @type {number}
313
- */
314
- get volume(): number;
315
- /**
316
- * The playback time
317
- * @type {number}
318
- */
319
- get streamTime(): number;
205
+ interface CreateStreamOps {
206
+ type?: StreamType;
207
+ data?: any;
208
+ disableVolume?: boolean;
209
+ disableEqualizer?: boolean;
210
+ disableBiquad?: boolean;
211
+ eq?: EqualizerBand[];
212
+ biquadFilter?: BiquadFilters;
213
+ disableFilters?: boolean;
214
+ defaultFilters?: PCMFilters[];
215
+ volume?: number;
216
+ disableResampler?: boolean;
217
+ sampleRate?: number;
218
+ }
219
+ interface VoiceEvents {
220
+ error: (error: AudioPlayerError) => any;
221
+ debug: (message: string) => any;
222
+ start: (resource: AudioResource<Track>) => any;
223
+ finish: (resource: AudioResource<Track>) => any;
224
+ dsp: (filters: PCMFilters[]) => any;
225
+ eqBands: (filters: EqualizerBand[]) => any;
226
+ sampleRate: (filters: number) => any;
227
+ biquad: (filters: BiquadFilters) => any;
228
+ volume: (volume: number) => any;
229
+ }
230
+ declare class StreamDispatcher extends EventEmitter<VoiceEvents> {
231
+ queue: GuildQueue;
232
+ readonly connectionTimeout: number;
233
+ readonly voiceConnection: VoiceConnection;
234
+ readonly audioPlayer: AudioPlayer;
235
+ receiver: VoiceReceiverNode;
236
+ channel: VoiceChannel | StageChannel;
237
+ audioResource?: AudioResource<Track> | null;
238
+ private readyLock;
239
+ dsp: FiltersChain;
240
+ /**
241
+ * Creates new connection object
242
+ * @param {VoiceConnection} connection The connection
243
+ * @param {VoiceChannel|StageChannel} channel The connected channel
244
+ * @private
245
+ */
246
+ constructor(connection: VoiceConnection, channel: VoiceChannel | StageChannel, queue: GuildQueue, connectionTimeout?: number);
247
+ /**
248
+ * Check if the player has been paused manually
249
+ */
250
+ get paused(): boolean;
251
+ set paused(val: boolean);
252
+ /**
253
+ * Whether or not the player is currently paused automatically or manually.
254
+ */
255
+ isPaused(): boolean;
256
+ /**
257
+ * Whether or not the player is currently buffering
258
+ */
259
+ isBuffering(): boolean;
260
+ /**
261
+ * Whether or not the player is currently playing
262
+ */
263
+ isPlaying(): boolean;
264
+ /**
265
+ * Whether or not the player is currently idle
266
+ */
267
+ isIdle(): boolean;
268
+ /**
269
+ * Whether or not the voice connection has been destroyed
270
+ */
271
+ isDestroyed(): boolean;
272
+ /**
273
+ * Whether or not the voice connection has been destroyed
274
+ */
275
+ isDisconnected(): boolean;
276
+ /**
277
+ * Whether or not the voice connection is ready to play
278
+ */
279
+ isReady(): boolean;
280
+ /**
281
+ * Whether or not the voice connection is signalling
282
+ */
283
+ isSignalling(): boolean;
284
+ /**
285
+ * Whether or not the voice connection is connecting
286
+ */
287
+ isConnecting(): boolean;
288
+ /**
289
+ * Creates stream
290
+ * @param {Readable} src The stream source
291
+ * @param {object} [ops] Options
292
+ * @returns {AudioResource}
293
+ */
294
+ createStream(src: Readable, ops?: CreateStreamOps): Promise<AudioResource<Track>>;
295
+ get resampler(): _discord_player_equalizer.PCMResampler | null;
296
+ get filters(): _discord_player_equalizer.AudioFilter | null;
297
+ get biquad(): _discord_player_equalizer.BiquadStream | null;
298
+ get equalizer(): _discord_player_equalizer.EqualizerStream | null;
299
+ /**
300
+ * The player status
301
+ * @type {AudioPlayerStatus}
302
+ */
303
+ get status(): AudioPlayerStatus;
304
+ /**
305
+ * Disconnects from voice
306
+ * @returns {void}
307
+ */
308
+ disconnect(): void;
309
+ /**
310
+ * Stops the player
311
+ * @returns {void}
312
+ */
313
+ end(): void;
314
+ /**
315
+ * Pauses the stream playback
316
+ * @param {boolean} [interpolateSilence=false] If true, the player will play 5 packets of silence after pausing to prevent audio glitches.
317
+ * @returns {boolean}
318
+ */
319
+ pause(interpolateSilence?: boolean): boolean;
320
+ /**
321
+ * Resumes the stream playback
322
+ * @returns {boolean}
323
+ */
324
+ resume(): boolean;
325
+ /**
326
+ * Play stream
327
+ * @param {AudioResource<Track>} [resource=this.audioResource] The audio resource to play
328
+ * @returns {Promise<StreamDispatcher>}
329
+ */
330
+ playStream(resource?: AudioResource<Track>): Promise<this | undefined>;
331
+ /**
332
+ * Sets playback volume
333
+ * @param {number} value The volume amount
334
+ * @returns {boolean}
335
+ */
336
+ setVolume(value: number): boolean;
337
+ /**
338
+ * The current volume
339
+ * @type {number}
340
+ */
341
+ get volume(): number;
342
+ /**
343
+ * The playback time
344
+ * @type {number}
345
+ */
346
+ get streamTime(): number;
320
347
  }
321
348
 
322
- interface VoiceReceiverOptions {
323
- mode?: 'opus' | 'pcm';
324
- end?: EndBehaviorType;
325
- silenceDuration?: number;
326
- crc?: boolean;
327
- }
328
- type RawTrackInit = Partial<Omit<RawTrackData, 'author' | 'playlist' | 'source' | 'engine' | 'raw' | 'queryType' | 'description' | 'views'>>;
329
- declare class VoiceReceiverNode {
330
- dispatcher: StreamDispatcher;
331
- constructor(dispatcher: StreamDispatcher);
332
- createRawTrack(stream: Readable, data?: RawTrackInit): Track;
333
- /**
334
- * Merge multiple streams together
335
- * @param streams The array of streams to merge
336
- */
337
- mergeRecordings(streams: Readable[]): void;
338
- /**
339
- * Record a user in voice channel
340
- * @param user The user to record
341
- * @param options Recording options
342
- */
343
- recordUser(user: UserResolvable, options?: VoiceReceiverOptions): Readable;
349
+ interface VoiceReceiverOptions {
350
+ mode?: 'opus' | 'pcm';
351
+ end?: EndBehaviorType;
352
+ silenceDuration?: number;
353
+ crc?: boolean;
354
+ }
355
+ type RawTrackInit = Partial<Omit<RawTrackData, 'author' | 'playlist' | 'source' | 'engine' | 'raw' | 'queryType' | 'description' | 'views'>>;
356
+ declare class VoiceReceiverNode {
357
+ dispatcher: StreamDispatcher;
358
+ constructor(dispatcher: StreamDispatcher);
359
+ createRawTrack(stream: Readable, data?: RawTrackInit): Track;
360
+ /**
361
+ * Merge multiple streams together
362
+ * @param streams The array of streams to merge
363
+ */
364
+ mergeRecordings(streams: Readable[]): void;
365
+ /**
366
+ * Record a user in voice channel
367
+ * @param user The user to record
368
+ * @param options Recording options
369
+ */
370
+ recordUser(user: UserResolvable, options?: VoiceReceiverOptions): Readable;
344
371
  }
345
372
 
346
- declare class GuildQueueHistory<Meta = unknown> {
347
- queue: GuildQueue<Meta>;
348
- tracks: Queue<Track>;
349
- constructor(queue: GuildQueue<Meta>);
350
- /**
351
- * Current track in the queue
352
- */
353
- get currentTrack(): Track | null;
354
- /**
355
- * Next track in the queue
356
- */
357
- get nextTrack(): Track | null;
358
- /**
359
- * Previous track in the queue
360
- */
361
- get previousTrack(): Track | null;
362
- /**
363
- * If history is disabled
364
- */
365
- get disabled(): boolean;
366
- /**
367
- * If history is empty
368
- */
369
- isEmpty(): boolean;
370
- /**
371
- * Add track to track history
372
- * @param track The track to add
373
- */
374
- push(track: Track | Track[]): boolean;
375
- /**
376
- * Clear history
377
- */
378
- clear(): void;
379
- /**
380
- * Play the next track in the queue
381
- */
382
- next(): Promise<void>;
383
- /**
384
- * Play the previous track in the queue
385
- */
386
- previous(): Promise<void>;
387
- /**
388
- * Alias to [GuildQueueHistory].previous()
389
- */
390
- back(): Promise<void>;
373
+ declare class GuildQueueHistory<Meta = unknown> {
374
+ queue: GuildQueue<Meta>;
375
+ tracks: Queue<Track>;
376
+ constructor(queue: GuildQueue<Meta>);
377
+ /**
378
+ * Current track in the queue
379
+ */
380
+ get currentTrack(): Track | null;
381
+ /**
382
+ * Next track in the queue
383
+ */
384
+ get nextTrack(): Track | null;
385
+ /**
386
+ * Previous track in the queue
387
+ */
388
+ get previousTrack(): Track | null;
389
+ /**
390
+ * If history is disabled
391
+ */
392
+ get disabled(): boolean;
393
+ /**
394
+ * Gets the size of the queue
395
+ */
396
+ get size(): number;
397
+ getSize(): number;
398
+ /**
399
+ * If history is empty
400
+ */
401
+ isEmpty(): boolean;
402
+ /**
403
+ * Add track to track history
404
+ * @param track The track to add
405
+ */
406
+ push(track: Track | Track[]): boolean;
407
+ /**
408
+ * Clear history
409
+ */
410
+ clear(): void;
411
+ /**
412
+ * Play the next track in the queue
413
+ */
414
+ next(): Promise<void>;
415
+ /**
416
+ * Play the previous track in the queue
417
+ */
418
+ previous(preserveCurrent?: boolean): Promise<void>;
419
+ /**
420
+ * Alias to [GuildQueueHistory].previous()
421
+ */
422
+ back(): Promise<void>;
391
423
  }
392
424
 
393
- declare const FFMPEG_SRATE_REGEX: RegExp;
394
- interface ResourcePlayOptions {
395
- queue?: boolean;
396
- seek?: number;
397
- transitionMode?: boolean;
398
- }
399
- interface PlayerTimestamp {
400
- current: {
401
- label: string;
402
- value: number;
403
- };
404
- total: {
405
- label: string;
406
- value: number;
407
- };
408
- progress: number;
409
- }
410
- declare class GuildQueuePlayerNode<Meta = unknown> {
411
- #private;
412
- queue: GuildQueue<Meta>;
413
- constructor(queue: GuildQueue<Meta>);
414
- /**
415
- * If the player is currently in idle mode
416
- */
417
- isIdle(): boolean;
418
- /**
419
- * If the player is currently buffering the track
420
- */
421
- isBuffering(): boolean;
422
- /**
423
- * If the player is currently playing a track
424
- */
425
- isPlaying(): boolean;
426
- /**
427
- * If the player is currently paused
428
- */
429
- isPaused(): boolean;
430
- /**
431
- * Reset progress history
432
- */
433
- resetProgress(): void;
434
- /**
435
- * The stream time for current session
436
- */
437
- get streamTime(): number;
438
- /**
439
- * Current playback duration with history included
440
- */
441
- get playbackTime(): number;
442
- /**
443
- * Get duration multiplier
444
- */
445
- getDurationMultiplier(): number;
446
- /**
447
- * Estimated progress of the player
448
- */
449
- get estimatedPlaybackTime(): number;
450
- /**
451
- * Estimated total duration of the player
452
- */
453
- get estimatedDuration(): number;
454
- /**
455
- * Get stream progress
456
- * @param ignoreFilters Ignore filters
457
- */
458
- getTimestamp(ignoreFilters?: boolean): PlayerTimestamp | null;
459
- /**
460
- * Create progress bar for current progress
461
- * @param options Progress bar options
462
- */
463
- createProgressBar(options?: PlayerProgressbarOptions): string | null;
464
- /**
465
- * Seek the player
466
- * @param duration The duration to seek to
467
- */
468
- seek(duration: number): Promise<boolean>;
469
- /**
470
- * Current volume
471
- */
472
- get volume(): number;
473
- /**
474
- * Set volume
475
- * @param vol Volume amount to set
476
- */
477
- setVolume(vol: number): boolean;
478
- /**
479
- * Set bit rate
480
- * @param rate The bit rate to set
481
- */
482
- setBitrate(rate: number | 'auto'): void;
483
- /**
484
- * Set paused state
485
- * @param state The state
486
- */
487
- setPaused(state: boolean): boolean;
488
- /**
489
- * Pause the playback
490
- */
491
- pause(): boolean;
492
- /**
493
- * Resume the playback
494
- */
495
- resume(): boolean;
496
- /**
497
- * Skip current track
498
- */
499
- skip(): boolean;
500
- /**
501
- * Remove the given track from queue
502
- * @param track The track to remove
503
- */
504
- remove(track: TrackResolvable): Track | null;
505
- /**
506
- * Jump to specific track on the queue
507
- * @param track The track to jump to without removing other tracks
508
- */
509
- jump(track: TrackResolvable): boolean;
510
- /**
511
- * Get track position
512
- * @param track The track
513
- */
514
- getTrackPosition(track: TrackResolvable): number;
515
- /**
516
- * Skip to the given track, removing others on the way
517
- * @param track The track to skip to
518
- */
519
- skipTo(track: TrackResolvable): boolean;
520
- /**
521
- * Insert a track on the given position in queue
522
- * @param track The track to insert
523
- * @param index The position to insert to, defaults to 0.
524
- */
525
- insert(track: Track, index?: number): void;
526
- /**
527
- * Stop the playback
528
- * @param force Whether or not to forcefully stop the playback
529
- */
530
- stop(force?: boolean): boolean;
531
- /**
532
- * Play raw audio resource
533
- * @param resource The audio resource to play
534
- */
535
- playRaw(resource: AudioResource): Promise<void>;
536
- /**
537
- * Play the given track
538
- * @param res The track to play
539
- * @param options Options for playing the track
540
- */
541
- play(res?: Track, options?: ResourcePlayOptions): Promise<void>;
425
+ declare const FFMPEG_SRATE_REGEX: RegExp;
426
+ interface ResourcePlayOptions {
427
+ queue?: boolean;
428
+ seek?: number;
429
+ transitionMode?: boolean;
430
+ }
431
+ interface PlayerTimestamp {
432
+ current: {
433
+ label: string;
434
+ value: number;
435
+ };
436
+ total: {
437
+ label: string;
438
+ value: number;
439
+ };
440
+ progress: number;
441
+ }
442
+ declare class GuildQueuePlayerNode<Meta = unknown> {
443
+ #private;
444
+ queue: GuildQueue<Meta>;
445
+ constructor(queue: GuildQueue<Meta>);
446
+ /**
447
+ * If the player is currently in idle mode
448
+ */
449
+ isIdle(): boolean;
450
+ /**
451
+ * If the player is currently buffering the track
452
+ */
453
+ isBuffering(): boolean;
454
+ /**
455
+ * If the player is currently playing a track
456
+ */
457
+ isPlaying(): boolean;
458
+ /**
459
+ * If the player is currently paused
460
+ */
461
+ isPaused(): boolean;
462
+ /**
463
+ * Reset progress history
464
+ */
465
+ resetProgress(): void;
466
+ /**
467
+ * The stream time for current session
468
+ */
469
+ get streamTime(): number;
470
+ /**
471
+ * Current playback duration with history included
472
+ */
473
+ get playbackTime(): number;
474
+ /**
475
+ * Get duration multiplier
476
+ */
477
+ getDurationMultiplier(): number;
478
+ /**
479
+ * Estimated progress of the player
480
+ */
481
+ get estimatedPlaybackTime(): number;
482
+ /**
483
+ * Estimated total duration of the player
484
+ */
485
+ get estimatedDuration(): number;
486
+ /**
487
+ * Get stream progress
488
+ * @param ignoreFilters Ignore filters
489
+ */
490
+ getTimestamp(ignoreFilters?: boolean): PlayerTimestamp | null;
491
+ /**
492
+ * Create progress bar for current progress
493
+ * @param options Progress bar options
494
+ */
495
+ createProgressBar(options?: PlayerProgressbarOptions): string | null;
496
+ /**
497
+ * Seek the player
498
+ * @param duration The duration to seek to
499
+ */
500
+ seek(duration: number): Promise<boolean>;
501
+ /**
502
+ * Current volume
503
+ */
504
+ get volume(): number;
505
+ /**
506
+ * Set volume
507
+ * @param vol Volume amount to set
508
+ */
509
+ setVolume(vol: number): boolean;
510
+ /**
511
+ * Set bit rate
512
+ * @param rate The bit rate to set
513
+ */
514
+ setBitrate(rate: number | 'auto'): void;
515
+ /**
516
+ * Set paused state
517
+ * @param state The state
518
+ */
519
+ setPaused(state: boolean): boolean;
520
+ /**
521
+ * Pause the playback
522
+ */
523
+ pause(): boolean;
524
+ /**
525
+ * Resume the playback
526
+ */
527
+ resume(): boolean;
528
+ /**
529
+ * Skip current track
530
+ */
531
+ skip(): boolean;
532
+ /**
533
+ * Remove the given track from queue
534
+ * @param track The track to remove
535
+ */
536
+ remove(track: TrackResolvable): Track | null;
537
+ /**
538
+ * Jump to specific track on the queue
539
+ * @param track The track to jump to without removing other tracks
540
+ */
541
+ jump(track: TrackResolvable): boolean;
542
+ /**
543
+ * Get track position
544
+ * @param track The track
545
+ */
546
+ getTrackPosition(track: TrackResolvable): number;
547
+ /**
548
+ * Skip to the given track, removing others on the way
549
+ * @param track The track to skip to
550
+ */
551
+ skipTo(track: TrackResolvable): boolean;
552
+ /**
553
+ * Insert a track on the given position in queue
554
+ * @param track The track to insert
555
+ * @param index The position to insert to, defaults to 0.
556
+ */
557
+ insert(track: Track, index?: number): void;
558
+ /**
559
+ * Stop the playback
560
+ * @param force Whether or not to forcefully stop the playback
561
+ */
562
+ stop(force?: boolean): boolean;
563
+ /**
564
+ * Play raw audio resource
565
+ * @param resource The audio resource to play
566
+ */
567
+ playRaw(resource: AudioResource): Promise<void>;
568
+ /**
569
+ * Play the given track
570
+ * @param res The track to play
571
+ * @param options Options for playing the track
572
+ */
573
+ play(res?: Track, options?: ResourcePlayOptions): Promise<void>;
542
574
  }
543
575
 
544
- interface FFmpegStreamOptions {
545
- fmt?: string;
546
- encoderArgs?: string[];
547
- seek?: number;
548
- skip?: boolean;
549
- cookies?: string;
550
- }
551
- declare function FFMPEG_ARGS_STRING(stream: string, fmt?: string, cookies?: string): string[];
552
- declare function FFMPEG_ARGS_PIPED(fmt?: string): string[];
553
- /**
554
- * Creates FFmpeg stream
555
- * @param stream The source stream
556
- * @param options FFmpeg stream options
557
- */
576
+ interface FFmpegStreamOptions {
577
+ fmt?: string;
578
+ encoderArgs?: string[];
579
+ seek?: number;
580
+ skip?: boolean;
581
+ cookies?: string;
582
+ }
583
+ declare function FFMPEG_ARGS_STRING(stream: string, fmt?: string, cookies?: string): string[];
584
+ declare function FFMPEG_ARGS_PIPED(fmt?: string): string[];
585
+ /**
586
+ * Creates FFmpeg stream
587
+ * @param stream The source stream
588
+ * @param options FFmpeg stream options
589
+ */
558
590
  declare function createFFmpegStream(stream: Readable | Duplex | string, options?: FFmpegStreamOptions): Readable;
559
591
 
560
- type Filters = keyof typeof AudioFilters.filters;
561
- declare const EqualizerConfigurationPreset: {
562
- readonly Flat: EqualizerBand[];
563
- readonly Classical: EqualizerBand[];
564
- readonly Club: EqualizerBand[];
565
- readonly Dance: EqualizerBand[];
566
- readonly FullBass: EqualizerBand[];
567
- readonly FullBassTreble: EqualizerBand[];
568
- readonly FullTreble: EqualizerBand[];
569
- readonly Headphones: EqualizerBand[];
570
- readonly LargeHall: EqualizerBand[];
571
- readonly Live: EqualizerBand[];
572
- readonly Party: EqualizerBand[];
573
- readonly Pop: EqualizerBand[];
574
- readonly Reggae: EqualizerBand[];
575
- readonly Rock: EqualizerBand[];
576
- readonly Ska: EqualizerBand[];
577
- readonly Soft: EqualizerBand[];
578
- readonly SoftRock: EqualizerBand[];
579
- readonly Techno: EqualizerBand[];
580
- };
581
- declare class FFmpegFilterer<Meta = unknown> {
582
- #private;
583
- af: GuildQueueAudioFilters<Meta>;
584
- constructor(af: GuildQueueAudioFilters<Meta>);
585
- /**
586
- * Create ffmpeg stream
587
- * @param source The stream source
588
- * @param options The stream options
589
- */
590
- createStream(source: string | Readable, options: FFmpegStreamOptions): Readable;
591
- /**
592
- * Set ffmpeg filters
593
- * @param filters The filters
594
- */
595
- setFilters(filters: Filters[] | Record<Filters, boolean> | boolean): Promise<boolean>;
596
- /**
597
- * Currently active ffmpeg filters
598
- */
599
- get filters(): Filters[];
600
- set filters(filters: Filters[]);
601
- /**
602
- * Toggle given ffmpeg filter(s)
603
- * @param filters The filter(s)
604
- */
605
- toggle(filters: Filters[] | Filters): Promise<boolean>;
606
- /**
607
- * Set default filters
608
- * @param ff Filters list
609
- */
610
- setDefaults(ff: Filters[]): void;
611
- /**
612
- * Get list of enabled filters
613
- */
614
- getFiltersEnabled(): (keyof QueueFilters)[];
615
- /**
616
- * Get list of disabled filters
617
- */
618
- getFiltersDisabled(): (keyof QueueFilters)[];
619
- /**
620
- * Check if the given filter is enabled
621
- * @param filter The filter
622
- */
623
- isEnabled<T extends Filters>(filter: T): boolean;
624
- /**
625
- * Check if the given filter is disabled
626
- * @param filter The filter
627
- */
628
- isDisabled<T extends Filters>(filter: T): boolean;
629
- /**
630
- * Check if the given filter is a valid filter
631
- * @param filter The filter to test
632
- */
633
- isValidFilter(filter: string): filter is FiltersName;
634
- /**
635
- * Convert current filters to array
636
- */
637
- toArray(): string[];
638
- /**
639
- * Convert current filters to JSON object
640
- */
641
- toJSON(): Record<keyof QueueFilters, string>;
642
- /**
643
- * String representation of current filters
644
- */
645
- toString(): string;
646
- }
647
- interface GuildQueueAFiltersCache {
648
- equalizer: EqualizerBand[];
649
- biquad: BiquadFilters | null;
650
- filters: PCMFilters[];
651
- volume: number;
652
- sampleRate: number;
653
- }
654
- declare class GuildQueueAudioFilters<Meta = unknown> {
655
- queue: GuildQueue<Meta>;
656
- graph: AFilterGraph<Meta>;
657
- ffmpeg: FFmpegFilterer<Meta>;
658
- equalizerPresets: {
659
- readonly Flat: EqualizerBand[];
660
- readonly Classical: EqualizerBand[];
661
- readonly Club: EqualizerBand[];
662
- readonly Dance: EqualizerBand[];
663
- readonly FullBass: EqualizerBand[];
664
- readonly FullBassTreble: EqualizerBand[];
665
- readonly FullTreble: EqualizerBand[];
666
- readonly Headphones: EqualizerBand[];
667
- readonly LargeHall: EqualizerBand[];
668
- readonly Live: EqualizerBand[];
669
- readonly Party: EqualizerBand[];
670
- readonly Pop: EqualizerBand[];
671
- readonly Reggae: EqualizerBand[];
672
- readonly Rock: EqualizerBand[];
673
- readonly Ska: EqualizerBand[];
674
- readonly Soft: EqualizerBand[];
675
- readonly SoftRock: EqualizerBand[];
676
- readonly Techno: EqualizerBand[];
677
- };
678
- _lastFiltersCache: GuildQueueAFiltersCache;
679
- constructor(queue: GuildQueue<Meta>);
680
- /**
681
- * Volume transformer
682
- */
683
- get volume(): _discord_player_equalizer.VolumeTransformer | null;
684
- /**
685
- * 15 Band Equalizer
686
- */
687
- get equalizer(): _discord_player_equalizer.EqualizerStream | null;
688
- /**
689
- * Digital biquad filters
690
- */
691
- get biquad(): _discord_player_equalizer.BiquadStream | null;
692
- /**
693
- * DSP filters
694
- */
695
- get filters(): _discord_player_equalizer.AudioFilter | null;
696
- /**
697
- * Audio resampler
698
- */
699
- get resampler(): _discord_player_equalizer.PCMResampler | null;
700
- /**
701
- * Replay current track in transition mode
702
- * @param seek The duration to seek to
703
- */
704
- triggerReplay(seek?: number): Promise<boolean>;
705
- }
706
- declare class AFilterGraph<Meta = unknown> {
707
- af: GuildQueueAudioFilters<Meta>;
708
- constructor(af: GuildQueueAudioFilters<Meta>);
709
- get ffmpeg(): (keyof QueueFilters)[];
710
- get equalizer(): EqualizerBand[];
711
- get biquad(): null;
712
- get filters(): ("8D" | "Tremolo" | "Vibrato" | "BassBoost")[];
713
- get volume(): _discord_player_equalizer.VolumeTransformer | null;
714
- get resampler(): _discord_player_equalizer.PCMResampler | null;
715
- dump(): FilterGraph;
716
- }
717
- interface FilterGraph {
718
- ffmpeg: Filters[];
719
- equalizer: EqualizerBand[];
720
- biquad: Exclude<BiquadFilters, number> | null;
721
- filters: PCMFilters[];
722
- volume: number;
723
- sampleRate: number;
592
+ type Filters = keyof typeof AudioFilters.filters;
593
+ declare const EqualizerConfigurationPreset: {
594
+ readonly Flat: EqualizerBand[];
595
+ readonly Classical: EqualizerBand[];
596
+ readonly Club: EqualizerBand[];
597
+ readonly Dance: EqualizerBand[];
598
+ readonly FullBass: EqualizerBand[];
599
+ readonly FullBassTreble: EqualizerBand[];
600
+ readonly FullTreble: EqualizerBand[];
601
+ readonly Headphones: EqualizerBand[];
602
+ readonly LargeHall: EqualizerBand[];
603
+ readonly Live: EqualizerBand[];
604
+ readonly Party: EqualizerBand[];
605
+ readonly Pop: EqualizerBand[];
606
+ readonly Reggae: EqualizerBand[];
607
+ readonly Rock: EqualizerBand[];
608
+ readonly Ska: EqualizerBand[];
609
+ readonly Soft: EqualizerBand[];
610
+ readonly SoftRock: EqualizerBand[];
611
+ readonly Techno: EqualizerBand[];
612
+ };
613
+ declare class FFmpegFilterer<Meta = unknown> {
614
+ #private;
615
+ af: GuildQueueAudioFilters<Meta>;
616
+ constructor(af: GuildQueueAudioFilters<Meta>);
617
+ /**
618
+ * Create ffmpeg stream
619
+ * @param source The stream source
620
+ * @param options The stream options
621
+ */
622
+ createStream(source: string | Readable, options: FFmpegStreamOptions): Readable;
623
+ /**
624
+ * Set ffmpeg filters
625
+ * @param filters The filters
626
+ */
627
+ setFilters(filters: Filters[] | Record<Filters, boolean> | boolean): Promise<boolean>;
628
+ /**
629
+ * Currently active ffmpeg filters
630
+ */
631
+ get filters(): Filters[];
632
+ set filters(filters: Filters[]);
633
+ /**
634
+ * Toggle given ffmpeg filter(s)
635
+ * @param filters The filter(s)
636
+ */
637
+ toggle(filters: Filters[] | Filters): Promise<boolean>;
638
+ /**
639
+ * Set default filters
640
+ * @param ff Filters list
641
+ */
642
+ setDefaults(ff: Filters[]): void;
643
+ /**
644
+ * Get list of enabled filters
645
+ */
646
+ getFiltersEnabled(): (keyof QueueFilters)[];
647
+ /**
648
+ * Get list of disabled filters
649
+ */
650
+ getFiltersDisabled(): (keyof QueueFilters)[];
651
+ /**
652
+ * Check if the given filter is enabled
653
+ * @param filter The filter
654
+ */
655
+ isEnabled<T extends Filters>(filter: T): boolean;
656
+ /**
657
+ * Check if the given filter is disabled
658
+ * @param filter The filter
659
+ */
660
+ isDisabled<T extends Filters>(filter: T): boolean;
661
+ /**
662
+ * Check if the given filter is a valid filter
663
+ * @param filter The filter to test
664
+ */
665
+ isValidFilter(filter: string): filter is FiltersName;
666
+ /**
667
+ * Convert current filters to array
668
+ */
669
+ toArray(): string[];
670
+ /**
671
+ * Convert current filters to JSON object
672
+ */
673
+ toJSON(): Record<keyof QueueFilters, string>;
674
+ /**
675
+ * String representation of current filters
676
+ */
677
+ toString(): string;
678
+ }
679
+ interface GuildQueueAFiltersCache {
680
+ equalizer: EqualizerBand[];
681
+ biquad: BiquadFilters | null;
682
+ filters: PCMFilters[];
683
+ volume: number;
684
+ sampleRate: number;
685
+ }
686
+ declare class GuildQueueAudioFilters<Meta = unknown> {
687
+ queue: GuildQueue<Meta>;
688
+ graph: AFilterGraph<Meta>;
689
+ ffmpeg: FFmpegFilterer<Meta>;
690
+ equalizerPresets: {
691
+ readonly Flat: EqualizerBand[];
692
+ readonly Classical: EqualizerBand[];
693
+ readonly Club: EqualizerBand[];
694
+ readonly Dance: EqualizerBand[];
695
+ readonly FullBass: EqualizerBand[];
696
+ readonly FullBassTreble: EqualizerBand[];
697
+ readonly FullTreble: EqualizerBand[];
698
+ readonly Headphones: EqualizerBand[];
699
+ readonly LargeHall: EqualizerBand[];
700
+ readonly Live: EqualizerBand[];
701
+ readonly Party: EqualizerBand[];
702
+ readonly Pop: EqualizerBand[];
703
+ readonly Reggae: EqualizerBand[];
704
+ readonly Rock: EqualizerBand[];
705
+ readonly Ska: EqualizerBand[];
706
+ readonly Soft: EqualizerBand[];
707
+ readonly SoftRock: EqualizerBand[];
708
+ readonly Techno: EqualizerBand[];
709
+ };
710
+ _lastFiltersCache: GuildQueueAFiltersCache;
711
+ constructor(queue: GuildQueue<Meta>);
712
+ /**
713
+ * Volume transformer
714
+ */
715
+ get volume(): _discord_player_equalizer.VolumeTransformer | null;
716
+ /**
717
+ * 15 Band Equalizer
718
+ */
719
+ get equalizer(): _discord_player_equalizer.EqualizerStream | null;
720
+ /**
721
+ * Digital biquad filters
722
+ */
723
+ get biquad(): _discord_player_equalizer.BiquadStream | null;
724
+ /**
725
+ * DSP filters
726
+ */
727
+ get filters(): _discord_player_equalizer.AudioFilter | null;
728
+ /**
729
+ * Audio resampler
730
+ */
731
+ get resampler(): _discord_player_equalizer.PCMResampler | null;
732
+ /**
733
+ * Replay current track in transition mode
734
+ * @param seek The duration to seek to
735
+ */
736
+ triggerReplay(seek?: number): Promise<boolean>;
737
+ }
738
+ declare class AFilterGraph<Meta = unknown> {
739
+ af: GuildQueueAudioFilters<Meta>;
740
+ constructor(af: GuildQueueAudioFilters<Meta>);
741
+ get ffmpeg(): (keyof QueueFilters)[];
742
+ get equalizer(): EqualizerBand[];
743
+ get biquad(): null;
744
+ get filters(): ("8D" | "Tremolo" | "Vibrato" | "BassBoost")[];
745
+ get volume(): _discord_player_equalizer.VolumeTransformer | null;
746
+ get resampler(): _discord_player_equalizer.PCMResampler | null;
747
+ dump(): FilterGraph;
748
+ }
749
+ interface FilterGraph {
750
+ ffmpeg: Filters[];
751
+ equalizer: EqualizerBand[];
752
+ biquad: Exclude<BiquadFilters, number> | null;
753
+ filters: PCMFilters[];
754
+ volume: number;
755
+ sampleRate: number;
724
756
  }
725
757
 
726
- interface GuildNodeInit<Meta = unknown> {
727
- guild: Guild;
728
- queueStrategy: QueueStrategy;
729
- equalizer: EqualizerBand[] | boolean;
730
- volume: number | boolean;
731
- biquad: BiquadFilters | boolean | undefined;
732
- resampler: number | boolean;
733
- filterer: PCMFilters[] | boolean;
734
- ffmpegFilters: FiltersName[];
735
- disableHistory: boolean;
736
- skipOnNoStream: boolean;
737
- onBeforeCreateStream?: OnBeforeCreateStreamHandler;
738
- onAfterCreateStream?: OnAfterCreateStreamHandler;
739
- repeatMode?: QueueRepeatMode;
740
- leaveOnEmpty: boolean;
741
- leaveOnEmptyCooldown: number;
742
- leaveOnEnd: boolean;
743
- leaveOnEndCooldown: number;
744
- leaveOnStop: boolean;
745
- leaveOnStopCooldown: number;
746
- connectionTimeout: number;
747
- selfDeaf?: boolean;
748
- metadata?: Meta | null;
749
- bufferingTimeout: number;
750
- }
751
- interface VoiceConnectConfig {
752
- deaf?: boolean;
753
- timeout?: number;
754
- }
755
- interface PostProcessedResult {
756
- stream: Readable;
757
- type: StreamType;
758
- }
759
- type OnBeforeCreateStreamHandler = (track: Track, queryType: SearchQueryType, queue: GuildQueue) => Promise<Readable | null>;
760
- type OnAfterCreateStreamHandler = (stream: Readable, queue: GuildQueue) => Promise<PostProcessedResult | null>;
761
- type PlayerTriggeredReason = 'filters' | 'normal';
762
- interface GuildQueueEvents<Meta = unknown> {
763
- /**
764
- * Emitted when audio track is added to the queue
765
- * @param queue The queue where this event occurred
766
- * @param track The track
767
- */
768
- audioTrackAdd: (queue: GuildQueue<Meta>, track: Track) => unknown;
769
- /**
770
- * Emitted when audio tracks were added to the queue
771
- * @param queue The queue where this event occurred
772
- * @param tracks The tracks array
773
- */
774
- audioTracksAdd: (queue: GuildQueue<Meta>, track: Track[]) => unknown;
775
- /**
776
- * Emitted when a connection is created
777
- * @param queue The queue where this event occurred
778
- */
779
- connection: (queue: GuildQueue<Meta>) => unknown;
780
- /**
781
- * Emitted when the bot is disconnected from the channel
782
- * @param queue The queue where this event occurred
783
- */
784
- disconnect: (queue: GuildQueue<Meta>) => unknown;
785
- /**
786
- * Emitted when the queue sends a debug info
787
- * @param queue The queue where this event occurred
788
- * @param message The debug message
789
- */
790
- debug: (queue: GuildQueue<Meta>, message: string) => unknown;
791
- /**
792
- * Emitted when the queue encounters error
793
- * @param queue The queue where this event occurred
794
- * @param error The error
795
- */
796
- error: (queue: GuildQueue<Meta>, error: Error) => unknown;
797
- /**
798
- * Emitted when the voice channel is empty
799
- * @param queue The queue where this event occurred
800
- */
801
- emptyChannel: (queue: GuildQueue<Meta>) => unknown;
802
- /**
803
- * Emitted when the queue is empty
804
- * @param queue The queue where this event occurred
805
- */
806
- emptyQueue: (queue: GuildQueue<Meta>) => unknown;
807
- /**
808
- * Emitted when the audio player starts streaming audio track
809
- * @param queue The queue where this event occurred
810
- * @param track The track that is being streamed
811
- */
812
- playerStart: (queue: GuildQueue<Meta>, track: Track) => unknown;
813
- /**
814
- * Emitted when the audio player errors while streaming audio track
815
- * @param queue The queue where this event occurred
816
- * @param error The error
817
- * @param track The track that is being streamed
818
- */
819
- playerError: (queue: GuildQueue<Meta>, error: Error, track: Track) => unknown;
820
- /**
821
- * Emitted when the audio player finishes streaming audio track
822
- * @param queue The queue where this event occurred
823
- * @param track The track that was being streamed
824
- */
825
- playerFinish: (queue: GuildQueue<Meta>, track: Track) => unknown;
826
- /**
827
- * Emitted when the audio player skips current track
828
- * @param queue The queue where this event occurred
829
- * @param track The track that was skipped
830
- */
831
- playerSkip: (queue: GuildQueue<Meta>, track: Track) => unknown;
832
- /**
833
- * Emitted when the audio player is triggered
834
- * @param queue The queue where this event occurred
835
- * @param track The track which was played in this event
836
- */
837
- playerTrigger: (queue: GuildQueue<Meta>, track: Track, reason: PlayerTriggeredReason) => unknown;
838
- /**
839
- * Emitted when the voice state is updated. Consuming this event may disable default voice state update handler if `Player.isVoiceStateHandlerLocked()` returns `false`.
840
- * @param queue The queue where this event occurred
841
- * @param oldState The old voice state
842
- * @param newState The new voice state
843
- */
844
- voiceStateUpdate: (queue: GuildQueue<Meta>, oldState: VoiceState, newState: VoiceState) => unknown;
845
- }
846
- declare class GuildQueue<Meta = unknown> {
847
- #private;
848
- player: Player;
849
- options: GuildNodeInit<Meta>;
850
- private __current;
851
- tracks: Queue<Track>;
852
- history: GuildQueueHistory<Meta>;
853
- dispatcher: StreamDispatcher | null;
854
- node: GuildQueuePlayerNode<Meta>;
855
- filters: GuildQueueAudioFilters<Meta>;
856
- onBeforeCreateStream: OnBeforeCreateStreamHandler;
857
- onAfterCreateStream: OnAfterCreateStreamHandler;
858
- repeatMode: QueueRepeatMode;
859
- timeouts: Collection<string, NodeJS.Timeout>;
860
- stats: GuildQueueStatistics<Meta>;
861
- constructor(player: Player, options: GuildNodeInit<Meta>);
862
- /**
863
- * The voice receiver for this queue
864
- */
865
- get voiceReceiver(): VoiceReceiverNode | null;
866
- /**
867
- * Write a debug message to this queue
868
- * @param m The message to write
869
- */
870
- debug(m: string): void;
871
- /**
872
- * The metadata of this queue
873
- */
874
- get metadata(): Meta | undefined | null;
875
- set metadata(m: Meta | undefined | null);
876
- /**
877
- * Set metadata for this queue
878
- * @param m Metadata to set
879
- */
880
- setMetadata(m: Meta | undefined | null): void;
881
- /**
882
- * Indicates if this queue is currently initializing
883
- */
884
- get initializing(): boolean;
885
- set initializing(v: boolean);
886
- /**
887
- * Indicates current track of this queue
888
- */
889
- get currentTrack(): Track | null;
890
- /**
891
- * Indicates if this queue was deleted previously
892
- */
893
- get deleted(): boolean;
894
- /**
895
- * The voice channel of this queue
896
- */
897
- get channel(): VoiceBasedChannel | null;
898
- set channel(c: VoiceBasedChannel | null);
899
- /**
900
- * The voice connection of this queue
901
- */
902
- get connection(): _discordjs_voice.VoiceConnection | null;
903
- /**
904
- * The guild this queue belongs to
905
- */
906
- get guild(): Guild;
907
- /**
908
- * The id of this queue
909
- */
910
- get id(): string;
911
- /**
912
- * Set transition mode for this queue
913
- * @param state The state to set
914
- */
915
- setTransitioning(state: boolean): void;
916
- /**
917
- * if this queue is currently under transition mode
918
- */
919
- isTransitioning(): boolean;
920
- /**
921
- * Set repeat mode for this queue
922
- * @param mode The repeat mode to apply
923
- */
924
- setRepeatMode(mode: QueueRepeatMode): void;
925
- /**
926
- * Check if this queue has no tracks left in it
927
- */
928
- isEmpty(): boolean;
929
- /**
930
- * Check if this queue currently holds active audio resource
931
- */
932
- isPlaying(): boolean;
933
- /**
934
- * Add track to the queue
935
- * @param track Track or playlist or array of tracks to add
936
- */
937
- addTrack(track: Track | Track[] | Playlist): void;
938
- /**
939
- * Remove a track from queue
940
- * @param track The track to remove
941
- */
942
- removeTrack(track: TrackResolvable): Track | null;
943
- /**
944
- * Inserts the track to the given index
945
- * @param track The track to insert
946
- * @param index The index to insert the track at (defaults to 0)
947
- */
948
- insertTrack(track: Track, index?: number): void;
949
- /**
950
- * Connect to a voice channel
951
- * @param channelResolvable The voice channel to connect to
952
- * @param options Join config
953
- */
954
- connect(channelResolvable: GuildVoiceChannelResolvable, options?: VoiceConnectConfig): Promise<this>;
955
- /**
956
- * The voice connection latency of this queue
957
- */
958
- get ping(): number;
959
- /**
960
- * Delete this queue
961
- */
962
- delete(): void;
963
- /**
964
- * Revives this queue
965
- * @returns
966
- */
967
- revive(): void;
968
- /**
969
- * Wait for this queue to initialize
970
- */
971
- awaitInitialization(): Promise<boolean>;
972
- /**
973
- * Set self deaf
974
- * @param mode On/Off state
975
- * @param reason Reason
976
- */
977
- setSelfDeaf(mode?: boolean, reason?: string): Promise<discord_js.GuildMember>;
978
- /**
979
- * Set self mute
980
- * @param mode On/Off state
981
- * @param reason Reason
982
- */
983
- setSelfMute(mode?: boolean, reason?: string): Promise<discord_js.GuildMember>;
758
+ interface GuildNodeInit<Meta = unknown> {
759
+ guild: Guild;
760
+ queueStrategy: QueueStrategy;
761
+ equalizer: EqualizerBand[] | boolean;
762
+ volume: number | boolean;
763
+ biquad: BiquadFilters | boolean | undefined;
764
+ resampler: number | boolean;
765
+ filterer: PCMFilters[] | boolean;
766
+ ffmpegFilters: FiltersName[];
767
+ disableHistory: boolean;
768
+ skipOnNoStream: boolean;
769
+ onBeforeCreateStream?: OnBeforeCreateStreamHandler;
770
+ onAfterCreateStream?: OnAfterCreateStreamHandler;
771
+ repeatMode?: QueueRepeatMode;
772
+ leaveOnEmpty: boolean;
773
+ leaveOnEmptyCooldown: number;
774
+ leaveOnEnd: boolean;
775
+ leaveOnEndCooldown: number;
776
+ leaveOnStop: boolean;
777
+ leaveOnStopCooldown: number;
778
+ connectionTimeout: number;
779
+ selfDeaf?: boolean;
780
+ metadata?: Meta | null;
781
+ bufferingTimeout: number;
782
+ }
783
+ interface VoiceConnectConfig {
784
+ deaf?: boolean;
785
+ timeout?: number;
786
+ }
787
+ interface PostProcessedResult {
788
+ stream: Readable;
789
+ type: StreamType;
790
+ }
791
+ type OnBeforeCreateStreamHandler = (track: Track, queryType: SearchQueryType, queue: GuildQueue) => Promise<Readable | null>;
792
+ type OnAfterCreateStreamHandler = (stream: Readable, queue: GuildQueue) => Promise<PostProcessedResult | null>;
793
+ type PlayerTriggeredReason = 'filters' | 'normal';
794
+ declare enum GuildQueueEvent {
795
+ /**
796
+ * Emitted when audio track is added to the queue
797
+ */
798
+ audioTrackAdd = "audioTrackadd",
799
+ /**
800
+ * Emitted when audio tracks were added to the queue
801
+ */
802
+ audioTracksAdd = "audioTracksAdd",
803
+ /**
804
+ * Emitted when audio track is removed from the queue
805
+ */
806
+ audioTrackRemove = "audioTrackRemove",
807
+ /**
808
+ * Emitted when audio tracks are removed from the queue
809
+ */
810
+ audioTracksRemove = "audioTracksRemove",
811
+ /**
812
+ * Emitted when a connection is created
813
+ */
814
+ connection = "connection",
815
+ /**
816
+ * Emitted when the bot is disconnected from the channel
817
+ */
818
+ disconnect = "disconnect",
819
+ /**
820
+ * Emitted when the queue sends a debug info
821
+ */
822
+ debug = "debug",
823
+ /**
824
+ * Emitted when the queue encounters error
825
+ */
826
+ error = "error",
827
+ /**
828
+ * Emitted when the voice channel is empty
829
+ */
830
+ emptyChannel = "emptyChannel",
831
+ /**
832
+ * Emitted when the queue is empty
833
+ */
834
+ emptyQueue = "emptyQueue",
835
+ /**
836
+ * Emitted when the audio player starts streaming audio track
837
+ */
838
+ playerStart = "playerStart",
839
+ /**
840
+ * Emitted when the audio player errors while streaming audio track
841
+ */
842
+ playerError = "playerError",
843
+ /**
844
+ * Emitted when the audio player finishes streaming audio track
845
+ */
846
+ playerFinish = "playerFinish",
847
+ /**
848
+ * Emitted when the audio player skips current track
849
+ */
850
+ playerSkip = "playerSkip",
851
+ /**
852
+ * Emitted when the audio player is triggered
853
+ */
854
+ playerTrigger = "playerTrigger",
855
+ /**
856
+ * Emitted when the voice state is updated. Consuming this event may disable default voice state update handler if `Player.isVoiceStateHandlerLocked()` returns `false`.
857
+ */
858
+ voiceStateUpdate = "voiceStateUpdate"
859
+ }
860
+ interface GuildQueueEvents<Meta = unknown> {
861
+ /**
862
+ * Emitted when audio track is added to the queue
863
+ * @param queue The queue where this event occurred
864
+ * @param track The track
865
+ */
866
+ audioTrackAdd: (queue: GuildQueue<Meta>, track: Track) => unknown;
867
+ /**
868
+ * Emitted when audio tracks were added to the queue
869
+ * @param queue The queue where this event occurred
870
+ * @param tracks The tracks array
871
+ */
872
+ audioTracksAdd: (queue: GuildQueue<Meta>, track: Track[]) => unknown;
873
+ /**
874
+ * Emitted when audio track is removed from the queue
875
+ * @param queue The queue where this event occurred
876
+ * @param track The track
877
+ */
878
+ audioTrackRemove: (queue: GuildQueue<Meta>, track: Track) => unknown;
879
+ /**
880
+ * Emitted when audio tracks are removed from the queue
881
+ * @param queue The queue where this event occurred
882
+ * @param track The track
883
+ */
884
+ audioTracksRemove: (queue: GuildQueue<Meta>, track: Track[]) => unknown;
885
+ /**
886
+ * Emitted when a connection is created
887
+ * @param queue The queue where this event occurred
888
+ */
889
+ connection: (queue: GuildQueue<Meta>) => unknown;
890
+ /**
891
+ * Emitted when the bot is disconnected from the channel
892
+ * @param queue The queue where this event occurred
893
+ */
894
+ disconnect: (queue: GuildQueue<Meta>) => unknown;
895
+ /**
896
+ * Emitted when the queue sends a debug info
897
+ * @param queue The queue where this event occurred
898
+ * @param message The debug message
899
+ */
900
+ debug: (queue: GuildQueue<Meta>, message: string) => unknown;
901
+ /**
902
+ * Emitted when the queue encounters error
903
+ * @param queue The queue where this event occurred
904
+ * @param error The error
905
+ */
906
+ error: (queue: GuildQueue<Meta>, error: Error) => unknown;
907
+ /**
908
+ * Emitted when the voice channel is empty
909
+ * @param queue The queue where this event occurred
910
+ */
911
+ emptyChannel: (queue: GuildQueue<Meta>) => unknown;
912
+ /**
913
+ * Emitted when the queue is empty
914
+ * @param queue The queue where this event occurred
915
+ */
916
+ emptyQueue: (queue: GuildQueue<Meta>) => unknown;
917
+ /**
918
+ * Emitted when the audio player starts streaming audio track
919
+ * @param queue The queue where this event occurred
920
+ * @param track The track that is being streamed
921
+ */
922
+ playerStart: (queue: GuildQueue<Meta>, track: Track) => unknown;
923
+ /**
924
+ * Emitted when the audio player errors while streaming audio track
925
+ * @param queue The queue where this event occurred
926
+ * @param error The error
927
+ * @param track The track that is being streamed
928
+ */
929
+ playerError: (queue: GuildQueue<Meta>, error: Error, track: Track) => unknown;
930
+ /**
931
+ * Emitted when the audio player finishes streaming audio track
932
+ * @param queue The queue where this event occurred
933
+ * @param track The track that was being streamed
934
+ */
935
+ playerFinish: (queue: GuildQueue<Meta>, track: Track) => unknown;
936
+ /**
937
+ * Emitted when the audio player skips current track
938
+ * @param queue The queue where this event occurred
939
+ * @param track The track that was skipped
940
+ */
941
+ playerSkip: (queue: GuildQueue<Meta>, track: Track) => unknown;
942
+ /**
943
+ * Emitted when the audio player is triggered
944
+ * @param queue The queue where this event occurred
945
+ * @param track The track which was played in this event
946
+ */
947
+ playerTrigger: (queue: GuildQueue<Meta>, track: Track, reason: PlayerTriggeredReason) => unknown;
948
+ /**
949
+ * Emitted when the voice state is updated. Consuming this event may disable default voice state update handler if `Player.isVoiceStateHandlerLocked()` returns `false`.
950
+ * @param queue The queue where this event occurred
951
+ * @param oldState The old voice state
952
+ * @param newState The new voice state
953
+ */
954
+ voiceStateUpdate: (queue: GuildQueue<Meta>, oldState: VoiceState, newState: VoiceState) => unknown;
955
+ }
956
+ declare class GuildQueue<Meta = unknown> {
957
+ #private;
958
+ player: Player;
959
+ options: GuildNodeInit<Meta>;
960
+ private __current;
961
+ tracks: Queue<Track>;
962
+ history: GuildQueueHistory<Meta>;
963
+ dispatcher: StreamDispatcher | null;
964
+ node: GuildQueuePlayerNode<Meta>;
965
+ filters: GuildQueueAudioFilters<Meta>;
966
+ onBeforeCreateStream: OnBeforeCreateStreamHandler;
967
+ onAfterCreateStream: OnAfterCreateStreamHandler;
968
+ repeatMode: QueueRepeatMode;
969
+ timeouts: Collection<string, NodeJS.Timeout>;
970
+ stats: GuildQueueStatistics<Meta>;
971
+ constructor(player: Player, options: GuildNodeInit<Meta>);
972
+ /**
973
+ * Estimated duration of this queue in ms
974
+ */
975
+ get estimatedDuration(): number;
976
+ /**
977
+ * Formatted duration of this queue
978
+ */
979
+ get durationFormatted(): string;
980
+ /**
981
+ * The voice receiver for this queue
982
+ */
983
+ get voiceReceiver(): VoiceReceiverNode | null;
984
+ /**
985
+ * Write a debug message to this queue
986
+ * @param m The message to write
987
+ */
988
+ debug(m: string): void;
989
+ /**
990
+ * The metadata of this queue
991
+ */
992
+ get metadata(): Meta | undefined | null;
993
+ set metadata(m: Meta | undefined | null);
994
+ /**
995
+ * Set metadata for this queue
996
+ * @param m Metadata to set
997
+ */
998
+ setMetadata(m: Meta | undefined | null): void;
999
+ /**
1000
+ * Indicates if this queue is currently initializing
1001
+ */
1002
+ get initializing(): boolean;
1003
+ set initializing(v: boolean);
1004
+ /**
1005
+ * Indicates current track of this queue
1006
+ */
1007
+ get currentTrack(): Track | null;
1008
+ /**
1009
+ * Indicates if this queue was deleted previously
1010
+ */
1011
+ get deleted(): boolean;
1012
+ /**
1013
+ * The voice channel of this queue
1014
+ */
1015
+ get channel(): VoiceBasedChannel | null;
1016
+ set channel(c: VoiceBasedChannel | null);
1017
+ /**
1018
+ * The voice connection of this queue
1019
+ */
1020
+ get connection(): _discordjs_voice.VoiceConnection | null;
1021
+ /**
1022
+ * The guild this queue belongs to
1023
+ */
1024
+ get guild(): Guild;
1025
+ /**
1026
+ * The id of this queue
1027
+ */
1028
+ get id(): string;
1029
+ /**
1030
+ * Set transition mode for this queue
1031
+ * @param state The state to set
1032
+ */
1033
+ setTransitioning(state: boolean): void;
1034
+ /**
1035
+ * if this queue is currently under transition mode
1036
+ */
1037
+ isTransitioning(): boolean;
1038
+ /**
1039
+ * Set repeat mode for this queue
1040
+ * @param mode The repeat mode to apply
1041
+ */
1042
+ setRepeatMode(mode: QueueRepeatMode): void;
1043
+ /**
1044
+ * Gets the size of the queue
1045
+ */
1046
+ get size(): number;
1047
+ /**
1048
+ * The size of this queue
1049
+ */
1050
+ getSize(): number;
1051
+ /**
1052
+ * Clear this queue
1053
+ */
1054
+ clear(): void;
1055
+ /**
1056
+ * Check if this queue has no tracks left in it
1057
+ */
1058
+ isEmpty(): boolean;
1059
+ /**
1060
+ * Check if this queue currently holds active audio resource
1061
+ */
1062
+ isPlaying(): boolean;
1063
+ /**
1064
+ * Add track to the queue. This will emit `audioTracksAdd` when multiple tracks are added, otherwise `audioTrackAdd`.
1065
+ * @param track Track or playlist or array of tracks to add
1066
+ */
1067
+ addTrack(track: Track | Track[] | Playlist): void;
1068
+ /**
1069
+ * Remove a track from queue
1070
+ * @param track The track to remove
1071
+ */
1072
+ removeTrack(track: TrackResolvable): Track | null;
1073
+ /**
1074
+ * Inserts the track to the given index
1075
+ * @param track The track to insert
1076
+ * @param index The index to insert the track at (defaults to 0)
1077
+ */
1078
+ insertTrack(track: Track, index?: number): void;
1079
+ /**
1080
+ * Connect to a voice channel
1081
+ * @param channelResolvable The voice channel to connect to
1082
+ * @param options Join config
1083
+ */
1084
+ connect(channelResolvable: GuildVoiceChannelResolvable, options?: VoiceConnectConfig): Promise<this>;
1085
+ /**
1086
+ * The voice connection latency of this queue
1087
+ */
1088
+ get ping(): number;
1089
+ /**
1090
+ * Delete this queue
1091
+ */
1092
+ delete(): void;
1093
+ /**
1094
+ * Revives this queue
1095
+ * @returns
1096
+ */
1097
+ revive(): void;
1098
+ /**
1099
+ * Wait for this queue to initialize
1100
+ */
1101
+ awaitInitialization(): Promise<boolean>;
1102
+ /**
1103
+ * Set self deaf
1104
+ * @param mode On/Off state
1105
+ * @param reason Reason
1106
+ */
1107
+ setSelfDeaf(mode?: boolean, reason?: string): Promise<discord_js.GuildMember>;
1108
+ /**
1109
+ * Set self mute
1110
+ * @param mode On/Off state
1111
+ * @param reason Reason
1112
+ */
1113
+ setSelfMute(mode?: boolean, reason?: string): Promise<discord_js.GuildMember>;
984
1114
  }
985
1115
 
986
- interface GuildQueueStatisticsMetadata {
987
- latency: {
988
- eventLoop: number;
989
- voiceConnection: number;
990
- };
991
- status: {
992
- buffering: boolean;
993
- playing: boolean;
994
- paused: boolean;
995
- idle: boolean;
996
- };
997
- tracksCount: number;
998
- historySize: number;
999
- extractors: number;
1000
- listeners: number;
1001
- memoryUsage: NodeJS.MemoryUsage;
1002
- versions: {
1003
- node: string;
1004
- player: string;
1005
- };
1006
- }
1007
- declare class GuildQueueStatistics<Meta = unknown> {
1008
- queue: GuildQueue<Meta>;
1009
- constructor(queue: GuildQueue<Meta>);
1010
- /**
1011
- * Generate statistics of this queue
1012
- */
1013
- generate(): GuildQueueStatisticsMetadata;
1116
+ interface GuildQueueStatisticsMetadata {
1117
+ latency: {
1118
+ eventLoop: number;
1119
+ voiceConnection: number;
1120
+ };
1121
+ status: {
1122
+ buffering: boolean;
1123
+ playing: boolean;
1124
+ paused: boolean;
1125
+ idle: boolean;
1126
+ };
1127
+ tracksCount: number;
1128
+ historySize: number;
1129
+ extractors: number;
1130
+ listeners: number;
1131
+ memoryUsage: NodeJS.MemoryUsage;
1132
+ versions: {
1133
+ node: string;
1134
+ player: string;
1135
+ };
1136
+ }
1137
+ declare class GuildQueueStatistics<Meta = unknown> {
1138
+ queue: GuildQueue<Meta>;
1139
+ constructor(queue: GuildQueue<Meta>);
1140
+ /**
1141
+ * Generate statistics of this queue
1142
+ */
1143
+ generate(): GuildQueueStatisticsMetadata;
1014
1144
  }
1015
1145
 
1016
- declare class VoiceUtils {
1017
- cache: Collection<Snowflake, StreamDispatcher>;
1018
- /**
1019
- * The voice utils
1020
- * @private
1021
- */
1022
- constructor();
1023
- /**
1024
- * Joins a voice channel, creating basic stream dispatch manager
1025
- * @param {StageChannel|VoiceChannel} channel The voice channel
1026
- * @param {object} [options] Join options
1027
- * @returns {Promise<StreamDispatcher>}
1028
- */
1029
- connect(channel: VoiceChannel | StageChannel, options?: {
1030
- deaf?: boolean;
1031
- maxTime?: number;
1032
- queue: GuildQueue;
1033
- }): Promise<StreamDispatcher>;
1034
- /**
1035
- * Joins a voice channel
1036
- * @param {StageChannel|VoiceChannel} [channel] The voice/stage channel to join
1037
- * @param {object} [options] Join options
1038
- * @returns {VoiceConnection}
1039
- */
1040
- join(channel: VoiceChannel | StageChannel, options?: {
1041
- deaf?: boolean;
1042
- maxTime?: number;
1043
- }): Promise<VoiceConnection>;
1044
- /**
1045
- * Disconnects voice connection
1046
- * @param {VoiceConnection} connection The voice connection
1047
- * @returns {void}
1048
- */
1049
- disconnect(connection: VoiceConnection | StreamDispatcher): void;
1050
- /**
1051
- * Returns Discord Player voice connection
1052
- * @param {Snowflake} guild The guild id
1053
- * @returns {StreamDispatcher}
1054
- */
1055
- getConnection(guild: Snowflake): StreamDispatcher | VoiceConnection | undefined;
1146
+ declare class VoiceUtils {
1147
+ player: Player;
1148
+ cache: Collection<Snowflake, StreamDispatcher>;
1149
+ /**
1150
+ * The voice utils
1151
+ * @private
1152
+ */
1153
+ constructor(player: Player);
1154
+ /**
1155
+ * Joins a voice channel, creating basic stream dispatch manager
1156
+ * @param {StageChannel|VoiceChannel} channel The voice channel
1157
+ * @param {object} [options] Join options
1158
+ * @returns {Promise<StreamDispatcher>}
1159
+ */
1160
+ connect(channel: VoiceChannel | StageChannel, options?: {
1161
+ deaf?: boolean;
1162
+ maxTime?: number;
1163
+ queue: GuildQueue;
1164
+ }): Promise<StreamDispatcher>;
1165
+ /**
1166
+ * Joins a voice channel
1167
+ * @param {StageChannel|VoiceChannel} [channel] The voice/stage channel to join
1168
+ * @param {object} [options] Join options
1169
+ * @returns {VoiceConnection}
1170
+ */
1171
+ join(channel: VoiceChannel | StageChannel, options?: {
1172
+ deaf?: boolean;
1173
+ maxTime?: number;
1174
+ }): Promise<VoiceConnection>;
1175
+ /**
1176
+ * Disconnects voice connection
1177
+ * @param {VoiceConnection} connection The voice connection
1178
+ * @returns {void}
1179
+ */
1180
+ disconnect(connection: VoiceConnection | StreamDispatcher): void;
1181
+ /**
1182
+ * Returns Discord Player voice connection
1183
+ * @param {Snowflake} guild The guild id
1184
+ * @returns {StreamDispatcher}
1185
+ */
1186
+ getConnection(guild: Snowflake): StreamDispatcher | VoiceConnection | undefined;
1056
1187
  }
1057
1188
 
1058
- interface SearchResultData {
1059
- query: string;
1060
- queryType?: SearchQueryType | QueryExtractorSearch | null;
1061
- extractor?: BaseExtractor | null;
1062
- playlist?: Playlist | null;
1063
- tracks?: Track[];
1064
- requestedBy?: User | null;
1065
- }
1066
- declare class SearchResult {
1067
- player: Player;
1068
- private _data;
1069
- constructor(player: Player, _data: SearchResultData);
1070
- /**
1071
- * The search query
1072
- */
1073
- get query(): string;
1074
- /**
1075
- * The search query type
1076
- */
1077
- get queryType(): SearchQueryType | `ext:${string}`;
1078
- /**
1079
- * The extractor
1080
- */
1081
- get extractor(): BaseExtractor | null;
1082
- /**
1083
- * Playlist result
1084
- */
1085
- get playlist(): Playlist | null | undefined;
1086
- /**
1087
- * Tracks result
1088
- */
1089
- get tracks(): Track[];
1090
- /**
1091
- * Requested by
1092
- */
1093
- get requestedBy(): User | null;
1094
- /**
1095
- * Re-execute this search
1096
- */
1097
- execute(): Promise<SearchResult>;
1098
- /**
1099
- * If this search result is empty
1100
- */
1101
- isEmpty(): boolean;
1102
- /**
1103
- * If this search result has playlist
1104
- */
1105
- hasPlaylist(): boolean;
1106
- /**
1107
- * If this search result has tracks
1108
- */
1109
- hasTracks(): boolean;
1110
- /**
1111
- * JSON representation of this search
1112
- */
1113
- toJSON(): {
1114
- query: string;
1115
- queryType: SearchQueryType | `ext:${string}`;
1116
- playlist: PlaylistJSON | null;
1117
- tracks: TrackJSON[];
1118
- extractor: string | null;
1119
- requestedBy: {} | null;
1120
- };
1189
+ interface SearchResultData {
1190
+ query: string;
1191
+ queryType?: SearchQueryType | QueryExtractorSearch | null;
1192
+ extractor?: BaseExtractor | null;
1193
+ playlist?: Playlist | null;
1194
+ tracks?: Track[];
1195
+ requestedBy?: User | null;
1196
+ }
1197
+ declare class SearchResult {
1198
+ player: Player;
1199
+ private _data;
1200
+ constructor(player: Player, _data: SearchResultData);
1201
+ setQueryType(type: SearchQueryType | QueryExtractorSearch): this;
1202
+ setRequestedBy(user: User): this;
1203
+ setExtractor(extractor: BaseExtractor): this;
1204
+ setTracks(tracks: Track[]): this;
1205
+ setQuery(query: string): this;
1206
+ setPlaylist(playlist: Playlist): this;
1207
+ /**
1208
+ * The search query
1209
+ */
1210
+ get query(): string;
1211
+ /**
1212
+ * The search query type
1213
+ */
1214
+ get queryType(): SearchQueryType | `ext:${string}`;
1215
+ /**
1216
+ * The extractor
1217
+ */
1218
+ get extractor(): BaseExtractor | null;
1219
+ /**
1220
+ * Playlist result
1221
+ */
1222
+ get playlist(): Playlist | null | undefined;
1223
+ /**
1224
+ * Tracks result
1225
+ */
1226
+ get tracks(): Track[];
1227
+ /**
1228
+ * Requested by
1229
+ */
1230
+ get requestedBy(): User | null;
1231
+ /**
1232
+ * Re-execute this search
1233
+ */
1234
+ execute(): Promise<SearchResult>;
1235
+ /**
1236
+ * If this search result is empty
1237
+ */
1238
+ isEmpty(): boolean;
1239
+ /**
1240
+ * If this search result has playlist
1241
+ */
1242
+ hasPlaylist(): boolean;
1243
+ /**
1244
+ * If this search result has tracks
1245
+ */
1246
+ hasTracks(): boolean;
1247
+ /**
1248
+ * JSON representation of this search
1249
+ */
1250
+ toJSON(): {
1251
+ query: string;
1252
+ queryType: SearchQueryType | `ext:${string}`;
1253
+ playlist: PlaylistJSON | null;
1254
+ tracks: TrackJSON[];
1255
+ extractor: string | null;
1256
+ requestedBy: {} | null;
1257
+ };
1121
1258
  }
1122
1259
 
1123
- interface QueryCacheOptions {
1124
- checkInterval?: number;
1125
- }
1126
- declare class QueryCache {
1127
- #private;
1128
- player: Player;
1129
- options: QueryCacheOptions;
1130
- timer: NodeJS.Timer;
1131
- fuse: Fuse<Track>;
1132
- constructor(player: Player, options?: QueryCacheOptions);
1133
- get checkInterval(): number;
1134
- cleanup(): Promise<void>;
1135
- clear(): Promise<void>;
1136
- getData(): Promise<DiscordPlayerQueryResultCache<Track>[]>;
1137
- addData(data: SearchResult): Promise<void>;
1138
- resolve(context: QueryCacheResolverContext): Promise<SearchResult>;
1139
- }
1140
- declare class DiscordPlayerQueryResultCache<T = unknown> {
1141
- data: T;
1142
- expireAfter: number;
1143
- constructor(data: T, expireAfter?: number);
1144
- hasExpired(): boolean;
1145
- }
1146
- interface QueryCacheResolverContext {
1147
- query: string;
1148
- requestedBy?: User;
1149
- queryType?: SearchQueryType | `ext:${string}`;
1260
+ interface QueryCacheOptions {
1261
+ checkInterval?: number;
1262
+ }
1263
+ declare class QueryCache {
1264
+ #private;
1265
+ player: Player;
1266
+ options: QueryCacheOptions;
1267
+ timer: NodeJS.Timer;
1268
+ constructor(player: Player, options?: QueryCacheOptions);
1269
+ get checkInterval(): number;
1270
+ cleanup(): Promise<void>;
1271
+ clear(): Promise<void>;
1272
+ getData(): Promise<DiscordPlayerQueryResultCache<Track>[]>;
1273
+ addData(data: SearchResult): Promise<void>;
1274
+ resolve(context: QueryCacheResolverContext): Promise<SearchResult>;
1275
+ }
1276
+ declare class DiscordPlayerQueryResultCache<T = unknown> {
1277
+ data: T;
1278
+ expireAfter: number;
1279
+ constructor(data: T, expireAfter?: number);
1280
+ hasExpired(): boolean;
1281
+ }
1282
+ interface QueryCacheResolverContext {
1283
+ query: string;
1284
+ requestedBy?: User;
1285
+ queryType?: SearchQueryType | `ext:${string}`;
1286
+ }
1287
+
1288
+ declare class Player extends PlayerEventsEmitter<PlayerEvents> {
1289
+ #private;
1290
+ static _singletonKey: symbol;
1291
+ readonly id: string;
1292
+ readonly client: Client;
1293
+ readonly options: PlayerInitOptions;
1294
+ nodes: GuildNodeManager<unknown>;
1295
+ readonly voiceUtils: VoiceUtils;
1296
+ extractors: ExtractorExecutionContext;
1297
+ events: PlayerEventsEmitter<GuildQueueEvents<unknown>>;
1298
+ /**
1299
+ * Creates new Discord Player
1300
+ * @param {Client} client The Discord Client
1301
+ * @param {PlayerInitOptions} [options] The player init options
1302
+ */
1303
+ constructor(client: Client, options?: PlayerInitOptions);
1304
+ debug(m: string): boolean;
1305
+ /**
1306
+ * Creates discord-player singleton instance.
1307
+ * @param client The client that instantiated player
1308
+ * @param options Player initializer options
1309
+ */
1310
+ static singleton(client: Client, options?: PlayerInitOptions): Player;
1311
+ /**
1312
+ * Get all active player instances
1313
+ */
1314
+ static getAllPlayers(): Player[];
1315
+ /**
1316
+ * Clear all player instances
1317
+ */
1318
+ static clearAllPlayers(): void;
1319
+ /**
1320
+ * The current query cache provider
1321
+ */
1322
+ get queryCache(): QueryCache | null;
1323
+ /**
1324
+ * Alias to `Player.nodes`
1325
+ */
1326
+ get queues(): GuildNodeManager<unknown>;
1327
+ /**
1328
+ * Event loop lag
1329
+ * @type {number}
1330
+ */
1331
+ get eventLoopLag(): number;
1332
+ /**
1333
+ * Generates statistics
1334
+ */
1335
+ generateStatistics(): {
1336
+ instances: number;
1337
+ queuesCount: number;
1338
+ queryCacheEnabled: boolean;
1339
+ queues: GuildQueueStatisticsMetadata[];
1340
+ };
1341
+ /**
1342
+ * Destroy player
1343
+ */
1344
+ destroy(): Promise<void>;
1345
+ private _handleVoiceState;
1346
+ /**
1347
+ * Handles voice state update
1348
+ * @param {VoiceState} oldState The old voice state
1349
+ * @param {VoiceState} newState The new voice state
1350
+ * @returns {void}
1351
+ */
1352
+ handleVoiceState(oldState: VoiceState, newState: VoiceState): void;
1353
+ /**
1354
+ * Lock voice state handler
1355
+ */
1356
+ lockVoiceStateHandler(): void;
1357
+ /**
1358
+ * Unlock voice state handler
1359
+ */
1360
+ unlockVoiceStateHandler(): void;
1361
+ /**
1362
+ * Checks if voice state handler is locked
1363
+ */
1364
+ isVoiceStateHandlerLocked(): boolean;
1365
+ /**
1366
+ * Initiate audio player
1367
+ * @param channel The voice channel on which the music should be played
1368
+ * @param query The track or source to play
1369
+ * @param options Options for player
1370
+ */
1371
+ play<T = unknown>(channel: GuildVoiceChannelResolvable, query: string | Track | SearchResult | Track[] | Playlist, options?: SearchOptions & {
1372
+ nodeOptions?: GuildNodeCreateOptions<T>;
1373
+ connectionOptions?: VoiceConnectConfig;
1374
+ afterSearch?: (result: SearchResult) => Promise<SearchResult>;
1375
+ }): Promise<{
1376
+ track: Track;
1377
+ extractor: BaseExtractor | null;
1378
+ searchResult: SearchResult;
1379
+ queue: GuildQueue<T>;
1380
+ }>;
1381
+ /**
1382
+ * @typedef {object} PlayerSearchResult
1383
+ * @property {Playlist} [playlist] The playlist (if any)
1384
+ * @property {Track[]} tracks The tracks
1385
+ */
1386
+ /**
1387
+ * Search tracks
1388
+ * @param {string | Track | Track[] | Playlist | SearchResult} query The search query
1389
+ * @param {SearchOptions} options The search options
1390
+ * @returns {Promise<SearchResult>}
1391
+ */
1392
+ search(query: string | Track | Track[] | Playlist | SearchResult, options?: SearchOptions): Promise<SearchResult>;
1393
+ /**
1394
+ * Generates a report of the dependencies used by the `@discordjs/voice` module. Useful for debugging.
1395
+ * @returns {string}
1396
+ */
1397
+ scanDeps(): string;
1398
+ [Symbol.iterator](): Generator<GuildQueue<unknown>, void, undefined>;
1399
+ /**
1400
+ * Creates `Playlist` instance
1401
+ * @param data The data to initialize a playlist
1402
+ */
1403
+ createPlaylist(data: PlaylistInitData): Playlist;
1150
1404
  }
1151
1405
 
1152
- declare class Player extends PlayerEventsEmitter<PlayerEvents> {
1153
- #private;
1154
- static _singletonKey: symbol;
1155
- readonly id: string;
1156
- readonly client: Client;
1157
- readonly options: PlayerInitOptions;
1158
- nodes: GuildNodeManager<unknown>;
1159
- readonly voiceUtils: VoiceUtils;
1160
- extractors: ExtractorExecutionContext;
1161
- events: PlayerEventsEmitter<GuildQueueEvents<unknown>>;
1162
- /**
1163
- * Creates new Discord Player
1164
- * @param {Client} client The Discord Client
1165
- * @param {PlayerInitOptions} [options] The player init options
1166
- */
1167
- constructor(client: Client, options?: PlayerInitOptions);
1168
- debug(m: string): boolean;
1169
- /**
1170
- * Creates discord-player singleton instance.
1171
- * @param client The client that instantiated player
1172
- * @param options Player initializer options
1173
- */
1174
- static singleton(client: Client, options?: PlayerInitOptions): Player;
1175
- /**
1176
- * Get all active player instances
1177
- */
1178
- static getAllPlayers(): Player[];
1179
- /**
1180
- * Clear all player instances
1181
- */
1182
- static clearAllPlayers(): void;
1183
- /**
1184
- * The current query cache provider
1185
- */
1186
- get queryCache(): QueryCache | null;
1187
- /**
1188
- * Alias to `Player.nodes`
1189
- */
1190
- get queues(): GuildNodeManager<unknown>;
1191
- /**
1192
- * Event loop lag
1193
- * @type {number}
1194
- */
1195
- get eventLoopLag(): number;
1196
- /**
1197
- * Generates statistics
1198
- */
1199
- generateStatistics(): {
1200
- instances: number;
1201
- queuesCount: number;
1202
- queryCacheEnabled: boolean;
1203
- queues: GuildQueueStatisticsMetadata[];
1204
- };
1205
- /**
1206
- * Destroy player
1207
- */
1208
- destroy(): Promise<void>;
1209
- private _handleVoiceState;
1210
- /**
1211
- * Handles voice state update
1212
- * @param {VoiceState} oldState The old voice state
1213
- * @param {VoiceState} newState The new voice state
1214
- * @returns {void}
1215
- */
1216
- handleVoiceState(oldState: VoiceState, newState: VoiceState): void;
1217
- /**
1218
- * Lock voice state handler
1219
- */
1220
- lockVoiceStateHandler(): void;
1221
- /**
1222
- * Unlock voice state handler
1223
- */
1224
- unlockVoiceStateHandler(): void;
1225
- /**
1226
- * Checks if voice state handler is locked
1227
- */
1228
- isVoiceStateHandlerLocked(): boolean;
1229
- /**
1230
- * Initiate audio player
1231
- * @param channel The voice channel on which the music should be played
1232
- * @param query The track or source to play
1233
- * @param options Options for player
1234
- */
1235
- play<T = unknown>(channel: GuildVoiceChannelResolvable, query: string | Track | SearchResult, options?: SearchOptions & {
1236
- nodeOptions?: GuildNodeCreateOptions<T>;
1237
- connectionOptions?: VoiceConnectConfig;
1238
- }): Promise<{
1239
- track: Track;
1240
- extractor: BaseExtractor | null;
1241
- searchResult: SearchResult;
1242
- queue: GuildQueue<T>;
1243
- }>;
1244
- /**
1245
- * @typedef {object} PlayerSearchResult
1246
- * @property {Playlist} [playlist] The playlist (if any)
1247
- * @property {Track[]} tracks The tracks
1248
- */
1249
- /**
1250
- * Search tracks
1251
- * @param {string|Track} query The search query
1252
- * @param {SearchOptions} options The search options
1253
- * @returns {Promise<SearchResult>}
1254
- */
1255
- search(query: string | Track, options?: SearchOptions): Promise<SearchResult>;
1256
- /**
1257
- * Generates a report of the dependencies used by the `@discordjs/voice` module. Useful for debugging.
1258
- * @returns {string}
1259
- */
1260
- scanDeps(): string;
1261
- [Symbol.iterator](): Generator<GuildQueue<unknown>, void, undefined>;
1262
- /**
1263
- * Creates `Playlist` instance
1264
- * @param data The data to initialize a playlist
1265
- */
1266
- createPlaylist(data: PlaylistInitData): Playlist;
1406
+ interface GuildNodeCreateOptions<T = unknown> {
1407
+ strategy?: QueueStrategy;
1408
+ volume?: number | boolean;
1409
+ equalizer?: EqualizerBand[] | boolean;
1410
+ a_filter?: PCMFilters[] | boolean;
1411
+ biquad?: BiquadFilters | boolean;
1412
+ resampler?: number | boolean;
1413
+ disableHistory?: boolean;
1414
+ skipOnNoStream?: boolean;
1415
+ onBeforeCreateStream?: OnBeforeCreateStreamHandler;
1416
+ onAfterCreateStream?: OnAfterCreateStreamHandler;
1417
+ repeatMode?: QueueRepeatMode;
1418
+ leaveOnEmpty?: boolean;
1419
+ leaveOnEmptyCooldown?: number;
1420
+ leaveOnEnd?: boolean;
1421
+ leaveOnEndCooldown?: number;
1422
+ leaveOnStop?: boolean;
1423
+ leaveOnStopCooldown?: number;
1424
+ metadata?: T | null;
1425
+ selfDeaf?: boolean;
1426
+ connectionTimeout?: number;
1427
+ defaultFFmpegFilters?: FiltersName[];
1428
+ bufferingTimeout?: number;
1429
+ }
1430
+ type NodeResolvable = GuildQueue | GuildResolvable;
1431
+ declare class GuildNodeManager<Meta = unknown> {
1432
+ player: Player;
1433
+ cache: Collection<string, GuildQueue<unknown>>;
1434
+ constructor(player: Player);
1435
+ /**
1436
+ * Create guild queue if it does not exist
1437
+ * @param guild The guild which will be the owner of the queue
1438
+ * @param options Queue initializer options
1439
+ */
1440
+ create<T = Meta>(guild: GuildResolvable, options?: GuildNodeCreateOptions<T>): GuildQueue<T>;
1441
+ /**
1442
+ * Get existing queue
1443
+ * @param node Queue resolvable
1444
+ */
1445
+ get<T = Meta>(node: NodeResolvable): GuildQueue<T> | null;
1446
+ /**
1447
+ * Check if a queue exists
1448
+ * @param node Queue resolvable
1449
+ */
1450
+ has(node: NodeResolvable): boolean;
1451
+ /**
1452
+ * Delete queue
1453
+ * @param node Queue resolvable
1454
+ */
1455
+ delete(node: NodeResolvable): boolean;
1456
+ /**
1457
+ * Resolve queue
1458
+ * @param node Queue resolvable
1459
+ */
1460
+ resolve<T = Meta>(node: NodeResolvable): GuildQueue<unknown> | undefined;
1461
+ /**
1462
+ * Resolve queue id
1463
+ * @param node Queue resolvable
1464
+ */
1465
+ resolveId(node: NodeResolvable): string | null;
1267
1466
  }
1268
1467
 
1269
- interface GuildNodeCreateOptions<T = unknown> {
1270
- strategy?: QueueStrategy;
1271
- volume?: number | boolean;
1272
- equalizer?: EqualizerBand[] | boolean;
1273
- a_filter?: PCMFilters[] | boolean;
1274
- biquad?: BiquadFilters | boolean;
1275
- resampler?: number | boolean;
1276
- disableHistory?: boolean;
1277
- skipOnNoStream?: boolean;
1278
- onBeforeCreateStream?: OnBeforeCreateStreamHandler;
1279
- onAfterCreateStream?: OnAfterCreateStreamHandler;
1280
- repeatMode?: QueueRepeatMode;
1281
- leaveOnEmpty?: boolean;
1282
- leaveOnEmptyCooldown?: number;
1283
- leaveOnEnd?: boolean;
1284
- leaveOnEndCooldown?: number;
1285
- leaveOnStop?: boolean;
1286
- leaveOnStopCooldown?: number;
1287
- metadata?: T | null;
1288
- selfDeaf?: boolean;
1289
- connectionTimeout?: number;
1290
- defaultFFmpegFilters?: FiltersName[];
1291
- bufferingTimeout?: number;
1292
- }
1293
- type NodeResolvable = GuildQueue | GuildResolvable;
1294
- declare class GuildNodeManager<Meta = unknown> {
1295
- player: Player;
1296
- cache: Collection<string, GuildQueue<unknown>>;
1297
- constructor(player: Player);
1298
- /**
1299
- * Create guild queue if it does not exist
1300
- * @param guild The guild which will be the owner of the queue
1301
- * @param options Queue initializer options
1302
- */
1303
- create<T = Meta>(guild: GuildResolvable, options?: GuildNodeCreateOptions<T>): GuildQueue<T>;
1304
- /**
1305
- * Get existing queue
1306
- * @param node Queue resolvable
1307
- */
1308
- get<T = Meta>(node: NodeResolvable): GuildQueue<T> | null;
1309
- /**
1310
- * Check if a queue exists
1311
- * @param node Queue resolvable
1312
- */
1313
- has(node: NodeResolvable): boolean;
1314
- /**
1315
- * Delete queue
1316
- * @param node Queue resolvable
1317
- */
1318
- delete(node: NodeResolvable): boolean;
1319
- /**
1320
- * Resolve queue
1321
- * @param node Queue resolvable
1322
- */
1323
- resolve<T = Meta>(node: NodeResolvable): GuildQueue<unknown> | undefined;
1324
- /**
1325
- * Resolve queue id
1326
- * @param node Queue resolvable
1327
- */
1328
- resolveId(node: NodeResolvable): string | null;
1468
+ declare enum ErrorStatusCode {
1469
+ STREAM_ERROR = "StreamError",
1470
+ AUDIO_PLAYER_ERROR = "AudioPlayerError",
1471
+ PLAYER_ERROR = "PlayerError",
1472
+ NO_AUDIO_RESOURCE = "NoAudioResource",
1473
+ UNKNOWN_GUILD = "UnknownGuild",
1474
+ INVALID_ARG_TYPE = "InvalidArgType",
1475
+ UNKNOWN_EXTRACTOR = "UnknownExtractor",
1476
+ INVALID_EXTRACTOR = "InvalidExtractor",
1477
+ INVALID_CHANNEL_TYPE = "InvalidChannelType",
1478
+ INVALID_TRACK = "InvalidTrack",
1479
+ UNKNOWN_REPEAT_MODE = "UnknownRepeatMode",
1480
+ TRACK_NOT_FOUND = "TrackNotFound",
1481
+ NO_CONNECTION = "NoConnection",
1482
+ DESTROYED_QUEUE = "DestroyedQueue"
1483
+ }
1484
+ declare class PlayerError extends Error {
1485
+ message: string;
1486
+ statusCode: ErrorStatusCode;
1487
+ createdAt: Date;
1488
+ constructor(message: string, code?: ErrorStatusCode);
1489
+ get createdTimestamp(): number;
1490
+ valueOf(): ErrorStatusCode;
1491
+ toJSON(): {
1492
+ stack: string | undefined;
1493
+ code: ErrorStatusCode;
1494
+ message: string;
1495
+ created: number;
1496
+ };
1497
+ toString(): string | undefined;
1329
1498
  }
1330
1499
 
1331
- declare enum ErrorStatusCode {
1332
- STREAM_ERROR = "StreamError",
1333
- AUDIO_PLAYER_ERROR = "AudioPlayerError",
1334
- PLAYER_ERROR = "PlayerError",
1335
- NO_AUDIO_RESOURCE = "NoAudioResource",
1336
- UNKNOWN_GUILD = "UnknownGuild",
1337
- INVALID_ARG_TYPE = "InvalidArgType",
1338
- UNKNOWN_EXTRACTOR = "UnknownExtractor",
1339
- INVALID_EXTRACTOR = "InvalidExtractor",
1340
- INVALID_CHANNEL_TYPE = "InvalidChannelType",
1341
- INVALID_TRACK = "InvalidTrack",
1342
- UNKNOWN_REPEAT_MODE = "UnknownRepeatMode",
1343
- TRACK_NOT_FOUND = "TrackNotFound",
1344
- NO_CONNECTION = "NoConnection",
1345
- DESTROYED_QUEUE = "DestroyedQueue"
1346
- }
1347
- declare class PlayerError extends Error {
1348
- message: string;
1349
- statusCode: ErrorStatusCode;
1350
- createdAt: Date;
1351
- constructor(message: string, code?: ErrorStatusCode);
1352
- get createdTimestamp(): number;
1353
- valueOf(): ErrorStatusCode;
1354
- toJSON(): {
1355
- stack: string | undefined;
1356
- code: ErrorStatusCode;
1357
- message: string;
1358
- created: number;
1359
- };
1360
- toString(): string | undefined;
1500
+ type FiltersName = keyof QueueFilters;
1501
+ interface PlayerSearchResult {
1502
+ playlist: Playlist | null;
1503
+ tracks: Track[];
1504
+ }
1505
+ /**
1506
+ * @typedef {AudioFilters} QueueFilters
1507
+ */
1508
+ interface QueueFilters {
1509
+ bassboost_low?: boolean;
1510
+ bassboost?: boolean;
1511
+ bassboost_high?: boolean;
1512
+ '8D'?: boolean;
1513
+ vaporwave?: boolean;
1514
+ nightcore?: boolean;
1515
+ phaser?: boolean;
1516
+ tremolo?: boolean;
1517
+ vibrato?: boolean;
1518
+ reverse?: boolean;
1519
+ treble?: boolean;
1520
+ normalizer?: boolean;
1521
+ normalizer2?: boolean;
1522
+ surrounding?: boolean;
1523
+ pulsator?: boolean;
1524
+ subboost?: boolean;
1525
+ karaoke?: boolean;
1526
+ flanger?: boolean;
1527
+ gate?: boolean;
1528
+ haas?: boolean;
1529
+ mcompand?: boolean;
1530
+ mono?: boolean;
1531
+ mstlr?: boolean;
1532
+ mstrr?: boolean;
1533
+ compressor?: boolean;
1534
+ expander?: boolean;
1535
+ softlimiter?: boolean;
1536
+ chorus?: boolean;
1537
+ chorus2d?: boolean;
1538
+ chorus3d?: boolean;
1539
+ fadein?: boolean;
1540
+ dim?: boolean;
1541
+ earrape?: boolean;
1542
+ lofi?: boolean;
1543
+ }
1544
+ /**
1545
+ * The track source:
1546
+ * - soundcloud
1547
+ * - youtube
1548
+ * - spotify
1549
+ * - apple_music
1550
+ * - arbitrary
1551
+ * @typedef {string} TrackSource
1552
+ */
1553
+ type TrackSource = 'soundcloud' | 'youtube' | 'spotify' | 'apple_music' | 'arbitrary';
1554
+ /**
1555
+ * @typedef {object} RawTrackData
1556
+ * @property {string} title The title
1557
+ * @property {string} description The description
1558
+ * @property {string} author The author
1559
+ * @property {string} url The url
1560
+ * @property {string} thumbnail The thumbnail
1561
+ * @property {string} duration The duration
1562
+ * @property {number} views The views
1563
+ * @property {User} requestedBy The user who requested this track
1564
+ * @property {Playlist} [playlist] The playlist
1565
+ * @property {TrackSource} [source="arbitrary"] The source
1566
+ * @property {any} [engine] The engine
1567
+ * @property {boolean} [live] If this track is live
1568
+ * @property {any} [raw] The raw data
1569
+ */
1570
+ interface RawTrackData {
1571
+ title: string;
1572
+ description: string;
1573
+ author: string;
1574
+ url: string;
1575
+ thumbnail: string;
1576
+ duration: string;
1577
+ views: number;
1578
+ requestedBy?: User | null;
1579
+ playlist?: Playlist;
1580
+ source?: TrackSource;
1581
+ engine?: any;
1582
+ live?: boolean;
1583
+ raw?: any;
1584
+ queryType?: SearchQueryType;
1585
+ }
1586
+ /**
1587
+ * @typedef {object} TimeData
1588
+ * @property {number} days Time in days
1589
+ * @property {number} hours Time in hours
1590
+ * @property {number} minutes Time in minutes
1591
+ * @property {number} seconds Time in seconds
1592
+ */
1593
+ interface TimeData {
1594
+ days: number;
1595
+ hours: number;
1596
+ minutes: number;
1597
+ seconds: number;
1598
+ }
1599
+ /**
1600
+ * @typedef {object} PlayerProgressbarOptions
1601
+ * @property {boolean} [timecodes] If it should render time codes
1602
+ * @property {boolean} [queue] If it should create progress bar for the whole queue
1603
+ * @property {number} [length] The bar length
1604
+ * @property {string} [line] The bar track
1605
+ * @property {string} [indicator] The indicator
1606
+ */
1607
+ interface PlayerProgressbarOptions {
1608
+ timecodes?: boolean;
1609
+ length?: number;
1610
+ line?: string;
1611
+ indicator?: string;
1612
+ queue?: boolean;
1613
+ }
1614
+ /**
1615
+ * The search query type
1616
+ * This can be one of:
1617
+ * - AUTO
1618
+ * - YOUTUBE
1619
+ * - YOUTUBE_PLAYLIST
1620
+ * - SOUNDCLOUD_TRACK
1621
+ * - SOUNDCLOUD_PLAYLIST
1622
+ * - SOUNDCLOUD
1623
+ * - SPOTIFY_SONG
1624
+ * - SPOTIFY_ALBUM
1625
+ * - SPOTIFY_PLAYLIST
1626
+ * - FACEBOOK
1627
+ * - VIMEO
1628
+ * - ARBITRARY
1629
+ * - REVERBNATION
1630
+ * - YOUTUBE_SEARCH
1631
+ * - YOUTUBE_VIDEO
1632
+ * - SOUNDCLOUD_SEARCH
1633
+ * - APPLE_MUSIC_SONG
1634
+ * - APPLE_MUSIC_ALBUM
1635
+ * - APPLE_MUSIC_PLAYLIST
1636
+ * - APPLE_MUSIC_SEARCH
1637
+ * - FILE
1638
+ * @typedef {number} QueryType
1639
+ */
1640
+ declare const QueryType: {
1641
+ readonly AUTO: "auto";
1642
+ readonly YOUTUBE: "youtube";
1643
+ readonly YOUTUBE_PLAYLIST: "youtubePlaylist";
1644
+ readonly SOUNDCLOUD_TRACK: "soundcloudTrack";
1645
+ readonly SOUNDCLOUD_PLAYLIST: "soundcloudPlaylist";
1646
+ readonly SOUNDCLOUD: "soundcloud";
1647
+ readonly SPOTIFY_SONG: "spotifySong";
1648
+ readonly SPOTIFY_ALBUM: "spotifyAlbum";
1649
+ readonly SPOTIFY_PLAYLIST: "spotifyPlaylist";
1650
+ readonly FACEBOOK: "facebook";
1651
+ readonly VIMEO: "vimeo";
1652
+ readonly ARBITRARY: "arbitrary";
1653
+ readonly REVERBNATION: "reverbnation";
1654
+ readonly YOUTUBE_SEARCH: "youtubeSearch";
1655
+ readonly YOUTUBE_VIDEO: "youtubeVideo";
1656
+ readonly SOUNDCLOUD_SEARCH: "soundcloudSearch";
1657
+ readonly APPLE_MUSIC_SONG: "appleMusicSong";
1658
+ readonly APPLE_MUSIC_ALBUM: "appleMusicAlbum";
1659
+ readonly APPLE_MUSIC_PLAYLIST: "appleMusicPlaylist";
1660
+ readonly APPLE_MUSIC_SEARCH: "appleMusicSearch";
1661
+ readonly FILE: "file";
1662
+ };
1663
+ type SearchQueryType = keyof typeof QueryType | (typeof QueryType)[keyof typeof QueryType];
1664
+ interface PlayerEvents {
1665
+ debug: (message: string) => any;
1666
+ error: (error: Error) => any;
1667
+ voiceStateUpdate: (queue: GuildQueue, oldState: VoiceState, newState: VoiceState) => any;
1668
+ }
1669
+ declare enum PlayerEvent {
1670
+ debug = "debug",
1671
+ error = "error",
1672
+ voiceStateUpdate = "voiceStateUpdate"
1673
+ }
1674
+ /**
1675
+ * @typedef {object} PlayOptions
1676
+ * @property {boolean} [filtersUpdate=false] If this play was triggered for filters update
1677
+ * @property {string[]} [encoderArgs=[]] FFmpeg args passed to encoder
1678
+ * @property {number} [seek] Time to seek to before playing
1679
+ * @property {boolean} [immediate=false] If it should start playing the provided track immediately
1680
+ */
1681
+ interface PlayOptions {
1682
+ filtersUpdate?: boolean;
1683
+ encoderArgs?: string[];
1684
+ seek?: number;
1685
+ immediate?: boolean;
1686
+ }
1687
+ type QueryExtractorSearch = `ext:${string}`;
1688
+ /**
1689
+ * @typedef {object} SearchOptions
1690
+ * @property {UserResolvable} requestedBy The user who requested this search
1691
+ * @property {typeof QueryType|string} [searchEngine=QueryType.AUTO] The query search engine, can be extractor name to target specific one (custom)
1692
+ * @property {string[]} [blockExtractors[]] List of the extractors to block
1693
+ * @property {boolean} [ignoreCache] If it should ignore query cache lookup
1694
+ */
1695
+ interface SearchOptions {
1696
+ requestedBy?: UserResolvable;
1697
+ searchEngine?: SearchQueryType | QueryExtractorSearch;
1698
+ blockExtractors?: string[];
1699
+ ignoreCache?: boolean;
1700
+ }
1701
+ /**
1702
+ * The queue repeat mode. This can be one of:
1703
+ * - OFF
1704
+ * - TRACK
1705
+ * - QUEUE
1706
+ * - AUTOPLAY
1707
+ * @typedef {number} QueueRepeatMode
1708
+ */
1709
+ declare enum QueueRepeatMode {
1710
+ OFF = 0,
1711
+ TRACK = 1,
1712
+ QUEUE = 2,
1713
+ AUTOPLAY = 3
1714
+ }
1715
+ /**
1716
+ * @typedef {object} PlaylistInitData
1717
+ * @property {Track[]} tracks The tracks of this playlist
1718
+ * @property {string} title The playlist title
1719
+ * @property {string} description The description
1720
+ * @property {string} thumbnail The thumbnail
1721
+ * @property {album|playlist} type The playlist type: `album` | `playlist`
1722
+ * @property {TrackSource} source The playlist source
1723
+ * @property {object} author The playlist author
1724
+ * @property {string} [author.name] The author name
1725
+ * @property {string} [author.url] The author url
1726
+ * @property {string} id The playlist id
1727
+ * @property {string} url The playlist url
1728
+ * @property {any} [rawPlaylist] The raw playlist data
1729
+ */
1730
+ interface PlaylistInitData {
1731
+ tracks: Track[];
1732
+ title: string;
1733
+ description: string;
1734
+ thumbnail: string;
1735
+ type: 'album' | 'playlist';
1736
+ source: TrackSource;
1737
+ author: {
1738
+ name: string;
1739
+ url: string;
1740
+ };
1741
+ id: string;
1742
+ url: string;
1743
+ rawPlaylist?: any;
1744
+ }
1745
+ /**
1746
+ * @typedef {object} TrackJSON
1747
+ * @property {string} title The track title
1748
+ * @property {string} description The track description
1749
+ * @property {string} author The author
1750
+ * @property {string} url The url
1751
+ * @property {string} thumbnail The thumbnail
1752
+ * @property {string} duration The duration
1753
+ * @property {number} durationMS The duration in ms
1754
+ * @property {number} views The views count
1755
+ * @property {Snowflake} requestedBy The id of the user who requested this track
1756
+ * @property {PlaylistJSON} [playlist] The playlist info (if any)
1757
+ */
1758
+ interface TrackJSON {
1759
+ id: Snowflake;
1760
+ title: string;
1761
+ description: string;
1762
+ author: string;
1763
+ url: string;
1764
+ thumbnail: string;
1765
+ duration: string;
1766
+ durationMS: number;
1767
+ views: number;
1768
+ requestedBy: Snowflake;
1769
+ playlist?: PlaylistJSON;
1770
+ }
1771
+ /**
1772
+ * @typedef {object} PlaylistJSON
1773
+ * @property {string} id The playlist id
1774
+ * @property {string} url The playlist url
1775
+ * @property {string} title The playlist title
1776
+ * @property {string} description The playlist description
1777
+ * @property {string} thumbnail The thumbnail
1778
+ * @property {album|playlist} type The playlist type: `album` | `playlist`
1779
+ * @property {TrackSource} source The track source
1780
+ * @property {object} author The playlist author
1781
+ * @property {string} [author.name] The author name
1782
+ * @property {string} [author.url] The author url
1783
+ * @property {TrackJSON[]} tracks The tracks data (if any)
1784
+ */
1785
+ interface PlaylistJSON {
1786
+ id: string;
1787
+ url: string;
1788
+ title: string;
1789
+ description: string;
1790
+ thumbnail: string;
1791
+ type: 'album' | 'playlist';
1792
+ source: TrackSource;
1793
+ author: {
1794
+ name: string;
1795
+ url: string;
1796
+ };
1797
+ tracks: TrackJSON[];
1798
+ }
1799
+ /**
1800
+ * @typedef {object} PlayerInitOptions
1801
+ * @property {boolean} [autoRegisterExtractor=true] If it should automatically register `@discord-player/extractor`
1802
+ * @property {YTDLDownloadOptions} [ytdlOptions] The options passed to `ytdl-core`
1803
+ * @property {number} [connectionTimeout=20000] The voice connection timeout
1804
+ * @property {boolean} [smoothVolume=true] Toggle smooth volume transition
1805
+ * @property {boolean} [lagMonitor=30000] Time in ms to re-monitor event loop lag
1806
+ * @property {boolean} [lockVoiceStateHandler] Prevent voice state handler from being overridden
1807
+ * @property {string[]} [blockExtractors] List of extractors to disable querying metadata from
1808
+ * @property {string[]} [blockStreamFrom] List of extractors to disable streaming from
1809
+ * @property {QueryCache | null} [queryCache] Query cache provider
1810
+ * @property {boolean} [ignoreInstance] Ignore player instance
1811
+ */
1812
+ interface PlayerInitOptions {
1813
+ autoRegisterExtractor?: boolean;
1814
+ ytdlOptions?: downloadOptions;
1815
+ connectionTimeout?: number;
1816
+ smoothVolume?: boolean;
1817
+ lagMonitor?: number;
1818
+ lockVoiceStateHandler?: boolean;
1819
+ blockExtractors?: string[];
1820
+ blockStreamFrom?: string[];
1821
+ queryCache?: QueryCache | null;
1822
+ ignoreInstance?: boolean;
1361
1823
  }
1362
1824
 
1363
- type FiltersName = keyof QueueFilters;
1364
- interface PlayerSearchResult {
1365
- playlist: Playlist | null;
1366
- tracks: Track[];
1367
- }
1368
- /**
1369
- * @typedef {AudioFilters} QueueFilters
1370
- */
1371
- interface QueueFilters {
1372
- bassboost_low?: boolean;
1373
- bassboost?: boolean;
1374
- bassboost_high?: boolean;
1375
- '8D'?: boolean;
1376
- vaporwave?: boolean;
1377
- nightcore?: boolean;
1378
- phaser?: boolean;
1379
- tremolo?: boolean;
1380
- vibrato?: boolean;
1381
- reverse?: boolean;
1382
- treble?: boolean;
1383
- normalizer?: boolean;
1384
- normalizer2?: boolean;
1385
- surrounding?: boolean;
1386
- pulsator?: boolean;
1387
- subboost?: boolean;
1388
- karaoke?: boolean;
1389
- flanger?: boolean;
1390
- gate?: boolean;
1391
- haas?: boolean;
1392
- mcompand?: boolean;
1393
- mono?: boolean;
1394
- mstlr?: boolean;
1395
- mstrr?: boolean;
1396
- compressor?: boolean;
1397
- expander?: boolean;
1398
- softlimiter?: boolean;
1399
- chorus?: boolean;
1400
- chorus2d?: boolean;
1401
- chorus3d?: boolean;
1402
- fadein?: boolean;
1403
- dim?: boolean;
1404
- earrape?: boolean;
1405
- lofi?: boolean;
1406
- }
1407
- /**
1408
- * The track source:
1409
- * - soundcloud
1410
- * - youtube
1411
- * - spotify
1412
- * - apple_music
1413
- * - arbitrary
1414
- * @typedef {string} TrackSource
1415
- */
1416
- type TrackSource = 'soundcloud' | 'youtube' | 'spotify' | 'apple_music' | 'arbitrary';
1417
- /**
1418
- * @typedef {object} RawTrackData
1419
- * @property {string} title The title
1420
- * @property {string} description The description
1421
- * @property {string} author The author
1422
- * @property {string} url The url
1423
- * @property {string} thumbnail The thumbnail
1424
- * @property {string} duration The duration
1425
- * @property {number} views The views
1426
- * @property {User} requestedBy The user who requested this track
1427
- * @property {Playlist} [playlist] The playlist
1428
- * @property {TrackSource} [source="arbitrary"] The source
1429
- * @property {any} [engine] The engine
1430
- * @property {boolean} [live] If this track is live
1431
- * @property {any} [raw] The raw data
1432
- */
1433
- interface RawTrackData {
1434
- title: string;
1435
- description: string;
1436
- author: string;
1437
- url: string;
1438
- thumbnail: string;
1439
- duration: string;
1440
- views: number;
1441
- requestedBy?: User | null;
1442
- playlist?: Playlist;
1443
- source?: TrackSource;
1444
- engine?: any;
1445
- live?: boolean;
1446
- raw?: any;
1447
- queryType?: SearchQueryType;
1448
- }
1449
- /**
1450
- * @typedef {object} TimeData
1451
- * @property {number} days Time in days
1452
- * @property {number} hours Time in hours
1453
- * @property {number} minutes Time in minutes
1454
- * @property {number} seconds Time in seconds
1455
- */
1456
- interface TimeData {
1457
- days: number;
1458
- hours: number;
1459
- minutes: number;
1460
- seconds: number;
1461
- }
1462
- /**
1463
- * @typedef {object} PlayerProgressbarOptions
1464
- * @property {boolean} [timecodes] If it should render time codes
1465
- * @property {boolean} [queue] If it should create progress bar for the whole queue
1466
- * @property {number} [length] The bar length
1467
- * @property {string} [line] The bar track
1468
- * @property {string} [indicator] The indicator
1469
- */
1470
- interface PlayerProgressbarOptions {
1471
- timecodes?: boolean;
1472
- length?: number;
1473
- line?: string;
1474
- indicator?: string;
1475
- queue?: boolean;
1476
- }
1477
- /**
1478
- * The search query type
1479
- * This can be one of:
1480
- * - AUTO
1481
- * - YOUTUBE
1482
- * - YOUTUBE_PLAYLIST
1483
- * - SOUNDCLOUD_TRACK
1484
- * - SOUNDCLOUD_PLAYLIST
1485
- * - SOUNDCLOUD
1486
- * - SPOTIFY_SONG
1487
- * - SPOTIFY_ALBUM
1488
- * - SPOTIFY_PLAYLIST
1489
- * - FACEBOOK
1490
- * - VIMEO
1491
- * - ARBITRARY
1492
- * - REVERBNATION
1493
- * - YOUTUBE_SEARCH
1494
- * - YOUTUBE_VIDEO
1495
- * - SOUNDCLOUD_SEARCH
1496
- * - APPLE_MUSIC_SONG
1497
- * - APPLE_MUSIC_ALBUM
1498
- * - APPLE_MUSIC_PLAYLIST
1499
- * - FILE
1500
- * @typedef {number} QueryType
1501
- */
1502
- declare const QueryType: {
1503
- readonly AUTO: "auto";
1504
- readonly YOUTUBE: "youtube";
1505
- readonly YOUTUBE_PLAYLIST: "youtubePlaylist";
1506
- readonly SOUNDCLOUD_TRACK: "soundcloudTrack";
1507
- readonly SOUNDCLOUD_PLAYLIST: "soundcloudPlaylist";
1508
- readonly SOUNDCLOUD: "soundcloud";
1509
- readonly SPOTIFY_SONG: "spotifySong";
1510
- readonly SPOTIFY_ALBUM: "spotifyAlbum";
1511
- readonly SPOTIFY_PLAYLIST: "spotifyPlaylist";
1512
- readonly FACEBOOK: "facebook";
1513
- readonly VIMEO: "vimeo";
1514
- readonly ARBITRARY: "arbitrary";
1515
- readonly REVERBNATION: "reverbnation";
1516
- readonly YOUTUBE_SEARCH: "youtubeSearch";
1517
- readonly YOUTUBE_VIDEO: "youtubeVideo";
1518
- readonly SOUNDCLOUD_SEARCH: "soundcloudSearch";
1519
- readonly APPLE_MUSIC_SONG: "appleMusicSong";
1520
- readonly APPLE_MUSIC_ALBUM: "appleMusicAlbum";
1521
- readonly APPLE_MUSIC_PLAYLIST: "appleMusicPlaylist";
1522
- readonly FILE: "file";
1523
- };
1524
- type SearchQueryType = keyof typeof QueryType | (typeof QueryType)[keyof typeof QueryType];
1525
- interface PlayerEvents {
1526
- debug: (message: string) => any;
1527
- error: (error: Error) => any;
1528
- voiceStateUpdate: (queue: GuildQueue, oldState: VoiceState, newState: VoiceState) => any;
1529
- }
1530
- /**
1531
- * @typedef {object} PlayOptions
1532
- * @property {boolean} [filtersUpdate=false] If this play was triggered for filters update
1533
- * @property {string[]} [encoderArgs=[]] FFmpeg args passed to encoder
1534
- * @property {number} [seek] Time to seek to before playing
1535
- * @property {boolean} [immediate=false] If it should start playing the provided track immediately
1536
- */
1537
- interface PlayOptions {
1538
- filtersUpdate?: boolean;
1539
- encoderArgs?: string[];
1540
- seek?: number;
1541
- immediate?: boolean;
1542
- }
1543
- type QueryExtractorSearch = `ext:${string}`;
1544
- /**
1545
- * @typedef {object} SearchOptions
1546
- * @property {UserResolvable} requestedBy The user who requested this search
1547
- * @property {typeof QueryType|string} [searchEngine=QueryType.AUTO] The query search engine, can be extractor name to target specific one (custom)
1548
- * @property {string[]} [blockExtractors[]] List of the extractors to block
1549
- * @property {boolean} [ignoreCache] If it should ignore query cache lookup
1550
- */
1551
- interface SearchOptions {
1552
- requestedBy?: UserResolvable;
1553
- searchEngine?: SearchQueryType | QueryExtractorSearch;
1554
- blockExtractors?: string[];
1555
- ignoreCache?: boolean;
1556
- }
1557
- /**
1558
- * The queue repeat mode. This can be one of:
1559
- * - OFF
1560
- * - TRACK
1561
- * - QUEUE
1562
- * - AUTOPLAY
1563
- * @typedef {number} QueueRepeatMode
1564
- */
1565
- declare enum QueueRepeatMode {
1566
- OFF = 0,
1567
- TRACK = 1,
1568
- QUEUE = 2,
1569
- AUTOPLAY = 3
1570
- }
1571
- /**
1572
- * @typedef {object} PlaylistInitData
1573
- * @property {Track[]} tracks The tracks of this playlist
1574
- * @property {string} title The playlist title
1575
- * @property {string} description The description
1576
- * @property {string} thumbnail The thumbnail
1577
- * @property {album|playlist} type The playlist type: `album` | `playlist`
1578
- * @property {TrackSource} source The playlist source
1579
- * @property {object} author The playlist author
1580
- * @property {string} [author.name] The author name
1581
- * @property {string} [author.url] The author url
1582
- * @property {string} id The playlist id
1583
- * @property {string} url The playlist url
1584
- * @property {any} [rawPlaylist] The raw playlist data
1585
- */
1586
- interface PlaylistInitData {
1587
- tracks: Track[];
1588
- title: string;
1589
- description: string;
1590
- thumbnail: string;
1591
- type: 'album' | 'playlist';
1592
- source: TrackSource;
1593
- author: {
1594
- name: string;
1595
- url: string;
1596
- };
1597
- id: string;
1598
- url: string;
1599
- rawPlaylist?: any;
1600
- }
1601
- /**
1602
- * @typedef {object} TrackJSON
1603
- * @property {string} title The track title
1604
- * @property {string} description The track description
1605
- * @property {string} author The author
1606
- * @property {string} url The url
1607
- * @property {string} thumbnail The thumbnail
1608
- * @property {string} duration The duration
1609
- * @property {number} durationMS The duration in ms
1610
- * @property {number} views The views count
1611
- * @property {Snowflake} requestedBy The id of the user who requested this track
1612
- * @property {PlaylistJSON} [playlist] The playlist info (if any)
1613
- */
1614
- interface TrackJSON {
1615
- id: Snowflake;
1616
- title: string;
1617
- description: string;
1618
- author: string;
1619
- url: string;
1620
- thumbnail: string;
1621
- duration: string;
1622
- durationMS: number;
1623
- views: number;
1624
- requestedBy: Snowflake;
1625
- playlist?: PlaylistJSON;
1626
- }
1627
- /**
1628
- * @typedef {object} PlaylistJSON
1629
- * @property {string} id The playlist id
1630
- * @property {string} url The playlist url
1631
- * @property {string} title The playlist title
1632
- * @property {string} description The playlist description
1633
- * @property {string} thumbnail The thumbnail
1634
- * @property {album|playlist} type The playlist type: `album` | `playlist`
1635
- * @property {TrackSource} source The track source
1636
- * @property {object} author The playlist author
1637
- * @property {string} [author.name] The author name
1638
- * @property {string} [author.url] The author url
1639
- * @property {TrackJSON[]} tracks The tracks data (if any)
1640
- */
1641
- interface PlaylistJSON {
1642
- id: string;
1643
- url: string;
1644
- title: string;
1645
- description: string;
1646
- thumbnail: string;
1647
- type: 'album' | 'playlist';
1648
- source: TrackSource;
1649
- author: {
1650
- name: string;
1651
- url: string;
1652
- };
1653
- tracks: TrackJSON[];
1654
- }
1655
- /**
1656
- * @typedef {object} PlayerInitOptions
1657
- * @property {boolean} [autoRegisterExtractor=true] If it should automatically register `@discord-player/extractor`
1658
- * @property {YTDLDownloadOptions} [ytdlOptions] The options passed to `ytdl-core`
1659
- * @property {number} [connectionTimeout=20000] The voice connection timeout
1660
- * @property {boolean} [smoothVolume=true] Toggle smooth volume transition
1661
- * @property {boolean} [lagMonitor=30000] Time in ms to re-monitor event loop lag
1662
- * @property {boolean} [lockVoiceStateHandler] Prevent voice state handler from being overridden
1663
- * @property {string[]} [blockExtractors] List of extractors to disable querying metadata from
1664
- * @property {string[]} [blockStreamFrom] List of extractors to disable streaming from
1665
- * @property {QueryCache | null} [queryCache] Query cache provider
1666
- */
1667
- interface PlayerInitOptions {
1668
- autoRegisterExtractor?: boolean;
1669
- ytdlOptions?: downloadOptions;
1670
- connectionTimeout?: number;
1671
- smoothVolume?: boolean;
1672
- lagMonitor?: number;
1673
- lockVoiceStateHandler?: boolean;
1674
- blockExtractors?: string[];
1675
- blockStreamFrom?: string[];
1676
- queryCache?: QueryCache | null;
1825
+ declare class AudioFilters {
1826
+ constructor();
1827
+ static filters: Record<FiltersName, string>;
1828
+ static get<K extends FiltersName>(name: K): Record<keyof QueueFilters, string>[K];
1829
+ static has<K extends FiltersName>(name: K): boolean;
1830
+ static [Symbol.iterator](): IterableIterator<{
1831
+ name: FiltersName;
1832
+ value: string;
1833
+ }>;
1834
+ static get names(): (keyof QueueFilters)[];
1835
+ static get length(): number;
1836
+ static toString(): string;
1837
+ /**
1838
+ * Create ffmpeg args from the specified filters name
1839
+ * @param filter The filter name
1840
+ * @returns
1841
+ */
1842
+ static create<K extends FiltersName>(filters?: K[]): string;
1843
+ /**
1844
+ * Defines audio filter
1845
+ * @param filterName The name of the filter
1846
+ * @param value The ffmpeg args
1847
+ */
1848
+ static define(filterName: string, value: string): void;
1849
+ /**
1850
+ * Defines multiple audio filters
1851
+ * @param filtersArray Array of filters containing the filter name and ffmpeg args
1852
+ */
1853
+ static defineBulk(filtersArray: {
1854
+ name: string;
1855
+ value: string;
1856
+ }[]): void;
1677
1857
  }
1678
1858
 
1679
- declare class AudioFilters {
1680
- constructor();
1681
- static filters: Record<FiltersName, string>;
1682
- static get<K extends FiltersName>(name: K): Record<keyof QueueFilters, string>[K];
1683
- static has<K extends FiltersName>(name: K): boolean;
1684
- static [Symbol.iterator](): IterableIterator<{
1685
- name: FiltersName;
1686
- value: string;
1687
- }>;
1688
- static get names(): (keyof QueueFilters)[];
1689
- static get length(): number;
1690
- static toString(): string;
1691
- /**
1692
- * Create ffmpeg args from the specified filters name
1693
- * @param filter The filter name
1694
- * @returns
1695
- */
1696
- static create<K extends FiltersName>(filters?: K[]): string;
1697
- /**
1698
- * Defines audio filter
1699
- * @param filterName The name of the filter
1700
- * @param value The ffmpeg args
1701
- */
1702
- static define(filterName: string, value: string): void;
1703
- /**
1704
- * Defines multiple audio filters
1705
- * @param filtersArray Array of filters containing the filter name and ffmpeg args
1706
- */
1707
- static defineBulk(filtersArray: {
1708
- name: string;
1709
- value: string;
1710
- }[]): void;
1859
+ declare class Util {
1860
+ /**
1861
+ * Utils
1862
+ */
1863
+ private constructor();
1864
+ /**
1865
+ * Creates duration string
1866
+ * @param {object} durObj The duration object
1867
+ * @returns {string}
1868
+ */
1869
+ static durationString(durObj: Record<string, number>): string;
1870
+ /**
1871
+ * Parses milliseconds to consumable time object
1872
+ * @param {number} milliseconds The time in ms
1873
+ * @returns {TimeData}
1874
+ */
1875
+ static parseMS(milliseconds: number): TimeData;
1876
+ /**
1877
+ * Builds time code
1878
+ * @param {TimeData} duration The duration object
1879
+ * @returns {string}
1880
+ */
1881
+ static buildTimeCode(duration: TimeData): string;
1882
+ /**
1883
+ * Picks last item of the given array
1884
+ * @param {any[]} arr The array
1885
+ * @returns {any}
1886
+ */
1887
+ static last<T = any>(arr: T[]): T;
1888
+ /**
1889
+ * Checks if the voice channel is empty
1890
+ * @param {VoiceChannel|StageChannel} channel The voice channel
1891
+ * @returns {boolean}
1892
+ */
1893
+ static isVoiceEmpty(channel: VoiceChannel | StageChannel): boolean;
1894
+ /**
1895
+ * Safer require
1896
+ * @param {string} id Node require id
1897
+ * @returns {any}
1898
+ */
1899
+ static require(id: string): {
1900
+ module: any;
1901
+ error: null;
1902
+ } | {
1903
+ module: null;
1904
+ error: unknown;
1905
+ };
1906
+ static import(id: string): Promise<{
1907
+ module: any;
1908
+ error: null;
1909
+ } | {
1910
+ module: null;
1911
+ error: unknown;
1912
+ }>;
1913
+ /**
1914
+ * Asynchronous timeout
1915
+ * @param {number} time The time in ms to wait
1916
+ * @returns {Promise<unknown>}
1917
+ */
1918
+ static wait(time: number): Promise<undefined>;
1919
+ static noop(): void;
1920
+ static getFetch(): Promise<any>;
1921
+ static warn(message: string, code?: string, detail?: string): void;
1922
+ static randomChoice<T>(src: T[]): T;
1711
1923
  }
1712
1924
 
1713
- declare class Util {
1714
- /**
1715
- * Utils
1716
- */
1717
- private constructor();
1718
- /**
1719
- * Creates duration string
1720
- * @param {object} durObj The duration object
1721
- * @returns {string}
1722
- */
1723
- static durationString(durObj: Record<string, number>): string;
1724
- /**
1725
- * Parses milliseconds to consumable time object
1726
- * @param {number} milliseconds The time in ms
1727
- * @returns {TimeData}
1728
- */
1729
- static parseMS(milliseconds: number): TimeData;
1730
- /**
1731
- * Builds time code
1732
- * @param {TimeData} duration The duration object
1733
- * @returns {string}
1734
- */
1735
- static buildTimeCode(duration: TimeData): string;
1736
- /**
1737
- * Picks last item of the given array
1738
- * @param {any[]} arr The array
1739
- * @returns {any}
1740
- */
1741
- static last<T = any>(arr: T[]): T;
1742
- /**
1743
- * Checks if the voice channel is empty
1744
- * @param {VoiceChannel|StageChannel} channel The voice channel
1745
- * @returns {boolean}
1746
- */
1747
- static isVoiceEmpty(channel: VoiceChannel | StageChannel): boolean;
1748
- /**
1749
- * Safer require
1750
- * @param {string} id Node require id
1751
- * @returns {any}
1752
- */
1753
- static require(id: string): {
1754
- module: any;
1755
- error: null;
1756
- } | {
1757
- module: null;
1758
- error: unknown;
1759
- };
1760
- static import(id: string): Promise<{
1761
- module: any;
1762
- error: null;
1763
- } | {
1764
- module: null;
1765
- error: unknown;
1766
- }>;
1767
- /**
1768
- * Asynchronous timeout
1769
- * @param {number} time The time in ms to wait
1770
- * @returns {Promise<unknown>}
1771
- */
1772
- static wait(time: number): Promise<undefined>;
1773
- static noop(): void;
1774
- static getFetch(): Promise<any>;
1775
- static warn(message: string, code?: string, detail?: string): void;
1925
+ declare class QueryResolver {
1926
+ /**
1927
+ * Query resolver
1928
+ */
1929
+ private constructor();
1930
+ static get regex(): {
1931
+ spotifyAlbumRegex: RegExp;
1932
+ spotifyPlaylistRegex: RegExp;
1933
+ spotifySongRegex: RegExp;
1934
+ vimeoRegex: RegExp;
1935
+ reverbnationRegex: RegExp;
1936
+ attachmentRegex: RegExp;
1937
+ appleMusicAlbumRegex: RegExp;
1938
+ appleMusicPlaylistRegex: RegExp;
1939
+ appleMusicSongRegex: RegExp;
1940
+ };
1941
+ /**
1942
+ * Resolves the given search query
1943
+ * @param {string} query The query
1944
+ * @returns {QueryType}
1945
+ */
1946
+ static resolve(query: string): (typeof QueryType)[keyof typeof QueryType];
1947
+ /**
1948
+ * Parses vimeo id from url
1949
+ * @param {string} query The query
1950
+ * @returns {string}
1951
+ */
1952
+ static getVimeoID(query: string): string | null | undefined;
1953
+ static validateId(q: string): boolean;
1954
+ static validateURL(q: string): boolean;
1776
1955
  }
1777
1956
 
1957
+ declare function useHistory<Meta = unknown>(node: NodeResolvable): GuildQueueHistory<Meta> | null;
1958
+
1959
+ declare function usePlayer<Meta = unknown>(node: NodeResolvable): GuildQueuePlayerNode<Meta> | null;
1960
+
1961
+ declare function useQueue<Meta = unknown>(node: NodeResolvable): GuildQueue<Meta> | null;
1962
+
1963
+ declare function useMasterPlayer(): Player | null;
1964
+
1778
1965
  declare const version: string;
1779
1966
 
1780
- export { AFilterGraph, AudioFilters, BaseExtractor, DiscordPlayerQueryResultCache, EqualizerConfigurationPreset, ErrorStatusCode, ExtractorExecutionContext, ExtractorExecutionFN, ExtractorExecutionResult, ExtractorInfo, ExtractorSearchContext, FFMPEG_ARGS_PIPED, FFMPEG_ARGS_STRING, FFMPEG_SRATE_REGEX, FFmpegFilterer, FFmpegStreamOptions, FilterGraph, FiltersName, GuildNodeCreateOptions, GuildNodeInit, GuildNodeManager, GuildQueue, GuildQueueAFiltersCache, GuildQueueAudioFilters, GuildQueueEvents, GuildQueueHistory, GuildQueuePlayerNode, NextFunction, NodeResolvable, OnAfterCreateStreamHandler, OnBeforeCreateStreamHandler, PlayOptions, Player, PlayerError, PlayerEvents, PlayerEventsEmitter, PlayerInitOptions, PlayerProgressbarOptions, PlayerSearchResult, PlayerTimestamp, PlayerTriggeredReason, Playlist, PlaylistInitData, PlaylistJSON, PostProcessedResult, QueryCache, QueryCacheOptions, QueryCacheResolverContext, QueryExtractorSearch, QueryType, QueueFilters, QueueRepeatMode, RawTrackData, RawTrackInit, ResourcePlayOptions, SearchOptions, SearchQueryType, SearchResult, SearchResultData, StreamDispatcher, TimeData, Track, TrackJSON, TrackResolvable, TrackSource, Util, VoiceConnectConfig, VoiceEvents, VoiceReceiverNode, VoiceReceiverOptions, VoiceUtils, createFFmpegStream, version };
1967
+ export { AFilterGraph, AudioFilters, BaseExtractor, DiscordPlayerQueryResultCache, EqualizerConfigurationPreset, ErrorStatusCode, ExtractorExecutionContext, 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, NextFunction, NodeResolvable, OnAfterCreateStreamHandler, OnBeforeCreateStreamHandler, PlayOptions, Player, PlayerError, PlayerEvent, PlayerEvents, PlayerEventsEmitter, PlayerInitOptions, PlayerProgressbarOptions, PlayerSearchResult, PlayerTimestamp, PlayerTriggeredReason, Playlist, PlaylistInitData, PlaylistJSON, PostProcessedResult, QueryCache, QueryCacheOptions, QueryCacheResolverContext, QueryExtractorSearch, QueryResolver, QueryType, QueueFilters, QueueRepeatMode, RawTrackData, RawTrackInit, ResourcePlayOptions, SearchOptions, SearchQueryType, SearchResult, SearchResultData, StreamDispatcher, TimeData, Track, TrackJSON, TrackResolvable, TrackSource, Util, VoiceConnectConfig, VoiceEvents, VoiceReceiverNode, VoiceReceiverOptions, VoiceUtils, createFFmpegStream, useHistory, useMasterPlayer, usePlayer, useQueue, version };