discord-player 6.6.0-dev → 6.6.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 +35 -39
- package/dist/index.d.ts +584 -588
- package/dist/index.js +811 -680
- package/dist/index.mjs +2 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,87 +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
|
|
76
78
|
# or
|
|
77
|
-
$
|
|
79
|
+
$ npm install --save yt-stream
|
|
78
80
|
```
|
|
79
81
|
|
|
80
|
-
|
|
82
|
+
Once you have completed these installations, let's proceed with writing a simple music bot.
|
|
81
83
|
|
|
82
84
|
### Setup
|
|
83
85
|
|
|
84
|
-
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.
|
|
85
87
|
|
|
86
88
|
```js
|
|
87
89
|
const { Player } = require('discord-player');
|
|
@@ -94,7 +96,6 @@ const client = new Discord.Client({
|
|
|
94
96
|
intents: ['GuildVoiceStates' /* Other intents */]
|
|
95
97
|
});
|
|
96
98
|
|
|
97
|
-
|
|
98
99
|
// this is the entrypoint for discord-player based application
|
|
99
100
|
const player = new Player(client);
|
|
100
101
|
|
|
@@ -106,9 +107,7 @@ await player.extractors.register(SpotifyExtractor, {});
|
|
|
106
107
|
await player.extractors.register(SoundCloudExtractor, {});
|
|
107
108
|
```
|
|
108
109
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
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:
|
|
112
111
|
|
|
113
112
|
```js
|
|
114
113
|
// this event is emitted whenever discord-player starts to play a track
|
|
@@ -118,7 +117,7 @@ player.events.on('playerStart', (queue, track) => {
|
|
|
118
117
|
});
|
|
119
118
|
```
|
|
120
119
|
|
|
121
|
-
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:
|
|
122
121
|
|
|
123
122
|
```js
|
|
124
123
|
async function execute(interaction) {
|
|
@@ -145,11 +144,8 @@ async function execute(interaction) {
|
|
|
145
144
|
}
|
|
146
145
|
```
|
|
147
146
|
|
|
148
|
-
That's all it takes to build your own music bot.
|
|
149
|
-
|
|
150
|
-
#### 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.
|
|
151
148
|
|
|
152
149
|
## Community Resources
|
|
153
150
|
|
|
154
|
-
|
|
155
|
-
[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/showcase](https://discord-player.js.org/showcase) for more information.
|