How to Make a Discord Music Bot
On this page
A music bot is a Discord bot that joins a voice channel and plays audio. The bot part — commands, a queue, a now-playing message — is ordinary bot code. The hard part is the audio: fetching tracks, encoding them and streaming them into the voice channel without stuttering.
This guide explains the two ways to handle the audio, which libraries still work after Discord's 2026 voice changes, and what a music bot may and may not play. If you have never made a bot, start with how to make a Discord bot.
First: Discord's encrypted voice (DAVE)
Since 1 March 2026, Discord only allows end-to-end encrypted voice calls, through a protocol called DAVE. A bot built on a library that does not support it can no longer join voice channels at all. This is why many older music-bot tutorials and repositories stopped working.
Before you start, make sure your stack is new enough:
| Library | DAVE support from |
|---|---|
| discord.py | 2.7.0, installed as discord.py[voice] |
| @discordjs/voice | 0.19, which needs Node.js 22.12 or newer |
| Lavalink server | 4.2.0 |
| discord-player | 7.2.0 |
Two ways to play audio: Lavalink or FFmpeg
| Lavalink | FFmpeg in the bot | |
|---|---|---|
| How it works | A separate audio server streams the music; the bot sends it commands | The bot itself decodes and streams the audio with FFmpeg |
| Bot needs | A Lavalink client library | FFmpeg and Opus installed alongside the bot |
| Scales to | Many servers at once; one Lavalink can feed several bots | A few servers before the bot's CPU becomes the limit |
| Good for | Any bot you expect to grow | Learning, or a bot for one server |
Most public music bots use Lavalink. FFmpeg is simpler to start with because there is only one program to run.
Lavalink client libraries that are maintained
These clients are on Lavalink's official list and had releases in 2026 with the voice changes above:
- JavaScript (discord.js): lavalink-client, Shoukaku, Riffy, Moonlink.js
- Python (discord.py): Wavelink, lavalink.py, mafic, pomice
- C#: Lavalink4NET
- Java (JDA): Lavalink-Client
Each one connects to a Lavalink server with a host, port and password, then gives your bot commands such as search, play, skip and volume. Setting up the server itself is covered in how to host a Lavalink server.
In JavaScript there is also discord-player, which handles the audio inside the bot. Its current version no longer supports YouTube; it plays SoundCloud, Vimeo, attachments and Spotify or Apple Music links through other sources.
The FFmpeg way, in a few lines
To see voice working, play a file you own. In Python, install the voice extra and make sure ffmpeg is on your system:
pip install "discord.py[voice]"
Then, inside a slash command, join the caller's channel and play a local file:
channel = interaction.user.voice.channel
voice = await channel.connect()
voice.play(discord.FFmpegPCMAudio("song.mp3"))
await interaction.response.send_message("Playing.")
In JavaScript the equivalent is @discordjs/voice with @discordjs/opus and FFmpeg. A real bot adds a queue, skip and stop commands, and leaves the channel when it is empty.
What a music bot may play
This is where most music bots get into trouble, so be clear about it before you build:
- YouTube's terms do not allow downloading or rebroadcasting its content without permission, or getting around its protections. Large music bots have been shut down over exactly this.
- Discord's community guidelines forbid sharing content that violates anyone's intellectual property, and the bot's owner is responsible for what it does.
- Safer sources: music you own or have a licence for, royalty-free and Creative Commons libraries, internet radio that allows it, and files your members upload with the rights to share them.
Lavalink and its plugins can technically play from many sites; whether you are allowed to is a separate question, and it is yours to answer.
Hosting a music bot
A music bot needs to stay online and keep a steady connection while it streams, which a home PC on Wi-Fi rarely manages for long. On HytHost Discord bot hosting:
- The bot runs on the Node.js, Python, Java, Go, C# or Bun runtime you pick at order.
- Lavalink is a runtime of its own. It runs as a separate server: order one plan for the bot and one with the Lavalink runtime, or on a plan with several bot slots ask us to move one of them to Lavalink.
- Point the bot's Lavalink client at the Lavalink server's address, port and password, as shown in its panel.
Keeping the bot itself online, with auto-restart and the token in a safe place, is covered in how to host a Discord bot 24/7.
Run the bot and its Lavalink server on HytHost Discord bot hosting — Node.js, Python, Java, Lavalink and more, from €0.89/mo.
See bot hosting plansFrequently asked questions
Most likely Discord's encrypted voice. Since 1 March 2026 only clients that support the DAVE protocol can join voice calls. Update to discord.py 2.7, @discordjs/voice 0.19 or Lavalink 4.2 or newer, and a current Lavalink client.
No. A small bot can stream with FFmpeg directly. Lavalink is worth it once the bot plays in several servers at once, because it takes the audio work off the bot.
Technically some tools still can, but YouTube's terms do not allow downloading or rebroadcasting its content without permission, and the tools break often. Music you own or have a licence for is the safe choice.
With discord.js, a Lavalink client such as lavalink-client or Shoukaku; with discord.py, Wavelink or lavalink.py. Pick one with a 2026 release, so it supports Discord's encrypted voice.
The bot itself is light; the audio work is what costs. With Lavalink, give the Lavalink server about 1 GB for a small bot (our recommendation) and the bot what it needs without music.
Put your music bot online
HytHost Discord bot hosting runs your bot and your Lavalink server, with a MySQL database and backups — from €0.89/mo.
Live chat 8 AM – 11 PM (Chișinău time) · tickets answered during business hoursWas this guide helpful?