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
Joan
c0783340b0
Unify all handler signatures and simplify router
...
- Standardize all handlers to signature: (query, user_id, player, data=None)
- Replace 125-line if/elif chain with HANDLER_MAP dictionary
- Reduce router code by 90 lines (72% reduction)
- Add HANDLER_MAP registry for cleaner organization
- Enable future auto-discovery and decorator patterns
- Maintain full backward compatibility
- Document changes in HANDLER_REFACTORING_V2.md
Benefits:
- O(1) handler lookup vs O(n) if/elif chain
- Add new handlers by just updating the map
- Consistent signature makes code easier to understand
- Opens doors for middleware and hooks
2025-10-20 12:22:07 +02:00
Joan
861f3b8a36
Add visual progress bars and refactor handler modules
...
- Implement visual HP/Stamina/XP bars using Unicode characters (██░)
- Refactor handlers.py (1308 → 377 lines) into specialized modules:
* action_handlers.py - World interaction and status display
* inventory_handlers.py - Inventory management
* combat_handlers.py - Combat actions
* profile_handlers.py - Character stats with visual bars
* corpse_handlers.py - Looting system
* pickup_handlers.py - Item collection
- Add utility functions: create_progress_bar(), format_stat_bar()
- Organize all documentation into docs/ structure
- Create comprehensive documentation index with navigation
- Add UI examples showing before/after visual improvements
2025-10-19 00:23:44 +02:00
Joan
3ab412bc09
Initial commit: Echoes of the Ashes - Telegram RPG Bot
2025-10-18 19:21:19 +02:00