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