A modular Telegram group management bot built with Pyrogram.
✨ Moderation Commands
- Kick, ban, unban users
- Mute and unmute members
- Delete and purge messages
📌 Admin Tools
- Pin and unpin messages
- Promote and demote users
- Manage chat settings
ℹ️ Information Commands
- User and chat info
- Statistics and admin list
- ID lookup
⚙️ Chat Settings
- Lock and unlock chat
- Set chat photo, title, and description
-
Clone or download this repository
-
Install dependencies
pip install -r requirements.txt- Create .env file
Create a
.envfile in the root directory with your credentials:
API_ID=12345678
API_HASH=your_api_hash_here
BOT_TOKEN=your_bot_token_here
LOG_LEVEL=INFO
SUDO_USERS=your_user_id- Run the bot
python -m MrManagerMrManager/
├── __init__.py # Package initialization
├── __main__.py # Entry point
├── config.py # Configuration management
├── logger.py # Logging setup
├── bot.py # Bot client
├── plugins/ # Command handlers
│ ├── __init__.py
│ ├── start.py # Start command
│ ├── help.py # Help command
│ ├── admin.py # Admin commands
│ ├── moderation.py # Moderation commands
│ ├── info.py # Info commands
│ └── settings.py # Settings commands
└── helpers/ # Helper utilities
├── __init__.py
├── decorators.py # Custom decorators
└── utils.py # Utility functions
API_ID: Your Telegram API ID (required)API_HASH: Your Telegram API hash (required)BOT_TOKEN: Your bot token from @BotFather (required)LOG_LEVEL: Logging level (DEBUG, INFO, WARNING, ERROR, CRITICAL) - default: INFOBOT_USERNAME: Your bot's usernameSUDO_USERS: Comma-separated list of user IDs with sudo access
- DEBUG: Detailed information for debugging
- INFO: General informational messages (default)
- WARNING: Warning messages
- ERROR: Error messages
- CRITICAL: Critical issues
To add a new plugin, create a new file in the plugins/ directory:
from pyrogram import Client, filters
from pyrogram.types import Message
from ..helpers.decorators import log_command, admin_only, group_only
from ..logger import logger
@Client.on_message(filters.command("mycommand"))
@log_command
@group_only
@admin_only
async def my_command(client: Client, message: Message):
"""My custom command."""
await message.reply_text("Hello from my command!")
logger.info("My command executed")The bot includes several useful decorators in helpers/decorators.py:
@admin_only: Restricts command to group admins@sudo_only: Restricts command to sudo users (defined in config)@group_only: Restricts command to group chats@private_only: Restricts command to private chats@log_command: Logs command usage
/start- Start the bot (private chat only)/help- Show help message/id- Get your user ID and chat ID/info- Get user information (reply to get other user's info)
/kick- Kick a user (reply to their message)/ban- Ban a user (reply to their message)/mute- Mute a user (reply to their message)/pin- Pin a message (reply to the message)/promote- Promote user to admin (reply to their message)/lock- Lock chat for non-admins/settitle New Title- Set new chat title
- Python 3.7+
- Pyrogram 2.0+
- TgCrypto
- python-dotenv
- Go to https://my.telegram.org
- Log in with your phone number
- Click on "API Development Tools"
- Create a new application
- Copy your
API_IDandAPI_HASH
- Message @BotFather on Telegram
- Send
/newbotand follow the instructions - Copy the bot token provided
This project is open source and available under the AGPL v3.0 License.
Developed by @dotenv with ❤️
For issues and questions, please open an issue on the repository.