Skip to content

Repository files navigation

Hasii Music

🎡 ΛΉΚœα΄€κœ±ΙͺΙͺ κ­™ ᴍᴜꜱΙͺα΄„ΛΌ

A Modern Telegram Music Bot for High-Quality Voice Chat Streaming

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.


Python License: GPL v3 GitHub Stars GitHub Forks GitHub Issues

Telegram Channel Telegram Support


πŸ“– About

ΛΉΚœα΄€κœ±ΙͺΙͺ ᴍᴜꜱΙͺα΄„ΛΌ 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.


πŸ“‘ Table of Contents


⭐ Why Hasii Music?

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.

Highlights

  • πŸš€ 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

✨ Features

🎡 High-Quality Audio Streaming

Experience smooth and crystal-clear music playback optimized for Telegram voice chats using the Opus codec and FFmpeg.

🎧 YouTube Integration

Play music instantly from:

  • YouTube links
  • Search queries
  • Supported playlists

πŸ“» Live Radio Streaming

Access and stream a collection of online radio stations directly within Telegram voice chats.

πŸ“ Smart Queue Management

Manage playlists effortlessly with a built-in queue system.

  • Add songs
  • View queue
  • Skip tracks
  • Clear queue

⚑ Optimized Performance

Built with asynchronous libraries for efficient resource usage and responsive performance.

πŸŽ› Playback Controls

Complete playback management with support for:

  • Play
  • Pause
  • Resume
  • Skip
  • Stop
  • Seek

πŸ‘₯ Authorization System

Restrict playback controls to:

  • Chat administrators
  • Authorized users
  • Bot owner
  • Sudo users

πŸ”„ Automatic Voice Chat Cleanup

Automatically detects inactive voice chats and leaves them to conserve server resources.

🐳 Docker Ready

Deploy effortlessly using Docker or Docker Compose for a consistent production environment.

πŸ”§ Easy Configuration

Configure the bot entirely through environment variables without modifying the source code.


πŸ— Tech Stack

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

πŸ“‹ Requirements

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

πŸ”§ Installing Prerequisites (Linux/Ubuntu)

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

πŸš€ Quick Start

Clone the repository.

git clone https://github.com/hasindu-nagolla/HasiiMusicBot.git

Move into the project directory.

cd HasiiMusicBot

Install the required dependencies.

pip install -r requirements.txt

Create your environment configuration.

cp sample.env .env

Update the values inside .env.

Start the bot in another session.

bash start

βš™οΈ Environment Variables

Create 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

πŸ›  Installation

Local Installation

Clone the repository.

git clone https://github.com/hasindu-nagolla/HasiiMusicBot.git

Enter the project directory.

cd HasiiMusicBot

Install Python dependencies.

pip install -r requirements.txt

Create the environment file.

cp sample.env .env

Configure all required environment variables.

Start the bot.

bash start

Docker

Build 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:latest

Docker Compose

Deploy using Docker Compose.

docker compose up -d --build

View container logs.

docker compose logs -f

Stop the services.

docker compose down

Restart the services.

docker compose restart

πŸ“– Commands

πŸ‘€ User Commands

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

πŸ›‘ Admin Commands

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

πŸ‘‘ Owner Commands

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 |


πŸ“‚ Project Structure

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

🀝 Contributing

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.


πŸ“ž Support

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.


πŸ™ Credits

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.


πŸ“„ License

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.


⭐ Support the Project

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

About

An advanced Telegram Music Bot written in Python. Experience high-quality audio streaming, YouTube & live radio playback, queue management, and multi-language support for Telegram voice chats using Pyrogram and PyTgCalls.

Topics

Resources

Contributing

Security policy

Stars

Watchers

Forks

Releases

Contributors

Languages