[Phase 1] Task 7: Refactor telegram-bot/commands.py — Thin Telegram wrappers #13

Closed
opened 2026-04-02 18:31:47 +02:00 by shoko · 0 comments
Owner

Task 7: Refactor apps/telegram-bot/commands.py

Labels: phase-1, telegram-bot
Dependency: Task 4 (#8)

Goal

Refactor commands.py to be thin Telegram wrappers around core services.

Changes

  • Refactor existing commands.py
  • Import services from core
  • Each command handler should:
    1. Extract Telegram types (update, user_id, chat_id)
    2. Call appropriate core service
    3. Format and send response

Example pattern

See current implementation in commands.py as reference. Each handler should call services from core/services.py instead of the old storage module.

Commands to implement

  • /bounty: List bounties (group or personal based on chat type)
  • /my: List tracked bounties (group) or personal bounties (DM)
  • /add: Add bounty
  • /edit: Update bounty (renamed from /update per spec)
  • /delete: Delete bounty
  • /track: Track a bounty (group only)
  • /untrack: Untrack a bounty (group only)
  • /help: Show help

Keep from current implementation

  • parse_args() for parsing command arguments
  • format_bounty() for formatting bounty output
  • extract_args() for extracting arguments from message

Acceptance Criteria

  • All commands work as before
  • commands.py imports and uses core services
  • No business logic in commands.py
## Task 7: Refactor apps/telegram-bot/commands.py **Labels:** phase-1, telegram-bot **Dependency:** Task 4 (#8) ### Goal Refactor commands.py to be thin Telegram wrappers around core services. ### Changes - Refactor existing commands.py - Import services from core - Each command handler should: 1. Extract Telegram types (update, user_id, chat_id) 2. Call appropriate core service 3. Format and send response ### Example pattern See current implementation in commands.py as reference. Each handler should call services from core/services.py instead of the old storage module. ### Commands to implement - /bounty: List bounties (group or personal based on chat type) - /my: List tracked bounties (group) or personal bounties (DM) - /add: Add bounty - /edit: Update bounty (renamed from /update per spec) - /delete: Delete bounty - /track: Track a bounty (group only) - /untrack: Untrack a bounty (group only) - /help: Show help ### Keep from current implementation - parse_args() for parsing command arguments - format_bounty() for formatting bounty output - extract_args() for extracting arguments from message ### Acceptance Criteria - All commands work as before - commands.py imports and uses core services - No business logic in commands.py
shoko added the phase-1telegram-bot labels 2026-04-02 18:34:43 +02:00
shoko closed this issue 2026-04-03 16:14:24 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: shoko/jigaido#13