Telegram: gate implicit topic replies behind a config flag - #69
Open
strk-ai-agent wants to merge 1 commit into
Open
Telegram: gate implicit topic replies behind a config flag#69strk-ai-agent wants to merge 1 commit into
strk-ai-agent wants to merge 1 commit into
Conversation
Add telegram.respondToImplicitTopicReplies (default true) so that forum-topic per-session isolation can be kept without forwarding every plain message in an active topic. When set to false, the bot in a topic only answers when the message matches the trigger, an @mention, a swipe-reply to the bot, or carries an attachment. The decision tree in handleUpdate is extracted into a pure resolveTelegramQuery helper so the new flag is covered by unit tests in isolation from the Telegram Bot API and the session manager. Assisted-By: MiniMax-M3 [via opencode]
Contributor
|
I've tested and am successfully using this feature. It's backward compatible (nothing changes unless you add a new configuration). I can finally have Telegram topics w/out the bot answering every single line Approved ! |
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.
Adds a new
telegram.respondToImplicitTopicRepliesflag (defaulttrue).When set to
false, the bot in a forum supergroup topic withthreadIsolation: trueonly answers messages that match:!oc ...),@botnamemention (whenrespondToMentions: true, default),respondToReplies: true, default), orPlain messages in an active topic are dropped, while per-topic session isolation is preserved. Set
respondToMentions: falseandrespondToReplies: falsetoo if you want only trigger-prefixed messages and attachment-bearing messages to be forwarded.Implementation notes:
handleUpdateis extracted into a pureresolveTelegramQueryhelper so the new flag is covered by unit tests in isolation from the Telegram Bot API and the session manager.tests/unit/telegram-resolve-query.test.tscover the routing rules, including the new flag.respondToMentionsandrespondToReplieswork; this PR adds a parallelrespondToImplicitTopicRepliestodocs/TELEGRAM_SETUP.md.Verification:
bun run typecheckbun run check:connectorsbun test(383 pass, 0 fail)