Refactor commands.py to be thin Telegram wrappers around core services. Changes: - Replace 'import storage' with imports from core.services and adapters.storage - Create module-level service instances (BountyService, TrackingService) - Update format_bounty() to work with Bounty dataclass instead of dict - Add get_room_id() helper for unified group/DM handling - Each command handler is now a thin wrapper that: 1. Extracts Telegram types (update, user_id, room_id) 2. Calls appropriate core service 3. Formats and sends response Kept from original: - parse_args() - format_bounty() - extract_args() Commands now use services: - cmd_bounty: BOUNTY_SERVICE.list_bounties() - cmd_my: BOUNTY_SERVICE.list_bounties() or TRACKING_SERVICE.get_tracked_bounties() - cmd_add: BOUNTY_SERVICE.add_bounty() - cmd_update: BOUNTY_SERVICE.update_bounty() - cmd_delete: BOUNTY_SERVICE.delete_bounty() - cmd_track: TRACKING_SERVICE.track_bounty() (groups only) - cmd_untrack: TRACKING_SERVICE.untrack_bounty() (groups only) Fixes #13
9.6 KiB
9.6 KiB