How drtnn/telegram-secretary-bot works
This is a Telegram secretary bot that records users’ business-chat messages and notifies the connected user when messages are edited or deleted; it also saves and relays media. The visible runtime starts polling, registers business-message and private-command handlers, persists user/message records, and periodically removes old records and cached files. The README provides no further capability documentation. Edges reflect shown calls and imports; dispatch from Telegram and some content-helper details are not fully shown.
Main entry points: repositories.py Data repositories · content.py Message content operations · loader.py Bot wiring · business_message.py Business handlers
Components 16
Bot runtime
- Polling startup
app/main.py - Bot wiring
app/loader.py - Runtime settings
app/config.py
Telegram handlers
- Business handlers
app/controller/business_message.py - Private start handler
app/controller/private.py
Message processing
- Message content operations
app/utils/content.py - Message templates
app/utils/patterns.py - User link markup
app/utils/markups.py - Scheduled cleanup
app/utils/content.py
Persistence and files
- Filesystem storage
app/utils/storage.py - Data repositories
app/database/repositories.py - User and message models
app/database/models.py - Database sessions
app/database/session.py
Other components
- Chat users
- Telegram API
- PostgreSQL
Connections 26
- Chat users → Telegram API: send messages
- Telegram API → Business handlers: delivers business events
- Telegram API → Private start handler: delivers commands
- Polling startup → Business handlers: registers router
app/main.py - Polling startup → Private start handler: registers router
app/main.py - Polling startup → Bot wiring: starts polling
app/main.py - Polling startup → Scheduled cleanup: starts task
app/main.py - Business handlers → Data repositories: creates and looks up records
app/controller/business_message.py - Business handlers → Message content operations: saves and relays messages
app/controller/business_message.py - Business handlers → Bot wiring: gets business connection
app/controller/business_message.py - Private start handler → Data repositories: creates user record
app/controller/private.py - Private start handler → Message templates: uses start text
app/controller/private.py - Message content operations → Data repositories: stores and retrieves messages
app/utils/content.py - Message content operations → Bot wiring: uses bot and storage
app/utils/content.py - Message content operations → Message templates: uses message templates
app/utils/content.py - Message content operations → User link markup: uses user markup
app/utils/content.py - Message content operations → Telegram API: downloads and sends content
app/utils/content.py - Scheduled cleanup → Data repositories: deletes old records
app/utils/content.py - Scheduled cleanup → Filesystem storage: deletes cached files
app/utils/content.py - Data repositories → User and message models: queries models
app/database/repositories.py - Data repositories → Database sessions: uses session wrapper
app/database/repositories.py - Database sessions → Runtime settings: gets database URL
app/database/session.py - Database sessions → PostgreSQL: opens database connection
app/database/session.py - Bot wiring → Data repositories: instantiates repositories
app/loader.py - Bot wiring → Filesystem storage: instantiates storage
app/loader.py - Bot wiring → Runtime settings: configures bot
app/loader.py