How rezhajulio/pythonid-bot works
PythonID is a multi-group Telegram moderation bot. It loads shared and per-group settings, registers configurable plugins, then processes group events for profile compliance, new-member verification, spam enforcement and admin moderation; scheduled jobs handle time-based restrictions and recovery. Persistent warning, trust, captcha and probation state is shared through SQLite. The graph preserves documented features whose handler details were not sampled; those links are based on the README or SOURCE INDEX references, not a full inspection of those implementations.
Main entry points: manager.py Plugin manager · service.py SQLite state · captcha.py Captcha verification · main.py Bot runtime
Components 33
Startup & Configuration
- Bot settings
src/bot/config.py - Group registry
src/bot/group_config.py - Plugin manager
src/bot/plugins/manager.py - Plugin toggles
src/bot/plugins/config.py - Bot runtime
src/bot/main.py - Spam registrations
src/bot/plugins/builtin/spam.py - Command registrations
src/bot/plugins/builtin/commands.py - Captcha registration
src/bot/plugins/builtin/captcha.py - Profile registration
src/bot/plugins/builtin/profile_monitor.py - AI registration
src/bot/plugins/builtin/ai_monitor.py - Job registration
src/bot/plugins/builtin/jobs.py
Moderation Workflows
- Profile checks
src/bot/handlers/message.py - Captcha verification
src/bot/handlers/captcha.py - Spam enforcement
src/bot/handlers/anti_spam.py - Duplicate spam
src/bot/handlers/duplicate_spam.py - Bio-bait detection
src/bot/handlers/bio_bait.py - Guest bot blocking
src/bot/handlers/guest_bot.py - AI moderation
src/bot/handlers/ai_spam_monitor.py
State & Shared Services
- SQLite state
src/bot/database/service.py - State models
src/bot/database/models.py - Telegram utilities
src/bot/services/telegram_utils.py - Restriction lock
src/bot/services/restriction_lock.py - Captcha recovery
src/bot/services/captcha_recovery.py - Restriction scheduler
src/bot/services/scheduler.py - Admin cache
src/bot/services/admin_cache.py - Classifier client
src/bot/services/classifier_client.py
Admin & Operations
- Warnings & trust
src/bot/handlers/warn.py - Verify & check
src/bot/handlers/verify.py - DM unrestriction
src/bot/handlers/dm.py - Topic protection
src/bot/handlers/topic_guard.py
Other components
- Telegram users
- Telegram API
- classifier.dev
Connections 48
- Telegram users → Bot runtime: sends updates
README.md - Bot runtime → Bot settings: loads settings
src/bot/main.py - Bot runtime → Group registry: initializes groups
src/bot/main.py - Bot runtime → Plugin manager: registers plugins
src/bot/main.py - Plugin manager → Spam registrations: registers
src/bot/plugins/manager.py - Plugin manager → Command registrations: registers
src/bot/plugins/manager.py - Plugin manager → Captcha registration: registers
src/bot/plugins/manager.py - Plugin manager → Profile registration: registers
src/bot/plugins/manager.py - Plugin manager → AI registration: registers
src/bot/plugins/manager.py - Plugin manager → Job registration: registers
src/bot/plugins/manager.py - Spam registrations → Spam enforcement: registers handlers
src/bot/plugins/builtin/spam.py - Spam registrations → Duplicate spam: registers handler
src/bot/plugins/builtin/spam.py - Spam registrations → Bio-bait detection: registers handler
src/bot/plugins/builtin/spam.py - Spam registrations → Guest bot blocking: registers handler
src/bot/plugins/builtin/spam.py - Command registrations → Warnings & trust: registers handler
src/bot/plugins/builtin/commands.py - Command registrations → Verify & check: registers handlers
src/bot/plugins/builtin/commands.py - Captcha registration → Captcha verification: registers handler
src/bot/plugins/builtin/captcha.py - Profile registration → Profile checks: registers handler
src/bot/plugins/builtin/profile_monitor.py - AI registration → AI moderation: registers handler
src/bot/plugins/builtin/ai_monitor.py - Job registration → Restriction scheduler: registers jobs
src/bot/plugins/builtin/jobs.py - Plugin manager → Plugin toggles: resolves toggles
src/bot/plugins/manager.py - Bot runtime → SQLite state: initializes database
src/bot/main.py - Profile checks → SQLite state: reads state
- Captcha verification → SQLite state: records challenges
src/bot/handlers/captcha.py - Captcha verification → Restriction lock: serializes changes
src/bot/handlers/captcha.py - Captcha verification → Telegram utilities: uses helpers
src/bot/handlers/captcha.py - Spam enforcement → SQLite state: records violations
src/bot/handlers/anti_spam.py - Spam enforcement → Telegram utilities: uses helpers
src/bot/handlers/anti_spam.py - Duplicate spam → Spam enforcement: reuses checks
src/bot/handlers/duplicate_spam.py - Guest bot blocking → SQLite state: reads trust state
src/bot/handlers/guest_bot.py - Guest bot blocking → Restriction lock: serializes changes
src/bot/handlers/guest_bot.py - AI moderation → Classifier client: requests classification
src/bot/handlers/ai_spam_monitor.py - Classifier client → classifier.dev: calls service
README.md - AI moderation → Telegram utilities: uses helpers
src/bot/handlers/ai_spam_monitor.py - Captcha recovery → SQLite state: loads pending challenges
src/bot/services/captcha_recovery.py - Captcha recovery → Captcha verification: recovers challenges
src/bot/services/captcha_recovery.py - Restriction scheduler → SQLite state: checks warnings
src/bot/services/scheduler.py - Restriction scheduler → Restriction lock: serializes changes
src/bot/services/scheduler.py - Admin cache → Group registry: lists groups
src/bot/services/admin_cache.py - Admin cache → Telegram API: fetches admins
src/bot/services/admin_cache.py - Warnings & trust → Telegram utilities: uses helpers
src/bot/handlers/warn.py - Verify & check → SQLite state: updates whitelist
src/bot/handlers/verify.py - Verify & check → Restriction lock: serializes changes
src/bot/handlers/verify.py - DM unrestriction → SQLite state: reads trust state
- Topic protection → Telegram API: protects topic
README.md - Spam enforcement → Telegram API: deletes or restricts
src/bot/handlers/anti_spam.py - Captcha verification → Telegram API: challenges members
src/bot/handlers/captcha.py - Telegram utilities → Telegram API: calls Telegram
src/bot/services/telegram_utils.py