# How do music bots work on Discord?

> How Discord music bots work: joining voice, streaming audio from sources, managing queues, and why many bots avoid YouTube. Includes common fixes.

URL: https://www.jalkarna.in/based/learn/how-music-bots-work-on-discord/  
Last updated: 2026-11-16

A Discord music bot joins a voice channel as a participant, finds audio from a source, and streams it into the channel while you control it with commands or buttons. The bot doesn't play music from your device: it fetches the audio itself, encodes it, and sends it to Discord's voice servers, which deliver it to everyone listening.

## How does a music bot play audio?

The basic flow has five steps:

1. **You ask for a song.** You give a search term or a link.
2. **The bot resolves it.** It searches a catalog or reads the link to find a playable audio stream.
3. **It joins voice.** The bot connects to your voice channel. Discord allows a bot to be in only one voice channel per server at a time.
4. **It streams.** Audio is decoded, adjusted for volume, re-encoded with the [Opus codec](https://en.wikipedia.org/wiki/Opus_(audio_format)) that Discord voice uses, and sent as a live stream.
5. **It manages the queue.** When a track ends, the bot starts the next one.

Streaming means the bot doesn't need to keep a library of files. Some bots download or cache tracks first, others read the stream as it plays.

## Where does the music come from?

This is the part that most often decides whether a bot works well. A bot needs a **source**: a service it's allowed to fetch audio from. Different bots use different sources, such as open or artist-friendly platforms, or services with public catalogs. Sources can change their rules or block automated access, which is why a bot that worked last month can suddenly fail on certain links.

A few practical points:

- **Direct links** from a supported service play as-is.
- **Search terms** are matched against the sources the bot checks, usually in a fixed order.
- **Links from unsupported services** are often read only for the title and artist, then searched elsewhere, so the version you hear may differ from the one you linked.

## How do music queues work?

A queue is an ordered list of upcoming tracks. Typical features:

- **Add / remove:** append a track or take one out by position.
- **Skip and stop:** move to the next track, or clear everything and leave.
- **Shuffle:** randomize the order of upcoming tracks.
- **Loop:** repeat the current track or the whole queue.
- **Seek and volume:** jump to a time in the track and adjust loudness.

Most bots also set a maximum queue length so one person can't add an unlimited playlist.

## Slash commands vs prefix commands

Music bots historically used prefix commands like `!play`. Many now support slash commands as well. See [slash commands vs prefix commands](https://www.jalkarna.in/based/learn/slash-commands-vs-prefix-commands/) for how they differ.

## Common problems and fixes

- **Bot joins but is silent.** Check it has Connect and Speak permissions in that voice channel; see [how Discord permissions work](https://www.jalkarna.in/based/learn/how-discord-permissions-work/).
- **Audio stutters.** Usually a network or host issue on the bot side, or a very busy voice region.
- **A link won't play.** The source may be unsupported or blocked. Try searching the song name instead.
- **Controls don't respond.** Many bots require you to be in the same voice channel, or hold a DJ role.

## Doing this with Based

Based's `/play` takes a song name or link and streams it in voice; nothing is downloaded or cached. Song names are searched on JioSaavn first, then SoundCloud, then Audius. JioSaavn, SoundCloud and Audius links play directly. Spotify, Apple Music and YouTube links are read for the title and artist and then searched. Playlists and albums are queued up to the queue limit, which defaults to 100.

Controls live in one player panel with buttons for pause, skip, stop, seek by 15 seconds, volume, loop, shuffle and queue. The matching commands are `/pause`, `/resume`, `/skip`, `/stop`, `/queue`, `/playing`, `/volume`, `/seek`, `/remove`, `/shuffle`, `/loop` and `/clearqueue`. An optional DJ role can restrict who controls playback. Based pauses when no human is listening and leaves after two minutes alone or three idle minutes. Every slash command also works with the "." prefix, such as `.play`. More in the [music docs](https://www.jalkarna.in/based/docs/music/) and the [music feature page](https://www.jalkarna.in/based/features/music/).

## FAQ

### Do Discord music bots download songs?

It depends on the bot. Many stream audio as it plays, and some cache files. Based streams and doesn't download or cache tracks.

### Why can't I play a Spotify link directly?

Spotify doesn't hand out playable audio to bots. Bots that accept Spotify links usually read the title and artist and then find the song on another source, so the version may differ.

### Why is my music bot not making sound?

The most common causes are missing Connect or Speak permission, the bot being in a different voice channel, or a source that is blocked. Check permissions first.

### Can a bot play in two voice channels at once?

Not within one server. Discord limits a bot to one voice connection per server at a time.

## Related
- [What is a Discord bot?](https://www.jalkarna.in/based/learn/what-is-a-discord-bot/)
- [Slash commands vs prefix commands on Discord](https://www.jalkarna.in/based/learn/slash-commands-vs-prefix-commands/)
- [How Discord permissions work](https://www.jalkarna.in/based/learn/how-discord-permissions-work/)
- [What are temporary voice channels on Discord?](https://www.jalkarna.in/based/learn/what-are-temporary-voice-channels/)
- [How do voice AI assistants work?](https://www.jalkarna.in/based/learn/how-voice-ai-assistants-work/)
