A Pyrogram-based bot that monitors and enforces channel ban policies by:
- Detecting when admins ban members
- Automatically removing violating admins
- Reporting all actions to the main admin
- Ban Monitoring: Tracks all ban actions in the channel
- Admin Enforcement: Automatically removes admins who ban members
- Detailed Reporting: Sends violation reports to the main admin
- Permission Checks: Verifies bot privileges before acting
- Python 3.7+
- Pyrogram
- Telegram API credentials
- Bot with admin privileges in your channel
-
Clone the repository or copy the bot code
-
Install dependencies:
pip install pyrogram python-dotenv
-
Create a .env file with your credentials:
env API_ID=your_api_id API_HASH=your_api_hash BOT_TOKEN=your_bot_token ADMIN_ID=your_user_id CHANNEL=your_channel
Ensure your bot has these admin permissions:
- Add admins
- Change admin privileges
- Delete messages (recommended)
- Start the bot with
/start
in your private chat - Add bot to your channel
- The bot will begin monitoring the channel
- Violations will be reported to your private chat
- Requires the bot to be admin with sufficient privileges
- Can only track bans made after bot activation
If the bot fails to remove admins:
- Verify the bot has all required permissions
- Check that the bot's admin rank is higher than the admins it needs to remove