discord-player 5.1.0 → 5.2.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/LICENSE +21 -21
- package/README.md +51 -4
- package/dist/Player.js +556 -514
- package/dist/Structures/ExtractorModel.js +70 -78
- package/dist/Structures/PlayerError.js +48 -43
- package/dist/Structures/Playlist.js +109 -109
- package/dist/Structures/Queue.js +802 -763
- package/dist/Structures/Track.js +158 -153
- package/dist/VoiceInterface/StreamDispatcher.js +231 -221
- package/dist/VoiceInterface/VoiceUtils.js +83 -86
- package/dist/VoiceInterface/VolumeTransformer.js +120 -0
- package/dist/index.d.ts +1158 -1128
- package/dist/index.js +32 -39
- package/dist/smoothVolume.js +13 -0
- package/dist/types/types.js +58 -58
- package/dist/utils/AudioFilters.js +109 -109
- package/dist/utils/QueryResolver.js +68 -68
- package/dist/utils/Util.js +90 -90
- package/package.json +30 -24
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2020-present Androz
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020-present Androz
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -32,11 +32,12 @@ $ npm install --save @discordjs/opus
|
|
|
32
32
|
- Simple & easy to use 🤘
|
|
33
33
|
- Beginner friendly 😱
|
|
34
34
|
- Audio filters 🎸
|
|
35
|
-
- Lightweight
|
|
35
|
+
- Lightweight ☁️
|
|
36
36
|
- Custom extractors support 🌌
|
|
37
|
-
- Lyrics 📃
|
|
38
37
|
- Multiple sources support ✌
|
|
39
38
|
- Play in multiple servers at the same time 🚗
|
|
39
|
+
- Does not inject anything to discord.js or your discord.js client 💉
|
|
40
|
+
- Allows you to have full control over what is going to be streamed 👑
|
|
40
41
|
|
|
41
42
|
## [Documentation](https://discord-player.js.org)
|
|
42
43
|
|
|
@@ -99,7 +100,7 @@ client.once("ready", () => {
|
|
|
99
100
|
client.on("interactionCreate", async (interaction) => {
|
|
100
101
|
if (!interaction.isCommand()) return;
|
|
101
102
|
|
|
102
|
-
// /play Despacito
|
|
103
|
+
// /play track:Despacito
|
|
103
104
|
// will play "Despacito" in the voice channel
|
|
104
105
|
if (interaction.commandName === "play") {
|
|
105
106
|
if (!interaction.member.voice.channelId) return await interaction.reply({ content: "You are not in a voice channel!", ephemeral: true });
|
|
@@ -156,12 +157,29 @@ You just need to install it using `npm i --save @discord-player/extractor` (disc
|
|
|
156
157
|
These bots are made by the community, they can help you build your own!
|
|
157
158
|
|
|
158
159
|
* **[Discord Music Bot](https://github.com/Androz2091/discord-music-bot)** by [Androz2091](https://github.com/Androz2091)
|
|
160
|
+
* [Dodong](https://github.com/nizeic/Dodong) by [nizeic](https://github.com/nizeic)
|
|
161
|
+
* [Musico](https://github.com/Whirl21/Musico) by [Whirl21](https://github.com/Whirl21)
|
|
162
|
+
* [Eyesense-Music-Bot](https://github.com/naseif/Eyesense-Music-Bot) by [naseif](https://github.com/naseif)
|
|
163
|
+
* [Music-bot](https://github.com/ZerioDev/Music-bot) by [ZerioDev](https://github.com/ZerioDev)
|
|
159
164
|
* [AtlantaBot](https://github.com/Androz2091/AtlantaBot) by [Androz2091](https://github.com/Androz2091) (**outdated**)
|
|
160
165
|
* [Discord-Music](https://github.com/inhydrox/discord-music) by [inhydrox](https://github.com/inhydrox) (**outdated**)
|
|
161
|
-
* [Music-bot](https://github.com/ZerioDev/Music-bot) by [ZerioDev](https://github.com/ZerioDev) (**outdated**)
|
|
162
166
|
|
|
163
167
|
## Advanced
|
|
164
168
|
|
|
169
|
+
### Smooth Volume
|
|
170
|
+
|
|
171
|
+
Discord Player will by default try to implement this. If smooth volume does not work, you need to add this line at the top of your main file:
|
|
172
|
+
|
|
173
|
+
```js
|
|
174
|
+
// CJS
|
|
175
|
+
require("discord-player/smoothVolume");
|
|
176
|
+
|
|
177
|
+
// ESM
|
|
178
|
+
import "discord-player/smoothVolume"
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
> ⚠️ Make sure that line is situated at the **TOP** of your **main** file.
|
|
182
|
+
|
|
165
183
|
### Use cookies
|
|
166
184
|
|
|
167
185
|
```js
|
|
@@ -191,3 +209,32 @@ const player = new Player(client, {
|
|
|
191
209
|
}
|
|
192
210
|
});
|
|
193
211
|
```
|
|
212
|
+
|
|
213
|
+
> You may also create a simple proxy server and forward requests through it.
|
|
214
|
+
> See **[https://github.com/http-party/node-http-proxy](https://github.com/http-party/node-http-proxy)** for more info.
|
|
215
|
+
|
|
216
|
+
### Custom stream Engine
|
|
217
|
+
|
|
218
|
+
Discord Player by default uses **[node-ytdl-core](https://github.com/fent/node-ytdl-core)** for youtube and some other extractors for other sources.
|
|
219
|
+
If you need to modify this behavior without touching extractors, you need to use `createStream` functionality of discord player.
|
|
220
|
+
Here's an example on how you can use **[play-dl](https://npmjs.com/package/play-dl)** to download youtube streams instead of using ytdl-core.
|
|
221
|
+
|
|
222
|
+
```js
|
|
223
|
+
const playdl = require("play-dl");
|
|
224
|
+
|
|
225
|
+
// other code
|
|
226
|
+
const queue = player.createQueue(..., {
|
|
227
|
+
...,
|
|
228
|
+
async onBeforeCreateStream(track, source, _queue) {
|
|
229
|
+
// only trap youtube source
|
|
230
|
+
if (source === "youtube") {
|
|
231
|
+
// track here would be youtube track
|
|
232
|
+
return (await playdl.stream(track.url, { discordPlayerCompatibility : true })).stream;
|
|
233
|
+
// we must return readable stream or void (returning void means telling discord-player to look for default extractor)
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
`<Queue>.onBeforeCreateStream` is called before actually downloading the stream. It is a different concept from extractors, where you are **just** downloading
|
|
240
|
+
streams. `source` here will be a video source. Streams from `onBeforeCreateStream` are then piped to `FFmpeg` and finally sent to Discord voice servers.
|