Telegram bot for group moderation built with Python and Aiogram 3.
- Profanity filter
- Telegram invite link detection
- Warning system
- Auto mute after warning limit
- Progressive mute durations
- Join captcha
- Moderation logs
- User statistics
- Admin moderation commands
- Modular project structure
- Python 3.10+
- Aiogram 3
- SQLAlchemy
- SQLite
- Docker / Docker Compose
📦 Telegram-Moderation-Bot
┣ 📂 app
┃ ┣ 📂 config # App configuration, logging setup
┃ ┣ 📂 locales # UI text resources, message templates, and localization
┃ ┃ ┣ 📂 group # Group chat messages (bans, mutes, warns, captcha)
┃ ┃ ┗ 📂 private # Private chat messages (main menu, help, user stats)
┃ ┣ 📂 database # SQLAlchemy models, SQLite, and banwords
┃ ┣ 📂 filters # Admin validation and chat-type filters
┃ ┣ 📂 handlers # Modular routers (Moderation, Captcha, Filters, etc.)
┃ ┣ 📂 middlewares # DB session and Statistics middlewares
┃ ┣ 📂 services # Core business logic (Restrictions, History, Filters)
┃ ┣ 📂 utils # Helper functions (Time parsing, Text normalization)
┃ ┣ 📜 app.py # Main entry point & dispatcher configuration
┃ ┣ 📜 requirements.txt # Project dependencies
┣ 📜 .env # Environment variables
┣ 📜 docker-compose.yml # Docker orchestration
┗ 📜 LICENSE # MIT License
| Command | Description |
|---|---|
/start |
Start bot |
/help |
Show help |
/stats |
Show personal statistics |
/about |
Show project information |
/how_use_bot |
Show setup instructions |
| Command | Description |
|---|---|
/set_admin_chat |
Set moderation log chat |
/unset_admin_chat |
Disable moderation logs |
/warn |
Add warning |
/unwarn |
Remove warning |
/mute |
Mute user |
/unmute |
Remove mute |
/ban |
Ban user |
/unban |
Remove ban |
/addfilter |
Add banned word |
/removefilter |
Remove banned word |
/mute_list |
Show mute history |
/ban_list |
Show ban history |
/warn_list |
Show warning history |
/warn
/mute 30m spam
/ban 7d advertising
/addfilter badword
| Command | Description |
|---|---|
/report |
Report message to admins |
/stats |
Show user statistics |
Clone repository:
git clone https://github.com/kapusta123b/Telegram-Moderation-Bot
cd Telegram-Moderation-BotEdit .env:
BOT_TOKEN=your_bot_tokenRun container:
docker compose up -d --buildStop container:
docker compose downClone repository:
git clone https://github.com/kapusta123b/Telegram-Moderation-Bot
cd Telegram-Moderation-BotCreate virtual environment:
python -m venv venvActivate virtual environment:
source venv/bin/activatevenv\Scripts\activateInstall dependencies:
pip install -r app/requirements.txtEdit .env:
BOT_TOKEN=your_bot_tokenRun bot:
cd app
python app.pyFilter words are stored in:
app/database/banwords.txt
You can also manage filters directly from Telegram using:
/addfilter
/removefilter