feat(channel): support telegram bot

This commit is contained in:
zhayujie
2026-05-28 15:07:09 +08:00
parent d106465419
commit e3eacc77d7
11 changed files with 261 additions and 23 deletions

View File

@@ -246,8 +246,17 @@ class TelegramChannel(ChatChannel):
is_group = chat.type in ("group", "supergroup")
# Debug log: helpful when group messages are silently dropped
if is_group:
logger.debug(
f"[Telegram] group update received: chat_id={chat.id}, "
f"text={(message.text or message.caption or '')[:40]!r}, "
f"reply_to_bot={bool(message.reply_to_message and message.reply_to_message.from_user and message.reply_to_message.from_user.username == self.bot_username)}"
)
# Group trigger gate (silently drop if not triggered)
if is_group and not self._should_reply_in_group(update):
logger.debug(f"[Telegram] group message not triggered (need @{self.bot_username} or reply), skip")
return
# Parse message type + download media if needed.

View File

@@ -2915,7 +2915,6 @@ class ChannelsHandler:
"color": "sky",
"fields": [
{"key": "telegram_token", "label": "Bot Token", "type": "secret"},
{"key": "telegram_proxy", "label": "Proxy (optional)", "type": "text"},
],
}),
])