| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Official Telegram bot for the main Italian Python group and local sub-groups in Italy.
Electus — named after Neo's Latin epithet ("the chosen one") from The Matrix. The bot personality blends Matrix and Python themes, guiding users through verification and community moderation in Italian.
Install UV if needed:
curl -LsSf https://astral.sh/uv/install.sh | shInstall dependencies:
uv syncCopy the environment template and configure:
cp .env.example .env
# Edit .env and set TELEGRAM_BOT_TOKEN(Optional) Set the bot name and description in @BotFather:
If using PostgreSQL (DATABASE_URL set), create the schema:
psql "$DATABASE_URL" -f schema.sqlRun the bot:
uv run python-italy-bot
# or: uv run python -m python_italy_bot.mainStart the bot:
uv run python-italy-botThe bot starts polling for updates. You should see:
INFO - Starting bot... INFO - Application started
Stop with Ctrl+C.
| Variable | Required | Description |
|---|---|---|
| TELEGRAM_BOT_TOKEN | Yes | Bot token from @BotFather |
| DATABASE_URL | No | PostgreSQL URL (Neon or other). When set, uses PostgresRepository; otherwise in-memory. |
| CAPTCHA_SECRET_COMMAND | No | Secret command for captcha (default: python-italy) |
| CAPTCHA_FILE_PATH | No | Path to rules file (default: assets/regolamento.md) |
| MAIN_GROUP_ID | No | Main group ID for multi-group logic |
| LOCAL_GROUP_IDS | No | Comma-separated sub-group IDs |
| Command | Who | Description |
|---|---|---|
| /id | Anyone | Returns chat ID and your user ID. |
| /ban | Admin | Ban a user. |
| /unban | Admin | Unban a user. |
| /mute | Admin | Mute a user (optionally for N minutes). |
| /unmute | Admin | Unmute a user. |
| /report | Anyone | Report a message. |
| @admin | Anyone | Request admin intervention (no reply needed). |
New members must send the secret command in DM to the bot. Default: python-italy (configurable via CAPTCHA_SECRET_COMMAND). Send it as plain text in a private chat with the bot.
Add the bot to a group: Make the bot an admin so it can restrict members and ban/mute users.
Test captcha:
Test moderation (as admin):
Test report (as any member):
Test @admin (as any member):
src/python_italy_bot/ ├── main.py # Entry point, Application setup ├── config.py # Settings from env ├── handlers/ # Telegram update handlers │ ├── welcome.py # New member + captcha flow │ ├── moderation.py # Ban, mute, report commands │ └── spam.py # Spam detection ├── services/ # Business logic │ ├── captcha.py # Captcha verification │ ├── spam_detector.py │ └── moderation.py ├── db/ # Persistence abstraction │ ├── base.py # Repository interface │ ├── models.py # Domain models │ └── in_memory.py # In-memory implementation └── assets/ # Captcha/rules file
MIT
| Back | FazBrowse Home | New Git URL |