fix(telegram): apply bot auth policy to Telegram sources

# Conflicts:
#	gateway/config.py
This commit is contained in:
sweetcornna 2026-06-28 00:40:32 -07:00 committed by Teknium
parent 002357a83f
commit fc70d023d8
6 changed files with 196 additions and 0 deletions

View file

@ -7253,6 +7253,7 @@ class TelegramAdapter(BasePlatformAdapter):
thread_id=thread_id_str,
chat_topic=chat_topic,
message_id=str(message.message_id),
is_bot=bool(getattr(user, "is_bot", False)) if user else False,
)
# Extract reply context if this message is a reply.
@ -7528,6 +7529,8 @@ def _apply_yaml_config(yaml_cfg: dict, telegram_cfg: dict) -> dict | None:
os.environ["TELEGRAM_MENTION_PATTERNS"] = _json.dumps(telegram_cfg["mention_patterns"])
if "exclusive_bot_mentions" in telegram_cfg and not os.getenv("TELEGRAM_EXCLUSIVE_BOT_MENTIONS"):
os.environ["TELEGRAM_EXCLUSIVE_BOT_MENTIONS"] = str(telegram_cfg["exclusive_bot_mentions"]).lower()
if "allow_bots" in telegram_cfg and not os.getenv("TELEGRAM_ALLOW_BOTS"):
os.environ["TELEGRAM_ALLOW_BOTS"] = str(telegram_cfg["allow_bots"]).lower()
if "guest_mode" in telegram_cfg and not os.getenv("TELEGRAM_GUEST_MODE"):
os.environ["TELEGRAM_GUEST_MODE"] = str(telegram_cfg["guest_mode"]).lower()
if "observe_unmentioned_group_messages" in telegram_cfg and not os.getenv("TELEGRAM_OBSERVE_UNMENTIONED_GROUP_MESSAGES"):