discord-player 6.0.0-dev.5 → 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/README.md +75 -297
- package/dist/index.d.ts +1901 -1823
- package/dist/index.js +144 -30
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +143 -31
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -10,1872 +10,1948 @@ export { AF_NIGHTCORE_RATE, AF_VAPORWAVE_RATE, BASS_EQ_BANDS, FilterType as Biqu
|
|
|
10
10
|
import { RequestOptions } from 'http';
|
|
11
11
|
import { downloadOptions } from 'ytdl-core';
|
|
12
12
|
|
|
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;
|
|
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;
|
|
17
17
|
}
|
|
18
18
|
|
|
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;
|
|
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;
|
|
55
55
|
}
|
|
56
56
|
|
|
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
|
-
}
|
|
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
|
+
}
|
|
80
80
|
type ExtractorExecutionFN<T = unknown> = (extractor: BaseExtractor) => Promise<T | boolean>;
|
|
81
81
|
|
|
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;
|
|
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;
|
|
153
153
|
}
|
|
154
154
|
|
|
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;
|
|
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;
|
|
203
203
|
}
|
|
204
204
|
|
|
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;
|
|
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;
|
|
347
347
|
}
|
|
348
348
|
|
|
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;
|
|
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;
|
|
371
371
|
}
|
|
372
372
|
|
|
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>;
|
|
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>;
|
|
423
423
|
}
|
|
424
424
|
|
|
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>;
|
|
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>;
|
|
574
574
|
}
|
|
575
575
|
|
|
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
|
-
*/
|
|
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
|
+
*/
|
|
590
590
|
declare function createFFmpegStream(stream: Readable | Duplex | string, options?: FFmpegStreamOptions): Readable;
|
|
591
591
|
|
|
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;
|
|
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;
|
|
756
756
|
}
|
|
757
757
|
|
|
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
|
-
|
|
795
|
-
/**
|
|
796
|
-
* Emitted when audio track is added to the queue
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
*
|
|
805
|
-
*/
|
|
806
|
-
|
|
807
|
-
/**
|
|
808
|
-
* Emitted when audio
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
*
|
|
817
|
-
*/
|
|
818
|
-
|
|
819
|
-
/**
|
|
820
|
-
* Emitted when a
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
*
|
|
833
|
-
*/
|
|
834
|
-
|
|
835
|
-
/**
|
|
836
|
-
* Emitted when the
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
*
|
|
849
|
-
*/
|
|
850
|
-
|
|
851
|
-
/**
|
|
852
|
-
* Emitted when the audio player
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
*
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
*
|
|
920
|
-
* @param
|
|
921
|
-
*/
|
|
922
|
-
|
|
923
|
-
/**
|
|
924
|
-
*
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
*
|
|
940
|
-
*/
|
|
941
|
-
|
|
942
|
-
/**
|
|
943
|
-
*
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
*
|
|
953
|
-
*/
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
/**
|
|
973
|
-
*
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
*
|
|
987
|
-
*/
|
|
988
|
-
|
|
989
|
-
/**
|
|
990
|
-
*
|
|
991
|
-
*/
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
*
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
*
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
*
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
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>;
|
|
1048
1114
|
}
|
|
1049
1115
|
|
|
1050
|
-
interface GuildQueueStatisticsMetadata {
|
|
1051
|
-
latency: {
|
|
1052
|
-
eventLoop: number;
|
|
1053
|
-
voiceConnection: number;
|
|
1054
|
-
};
|
|
1055
|
-
status: {
|
|
1056
|
-
buffering: boolean;
|
|
1057
|
-
playing: boolean;
|
|
1058
|
-
paused: boolean;
|
|
1059
|
-
idle: boolean;
|
|
1060
|
-
};
|
|
1061
|
-
tracksCount: number;
|
|
1062
|
-
historySize: number;
|
|
1063
|
-
extractors: number;
|
|
1064
|
-
listeners: number;
|
|
1065
|
-
memoryUsage: NodeJS.MemoryUsage;
|
|
1066
|
-
versions: {
|
|
1067
|
-
node: string;
|
|
1068
|
-
player: string;
|
|
1069
|
-
};
|
|
1070
|
-
}
|
|
1071
|
-
declare class GuildQueueStatistics<Meta = unknown> {
|
|
1072
|
-
queue: GuildQueue<Meta>;
|
|
1073
|
-
constructor(queue: GuildQueue<Meta>);
|
|
1074
|
-
/**
|
|
1075
|
-
* Generate statistics of this queue
|
|
1076
|
-
*/
|
|
1077
|
-
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;
|
|
1078
1144
|
}
|
|
1079
1145
|
|
|
1080
|
-
declare class VoiceUtils {
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
*
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
*
|
|
1090
|
-
* @param {
|
|
1091
|
-
* @
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
*
|
|
1101
|
-
* @param {
|
|
1102
|
-
* @
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
*
|
|
1111
|
-
* @
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
*
|
|
1117
|
-
* @
|
|
1118
|
-
|
|
1119
|
-
|
|
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;
|
|
1120
1187
|
}
|
|
1121
1188
|
|
|
1122
|
-
interface SearchResultData {
|
|
1123
|
-
query: string;
|
|
1124
|
-
queryType?: SearchQueryType | QueryExtractorSearch | null;
|
|
1125
|
-
extractor?: BaseExtractor | null;
|
|
1126
|
-
playlist?: Playlist | null;
|
|
1127
|
-
tracks?: Track[];
|
|
1128
|
-
requestedBy?: User | null;
|
|
1129
|
-
}
|
|
1130
|
-
declare class SearchResult {
|
|
1131
|
-
player: Player;
|
|
1132
|
-
private _data;
|
|
1133
|
-
constructor(player: Player, _data: SearchResultData);
|
|
1134
|
-
setQueryType(type: SearchQueryType | QueryExtractorSearch): this;
|
|
1135
|
-
setRequestedBy(user: User): this;
|
|
1136
|
-
setExtractor(extractor: BaseExtractor): this;
|
|
1137
|
-
setTracks(tracks: Track[]): this;
|
|
1138
|
-
setQuery(query: string): this;
|
|
1139
|
-
setPlaylist(playlist: Playlist): this;
|
|
1140
|
-
/**
|
|
1141
|
-
* The search query
|
|
1142
|
-
*/
|
|
1143
|
-
get query(): string;
|
|
1144
|
-
/**
|
|
1145
|
-
* The search query type
|
|
1146
|
-
*/
|
|
1147
|
-
get queryType(): SearchQueryType | `ext:${string}`;
|
|
1148
|
-
/**
|
|
1149
|
-
* The extractor
|
|
1150
|
-
*/
|
|
1151
|
-
get extractor(): BaseExtractor | null;
|
|
1152
|
-
/**
|
|
1153
|
-
* Playlist result
|
|
1154
|
-
*/
|
|
1155
|
-
get playlist(): Playlist | null | undefined;
|
|
1156
|
-
/**
|
|
1157
|
-
* Tracks result
|
|
1158
|
-
*/
|
|
1159
|
-
get tracks(): Track[];
|
|
1160
|
-
/**
|
|
1161
|
-
* Requested by
|
|
1162
|
-
*/
|
|
1163
|
-
get requestedBy(): User | null;
|
|
1164
|
-
/**
|
|
1165
|
-
* Re-execute this search
|
|
1166
|
-
*/
|
|
1167
|
-
execute(): Promise<SearchResult>;
|
|
1168
|
-
/**
|
|
1169
|
-
* If this search result is empty
|
|
1170
|
-
*/
|
|
1171
|
-
isEmpty(): boolean;
|
|
1172
|
-
/**
|
|
1173
|
-
* If this search result has playlist
|
|
1174
|
-
*/
|
|
1175
|
-
hasPlaylist(): boolean;
|
|
1176
|
-
/**
|
|
1177
|
-
* If this search result has tracks
|
|
1178
|
-
*/
|
|
1179
|
-
hasTracks(): boolean;
|
|
1180
|
-
/**
|
|
1181
|
-
* JSON representation of this search
|
|
1182
|
-
*/
|
|
1183
|
-
toJSON(): {
|
|
1184
|
-
query: string;
|
|
1185
|
-
queryType: SearchQueryType | `ext:${string}`;
|
|
1186
|
-
playlist: PlaylistJSON | null;
|
|
1187
|
-
tracks: TrackJSON[];
|
|
1188
|
-
extractor: string | null;
|
|
1189
|
-
requestedBy: {} | null;
|
|
1190
|
-
};
|
|
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
|
+
};
|
|
1191
1258
|
}
|
|
1192
1259
|
|
|
1193
|
-
interface QueryCacheOptions {
|
|
1194
|
-
checkInterval?: number;
|
|
1195
|
-
}
|
|
1196
|
-
declare class QueryCache {
|
|
1197
|
-
#private;
|
|
1198
|
-
player: Player;
|
|
1199
|
-
options: QueryCacheOptions;
|
|
1200
|
-
timer: NodeJS.Timer;
|
|
1201
|
-
constructor(player: Player, options?: QueryCacheOptions);
|
|
1202
|
-
get checkInterval(): number;
|
|
1203
|
-
cleanup(): Promise<void>;
|
|
1204
|
-
clear(): Promise<void>;
|
|
1205
|
-
getData(): Promise<DiscordPlayerQueryResultCache<Track>[]>;
|
|
1206
|
-
addData(data: SearchResult): Promise<void>;
|
|
1207
|
-
resolve(context: QueryCacheResolverContext): Promise<SearchResult>;
|
|
1208
|
-
}
|
|
1209
|
-
declare class DiscordPlayerQueryResultCache<T = unknown> {
|
|
1210
|
-
data: T;
|
|
1211
|
-
expireAfter: number;
|
|
1212
|
-
constructor(data: T, expireAfter?: number);
|
|
1213
|
-
hasExpired(): boolean;
|
|
1214
|
-
}
|
|
1215
|
-
interface QueryCacheResolverContext {
|
|
1216
|
-
query: string;
|
|
1217
|
-
requestedBy?: User;
|
|
1218
|
-
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}`;
|
|
1219
1286
|
}
|
|
1220
1287
|
|
|
1221
|
-
declare class Player extends PlayerEventsEmitter<PlayerEvents> {
|
|
1222
|
-
#private;
|
|
1223
|
-
static _singletonKey: symbol;
|
|
1224
|
-
readonly id: string;
|
|
1225
|
-
readonly client: Client;
|
|
1226
|
-
readonly options: PlayerInitOptions;
|
|
1227
|
-
nodes: GuildNodeManager<unknown>;
|
|
1228
|
-
readonly voiceUtils: VoiceUtils;
|
|
1229
|
-
extractors: ExtractorExecutionContext;
|
|
1230
|
-
events: PlayerEventsEmitter<GuildQueueEvents<unknown>>;
|
|
1231
|
-
/**
|
|
1232
|
-
* Creates new Discord Player
|
|
1233
|
-
* @param {Client} client The Discord Client
|
|
1234
|
-
* @param {PlayerInitOptions} [options] The player init options
|
|
1235
|
-
*/
|
|
1236
|
-
constructor(client: Client, options?: PlayerInitOptions);
|
|
1237
|
-
debug(m: string): boolean;
|
|
1238
|
-
/**
|
|
1239
|
-
* Creates discord-player singleton instance.
|
|
1240
|
-
* @param client The client that instantiated player
|
|
1241
|
-
* @param options Player initializer options
|
|
1242
|
-
*/
|
|
1243
|
-
static singleton(client: Client, options?: PlayerInitOptions): Player;
|
|
1244
|
-
/**
|
|
1245
|
-
* Get all active player instances
|
|
1246
|
-
*/
|
|
1247
|
-
static getAllPlayers(): Player[];
|
|
1248
|
-
/**
|
|
1249
|
-
* Clear all player instances
|
|
1250
|
-
*/
|
|
1251
|
-
static clearAllPlayers(): void;
|
|
1252
|
-
/**
|
|
1253
|
-
* The current query cache provider
|
|
1254
|
-
*/
|
|
1255
|
-
get queryCache(): QueryCache | null;
|
|
1256
|
-
/**
|
|
1257
|
-
* Alias to `Player.nodes`
|
|
1258
|
-
*/
|
|
1259
|
-
get queues(): GuildNodeManager<unknown>;
|
|
1260
|
-
/**
|
|
1261
|
-
* Event loop lag
|
|
1262
|
-
* @type {number}
|
|
1263
|
-
*/
|
|
1264
|
-
get eventLoopLag(): number;
|
|
1265
|
-
/**
|
|
1266
|
-
* Generates statistics
|
|
1267
|
-
*/
|
|
1268
|
-
generateStatistics(): {
|
|
1269
|
-
instances: number;
|
|
1270
|
-
queuesCount: number;
|
|
1271
|
-
queryCacheEnabled: boolean;
|
|
1272
|
-
queues: GuildQueueStatisticsMetadata[];
|
|
1273
|
-
};
|
|
1274
|
-
/**
|
|
1275
|
-
* Destroy player
|
|
1276
|
-
*/
|
|
1277
|
-
destroy(): Promise<void>;
|
|
1278
|
-
private _handleVoiceState;
|
|
1279
|
-
/**
|
|
1280
|
-
* Handles voice state update
|
|
1281
|
-
* @param {VoiceState} oldState The old voice state
|
|
1282
|
-
* @param {VoiceState} newState The new voice state
|
|
1283
|
-
* @returns {void}
|
|
1284
|
-
*/
|
|
1285
|
-
handleVoiceState(oldState: VoiceState, newState: VoiceState): void;
|
|
1286
|
-
/**
|
|
1287
|
-
* Lock voice state handler
|
|
1288
|
-
*/
|
|
1289
|
-
lockVoiceStateHandler(): void;
|
|
1290
|
-
/**
|
|
1291
|
-
* Unlock voice state handler
|
|
1292
|
-
*/
|
|
1293
|
-
unlockVoiceStateHandler(): void;
|
|
1294
|
-
/**
|
|
1295
|
-
* Checks if voice state handler is locked
|
|
1296
|
-
*/
|
|
1297
|
-
isVoiceStateHandlerLocked(): boolean;
|
|
1298
|
-
/**
|
|
1299
|
-
* Initiate audio player
|
|
1300
|
-
* @param channel The voice channel on which the music should be played
|
|
1301
|
-
* @param query The track or source to play
|
|
1302
|
-
* @param options Options for player
|
|
1303
|
-
*/
|
|
1304
|
-
play<T = unknown>(channel: GuildVoiceChannelResolvable, query: string | Track | SearchResult, options?: SearchOptions & {
|
|
1305
|
-
nodeOptions?: GuildNodeCreateOptions<T>;
|
|
1306
|
-
connectionOptions?: VoiceConnectConfig;
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
* @
|
|
1316
|
-
* @property {
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
*
|
|
1321
|
-
* @param {
|
|
1322
|
-
* @
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
*
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
*
|
|
1334
|
-
|
|
1335
|
-
|
|
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;
|
|
1336
1404
|
}
|
|
1337
1405
|
|
|
1338
|
-
interface GuildNodeCreateOptions<T = unknown> {
|
|
1339
|
-
strategy?: QueueStrategy;
|
|
1340
|
-
volume?: number | boolean;
|
|
1341
|
-
equalizer?: EqualizerBand[] | boolean;
|
|
1342
|
-
a_filter?: PCMFilters[] | boolean;
|
|
1343
|
-
biquad?: BiquadFilters | boolean;
|
|
1344
|
-
resampler?: number | boolean;
|
|
1345
|
-
disableHistory?: boolean;
|
|
1346
|
-
skipOnNoStream?: boolean;
|
|
1347
|
-
onBeforeCreateStream?: OnBeforeCreateStreamHandler;
|
|
1348
|
-
onAfterCreateStream?: OnAfterCreateStreamHandler;
|
|
1349
|
-
repeatMode?: QueueRepeatMode;
|
|
1350
|
-
leaveOnEmpty?: boolean;
|
|
1351
|
-
leaveOnEmptyCooldown?: number;
|
|
1352
|
-
leaveOnEnd?: boolean;
|
|
1353
|
-
leaveOnEndCooldown?: number;
|
|
1354
|
-
leaveOnStop?: boolean;
|
|
1355
|
-
leaveOnStopCooldown?: number;
|
|
1356
|
-
metadata?: T | null;
|
|
1357
|
-
selfDeaf?: boolean;
|
|
1358
|
-
connectionTimeout?: number;
|
|
1359
|
-
defaultFFmpegFilters?: FiltersName[];
|
|
1360
|
-
bufferingTimeout?: number;
|
|
1361
|
-
}
|
|
1362
|
-
type NodeResolvable = GuildQueue | GuildResolvable;
|
|
1363
|
-
declare class GuildNodeManager<Meta = unknown> {
|
|
1364
|
-
player: Player;
|
|
1365
|
-
cache: Collection<string, GuildQueue<unknown>>;
|
|
1366
|
-
constructor(player: Player);
|
|
1367
|
-
/**
|
|
1368
|
-
* Create guild queue if it does not exist
|
|
1369
|
-
* @param guild The guild which will be the owner of the queue
|
|
1370
|
-
* @param options Queue initializer options
|
|
1371
|
-
*/
|
|
1372
|
-
create<T = Meta>(guild: GuildResolvable, options?: GuildNodeCreateOptions<T>): GuildQueue<T>;
|
|
1373
|
-
/**
|
|
1374
|
-
* Get existing queue
|
|
1375
|
-
* @param node Queue resolvable
|
|
1376
|
-
*/
|
|
1377
|
-
get<T = Meta>(node: NodeResolvable): GuildQueue<T> | null;
|
|
1378
|
-
/**
|
|
1379
|
-
* Check if a queue exists
|
|
1380
|
-
* @param node Queue resolvable
|
|
1381
|
-
*/
|
|
1382
|
-
has(node: NodeResolvable): boolean;
|
|
1383
|
-
/**
|
|
1384
|
-
* Delete queue
|
|
1385
|
-
* @param node Queue resolvable
|
|
1386
|
-
*/
|
|
1387
|
-
delete(node: NodeResolvable): boolean;
|
|
1388
|
-
/**
|
|
1389
|
-
* Resolve queue
|
|
1390
|
-
* @param node Queue resolvable
|
|
1391
|
-
*/
|
|
1392
|
-
resolve<T = Meta>(node: NodeResolvable): GuildQueue<unknown> | undefined;
|
|
1393
|
-
/**
|
|
1394
|
-
* Resolve queue id
|
|
1395
|
-
* @param node Queue resolvable
|
|
1396
|
-
*/
|
|
1397
|
-
resolveId(node: NodeResolvable): string | null;
|
|
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;
|
|
1398
1466
|
}
|
|
1399
1467
|
|
|
1400
|
-
declare enum ErrorStatusCode {
|
|
1401
|
-
STREAM_ERROR = "StreamError",
|
|
1402
|
-
AUDIO_PLAYER_ERROR = "AudioPlayerError",
|
|
1403
|
-
PLAYER_ERROR = "PlayerError",
|
|
1404
|
-
NO_AUDIO_RESOURCE = "NoAudioResource",
|
|
1405
|
-
UNKNOWN_GUILD = "UnknownGuild",
|
|
1406
|
-
INVALID_ARG_TYPE = "InvalidArgType",
|
|
1407
|
-
UNKNOWN_EXTRACTOR = "UnknownExtractor",
|
|
1408
|
-
INVALID_EXTRACTOR = "InvalidExtractor",
|
|
1409
|
-
INVALID_CHANNEL_TYPE = "InvalidChannelType",
|
|
1410
|
-
INVALID_TRACK = "InvalidTrack",
|
|
1411
|
-
UNKNOWN_REPEAT_MODE = "UnknownRepeatMode",
|
|
1412
|
-
TRACK_NOT_FOUND = "TrackNotFound",
|
|
1413
|
-
NO_CONNECTION = "NoConnection",
|
|
1414
|
-
DESTROYED_QUEUE = "DestroyedQueue"
|
|
1415
|
-
}
|
|
1416
|
-
declare class PlayerError extends Error {
|
|
1417
|
-
message: string;
|
|
1418
|
-
statusCode: ErrorStatusCode;
|
|
1419
|
-
createdAt: Date;
|
|
1420
|
-
constructor(message: string, code?: ErrorStatusCode);
|
|
1421
|
-
get createdTimestamp(): number;
|
|
1422
|
-
valueOf(): ErrorStatusCode;
|
|
1423
|
-
toJSON(): {
|
|
1424
|
-
stack: string | undefined;
|
|
1425
|
-
code: ErrorStatusCode;
|
|
1426
|
-
message: string;
|
|
1427
|
-
created: number;
|
|
1428
|
-
};
|
|
1429
|
-
toString(): string | undefined;
|
|
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;
|
|
1430
1498
|
}
|
|
1431
1499
|
|
|
1432
|
-
type FiltersName = keyof QueueFilters;
|
|
1433
|
-
interface PlayerSearchResult {
|
|
1434
|
-
playlist: Playlist | null;
|
|
1435
|
-
tracks: Track[];
|
|
1436
|
-
}
|
|
1437
|
-
/**
|
|
1438
|
-
* @typedef {AudioFilters} QueueFilters
|
|
1439
|
-
*/
|
|
1440
|
-
interface QueueFilters {
|
|
1441
|
-
bassboost_low?: boolean;
|
|
1442
|
-
bassboost?: boolean;
|
|
1443
|
-
bassboost_high?: boolean;
|
|
1444
|
-
'8D'?: boolean;
|
|
1445
|
-
vaporwave?: boolean;
|
|
1446
|
-
nightcore?: boolean;
|
|
1447
|
-
phaser?: boolean;
|
|
1448
|
-
tremolo?: boolean;
|
|
1449
|
-
vibrato?: boolean;
|
|
1450
|
-
reverse?: boolean;
|
|
1451
|
-
treble?: boolean;
|
|
1452
|
-
normalizer?: boolean;
|
|
1453
|
-
normalizer2?: boolean;
|
|
1454
|
-
surrounding?: boolean;
|
|
1455
|
-
pulsator?: boolean;
|
|
1456
|
-
subboost?: boolean;
|
|
1457
|
-
karaoke?: boolean;
|
|
1458
|
-
flanger?: boolean;
|
|
1459
|
-
gate?: boolean;
|
|
1460
|
-
haas?: boolean;
|
|
1461
|
-
mcompand?: boolean;
|
|
1462
|
-
mono?: boolean;
|
|
1463
|
-
mstlr?: boolean;
|
|
1464
|
-
mstrr?: boolean;
|
|
1465
|
-
compressor?: boolean;
|
|
1466
|
-
expander?: boolean;
|
|
1467
|
-
softlimiter?: boolean;
|
|
1468
|
-
chorus?: boolean;
|
|
1469
|
-
chorus2d?: boolean;
|
|
1470
|
-
chorus3d?: boolean;
|
|
1471
|
-
fadein?: boolean;
|
|
1472
|
-
dim?: boolean;
|
|
1473
|
-
earrape?: boolean;
|
|
1474
|
-
lofi?: boolean;
|
|
1475
|
-
}
|
|
1476
|
-
/**
|
|
1477
|
-
* The track source:
|
|
1478
|
-
* - soundcloud
|
|
1479
|
-
* - youtube
|
|
1480
|
-
* - spotify
|
|
1481
|
-
* - apple_music
|
|
1482
|
-
* - arbitrary
|
|
1483
|
-
* @typedef {string} TrackSource
|
|
1484
|
-
*/
|
|
1485
|
-
type TrackSource = 'soundcloud' | 'youtube' | 'spotify' | 'apple_music' | 'arbitrary';
|
|
1486
|
-
/**
|
|
1487
|
-
* @typedef {object} RawTrackData
|
|
1488
|
-
* @property {string} title The title
|
|
1489
|
-
* @property {string} description The description
|
|
1490
|
-
* @property {string} author The author
|
|
1491
|
-
* @property {string} url The url
|
|
1492
|
-
* @property {string} thumbnail The thumbnail
|
|
1493
|
-
* @property {string} duration The duration
|
|
1494
|
-
* @property {number} views The views
|
|
1495
|
-
* @property {User} requestedBy The user who requested this track
|
|
1496
|
-
* @property {Playlist} [playlist] The playlist
|
|
1497
|
-
* @property {TrackSource} [source="arbitrary"] The source
|
|
1498
|
-
* @property {any} [engine] The engine
|
|
1499
|
-
* @property {boolean} [live] If this track is live
|
|
1500
|
-
* @property {any} [raw] The raw data
|
|
1501
|
-
*/
|
|
1502
|
-
interface RawTrackData {
|
|
1503
|
-
title: string;
|
|
1504
|
-
description: string;
|
|
1505
|
-
author: string;
|
|
1506
|
-
url: string;
|
|
1507
|
-
thumbnail: string;
|
|
1508
|
-
duration: string;
|
|
1509
|
-
views: number;
|
|
1510
|
-
requestedBy?: User | null;
|
|
1511
|
-
playlist?: Playlist;
|
|
1512
|
-
source?: TrackSource;
|
|
1513
|
-
engine?: any;
|
|
1514
|
-
live?: boolean;
|
|
1515
|
-
raw?: any;
|
|
1516
|
-
queryType?: SearchQueryType;
|
|
1517
|
-
}
|
|
1518
|
-
/**
|
|
1519
|
-
* @typedef {object} TimeData
|
|
1520
|
-
* @property {number} days Time in days
|
|
1521
|
-
* @property {number} hours Time in hours
|
|
1522
|
-
* @property {number} minutes Time in minutes
|
|
1523
|
-
* @property {number} seconds Time in seconds
|
|
1524
|
-
*/
|
|
1525
|
-
interface TimeData {
|
|
1526
|
-
days: number;
|
|
1527
|
-
hours: number;
|
|
1528
|
-
minutes: number;
|
|
1529
|
-
seconds: number;
|
|
1530
|
-
}
|
|
1531
|
-
/**
|
|
1532
|
-
* @typedef {object} PlayerProgressbarOptions
|
|
1533
|
-
* @property {boolean} [timecodes] If it should render time codes
|
|
1534
|
-
* @property {boolean} [queue] If it should create progress bar for the whole queue
|
|
1535
|
-
* @property {number} [length] The bar length
|
|
1536
|
-
* @property {string} [line] The bar track
|
|
1537
|
-
* @property {string} [indicator] The indicator
|
|
1538
|
-
*/
|
|
1539
|
-
interface PlayerProgressbarOptions {
|
|
1540
|
-
timecodes?: boolean;
|
|
1541
|
-
length?: number;
|
|
1542
|
-
line?: string;
|
|
1543
|
-
indicator?: string;
|
|
1544
|
-
queue?: boolean;
|
|
1545
|
-
}
|
|
1546
|
-
/**
|
|
1547
|
-
* The search query type
|
|
1548
|
-
* This can be one of:
|
|
1549
|
-
* - AUTO
|
|
1550
|
-
* - YOUTUBE
|
|
1551
|
-
* - YOUTUBE_PLAYLIST
|
|
1552
|
-
* - SOUNDCLOUD_TRACK
|
|
1553
|
-
* - SOUNDCLOUD_PLAYLIST
|
|
1554
|
-
* - SOUNDCLOUD
|
|
1555
|
-
* - SPOTIFY_SONG
|
|
1556
|
-
* - SPOTIFY_ALBUM
|
|
1557
|
-
* - SPOTIFY_PLAYLIST
|
|
1558
|
-
* - FACEBOOK
|
|
1559
|
-
* - VIMEO
|
|
1560
|
-
* - ARBITRARY
|
|
1561
|
-
* - REVERBNATION
|
|
1562
|
-
* - YOUTUBE_SEARCH
|
|
1563
|
-
* - YOUTUBE_VIDEO
|
|
1564
|
-
* - SOUNDCLOUD_SEARCH
|
|
1565
|
-
* - APPLE_MUSIC_SONG
|
|
1566
|
-
* - APPLE_MUSIC_ALBUM
|
|
1567
|
-
* - APPLE_MUSIC_PLAYLIST
|
|
1568
|
-
* -
|
|
1569
|
-
*
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
readonly
|
|
1574
|
-
readonly
|
|
1575
|
-
readonly
|
|
1576
|
-
readonly
|
|
1577
|
-
readonly
|
|
1578
|
-
readonly
|
|
1579
|
-
readonly
|
|
1580
|
-
readonly
|
|
1581
|
-
readonly
|
|
1582
|
-
readonly
|
|
1583
|
-
readonly
|
|
1584
|
-
readonly
|
|
1585
|
-
readonly
|
|
1586
|
-
readonly
|
|
1587
|
-
readonly
|
|
1588
|
-
readonly
|
|
1589
|
-
readonly
|
|
1590
|
-
readonly
|
|
1591
|
-
readonly
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
}
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
}
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
}
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
* @
|
|
1649
|
-
* @property {
|
|
1650
|
-
* @property {string}
|
|
1651
|
-
* @property {string}
|
|
1652
|
-
* @property {string}
|
|
1653
|
-
* @property {
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
* @
|
|
1679
|
-
* @property {
|
|
1680
|
-
* @property {
|
|
1681
|
-
* @property {
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
* @
|
|
1705
|
-
* @property {
|
|
1706
|
-
* @property {string}
|
|
1707
|
-
* @property {string}
|
|
1708
|
-
* @property {
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
* @
|
|
1733
|
-
* @property {
|
|
1734
|
-
* @property {
|
|
1735
|
-
* @property {
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
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;
|
|
1748
1823
|
}
|
|
1749
1824
|
|
|
1750
|
-
declare class AudioFilters {
|
|
1751
|
-
constructor();
|
|
1752
|
-
static filters: Record<FiltersName, string>;
|
|
1753
|
-
static get<K extends FiltersName>(name: K): Record<keyof QueueFilters, string>[K];
|
|
1754
|
-
static has<K extends FiltersName>(name: K): boolean;
|
|
1755
|
-
static [Symbol.iterator](): IterableIterator<{
|
|
1756
|
-
name: FiltersName;
|
|
1757
|
-
value: string;
|
|
1758
|
-
}>;
|
|
1759
|
-
static get names(): (keyof QueueFilters)[];
|
|
1760
|
-
static get length(): number;
|
|
1761
|
-
static toString(): string;
|
|
1762
|
-
/**
|
|
1763
|
-
* Create ffmpeg args from the specified filters name
|
|
1764
|
-
* @param filter The filter name
|
|
1765
|
-
* @returns
|
|
1766
|
-
*/
|
|
1767
|
-
static create<K extends FiltersName>(filters?: K[]): string;
|
|
1768
|
-
/**
|
|
1769
|
-
* Defines audio filter
|
|
1770
|
-
* @param filterName The name of the filter
|
|
1771
|
-
* @param value The ffmpeg args
|
|
1772
|
-
*/
|
|
1773
|
-
static define(filterName: string, value: string): void;
|
|
1774
|
-
/**
|
|
1775
|
-
* Defines multiple audio filters
|
|
1776
|
-
* @param filtersArray Array of filters containing the filter name and ffmpeg args
|
|
1777
|
-
*/
|
|
1778
|
-
static defineBulk(filtersArray: {
|
|
1779
|
-
name: string;
|
|
1780
|
-
value: string;
|
|
1781
|
-
}[]): void;
|
|
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;
|
|
1782
1857
|
}
|
|
1783
1858
|
|
|
1784
|
-
declare class Util {
|
|
1785
|
-
/**
|
|
1786
|
-
* Utils
|
|
1787
|
-
*/
|
|
1788
|
-
private constructor();
|
|
1789
|
-
/**
|
|
1790
|
-
* Creates duration string
|
|
1791
|
-
* @param {object} durObj The duration object
|
|
1792
|
-
* @returns {string}
|
|
1793
|
-
*/
|
|
1794
|
-
static durationString(durObj: Record<string, number>): string;
|
|
1795
|
-
/**
|
|
1796
|
-
* Parses milliseconds to consumable time object
|
|
1797
|
-
* @param {number} milliseconds The time in ms
|
|
1798
|
-
* @returns {TimeData}
|
|
1799
|
-
*/
|
|
1800
|
-
static parseMS(milliseconds: number): TimeData;
|
|
1801
|
-
/**
|
|
1802
|
-
* Builds time code
|
|
1803
|
-
* @param {TimeData} duration The duration object
|
|
1804
|
-
* @returns {string}
|
|
1805
|
-
*/
|
|
1806
|
-
static buildTimeCode(duration: TimeData): string;
|
|
1807
|
-
/**
|
|
1808
|
-
* Picks last item of the given array
|
|
1809
|
-
* @param {any[]} arr The array
|
|
1810
|
-
* @returns {any}
|
|
1811
|
-
*/
|
|
1812
|
-
static last<T = any>(arr: T[]): T;
|
|
1813
|
-
/**
|
|
1814
|
-
* Checks if the voice channel is empty
|
|
1815
|
-
* @param {VoiceChannel|StageChannel} channel The voice channel
|
|
1816
|
-
* @returns {boolean}
|
|
1817
|
-
*/
|
|
1818
|
-
static isVoiceEmpty(channel: VoiceChannel | StageChannel): boolean;
|
|
1819
|
-
/**
|
|
1820
|
-
* Safer require
|
|
1821
|
-
* @param {string} id Node require id
|
|
1822
|
-
* @returns {any}
|
|
1823
|
-
*/
|
|
1824
|
-
static require(id: string): {
|
|
1825
|
-
module: any;
|
|
1826
|
-
error: null;
|
|
1827
|
-
} | {
|
|
1828
|
-
module: null;
|
|
1829
|
-
error: unknown;
|
|
1830
|
-
};
|
|
1831
|
-
static import(id: string): Promise<{
|
|
1832
|
-
module: any;
|
|
1833
|
-
error: null;
|
|
1834
|
-
} | {
|
|
1835
|
-
module: null;
|
|
1836
|
-
error: unknown;
|
|
1837
|
-
}>;
|
|
1838
|
-
/**
|
|
1839
|
-
* Asynchronous timeout
|
|
1840
|
-
* @param {number} time The time in ms to wait
|
|
1841
|
-
* @returns {Promise<unknown>}
|
|
1842
|
-
*/
|
|
1843
|
-
static wait(time: number): Promise<undefined>;
|
|
1844
|
-
static noop(): void;
|
|
1845
|
-
static getFetch(): Promise<any>;
|
|
1846
|
-
static warn(message: string, code?: string, detail?: string): 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;
|
|
1847
1923
|
}
|
|
1848
1924
|
|
|
1849
|
-
declare class QueryResolver {
|
|
1850
|
-
/**
|
|
1851
|
-
* Query resolver
|
|
1852
|
-
*/
|
|
1853
|
-
private constructor();
|
|
1854
|
-
static get regex(): {
|
|
1855
|
-
spotifyAlbumRegex: RegExp;
|
|
1856
|
-
spotifyPlaylistRegex: RegExp;
|
|
1857
|
-
spotifySongRegex: RegExp;
|
|
1858
|
-
vimeoRegex: RegExp;
|
|
1859
|
-
reverbnationRegex: RegExp;
|
|
1860
|
-
attachmentRegex: RegExp;
|
|
1861
|
-
appleMusicAlbumRegex: RegExp;
|
|
1862
|
-
appleMusicPlaylistRegex: RegExp;
|
|
1863
|
-
appleMusicSongRegex: RegExp;
|
|
1864
|
-
};
|
|
1865
|
-
/**
|
|
1866
|
-
* Resolves the given search query
|
|
1867
|
-
* @param {string} query The query
|
|
1868
|
-
* @returns {QueryType}
|
|
1869
|
-
*/
|
|
1870
|
-
static resolve(query: string): (typeof QueryType)[keyof typeof QueryType];
|
|
1871
|
-
/**
|
|
1872
|
-
* Parses vimeo id from url
|
|
1873
|
-
* @param {string} query The query
|
|
1874
|
-
* @returns {string}
|
|
1875
|
-
*/
|
|
1876
|
-
static getVimeoID(query: string): string | null | undefined;
|
|
1877
|
-
static validateId(q: string): boolean;
|
|
1878
|
-
static validateURL(q: string): boolean;
|
|
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;
|
|
1879
1955
|
}
|
|
1880
1956
|
|
|
1881
1957
|
declare function useHistory<Meta = unknown>(node: NodeResolvable): GuildQueueHistory<Meta> | null;
|
|
@@ -1884,6 +1960,8 @@ declare function usePlayer<Meta = unknown>(node: NodeResolvable): GuildQueuePlay
|
|
|
1884
1960
|
|
|
1885
1961
|
declare function useQueue<Meta = unknown>(node: NodeResolvable): GuildQueue<Meta> | null;
|
|
1886
1962
|
|
|
1963
|
+
declare function useMasterPlayer(): Player | null;
|
|
1964
|
+
|
|
1887
1965
|
declare const version: string;
|
|
1888
1966
|
|
|
1889
|
-
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, 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, usePlayer, useQueue, 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 };
|