feat: implement TelegramCommandHandler core structure (issue #61) #62

Merged
jihoson merged 1 commits from feature/issue-61-command-handler into main 2026-02-05 13:51:19 +09:00
Collaborator

Summary

  • Add TelegramCommandHandler class for receiving and processing Telegram commands
  • Implement long polling with getUpdates API
  • Add command registration/routing and chat ID security verification

Changes

  • src/notifications/telegram_client.py: Add TelegramCommandHandler class
  • tests/test_telegram_commands.py: Add 16 comprehensive tests

Features

  • Long Polling: Fetches updates from Telegram API with configurable interval
  • Command Routing: register_command() for flexible handler registration
  • Security: Chat ID verification prevents unauthorized access
  • Error Isolation: Command handler failures don't crash trading system
  • Lifecycle Management: start_polling() / stop_polling() control

Test plan

  • All tests pass (16/16)
  • Coverage ≥ 80% (85% for telegram_client.py)
  • Chat ID verification blocks unauthorized users
  • Unknown commands send helpful error messages
  • Handler errors don't crash polling loop
  • API errors handled gracefully

Closes #61
Depends on #59

🤖 Generated with Claude Code

## Summary - Add `TelegramCommandHandler` class for receiving and processing Telegram commands - Implement long polling with getUpdates API - Add command registration/routing and chat ID security verification ## Changes - `src/notifications/telegram_client.py`: Add TelegramCommandHandler class - `tests/test_telegram_commands.py`: Add 16 comprehensive tests ## Features - **Long Polling**: Fetches updates from Telegram API with configurable interval - **Command Routing**: register_command() for flexible handler registration - **Security**: Chat ID verification prevents unauthorized access - **Error Isolation**: Command handler failures don't crash trading system - **Lifecycle Management**: start_polling() / stop_polling() control ## Test plan - [x] All tests pass (16/16) - [x] Coverage ≥ 80% (85% for telegram_client.py) - [x] Chat ID verification blocks unauthorized users - [x] Unknown commands send helpful error messages - [x] Handler errors don't crash polling loop - [x] API errors handled gracefully ## Related Issues Closes #61 Depends on #59 🤖 Generated with [Claude Code](https://claude.com/claude-code)
agentson added 1 commit 2026-02-05 13:48:23 +09:00
feat: implement TelegramCommandHandler core structure (issue #61)
Some checks failed
CI / test (pull_request) Has been cancelled
065c9daaad
Add TelegramCommandHandler class with long polling, command routing,
and security features.

Changes:
- Add TelegramCommandHandler class to telegram_client.py
- Implement long polling with getUpdates API
- Add command registration and routing mechanism
- Implement chat ID verification for security
- Add comprehensive tests (16 tests)
- Coverage: 85% for telegram_client.py

Features:
- start_polling() / stop_polling() lifecycle management
- register_command() for handler registration
- Chat ID verification to prevent unauthorized access
- Error isolation (command failures don't crash system)
- Graceful handling of API errors and timeouts

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
jihoson merged commit ee66ecc305 into main 2026-02-05 13:51:19 +09:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: jihoson/The-Ouroboros#62