Discord · Guide

How to Make a Discord Music Bot

Updated October 10, 2026 5 min read

On this page
  1. First: Discord's encrypted voice (DAVE)
  2. Two ways to play audio: Lavalink or FFmpeg
  3. Lavalink client libraries that are maintained
  4. The FFmpeg way, in a few lines
  5. What a music bot may play
  6. Hosting a music bot
  7. FAQ

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:

LibraryDAVE support from
discord.py2.7.0, installed as discord.py[voice]
@discordjs/voice0.19, which needs Node.js 22.12 or newer
Lavalink server4.2.0
discord-player7.2.0

Two ways to play audio: Lavalink or FFmpeg

LavalinkFFmpeg in the bot
How it worksA separate audio server streams the music; the bot sends it commandsThe bot itself decodes and streams the audio with FFmpeg
Bot needsA Lavalink client libraryFFmpeg and Opus installed alongside the bot
Scales toMany servers at once; one Lavalink can feed several botsA few servers before the bot's CPU becomes the limit
Good forAny bot you expect to growLearning, 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.

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 plans
FAQ

Frequently 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 hours

Was this guide helpful?