@kattowo/distube 0.0.0-stage → 6.0.1
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 +22 -0
- package/README.md +129 -2
- package/dist/index.d.mts +3260 -0
- package/dist/index.d.ts +3262 -0
- package/dist/index.js +4028 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +3941 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +110 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 Skick
|
|
4
|
+
Copyright (c) 2026 carlylekatto (the v6 fork)
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,130 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
|
+
<p>
|
|
3
|
+
<a href="https://github.com/carlylekatto/DisTube/actions" target="_blank"><img alt="GitHub Workflow Status" src="https://img.shields.io/github/actions/workflow/status/carlylekatto/DisTube/test.yml?branch=main&label=Tests&logo=github&style=flat-square" /></a>
|
|
4
|
+
<a href="https://nodejs.org/" target="_blank"><img alt="node-current" src="https://img.shields.io/node/v/distube?logo=node.js&logoColor=white&style=flat-square"/></a>
|
|
5
|
+
<a href="https://discord.js.org/" target="_blank"><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"/></a>
|
|
6
|
+
<br/>
|
|
7
|
+
<a href="https://github.com/carlylekatto/DisTube/stargazers" target="_blank"><img alt="GitHub Repo stars" src="https://img.shields.io/github/stars/carlylekatto/DisTube?logo=github&logoColor=white&style=flat-square"/></a>
|
|
8
|
+
<a href="https://discord.gg/feaDd9h" target="_blank"><img alt="Discord" src="https://img.shields.io/discord/732254550689316914?logo=discord&logoColor=white&style=flat-square"/></a>
|
|
9
|
+
</p>
|
|
10
|
+
</div>
|
|
2
11
|
|
|
3
|
-
|
|
12
|
+
# DisTube
|
|
13
|
+
|
|
14
|
+
DisTube plays music in a Discord bot. It handles the voice connection, the queue, the audio filters
|
|
15
|
+
and the sources, so a bot only has to deal with its own commands.
|
|
16
|
+
|
|
17
|
+
## This fork
|
|
18
|
+
|
|
19
|
+
This repository is a fork of [skick1234/DisTube](https://github.com/skick1234/DisTube). The v6 line
|
|
20
|
+
is built here, and the two lines part ways from here: the plugin API, the stream server and the
|
|
21
|
+
errors of the plugins belong to this fork.
|
|
22
|
+
|
|
23
|
+
Fixes that every user needs are still sent upstream as pull requests, so both lines get them. There
|
|
24
|
+
is one so far, [#353](https://github.com/skick1234/DisTube/pull/353), which turns on the DAVE
|
|
25
|
+
encryption that Discord made mandatory in March 2026.
|
|
26
|
+
- [The documentation of the fork](https://carlylekatto.github.io/distube-website/)
|
|
27
|
+
- [The changelog](./CHANGELOG.md)
|
|
28
|
+
- [Publishing the fork](./PUBLISHING.md)
|
|
29
|
+
|
|
30
|
+
## Requirements
|
|
31
|
+
|
|
32
|
+
- Node.js 22.12 or later, or Bun
|
|
33
|
+
- FFmpeg on the PATH
|
|
34
|
+
- discord.js 14
|
|
35
|
+
- @discordjs/voice 0.19.1 or later
|
|
36
|
+
|
|
37
|
+
## Install
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npm install @kattowo/distube @discordjs/voice @discordjs/opus
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
# Bun works as well
|
|
45
|
+
bun add @kattowo/distube @discordjs/voice @discordjs/opus
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Quick start
|
|
49
|
+
|
|
50
|
+
```javascript
|
|
51
|
+
const { DisTube } = require("@kattowo/distube");
|
|
52
|
+
const { Client, GatewayIntentBits } = require("discord.js");
|
|
53
|
+
|
|
54
|
+
const client = new Client({
|
|
55
|
+
intents: [
|
|
56
|
+
GatewayIntentBits.Guilds,
|
|
57
|
+
GatewayIntentBits.GuildVoiceStates,
|
|
58
|
+
GatewayIntentBits.GuildMessages,
|
|
59
|
+
GatewayIntentBits.MessageContent,
|
|
60
|
+
],
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
const distube = new DisTube(client);
|
|
64
|
+
|
|
65
|
+
distube.on("playSong", (queue, song) =>
|
|
66
|
+
queue.textChannel.send(`Playing \`${song.name}\` - \`${song.formattedDuration}\``),
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
client.on("messageCreate", message => {
|
|
70
|
+
if (message.content.startsWith("!play")) {
|
|
71
|
+
distube.play(message.member.voice.channel, message.content.slice(6), {
|
|
72
|
+
message,
|
|
73
|
+
textChannel: message.channel,
|
|
74
|
+
member: message.member,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
client.login("TOKEN");
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
The shortcut methods are gone in v6. `distube.pause(guild)` becomes `distube.getQueue(guild).pause()`.
|
|
83
|
+
The changelog lists every removal.
|
|
84
|
+
|
|
85
|
+
## The plugins
|
|
86
|
+
|
|
87
|
+
DisTube ships no music source. Every source is a plugin, so a bot loads the ones it needs:
|
|
88
|
+
|
|
89
|
+
```javascript
|
|
90
|
+
const { DisTube } = require("@kattowo/distube");
|
|
91
|
+
const { YoutubePlugin } = require("@distube/youtube");
|
|
92
|
+
const { SpotifyPlugin } = require("@distube/spotify");
|
|
93
|
+
|
|
94
|
+
const distube = new DisTube(client, {
|
|
95
|
+
plugins: [new YoutubePlugin(), new SpotifyPlugin()],
|
|
96
|
+
});
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
A plugin that cannot hand out a static URL to FFmpeg registers a handler on the shared stream server
|
|
100
|
+
of DisTube, so the bot runs one HTTP server instead of one per plugin.
|
|
101
|
+
|
|
102
|
+
`search()` returns a `SearchResult` at every level, and the `source` option of the search and of the
|
|
103
|
+
play options routes a query to a single source:
|
|
104
|
+
|
|
105
|
+
```javascript
|
|
106
|
+
const result = await distube.search("never gonna give you up", { source: "youtube" });
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Documentation
|
|
110
|
+
|
|
111
|
+
- [Overview](https://carlylekatto.github.io/distube-website/)
|
|
112
|
+
- [Installation](https://carlylekatto.github.io/distube-website/getting-started/installation/)
|
|
113
|
+
- [Quick start](https://carlylekatto.github.io/distube-website/getting-started/quick-start/)
|
|
114
|
+
- [Plugin system](https://carlylekatto.github.io/distube-website/guide/plugins/)
|
|
115
|
+
- [Events](https://carlylekatto.github.io/distube-website/guide/events/)
|
|
116
|
+
- [Audio filters](https://carlylekatto.github.io/distube-website/guide/filters/)
|
|
117
|
+
- [Upgrading from v5](https://carlylekatto.github.io/distube-website/guide/upgrade/)
|
|
118
|
+
- [API reference](https://carlylekatto.github.io/distube-website/api/)
|
|
119
|
+
- [FAQ](https://carlylekatto.github.io/distube-website/faq/)
|
|
120
|
+
|
|
121
|
+
The wiki of the repository holds the long form pages.
|
|
122
|
+
|
|
123
|
+
## Contributing
|
|
124
|
+
|
|
125
|
+
Read the [contributing guidelines](./.github/CONTRIBUTING.md) first. A pull request that fixes
|
|
126
|
+
something should come with a test.
|
|
127
|
+
|
|
128
|
+
## License
|
|
129
|
+
|
|
130
|
+
[MIT](./LICENSE)
|