DisTube is a comprehensive Discord music bot library built for Discord.js, offering simplified music commands, effortless playback from diverse sources, and integrated audio filters.
| Resource | Description |
|---|---|
| Learn DisTube with AI-powered assistance. | |
| Installation | Detailed requirements and setup guide. |
| API Reference | Complete technical documentation. |
| Discord Support | Join our community for help and discussion. |
npm install distube @discordjs/voice @discordjs/opus
const { DisTube } = require('distube');
const { Client, GatewayIntentBits } = require('discord.js');
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildVoiceStates,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
],
});
const distube = new DisTube(client, {
emitNewSongOnly: true,
});
distube.on('playSong', (queue, song) =>
queue.textChannel.send(`Playing \`${song.name}\` - \`${song.formatDuration()}\``)
);
client.on('messageCreate', message => {
if (message.content.startsWith('!play')) {
distube.play(message.member.voice.channel, message.content.slice(6), {
message,
textChannel: message.channel,
member: message.member,
});
}
});
client.login('TOKEN');
Contributions are welcome! Please read our Contributing Guidelines before submitting a pull request.
Licensed under MIT License