feat: add multi-account support#88
Conversation
Support multiple Telegram accounts simultaneously via label-suffixed env vars (TELEGRAM_SESSION_STRING_WORK, _PERSONAL, etc.). Single-account configs remain fully backward-compatible. - Replace global client singleton with clients dict registry - Add @with_account decorator to all 93 tools: read-only tools fan out to all accounts, write tools require explicit account - Add list_accounts tool for account discovery - Concurrent client startup via asyncio.gather - Update session_string_generator.py with optional label prompt - Parameterize resolve_entity/resolve_input_entity Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add multi-account configuration section (.env with label suffixes) - Add Multi-Account section to features list - Update code examples to show @with_account decorator and get_client() - Add multi-account usage examples - Update Docker run instructions for multi-account env vars - Mention session generator label prompt Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Keep upstream's extension-stripping logic in download_media, adapted to use multi-account cl variable instead of global client. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Hey @chigwell — friendly ping on this one. Not an April Fools joke, for the record :) I've been running this branch off my fork since April 1st with two Telegram accounts (work + personal) and everything has been working great — no bugs surfaced so far. Happy to address anything on your end: code style, test coverage, API design, naming — whatever would help get this merged. And if you feel multi-account support just doesn't fit the direction you want mcp-telegram to go, that's a totally valid answer too — just let me know and I'll keep maintaining it on the fork. Thanks! |
These were local spec-driven planning artifacts and should not be committed. Removing per maintainer feedback. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
@chigwell done — both asks addressed:
The merge required a bit more than a straight conflict resolution because several things landed on
All three CI checks pass ✅. Let me know if you want anything else tweaked. |
|
@chigwell gentle ping — both items are addressed and CI is green. Could you take another look when you have a minute? Thanks! |
Summary
TELEGRAM_SESSION_STRING_WORK,_PERSONAL, etc.)accountis omitted; write tools require explicit accountlist_accountstool for account discovery@with_accountdecorator andaccountparameterasyncio.gatherTest plan
.envwith oneTELEGRAM_SESSION_STRINGworks identically to beforelist_accountsreturns bothget_chats()without account returns results from all accounts with[label]prefixsend_message()without account in multi-mode returns error listing available accountssend_message(account="work", ...)sends from correct account🤖 Generated with Claude Code