discord-player 6.5.0 → 6.6.0-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -38
- package/dist/index.d.ts +146 -87
- package/dist/index.js +979 -990
- package/dist/index.mjs +14 -6
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -1,85 +1,89 @@
|
|
|
1
1
|
# Discord Player
|
|
2
2
|
|
|
3
|
-
Discord Player is a
|
|
4
|
-
It provides easy set of customizable tools to develop Discord Music bots.
|
|
3
|
+
Discord Player is a robust framework for developing Discord Music bots using JavaScript and TypeScript. It is built on top of the [@discordjs/voice](https://npm.im/@discordjs/voice) library and offers a comprehensive set of customizable tools, making it one of the most feature enrich framework in town.
|
|
5
4
|
|
|
6
5
|
[](https://npmjs.com/discord-player)
|
|
7
6
|
[](https://npmjs.com/discord-player)
|
|
8
7
|
[](https://androz2091.fr/discord)
|
|
9
8
|
|
|
10
|
-
# Why Discord Player?
|
|
9
|
+
# Why Choose Discord Player?
|
|
11
10
|
|
|
12
|
-
- Beginner
|
|
11
|
+
- Beginner-friendly with easy-to-understand features
|
|
13
12
|
- TypeScript support
|
|
13
|
+
- Offers hackable APIs.
|
|
14
14
|
- Supports audio player sharing
|
|
15
|
-
- Quick and easy
|
|
15
|
+
- Quick and easy setup process
|
|
16
16
|
- Wide range of player management features
|
|
17
|
-
- 64+ built-in audio filter presets
|
|
18
|
-
- Highly customizable
|
|
17
|
+
- Offers 64+ built-in audio filter presets
|
|
18
|
+
- Highly customizable according to your needs
|
|
19
19
|
- Automatic queue management
|
|
20
20
|
- Query caching support
|
|
21
|
-
-
|
|
22
|
-
- Object
|
|
23
|
-
- Built
|
|
21
|
+
- Extensible sources through the Extractors API
|
|
22
|
+
- Object-oriented design
|
|
23
|
+
- Built-in stats tracker
|
|
24
|
+
- Offers easy debugging methods
|
|
25
|
+
- Out-of-the-box voice states handling
|
|
24
26
|
|
|
25
27
|
## Installation
|
|
26
28
|
|
|
27
29
|
### Before you start
|
|
28
30
|
|
|
29
|
-
Discord Player requires Discord.js 14.0 or higher.
|
|
31
|
+
Discord Player requires Discord.js 14.0 or higher. Please ensure that you have a compatible version by running `npm list discord.js` in your terminal. If you're using an earlier version, please update it. The [discord.js Guide](https://discordjs.guide) provides resources to assist you with the update process.
|
|
30
32
|
|
|
31
33
|
#### Main Library
|
|
32
34
|
|
|
33
35
|
```bash
|
|
34
|
-
$
|
|
35
|
-
$
|
|
36
|
+
$ npm install --save discord-player # main library
|
|
37
|
+
$ npm install --save @discord-player/extractor # extractors provider
|
|
36
38
|
```
|
|
37
39
|
|
|
38
|
-
> Discord Player recognizes `@discord-player/extractor` and loads it automatically by default.
|
|
40
|
+
> Discord Player recognizes `@discord-player/extractor` and loads it automatically by default. Just invoke `await player.extractors.loadDefault()`.
|
|
39
41
|
|
|
40
42
|
#### Opus Library
|
|
41
43
|
|
|
42
|
-
|
|
44
|
+
Since Discord only accepts opus packets, you need to install the opus library. Choose one of the following options:
|
|
43
45
|
|
|
44
46
|
```bash
|
|
45
|
-
$
|
|
47
|
+
$ npm install --save @discordjs/opus
|
|
46
48
|
# or
|
|
47
|
-
$
|
|
49
|
+
$ npm install --save opusscript
|
|
48
50
|
```
|
|
49
51
|
|
|
50
52
|
#### FFmpeg or Avconv
|
|
51
53
|
|
|
52
|
-
FFmpeg or Avconv is required for media transcoding. You can
|
|
54
|
+
FFmpeg or Avconv is required for media transcoding. You can obtain it from [https://ffmpeg.org](https://ffmpeg.org) or install it via npm (we recommend against using ffmpeg-static or other binaries):
|
|
53
55
|
|
|
54
56
|
```bash
|
|
55
|
-
$
|
|
57
|
+
$ npm install --save ffmpeg-static
|
|
56
58
|
# or
|
|
57
|
-
$
|
|
59
|
+
$ npm install --save @ffmpeg-installer/ffmpeg
|
|
58
60
|
# or
|
|
59
|
-
$
|
|
61
|
+
$ npm install --save @node-ffmpeg/node-ffmpeg-installer
|
|
60
62
|
# or
|
|
61
|
-
$
|
|
63
|
+
$ npm install --save ffmpeg-binaries
|
|
62
64
|
```
|
|
63
65
|
|
|
64
66
|
> Use `FFMPEG_PATH` environment variable to load ffmpeg from custom path.
|
|
65
67
|
|
|
66
68
|
#### Streaming Library
|
|
67
69
|
|
|
68
|
-
|
|
70
|
+
If you want to add support for YouTube playback, you need to install a streaming library. Choose one of the following options:
|
|
69
71
|
|
|
70
72
|
```bash
|
|
71
|
-
$
|
|
73
|
+
$ npm install --save ytdl-core
|
|
72
74
|
# or
|
|
73
|
-
$
|
|
75
|
+
$ npm install --save play-dl
|
|
74
76
|
# or
|
|
75
|
-
$
|
|
77
|
+
$ npm install --save @distube/ytdl-core
|
|
78
|
+
# or
|
|
79
|
+
$ npm install --save yt-stream
|
|
76
80
|
```
|
|
77
81
|
|
|
78
|
-
|
|
82
|
+
Once you have completed these installations, let's proceed with writing a simple music bot.
|
|
79
83
|
|
|
80
84
|
### Setup
|
|
81
85
|
|
|
82
|
-
Let's create a
|
|
86
|
+
Let's create a main player instance. This instance handles and keeps track of all the queues and its components.
|
|
83
87
|
|
|
84
88
|
```js
|
|
85
89
|
const { Player } = require('discord-player');
|
|
@@ -92,7 +96,6 @@ const client = new Discord.Client({
|
|
|
92
96
|
intents: ['GuildVoiceStates' /* Other intents */]
|
|
93
97
|
});
|
|
94
98
|
|
|
95
|
-
|
|
96
99
|
// this is the entrypoint for discord-player based application
|
|
97
100
|
const player = new Player(client);
|
|
98
101
|
|
|
@@ -104,9 +107,7 @@ await player.extractors.register(SpotifyExtractor, {});
|
|
|
104
107
|
await player.extractors.register(SoundCloudExtractor, {});
|
|
105
108
|
```
|
|
106
109
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
Now, let's add some event listeners:
|
|
110
|
+
Discord Player is mostly events based. It emits different events based on the context and actions. Let's add a basic event listener to notify the user when a track starts to play:
|
|
110
111
|
|
|
111
112
|
```js
|
|
112
113
|
// this event is emitted whenever discord-player starts to play a track
|
|
@@ -116,7 +117,7 @@ player.events.on('playerStart', (queue, track) => {
|
|
|
116
117
|
});
|
|
117
118
|
```
|
|
118
119
|
|
|
119
|
-
Let's
|
|
120
|
+
Let's move on to the command part. You can define the command as per your requirements. We will only focus on the command handler part:
|
|
120
121
|
|
|
121
122
|
```js
|
|
122
123
|
async function execute(interaction) {
|
|
@@ -143,11 +144,8 @@ async function execute(interaction) {
|
|
|
143
144
|
}
|
|
144
145
|
```
|
|
145
146
|
|
|
146
|
-
That's all it takes to build your own music bot.
|
|
147
|
-
|
|
148
|
-
#### Check out the [Documentation](https://discord-player.js.org) for more info.
|
|
147
|
+
That's all it takes to build your own music bot. Please check out the [Documentation](https://discord-player.js.org) for more features/functionalities.
|
|
149
148
|
|
|
150
149
|
## Community Resources
|
|
151
150
|
|
|
152
|
-
|
|
153
|
-
[https://discord-player.js.org/docs/guides/community-resources](https://discord-player.js.org/docs/guides/community-resources)
|
|
151
|
+
Explore a curated list of resources built by the Discord Player community, including open-source music bots and extractors. Visit [https://discord-player.js.org/docs/guides/community-resources](https://discord-player.js.org/docs/guides/community-resources) for more information.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
import { ListenerSignature, DefaultListener, EventEmitter, Collection, Queue, QueueStrategy } from '@discord-player/utils';
|
|
2
2
|
import * as discord_js from 'discord.js';
|
|
3
3
|
import { User, GuildVoiceChannelResolvable, VoiceChannel, StageChannel, UserResolvable, Guild, VoiceState, VoiceBasedChannel, Snowflake, Client, GuildResolvable } from 'discord.js';
|
|
4
|
-
import
|
|
5
|
-
import { Readable, Duplex, DuplexOptions } from 'stream';
|
|
4
|
+
import { Readable, Duplex } from 'stream';
|
|
6
5
|
import { RequestOptions } from 'http';
|
|
7
6
|
import * as _discord_player_equalizer from '@discord-player/equalizer';
|
|
8
7
|
import { EqualizerBand, BiquadFilters, PCMFilters, FiltersChain } from '@discord-player/equalizer';
|
|
9
8
|
export { AF_NIGHTCORE_RATE, AF_VAPORWAVE_RATE, BASS_EQ_BANDS, FilterType as BiquadFilterType, BiquadFilters, FiltersChain, AudioFilters as PCMAudioFilters, PCMFilters, Q_BUTTERWORTH, VolumeTransformer } from '@discord-player/equalizer';
|
|
10
|
-
import * as _discordjs_voice from '@discordjs/voice';
|
|
11
9
|
import { StreamType, AudioPlayerError, AudioResource, VoiceConnection, AudioPlayer, AudioPlayerStatus, EndBehaviorType } from '@discordjs/voice';
|
|
12
10
|
export { AudioPlayer, CreateAudioPlayerOptions, createAudioPlayer } from '@discordjs/voice';
|
|
13
11
|
import { downloadOptions } from 'ytdl-core';
|
|
14
|
-
|
|
12
|
+
export * from '@discord-player/ffmpeg';
|
|
15
13
|
|
|
16
14
|
declare class PlayerEventsEmitter<L extends ListenerSignature<L> = DefaultListener> extends EventEmitter<L> {
|
|
17
15
|
requiredEvents: Array<keyof L>;
|
|
@@ -336,16 +334,16 @@ interface VoiceEvents {
|
|
|
336
334
|
sampleRate: (filters: number) => any;
|
|
337
335
|
biquad: (filters: BiquadFilters) => any;
|
|
338
336
|
volume: (volume: number) => any;
|
|
337
|
+
destroyed: () => any;
|
|
339
338
|
}
|
|
340
339
|
declare class StreamDispatcher extends EventEmitter<VoiceEvents> {
|
|
341
340
|
queue: GuildQueue;
|
|
342
341
|
readonly connectionTimeout: number;
|
|
343
|
-
|
|
344
|
-
|
|
342
|
+
voiceConnection: VoiceConnection;
|
|
343
|
+
audioPlayer: AudioPlayer;
|
|
345
344
|
receiver: VoiceReceiverNode;
|
|
346
345
|
channel: VoiceChannel | StageChannel;
|
|
347
346
|
audioResource?: AudioResource<Track> | null;
|
|
348
|
-
private readyLock;
|
|
349
347
|
dsp: FiltersChain;
|
|
350
348
|
/**
|
|
351
349
|
* Creates new connection object
|
|
@@ -416,6 +414,10 @@ declare class StreamDispatcher extends EventEmitter<VoiceEvents> {
|
|
|
416
414
|
* @returns {void}
|
|
417
415
|
*/
|
|
418
416
|
disconnect(): void;
|
|
417
|
+
/**
|
|
418
|
+
* Destroys this dispatcher
|
|
419
|
+
*/
|
|
420
|
+
destroy(): void;
|
|
419
421
|
/**
|
|
420
422
|
* Stops the player
|
|
421
423
|
* @returns {void}
|
|
@@ -827,6 +829,22 @@ declare class FFmpegFilterer<Meta = unknown> {
|
|
|
827
829
|
#private;
|
|
828
830
|
af: GuildQueueAudioFilters<Meta>;
|
|
829
831
|
constructor(af: GuildQueueAudioFilters<Meta>);
|
|
832
|
+
/**
|
|
833
|
+
* Set input args for FFmpeg
|
|
834
|
+
*/
|
|
835
|
+
setInputArgs(args: string[]): void;
|
|
836
|
+
/**
|
|
837
|
+
* Get input args
|
|
838
|
+
*/
|
|
839
|
+
get inputArgs(): string[];
|
|
840
|
+
/**
|
|
841
|
+
* Get encoder args
|
|
842
|
+
*/
|
|
843
|
+
get encoderArgs(): string[];
|
|
844
|
+
/**
|
|
845
|
+
* Get final ffmpeg args
|
|
846
|
+
*/
|
|
847
|
+
get args(): string[];
|
|
830
848
|
/**
|
|
831
849
|
* Create ffmpeg stream
|
|
832
850
|
* @param source The stream source
|
|
@@ -1000,6 +1018,7 @@ interface GuildNodeInit<Meta = unknown> {
|
|
|
1000
1018
|
interface VoiceConnectConfig {
|
|
1001
1019
|
deaf?: boolean;
|
|
1002
1020
|
timeout?: number;
|
|
1021
|
+
group?: string;
|
|
1003
1022
|
audioPlayer?: AudioPlayer;
|
|
1004
1023
|
}
|
|
1005
1024
|
interface PostProcessedResult {
|
|
@@ -1013,7 +1032,7 @@ declare const GuildQueueEvent: {
|
|
|
1013
1032
|
/**
|
|
1014
1033
|
* Emitted when audio track is added to the queue
|
|
1015
1034
|
*/
|
|
1016
|
-
readonly audioTrackAdd: "
|
|
1035
|
+
readonly audioTrackAdd: "audioTrackAdd";
|
|
1017
1036
|
/**
|
|
1018
1037
|
* Emitted when audio tracks were added to the queue
|
|
1019
1038
|
*/
|
|
@@ -1030,6 +1049,10 @@ declare const GuildQueueEvent: {
|
|
|
1030
1049
|
* Emitted when a connection is created
|
|
1031
1050
|
*/
|
|
1032
1051
|
readonly connection: "connection";
|
|
1052
|
+
/**
|
|
1053
|
+
* Emitted when a voice connection is destroyed
|
|
1054
|
+
*/
|
|
1055
|
+
readonly connectionDestroyed: "connectionDestroyed";
|
|
1033
1056
|
/**
|
|
1034
1057
|
* Emitted when the bot is disconnected from the channel
|
|
1035
1058
|
*/
|
|
@@ -1106,6 +1129,18 @@ declare const GuildQueueEvent: {
|
|
|
1106
1129
|
* Audio player will play next track
|
|
1107
1130
|
*/
|
|
1108
1131
|
readonly willPlayTrack: "willPlayTrack";
|
|
1132
|
+
/**
|
|
1133
|
+
* Emitted when a voice channel is repopulated
|
|
1134
|
+
*/
|
|
1135
|
+
readonly channelPopulate: "channelPopulate";
|
|
1136
|
+
/**
|
|
1137
|
+
* Emitted when a queue is successfully created
|
|
1138
|
+
*/
|
|
1139
|
+
readonly queueCreate: "queueCreate";
|
|
1140
|
+
/**
|
|
1141
|
+
* Emitted when a queue is deleted
|
|
1142
|
+
*/
|
|
1143
|
+
readonly queueDelete: "queueDelete";
|
|
1109
1144
|
};
|
|
1110
1145
|
interface GuildQueueEvents<Meta = unknown> {
|
|
1111
1146
|
/**
|
|
@@ -1137,6 +1172,11 @@ interface GuildQueueEvents<Meta = unknown> {
|
|
|
1137
1172
|
* @param queue The queue where this event occurred
|
|
1138
1173
|
*/
|
|
1139
1174
|
connection: (queue: GuildQueue<Meta>) => unknown;
|
|
1175
|
+
/**
|
|
1176
|
+
* Emitted when a connection is destroyed
|
|
1177
|
+
* @param queue The queue where this event occurred
|
|
1178
|
+
*/
|
|
1179
|
+
connectionDestroyed: (queue: GuildQueue<Meta>) => unknown;
|
|
1140
1180
|
/**
|
|
1141
1181
|
* Emitted when the bot is disconnected from the channel
|
|
1142
1182
|
* @param queue The queue where this event occurred
|
|
@@ -1256,6 +1296,21 @@ interface GuildQueueEvents<Meta = unknown> {
|
|
|
1256
1296
|
* @param done Done callback
|
|
1257
1297
|
*/
|
|
1258
1298
|
willPlayTrack: (queue: GuildQueue<Meta>, track: Track<unknown>, config: StreamConfig, done: () => void) => unknown;
|
|
1299
|
+
/**
|
|
1300
|
+
* Emitted when a voice channel is populated
|
|
1301
|
+
* @param queue The queue where this event occurred
|
|
1302
|
+
*/
|
|
1303
|
+
channelPopulate: (queue: GuildQueue<Meta>) => unknown;
|
|
1304
|
+
/**
|
|
1305
|
+
* Emitted when a queue is successfully created
|
|
1306
|
+
* @param queue The queue where this event occurred
|
|
1307
|
+
*/
|
|
1308
|
+
queueCreate: (queue: GuildQueue<Meta>) => unknown;
|
|
1309
|
+
/**
|
|
1310
|
+
* Emitted when a queue is successfully deleted
|
|
1311
|
+
* @param queue The queue where this event occurred
|
|
1312
|
+
*/
|
|
1313
|
+
queueDelete: (queue: GuildQueue<Meta>) => unknown;
|
|
1259
1314
|
}
|
|
1260
1315
|
declare class GuildQueue<Meta = unknown> {
|
|
1261
1316
|
#private;
|
|
@@ -1317,7 +1372,7 @@ declare class GuildQueue<Meta = unknown> {
|
|
|
1317
1372
|
/**
|
|
1318
1373
|
* The voice connection of this queue
|
|
1319
1374
|
*/
|
|
1320
|
-
get connection():
|
|
1375
|
+
get connection(): VoiceConnection | null;
|
|
1321
1376
|
/**
|
|
1322
1377
|
* The guild this queue belongs to
|
|
1323
1378
|
*/
|
|
@@ -1428,6 +1483,11 @@ declare class GuildQueue<Meta = unknown> {
|
|
|
1428
1483
|
* @param dest The second track to swap
|
|
1429
1484
|
*/
|
|
1430
1485
|
swapTracks(src: TrackResolvable, dest: TrackResolvable): void;
|
|
1486
|
+
/**
|
|
1487
|
+
* Create stream dispatcher from the given connection
|
|
1488
|
+
* @param connection The connection to use
|
|
1489
|
+
*/
|
|
1490
|
+
createDispatcher(connection: VoiceConnection, options?: Pick<VoiceConnectConfig, 'audioPlayer' | 'timeout'>): void;
|
|
1431
1491
|
/**
|
|
1432
1492
|
* Connect to a voice channel
|
|
1433
1493
|
* @param channelResolvable The voice channel to connect to
|
|
@@ -1465,6 +1525,13 @@ declare class GuildQueue<Meta = unknown> {
|
|
|
1465
1525
|
* @param options Player node initialization options
|
|
1466
1526
|
*/
|
|
1467
1527
|
play(track: TrackLike, options?: PlayerNodeInitializerOptions<Meta>): Promise<PlayerNodeInitializationResult<Meta>>;
|
|
1528
|
+
/**
|
|
1529
|
+
* Emit an event on this queue
|
|
1530
|
+
* @param event The event to emit
|
|
1531
|
+
* @param args The args for the event
|
|
1532
|
+
*/
|
|
1533
|
+
emit<K extends keyof GuildQueueEvents<Meta>>(event: K, ...args: Parameters<GuildQueueEvents<Meta>[K]>): boolean;
|
|
1534
|
+
get hasDebugger(): boolean;
|
|
1468
1535
|
}
|
|
1469
1536
|
|
|
1470
1537
|
interface GuildQueueStatisticsMetadata {
|
|
@@ -1587,6 +1654,7 @@ declare class VoiceUtils {
|
|
|
1587
1654
|
maxTime?: number;
|
|
1588
1655
|
queue: GuildQueue;
|
|
1589
1656
|
audioPlayer?: AudioPlayer;
|
|
1657
|
+
group?: string;
|
|
1590
1658
|
}): Promise<StreamDispatcher>;
|
|
1591
1659
|
/**
|
|
1592
1660
|
* Joins a voice channel
|
|
@@ -1597,6 +1665,7 @@ declare class VoiceUtils {
|
|
|
1597
1665
|
join(channel: VoiceChannel | StageChannel, options?: {
|
|
1598
1666
|
deaf?: boolean;
|
|
1599
1667
|
maxTime?: number;
|
|
1668
|
+
group?: string;
|
|
1600
1669
|
}): Promise<VoiceConnection>;
|
|
1601
1670
|
/**
|
|
1602
1671
|
* Disconnects voice connection
|
|
@@ -1609,7 +1678,7 @@ declare class VoiceUtils {
|
|
|
1609
1678
|
* @param {Snowflake} guild The guild id
|
|
1610
1679
|
* @returns {StreamDispatcher}
|
|
1611
1680
|
*/
|
|
1612
|
-
getConnection(guild: Snowflake): StreamDispatcher | VoiceConnection | undefined;
|
|
1681
|
+
getConnection(guild: Snowflake, group?: string): StreamDispatcher | VoiceConnection | undefined;
|
|
1613
1682
|
}
|
|
1614
1683
|
|
|
1615
1684
|
interface QueryCacheOptions {
|
|
@@ -1653,6 +1722,7 @@ interface PlayerNodeInitializerOptions<T> extends SearchOptions {
|
|
|
1653
1722
|
audioPlayerOptions?: ResourcePlayOptions;
|
|
1654
1723
|
afterSearch?: (result: SearchResult) => Promise<SearchResult>;
|
|
1655
1724
|
}
|
|
1725
|
+
type VoiceStateHandler = (player: Player, queue: GuildQueue, oldVoiceState: VoiceState, newVoiceState: VoiceState) => Awaited<void>;
|
|
1656
1726
|
declare class Player extends PlayerEventsEmitter<PlayerEvents> {
|
|
1657
1727
|
#private;
|
|
1658
1728
|
static readonly version: string;
|
|
@@ -1670,6 +1740,12 @@ declare class Player extends PlayerEventsEmitter<PlayerEvents> {
|
|
|
1670
1740
|
* @param {PlayerInitOptions} [options] The player init options
|
|
1671
1741
|
*/
|
|
1672
1742
|
constructor(client: Client, options?: PlayerInitOptions);
|
|
1743
|
+
get hasDebugger(): boolean;
|
|
1744
|
+
/**
|
|
1745
|
+
* Override default voice state update handler
|
|
1746
|
+
* @param handler The handler callback
|
|
1747
|
+
*/
|
|
1748
|
+
onVoiceStateUpdate(handler: VoiceStateHandler): void;
|
|
1673
1749
|
debug(m: string): boolean;
|
|
1674
1750
|
/**
|
|
1675
1751
|
* Creates discord-player singleton instance.
|
|
@@ -2351,93 +2427,49 @@ declare class QueryResolver {
|
|
|
2351
2427
|
static validateURL(q: string): boolean;
|
|
2352
2428
|
}
|
|
2353
2429
|
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
version: string | null;
|
|
2359
|
-
isStatic: boolean;
|
|
2360
|
-
}
|
|
2361
|
-
interface FFmpegOptions extends DuplexOptions {
|
|
2362
|
-
args?: string[];
|
|
2363
|
-
shell?: boolean;
|
|
2364
|
-
}
|
|
2365
|
-
declare class FFmpeg extends Duplex {
|
|
2366
|
-
/**
|
|
2367
|
-
* FFmpeg version regex
|
|
2368
|
-
*/
|
|
2369
|
-
static VersionRegex: RegExp;
|
|
2370
|
-
/**
|
|
2371
|
-
* Spawns ffmpeg process
|
|
2372
|
-
* @param options Spawn options
|
|
2373
|
-
*/
|
|
2374
|
-
static spawn({ args, shell }?: {
|
|
2375
|
-
args?: string[] | undefined;
|
|
2376
|
-
shell?: boolean | undefined;
|
|
2377
|
-
}): childProcess.ChildProcessWithoutNullStreams;
|
|
2378
|
-
/**
|
|
2379
|
-
* Check if ffmpeg is available
|
|
2380
|
-
*/
|
|
2381
|
-
static isAvailable(): boolean;
|
|
2382
|
-
/**
|
|
2383
|
-
* Safe locate ffmpeg
|
|
2384
|
-
* @param force if it should relocate the command
|
|
2385
|
-
*/
|
|
2386
|
-
static locateSafe(force?: boolean): FFmpegInfo | null | undefined;
|
|
2387
|
-
/**
|
|
2388
|
-
* Locate ffmpeg command. Throws error if ffmpeg is not found.
|
|
2389
|
-
* @param force Forcefully reload
|
|
2390
|
-
*/
|
|
2391
|
-
static locate(force?: boolean): FFmpegInfo | undefined;
|
|
2392
|
-
/**
|
|
2393
|
-
* Current FFmpeg process
|
|
2394
|
-
*/
|
|
2395
|
-
process: childProcess.ChildProcessWithoutNullStreams;
|
|
2396
|
-
/**
|
|
2397
|
-
* Create FFmpeg duplex stream
|
|
2398
|
-
* @param options Options to initialize ffmpeg
|
|
2399
|
-
* @example ```typescript
|
|
2400
|
-
* const ffmpeg = new FFmpeg({
|
|
2401
|
-
* args: [
|
|
2402
|
-
* '-analyzeduration', '0',
|
|
2403
|
-
* '-loglevel', '0',
|
|
2404
|
-
* '-f', 's16le',
|
|
2405
|
-
* '-ar', '48000',
|
|
2406
|
-
* '-ac', '2',
|
|
2407
|
-
* '-af', 'bass=g=10,acompressor'
|
|
2408
|
-
* ]
|
|
2409
|
-
* });
|
|
2410
|
-
*
|
|
2411
|
-
* const pcm = input.pipe(ffmpeg);
|
|
2412
|
-
*
|
|
2413
|
-
* pcm.pipe(fs.createWriteStream('./audio.pcm'));
|
|
2414
|
-
* ```
|
|
2415
|
-
*/
|
|
2416
|
-
constructor(options?: FFmpegOptions);
|
|
2417
|
-
get _reader(): stream.Readable;
|
|
2418
|
-
get _writer(): stream.Writable;
|
|
2419
|
-
private _copy;
|
|
2420
|
-
_destroy(err: Error | null, cb: Callback<[Error | null]>): unknown;
|
|
2421
|
-
_final(cb: Callback<[]>): void;
|
|
2422
|
-
private _cleanup;
|
|
2423
|
-
toString(): string;
|
|
2424
|
-
}
|
|
2425
|
-
declare const findFFmpeg: typeof FFmpeg.locate;
|
|
2426
|
-
|
|
2430
|
+
/**
|
|
2431
|
+
* Fetch guild queue history
|
|
2432
|
+
* @param node guild queue node resolvable
|
|
2433
|
+
*/
|
|
2427
2434
|
declare function useHistory<Meta = unknown>(node: NodeResolvable): GuildQueueHistory<Meta> | null;
|
|
2428
2435
|
|
|
2436
|
+
/**
|
|
2437
|
+
* Fetch guild queue player node
|
|
2438
|
+
* @param node Guild queue node resolvable
|
|
2439
|
+
*/
|
|
2429
2440
|
declare function usePlayer<Meta = unknown>(node: NodeResolvable): GuildQueuePlayerNode<Meta> | null;
|
|
2430
2441
|
|
|
2442
|
+
/**
|
|
2443
|
+
* Fetch guild queue
|
|
2444
|
+
* @param node Guild queue node resolvable
|
|
2445
|
+
*/
|
|
2431
2446
|
declare function useQueue<Meta = unknown>(node: NodeResolvable): GuildQueue<Meta> | null;
|
|
2432
2447
|
|
|
2433
|
-
|
|
2448
|
+
/**
|
|
2449
|
+
* Fetch main player instance
|
|
2450
|
+
* @deprecated
|
|
2451
|
+
*/
|
|
2452
|
+
declare function useMasterPlayer(): Player | null;
|
|
2453
|
+
/**
|
|
2454
|
+
* Fetch main player instance
|
|
2455
|
+
*/
|
|
2456
|
+
declare function useMainPlayer(): Player | null;
|
|
2434
2457
|
|
|
2435
|
-
type SetterFN<T, P> = (previous: P) => T;
|
|
2436
|
-
|
|
2458
|
+
type SetterFN$1<T, P> = (previous: P) => T;
|
|
2459
|
+
/**
|
|
2460
|
+
* Fetch or manipulate guild queue metadata
|
|
2461
|
+
* @param node Guild queue node resolvable
|
|
2462
|
+
*/
|
|
2463
|
+
declare function useMetadata<T = unknown>(node: NodeResolvable): readonly [() => T, (metadata: T | SetterFN$1<T, T>) => void];
|
|
2437
2464
|
|
|
2438
2465
|
interface TimelineDispatcherOptions {
|
|
2439
2466
|
ignoreFilters: boolean;
|
|
2440
2467
|
}
|
|
2468
|
+
/**
|
|
2469
|
+
* Fetch or manipulate current track
|
|
2470
|
+
* @param node Guild queue node resolvable
|
|
2471
|
+
* @param options Options for timeline dispatcher
|
|
2472
|
+
*/
|
|
2441
2473
|
declare function useTimeline(node: NodeResolvable, options?: Partial<TimelineDispatcherOptions>): {
|
|
2442
2474
|
readonly timestamp: PlayerTimestamp;
|
|
2443
2475
|
readonly volume: number;
|
|
@@ -2449,10 +2481,37 @@ declare function useTimeline(node: NodeResolvable, options?: Partial<TimelineDis
|
|
|
2449
2481
|
setPosition(time: number): Promise<boolean>;
|
|
2450
2482
|
} | null;
|
|
2451
2483
|
|
|
2484
|
+
/**
|
|
2485
|
+
* Global onAfterCreateStream handler
|
|
2486
|
+
* @param handler The handler callback
|
|
2487
|
+
*/
|
|
2452
2488
|
declare function onAfterCreateStream(handler: OnAfterCreateStreamHandler): void;
|
|
2453
2489
|
|
|
2490
|
+
/**
|
|
2491
|
+
* Global onBeforeCreateStream handler
|
|
2492
|
+
* @param handler The handler callback
|
|
2493
|
+
*/
|
|
2454
2494
|
declare function onBeforeCreateStream(handler: OnBeforeCreateStreamHandler): void;
|
|
2455
2495
|
|
|
2496
|
+
type SetterFN = (previous: number) => number;
|
|
2497
|
+
/**
|
|
2498
|
+
* Fetch or manipulate player volume
|
|
2499
|
+
* @param node Guild queue node resolvable
|
|
2500
|
+
*/
|
|
2501
|
+
declare function useVolume(node: NodeResolvable): readonly [() => number, (volume: number | SetterFN) => boolean | undefined];
|
|
2502
|
+
|
|
2503
|
+
declare const instances: Collection<string, Player>;
|
|
2504
|
+
|
|
2505
|
+
declare const getPlayer: () => Player | null;
|
|
2506
|
+
declare const getQueue: <T = unknown>(node: NodeResolvable) => GuildQueue<T> | null;
|
|
2507
|
+
interface HookDeclarationContext {
|
|
2508
|
+
getQueue: typeof getQueue;
|
|
2509
|
+
getPlayer: typeof getPlayer;
|
|
2510
|
+
instances: typeof instances;
|
|
2511
|
+
}
|
|
2512
|
+
type HookDeclaration<T extends (...args: any[]) => any> = (context: HookDeclarationContext) => T;
|
|
2513
|
+
declare function createHook<T extends HookDeclaration<(...args: any[]) => any>>(hook: T): ReturnType<T>;
|
|
2514
|
+
|
|
2456
2515
|
declare const version: string;
|
|
2457
2516
|
|
|
2458
|
-
export { AFilterGraph, AsyncQueue, AsyncQueueAcquisitionOptions, AsyncQueueEntry, AudioFilters, BaseExtractor, CreateStreamOps, DiscordPlayerQueryResultCache, EqualizerConfigurationPreset, ExtractorExecutionContext, ExtractorExecutionEvents, ExtractorExecutionFN, ExtractorExecutionResult, ExtractorInfo, ExtractorSearchContext, FFMPEG_ARGS_PIPED, FFMPEG_ARGS_STRING, FFMPEG_SRATE_REGEX,
|
|
2517
|
+
export { AFilterGraph, AsyncQueue, AsyncQueueAcquisitionOptions, AsyncQueueEntry, AudioFilters, BaseExtractor, CreateStreamOps, DiscordPlayerQueryResultCache, EqualizerConfigurationPreset, ExtractorExecutionContext, ExtractorExecutionEvents, ExtractorExecutionFN, ExtractorExecutionResult, ExtractorInfo, ExtractorSearchContext, FFMPEG_ARGS_PIPED, FFMPEG_ARGS_STRING, FFMPEG_SRATE_REGEX, FFmpegFilterer, FFmpegStreamOptions, FilterGraph, FiltersName, GuildNodeCreateOptions, GuildNodeInit, GuildNodeManager, GuildQueue, GuildQueueAFiltersCache, GuildQueueAudioFilters, GuildQueueEvent, GuildQueueEvents, GuildQueueHistory, GuildQueuePlayerNode, HookDeclaration, HookDeclarationContext, NextFunction, NodeResolvable, OnAfterCreateStreamHandler, OnBeforeCreateStreamHandler, PlayOptions, Player, PlayerEvent, PlayerEvents, PlayerEventsEmitter, PlayerInitOptions, PlayerNodeInitializationResult, PlayerNodeInitializerOptions, PlayerProgressbarOptions, PlayerSearchResult, PlayerTimestamp, PlayerTriggeredReason, Playlist, PlaylistInitData, PlaylistJSON, PostProcessedResult, QueryCache, QueryCacheOptions, QueryCacheResolverContext, QueryExtractorSearch, QueryResolver, QueryType, QueueFilters, QueueRepeatMode, RawTrackData, RawTrackInit, ResourcePlayOptions, SearchOptions, SearchQueryType, SearchResult, SearchResultData, StreamConfig, StreamDispatcher, TimeData, TimelineDispatcherOptions, Track, TrackJSON, TrackLike, TrackResolvable, TrackSource, TypeUtil, Util, VALIDATE_QUEUE_CAP, VoiceConnectConfig, VoiceEvents, VoiceReceiverNode, VoiceReceiverOptions, VoiceStateHandler, VoiceUtils, WithMetadata, createFFmpegStream, createHook, onAfterCreateStream, onBeforeCreateStream, useHistory, useMainPlayer, useMasterPlayer, useMetadata, usePlayer, useQueue, useTimeline, useVolume, version };
|