Commit Graph

2 Commits

Author SHA1 Message Date
Joan
33cc9586c2 What a mess 2025-11-07 15:27:13 +01:00
Joan
d243ec571f Separate utilities and commands into dedicated modules
Extract functionality from handlers.py into focused modules:

New Modules:
- bot/message_utils.py (120 lines) - Telegram message handling
  * send_or_edit_with_image() - Smart message/image transitions
  * Image caching and upload logic

- bot/commands.py (110 lines) - Slash command handlers
  * start() - Player initialization
  * export_map() - Admin map export
  * spawn_stats() - Admin spawn statistics

Refactored:
- bot/handlers.py: 365 → 177 lines (-51% reduction)
  * Now contains only routing logic
  * Re-exports commands for backward compatibility
  * Cleaner, more focused responsibility

Benefits:
- Single Responsibility Principle achieved
- Better testability (can test modules independently)
- Improved organization and discoverability
- Easier maintenance (changes isolated to specific files)
- Full backward compatibility maintained

Documented in MODULE_SEPARATION.md
2025-10-20 12:28:40 +02:00