Skip to content

Commit a33b2f4

Browse files
committed
docs(README): enhance bot usage instructions and configuration details
- Added section on running the bot with start/stop commands. - Expanded configuration table with detailed descriptions for DATABASE_URL. - Updated commands section with usage examples for each command. - Included testing instructions for bot functionality and moderation commands.
1 parent acd93f3 commit a33b2f4

1 file changed

Lines changed: 57 additions & 7 deletions

File tree

README.md

Lines changed: 57 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,31 +43,81 @@ Official Telegram bot for the main Italian Python group and local sub-groups in
4343
# or: uv run python -m python_italy_bot.main
4444
```
4545

46+
## Running the bot
47+
48+
Start the bot:
49+
50+
```bash
51+
uv run python-italy-bot
52+
```
53+
54+
The bot starts polling for updates. You should see:
55+
56+
```
57+
INFO - Starting bot...
58+
INFO - Application started
59+
```
60+
61+
Stop with `Ctrl+C`.
62+
4663
## Configuration
4764

4865
| Variable | Required | Description |
4966
|----------|----------|-------------|
5067
| `TELEGRAM_BOT_TOKEN` | Yes | Bot token from [@BotFather](https://t.me/BotFather) |
51-
| `DATABASE_URL` | No | Database URL (placeholder for future use) |
68+
| `DATABASE_URL` | No | PostgreSQL URL (Neon or other). When set, uses PostgresRepository; otherwise in-memory. |
5269
| `CAPTCHA_SECRET_COMMAND` | No | Secret command for captcha (default: `python-italy`) |
5370
| `CAPTCHA_FILE_PATH` | No | Path to rules file (default: `assets/regolamento.md`) |
5471
| `MAIN_GROUP_ID` | No | Main group ID for multi-group logic |
5572
| `LOCAL_GROUP_IDS` | No | Comma-separated sub-group IDs |
5673

5774
## Commands
5875

59-
- `/ban` – Ban a user (admin only). Usage: `/ban @username`, `/ban user_id [reason]`, or reply to message with `/ban [reason]`
60-
- `/unban` – Unban a user (admin only)
61-
- `/mute` – Mute a user (admin only). Usage: `/mute @username [minutes] [reason]`
62-
- `/unmute` – Unmute a user (admin only)
63-
- `/report` – Report a message. Reply to the message with `/report [reason]`
76+
| Command | Who | Description |
77+
|---------|-----|-------------|
78+
| `/ban` | Admin | Ban a user. |
79+
| `/unban` | Admin | Unban a user. |
80+
| `/mute` | Admin | Mute a user (optionally for N minutes). |
81+
| `/unmute` | Admin | Unmute a user. |
82+
| `/report` | Anyone | Report a message. |
83+
84+
### Usage
85+
86+
- **Ban**: `/ban @username`, `/ban user_id [reason]`, or reply to a message with `/ban [reason]`
87+
- **Unban**: `/unban @username`, `/unban user_id`, or reply to user's message
88+
- **Mute**: `/mute @username [minutes] [reason]`, or reply to message. Omit minutes for indefinite mute.
89+
- **Unmute**: `/unmute @username`, `/unmute user_id`, or reply to user's message
90+
- **Report**: Reply to the offending message with `/report [reason]`
91+
92+
### Captcha (secret command)
93+
94+
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.
95+
96+
## Testing the bot
97+
98+
1. **Add the bot to a group**: Make the bot an admin so it can restrict members and ban/mute users.
99+
100+
2. **Test captcha**:
101+
- Join the group with a test account (not admin).
102+
- You should be restricted (read-only).
103+
- Open a private chat with the bot and send the secret command (e.g. `python-italy`).
104+
- You should be unrestricted in the group.
105+
106+
3. **Test moderation** (as admin):
107+
- `/ban @username` or reply to a message with `/ban [reason]`
108+
- `/unban @username` to unban
109+
- `/mute @username 60` to mute for 60 minutes
110+
- `/unmute @username` to unmute
111+
112+
4. **Test report** (as any member):
113+
- Reply to a message with `/report spam` (or any reason).
64114

65115
## Architecture
66116

67117
```
68118
src/python_italy_bot/
69119
├── main.py # Entry point, Application setup
70-
├── config.py # Pydantic settings from env
120+
├── config.py # Settings from env
71121
├── handlers/ # Telegram update handlers
72122
│ ├── welcome.py # New member + captcha flow
73123
│ ├── moderation.py # Ban, mute, report commands

0 commit comments

Comments
 (0)