fix(gateway): bridge top-level require_mention to Telegram config#19429
Merged
Conversation
Users commonly place `require_mention: true` at the top level of config.yaml alongside `group_sessions_per_user`, expecting it to gate Telegram group messages. The key was silently ignored because the config loader only checked `yaml_cfg["telegram"]["require_mention"]`. When `require_mention` is found at the top level and no telegram-specific value is set, the fix now: - adds it to platforms_data["telegram"]["extra"] so _telegram_require_mention() picks it up via the primary config.extra path - sets TELEGRAM_REQUIRE_MENTION env var for the secondary fallback path A telegram-specific value (telegram.require_mention) still takes precedence over the top-level shorthand. Also corrects telegram.md: bare /cmd without @botName is rejected when require_mention is enabled; only /cmd@botname (bot-menu form) passes. Fixes #3979
1 task
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.
Salvage of #19317 by @konsisumer onto current main.
Summary
A top-level
require_mention: truein config.yaml was ignored by the Telegram adapter unless also duplicated undertelegram.require_mention. Bridge the top-level shorthand into theTELEGRAM_REQUIRE_MENTIONenv var (withtelegram.require_mentiontaking precedence when set), matching existing shorthand handling for other platform knobs.Also corrects
telegram.md: bare/cmdwithout@botnameis rejected whenrequire_mentionis enabled; only/cmd@botname(bot-menu form) passes.Changes
Validation
scripts/run_tests.sh tests/gateway/test_telegram_group_gating.py → 14 passed
Original PR: #19317
Fixes: #3979