distube 2.8.15 → 3.0.0-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 +32 -98
- package/dist/DisTube.d.ts +522 -0
- package/dist/DisTube.d.ts.map +1 -0
- package/dist/DisTube.js +794 -0
- package/dist/DisTube.js.map +1 -0
- package/dist/constant.d.ts +130 -0
- package/dist/constant.d.ts.map +1 -0
- package/dist/constant.js +150 -0
- package/dist/constant.js.map +1 -0
- package/dist/core/DisTubeBase.d.ts +55 -0
- package/dist/core/DisTubeBase.d.ts.map +1 -0
- package/dist/core/DisTubeBase.js +76 -0
- package/dist/core/DisTubeBase.js.map +1 -0
- package/dist/core/DisTubeHandler.d.ts +84 -0
- package/dist/core/DisTubeHandler.d.ts.map +1 -0
- package/dist/core/DisTubeHandler.js +311 -0
- package/dist/core/DisTubeHandler.js.map +1 -0
- package/dist/core/DisTubeOptions.d.ts +26 -0
- package/dist/core/DisTubeOptions.d.ts.map +1 -0
- package/dist/core/DisTubeOptions.js +93 -0
- package/dist/core/DisTubeOptions.js.map +1 -0
- package/dist/core/DisTubeStream.d.ts +52 -0
- package/dist/core/DisTubeStream.d.ts.map +1 -0
- package/dist/core/DisTubeStream.js +109 -0
- package/dist/core/DisTubeStream.js.map +1 -0
- package/dist/core/index.d.ts +7 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +19 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/manager/BaseManager.d.ts +18 -0
- package/dist/core/manager/BaseManager.d.ts.map +1 -0
- package/dist/core/manager/BaseManager.js +44 -0
- package/dist/core/manager/BaseManager.js.map +1 -0
- package/dist/core/manager/QueueManager.d.ts +60 -0
- package/dist/core/manager/QueueManager.d.ts.map +1 -0
- package/dist/core/manager/QueueManager.js +202 -0
- package/dist/core/manager/QueueManager.js.map +1 -0
- package/dist/core/manager/index.d.ts +3 -0
- package/dist/core/manager/index.d.ts.map +1 -0
- package/dist/core/manager/index.js +15 -0
- package/dist/core/manager/index.js.map +1 -0
- package/dist/core/voice/DJSAdapter.d.ts +4 -0
- package/dist/core/voice/DJSAdapter.d.ts.map +1 -0
- package/dist/core/voice/DJSAdapter.js +61 -0
- package/dist/core/voice/DJSAdapter.js.map +1 -0
- package/dist/core/voice/DisTubeVoice.d.ts +83 -0
- package/dist/core/voice/DisTubeVoice.d.ts.map +1 -0
- package/dist/core/voice/DisTubeVoice.js +236 -0
- package/dist/core/voice/DisTubeVoice.js.map +1 -0
- package/dist/core/voice/DisTubeVoiceManager.d.ts +41 -0
- package/dist/core/voice/DisTubeVoiceManager.d.ts.map +1 -0
- package/dist/core/voice/DisTubeVoiceManager.js +67 -0
- package/dist/core/voice/DisTubeVoiceManager.js.map +1 -0
- package/dist/core/voice/index.d.ts +4 -0
- package/dist/core/voice/index.d.ts.map +1 -0
- package/dist/core/voice/index.js +16 -0
- package/dist/core/voice/index.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -0
- package/dist/plugin/http.d.ts +8 -0
- package/dist/plugin/http.d.ts.map +1 -0
- package/dist/plugin/http.js +20 -0
- package/dist/plugin/http.js.map +1 -0
- package/dist/plugin/https.d.ts +14 -0
- package/dist/plugin/https.d.ts.map +1 -0
- package/dist/plugin/https.js +50 -0
- package/dist/plugin/https.js.map +1 -0
- package/dist/plugin/index.d.ts +4 -0
- package/dist/plugin/index.d.ts.map +1 -0
- package/dist/plugin/index.js +16 -0
- package/dist/plugin/index.js.map +1 -0
- package/dist/plugin/youtube-dl.d.ts +11 -0
- package/dist/plugin/youtube-dl.d.ts.map +1 -0
- package/dist/plugin/youtube-dl.js +75 -0
- package/dist/plugin/youtube-dl.js.map +1 -0
- package/dist/struct/CustomPlugin.d.ts +27 -0
- package/dist/struct/CustomPlugin.d.ts.map +1 -0
- package/dist/struct/CustomPlugin.js +35 -0
- package/dist/struct/CustomPlugin.js.map +1 -0
- package/dist/struct/DisTubeError.d.ts +54 -0
- package/dist/struct/DisTubeError.d.ts.map +1 -0
- package/dist/struct/DisTubeError.js +72 -0
- package/dist/struct/DisTubeError.js.map +1 -0
- package/dist/struct/ExtractorPlugin.d.ts +29 -0
- package/dist/struct/ExtractorPlugin.d.ts.map +1 -0
- package/dist/struct/ExtractorPlugin.js +32 -0
- package/dist/struct/ExtractorPlugin.js.map +1 -0
- package/dist/struct/Playlist.d.ts +42 -0
- package/dist/struct/Playlist.d.ts.map +1 -0
- package/dist/struct/Playlist.js +104 -0
- package/dist/struct/Playlist.js.map +1 -0
- package/dist/struct/Plugin.d.ts +82 -0
- package/dist/struct/Plugin.d.ts.map +1 -0
- package/dist/struct/Plugin.js +108 -0
- package/dist/struct/Plugin.js.map +1 -0
- package/dist/struct/Queue.d.ts +217 -0
- package/dist/struct/Queue.d.ts.map +1 -0
- package/dist/struct/Queue.js +480 -0
- package/dist/struct/Queue.js.map +1 -0
- package/dist/struct/SearchResult.d.ts +28 -0
- package/dist/struct/SearchResult.d.ts.map +1 -0
- package/dist/struct/SearchResult.js +79 -0
- package/dist/struct/SearchResult.js.map +1 -0
- package/dist/struct/Song.d.ts +68 -0
- package/dist/struct/Song.d.ts.map +1 -0
- package/dist/struct/Song.js +229 -0
- package/dist/struct/Song.js.map +1 -0
- package/dist/struct/TaskQueue.d.ts +33 -0
- package/dist/struct/TaskQueue.d.ts.map +1 -0
- package/dist/struct/TaskQueue.js +58 -0
- package/dist/struct/TaskQueue.js.map +1 -0
- package/dist/struct/index.d.ts +10 -0
- package/dist/struct/index.d.ts.map +1 -0
- package/dist/struct/index.js +22 -0
- package/dist/struct/index.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/type.d.ts +159 -0
- package/dist/type.d.ts.map +1 -0
- package/dist/type.js +3 -0
- package/dist/type.js.map +1 -0
- package/dist/util.d.ts +47 -0
- package/dist/util.d.ts.map +1 -0
- package/dist/util.js +205 -0
- package/dist/util.js.map +1 -0
- package/package.json +53 -25
- package/.eslintrc.json +0 -150
- package/.gitattributes +0 -2
- package/.github/FUNDING.yml +0 -1
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -17
- package/.github/ISSUE_TEMPLATE/config.yml +0 -8
- package/.github/workflows/npm-publish.yml +0 -17
- package/jsdoc.json +0 -97
- package/src/DisTube.js +0 -1121
- package/src/Playlist.js +0 -107
- package/src/Queue.js +0 -120
- package/src/SearchResult.js +0 -81
- package/src/Song.js +0 -135
- package/src/duration.js +0 -39
- package/tsconfig.json +0 -24
- package/typings/DisTube.d.ts +0 -635
- package/typings/Playlist.d.ts +0 -73
- package/typings/Queue.d.ts +0 -106
- package/typings/SearchResult.d.ts +0 -59
- package/typings/Song.d.ts +0 -104
- package/typings/duration.d.ts +0 -2
package/README.md
CHANGED
|
@@ -3,28 +3,32 @@
|
|
|
3
3
|
<a href="https://nodei.co/npm/distube/"><img src="https://nodei.co/npm/distube.png?downloads=true&downloadRank=true&stars=true"></a>
|
|
4
4
|
</p>
|
|
5
5
|
<p>
|
|
6
|
-
<img alt="
|
|
7
|
-
<img alt="
|
|
8
|
-
<img alt="
|
|
9
|
-
<img alt="
|
|
6
|
+
<img alt="GitHub Workflow Status" src="https://img.shields.io/github/workflow/status/skick1234/DisTube/Testing?label=Tests&logo=github&style=flat-square">
|
|
7
|
+
<img alt="node-current" src="https://img.shields.io/node/v/distube?logo=node.js&logoColor=white&style=flat-square">
|
|
8
|
+
<img alt="npm peer dependency version" src="https://img.shields.io/npm/dependency-version/distube/peer/discord.js?label=discord.js&logo=discord&logoColor=white&style=flat-square">
|
|
9
|
+
<img alt="Depfu" src="https://img.shields.io/depfu/skick1234/DisTube?style=flat-square">
|
|
10
|
+
<img alt="Codecov branch" src="https://img.shields.io/codecov/c/github/skick1234/DisTube?logo=codecov&logoColor=white&style=flat-square&token=WWDYRRSEQW">
|
|
11
|
+
<br>
|
|
12
|
+
<img alt="npm" src="https://img.shields.io/npm/dt/distube?logo=npm&style=flat-square">
|
|
13
|
+
<img alt="GitHub Repo stars" src="https://img.shields.io/github/stars/skick1234/DisTube?logo=github&logoColor=white&style=flat-square">
|
|
14
|
+
<img alt="Discord" src="https://img.shields.io/discord/732254550689316914?logo=discord&logoColor=white&style=flat-square">
|
|
10
15
|
</p>
|
|
11
16
|
</div>
|
|
12
17
|
|
|
13
18
|
# DisTube
|
|
14
19
|
|
|
15
|
-
A Discord.js
|
|
20
|
+
A Discord.js module to simplify your music commands and play songs with audio filters on Discord without any API key.
|
|
16
21
|
|
|
17
|
-
[DisTube Support Server](https://discord.gg/feaDd9h) - [Frequently Asked Questions](https://
|
|
22
|
+
[DisTube Support Server](https://discord.gg/feaDd9h) - [Frequently Asked Questions](https://discord.gg/feaDd9h)
|
|
18
23
|
|
|
19
24
|
## Features
|
|
20
25
|
|
|
21
|
-
- Build on
|
|
22
|
-
-
|
|
26
|
+
- Build on `@discordjs/voice`
|
|
27
|
+
- Easy to use and customize
|
|
23
28
|
- Support YouTube, SoundCloud, Facebook, and [700+ more sites](https://ytdl-org.github.io/youtube-dl/supportedsites.html)
|
|
24
29
|
- Audio filters (bassboost, nightcore, vaporwave,...)
|
|
25
|
-
- Autoplay related
|
|
26
|
-
-
|
|
27
|
-
- Multiple servers compatible
|
|
30
|
+
- Autoplay related songs
|
|
31
|
+
- Plugin system to support more sites ([Plugin List](https://distube.js.org/#/docs/DisTube/stable/plugin/list))
|
|
28
32
|
|
|
29
33
|
## Installation
|
|
30
34
|
|
|
@@ -33,10 +37,15 @@ npm install distube
|
|
|
33
37
|
```
|
|
34
38
|
|
|
35
39
|
### Requirement
|
|
36
|
-
|
|
37
|
-
-
|
|
38
|
-
- [
|
|
39
|
-
- [
|
|
40
|
+
|
|
41
|
+
- Node v12 or higher
|
|
42
|
+
- [git](https://git-scm.com/downloads) _(For installing forked dependencies)_
|
|
43
|
+
- [discord.js](https://discord.js.org) v12 or **v13 _(Recommended)_**
|
|
44
|
+
- [@discordjs/voice](https://github.com/discordjs/voice)
|
|
45
|
+
- [FFmpeg](https://www.ffmpeg.org/download.html)
|
|
46
|
+
- [@discordjs/opus](https://github.com/discordjs/opus)
|
|
47
|
+
- [sodium](https://www.npmjs.com/package/sodium) or [libsodium-wrappers](https://www.npmjs.com/package/libsodium-wrappers)
|
|
48
|
+
- [python](https://www.python.org/) _(Optional - For [`youtube-dl`](https://youtube-dl.org/) to support [700+ more sites](https://ytdl-org.github.io/youtube-dl/supportedsites.html).)_
|
|
40
49
|
|
|
41
50
|
## Documentation
|
|
42
51
|
|
|
@@ -44,88 +53,13 @@ Read DisTube's definitions, properties and events details in the [Documentation
|
|
|
44
53
|
|
|
45
54
|
## Example Bot
|
|
46
55
|
|
|
47
|
-
- [DisTube
|
|
48
|
-
- [DisTube
|
|
49
|
-
|
|
50
|
-
```javascript
|
|
51
|
-
|
|
52
|
-
// DisTube example bot, definitions, properties and events details in the Documentation page.
|
|
53
|
-
const Discord = require('discord.js'),
|
|
54
|
-
DisTube = require('distube'),
|
|
55
|
-
client = new Discord.Client(),
|
|
56
|
-
config = {
|
|
57
|
-
prefix: ".",
|
|
58
|
-
token: process.env.TOKEN || "Your Discord Token"
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
// Create a new DisTube
|
|
62
|
-
const distube = new DisTube(client, { searchSongs: true, emitNewSongOnly: true });
|
|
63
|
-
|
|
64
|
-
client.on('ready', () => {
|
|
65
|
-
console.log(`Logged in as ${client.user.tag}!`);
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
client.on("message", async (message) => {
|
|
69
|
-
if (message.author.bot) return;
|
|
70
|
-
if (!message.content.startsWith(config.prefix)) return;
|
|
71
|
-
const args = message.content.slice(config.prefix.length).trim().split(/ +/g);
|
|
72
|
-
const command = args.shift();
|
|
73
|
-
|
|
74
|
-
if (command == "play")
|
|
75
|
-
distube.play(message, args.join(" "));
|
|
76
|
-
|
|
77
|
-
if (["repeat", "loop"].includes(command))
|
|
78
|
-
distube.setRepeatMode(message, parseInt(args[0]));
|
|
79
|
-
|
|
80
|
-
if (command == "stop") {
|
|
81
|
-
distube.stop(message);
|
|
82
|
-
message.channel.send("Stopped the music!");
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
if (command == "skip")
|
|
86
|
-
distube.skip(message);
|
|
87
|
-
|
|
88
|
-
if (command == "queue") {
|
|
89
|
-
let queue = distube.getQueue(message);
|
|
90
|
-
message.channel.send('Current queue:\n' + queue.songs.map((song, id) =>
|
|
91
|
-
`**${id + 1}**. ${song.name} - \`${song.formattedDuration}\``
|
|
92
|
-
).slice(0, 10).join("\n"));
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
if ([`3d`, `bassboost`, `echo`, `karaoke`, `nightcore`, `vaporwave`].includes(command)) {
|
|
96
|
-
let filter = distube.setFilter(message, command);
|
|
97
|
-
message.channel.send("Current queue filter: " + (filter || "Off"));
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
// Queue status template
|
|
102
|
-
const status = (queue) => `Volume: \`${queue.volume}%\` | Filter: \`${queue.filter || "Off"}\` | Loop: \`${queue.repeatMode ? queue.repeatMode == 2 ? "All Queue" : "This Song" : "Off"}\` | Autoplay: \`${queue.autoplay ? "On" : "Off"}\``;
|
|
56
|
+
- [DisTube Bot](https://skick.xyz/DisTube) - A music bot with reaction controller, filters, DJ mode, user's custom playlist and voting.
|
|
57
|
+
- [DisTube Example](https://github.com/distubejs/example) - Example bot with simple command handler.
|
|
58
|
+
- [DisTube Guide](https://distube.js.org/guide) - How to build a music bot from scratch.
|
|
103
59
|
|
|
104
|
-
|
|
105
|
-
distube
|
|
106
|
-
.on("playSong", (message, queue, song) => message.channel.send(
|
|
107
|
-
`Playing \`${song.name}\` - \`${song.formattedDuration}\`\nRequested by: ${song.user}\n${status(queue)}`
|
|
108
|
-
))
|
|
109
|
-
.on("addSong", (message, queue, song) => message.channel.send(
|
|
110
|
-
`Added ${song.name} - \`${song.formattedDuration}\` to the queue by ${song.user}`
|
|
111
|
-
))
|
|
112
|
-
.on("playList", (message, queue, playlist, song) => message.channel.send(
|
|
113
|
-
`Play \`${playlist.name}\` playlist (${playlist.songs.length} songs).\nRequested by: ${song.user}\nNow playing \`${song.name}\` - \`${song.formattedDuration}\`\n${status(queue)}`
|
|
114
|
-
))
|
|
115
|
-
.on("addList", (message, queue, playlist) => message.channel.send(
|
|
116
|
-
`Added \`${playlist.name}\` playlist (${playlist.songs.length} songs) to queue\n${status(queue)}`
|
|
117
|
-
))
|
|
118
|
-
// DisTubeOptions.searchSongs = true
|
|
119
|
-
.on("searchResult", (message, result) => {
|
|
120
|
-
let i = 0;
|
|
121
|
-
message.channel.send(`**Choose an option from below**\n${result.map(song => `**${++i}**. ${song.name} - \`${song.formattedDuration}\``).join("\n")}\n*Enter anything else or wait 60 seconds to cancel*`);
|
|
122
|
-
})
|
|
123
|
-
// DisTubeOptions.searchSongs = true
|
|
124
|
-
.on("searchCancel", (message) => message.channel.send(`Searching canceled`))
|
|
125
|
-
.on("error", (message, e) => {
|
|
126
|
-
console.error(e)
|
|
127
|
-
message.channel.send("An error encountered: " + e);
|
|
128
|
-
});
|
|
60
|
+
## Dependencies
|
|
129
61
|
|
|
130
|
-
|
|
131
|
-
|
|
62
|
+
- [node-ytdl-core](https://github.com/fent/node-ytdl-core): YouTube scraper ([DisTube Fork](https://github.com/distubejs/node-ytdl-core))
|
|
63
|
+
- [node-ytsr](https://github.com/TimeForANinja/node-ytsr): YouTube search scraper ([DisTube Fork](https://github.com/distubejs/ytsr))
|
|
64
|
+
- [node-ytpl](https://github.com/TimeForANinja/node-ytpl): YouTube playlist resolver ([DisTube Fork](https://github.com/distubejs/ytpl))
|
|
65
|
+
- [youtube-dl-exec](https://github.com/microlinkhq/youtube-dl-exec): [`youtube-dl`](https://youtube-dl.org/) wrapper
|