How axellorwave/gosha works
Гоша is a Telegram group-chat bot whose central workflow is: Telegram updates reach registered handlers, handlers apply chat/profile/statistics/moderation or event logic, and the repository persists state in PostgreSQL before the bot replies or sends scheduled messages. The graph preserves the documented birthdays, backups, broadcasts, secret words, logs, and tic-tac-toe branches. Source excerpts are partial; documented capabilities are included, while uncertain internal links are omitted rather than inferred.
Main entry points: handlers Handler registration · repo.py Data access · event_sender.py Event delivery · games.py Tic-tac-toe
Components 31
Bot runtime
- Bot startup
gosha/__main__.py - Runtime settings
gosha/config.py - Handler registration
gosha/handlers - Dialog state
gosha/handlers/states.py
Chat features
- Message tracking
gosha/handlers/tracking.py - Statistics
gosha/handlers/stats.py - Profiles
gosha/handlers/profile.py - Administration
gosha/handlers/admin.py - Membership changes
gosha/handlers/membership.py - Moderation
gosha/handlers/moderation.py - Secret words
gosha/handlers/secrets.py - Tic-tac-toe
gosha/handlers/games.py - Game engine
gosha/services/tictactoe.py - Rich-message adapter
gosha/services/rich.py
Events and messaging
- Event management
gosha/handlers/events.py - Event scheduling logic
gosha/services/events.py - Event delivery
gosha/services/event_sender.py - Birthday service
gosha/services/birthdays.py - Broadcasts
gosha/handlers/broadcast.py - Command menus
gosha/services/commands.py
Persistence
- Data access
gosha/db/repo.py - Domain records
gosha/db/models.py - PostgreSQL
Operations
- Backup and restore
gosha/services/backups.py - Backup controls
gosha/handlers/backups.py - Log management
gosha/services/logs.py - Log controls
gosha/handlers/logs.py - Message formatting
gosha/services/formatting.py
Other components
- Group members
- Bot owner
- Telegram Bot API
Connections 48
- Group members → Telegram Bot API: sends updates
README.md - Bot owner → Telegram Bot API: sends commands
README.md - Telegram Bot API → Handler registration: delivers updates
- Bot startup → Runtime settings: loads
gosha/__main__.py - Bot startup → Handler registration: registers
gosha/__main__.py - Bot startup → Event delivery: starts scheduler
gosha/__main__.py - Bot startup → Backup and restore: starts backup service
gosha/__main__.py - Handler registration → Dialog state: registers dispatcher
gosha/handlers/__init__.py - Handler registration → Message tracking: registers
gosha/handlers/__init__.py - Handler registration → Statistics: registers
gosha/handlers/__init__.py - Handler registration → Profiles: registers
gosha/handlers/__init__.py - Handler registration → Administration: registers
gosha/handlers/__init__.py - Handler registration → Membership changes: registers
gosha/handlers/__init__.py - Handler registration → Moderation: registers
gosha/handlers/__init__.py - Handler registration → Secret words: registers
gosha/handlers/__init__.py - Handler registration → Tic-tac-toe: registers
gosha/handlers/__init__.py - Handler registration → Event management: registers
gosha/handlers/__init__.py - Handler registration → Broadcasts: registers
gosha/handlers/__init__.py - Message tracking → Data access: records activity
gosha/handlers/tracking.py - Statistics → Data access: queries totals
gosha/handlers/stats.py - Profiles → Data access: reads profile
gosha/handlers/profile.py - Administration → Data access: updates settings
gosha/handlers/admin.py - Membership changes → Data access: updates membership
gosha/handlers/membership.py - Moderation → Telegram Bot API: moderates users
README.md - Secret words → Data access: manages words
- Tic-tac-toe → Game engine: runs game rules
gosha/handlers/games.py - Tic-tac-toe → Rich-message adapter: renders rich game
gosha/handlers/games.py - Tic-tac-toe → Data access: loads and saves games
gosha/handlers/games.py - Tic-tac-toe → Telegram Bot API: sends game messages
gosha/handlers/games.py - Event management → Event scheduling logic: uses event logic
gosha/handlers/events.py - Event management → Event delivery: requests preview
gosha/handlers/events.py - Event management → Birthday service: manages birthdays
gosha/handlers/events.py - Event management → Command menus: syncs commands
gosha/handlers/events.py - Event delivery → Event scheduling logic: evaluates schedule
gosha/services/event_sender.py - Event delivery → Birthday service: builds birthday content
gosha/services/event_sender.py - Event delivery → Data access: loads due events
gosha/services/event_sender.py - Event delivery → Telegram Bot API: sends messages
gosha/services/event_sender.py - Birthday service → Data access: maintains birthday events
gosha/services/birthdays.py - Broadcasts → Telegram Bot API: sends broadcasts
README.md - Broadcasts → Data access: selects recipients
gosha/handlers/broadcast.py - Command menus → Telegram Bot API: publishes menus
gosha/services/commands.py - Backup controls → Backup and restore: controls backup
gosha/handlers/backups.py - Backup and restore → PostgreSQL: exports and restores
README.md - Log controls → Log management: requests log ranges
gosha/handlers/logs.py - Log controls → Telegram Bot API: sends log files
gosha/handlers/logs.py - Data access → Domain records: queries records
gosha/db/repo.py - Data access → PostgreSQL: reads and writes
gosha/db/repo.py - Domain records → PostgreSQL: maps tables
gosha/db/models.py