An open-source Telegram music bot built with Python, Pyrogram, PyTgCalls, and FFmpeg, delivering fast, reliable, and high-quality audio streaming directly to Telegram voice chats.
ΛΉΚα΄κ±ΙͺΙͺ α΄α΄κ±Ιͺα΄ΛΌ is a powerful and modern Telegram music bot built for seamless voice chat streaming. It enables users to play music directly in Telegram voice chats using YouTube links, search queries, and live radio stations while offering administrators complete control over playback.
Designed with performance, stability, and simplicity in mind, the project combines modern asynchronous technologies to provide a fast, reliable, and highly customizable music streaming experience. Whether you're hosting a small community or managing a large Telegram group, Hasii Music is built to deliver consistent performance with minimal configuration.
- π About
- β Why Hasii Music?
- β¨ Features
- π Tech Stack
- π Requirements
- π Quick Start
- βοΈ Environment Variables
- π Installation
- π Commands
- π Project Structure
- π€ Contributing
- π Support
- π Credits
- π License
Choosing the right Telegram music bot shouldn't mean sacrificing performance, reliability, or ease of deployment. Hasii Music is designed with developers and communities in mind, providing a clean architecture, modern technologies, and powerful features while remaining simple to deploy and maintain.
- π Fast and lightweight architecture
- π΅ High-quality voice chat streaming
- π§ YouTube search and direct URL playback
- π» Built-in live radio support
- π Smart queue management
- π‘ Powerful administrator controls
- π₯ User authorization system
- π Automatic voice chat cleanup
- π³ Docker and Docker Compose support
- βοΈ Environment-based configuration
- π Modular and maintainable codebase
- β€οΈ Open-source under the GPL-3.0 License
Experience smooth and crystal-clear music playback optimized for Telegram voice chats using the Opus codec and FFmpeg.
Play music instantly from:
- YouTube links
- Search queries
- Supported playlists
Access and stream a collection of online radio stations directly within Telegram voice chats.
Manage playlists effortlessly with a built-in queue system.
- Add songs
- View queue
- Skip tracks
- Clear queue
Built with asynchronous libraries for efficient resource usage and responsive performance.
Complete playback management with support for:
- Play
- Pause
- Resume
- Skip
- Stop
- Seek
Restrict playback controls to:
- Chat administrators
- Authorized users
- Bot owner
- Sudo users
Automatically detects inactive voice chats and leaves them to conserve server resources.
Deploy effortlessly using Docker or Docker Compose for a consistent production environment.
Configure the bot entirely through environment variables without modifying the source code.
| Category | Technology |
|---|---|
| Language | Python 3.10+ |
| Telegram Framework | Pyrogram |
| Voice Chat | PyTgCalls |
| Database | MongoDB |
| Media Processing | FFmpeg |
| Runtime | Deno |
| Containerization | Docker & Docker Compose |
| Version Control | Git |
Before deploying ΛΉΚα΄κ±ΙͺΙͺ α΄α΄κ±Ιͺα΄ΛΌ, ensure your system meets the following requirements.
| Software | Version |
|---|---|
| Python | 3.10 or higher |
| FFmpeg | Latest |
| Deno | Latest |
| MongoDB | Atlas or Self-hosted |
| Git | Latest |
Before starting, install the required runtimes:
# Install FFmpeg
sudo apt update && sudo apt install ffmpeg -y
# Install Deno
curl -fsSL https://deno.land/x/install/install.sh | sh
Clone the repository.
git clone https://github.com/hasindu-nagolla/HasiiMusicBot.gitMove into the project directory.
cd HasiiMusicBotInstall the required dependencies.
pip install -r requirements.txtCreate your environment configuration.
cp sample.env .envUpdate the values inside .env.
Start the bot in another session.
bash startCreate a .env file in the project's root directory.
# Telegram API
API_ID=
API_HASH=
BOT_TOKEN=
# MongoDB
MONGO_DB_URI=
# Bot Configuration
OWNER_ID=
LOGGER_ID=
# Assistant Account
STRING_SESSION=
# Essential
COOKIE_URL=| Variable | Description |
|---|---|
API_ID |
Telegram API ID obtained from my.telegram.org |
API_HASH |
Telegram API Hash |
BOT_TOKEN |
Bot Token received from @BotFather |
MONGO_DB_URI |
MongoDB connection URI |
OWNER_ID |
Telegram User ID of the bot owner |
LOGGER_ID |
Group ID used for bot logs |
STRING_SESSION |
Pyrogram String Session for the assistant account |
COOKIE_URL |
YouTube cookies URL |
Clone the repository.
git clone https://github.com/hasindu-nagolla/HasiiMusicBot.gitEnter the project directory.
cd HasiiMusicBotInstall Python dependencies.
pip install -r requirements.txtCreate the environment file.
cp sample.env .envConfigure all required environment variables.
Start the bot.
bash startBuild the Docker image.
docker build -t hasiimusicbot:latest .Run the container.
docker run -d \
--restart unless-stopped \
--env-file .env \
-v ./HasiiMusic/cookies:/app/HasiiMusic/cookies \
-v ./downloads:/app/downloads \
--name hasiimusicbot \
hasiimusicbot:latestDeploy using Docker Compose.
docker compose up -d --buildView container logs.
docker compose logs -fStop the services.
docker compose downRestart the services.
docker compose restart| Command | Description |
|---|---|
/play <song/url> |
Play a song from a YouTube URL or search query |
/radio |
Browse available radio stations |
/queue |
Display the current music queue |
/ping |
Check the bot's latency and status |
/help |
Show the help menu |
| Command | Description |
|---|---|
/pause |
Pause the current playback |
/resume |
Resume playback |
/skip |
Skip the current track |
/next |
Play the next track in the queue |
/stop |
Stop playback |
/end |
Stop playback and clear the queue |
/seek <time> |
Seek to a specific timestamp |
/reload |
Reload administrator cache |
| Command | Description |
|---|---|
/stats |
Display bot statistics |
/broadcast |
Broadcast a message to all served chats |
/addsudo |
Add a sudo user |
/rmsudo |
Remove a sudo user |
| /maintenance | Enable or disable maintenance mode |
| /restart | Restart the bot |
| /logs | Retrieve the latest bot logs |
HasiiMusicBot/
βββ HasiiMusic/
β βββ __init__.py
β βββ __main__.py
β βββ cookies/
β βββ core/
β βββ helpers/
β βββ locales/
β βββ plugins/
β
βββ config.py
βββ sample.env
βββ requirements.txt
βββ Dockerfile
βββ docker-compose.yml
βββ setup
βββ start
βββ LICENSE
βββ Readme.md
Contributions are welcome and greatly appreciated.
Whether you're fixing bugs, improving documentation, optimizing performance, or adding new features, your contributions help make ΛΉΚα΄κ±ΙͺΙͺ α΄α΄κ±Ιͺα΄ΛΌ better for everyone.
Please read the CONTRIBUTING.md guide before opening an issue or submitting a pull request.
Need help with deployment or encountered an issue?
Feel free to reach out through the following platforms.
| Platform | Link |
|---|---|
| π» GitHub Repository | https://github.com/hasindu-nagolla/HasiiMusicBot |
| π’ Telegram Channel | https://t.me/TheInfinityAI |
| π¬ Telegram Support | https://t.me/Hasindu_Lakshan |
If you discover a bug, please open a GitHub Issue with detailed information so it can be reproduced and fixed quickly.
This project would not have been possible without the amazing open-source community.
Special thanks to:
- Anony β Inspiration for the original project.
- Pyrogram β Telegram MTProto framework.
- PyTgCalls β Telegram voice chat streaming library.
- FFmpeg β Audio processing and transcoding.
Thank you to everyone who has contributed through code, bug reports, feature suggestions, testing, and community support.
This project is licensed under the GNU General Public License v3.0 (GPL-3.0).
You are free to use, modify, and distribute this software. However, any derivative works must also be open-source and released under the exact same license.
For more information, see the LICENSE file.
If you find ΛΉΚα΄κ±ΙͺΙͺ α΄α΄κ±Ιͺα΄ΛΌ useful, consider giving this repository a β on GitHub.
Your support helps increase the project's visibility and encourages future development.
Made with β€οΈ by Hasindu Nagolla