discord-player 5.4.0 → 5.4.1-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/dist/index.d.ts +1492 -1281
- package/dist/index.js +2072 -36
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2039 -22
- package/dist/index.mjs.map +1 -0
- package/package.json +15 -31
- package/dist/Player.js +0 -623
- package/dist/Structures/ExtractorModel.js +0 -65
- package/dist/Structures/PlayerError.js +0 -48
- package/dist/Structures/Playlist.js +0 -108
- package/dist/Structures/Queue.js +0 -917
- package/dist/Structures/Track.js +0 -155
- package/dist/VoiceInterface/StreamDispatcher.js +0 -238
- package/dist/VoiceInterface/VoiceUtils.js +0 -65
- package/dist/VoiceInterface/VolumeTransformer.js +0 -120
- package/dist/smoothVolume.js +0 -15
- package/dist/types/types.js +0 -58
- package/dist/utils/AudioFilters.js +0 -95
- package/dist/utils/FFmpegStream.js +0 -53
- package/dist/utils/QueryResolver.js +0 -68
- package/dist/utils/Util.js +0 -136
package/dist/index.d.ts
CHANGED
|
@@ -1,1315 +1,1526 @@
|
|
|
1
|
-
|
|
2
|
-
import { User, VoiceChannel, StageChannel, Collection, Snowflake, Client, GuildResolvable, Guild, GuildChannelResolvable, VoiceState, UserResolvable } from 'discord.js';
|
|
1
|
+
import { User, VoiceChannel, StageChannel, Snowflake, Client, GuildResolvable, Guild, GuildChannelResolvable, VoiceState, UserResolvable } from 'discord.js';
|
|
3
2
|
import { Readable, Duplex, TransformOptions, Transform } from 'stream';
|
|
3
|
+
import * as _discord_player_equalizer from '@discord-player/equalizer';
|
|
4
|
+
import { PCMFilters, EqualizerStream, BiquadStream, AudioFilter, EqualizerBand, BiquadFilters } from '@discord-player/equalizer';
|
|
4
5
|
import { TypedEmitter } from 'tiny-typed-emitter';
|
|
5
|
-
import { AudioPlayerError, AudioResource, VoiceConnection, AudioPlayer,
|
|
6
|
-
import {
|
|
6
|
+
import { AudioPlayerError, AudioResource, VoiceConnection, AudioPlayer, AudioPlayerStatus, StreamType } from '@discordjs/voice';
|
|
7
|
+
import { Collection } from '@discord-player/utils';
|
|
7
8
|
import { downloadOptions } from 'ytdl-core';
|
|
8
9
|
|
|
9
|
-
declare class Playlist {
|
|
10
|
-
readonly player: Player;
|
|
11
|
-
tracks: Track[];
|
|
12
|
-
title: string;
|
|
13
|
-
description: string;
|
|
14
|
-
thumbnail: string;
|
|
15
|
-
type:
|
|
16
|
-
source: TrackSource;
|
|
17
|
-
author: {
|
|
18
|
-
name: string;
|
|
19
|
-
url: string;
|
|
20
|
-
};
|
|
21
|
-
id: string;
|
|
22
|
-
url: string;
|
|
23
|
-
readonly rawPlaylist?: any;
|
|
24
|
-
/**
|
|
25
|
-
* Playlist constructor
|
|
26
|
-
* @param {Player} player The player
|
|
27
|
-
* @param {PlaylistInitData} data The data
|
|
28
|
-
*/
|
|
29
|
-
constructor(player: Player, data: PlaylistInitData);
|
|
30
|
-
[Symbol.iterator](): Generator<Track, void, undefined>;
|
|
31
|
-
/**
|
|
32
|
-
* JSON representation of this playlist
|
|
33
|
-
* @param {boolean} [withTracks=true] If it should build json with tracks
|
|
34
|
-
* @returns {PlaylistJSON}
|
|
35
|
-
*/
|
|
36
|
-
toJSON(withTracks?: boolean): PlaylistJSON;
|
|
10
|
+
declare class Playlist {
|
|
11
|
+
readonly player: Player;
|
|
12
|
+
tracks: Track[];
|
|
13
|
+
title: string;
|
|
14
|
+
description: string;
|
|
15
|
+
thumbnail: string;
|
|
16
|
+
type: 'album' | 'playlist';
|
|
17
|
+
source: TrackSource;
|
|
18
|
+
author: {
|
|
19
|
+
name: string;
|
|
20
|
+
url: string;
|
|
21
|
+
};
|
|
22
|
+
id: string;
|
|
23
|
+
url: string;
|
|
24
|
+
readonly rawPlaylist?: any;
|
|
25
|
+
/**
|
|
26
|
+
* Playlist constructor
|
|
27
|
+
* @param {Player} player The player
|
|
28
|
+
* @param {PlaylistInitData} data The data
|
|
29
|
+
*/
|
|
30
|
+
constructor(player: Player, data: PlaylistInitData);
|
|
31
|
+
[Symbol.iterator](): Generator<Track, void, undefined>;
|
|
32
|
+
/**
|
|
33
|
+
* JSON representation of this playlist
|
|
34
|
+
* @param {boolean} [withTracks=true] If it should build json with tracks
|
|
35
|
+
* @returns {PlaylistJSON}
|
|
36
|
+
*/
|
|
37
|
+
toJSON(withTracks?: boolean): PlaylistJSON;
|
|
37
38
|
}
|
|
38
39
|
|
|
39
|
-
declare class Track {
|
|
40
|
-
player: Player;
|
|
41
|
-
title: string;
|
|
42
|
-
description: string;
|
|
43
|
-
author: string;
|
|
44
|
-
url: string;
|
|
45
|
-
thumbnail: string;
|
|
46
|
-
duration: string;
|
|
47
|
-
views: number;
|
|
48
|
-
requestedBy: User;
|
|
49
|
-
playlist?: Playlist;
|
|
50
|
-
|
|
51
|
-
readonly
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
*
|
|
55
|
-
* @param {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
*
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
*
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
*
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
*
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
*
|
|
82
|
-
|
|
83
|
-
|
|
40
|
+
declare class Track {
|
|
41
|
+
player: Player;
|
|
42
|
+
title: string;
|
|
43
|
+
description: string;
|
|
44
|
+
author: string;
|
|
45
|
+
url: string;
|
|
46
|
+
thumbnail: string;
|
|
47
|
+
duration: string;
|
|
48
|
+
views: number;
|
|
49
|
+
requestedBy: User | null;
|
|
50
|
+
playlist?: Playlist;
|
|
51
|
+
queryType: SearchQueryType | null | undefined;
|
|
52
|
+
readonly raw: RawTrackData;
|
|
53
|
+
readonly id: string;
|
|
54
|
+
/**
|
|
55
|
+
* Track constructor
|
|
56
|
+
* @param {Player} player The player that instantiated this Track
|
|
57
|
+
* @param {RawTrackData} data Track data
|
|
58
|
+
*/
|
|
59
|
+
constructor(player: Player, data: RawTrackData);
|
|
60
|
+
private _patch;
|
|
61
|
+
/**
|
|
62
|
+
* The queue in which this track is located
|
|
63
|
+
* @type {Queue}
|
|
64
|
+
*/
|
|
65
|
+
get queue(): Queue;
|
|
66
|
+
/**
|
|
67
|
+
* The track duration in millisecond
|
|
68
|
+
* @type {number}
|
|
69
|
+
*/
|
|
70
|
+
get durationMS(): number;
|
|
71
|
+
/**
|
|
72
|
+
* Returns source of this track
|
|
73
|
+
* @type {TrackSource}
|
|
74
|
+
*/
|
|
75
|
+
get source(): TrackSource;
|
|
76
|
+
/**
|
|
77
|
+
* String representation of this track
|
|
78
|
+
* @returns {string}
|
|
79
|
+
*/
|
|
80
|
+
toString(): string;
|
|
81
|
+
/**
|
|
82
|
+
* Raw JSON representation of this track
|
|
83
|
+
* @returns {TrackJSON}
|
|
84
|
+
*/
|
|
85
|
+
toJSON(hidePlaylist?: boolean): TrackJSON;
|
|
84
86
|
}
|
|
85
87
|
|
|
86
|
-
interface
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
*
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
*
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
*
|
|
140
|
-
*/
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
*
|
|
144
|
-
* @
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
*
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
*
|
|
156
|
-
* @returns {
|
|
157
|
-
*/
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
*
|
|
161
|
-
* @
|
|
162
|
-
*/
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
*
|
|
166
|
-
* @
|
|
167
|
-
|
|
168
|
-
|
|
88
|
+
interface CreateStreamOps {
|
|
89
|
+
type?: StreamType;
|
|
90
|
+
data?: any;
|
|
91
|
+
disableVolume?: boolean;
|
|
92
|
+
disableEqualizer?: boolean;
|
|
93
|
+
disableBiquad?: boolean;
|
|
94
|
+
eq?: EqualizerBand[];
|
|
95
|
+
biquadFilter?: BiquadFilters;
|
|
96
|
+
disableFilters?: boolean;
|
|
97
|
+
defaultFilters?: PCMFilters[];
|
|
98
|
+
}
|
|
99
|
+
interface VoiceEvents {
|
|
100
|
+
error: (error: AudioPlayerError) => any;
|
|
101
|
+
debug: (message: string) => any;
|
|
102
|
+
start: (resource: AudioResource<Track>) => any;
|
|
103
|
+
finish: (resource: AudioResource<Track>) => any;
|
|
104
|
+
audioFilters: (filters: PCMFilters[]) => any;
|
|
105
|
+
}
|
|
106
|
+
declare class StreamDispatcher extends TypedEmitter<VoiceEvents> {
|
|
107
|
+
readonly connectionTimeout: number;
|
|
108
|
+
readonly voiceConnection: VoiceConnection;
|
|
109
|
+
readonly audioPlayer: AudioPlayer;
|
|
110
|
+
channel: VoiceChannel | StageChannel;
|
|
111
|
+
audioResource?: AudioResource<Track> | null;
|
|
112
|
+
private readyLock;
|
|
113
|
+
equalizer: EqualizerStream | null;
|
|
114
|
+
biquad: BiquadStream | null;
|
|
115
|
+
audioFilters: AudioFilter | null;
|
|
116
|
+
/**
|
|
117
|
+
* Creates new connection object
|
|
118
|
+
* @param {VoiceConnection} connection The connection
|
|
119
|
+
* @param {VoiceChannel|StageChannel} channel The connected channel
|
|
120
|
+
* @private
|
|
121
|
+
*/
|
|
122
|
+
constructor(connection: VoiceConnection, channel: VoiceChannel | StageChannel, connectionTimeout?: number);
|
|
123
|
+
/**
|
|
124
|
+
* Check if the player has been paused manually
|
|
125
|
+
*/
|
|
126
|
+
get paused(): boolean;
|
|
127
|
+
set paused(val: boolean);
|
|
128
|
+
/**
|
|
129
|
+
* Whether or not the player is currently paused automatically or manually.
|
|
130
|
+
*/
|
|
131
|
+
isPaused(): boolean;
|
|
132
|
+
/**
|
|
133
|
+
* Whether or not the player is currently buffering
|
|
134
|
+
*/
|
|
135
|
+
isBuffering(): boolean;
|
|
136
|
+
/**
|
|
137
|
+
* Whether or not the player is currently playing
|
|
138
|
+
*/
|
|
139
|
+
isPlaying(): boolean;
|
|
140
|
+
/**
|
|
141
|
+
* Whether or not the player is currently idle
|
|
142
|
+
*/
|
|
143
|
+
isIdle(): boolean;
|
|
144
|
+
/**
|
|
145
|
+
* Creates stream
|
|
146
|
+
* @param {Readable|Duplex|string} src The stream source
|
|
147
|
+
* @param {object} [ops] Options
|
|
148
|
+
* @returns {AudioResource}
|
|
149
|
+
*/
|
|
150
|
+
createStream(src: Readable | Duplex | string, ops?: CreateStreamOps): AudioResource<Track>;
|
|
151
|
+
/**
|
|
152
|
+
* The player status
|
|
153
|
+
* @type {AudioPlayerStatus}
|
|
154
|
+
*/
|
|
155
|
+
get status(): AudioPlayerStatus;
|
|
156
|
+
/**
|
|
157
|
+
* Disconnects from voice
|
|
158
|
+
* @returns {void}
|
|
159
|
+
*/
|
|
160
|
+
disconnect(): void;
|
|
161
|
+
/**
|
|
162
|
+
* Stops the player
|
|
163
|
+
* @returns {void}
|
|
164
|
+
*/
|
|
165
|
+
end(): void;
|
|
166
|
+
/**
|
|
167
|
+
* Pauses the stream playback
|
|
168
|
+
* @param {boolean} [interpolateSilence=false] If true, the player will play 5 packets of silence after pausing to prevent audio glitches.
|
|
169
|
+
* @returns {boolean}
|
|
170
|
+
*/
|
|
171
|
+
pause(interpolateSilence?: boolean): boolean;
|
|
172
|
+
/**
|
|
173
|
+
* Resumes the stream playback
|
|
174
|
+
* @returns {boolean}
|
|
175
|
+
*/
|
|
176
|
+
resume(): boolean;
|
|
177
|
+
/**
|
|
178
|
+
* Play stream
|
|
179
|
+
* @param {AudioResource<Track>} [resource=this.audioResource] The audio resource to play
|
|
180
|
+
* @returns {Promise<StreamDispatcher>}
|
|
181
|
+
*/
|
|
182
|
+
playStream(resource?: AudioResource<Track>): Promise<this | undefined>;
|
|
183
|
+
/**
|
|
184
|
+
* Sets playback volume
|
|
185
|
+
* @param {number} value The volume amount
|
|
186
|
+
* @returns {boolean}
|
|
187
|
+
*/
|
|
188
|
+
setVolume(value: number): boolean;
|
|
189
|
+
/**
|
|
190
|
+
* The current volume
|
|
191
|
+
* @type {number}
|
|
192
|
+
*/
|
|
193
|
+
get volume(): number;
|
|
194
|
+
/**
|
|
195
|
+
* The playback time
|
|
196
|
+
* @type {number}
|
|
197
|
+
*/
|
|
198
|
+
get streamTime(): number;
|
|
169
199
|
}
|
|
170
200
|
|
|
171
|
-
declare class VoiceUtils {
|
|
172
|
-
cache: Collection<Snowflake, StreamDispatcher>;
|
|
173
|
-
/**
|
|
174
|
-
* The voice utils
|
|
175
|
-
* @private
|
|
176
|
-
*/
|
|
177
|
-
constructor();
|
|
178
|
-
/**
|
|
179
|
-
* Joins a voice channel, creating basic stream dispatch manager
|
|
180
|
-
* @param {StageChannel|VoiceChannel} channel The voice channel
|
|
181
|
-
* @param {object} [options] Join options
|
|
182
|
-
* @returns {Promise<StreamDispatcher>}
|
|
183
|
-
*/
|
|
184
|
-
connect(channel: VoiceChannel | StageChannel, options?: {
|
|
185
|
-
deaf?: boolean;
|
|
186
|
-
maxTime?: number;
|
|
187
|
-
}): Promise<StreamDispatcher>;
|
|
188
|
-
/**
|
|
189
|
-
* Joins a voice channel
|
|
190
|
-
* @param {StageChannel|VoiceChannel} [channel] The voice/stage channel to join
|
|
191
|
-
* @param {object} [options] Join options
|
|
192
|
-
* @returns {VoiceConnection}
|
|
193
|
-
*/
|
|
194
|
-
join(channel: VoiceChannel | StageChannel, options?: {
|
|
195
|
-
deaf?: boolean;
|
|
196
|
-
maxTime?: number;
|
|
197
|
-
}): Promise<VoiceConnection>;
|
|
198
|
-
/**
|
|
199
|
-
* Disconnects voice connection
|
|
200
|
-
* @param {VoiceConnection} connection The voice connection
|
|
201
|
-
* @returns {void}
|
|
202
|
-
*/
|
|
203
|
-
disconnect(connection: VoiceConnection | StreamDispatcher): void;
|
|
204
|
-
/**
|
|
205
|
-
* Returns Discord Player voice connection
|
|
206
|
-
* @param {Snowflake} guild The guild id
|
|
207
|
-
* @returns {StreamDispatcher}
|
|
208
|
-
*/
|
|
209
|
-
getConnection(guild: Snowflake): StreamDispatcher;
|
|
201
|
+
declare class VoiceUtils {
|
|
202
|
+
cache: Collection<Snowflake, StreamDispatcher>;
|
|
203
|
+
/**
|
|
204
|
+
* The voice utils
|
|
205
|
+
* @private
|
|
206
|
+
*/
|
|
207
|
+
constructor();
|
|
208
|
+
/**
|
|
209
|
+
* Joins a voice channel, creating basic stream dispatch manager
|
|
210
|
+
* @param {StageChannel|VoiceChannel} channel The voice channel
|
|
211
|
+
* @param {object} [options] Join options
|
|
212
|
+
* @returns {Promise<StreamDispatcher>}
|
|
213
|
+
*/
|
|
214
|
+
connect(channel: VoiceChannel | StageChannel, options?: {
|
|
215
|
+
deaf?: boolean;
|
|
216
|
+
maxTime?: number;
|
|
217
|
+
}): Promise<StreamDispatcher>;
|
|
218
|
+
/**
|
|
219
|
+
* Joins a voice channel
|
|
220
|
+
* @param {StageChannel|VoiceChannel} [channel] The voice/stage channel to join
|
|
221
|
+
* @param {object} [options] Join options
|
|
222
|
+
* @returns {VoiceConnection}
|
|
223
|
+
*/
|
|
224
|
+
join(channel: VoiceChannel | StageChannel, options?: {
|
|
225
|
+
deaf?: boolean;
|
|
226
|
+
maxTime?: number;
|
|
227
|
+
}): Promise<VoiceConnection>;
|
|
228
|
+
/**
|
|
229
|
+
* Disconnects voice connection
|
|
230
|
+
* @param {VoiceConnection} connection The voice connection
|
|
231
|
+
* @returns {void}
|
|
232
|
+
*/
|
|
233
|
+
disconnect(connection: VoiceConnection | StreamDispatcher): void;
|
|
234
|
+
/**
|
|
235
|
+
* Returns Discord Player voice connection
|
|
236
|
+
* @param {Snowflake} guild The guild id
|
|
237
|
+
* @returns {StreamDispatcher}
|
|
238
|
+
*/
|
|
239
|
+
getConnection(guild: Snowflake): StreamDispatcher | undefined;
|
|
210
240
|
}
|
|
211
241
|
|
|
212
|
-
declare class
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
*
|
|
225
|
-
*/
|
|
226
|
-
|
|
227
|
-
/**
|
|
228
|
-
*
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
242
|
+
declare class BaseExtractor {
|
|
243
|
+
context: ExtractorExecutionContext;
|
|
244
|
+
/**
|
|
245
|
+
* Identifier for this extractor
|
|
246
|
+
*/
|
|
247
|
+
static identifier: string;
|
|
248
|
+
/**
|
|
249
|
+
* Extractor constructor
|
|
250
|
+
* @param context Context that instantiated this extractor
|
|
251
|
+
*/
|
|
252
|
+
constructor(context: ExtractorExecutionContext);
|
|
253
|
+
/**
|
|
254
|
+
* Identifier of this extractor
|
|
255
|
+
*/
|
|
256
|
+
get identifier(): string;
|
|
257
|
+
/**
|
|
258
|
+
* This method will be executed when this extractor is activated
|
|
259
|
+
*/
|
|
260
|
+
activate(): Promise<void>;
|
|
261
|
+
/**
|
|
262
|
+
* This method will be executed when this extractor is deactivated
|
|
263
|
+
*/
|
|
264
|
+
deactivate(): Promise<void>;
|
|
265
|
+
/**
|
|
266
|
+
* Validate incoming query
|
|
267
|
+
* @param query The query to validate
|
|
268
|
+
*/
|
|
269
|
+
validate(query: string, type?: SearchQueryType | null): Promise<boolean>;
|
|
270
|
+
/**
|
|
271
|
+
* Stream the given track
|
|
272
|
+
* @param info The track to stream
|
|
273
|
+
*/
|
|
274
|
+
stream(info: Track): Promise<Readable | string>;
|
|
275
|
+
/**
|
|
276
|
+
* Handle the given query
|
|
277
|
+
* @param query The query to handle
|
|
278
|
+
*/
|
|
279
|
+
handle(query: string, context: ExtractorSearchContext): Promise<ExtractorInfo>;
|
|
280
|
+
/**
|
|
281
|
+
* A stream middleware to handle streams before passing it to the player
|
|
282
|
+
* @param stream The incoming stream
|
|
283
|
+
* @param next The next function
|
|
284
|
+
*/
|
|
285
|
+
handlePostStream(stream: Readable, next: NextFunction): void;
|
|
286
|
+
/**
|
|
287
|
+
* Dispatch an event to the player
|
|
288
|
+
* @param event The event to dispatch
|
|
289
|
+
* @param args The data to dispatch
|
|
290
|
+
*/
|
|
291
|
+
emit<K extends keyof PlayerEvents>(event: K, ...args: Parameters<PlayerEvents[K]>): boolean;
|
|
292
|
+
}
|
|
293
|
+
type NextFunction = (error?: Error | null, stream?: Readable) => void;
|
|
294
|
+
interface ExtractorInfo {
|
|
295
|
+
playlist: Playlist | null;
|
|
296
|
+
tracks: Track[];
|
|
297
|
+
}
|
|
298
|
+
interface ExtractorSearchContext {
|
|
299
|
+
type?: SearchQueryType | null;
|
|
300
|
+
requestedBy?: User | null;
|
|
238
301
|
}
|
|
239
302
|
|
|
240
|
-
declare class
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
*/
|
|
258
|
-
get eventLoopLag(): number;
|
|
259
|
-
/**
|
|
260
|
-
* Generates statistics
|
|
261
|
-
*/
|
|
262
|
-
generateStatistics(): {
|
|
263
|
-
guild: string;
|
|
264
|
-
memory: NodeJS.MemoryUsage;
|
|
265
|
-
tracks: number;
|
|
266
|
-
os: {
|
|
267
|
-
cpuCount: number;
|
|
268
|
-
totalMem: number;
|
|
269
|
-
freeMem: number;
|
|
270
|
-
platform: NodeJS.Platform;
|
|
271
|
-
};
|
|
272
|
-
isShard: boolean;
|
|
273
|
-
latency: {
|
|
274
|
-
client: number;
|
|
275
|
-
udp: number;
|
|
276
|
-
ws: number;
|
|
277
|
-
eventLoop: number;
|
|
278
|
-
};
|
|
279
|
-
subscribers: number;
|
|
280
|
-
connections: number;
|
|
281
|
-
extractors: number;
|
|
282
|
-
}[];
|
|
283
|
-
/**
|
|
284
|
-
* Handles voice state update
|
|
285
|
-
* @param {VoiceState} oldState The old voice state
|
|
286
|
-
* @param {VoiceState} newState The new voice state
|
|
287
|
-
* @returns {void}
|
|
288
|
-
* @private
|
|
289
|
-
*/
|
|
290
|
-
private _handleVoiceState;
|
|
291
|
-
/**
|
|
292
|
-
* Creates a queue for a guild if not available, else returns existing queue
|
|
293
|
-
* @param {GuildResolvable} guild The guild
|
|
294
|
-
* @param {PlayerOptions} queueInitOptions Queue init options
|
|
295
|
-
* @returns {Queue}
|
|
296
|
-
*/
|
|
297
|
-
createQueue<T = unknown>(guild: GuildResolvable, queueInitOptions?: PlayerOptions & {
|
|
298
|
-
metadata?: T;
|
|
299
|
-
}): Queue<T>;
|
|
300
|
-
/**
|
|
301
|
-
* Returns the queue if available
|
|
302
|
-
* @param {GuildResolvable} guild The guild id
|
|
303
|
-
* @returns {Queue | undefined}
|
|
304
|
-
*/
|
|
305
|
-
getQueue<T = unknown>(guild: GuildResolvable): Queue<T> | undefined;
|
|
306
|
-
/**
|
|
307
|
-
* Deletes a queue and returns deleted queue object
|
|
308
|
-
* @param {GuildResolvable} guild The guild id to remove
|
|
309
|
-
* @returns {Queue}
|
|
310
|
-
*/
|
|
311
|
-
deleteQueue<T = unknown>(guild: GuildResolvable): Queue<T>;
|
|
312
|
-
/**
|
|
313
|
-
* @typedef {object} PlayerSearchResult
|
|
314
|
-
* @property {Playlist} [playlist] The playlist (if any)
|
|
315
|
-
* @property {Track[]} tracks The tracks
|
|
316
|
-
*/
|
|
317
|
-
/**
|
|
318
|
-
* Search tracks
|
|
319
|
-
* @param {string|Track} query The search query
|
|
320
|
-
* @param {SearchOptions} options The search options
|
|
321
|
-
* @returns {Promise<PlayerSearchResult>}
|
|
322
|
-
*/
|
|
323
|
-
search(query: string | Track, options: SearchOptions): Promise<PlayerSearchResult>;
|
|
324
|
-
/**
|
|
325
|
-
* Registers extractor
|
|
326
|
-
* @param {string} extractorName The extractor name
|
|
327
|
-
* @param {ExtractorModel|any} extractor The extractor object
|
|
328
|
-
* @param {boolean} [force=false] Overwrite existing extractor with this name (if available)
|
|
329
|
-
* @returns {ExtractorModel}
|
|
330
|
-
*/
|
|
331
|
-
use(extractorName: string, extractor: ExtractorModel | any, force?: boolean): ExtractorModel;
|
|
332
|
-
/**
|
|
333
|
-
* Removes registered extractor
|
|
334
|
-
* @param {string} extractorName The extractor name
|
|
335
|
-
* @returns {ExtractorModel}
|
|
336
|
-
*/
|
|
337
|
-
unuse(extractorName: string): ExtractorModel;
|
|
338
|
-
/**
|
|
339
|
-
* Generates a report of the dependencies used by the `@discordjs/voice` module. Useful for debugging.
|
|
340
|
-
* @returns {string}
|
|
341
|
-
*/
|
|
342
|
-
scanDeps(): string;
|
|
343
|
-
emit<U extends keyof PlayerEvents>(eventName: U, ...args: Parameters<PlayerEvents[U]>): boolean;
|
|
344
|
-
/**
|
|
345
|
-
* Resolves queue
|
|
346
|
-
* @param {GuildResolvable|Queue} queueLike Queue like object
|
|
347
|
-
* @returns {Queue}
|
|
348
|
-
*/
|
|
349
|
-
resolveQueue<T>(queueLike: GuildResolvable | Queue): Queue<T>;
|
|
350
|
-
[Symbol.iterator](): Generator<Queue<unknown>, void, undefined>;
|
|
351
|
-
/**
|
|
352
|
-
* Creates `Playlist` instance
|
|
353
|
-
* @param data The data to initialize a playlist
|
|
354
|
-
*/
|
|
355
|
-
createPlaylist(data: PlaylistInitData): Playlist;
|
|
356
|
-
}
|
|
303
|
+
declare class ExtractorExecutionContext {
|
|
304
|
+
player: Player;
|
|
305
|
+
store: Collection<string, BaseExtractor>;
|
|
306
|
+
constructor(player: Player);
|
|
307
|
+
isRegistered(identifier: string): boolean;
|
|
308
|
+
get size(): number;
|
|
309
|
+
get(identifier: string): BaseExtractor | undefined;
|
|
310
|
+
register(_extractor: typeof BaseExtractor): Promise<void>;
|
|
311
|
+
unregister<K extends string | BaseExtractor>(_extractor: K): Promise<void>;
|
|
312
|
+
unregisterAll(): Promise<void>;
|
|
313
|
+
run<T = unknown>(fn: ExtractorExecutionFN<T>): Promise<ExtractorExecutionResult<T> | null>;
|
|
314
|
+
}
|
|
315
|
+
interface ExtractorExecutionResult<T = unknown> {
|
|
316
|
+
extractor: BaseExtractor;
|
|
317
|
+
result: T;
|
|
318
|
+
}
|
|
319
|
+
type ExtractorExecutionFN<T = unknown> = (extractor: BaseExtractor) => Promise<T | boolean>;
|
|
357
320
|
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
tracks
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
/**
|
|
389
|
-
* Set particular equalizer band multiplier
|
|
390
|
-
* @param band The band to update
|
|
391
|
-
* @param gain The gain
|
|
392
|
-
*/
|
|
393
|
-
setEqualizerBand(band: number, gain: number): boolean;
|
|
394
|
-
/**
|
|
395
|
-
* Returns gain value of specific equalizer band
|
|
396
|
-
* @param band The band to get value of
|
|
397
|
-
*/
|
|
398
|
-
getEqualizerBand(band: number): number;
|
|
399
|
-
/**
|
|
400
|
-
* Returns entire equalizer bands
|
|
401
|
-
*/
|
|
402
|
-
getEqualizer(): EqualizerBand[];
|
|
403
|
-
/**
|
|
404
|
-
* Check if equalizer is enabled
|
|
405
|
-
*/
|
|
406
|
-
isEqualizerEnabled(): boolean;
|
|
407
|
-
/**
|
|
408
|
-
* Toggles equalizer on/off
|
|
409
|
-
*/
|
|
410
|
-
toggleEqualizer(): boolean;
|
|
411
|
-
/**
|
|
412
|
-
* Enables equalizer
|
|
413
|
-
*/
|
|
414
|
-
enableEqualizer(): boolean;
|
|
415
|
-
/**
|
|
416
|
-
* Disables equalizer
|
|
417
|
-
*/
|
|
418
|
-
disableEqualizer(): boolean;
|
|
419
|
-
/**
|
|
420
|
-
* Forces next play
|
|
421
|
-
* @returns {Promise<void>}
|
|
422
|
-
*/
|
|
423
|
-
forceNext(): Promise<void>;
|
|
424
|
-
/**
|
|
425
|
-
* Returns current track
|
|
426
|
-
* @type {Track}
|
|
427
|
-
*/
|
|
428
|
-
get current(): Track;
|
|
429
|
-
/**
|
|
430
|
-
* If this queue is destroyed
|
|
431
|
-
* @type {boolean}
|
|
432
|
-
*/
|
|
433
|
-
get destroyed(): boolean;
|
|
434
|
-
/**
|
|
435
|
-
* Returns current track
|
|
436
|
-
* @returns {Track}
|
|
437
|
-
*/
|
|
438
|
-
nowPlaying(): Track;
|
|
439
|
-
/**
|
|
440
|
-
* Connects to a voice channel
|
|
441
|
-
* @param {GuildChannelResolvable} channel The voice/stage channel
|
|
442
|
-
* @returns {Promise<Queue>}
|
|
443
|
-
*/
|
|
444
|
-
connect(channel: GuildChannelResolvable): Promise<this>;
|
|
445
|
-
private emitEnd;
|
|
446
|
-
private refreshEndCooldown;
|
|
447
|
-
/**
|
|
448
|
-
* Destroys this queue
|
|
449
|
-
* @param {boolean} [disconnect=this.options.leaveOnStop] If it should leave on destroy
|
|
450
|
-
* @returns {void}
|
|
451
|
-
*/
|
|
452
|
-
destroy(disconnect?: boolean): void;
|
|
453
|
-
/**
|
|
454
|
-
* Skips current track
|
|
455
|
-
* @returns {boolean}
|
|
456
|
-
*/
|
|
457
|
-
skip(): boolean;
|
|
458
|
-
/**
|
|
459
|
-
* Adds single track to the queue
|
|
460
|
-
* @param {Track} track The track to add
|
|
461
|
-
* @returns {void}
|
|
462
|
-
*/
|
|
463
|
-
addTrack(track: Track): void;
|
|
464
|
-
/**
|
|
465
|
-
* Adds multiple tracks to the queue
|
|
466
|
-
* @param {Track[]} tracks Array of tracks to add
|
|
467
|
-
*/
|
|
468
|
-
addTracks(tracks: Track[]): void;
|
|
469
|
-
/**
|
|
470
|
-
* Sets paused state
|
|
471
|
-
* @param {boolean} paused The paused state
|
|
472
|
-
* @returns {boolean}
|
|
473
|
-
*/
|
|
474
|
-
setPaused(paused?: boolean): boolean;
|
|
475
|
-
/**
|
|
476
|
-
* Sets bitrate
|
|
477
|
-
* @param {number|auto} bitrate bitrate to set
|
|
478
|
-
* @returns {void}
|
|
479
|
-
*/
|
|
480
|
-
setBitrate(bitrate: number | "auto"): void;
|
|
481
|
-
/**
|
|
482
|
-
* Sets volume
|
|
483
|
-
* @param {number} amount The volume amount
|
|
484
|
-
* @returns {boolean}
|
|
485
|
-
*/
|
|
486
|
-
setVolume(amount: number): boolean;
|
|
487
|
-
/**
|
|
488
|
-
* Sets repeat mode
|
|
489
|
-
* @param {QueueRepeatMode} mode The repeat mode
|
|
490
|
-
* @returns {boolean}
|
|
491
|
-
*/
|
|
492
|
-
setRepeatMode(mode: QueueRepeatMode): boolean;
|
|
493
|
-
/**
|
|
494
|
-
* The current volume amount
|
|
495
|
-
* @type {number}
|
|
496
|
-
*/
|
|
497
|
-
get volume(): number;
|
|
498
|
-
set volume(amount: number);
|
|
499
|
-
/**
|
|
500
|
-
* The stream time of this queue
|
|
501
|
-
* @type {number}
|
|
502
|
-
*/
|
|
503
|
-
get streamTime(): number;
|
|
504
|
-
set streamTime(time: number);
|
|
505
|
-
/**
|
|
506
|
-
* Returns enabled filters
|
|
507
|
-
* @returns {AudioFilters}
|
|
508
|
-
*/
|
|
509
|
-
getFiltersEnabled(): (keyof QueueFilters)[];
|
|
510
|
-
/**
|
|
511
|
-
* Returns disabled filters
|
|
512
|
-
* @returns {AudioFilters}
|
|
513
|
-
*/
|
|
514
|
-
getFiltersDisabled(): (keyof QueueFilters)[];
|
|
515
|
-
/**
|
|
516
|
-
* Sets filters
|
|
517
|
-
* @param {QueueFilters} filters Queue filters
|
|
518
|
-
* @returns {Promise<void>}
|
|
519
|
-
*/
|
|
520
|
-
setFilters(filters?: QueueFilters): Promise<void>;
|
|
521
|
-
/**
|
|
522
|
-
* Seeks to the given time
|
|
523
|
-
* @param {number} position The position
|
|
524
|
-
* @returns {boolean}
|
|
525
|
-
*/
|
|
526
|
-
seek(position: number): Promise<boolean>;
|
|
527
|
-
/**
|
|
528
|
-
* Plays previous track
|
|
529
|
-
* @returns {Promise<void>}
|
|
530
|
-
*/
|
|
531
|
-
back(): Promise<void>;
|
|
532
|
-
/**
|
|
533
|
-
* Clear this queue
|
|
534
|
-
*/
|
|
535
|
-
clear(): void;
|
|
536
|
-
/**
|
|
537
|
-
* Stops the player
|
|
538
|
-
* @returns {void}
|
|
539
|
-
*/
|
|
540
|
-
stop(): void;
|
|
541
|
-
/**
|
|
542
|
-
* Shuffles this queue
|
|
543
|
-
* @returns {boolean}
|
|
544
|
-
*/
|
|
545
|
-
shuffle(): boolean;
|
|
546
|
-
/**
|
|
547
|
-
* Removes a track from the queue
|
|
548
|
-
* @param {Track|string|number} track The track to remove
|
|
549
|
-
* @returns {Track}
|
|
550
|
-
*/
|
|
551
|
-
remove(track: Track | string | number): Track;
|
|
552
|
-
/**
|
|
553
|
-
* Returns the index of the specified track. If found, returns the track index else returns -1.
|
|
554
|
-
* @param {number|Track|string} track The track
|
|
555
|
-
* @returns {number}
|
|
556
|
-
*/
|
|
557
|
-
getTrackPosition(track: number | Track | string): number;
|
|
558
|
-
/**
|
|
559
|
-
* Jumps to particular track
|
|
560
|
-
* @param {Track|number} track The track
|
|
561
|
-
* @returns {void}
|
|
562
|
-
*/
|
|
563
|
-
jump(track: Track | number): void;
|
|
564
|
-
/**
|
|
565
|
-
* Jumps to particular track, removing other tracks on the way
|
|
566
|
-
* @param {Track|number} track The track
|
|
567
|
-
* @returns {void}
|
|
568
|
-
*/
|
|
569
|
-
skipTo(track: Track | number): void;
|
|
570
|
-
/**
|
|
571
|
-
* Inserts the given track to specified index
|
|
572
|
-
* @param {Track} track The track to insert
|
|
573
|
-
* @param {number} [index=0] The index where this track should be
|
|
574
|
-
*/
|
|
575
|
-
insert(track: Track, index?: number): void;
|
|
576
|
-
/**
|
|
577
|
-
* @typedef {object} PlayerTimestamp
|
|
578
|
-
* @property {string} current The current progress
|
|
579
|
-
* @property {string} end The total time
|
|
580
|
-
* @property {number} progress Progress in %
|
|
581
|
-
*/
|
|
582
|
-
/**
|
|
583
|
-
* Returns player stream timestamp
|
|
584
|
-
* @returns {PlayerTimestamp}
|
|
585
|
-
*/
|
|
586
|
-
getPlayerTimestamp(): {
|
|
587
|
-
current: string;
|
|
588
|
-
end: string;
|
|
589
|
-
progress: number;
|
|
590
|
-
};
|
|
591
|
-
/**
|
|
592
|
-
* Creates progress bar string
|
|
593
|
-
* @param {PlayerProgressbarOptions} options The progress bar options
|
|
594
|
-
* @returns {string}
|
|
595
|
-
*/
|
|
596
|
-
createProgressBar(options?: PlayerProgressbarOptions): string;
|
|
597
|
-
/**
|
|
598
|
-
* Total duration
|
|
599
|
-
* @type {Number}
|
|
600
|
-
*/
|
|
601
|
-
get totalTime(): number;
|
|
602
|
-
/**
|
|
603
|
-
* Generates statistics
|
|
604
|
-
*/
|
|
605
|
-
generateStatistics(): {
|
|
606
|
-
guild: string;
|
|
607
|
-
memory: NodeJS.MemoryUsage;
|
|
608
|
-
tracks: number;
|
|
609
|
-
os: {
|
|
610
|
-
cpuCount: number;
|
|
611
|
-
totalMem: number;
|
|
612
|
-
freeMem: number;
|
|
613
|
-
platform: NodeJS.Platform;
|
|
614
|
-
};
|
|
615
|
-
isShard: boolean;
|
|
616
|
-
latency: {
|
|
617
|
-
client: number;
|
|
618
|
-
udp: number;
|
|
619
|
-
ws: number;
|
|
620
|
-
eventLoop: number;
|
|
621
|
-
};
|
|
622
|
-
subscribers: number;
|
|
623
|
-
connections: number;
|
|
624
|
-
extractors: number;
|
|
625
|
-
};
|
|
626
|
-
/**
|
|
627
|
-
* Voice connection latency in ms
|
|
628
|
-
* @type {number}
|
|
629
|
-
*/
|
|
630
|
-
get ping(): number;
|
|
631
|
-
/**
|
|
632
|
-
* Play stream in a voice/stage channel
|
|
633
|
-
* @param {Track} [src] The track to play (if empty, uses first track from the queue)
|
|
634
|
-
* @param {PlayOptions} [options] The options
|
|
635
|
-
* @returns {Promise<void>}
|
|
636
|
-
*/
|
|
637
|
-
play(src?: Track, options?: PlayOptions): Promise<void>;
|
|
638
|
-
/**
|
|
639
|
-
* Private method to handle autoplay
|
|
640
|
-
* @param {Track} track The source track to find its similar track for autoplay
|
|
641
|
-
* @returns {Promise<void>}
|
|
642
|
-
* @private
|
|
643
|
-
*/
|
|
644
|
-
private _handleAutoplay;
|
|
645
|
-
[Symbol.iterator](): Generator<Track, void, undefined>;
|
|
646
|
-
/**
|
|
647
|
-
* JSON representation of this queue
|
|
648
|
-
* @returns {object}
|
|
649
|
-
*/
|
|
650
|
-
toJSON(): {
|
|
651
|
-
id: string;
|
|
652
|
-
guild: string;
|
|
653
|
-
voiceChannel: string;
|
|
654
|
-
options: PlayerOptions;
|
|
655
|
-
tracks: TrackJSON[];
|
|
656
|
-
};
|
|
657
|
-
/**
|
|
658
|
-
* String representation of this queue
|
|
659
|
-
* @returns {string}
|
|
660
|
-
*/
|
|
661
|
-
toString(): string;
|
|
321
|
+
interface SearchResultData {
|
|
322
|
+
query: string;
|
|
323
|
+
queryType?: SearchQueryType | QueryExtractorSearch | null;
|
|
324
|
+
extractor?: BaseExtractor | null;
|
|
325
|
+
playlist?: Playlist | null;
|
|
326
|
+
tracks?: Track[];
|
|
327
|
+
requestedBy?: User | null;
|
|
328
|
+
}
|
|
329
|
+
declare class SearchResult {
|
|
330
|
+
player: Player;
|
|
331
|
+
private _data;
|
|
332
|
+
constructor(player: Player, _data: SearchResultData);
|
|
333
|
+
get query(): string;
|
|
334
|
+
get queryType(): SearchQueryType | `ext:${string}`;
|
|
335
|
+
get extractor(): BaseExtractor | null;
|
|
336
|
+
get playlist(): Playlist | null | undefined;
|
|
337
|
+
get tracks(): Track[];
|
|
338
|
+
get requestedBy(): User | null;
|
|
339
|
+
execute(): Promise<SearchResult>;
|
|
340
|
+
isEmpty(): boolean;
|
|
341
|
+
hasPlaylist(): boolean;
|
|
342
|
+
hasTracks(): boolean;
|
|
343
|
+
toJSON(): {
|
|
344
|
+
query: string;
|
|
345
|
+
queryType: SearchQueryType | `ext:${string}`;
|
|
346
|
+
playlist: PlaylistJSON | null;
|
|
347
|
+
tracks: TrackJSON[];
|
|
348
|
+
extractor: string | null;
|
|
349
|
+
requestedBy: {} | null;
|
|
350
|
+
};
|
|
662
351
|
}
|
|
663
352
|
|
|
664
|
-
declare
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
}
|
|
707
|
-
/**
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
* @property {string} [indicator] The indicator
|
|
767
|
-
*/
|
|
768
|
-
interface PlayerProgressbarOptions {
|
|
769
|
-
timecodes?: boolean;
|
|
770
|
-
length?: number;
|
|
771
|
-
line?: string;
|
|
772
|
-
indicator?: string;
|
|
773
|
-
queue?: boolean;
|
|
774
|
-
}
|
|
775
|
-
/**
|
|
776
|
-
* @typedef {object} PlayerOptions
|
|
777
|
-
* @property {boolean} [leaveOnEnd=true] If it should leave on end
|
|
778
|
-
* @property {boolean} [leaveOnStop=true] If it should leave on stop
|
|
779
|
-
* @property {boolean} [leaveOnEmpty=true] If it should leave on empty
|
|
780
|
-
* @property {number} [leaveOnEmptyCooldown=1000] The cooldown in ms
|
|
781
|
-
* @property {number} [leaveOnEndCooldown=1000] The cooldown in ms
|
|
782
|
-
* @property {boolean} [autoSelfDeaf=true] If it should set the bot in deaf mode
|
|
783
|
-
* @property {YTDLDownloadOptions} [ytdlOptions] The youtube download options
|
|
784
|
-
* @property {number} [initialVolume=100] The initial player volume
|
|
785
|
-
* @property {number} [bufferingTimeout=3000] Buffering timeout for the stream
|
|
786
|
-
* @property {boolean} [spotifyBridge=true] If player should bridge spotify source to youtube
|
|
787
|
-
* @property {boolean} [disableVolume=false] If player should disable inline volume
|
|
788
|
-
* @property {boolean} [disableEqualizer=false] If player should disable equalizer
|
|
789
|
-
* @property {number} [volumeSmoothness=0] The volume transition smoothness between volume changes (lower the value to get better result)
|
|
790
|
-
* Setting this or leaving this empty will disable this effect. Example: `volumeSmoothness: 0.1`
|
|
791
|
-
* @property {EqualizerBand[]} [equalizerBands] The equalizer bands array for 15 band equalizer.
|
|
792
|
-
* @property {Function} [onBeforeCreateStream] Runs before creating stream
|
|
793
|
-
*/
|
|
794
|
-
interface PlayerOptions {
|
|
795
|
-
leaveOnEnd?: boolean;
|
|
796
|
-
leaveOnEndCooldown?: number;
|
|
797
|
-
leaveOnStop?: boolean;
|
|
798
|
-
leaveOnEmpty?: boolean;
|
|
799
|
-
leaveOnEmptyCooldown?: number;
|
|
800
|
-
autoSelfDeaf?: boolean;
|
|
801
|
-
ytdlOptions?: downloadOptions;
|
|
802
|
-
initialVolume?: number;
|
|
803
|
-
bufferingTimeout?: number;
|
|
804
|
-
spotifyBridge?: boolean;
|
|
805
|
-
disableVolume?: boolean;
|
|
806
|
-
disableEqualizer?: boolean;
|
|
807
|
-
volumeSmoothness?: number;
|
|
808
|
-
equalizerBands?: EqualizerBand[];
|
|
809
|
-
onBeforeCreateStream?: (track: Track, source: TrackSource, queue: Queue) => Promise<Readable>;
|
|
810
|
-
}
|
|
811
|
-
/**
|
|
812
|
-
* @typedef {object} ExtractorModelData
|
|
813
|
-
* @property {object} [playlist] The playlist info (if any)
|
|
814
|
-
* @property {string} [playlist.title] The playlist title
|
|
815
|
-
* @property {string} [playlist.description] The playlist description
|
|
816
|
-
* @property {string} [playlist.thumbnail] The playlist thumbnail
|
|
817
|
-
* @property {album|playlist} [playlist.type] The playlist type: `album` | `playlist`
|
|
818
|
-
* @property {TrackSource} [playlist.source] The playlist source
|
|
819
|
-
* @property {object} [playlist.author] The playlist author
|
|
820
|
-
* @property {string} [playlist.author.name] The author name
|
|
821
|
-
* @property {string} [playlist.author.url] The author url
|
|
822
|
-
* @property {string} [playlist.id] The playlist id
|
|
823
|
-
* @property {string} [playlist.url] The playlist url
|
|
824
|
-
* @property {any} [playlist.rawPlaylist] The raw data
|
|
825
|
-
* @property {ExtractorData[]} data The data
|
|
826
|
-
*/
|
|
827
|
-
/**
|
|
828
|
-
* @typedef {object} ExtractorData
|
|
829
|
-
* @property {string} title The title
|
|
830
|
-
* @property {number} duration The duration
|
|
831
|
-
* @property {string} thumbnail The thumbnail
|
|
832
|
-
* @property {string|Readable|Duplex} engine The stream engine
|
|
833
|
-
* @property {number} views The views count
|
|
834
|
-
* @property {string} author The author
|
|
835
|
-
* @property {string} description The description
|
|
836
|
-
* @property {string} url The url
|
|
837
|
-
* @property {string} [version] The extractor version
|
|
838
|
-
* @property {TrackSource} [source="arbitrary"] The source
|
|
839
|
-
*/
|
|
840
|
-
interface ExtractorModelData {
|
|
841
|
-
playlist?: {
|
|
842
|
-
title: string;
|
|
843
|
-
description: string;
|
|
844
|
-
thumbnail: string;
|
|
845
|
-
type: "album" | "playlist";
|
|
846
|
-
source: TrackSource;
|
|
847
|
-
author: {
|
|
848
|
-
name: string;
|
|
849
|
-
url: string;
|
|
850
|
-
};
|
|
851
|
-
id: string;
|
|
852
|
-
url: string;
|
|
853
|
-
rawPlaylist?: any;
|
|
854
|
-
};
|
|
855
|
-
data: {
|
|
856
|
-
title: string;
|
|
857
|
-
duration: number;
|
|
858
|
-
thumbnail: string;
|
|
859
|
-
engine: string | Readable | Duplex;
|
|
860
|
-
views: number;
|
|
861
|
-
author: string;
|
|
862
|
-
description: string;
|
|
863
|
-
url: string;
|
|
864
|
-
version?: string;
|
|
865
|
-
source?: TrackSource;
|
|
866
|
-
}[];
|
|
867
|
-
}
|
|
868
|
-
/**
|
|
869
|
-
* The search query type
|
|
870
|
-
* This can be one of:
|
|
871
|
-
* - AUTO
|
|
872
|
-
* - YOUTUBE
|
|
873
|
-
* - YOUTUBE_PLAYLIST
|
|
874
|
-
* - SOUNDCLOUD_TRACK
|
|
875
|
-
* - SOUNDCLOUD_PLAYLIST
|
|
876
|
-
* - SOUNDCLOUD
|
|
877
|
-
* - SPOTIFY_SONG
|
|
878
|
-
* - SPOTIFY_ALBUM
|
|
879
|
-
* - SPOTIFY_PLAYLIST
|
|
880
|
-
* - FACEBOOK
|
|
881
|
-
* - VIMEO
|
|
882
|
-
* - ARBITRARY
|
|
883
|
-
* - REVERBNATION
|
|
884
|
-
* - YOUTUBE_SEARCH
|
|
885
|
-
* - YOUTUBE_VIDEO
|
|
886
|
-
* - SOUNDCLOUD_SEARCH
|
|
887
|
-
* @typedef {number} QueryType
|
|
888
|
-
*/
|
|
889
|
-
declare enum QueryType {
|
|
890
|
-
AUTO = 0,
|
|
891
|
-
YOUTUBE = 1,
|
|
892
|
-
YOUTUBE_PLAYLIST = 2,
|
|
893
|
-
SOUNDCLOUD_TRACK = 3,
|
|
894
|
-
SOUNDCLOUD_PLAYLIST = 4,
|
|
895
|
-
SOUNDCLOUD = 5,
|
|
896
|
-
SPOTIFY_SONG = 6,
|
|
897
|
-
SPOTIFY_ALBUM = 7,
|
|
898
|
-
SPOTIFY_PLAYLIST = 8,
|
|
899
|
-
FACEBOOK = 9,
|
|
900
|
-
VIMEO = 10,
|
|
901
|
-
ARBITRARY = 11,
|
|
902
|
-
REVERBNATION = 12,
|
|
903
|
-
YOUTUBE_SEARCH = 13,
|
|
904
|
-
YOUTUBE_VIDEO = 14,
|
|
905
|
-
SOUNDCLOUD_SEARCH = 15
|
|
906
|
-
}
|
|
907
|
-
/**
|
|
908
|
-
* Emitted when bot gets disconnected from a voice channel
|
|
909
|
-
* @event Player#botDisconnect
|
|
910
|
-
* @param {Queue} queue The queue
|
|
911
|
-
*/
|
|
912
|
-
/**
|
|
913
|
-
* Emitted when the voice channel is empty
|
|
914
|
-
* @event Player#channelEmpty
|
|
915
|
-
* @param {Queue} queue The queue
|
|
916
|
-
*/
|
|
917
|
-
/**
|
|
918
|
-
* Emitted when bot connects to a voice channel
|
|
919
|
-
* @event Player#connectionCreate
|
|
920
|
-
* @param {Queue} queue The queue
|
|
921
|
-
* @param {StreamDispatcher} connection The discord player connection object
|
|
922
|
-
*/
|
|
923
|
-
/**
|
|
924
|
-
* Debug information
|
|
925
|
-
* @event Player#debug
|
|
926
|
-
* @param {Queue} queue The queue
|
|
927
|
-
* @param {string} message The message
|
|
928
|
-
*/
|
|
929
|
-
/**
|
|
930
|
-
* Emitted on error
|
|
931
|
-
* <warn>This event should handled properly otherwise it may crash your process!</warn>
|
|
932
|
-
* @event Player#error
|
|
933
|
-
* @param {Queue} queue The queue
|
|
934
|
-
* @param {Error} error The error
|
|
935
|
-
*/
|
|
936
|
-
/**
|
|
937
|
-
* Emitted on connection error. Sometimes stream errors are emitted here as well.
|
|
938
|
-
* @event Player#connectionError
|
|
939
|
-
* @param {Queue} queue The queue
|
|
940
|
-
* @param {Error} error The error
|
|
941
|
-
*/
|
|
942
|
-
/**
|
|
943
|
-
* Emitted when queue ends
|
|
944
|
-
* @event Player#queueEnd
|
|
945
|
-
* @param {Queue} queue The queue
|
|
946
|
-
*/
|
|
947
|
-
/**
|
|
948
|
-
* Emitted when a single track is added
|
|
949
|
-
* @event Player#trackAdd
|
|
950
|
-
* @param {Queue} queue The queue
|
|
951
|
-
* @param {Track} track The track
|
|
952
|
-
*/
|
|
953
|
-
/**
|
|
954
|
-
* Emitted when multiple tracks are added
|
|
955
|
-
* @event Player#tracksAdd
|
|
956
|
-
* @param {Queue} queue The queue
|
|
957
|
-
* @param {Track[]} tracks The tracks
|
|
958
|
-
*/
|
|
959
|
-
/**
|
|
960
|
-
* Emitted when a track starts playing
|
|
961
|
-
* @event Player#trackStart
|
|
962
|
-
* @param {Queue} queue The queue
|
|
963
|
-
* @param {Track} track The track
|
|
964
|
-
*/
|
|
965
|
-
/**
|
|
966
|
-
* Emitted when a track ends
|
|
967
|
-
* @event Player#trackEnd
|
|
968
|
-
* @param {Queue} queue The queue
|
|
969
|
-
* @param {Track} track The track
|
|
970
|
-
*/
|
|
971
|
-
/**
|
|
972
|
-
* Emitted when a track ends
|
|
973
|
-
* @event Player#voiceStateUpdate
|
|
974
|
-
* @param {Queue} queue The queue that this update belongs to
|
|
975
|
-
* @param {VoiceState} oldState The old voice state
|
|
976
|
-
* @param {VoiceState} newState The new voice state
|
|
977
|
-
*/
|
|
978
|
-
interface PlayerEvents {
|
|
979
|
-
botDisconnect: (queue: Queue) => any;
|
|
980
|
-
channelEmpty: (queue: Queue) => any;
|
|
981
|
-
connectionCreate: (queue: Queue, connection: StreamDispatcher) => any;
|
|
982
|
-
debug: (queue: Queue, message: string) => any;
|
|
983
|
-
error: (queue: Queue, error: Error) => any;
|
|
984
|
-
connectionError: (queue: Queue, error: Error) => any;
|
|
985
|
-
queueEnd: (queue: Queue) => any;
|
|
986
|
-
trackAdd: (queue: Queue, track: Track) => any;
|
|
987
|
-
tracksAdd: (queue: Queue, track: Track[]) => any;
|
|
988
|
-
trackStart: (queue: Queue, track: Track) => any;
|
|
989
|
-
trackEnd: (queue: Queue, track: Track) => any;
|
|
990
|
-
voiceStateUpdate: (queue: Queue, oldState: VoiceState, newState: VoiceState) => any;
|
|
991
|
-
}
|
|
992
|
-
/**
|
|
993
|
-
* @typedef {object} PlayOptions
|
|
994
|
-
* @property {boolean} [filtersUpdate=false] If this play was triggered for filters update
|
|
995
|
-
* @property {string[]} [encoderArgs=[]] FFmpeg args passed to encoder
|
|
996
|
-
* @property {number} [seek] Time to seek to before playing
|
|
997
|
-
* @property {boolean} [immediate=false] If it should start playing the provided track immediately
|
|
998
|
-
*/
|
|
999
|
-
interface PlayOptions {
|
|
1000
|
-
filtersUpdate?: boolean;
|
|
1001
|
-
encoderArgs?: string[];
|
|
1002
|
-
seek?: number;
|
|
1003
|
-
immediate?: boolean;
|
|
1004
|
-
}
|
|
1005
|
-
/**
|
|
1006
|
-
* @typedef {object} SearchOptions
|
|
1007
|
-
* @property {UserResolvable} requestedBy The user who requested this search
|
|
1008
|
-
* @property {QueryType|string} [searchEngine=QueryType.AUTO] The query search engine, can be extractor name to target specific one (custom)
|
|
1009
|
-
* @property {boolean} [blockExtractor=false] If it should block custom extractors
|
|
1010
|
-
*/
|
|
1011
|
-
interface SearchOptions {
|
|
1012
|
-
requestedBy: UserResolvable;
|
|
1013
|
-
searchEngine?: QueryType | string;
|
|
1014
|
-
blockExtractor?: boolean;
|
|
1015
|
-
}
|
|
1016
|
-
/**
|
|
1017
|
-
* The queue repeat mode. This can be one of:
|
|
1018
|
-
* - OFF
|
|
1019
|
-
* - TRACK
|
|
1020
|
-
* - QUEUE
|
|
1021
|
-
* - AUTOPLAY
|
|
1022
|
-
* @typedef {number} QueueRepeatMode
|
|
1023
|
-
*/
|
|
1024
|
-
declare enum QueueRepeatMode {
|
|
1025
|
-
OFF = 0,
|
|
1026
|
-
TRACK = 1,
|
|
1027
|
-
QUEUE = 2,
|
|
1028
|
-
AUTOPLAY = 3
|
|
1029
|
-
}
|
|
1030
|
-
/**
|
|
1031
|
-
* @typedef {object} PlaylistInitData
|
|
1032
|
-
* @property {Track[]} tracks The tracks of this playlist
|
|
1033
|
-
* @property {string} title The playlist title
|
|
1034
|
-
* @property {string} description The description
|
|
1035
|
-
* @property {string} thumbnail The thumbnail
|
|
1036
|
-
* @property {album|playlist} type The playlist type: `album` | `playlist`
|
|
1037
|
-
* @property {TrackSource} source The playlist source
|
|
1038
|
-
* @property {object} author The playlist author
|
|
1039
|
-
* @property {string} [author.name] The author name
|
|
1040
|
-
* @property {string} [author.url] The author url
|
|
1041
|
-
* @property {string} id The playlist id
|
|
1042
|
-
* @property {string} url The playlist url
|
|
1043
|
-
* @property {any} [rawPlaylist] The raw playlist data
|
|
1044
|
-
*/
|
|
1045
|
-
interface PlaylistInitData {
|
|
1046
|
-
tracks: Track[];
|
|
1047
|
-
title: string;
|
|
1048
|
-
description: string;
|
|
1049
|
-
thumbnail: string;
|
|
1050
|
-
type: "album" | "playlist";
|
|
1051
|
-
source: TrackSource;
|
|
1052
|
-
author: {
|
|
1053
|
-
name: string;
|
|
1054
|
-
url: string;
|
|
1055
|
-
};
|
|
1056
|
-
id: string;
|
|
1057
|
-
url: string;
|
|
1058
|
-
rawPlaylist?: any;
|
|
1059
|
-
}
|
|
1060
|
-
/**
|
|
1061
|
-
* @typedef {object} TrackJSON
|
|
1062
|
-
* @property {string} title The track title
|
|
1063
|
-
* @property {string} description The track description
|
|
1064
|
-
* @property {string} author The author
|
|
1065
|
-
* @property {string} url The url
|
|
1066
|
-
* @property {string} thumbnail The thumbnail
|
|
1067
|
-
* @property {string} duration The duration
|
|
1068
|
-
* @property {number} durationMS The duration in ms
|
|
1069
|
-
* @property {number} views The views count
|
|
1070
|
-
* @property {Snowflake} requestedBy The id of the user who requested this track
|
|
1071
|
-
* @property {PlaylistJSON} [playlist] The playlist info (if any)
|
|
1072
|
-
*/
|
|
1073
|
-
interface TrackJSON {
|
|
1074
|
-
id: Snowflake;
|
|
1075
|
-
title: string;
|
|
1076
|
-
description: string;
|
|
1077
|
-
author: string;
|
|
1078
|
-
url: string;
|
|
1079
|
-
thumbnail: string;
|
|
1080
|
-
duration: string;
|
|
1081
|
-
durationMS: number;
|
|
1082
|
-
views: number;
|
|
1083
|
-
requestedBy: Snowflake;
|
|
1084
|
-
playlist?: PlaylistJSON;
|
|
1085
|
-
}
|
|
1086
|
-
/**
|
|
1087
|
-
* @typedef {object} PlaylistJSON
|
|
1088
|
-
* @property {string} id The playlist id
|
|
1089
|
-
* @property {string} url The playlist url
|
|
1090
|
-
* @property {string} title The playlist title
|
|
1091
|
-
* @property {string} description The playlist description
|
|
1092
|
-
* @property {string} thumbnail The thumbnail
|
|
1093
|
-
* @property {album|playlist} type The playlist type: `album` | `playlist`
|
|
1094
|
-
* @property {TrackSource} source The track source
|
|
1095
|
-
* @property {object} author The playlist author
|
|
1096
|
-
* @property {string} [author.name] The author name
|
|
1097
|
-
* @property {string} [author.url] The author url
|
|
1098
|
-
* @property {TrackJSON[]} tracks The tracks data (if any)
|
|
1099
|
-
*/
|
|
1100
|
-
interface PlaylistJSON {
|
|
1101
|
-
id: string;
|
|
1102
|
-
url: string;
|
|
1103
|
-
title: string;
|
|
1104
|
-
description: string;
|
|
1105
|
-
thumbnail: string;
|
|
1106
|
-
type: "album" | "playlist";
|
|
1107
|
-
source: TrackSource;
|
|
1108
|
-
author: {
|
|
1109
|
-
name: string;
|
|
1110
|
-
url: string;
|
|
1111
|
-
};
|
|
1112
|
-
tracks: TrackJSON[];
|
|
1113
|
-
}
|
|
1114
|
-
/**
|
|
1115
|
-
* @typedef {object} PlayerInitOptions
|
|
1116
|
-
* @property {boolean} [autoRegisterExtractor=true] If it should automatically register `@discord-player/extractor`
|
|
1117
|
-
* @property {YTDLDownloadOptions} [ytdlOptions] The options passed to `ytdl-core`
|
|
1118
|
-
* @property {number} [connectionTimeout=20000] The voice connection timeout
|
|
1119
|
-
* @property {boolean} [smoothVolume=true] Toggle smooth volume transition
|
|
1120
|
-
* @property {boolean} [lagMonitor=30000] Time in ms to re-monitor event loop lag
|
|
1121
|
-
*/
|
|
1122
|
-
interface PlayerInitOptions {
|
|
1123
|
-
autoRegisterExtractor?: boolean;
|
|
1124
|
-
ytdlOptions?: downloadOptions;
|
|
1125
|
-
connectionTimeout?: number;
|
|
1126
|
-
smoothVolume?: boolean;
|
|
1127
|
-
lagMonitor?: number;
|
|
353
|
+
declare class Player extends TypedEmitter<PlayerEvents> {
|
|
354
|
+
#private;
|
|
355
|
+
readonly client: Client;
|
|
356
|
+
readonly options: PlayerInitOptions;
|
|
357
|
+
readonly queues: Collection<string, Queue<unknown>>;
|
|
358
|
+
readonly voiceUtils: VoiceUtils;
|
|
359
|
+
requiredEvents: string[];
|
|
360
|
+
extractors: ExtractorExecutionContext;
|
|
361
|
+
/**
|
|
362
|
+
* Creates new Discord Player
|
|
363
|
+
* @param {Client} client The Discord Client
|
|
364
|
+
* @param {PlayerInitOptions} [options] The player init options
|
|
365
|
+
*/
|
|
366
|
+
constructor(client: Client, options?: PlayerInitOptions);
|
|
367
|
+
/**
|
|
368
|
+
* Event loop lag
|
|
369
|
+
* @type {number}
|
|
370
|
+
*/
|
|
371
|
+
get eventLoopLag(): number;
|
|
372
|
+
/**
|
|
373
|
+
* Generates statistics
|
|
374
|
+
*/
|
|
375
|
+
generateStatistics(): {
|
|
376
|
+
guild: string;
|
|
377
|
+
memory: NodeJS.MemoryUsage;
|
|
378
|
+
tracks: number;
|
|
379
|
+
os: {
|
|
380
|
+
cpuCount: number;
|
|
381
|
+
totalMem: number;
|
|
382
|
+
freeMem: number;
|
|
383
|
+
platform: NodeJS.Platform;
|
|
384
|
+
};
|
|
385
|
+
isShard: boolean;
|
|
386
|
+
latency: {
|
|
387
|
+
client: number;
|
|
388
|
+
udp: number | undefined;
|
|
389
|
+
ws: number | undefined;
|
|
390
|
+
eventLoop: number;
|
|
391
|
+
};
|
|
392
|
+
subscribers: number;
|
|
393
|
+
connections: number;
|
|
394
|
+
extractors: number;
|
|
395
|
+
}[];
|
|
396
|
+
/**
|
|
397
|
+
* Handles voice state update
|
|
398
|
+
* @param {VoiceState} oldState The old voice state
|
|
399
|
+
* @param {VoiceState} newState The new voice state
|
|
400
|
+
* @returns {void}
|
|
401
|
+
* @private
|
|
402
|
+
*/
|
|
403
|
+
private _handleVoiceState;
|
|
404
|
+
/**
|
|
405
|
+
* Creates a queue for a guild if not available, else returns existing queue
|
|
406
|
+
* @param {GuildResolvable} guild The guild
|
|
407
|
+
* @param {PlayerOptions} queueInitOptions Queue init options
|
|
408
|
+
* @returns {Queue}
|
|
409
|
+
*/
|
|
410
|
+
createQueue<T = unknown>(guild: GuildResolvable, queueInitOptions?: PlayerOptions & {
|
|
411
|
+
metadata?: T;
|
|
412
|
+
}): Queue<T>;
|
|
413
|
+
/**
|
|
414
|
+
* Returns the queue if available
|
|
415
|
+
* @param {GuildResolvable} guild The guild id
|
|
416
|
+
* @returns {Queue | undefined}
|
|
417
|
+
*/
|
|
418
|
+
getQueue<T = unknown>(guild: GuildResolvable): Queue<T> | undefined;
|
|
419
|
+
/**
|
|
420
|
+
* Deletes a queue and returns deleted queue object
|
|
421
|
+
* @param {GuildResolvable} guild The guild id to remove
|
|
422
|
+
* @returns {Queue}
|
|
423
|
+
*/
|
|
424
|
+
deleteQueue<T = unknown>(guild: GuildResolvable): Queue<T>;
|
|
425
|
+
/**
|
|
426
|
+
* @typedef {object} PlayerSearchResult
|
|
427
|
+
* @property {Playlist} [playlist] The playlist (if any)
|
|
428
|
+
* @property {Track[]} tracks The tracks
|
|
429
|
+
*/
|
|
430
|
+
/**
|
|
431
|
+
* Search tracks
|
|
432
|
+
* @param {string|Track} query The search query
|
|
433
|
+
* @param {SearchOptions} options The search options
|
|
434
|
+
* @returns {Promise<SearchResult>}
|
|
435
|
+
*/
|
|
436
|
+
search(query: string | Track, options: SearchOptions): Promise<SearchResult>;
|
|
437
|
+
/**
|
|
438
|
+
* Generates a report of the dependencies used by the `@discordjs/voice` module. Useful for debugging.
|
|
439
|
+
* @returns {string}
|
|
440
|
+
*/
|
|
441
|
+
scanDeps(): string;
|
|
442
|
+
emit<U extends keyof PlayerEvents>(eventName: U, ...args: Parameters<PlayerEvents[U]>): boolean;
|
|
443
|
+
/**
|
|
444
|
+
* Resolves queue
|
|
445
|
+
* @param {GuildResolvable|Queue} queueLike Queue like object
|
|
446
|
+
* @returns {Queue}
|
|
447
|
+
*/
|
|
448
|
+
resolveQueue<T>(queueLike: GuildResolvable | Queue): Queue<T>;
|
|
449
|
+
[Symbol.iterator](): Generator<Queue<unknown>, void, undefined>;
|
|
450
|
+
/**
|
|
451
|
+
* Creates `Playlist` instance
|
|
452
|
+
* @param data The data to initialize a playlist
|
|
453
|
+
*/
|
|
454
|
+
createPlaylist(data: PlaylistInitData): Playlist;
|
|
1128
455
|
}
|
|
1129
456
|
|
|
1130
|
-
declare class
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
*
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
457
|
+
declare class Queue<T = unknown> {
|
|
458
|
+
#private;
|
|
459
|
+
readonly guild: Guild;
|
|
460
|
+
readonly player: Player;
|
|
461
|
+
connection: StreamDispatcher;
|
|
462
|
+
tracks: Track[];
|
|
463
|
+
previousTracks: Track[];
|
|
464
|
+
options: PlayerOptions;
|
|
465
|
+
playing: boolean;
|
|
466
|
+
metadata?: T | null;
|
|
467
|
+
repeatMode: QueueRepeatMode;
|
|
468
|
+
readonly id: string;
|
|
469
|
+
private _streamTime;
|
|
470
|
+
_cooldownsTimeout: Collection<string, NodeJS.Timeout>;
|
|
471
|
+
private _activeFilters;
|
|
472
|
+
private _filtersUpdate;
|
|
473
|
+
private _lastEQBands;
|
|
474
|
+
private _lastAudioFilters;
|
|
475
|
+
private _lastBiquadFilter;
|
|
476
|
+
onBeforeCreateStream: (track: Track, source: SearchQueryType, queue: Queue) => Promise<Readable | undefined>;
|
|
477
|
+
/**
|
|
478
|
+
* Queue constructor
|
|
479
|
+
* @param {Player} player The player that instantiated this queue
|
|
480
|
+
* @param {Guild} guild The guild that instantiated this queue
|
|
481
|
+
* @param {PlayerOptions} [options] Player options for the queue
|
|
482
|
+
*/
|
|
483
|
+
constructor(player: Player, guild: Guild, options?: PlayerOptions);
|
|
484
|
+
/**
|
|
485
|
+
* Whether or not the PCM filterer is available
|
|
486
|
+
*/
|
|
487
|
+
isFiltersAvailable(): boolean;
|
|
488
|
+
/**
|
|
489
|
+
* The PCM filterer
|
|
490
|
+
*/
|
|
491
|
+
get filters(): _discord_player_equalizer.AudioFilter | null;
|
|
492
|
+
/**
|
|
493
|
+
* Check if biquad filter is available
|
|
494
|
+
*/
|
|
495
|
+
isBiquadEnabled(): boolean;
|
|
496
|
+
/**
|
|
497
|
+
* Check if the equalizer is turned off
|
|
498
|
+
*/
|
|
499
|
+
isBiquadOff(): boolean;
|
|
500
|
+
/**
|
|
501
|
+
* Toggles biquad on/off
|
|
502
|
+
*/
|
|
503
|
+
toggleBiquad(): boolean;
|
|
504
|
+
/**
|
|
505
|
+
* Enables biquad
|
|
506
|
+
*/
|
|
507
|
+
enableBiquad(): boolean;
|
|
508
|
+
/**
|
|
509
|
+
* Disables biquad
|
|
510
|
+
*/
|
|
511
|
+
disableBiquad(): boolean;
|
|
512
|
+
/**
|
|
513
|
+
* Biquad filter setter
|
|
514
|
+
*/
|
|
515
|
+
setBiquadFilter(filter: BiquadFilters): void;
|
|
516
|
+
/**
|
|
517
|
+
* Get active biquad filter name
|
|
518
|
+
*/
|
|
519
|
+
getBiquadFilterName(): BiquadFilters | null | undefined;
|
|
520
|
+
/**
|
|
521
|
+
* Returns current biquad filter
|
|
522
|
+
*/
|
|
523
|
+
getBiquadFilter(): BiquadFilters | undefined;
|
|
524
|
+
/**
|
|
525
|
+
* Set biquad filter gain value
|
|
526
|
+
* @param gain The gain to set
|
|
527
|
+
*/
|
|
528
|
+
setBiquadGain(gain: number): void | undefined;
|
|
529
|
+
/**
|
|
530
|
+
* Set biquad cutoff frequency value
|
|
531
|
+
* @param val The value to set
|
|
532
|
+
*/
|
|
533
|
+
setBiquadCutoff(val: number): void | undefined;
|
|
534
|
+
/**
|
|
535
|
+
* Set biquad sample rate value
|
|
536
|
+
* @param val The value to set
|
|
537
|
+
*/
|
|
538
|
+
setBiquadSampleRate(val: number): void | undefined;
|
|
539
|
+
/**
|
|
540
|
+
* Set biquad Q value
|
|
541
|
+
* @param val The value to set
|
|
542
|
+
*/
|
|
543
|
+
setBiquadQ(val: number): void | undefined;
|
|
544
|
+
/**
|
|
545
|
+
* Set equalizer bands
|
|
546
|
+
* @param bands Equalizer band multiplier array
|
|
547
|
+
*/
|
|
548
|
+
setEqualizer(bands?: EqualizerBand[]): boolean;
|
|
549
|
+
/**
|
|
550
|
+
* Set particular equalizer band multiplier
|
|
551
|
+
* @param band The band to update
|
|
552
|
+
* @param gain The gain
|
|
553
|
+
*/
|
|
554
|
+
setEqualizerBand(band: number, gain: number): true | null;
|
|
555
|
+
/**
|
|
556
|
+
* Returns gain value of specific equalizer band
|
|
557
|
+
* @param band The band to get value of
|
|
558
|
+
*/
|
|
559
|
+
getEqualizerBand(band: number): number | null;
|
|
560
|
+
/**
|
|
561
|
+
* Returns entire equalizer bands
|
|
562
|
+
*/
|
|
563
|
+
getEqualizer(): EqualizerBand[];
|
|
564
|
+
/**
|
|
565
|
+
* Check if equalizer is enabled
|
|
566
|
+
*/
|
|
567
|
+
isEqualizerEnabled(): boolean;
|
|
568
|
+
/**
|
|
569
|
+
* Check if the equalizer is turned off
|
|
570
|
+
*/
|
|
571
|
+
isEqualizerOff(): boolean;
|
|
572
|
+
/**
|
|
573
|
+
* Toggles equalizer on/off
|
|
574
|
+
*/
|
|
575
|
+
toggleEqualizer(): boolean;
|
|
576
|
+
/**
|
|
577
|
+
* Enables equalizer
|
|
578
|
+
*/
|
|
579
|
+
enableEqualizer(): boolean;
|
|
580
|
+
/**
|
|
581
|
+
* Disables equalizer
|
|
582
|
+
*/
|
|
583
|
+
disableEqualizer(): boolean;
|
|
584
|
+
/**
|
|
585
|
+
* Forces next play
|
|
586
|
+
* @returns {Promise<void>}
|
|
587
|
+
*/
|
|
588
|
+
forceNext(): Promise<void>;
|
|
589
|
+
/**
|
|
590
|
+
* Returns current track
|
|
591
|
+
* @type {Track}
|
|
592
|
+
*/
|
|
593
|
+
get current(): Track | undefined;
|
|
594
|
+
/**
|
|
595
|
+
* If this queue is destroyed
|
|
596
|
+
* @type {boolean}
|
|
597
|
+
*/
|
|
598
|
+
get destroyed(): boolean;
|
|
599
|
+
/**
|
|
600
|
+
* Returns current track
|
|
601
|
+
* @returns {Track}
|
|
602
|
+
*/
|
|
603
|
+
nowPlaying(): Track | undefined;
|
|
604
|
+
/**
|
|
605
|
+
* Connects to a voice channel
|
|
606
|
+
* @param {GuildChannelResolvable} channel The voice/stage channel
|
|
607
|
+
* @returns {Promise<Queue>}
|
|
608
|
+
*/
|
|
609
|
+
connect(channel: GuildChannelResolvable): Promise<this | undefined>;
|
|
610
|
+
private emitEnd;
|
|
611
|
+
private refreshEndCooldown;
|
|
612
|
+
/**
|
|
613
|
+
* Destroys this queue
|
|
614
|
+
* @param {boolean} [disconnect=this.options.leaveOnStop] If it should leave on destroy
|
|
615
|
+
* @returns {void}
|
|
616
|
+
*/
|
|
617
|
+
destroy(disconnect?: boolean | undefined): void;
|
|
618
|
+
/**
|
|
619
|
+
* Skips current track
|
|
620
|
+
* @returns {boolean}
|
|
621
|
+
*/
|
|
622
|
+
skip(): boolean | undefined;
|
|
623
|
+
/**
|
|
624
|
+
* Adds single track to the queue
|
|
625
|
+
* @param {Track} track The track to add
|
|
626
|
+
* @returns {void}
|
|
627
|
+
*/
|
|
628
|
+
addTrack(track: Track): void;
|
|
629
|
+
/**
|
|
630
|
+
* Adds multiple tracks to the queue
|
|
631
|
+
* @param {Track[]} tracks Array of tracks to add
|
|
632
|
+
*/
|
|
633
|
+
addTracks(tracks: Track[]): void;
|
|
634
|
+
/**
|
|
635
|
+
* Sets paused state
|
|
636
|
+
* @param {boolean} paused The paused state
|
|
637
|
+
* @returns {boolean}
|
|
638
|
+
*/
|
|
639
|
+
setPaused(paused?: boolean): boolean;
|
|
640
|
+
/**
|
|
641
|
+
* If the player is currently paused
|
|
642
|
+
*/
|
|
643
|
+
get paused(): boolean;
|
|
644
|
+
set paused(val: boolean);
|
|
645
|
+
/**
|
|
646
|
+
* Pause the playback
|
|
647
|
+
*/
|
|
648
|
+
pause(): boolean;
|
|
649
|
+
/**
|
|
650
|
+
* Resume the playback
|
|
651
|
+
*/
|
|
652
|
+
resume(): boolean;
|
|
653
|
+
/**
|
|
654
|
+
* Sets bitrate
|
|
655
|
+
* @param {number|auto} bitrate bitrate to set
|
|
656
|
+
* @returns {void}
|
|
657
|
+
*/
|
|
658
|
+
setBitrate(bitrate: number | 'auto'): void;
|
|
659
|
+
/**
|
|
660
|
+
* Sets volume
|
|
661
|
+
* @param {number} amount The volume amount
|
|
662
|
+
* @returns {boolean}
|
|
663
|
+
*/
|
|
664
|
+
setVolume(amount: number): boolean | undefined;
|
|
665
|
+
/**
|
|
666
|
+
* Sets repeat mode
|
|
667
|
+
* @param {QueueRepeatMode} mode The repeat mode
|
|
668
|
+
* @returns {boolean}
|
|
669
|
+
*/
|
|
670
|
+
setRepeatMode(mode: QueueRepeatMode): boolean | undefined;
|
|
671
|
+
/**
|
|
672
|
+
* The current volume amount
|
|
673
|
+
* @type {number}
|
|
674
|
+
*/
|
|
675
|
+
get volume(): number;
|
|
676
|
+
set volume(amount: number);
|
|
677
|
+
/**
|
|
678
|
+
* The stream time of this queue
|
|
679
|
+
* @type {number}
|
|
680
|
+
*/
|
|
681
|
+
get streamTime(): number;
|
|
682
|
+
set streamTime(time: number);
|
|
683
|
+
/**
|
|
684
|
+
* Returns enabled filters
|
|
685
|
+
* @returns {AudioFilters}
|
|
686
|
+
*/
|
|
687
|
+
getFiltersEnabled(): (keyof QueueFilters)[] | undefined;
|
|
688
|
+
/**
|
|
689
|
+
* Returns disabled filters
|
|
690
|
+
* @returns {AudioFilters}
|
|
691
|
+
*/
|
|
692
|
+
getFiltersDisabled(): (keyof QueueFilters)[] | undefined;
|
|
693
|
+
/**
|
|
694
|
+
* Sets filters
|
|
695
|
+
* @param {QueueFilters} filters Queue filters
|
|
696
|
+
* @returns {Promise<void>}
|
|
697
|
+
*/
|
|
698
|
+
setFilters(filters?: QueueFilters): Promise<void>;
|
|
699
|
+
/**
|
|
700
|
+
* Seeks to the given time
|
|
701
|
+
* @param {number} position The position
|
|
702
|
+
* @returns {boolean}
|
|
703
|
+
*/
|
|
704
|
+
seek(position: number): Promise<boolean | undefined>;
|
|
705
|
+
/**
|
|
706
|
+
* Plays previous track
|
|
707
|
+
* @returns {Promise<void>}
|
|
708
|
+
*/
|
|
709
|
+
back(): Promise<void>;
|
|
710
|
+
/**
|
|
711
|
+
* Clear this queue
|
|
712
|
+
*/
|
|
713
|
+
clear(): void;
|
|
714
|
+
/**
|
|
715
|
+
* Stops the player
|
|
716
|
+
* @returns {void}
|
|
717
|
+
*/
|
|
718
|
+
stop(): void;
|
|
719
|
+
/**
|
|
720
|
+
* Shuffles this queue
|
|
721
|
+
* @returns {boolean}
|
|
722
|
+
*/
|
|
723
|
+
shuffle(): boolean | undefined;
|
|
724
|
+
/**
|
|
725
|
+
* Removes a track from the queue
|
|
726
|
+
* @param {Track|string|number} track The track to remove
|
|
727
|
+
* @returns {Track}
|
|
728
|
+
*/
|
|
729
|
+
remove(track: Track | string | number): Track | undefined;
|
|
730
|
+
/**
|
|
731
|
+
* Returns the index of the specified track. If found, returns the track index else returns -1.
|
|
732
|
+
* @param {number|Track|string} track The track
|
|
733
|
+
* @returns {number}
|
|
734
|
+
*/
|
|
735
|
+
getTrackPosition(track: number | Track | string): number | undefined;
|
|
736
|
+
/**
|
|
737
|
+
* Jumps to particular track
|
|
738
|
+
* @param {Track|number} track The track
|
|
739
|
+
* @returns {void}
|
|
740
|
+
*/
|
|
741
|
+
jump(track: Track | number): void;
|
|
742
|
+
/**
|
|
743
|
+
* Jumps to particular track, removing other tracks on the way
|
|
744
|
+
* @param {Track|number} track The track
|
|
745
|
+
* @returns {void}
|
|
746
|
+
*/
|
|
747
|
+
skipTo(track: Track | number): void;
|
|
748
|
+
/**
|
|
749
|
+
* Inserts the given track to specified index
|
|
750
|
+
* @param {Track} track The track to insert
|
|
751
|
+
* @param {number} [index=0] The index where this track should be
|
|
752
|
+
*/
|
|
753
|
+
insert(track: Track, index?: number): void;
|
|
754
|
+
/**
|
|
755
|
+
* @typedef {object} PlayerTimestamp
|
|
756
|
+
* @property {string} current The current progress
|
|
757
|
+
* @property {string} end The total time
|
|
758
|
+
* @property {number} progress Progress in %
|
|
759
|
+
*/
|
|
760
|
+
/**
|
|
761
|
+
* Returns player stream timestamp
|
|
762
|
+
* @returns {PlayerTimestamp}
|
|
763
|
+
*/
|
|
764
|
+
getPlayerTimestamp(): {
|
|
765
|
+
current: string;
|
|
766
|
+
end: string;
|
|
767
|
+
progress: number;
|
|
768
|
+
} | undefined;
|
|
769
|
+
/**
|
|
770
|
+
* Creates progress bar string
|
|
771
|
+
* @param {PlayerProgressbarOptions} options The progress bar options
|
|
772
|
+
* @returns {string}
|
|
773
|
+
*/
|
|
774
|
+
createProgressBar(options?: PlayerProgressbarOptions): string | undefined;
|
|
775
|
+
/**
|
|
776
|
+
* Total duration
|
|
777
|
+
* @type {Number}
|
|
778
|
+
*/
|
|
779
|
+
get totalTime(): number;
|
|
780
|
+
/**
|
|
781
|
+
* Generates statistics
|
|
782
|
+
*/
|
|
783
|
+
generateStatistics(): {
|
|
784
|
+
guild: string;
|
|
785
|
+
memory: NodeJS.MemoryUsage;
|
|
786
|
+
tracks: number;
|
|
787
|
+
os: {
|
|
788
|
+
cpuCount: number;
|
|
789
|
+
totalMem: number;
|
|
790
|
+
freeMem: number;
|
|
791
|
+
platform: NodeJS.Platform;
|
|
792
|
+
};
|
|
793
|
+
isShard: boolean;
|
|
794
|
+
latency: {
|
|
795
|
+
client: number;
|
|
796
|
+
udp: number | undefined;
|
|
797
|
+
ws: number | undefined;
|
|
798
|
+
eventLoop: number;
|
|
799
|
+
};
|
|
800
|
+
subscribers: number;
|
|
801
|
+
connections: number;
|
|
802
|
+
extractors: number;
|
|
803
|
+
};
|
|
804
|
+
/**
|
|
805
|
+
* Voice connection latency in ms
|
|
806
|
+
* @type {number}
|
|
807
|
+
*/
|
|
808
|
+
get ping(): number | undefined;
|
|
809
|
+
/**
|
|
810
|
+
* Play stream in a voice/stage channel
|
|
811
|
+
* @param {Track} [src] The track to play (if empty, uses first track from the queue)
|
|
812
|
+
* @param {PlayOptions} [options] The options
|
|
813
|
+
* @returns {Promise<void>}
|
|
814
|
+
*/
|
|
815
|
+
play(src?: Track, options?: PlayOptions): Promise<void>;
|
|
816
|
+
/**
|
|
817
|
+
* Private method to handle autoplay
|
|
818
|
+
* @param {Track} track The source track to find its similar track for autoplay
|
|
819
|
+
* @returns {Promise<void>}
|
|
820
|
+
* @private
|
|
821
|
+
*/
|
|
822
|
+
private _handleAutoplay;
|
|
823
|
+
[Symbol.iterator](): Generator<Track, void, undefined>;
|
|
824
|
+
/**
|
|
825
|
+
* JSON representation of this queue
|
|
826
|
+
* @returns {object}
|
|
827
|
+
*/
|
|
828
|
+
toJSON(): {
|
|
829
|
+
id: string;
|
|
830
|
+
guild: string;
|
|
831
|
+
voiceChannel: string;
|
|
832
|
+
options: PlayerOptions;
|
|
833
|
+
tracks: TrackJSON[];
|
|
834
|
+
} | undefined;
|
|
835
|
+
/**
|
|
836
|
+
* String representation of this queue
|
|
837
|
+
* @returns {string}
|
|
838
|
+
*/
|
|
839
|
+
toString(): string | undefined;
|
|
1162
840
|
}
|
|
1163
841
|
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
842
|
+
type FiltersName = keyof QueueFilters;
|
|
843
|
+
interface PlayerSearchResult {
|
|
844
|
+
playlist: Playlist | null;
|
|
845
|
+
tracks: Track[];
|
|
846
|
+
}
|
|
847
|
+
/**
|
|
848
|
+
* @typedef {AudioFilters} QueueFilters
|
|
849
|
+
*/
|
|
850
|
+
interface QueueFilters {
|
|
851
|
+
bassboost_low?: boolean;
|
|
852
|
+
bassboost?: boolean;
|
|
853
|
+
bassboost_high?: boolean;
|
|
854
|
+
'8D'?: boolean;
|
|
855
|
+
vaporwave?: boolean;
|
|
856
|
+
nightcore?: boolean;
|
|
857
|
+
phaser?: boolean;
|
|
858
|
+
tremolo?: boolean;
|
|
859
|
+
vibrato?: boolean;
|
|
860
|
+
reverse?: boolean;
|
|
861
|
+
treble?: boolean;
|
|
862
|
+
normalizer?: boolean;
|
|
863
|
+
normalizer2?: boolean;
|
|
864
|
+
surrounding?: boolean;
|
|
865
|
+
pulsator?: boolean;
|
|
866
|
+
subboost?: boolean;
|
|
867
|
+
karaoke?: boolean;
|
|
868
|
+
flanger?: boolean;
|
|
869
|
+
gate?: boolean;
|
|
870
|
+
haas?: boolean;
|
|
871
|
+
mcompand?: boolean;
|
|
872
|
+
mono?: boolean;
|
|
873
|
+
mstlr?: boolean;
|
|
874
|
+
mstrr?: boolean;
|
|
875
|
+
compressor?: boolean;
|
|
876
|
+
expander?: boolean;
|
|
877
|
+
softlimiter?: boolean;
|
|
878
|
+
chorus?: boolean;
|
|
879
|
+
chorus2d?: boolean;
|
|
880
|
+
chorus3d?: boolean;
|
|
881
|
+
fadein?: boolean;
|
|
882
|
+
dim?: boolean;
|
|
883
|
+
earrape?: boolean;
|
|
884
|
+
}
|
|
885
|
+
/**
|
|
886
|
+
* The track source:
|
|
887
|
+
* - soundcloud
|
|
888
|
+
* - youtube
|
|
889
|
+
* - spotify
|
|
890
|
+
* - apple_music
|
|
891
|
+
* - arbitrary
|
|
892
|
+
* @typedef {string} TrackSource
|
|
893
|
+
*/
|
|
894
|
+
type TrackSource = 'soundcloud' | 'youtube' | 'spotify' | 'apple_music' | 'arbitrary';
|
|
895
|
+
/**
|
|
896
|
+
* @typedef {object} RawTrackData
|
|
897
|
+
* @property {string} title The title
|
|
898
|
+
* @property {string} description The description
|
|
899
|
+
* @property {string} author The author
|
|
900
|
+
* @property {string} url The url
|
|
901
|
+
* @property {string} thumbnail The thumbnail
|
|
902
|
+
* @property {string} duration The duration
|
|
903
|
+
* @property {number} views The views
|
|
904
|
+
* @property {User} requestedBy The user who requested this track
|
|
905
|
+
* @property {Playlist} [playlist] The playlist
|
|
906
|
+
* @property {TrackSource} [source="arbitrary"] The source
|
|
907
|
+
* @property {any} [engine] The engine
|
|
908
|
+
* @property {boolean} [live] If this track is live
|
|
909
|
+
* @property {any} [raw] The raw data
|
|
910
|
+
*/
|
|
911
|
+
interface RawTrackData {
|
|
912
|
+
title: string;
|
|
913
|
+
description: string;
|
|
914
|
+
author: string;
|
|
915
|
+
url: string;
|
|
916
|
+
thumbnail: string;
|
|
917
|
+
duration: string;
|
|
918
|
+
views: number;
|
|
919
|
+
requestedBy?: User | null;
|
|
920
|
+
playlist?: Playlist;
|
|
921
|
+
source?: TrackSource;
|
|
922
|
+
engine?: any;
|
|
923
|
+
live?: boolean;
|
|
924
|
+
raw?: any;
|
|
925
|
+
queryType?: SearchQueryType;
|
|
926
|
+
}
|
|
927
|
+
/**
|
|
928
|
+
* @typedef {object} TimeData
|
|
929
|
+
* @property {number} days Time in days
|
|
930
|
+
* @property {number} hours Time in hours
|
|
931
|
+
* @property {number} minutes Time in minutes
|
|
932
|
+
* @property {number} seconds Time in seconds
|
|
933
|
+
*/
|
|
934
|
+
interface TimeData {
|
|
935
|
+
days: number;
|
|
936
|
+
hours: number;
|
|
937
|
+
minutes: number;
|
|
938
|
+
seconds: number;
|
|
939
|
+
}
|
|
940
|
+
/**
|
|
941
|
+
* @typedef {object} PlayerProgressbarOptions
|
|
942
|
+
* @property {boolean} [timecodes] If it should render time codes
|
|
943
|
+
* @property {boolean} [queue] If it should create progress bar for the whole queue
|
|
944
|
+
* @property {number} [length] The bar length
|
|
945
|
+
* @property {string} [line] The bar track
|
|
946
|
+
* @property {string} [indicator] The indicator
|
|
947
|
+
*/
|
|
948
|
+
interface PlayerProgressbarOptions {
|
|
949
|
+
timecodes?: boolean;
|
|
950
|
+
length?: number;
|
|
951
|
+
line?: string;
|
|
952
|
+
indicator?: string;
|
|
953
|
+
queue?: boolean;
|
|
954
|
+
}
|
|
955
|
+
/**
|
|
956
|
+
* @typedef {object} PlayerOptions
|
|
957
|
+
* @property {boolean} [leaveOnEnd=true] If it should leave on end
|
|
958
|
+
* @property {boolean} [leaveOnStop=true] If it should leave on stop
|
|
959
|
+
* @property {boolean} [leaveOnEmpty=true] If it should leave on empty
|
|
960
|
+
* @property {number} [leaveOnEmptyCooldown=1000] The cooldown in ms
|
|
961
|
+
* @property {number} [leaveOnEndCooldown=1000] The cooldown in ms
|
|
962
|
+
* @property {boolean} [autoSelfDeaf=true] If it should set the bot in deaf mode
|
|
963
|
+
* @property {YTDLDownloadOptions} [ytdlOptions] The youtube download options
|
|
964
|
+
* @property {number} [initialVolume=100] The initial player volume
|
|
965
|
+
* @property {number} [bufferingTimeout=3000] Buffering timeout for the stream
|
|
966
|
+
* @property {boolean} [spotifyBridge=true] If player should bridge spotify source to youtube
|
|
967
|
+
* @property {boolean} [disableVolume=false] If player should disable inline volume
|
|
968
|
+
* @property {boolean} [disableEqualizer=false] If player should disable equalizer
|
|
969
|
+
* @property {boolean} [disableBiquad=false] If player should disable biquad
|
|
970
|
+
* @property {number} [volumeSmoothness=0] The volume transition smoothness between volume changes (lower the value to get better result)
|
|
971
|
+
* Setting this or leaving this empty will disable this effect. Example: `volumeSmoothness: 0.1`
|
|
972
|
+
* @property {EqualizerBand[]} [equalizerBands] The equalizer bands array for 15 band equalizer.
|
|
973
|
+
* @property {BiquadFilters} [biquadFilter] The biquad filter initializer value
|
|
974
|
+
* @property {boolean} [disableFilters] Disable/enable PCM filter
|
|
975
|
+
* @property {PCMFilters[]} [defaultFilters] The PCM filters initializer
|
|
976
|
+
* @property {Function} [onBeforeCreateStream] Runs before creating stream
|
|
977
|
+
*/
|
|
978
|
+
interface PlayerOptions {
|
|
979
|
+
leaveOnEnd?: boolean;
|
|
980
|
+
leaveOnEndCooldown?: number;
|
|
981
|
+
leaveOnStop?: boolean;
|
|
982
|
+
leaveOnEmpty?: boolean;
|
|
983
|
+
leaveOnEmptyCooldown?: number;
|
|
984
|
+
autoSelfDeaf?: boolean;
|
|
985
|
+
ytdlOptions?: downloadOptions;
|
|
986
|
+
initialVolume?: number;
|
|
987
|
+
bufferingTimeout?: number;
|
|
988
|
+
spotifyBridge?: boolean;
|
|
989
|
+
disableVolume?: boolean;
|
|
990
|
+
disableEqualizer?: boolean;
|
|
991
|
+
disableBiquad?: boolean;
|
|
992
|
+
volumeSmoothness?: number;
|
|
993
|
+
equalizerBands?: EqualizerBand[];
|
|
994
|
+
biquadFilter?: BiquadFilters;
|
|
995
|
+
disableFilters?: boolean;
|
|
996
|
+
defaultFilters?: PCMFilters[];
|
|
997
|
+
onBeforeCreateStream?: (track: Track, source: SearchQueryType, queue: Queue) => Promise<Readable>;
|
|
998
|
+
}
|
|
999
|
+
/**
|
|
1000
|
+
* @typedef {object} ExtractorModelData
|
|
1001
|
+
* @property {object} [playlist] The playlist info (if any)
|
|
1002
|
+
* @property {string} [playlist.title] The playlist title
|
|
1003
|
+
* @property {string} [playlist.description] The playlist description
|
|
1004
|
+
* @property {string} [playlist.thumbnail] The playlist thumbnail
|
|
1005
|
+
* @property {album|playlist} [playlist.type] The playlist type: `album` | `playlist`
|
|
1006
|
+
* @property {TrackSource} [playlist.source] The playlist source
|
|
1007
|
+
* @property {object} [playlist.author] The playlist author
|
|
1008
|
+
* @property {string} [playlist.author.name] The author name
|
|
1009
|
+
* @property {string} [playlist.author.url] The author url
|
|
1010
|
+
* @property {string} [playlist.id] The playlist id
|
|
1011
|
+
* @property {string} [playlist.url] The playlist url
|
|
1012
|
+
* @property {any} [playlist.rawPlaylist] The raw data
|
|
1013
|
+
* @property {ExtractorData[]} data The data
|
|
1014
|
+
*/
|
|
1015
|
+
/**
|
|
1016
|
+
* @typedef {object} ExtractorData
|
|
1017
|
+
* @property {string} title The title
|
|
1018
|
+
* @property {number} duration The duration
|
|
1019
|
+
* @property {string} thumbnail The thumbnail
|
|
1020
|
+
* @property {string|Readable|Duplex} engine The stream engine
|
|
1021
|
+
* @property {number} views The views count
|
|
1022
|
+
* @property {string} author The author
|
|
1023
|
+
* @property {string} description The description
|
|
1024
|
+
* @property {string} url The url
|
|
1025
|
+
* @property {string} [version] The extractor version
|
|
1026
|
+
* @property {TrackSource} [source="arbitrary"] The source
|
|
1027
|
+
*/
|
|
1028
|
+
interface ExtractorModelData {
|
|
1029
|
+
playlist?: {
|
|
1030
|
+
title: string;
|
|
1031
|
+
description: string;
|
|
1032
|
+
thumbnail: string;
|
|
1033
|
+
type: 'album' | 'playlist';
|
|
1034
|
+
source: TrackSource;
|
|
1035
|
+
author: {
|
|
1036
|
+
name: string;
|
|
1037
|
+
url: string;
|
|
1038
|
+
};
|
|
1039
|
+
id: string;
|
|
1040
|
+
url: string;
|
|
1041
|
+
rawPlaylist?: any;
|
|
1042
|
+
};
|
|
1043
|
+
data: {
|
|
1044
|
+
title: string;
|
|
1045
|
+
duration: number;
|
|
1046
|
+
thumbnail: string;
|
|
1047
|
+
engine: string | Readable | Duplex;
|
|
1048
|
+
views: number;
|
|
1049
|
+
author: string;
|
|
1050
|
+
description: string;
|
|
1051
|
+
url: string;
|
|
1052
|
+
version?: string;
|
|
1053
|
+
source?: TrackSource;
|
|
1054
|
+
}[];
|
|
1055
|
+
}
|
|
1056
|
+
/**
|
|
1057
|
+
* The search query type
|
|
1058
|
+
* This can be one of:
|
|
1059
|
+
* - AUTO
|
|
1060
|
+
* - YOUTUBE
|
|
1061
|
+
* - YOUTUBE_PLAYLIST
|
|
1062
|
+
* - SOUNDCLOUD_TRACK
|
|
1063
|
+
* - SOUNDCLOUD_PLAYLIST
|
|
1064
|
+
* - SOUNDCLOUD
|
|
1065
|
+
* - SPOTIFY_SONG
|
|
1066
|
+
* - SPOTIFY_ALBUM
|
|
1067
|
+
* - SPOTIFY_PLAYLIST
|
|
1068
|
+
* - FACEBOOK
|
|
1069
|
+
* - VIMEO
|
|
1070
|
+
* - ARBITRARY
|
|
1071
|
+
* - REVERBNATION
|
|
1072
|
+
* - YOUTUBE_SEARCH
|
|
1073
|
+
* - YOUTUBE_VIDEO
|
|
1074
|
+
* - SOUNDCLOUD_SEARCH
|
|
1075
|
+
* - APPLE_MUSIC_SONG
|
|
1076
|
+
* - APPLE_MUSIC_ALBUM
|
|
1077
|
+
* - APPLE_MUSIC_PLAYLIST
|
|
1078
|
+
* - FILE
|
|
1079
|
+
* @typedef {number} QueryType
|
|
1080
|
+
*/
|
|
1081
|
+
declare const QueryType: {
|
|
1082
|
+
readonly AUTO: "auto";
|
|
1083
|
+
readonly YOUTUBE: "youtube";
|
|
1084
|
+
readonly YOUTUBE_PLAYLIST: "youtubePlaylist";
|
|
1085
|
+
readonly SOUNDCLOUD_TRACK: "soundcloudTrack";
|
|
1086
|
+
readonly SOUNDCLOUD_PLAYLIST: "soundcloudPlaylist";
|
|
1087
|
+
readonly SOUNDCLOUD: "soundcloud";
|
|
1088
|
+
readonly SPOTIFY_SONG: "spotifySong";
|
|
1089
|
+
readonly SPOTIFY_ALBUM: "spotifyAlbum";
|
|
1090
|
+
readonly SPOTIFY_PLAYLIST: "spotifyPlaylist";
|
|
1091
|
+
readonly FACEBOOK: "facebook";
|
|
1092
|
+
readonly VIMEO: "vimeo";
|
|
1093
|
+
readonly ARBITRARY: "arbitrary";
|
|
1094
|
+
readonly REVERBNATION: "reverbnation";
|
|
1095
|
+
readonly YOUTUBE_SEARCH: "youtubeSearch";
|
|
1096
|
+
readonly YOUTUBE_VIDEO: "youtubeVideo";
|
|
1097
|
+
readonly SOUNDCLOUD_SEARCH: "soundcloudSearch";
|
|
1098
|
+
readonly APPLE_MUSIC_SONG: "appleMusicSong";
|
|
1099
|
+
readonly APPLE_MUSIC_ALBUM: "appleMusicAlbum";
|
|
1100
|
+
readonly APPLE_MUSIC_PLAYLIST: "appleMusicPlaylist";
|
|
1101
|
+
readonly FILE: "file";
|
|
1102
|
+
};
|
|
1103
|
+
type SearchQueryType = keyof typeof QueryType | (typeof QueryType)[keyof typeof QueryType];
|
|
1104
|
+
/**
|
|
1105
|
+
* Emitted when bot gets disconnected from a voice channel
|
|
1106
|
+
* @event Player#botDisconnect
|
|
1107
|
+
* @param {Queue} queue The queue
|
|
1108
|
+
*/
|
|
1109
|
+
/**
|
|
1110
|
+
* Emitted when the voice channel is empty
|
|
1111
|
+
* @event Player#channelEmpty
|
|
1112
|
+
* @param {Queue} queue The queue
|
|
1113
|
+
*/
|
|
1114
|
+
/**
|
|
1115
|
+
* Emitted when bot connects to a voice channel
|
|
1116
|
+
* @event Player#connectionCreate
|
|
1117
|
+
* @param {Queue} queue The queue
|
|
1118
|
+
* @param {StreamDispatcher} connection The discord player connection object
|
|
1119
|
+
*/
|
|
1120
|
+
/**
|
|
1121
|
+
* Debug information
|
|
1122
|
+
* @event Player#debug
|
|
1123
|
+
* @param {Queue} queue The queue
|
|
1124
|
+
* @param {string} message The message
|
|
1125
|
+
*/
|
|
1126
|
+
/**
|
|
1127
|
+
* Emitted on error
|
|
1128
|
+
* <warn>This event should handled properly otherwise it may crash your process!</warn>
|
|
1129
|
+
* @event Player#error
|
|
1130
|
+
* @param {Queue} queue The queue
|
|
1131
|
+
* @param {Error} error The error
|
|
1132
|
+
*/
|
|
1133
|
+
/**
|
|
1134
|
+
* Emitted on connection error. Sometimes stream errors are emitted here as well.
|
|
1135
|
+
* @event Player#connectionError
|
|
1136
|
+
* @param {Queue} queue The queue
|
|
1137
|
+
* @param {Error} error The error
|
|
1138
|
+
*/
|
|
1139
|
+
/**
|
|
1140
|
+
* Emitted when queue ends
|
|
1141
|
+
* @event Player#queueEnd
|
|
1142
|
+
* @param {Queue} queue The queue
|
|
1143
|
+
*/
|
|
1144
|
+
/**
|
|
1145
|
+
* Emitted when a single track is added
|
|
1146
|
+
* @event Player#trackAdd
|
|
1147
|
+
* @param {Queue} queue The queue
|
|
1148
|
+
* @param {Track} track The track
|
|
1149
|
+
*/
|
|
1150
|
+
/**
|
|
1151
|
+
* Emitted when multiple tracks are added
|
|
1152
|
+
* @event Player#tracksAdd
|
|
1153
|
+
* @param {Queue} queue The queue
|
|
1154
|
+
* @param {Track[]} tracks The tracks
|
|
1155
|
+
*/
|
|
1156
|
+
/**
|
|
1157
|
+
* Emitted when a track starts playing
|
|
1158
|
+
* @event Player#trackStart
|
|
1159
|
+
* @param {Queue} queue The queue
|
|
1160
|
+
* @param {Track} track The track
|
|
1161
|
+
*/
|
|
1162
|
+
/**
|
|
1163
|
+
* Emitted when a track ends
|
|
1164
|
+
* @event Player#trackEnd
|
|
1165
|
+
* @param {Queue} queue The queue
|
|
1166
|
+
* @param {Track} track The track
|
|
1167
|
+
*/
|
|
1168
|
+
/**
|
|
1169
|
+
* Emitted when a track ends
|
|
1170
|
+
* @event Player#voiceStateUpdate
|
|
1171
|
+
* @param {Queue} queue The queue that this update belongs to
|
|
1172
|
+
* @param {VoiceState} oldState The old voice state
|
|
1173
|
+
* @param {VoiceState} newState The new voice state
|
|
1174
|
+
*/
|
|
1175
|
+
interface PlayerEvents {
|
|
1176
|
+
botDisconnect: (queue: Queue) => any;
|
|
1177
|
+
channelEmpty: (queue: Queue) => any;
|
|
1178
|
+
connectionCreate: (queue: Queue, connection: StreamDispatcher) => any;
|
|
1179
|
+
debug: (queue: Queue, message: string) => any;
|
|
1180
|
+
error: (queue: Queue, error: Error) => any;
|
|
1181
|
+
connectionError: (queue: Queue, error: Error) => any;
|
|
1182
|
+
queueEnd: (queue: Queue) => any;
|
|
1183
|
+
trackAdd: (queue: Queue, track: Track) => any;
|
|
1184
|
+
tracksAdd: (queue: Queue, track: Track[]) => any;
|
|
1185
|
+
trackStart: (queue: Queue, track: Track) => any;
|
|
1186
|
+
trackEnd: (queue: Queue, track: Track) => any;
|
|
1187
|
+
voiceStateUpdate: (queue: Queue, oldState: VoiceState, newState: VoiceState) => any;
|
|
1188
|
+
}
|
|
1189
|
+
/**
|
|
1190
|
+
* @typedef {object} PlayOptions
|
|
1191
|
+
* @property {boolean} [filtersUpdate=false] If this play was triggered for filters update
|
|
1192
|
+
* @property {string[]} [encoderArgs=[]] FFmpeg args passed to encoder
|
|
1193
|
+
* @property {number} [seek] Time to seek to before playing
|
|
1194
|
+
* @property {boolean} [immediate=false] If it should start playing the provided track immediately
|
|
1195
|
+
*/
|
|
1196
|
+
interface PlayOptions {
|
|
1197
|
+
filtersUpdate?: boolean;
|
|
1198
|
+
encoderArgs?: string[];
|
|
1199
|
+
seek?: number;
|
|
1200
|
+
immediate?: boolean;
|
|
1201
|
+
}
|
|
1202
|
+
type QueryExtractorSearch = `ext:${string}`;
|
|
1203
|
+
/**
|
|
1204
|
+
* @typedef {object} SearchOptions
|
|
1205
|
+
* @property {UserResolvable} requestedBy The user who requested this search
|
|
1206
|
+
* @property {typeof QueryType|string} [searchEngine=QueryType.AUTO] The query search engine, can be extractor name to target specific one (custom)
|
|
1207
|
+
* @property {boolean} [blockExtractor=false] If it should block custom extractors
|
|
1208
|
+
*/
|
|
1209
|
+
interface SearchOptions {
|
|
1210
|
+
requestedBy?: UserResolvable;
|
|
1211
|
+
searchEngine?: SearchQueryType | QueryExtractorSearch;
|
|
1212
|
+
blockExtractor?: boolean;
|
|
1213
|
+
}
|
|
1214
|
+
/**
|
|
1215
|
+
* The queue repeat mode. This can be one of:
|
|
1216
|
+
* - OFF
|
|
1217
|
+
* - TRACK
|
|
1218
|
+
* - QUEUE
|
|
1219
|
+
* - AUTOPLAY
|
|
1220
|
+
* @typedef {number} QueueRepeatMode
|
|
1221
|
+
*/
|
|
1222
|
+
declare enum QueueRepeatMode {
|
|
1223
|
+
OFF = 0,
|
|
1224
|
+
TRACK = 1,
|
|
1225
|
+
QUEUE = 2,
|
|
1226
|
+
AUTOPLAY = 3
|
|
1227
|
+
}
|
|
1228
|
+
/**
|
|
1229
|
+
* @typedef {object} PlaylistInitData
|
|
1230
|
+
* @property {Track[]} tracks The tracks of this playlist
|
|
1231
|
+
* @property {string} title The playlist title
|
|
1232
|
+
* @property {string} description The description
|
|
1233
|
+
* @property {string} thumbnail The thumbnail
|
|
1234
|
+
* @property {album|playlist} type The playlist type: `album` | `playlist`
|
|
1235
|
+
* @property {TrackSource} source The playlist source
|
|
1236
|
+
* @property {object} author The playlist author
|
|
1237
|
+
* @property {string} [author.name] The author name
|
|
1238
|
+
* @property {string} [author.url] The author url
|
|
1239
|
+
* @property {string} id The playlist id
|
|
1240
|
+
* @property {string} url The playlist url
|
|
1241
|
+
* @property {any} [rawPlaylist] The raw playlist data
|
|
1242
|
+
*/
|
|
1243
|
+
interface PlaylistInitData {
|
|
1244
|
+
tracks: Track[];
|
|
1245
|
+
title: string;
|
|
1246
|
+
description: string;
|
|
1247
|
+
thumbnail: string;
|
|
1248
|
+
type: 'album' | 'playlist';
|
|
1249
|
+
source: TrackSource;
|
|
1250
|
+
author: {
|
|
1251
|
+
name: string;
|
|
1252
|
+
url: string;
|
|
1253
|
+
};
|
|
1254
|
+
id: string;
|
|
1255
|
+
url: string;
|
|
1256
|
+
rawPlaylist?: any;
|
|
1257
|
+
}
|
|
1258
|
+
/**
|
|
1259
|
+
* @typedef {object} TrackJSON
|
|
1260
|
+
* @property {string} title The track title
|
|
1261
|
+
* @property {string} description The track description
|
|
1262
|
+
* @property {string} author The author
|
|
1263
|
+
* @property {string} url The url
|
|
1264
|
+
* @property {string} thumbnail The thumbnail
|
|
1265
|
+
* @property {string} duration The duration
|
|
1266
|
+
* @property {number} durationMS The duration in ms
|
|
1267
|
+
* @property {number} views The views count
|
|
1268
|
+
* @property {Snowflake} requestedBy The id of the user who requested this track
|
|
1269
|
+
* @property {PlaylistJSON} [playlist] The playlist info (if any)
|
|
1270
|
+
*/
|
|
1271
|
+
interface TrackJSON {
|
|
1272
|
+
id: Snowflake;
|
|
1273
|
+
title: string;
|
|
1274
|
+
description: string;
|
|
1275
|
+
author: string;
|
|
1276
|
+
url: string;
|
|
1277
|
+
thumbnail: string;
|
|
1278
|
+
duration: string;
|
|
1279
|
+
durationMS: number;
|
|
1280
|
+
views: number;
|
|
1281
|
+
requestedBy: Snowflake;
|
|
1282
|
+
playlist?: PlaylistJSON;
|
|
1283
|
+
}
|
|
1284
|
+
/**
|
|
1285
|
+
* @typedef {object} PlaylistJSON
|
|
1286
|
+
* @property {string} id The playlist id
|
|
1287
|
+
* @property {string} url The playlist url
|
|
1288
|
+
* @property {string} title The playlist title
|
|
1289
|
+
* @property {string} description The playlist description
|
|
1290
|
+
* @property {string} thumbnail The thumbnail
|
|
1291
|
+
* @property {album|playlist} type The playlist type: `album` | `playlist`
|
|
1292
|
+
* @property {TrackSource} source The track source
|
|
1293
|
+
* @property {object} author The playlist author
|
|
1294
|
+
* @property {string} [author.name] The author name
|
|
1295
|
+
* @property {string} [author.url] The author url
|
|
1296
|
+
* @property {TrackJSON[]} tracks The tracks data (if any)
|
|
1297
|
+
*/
|
|
1298
|
+
interface PlaylistJSON {
|
|
1299
|
+
id: string;
|
|
1300
|
+
url: string;
|
|
1301
|
+
title: string;
|
|
1302
|
+
description: string;
|
|
1303
|
+
thumbnail: string;
|
|
1304
|
+
type: 'album' | 'playlist';
|
|
1305
|
+
source: TrackSource;
|
|
1306
|
+
author: {
|
|
1307
|
+
name: string;
|
|
1308
|
+
url: string;
|
|
1309
|
+
};
|
|
1310
|
+
tracks: TrackJSON[];
|
|
1311
|
+
}
|
|
1312
|
+
/**
|
|
1313
|
+
* @typedef {object} PlayerInitOptions
|
|
1314
|
+
* @property {boolean} [autoRegisterExtractor=true] If it should automatically register `@discord-player/extractor`
|
|
1315
|
+
* @property {YTDLDownloadOptions} [ytdlOptions] The options passed to `ytdl-core`
|
|
1316
|
+
* @property {number} [connectionTimeout=20000] The voice connection timeout
|
|
1317
|
+
* @property {boolean} [smoothVolume=true] Toggle smooth volume transition
|
|
1318
|
+
* @property {boolean} [lagMonitor=30000] Time in ms to re-monitor event loop lag
|
|
1319
|
+
*/
|
|
1320
|
+
interface PlayerInitOptions {
|
|
1321
|
+
autoRegisterExtractor?: boolean;
|
|
1322
|
+
ytdlOptions?: downloadOptions;
|
|
1323
|
+
connectionTimeout?: number;
|
|
1324
|
+
smoothVolume?: boolean;
|
|
1325
|
+
lagMonitor?: number;
|
|
1194
1326
|
}
|
|
1195
1327
|
|
|
1196
|
-
declare class
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
static
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
*
|
|
1210
|
-
* @
|
|
1211
|
-
|
|
1212
|
-
|
|
1328
|
+
declare class AudioFilters {
|
|
1329
|
+
constructor();
|
|
1330
|
+
static filters: Record<FiltersName, string>;
|
|
1331
|
+
static get<K extends FiltersName>(name: K): Record<keyof QueueFilters, string>[K];
|
|
1332
|
+
static has<K extends FiltersName>(name: K): boolean;
|
|
1333
|
+
static [Symbol.iterator](): IterableIterator<{
|
|
1334
|
+
name: FiltersName;
|
|
1335
|
+
value: string;
|
|
1336
|
+
}>;
|
|
1337
|
+
static get names(): (keyof QueueFilters)[];
|
|
1338
|
+
static get length(): number;
|
|
1339
|
+
static toString(): string;
|
|
1340
|
+
/**
|
|
1341
|
+
* Create ffmpeg args from the specified filters name
|
|
1342
|
+
* @param filter The filter name
|
|
1343
|
+
* @returns
|
|
1344
|
+
*/
|
|
1345
|
+
static create<K extends FiltersName>(filters?: K[]): string;
|
|
1346
|
+
/**
|
|
1347
|
+
* Defines audio filter
|
|
1348
|
+
* @param filterName The name of the filter
|
|
1349
|
+
* @param value The ffmpeg args
|
|
1350
|
+
*/
|
|
1351
|
+
static define(filterName: string, value: string): void;
|
|
1352
|
+
/**
|
|
1353
|
+
* Defines multiple audio filters
|
|
1354
|
+
* @param filtersArray Array of filters containing the filter name and ffmpeg args
|
|
1355
|
+
*/
|
|
1356
|
+
static defineBulk(filtersArray: {
|
|
1357
|
+
name: string;
|
|
1358
|
+
value: string;
|
|
1359
|
+
}[]): void;
|
|
1213
1360
|
}
|
|
1214
1361
|
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1362
|
+
declare enum ErrorStatusCode {
|
|
1363
|
+
STREAM_ERROR = "StreamError",
|
|
1364
|
+
AUDIO_PLAYER_ERROR = "AudioPlayerError",
|
|
1365
|
+
PLAYER_ERROR = "PlayerError",
|
|
1366
|
+
NO_AUDIO_RESOURCE = "NoAudioResource",
|
|
1367
|
+
UNKNOWN_GUILD = "UnknownGuild",
|
|
1368
|
+
INVALID_ARG_TYPE = "InvalidArgType",
|
|
1369
|
+
UNKNOWN_EXTRACTOR = "UnknownExtractor",
|
|
1370
|
+
INVALID_EXTRACTOR = "InvalidExtractor",
|
|
1371
|
+
INVALID_CHANNEL_TYPE = "InvalidChannelType",
|
|
1372
|
+
INVALID_TRACK = "InvalidTrack",
|
|
1373
|
+
UNKNOWN_REPEAT_MODE = "UnknownRepeatMode",
|
|
1374
|
+
TRACK_NOT_FOUND = "TrackNotFound",
|
|
1375
|
+
NO_CONNECTION = "NoConnection",
|
|
1376
|
+
DESTROYED_QUEUE = "DestroyedQueue"
|
|
1377
|
+
}
|
|
1378
|
+
declare class PlayerError extends Error {
|
|
1379
|
+
message: string;
|
|
1380
|
+
statusCode: ErrorStatusCode;
|
|
1381
|
+
createdAt: Date;
|
|
1382
|
+
constructor(message: string, code?: ErrorStatusCode);
|
|
1383
|
+
get createdTimestamp(): number;
|
|
1384
|
+
valueOf(): ErrorStatusCode;
|
|
1385
|
+
toJSON(): {
|
|
1386
|
+
stack: string | undefined;
|
|
1387
|
+
code: ErrorStatusCode;
|
|
1388
|
+
message: string;
|
|
1389
|
+
created: number;
|
|
1390
|
+
};
|
|
1391
|
+
toString(): string | undefined;
|
|
1219
1392
|
}
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
private
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1393
|
+
|
|
1394
|
+
declare class QueryResolver {
|
|
1395
|
+
/**
|
|
1396
|
+
* Query resolver
|
|
1397
|
+
*/
|
|
1398
|
+
private constructor();
|
|
1399
|
+
static get regex(): {
|
|
1400
|
+
spotifyAlbumRegex: RegExp;
|
|
1401
|
+
spotifyPlaylistRegex: RegExp;
|
|
1402
|
+
spotifySongRegex: RegExp;
|
|
1403
|
+
vimeoRegex: RegExp;
|
|
1404
|
+
reverbnationRegex: RegExp;
|
|
1405
|
+
attachmentRegex: RegExp;
|
|
1406
|
+
appleMusicAlbumRegex: RegExp;
|
|
1407
|
+
appleMusicPlaylistRegex: RegExp;
|
|
1408
|
+
appleMusicSongRegex: RegExp;
|
|
1409
|
+
};
|
|
1410
|
+
/**
|
|
1411
|
+
* Resolves the given search query
|
|
1412
|
+
* @param {string} query The query
|
|
1413
|
+
* @returns {QueryType}
|
|
1414
|
+
*/
|
|
1415
|
+
static resolve(query: string): (typeof QueryType)[keyof typeof QueryType];
|
|
1416
|
+
/**
|
|
1417
|
+
* Parses vimeo id from url
|
|
1418
|
+
* @param {string} query The query
|
|
1419
|
+
* @returns {string}
|
|
1420
|
+
*/
|
|
1421
|
+
static getVimeoID(query: string): string | null | undefined;
|
|
1422
|
+
static validateId(q: string): boolean;
|
|
1423
|
+
static validateURL(q: string): boolean;
|
|
1245
1424
|
}
|
|
1246
1425
|
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
* Checks if the voice channel is empty
|
|
1278
|
-
* @param {VoiceChannel|StageChannel} channel The voice channel
|
|
1279
|
-
* @returns {boolean}
|
|
1280
|
-
*/
|
|
1281
|
-
static isVoiceEmpty(channel: VoiceChannel | StageChannel): boolean;
|
|
1282
|
-
/**
|
|
1283
|
-
* Safer require
|
|
1284
|
-
* @param {string} id Node require id
|
|
1285
|
-
* @returns {any}
|
|
1286
|
-
*/
|
|
1287
|
-
static require(id: string): any;
|
|
1288
|
-
/**
|
|
1289
|
-
* Asynchronous timeout
|
|
1290
|
-
* @param {number} time The time in ms to wait
|
|
1291
|
-
* @returns {Promise<unknown>}
|
|
1292
|
-
*/
|
|
1293
|
-
static wait(time: number): Promise<any>;
|
|
1294
|
-
static noop(): void;
|
|
1295
|
-
static getFetch(): Promise<any>;
|
|
1426
|
+
interface VolumeTransformerOptions extends TransformOptions {
|
|
1427
|
+
type?: 's16le' | 's16be' | 's32le' | 's32be';
|
|
1428
|
+
smoothness?: number;
|
|
1429
|
+
volume?: number;
|
|
1430
|
+
}
|
|
1431
|
+
declare class VolumeTransformer extends Transform {
|
|
1432
|
+
private _bits;
|
|
1433
|
+
private _smoothing;
|
|
1434
|
+
private _bytes;
|
|
1435
|
+
private _extremum;
|
|
1436
|
+
private _chunk;
|
|
1437
|
+
volume: number;
|
|
1438
|
+
private _targetVolume;
|
|
1439
|
+
type: 's16le' | 's32le' | 's16be' | 's32be';
|
|
1440
|
+
constructor(options?: VolumeTransformerOptions);
|
|
1441
|
+
_readInt(buffer: Buffer, index: number): number;
|
|
1442
|
+
_writeInt(buffer: Buffer, int: number, index: number): number;
|
|
1443
|
+
_applySmoothness(): void;
|
|
1444
|
+
_transform(chunk: Buffer, encoding: BufferEncoding, done: () => unknown): unknown;
|
|
1445
|
+
_destroy(err: Error, cb: (error: Error | null) => void): void;
|
|
1446
|
+
setVolume(volume: number): void;
|
|
1447
|
+
setVolumeDecibels(db: number): void;
|
|
1448
|
+
setVolumeLogarithmic(value: number): void;
|
|
1449
|
+
get volumeDecibels(): number;
|
|
1450
|
+
get volumeLogarithmic(): number;
|
|
1451
|
+
get smoothness(): number;
|
|
1452
|
+
setSmoothness(smoothness: number): void;
|
|
1453
|
+
smoothingEnabled(): boolean;
|
|
1454
|
+
get hasSmoothness(): boolean;
|
|
1455
|
+
static get hasSmoothing(): boolean;
|
|
1296
1456
|
}
|
|
1297
1457
|
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1458
|
+
declare class Util {
|
|
1459
|
+
/**
|
|
1460
|
+
* Utils
|
|
1461
|
+
*/
|
|
1462
|
+
private constructor();
|
|
1463
|
+
/**
|
|
1464
|
+
* Creates duration string
|
|
1465
|
+
* @param {object} durObj The duration object
|
|
1466
|
+
* @returns {string}
|
|
1467
|
+
*/
|
|
1468
|
+
static durationString(durObj: Record<string, number>): string;
|
|
1469
|
+
/**
|
|
1470
|
+
* Parses milliseconds to consumable time object
|
|
1471
|
+
* @param {number} milliseconds The time in ms
|
|
1472
|
+
* @returns {TimeData}
|
|
1473
|
+
*/
|
|
1474
|
+
static parseMS(milliseconds: number): TimeData;
|
|
1475
|
+
/**
|
|
1476
|
+
* Builds time code
|
|
1477
|
+
* @param {TimeData} duration The duration object
|
|
1478
|
+
* @returns {string}
|
|
1479
|
+
*/
|
|
1480
|
+
static buildTimeCode(duration: TimeData): string;
|
|
1481
|
+
/**
|
|
1482
|
+
* Picks last item of the given array
|
|
1483
|
+
* @param {any[]} arr The array
|
|
1484
|
+
* @returns {any}
|
|
1485
|
+
*/
|
|
1486
|
+
static last<T = any>(arr: T[]): T;
|
|
1487
|
+
/**
|
|
1488
|
+
* Checks if the voice channel is empty
|
|
1489
|
+
* @param {VoiceChannel|StageChannel} channel The voice channel
|
|
1490
|
+
* @returns {boolean}
|
|
1491
|
+
*/
|
|
1492
|
+
static isVoiceEmpty(channel: VoiceChannel | StageChannel): boolean;
|
|
1493
|
+
/**
|
|
1494
|
+
* Safer require
|
|
1495
|
+
* @param {string} id Node require id
|
|
1496
|
+
* @returns {any}
|
|
1497
|
+
*/
|
|
1498
|
+
static require(id: string): any;
|
|
1499
|
+
/**
|
|
1500
|
+
* Asynchronous timeout
|
|
1501
|
+
* @param {number} time The time in ms to wait
|
|
1502
|
+
* @returns {Promise<unknown>}
|
|
1503
|
+
*/
|
|
1504
|
+
static wait(time: number): Promise<undefined>;
|
|
1505
|
+
static noop(): void;
|
|
1506
|
+
static getFetch(): Promise<any>;
|
|
1303
1507
|
}
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
declare function
|
|
1508
|
+
|
|
1509
|
+
interface FFmpegStreamOptions {
|
|
1510
|
+
fmt?: string;
|
|
1511
|
+
encoderArgs?: string[];
|
|
1512
|
+
seek?: number;
|
|
1513
|
+
skip?: boolean;
|
|
1514
|
+
}
|
|
1515
|
+
declare function FFMPEG_ARGS_STRING(stream: string, fmt?: string): string[];
|
|
1516
|
+
declare function FFMPEG_ARGS_PIPED(fmt?: string): string[];
|
|
1517
|
+
/**
|
|
1518
|
+
* Creates FFmpeg stream
|
|
1519
|
+
* @param stream The source stream
|
|
1520
|
+
* @param options FFmpeg stream options
|
|
1521
|
+
*/
|
|
1522
|
+
declare function createFFmpegStream(stream: Readable | Duplex | string, options?: FFmpegStreamOptions): Readable;
|
|
1312
1523
|
|
|
1313
1524
|
declare const version: string;
|
|
1314
1525
|
|
|
1315
|
-
export { AudioFilters, ErrorStatusCode,
|
|
1526
|
+
export { AudioFilters, BaseExtractor, ErrorStatusCode, ExtractorExecutionContext, ExtractorExecutionFN, ExtractorExecutionResult, ExtractorInfo, ExtractorModelData, ExtractorSearchContext, FFMPEG_ARGS_PIPED, FFMPEG_ARGS_STRING, FFmpegStreamOptions, FiltersName, NextFunction, PlayOptions, Player, PlayerError, PlayerEvents, PlayerInitOptions, PlayerOptions, PlayerProgressbarOptions, PlayerSearchResult, Playlist, PlaylistInitData, PlaylistJSON, QueryExtractorSearch, QueryResolver, QueryType, Queue, QueueFilters, QueueRepeatMode, RawTrackData, SearchOptions, SearchQueryType, StreamDispatcher, TimeData, Track, TrackJSON, TrackSource, Util, VoiceEvents, VoiceUtils, VolumeTransformer, VolumeTransformerOptions, createFFmpegStream, version };
|