A self-hostable Discord bot that plays YouTube audio in voice channels. Post a YouTube link (or use !play) and the bot joins your voice channel and streams the audio.
Because the code is open source and self-hosted, anyone can run their own instance — no single bot to shut down.
| Command | Description |
|---|---|
!play <youtube-url> |
Joins your voice channel and plays the video's audio |
| A bare YouTube URL | Same as !play — just paste the link |
!stop |
Stops playback and disconnects the bot |
Install these before anything else.
Download from nodejs.org.
Verify: node --version
The bot uses yt-dlp to stream YouTube audio. It must be installed and available on your system PATH.
Windows:
winget install yt-dlp.yt-dlp
macOS:
brew install yt-dlp
Linux:
sudo pip install yt-dlp
Verify: yt-dlp --version
Restart your terminal after installing so the PATH is updated.
Used to transcode the audio stream.
Windows:
winget install Gyan.FFmpeg
macOS:
brew install ffmpeg
Linux:
sudo apt install ffmpeg
Verify: ffmpeg -version
- Go to the Discord Developer Portal
- Click New Application and give it a name
- Go to the Bot tab in the left sidebar
- Click Add Bot
- Under Token, click Reset Token and copy the token — you'll need this later
Still on the Bot tab, scroll down to Privileged Gateway Intents and enable:
- Server Members Intent
- Message Content Intent
Click Save Changes.
- Go to the OAuth2 → URL Generator tab
- Under Scopes, check
bot - Under Bot Permissions, check:
- Read Messages / View Channels
- Send Messages
- Connect
- Speak
- Copy the generated URL at the bottom and open it in your browser to invite the bot to your server
git clone https://github.com/ashindlecker/PulseCord.git
cd discord-music-bot
npm installCopy the example environment file and add your bot token:
cp .env.example .envOpen .env and replace the placeholder with your token from the Developer Portal:
DISCORD_TOKEN=your_bot_token_here
Development (runs directly with ts-node, no build step):
npm run devProduction (compile first, then run):
npm run build
npm startYou should see Bot ready: YourBotName#1234 in the console when it connects successfully.
| Package | Purpose |
|---|---|
discord.js |
Discord API client |
@discordjs/voice |
Voice channel connections and audio playback |
@discordjs/opus |
Opus audio codec |
ffmpeg-static |
Bundled ffmpeg fallback for audio transcoding |
dotenv |
Loads the bot token from .env |
yt-dlp (system) |
Streams YouTube audio — must be installed separately |
MIT