You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Copy file name to clipboardExpand all lines: README.md
+57-7Lines changed: 57 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,31 +43,81 @@ Official Telegram bot for the main Italian Python group and local sub-groups in
43
43
# or: uv run python -m python_italy_bot.main
44
44
```
45
45
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
+
46
63
## Configuration
47
64
48
65
| Variable | Required | Description |
49
66
|----------|----------|-------------|
50
67
|`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.|
52
69
|`CAPTCHA_SECRET_COMMAND`| No | Secret command for captcha (default: `python-italy`) |
53
70
|`CAPTCHA_FILE_PATH`| No | Path to rules file (default: `assets/regolamento.md`) |
54
71
|`MAIN_GROUP_ID`| No | Main group ID for multi-group logic |
55
72
|`LOCAL_GROUP_IDS`| No | Comma-separated sub-group IDs |
56
73
57
74
## Commands
58
75
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).
0 commit comments