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: update README with comprehensive feature list and workflow diagram
- Enhanced feature list with organized sections: Core Monitoring, Restriction & Unrestriction, New Member Protection, Admin Tools
- Added missing config variables: CAPTCHA_ENABLED, CAPTCHA_TIMEOUT_SECONDS, NEW_USER_PROBATION_HOURS, NEW_USER_VIOLATION_THRESHOLD, LOGFIRE_ENABLED, LOGFIRE_TOKEN, LOG_LEVEL
- Updated architecture section with all current handlers and services
- Completely redesigned Mermaid workflow diagram to include:
* Captcha verification flow with timeout handling
* Anti-spam enforcement for new users on probation
* URL whitelisting and violation tracking
* Admin verification commands (/verify, /unverify)
* Forwarded message handling for inline verify/unverify buttons
* Callback handlers for button interactions
* Captcha recovery on bot restart
- Reflects current state from latest commits including anti-spam, captcha, and verification features
A Telegram bot that monitors group messages and warns users who don't have a public profile picture or username set.
3
+
A comprehensive Telegram bot for managing group members with profile verification, captcha challenges, and anti-spam protection.
4
4
5
5
## Features
6
6
7
-
- Monitors all text messages in a configured group
7
+
### Core Monitoring
8
+
- Monitors all messages in a configured group
8
9
- Checks if users have a public profile picture
9
10
- Checks if users have a username set
10
11
- Sends warnings to a dedicated topic (thread) for non-compliant users
11
12
-**Warning topic protection**: Only admins and the bot can post in the warning topic
12
-
-**DM unrestriction flow**: Restricted users can DM the bot to get unrestricted after completing their profile
13
+
14
+
### Restriction & Unrestriction
13
15
-**Progressive restriction**: Optional mode to restrict users after multiple warnings (message-based)
14
16
-**Time-based auto-restriction**: Automatically restricts users after X hours from first warning
15
17
-**Scheduled job**: Background scheduler checks and enforces time-based restrictions every 5 minutes
18
+
-**DM unrestriction flow**: Restricted users can DM the bot to get unrestricted after completing their profile
19
+
20
+
### New Member Protection
21
+
-**Captcha verification**: New members must verify they're human before joining (optional)
22
+
-**Captcha timeout recovery**: Automatically recovers pending verifications after bot restart
23
+
-**New user probation**: New members restricted from sending links/forwarded messages for 3 days (configurable)
24
+
-**Anti-spam enforcement**: Tracks violations and restricts spammers after threshold
25
+
26
+
### Admin Tools
27
+
-**/verify command**: Whitelist users with hidden profile pictures (DM only)
28
+
-**/unverify command**: Remove users from verification whitelist (DM only)
29
+
-**Inline verification**: Forward messages to bot for quick verify/unverify buttons
30
+
-**Automatic clearance**: Sends notification when verified users' warnings are cleared
16
31
17
32
## Requirements
18
33
@@ -204,61 +219,89 @@ PythonID/
204
219
205
220
## Bot Workflow
206
221
207
-
The following diagram illustrates the complete bot workflow including message handling, restriction logic, DM unrestriction, background scheduler jobs, and captcha verification:
222
+
The following diagram illustrates the complete bot workflow including captcha verification, anti-spam protection, profile monitoring, restriction logic, DM unrestriction, admin verification, and background scheduler jobs:
class Init,FetchAdmins,StartJobs,Poll,CheckProfile,CheckDMProfile,ProcessMsg,SendCaptcha,WaitCaptcha processNode
323
-
class UpdateType,TopicGuard,IsAdmin,CheckBot,CheckWhitelist,ProfileComplete,CheckMode,CheckCount,CheckInGroup,CheckPendingCaptcha,DMProfileComplete,CheckBotRestricted,CheckCurrentStatus,HasExpired,CheckKicked,NextUser,CheckAdminVerify,CheckAdminUnverify,CaptchaAnswer decisionNode
324
-
class IncrementDB,SilentIncrement,MarkRestricted,ClearRecord,ClearRecord2,QueryDB,ClearKicked,MarkTimeRestricted,AddWhitelist,RemoveWhitelist dataNode
325
-
class DeleteMsg,SendWarning,SendFirstWarning,RestrictUser,SendRestrictionMsg,SendNotInGroup,SendCaptchaRedirect,SendMissing,SendNoRestriction,SendAlreadyUnrestricted,UnrestrictUser,SendSuccess,ApplyTimeRestriction,SendTimeNotice,SchedulerJob,SendVerifySuccess,SendUnverifySuccess,DenyVerify,DenyUnverify,UnrestrictMember,KickMember,Continue actionNode
326
-
class End1,End2,End3,End4,End5,End6,End7,EndJob endNode
327
-
class Start,StartNode startNode
383
+
class Init,FetchAdmins,RecoverPending,StartJobs,Poll,CheckProfile,CheckDMProfile,RestrictAndChallenge,StorePending,ScheduleTimeout,WaitCaptcha,StartProbation,StartProbationAfter processNode
384
+
class UpdateType,RecoverCaptcha,TopicGuard,IsAdmin,CheckBot,CheckWhitelist,ProfileComplete,CheckMode,CheckCount,CheckInGroup,CheckPendingCaptcha,DMProfileComplete,CheckBotRestricted,CheckCurrentStatus,HasExpired,CheckKicked,NextUser,CheckAdminVerify,CheckAdminUnverify,CaptchaAnswer,CheckCaptchaEnabled,CheckProbation,CheckExpired,CheckViolation,CheckWhitelisted,ViolationCount,CheckWarningsExist,CheckAdminForward,ExtractUser decisionNode
385
+
class IncrementDB,SilentIncrement,MarkRestricted,ClearRecord,ClearRecord2,QueryDB,ClearKicked,MarkTimeRestricted,AddWhitelist,RemoveWhitelist,IncrementViolation,ClearProbation,DeleteWarnings dataNode
386
+
class DeleteMsg,SendWarning,SendFirstWarning,RestrictUser,SendRestrictionMsg,SendNotInGroup,SendCaptchaRedirect,SendMissing,SendNoRestriction,SendAlreadyUnrestricted,UnrestrictUser,SendSuccess,ApplyTimeRestriction,SendTimeNotice,SchedulerJob,SendVerifySuccess,SendUnverifySuccess,DenyVerify,DenyUnverify,UnrestrictMember,KickMember,UpdateMessage,CancelTimeout,ShowError,DeleteSpam,SendSpamWarning,RestrictSpammer,SendSpamRestriction,UnrestrictVerified,SendClearance,DenyForward,SendButtons,SendExtractError,ProcessVerify,ProcessUnverify actionNode
387
+
class End1,End2,End3,End4,End5,End6,End7,End8,End9,End10,EndJob,StartProbation endNode
388
+
class Start startNode
328
389
```
329
390
330
391
## How It Works
@@ -338,14 +399,18 @@ The bot is organized into clear modules for maintainability:
338
399
-`message.py`: Monitors group messages and sends warnings/restrictions
339
400
-`dm.py`: Handles DM unrestriction flow
340
401
-`topic_guard.py`: Protects warning topic from unauthorized messages
402
+
-`captcha.py`: Captcha verification for new members
403
+
-`anti_spam.py`: Anti-spam enforcement for users on probation
404
+
-`verify.py`: /verify and /unverify command handlers
341
405
-**services/**: Business logic and utilities
342
406
-`scheduler.py`: JobQueue background job that runs every 5 minutes for time-based auto-restrictions
0 commit comments