feat: support separate Telegram bots per pi session - #23
Open
musichen wants to merge 7 commits into
Open
Conversation
Author
|
Follow-up fix: this branch now prevents duplicate Telegram replies when a bot is accidentally connected from more than one pi process, and guards against concurrent duplicate The polling lock is keyed from a one-way hash of the bot token, supports stale-lock recovery, and is released when polling stops. A two-process regression harness verified that the second process is rejected with |
agent_end fires before the agent is fully settled, so sending the next queued turn as a fresh prompt throws 'Agent is already processing'. Pass deliverAs: 'followUp' so pi queues it for the next run instead.
xqicxx
pushed a commit
to xqicxx/pi-telegram
that referenced
this pull request
Aug 26, 2026
0.9.0: hidden settings and proactive push, queue ui
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.
Summary
Allow separate pi sessions to use different Telegram bots without manually managing configuration filenames.
What changed
/telegram-addto validate a bot token with Telegram'sgetMeAPI and save its configuration astelegram-<bot-username>.json.telegram.jsonconfiguration automatically using its saved bot username./telegram-connectpresent a selection menu when multiple bot configurations are available./telegram-status.PI_TELEGRAM_CONFIGfor scripted or fixed per-session bot assignment.Each configuration retains its own token, paired user, and Telegram update offset. The existing single-bot flow still auto-connects when only one configuration exists.
Testing
/telegram-connectwith a harness and verified discovery of two saved bot configurations.getMeand long-pollgetUpdatesrequests for two local bot configurations.