A self-hosted Discord music bot that streams lofi radio 24/7 and stays connected even if the voice channel is empty.
Built with:
- Node.js
- discord.js
- @discordjs/voice
- Express (for cloud uptime support)
- β Automatically joins a specific voice channel
- β Streams continuous radio (never-ending stream)
- β Auto-restarts stream if connection drops
- β Can run 24/7 on Render / Railway
- β Includes Express web server for uptime monitoring
- β No premium, no dependency on public music bots
git clone https://github.com/CodeWithShrey-collab/Study247-bot.git
cd study247botnpm installCreate a .env file in the root directory:
TOKEN=your_discord_bot_token
VOICE_CHANNEL_ID=your_voice_channel_id
STREAM_URL=https://live.hunter.fm/lofi_high
node index.jsThe bot will:
- Log in
- Join the configured voice channel
- Begin streaming lofi music 24/7
Create a Web Service on Render.
Build Command:
npm install
Start Command:
node index.js
Add the following environment variables in the Render dashboard:
TOKENVOICE_CHANNEL_IDSTREAM_URL
After deployment, use an uptime monitoring service (like UptimeRobot) to ping the service URL every 5 minutes to prevent sleep mode.
Voice Permissions:
- Connect
- Speak
Text Permissions (Optional):
- View Channels
- Send Messages
- Read Message History
The bot can go down if on free plan may be after some weeks or months so u need to manually deploy again. In my case i did it on render.