refactor: migrate TelegramAdapter to grammY and remove Telegraf#6
Merged
Conversation
- Rewrite TelegramAdapter using grammY Bot with conversations - Register addBill and categorization conversations - Wire /add, /query, /cancel commands and callback handlers - Add short ID hashing for callback data (Telegram 64-byte limit) - Add pending merchant registry for conversation data lookup - Delete CommandHandlers, BaseCommandHandler, AddCommandHandler, CategorizationCommandHandler, categorization-utils, categorization-types - Remove telegraf npm dependency - Clean up all exit paths in categorization to prevent registry leaks Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
Task 005 of the grammY migration plan. The main integration task — remove Telegraf dependency and wire everything through grammY.
Approach
Rewrite TelegramAdapter to use grammY Bot, register conversations and command handlers, and delete all Telegraf-specific code.
Changes
Deleted (7 files, ~1200 lines removed):
command-handlers.ts— replaced by grammY middleware chainbase-command-handler.ts— no longer neededadd-command-handler.ts— replaced by addBill conversationcategorization-command-handler.ts— replaced by categorization conversationcategorization-utils.ts,categorization-types.ts— internalizedcategorization-command-handler.test.ts— handler deletedModified:
telegram.adapter.ts— full rewrite using grammY Bot, conversations, short ID registryquery-command-handler.ts— removed BaseCommandHandler dependencycustom-query-command-handler.ts— removed BaseCommandHandler dependencyconversations/categorization.ts— use short ID registry for merchant lookup, cleanup on all exit pathstypes.ts— removed Telegraf TextMessage typepackage.json— removedtelegrafdependencyKey design:
Testing
39 tests pass (7 suites). No Telegraf imports remain in codebase.
Code Review