XMusic is a modern Telegram bot that streams high-quality music into group voice chats. Powered by Pyrogram + PyTgCalls, it supports multiple platforms like YouTube, Spotify, Apple Music, SoundCloud, Resso, and more. It also includes basic group management features for convenience.
Below are the required and optional environment variables for deployment.
API_ID= # Required - Get from https://my.telegram.org
API_HASH= # Required - From https://my.telegram.org
BOT_TOKEN= # Required - Get t.me/BotFather
OWNER_ID= # Required - Your Telegram user ID
LOGGER_ID= # Required - Log group/channel ID
STRING_SESSION= # Required - Generate from @SessionBuilderbot
MONGO_DB_URI= # Required - MongoDB connection string
DEEP_API= # Optional - Get from https://deepai.org
API_URL= # Required - External API url for music DownloadWhere do I get each key?
| Key | Where to Get It | Steps | Notes |
|---|---|---|---|
API_ID & API_HASH |
my.telegram.org → API Development Tools | 1) Log in with Telegram → 2) Open API Development Tools → 3) Create app → 4) Copy values | Keep these private. Needed by both userbot & bot client. |
BOT_TOKEN |
@BotFather | 1) /newbot → 2) Set name & username → 3) Copy the token | Rotate if leaked. Store in .env. |
STRING_SESSION |
@SessionBuilderbot |
1) Start bot →
2) Provide API_ID/API_HASH →
3) Complete login →
4) Copy string
|
Userbot auth for Pyrogram. |
LOGGER_ID |
Telegram Channel/Group you own |
1) Create private channel/group →
2) Add your bot as admin →
3) Get ID via @XMusicro_bot or @MissRose_Bot
|
Use a private space so logs aren’t public. |
MONGO_DB_URI |
MongoDB Atlas |
1) Create free cluster →
2) Add database user & IP allowlist →
3) Copy connection string (mongodb+srv://...)
|
Required for persistence (queues, configs, etc.). |
COOKIE_URL |
Any secure host (e.g., Pastebin, Batbin) |
1) Upload your cookies.txt privately →
2) Set paste visibility to Unlisted →
3) Copy the raw URL
|
Improves YouTube reliability. Never commit raw cookies. |
DEEP_API / API_KEY / API_URL |
Provider of your choice | Sign up → generate key → paste here | Optional integrations (AI/extras). |
Details
🎵 Deploy XMusic on VPS
### Step 1: Update & Install Packages
sudo apt update && sudo apt upgrade -y
sudo apt install git curl python3-pip python3-venv ffmpeg -y
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt install -y nodejs
npm install -g npm
### Step 2: Clone Repo
git clone https://github.com/adityabty/music
cd music
tmux new -s Xmusic
### Step 3: Setup & Run
python3 -m venv venv
source venv/bin/activate
pip install -U pip && pip install -r requirements.txt
bash setup # Fill environment variables
bash start # Start bot
### Useful Commands
tmux detach # Use Ctrl+B, then D
tmux attach-session -t Xmusic # Attach to Running Bot session
tmux kill-session -t Xmusic # to kill the running bot session
rm -rf music # Uninstall the repoDetails
### Step 1: Clone Repo
git clone https://github.com/adityabty/music
cd music
### Step 2: Create .env File
nano .env
# Paste your environment variables here and save (Ctrl+O, Enter, Ctrl+X)
### Step 3: Build Image
docker build -t xmusic .
### Step 4: Run Container
docker run -d --name Xmusic --env-file .env --restart unless-stopped xmusic
### Step 5: Manage Container
docker logs -f music # View logs (Ctrl+C to exit)
docker stop music # Stop container
docker start music # Start again
docker rm -f music # Remove container
docker rmi music # Remove image| Platform | Deploy Link |
|---|---|
| 🔑 Generate Session | |
| 🌍 Heroku Deploy |
- sᴩᴇᴄɪᴀʟ ᴛʜᴀɴᴋs ᴛᴏ ᴀɴᴏɴʏ ғᴏʀ ᴀɴᴏɴxᴍᴜsɪᴄ
- ᴄʀᴀғᴛᴇᴅ ᴡɪᴛʜ ᴘᴀssɪᴏɴ ʙʏ 𝐀ᴅɪᴛʏᴀ 𝐂ᴏᴅᴇʀ


