Skip to content

The agent that grows with you

fix(telegram): an uncaptioned video note keeps the group silence notice

kshitijk4poor840d104031c8
diff --git a/plugins/platforms/telegram/telegram_context.py b/plugins/platforms/telegram/telegram_context.py
index 58e26a0b236..0cb91ab651d 100644
--- a/plugins/platforms/telegram/telegram_context.py
+++ b/plugins/platforms/telegram/telegram_context.py
@@ -77,8 +77,8 @@ def group_reply_expected(adapter: "TelegramAdapter", message: "Message", chat_ty
return None if unknown else False
if starts_with_other_participant_mention(adapter, message):
return False
- # Words in a voice note or audio file are not in the message text, so the "?" rule cannot read them.
- spoken = not text and any(getattr(message, kind, None) for kind in ("voice", "audio"))
+ # Words in a voice note, video note or audio file are not in the message text, so the "?" rule cannot read them.
+ spoken = not text and any(getattr(message, kind, None) for kind in ("voice", "video_note", "audio"))
return None if "?" in text or spoken else False
diff --git a/tests/gateway/test_telegram_group_gating.py b/tests/gateway/test_telegram_group_gating.py
index 309fc724cf8..360e3ba7995 100644
--- a/tests/gateway/test_telegram_group_gating.py
+++ b/tests/gateway/test_telegram_group_gating.py
@@ -1046,6 +1046,7 @@ def _with_media(message, kind):
(_replying_to(_group_message("agreed"), user_id=1087968824, sender_chat=-100), None),
(_with_media(_group_message(None), "voice"), None),
(_with_media(_group_message(None), "audio"), None),
+ (_with_media(_group_message(None), "video_note"), None),
(_with_media(_group_message(None, caption="the fridge arrives on saturday"), "voice"), False),
(_with_media(_group_message(None), "photo"), False),
], ids=[
@@ -1053,7 +1054,7 @@ def _with_media(message, kind):
"reply-to-other-member", "opens-with-other-mention", "chatter",
"question", "mentions-other-mid-question", "forum-topic-root", "reply-to-unknown-author",
"reply-to-unknown-author-statement", "reply-to-channel-autoforward", "reply-to-anonymous-admin",
- "voice-note", "audio-file", "captioned-voice-chatter", "photo-without-caption",
+ "voice-note", "audio-file", "video-note", "captioned-voice-chatter", "photo-without-caption",
])
def test_reply_expected_follows_who_the_group_message_addresses(message, expected):
adapter = _make_adapter(require_mention=False, mention_patterns=["hermes"])
diff --git a/website/docs/user-guide/messaging/telegram.md b/website/docs/user-guide/messaging/telegram.md
index c769604fdb0..066ccd2ddce 100644
--- a/website/docs/user-guide/messaging/telegram.md
+++ b/website/docs/user-guide/messaging/telegram.md
@@ -656,7 +656,7 @@ A bot that reads every group message can answer exactly `[SILENT]` (or another [
| Any other message without a `?` | Stays silent |
| Any other message with a `?` (it may be a question for the bot) | Replaced by the notice |
-A message still gets the notice while the bot's own identity is unknown, or when it replies to a message whose author is unknown or that was posted as a chat (a linked channel's post, an anonymous admin). A voice note or audio file without a caption also gets the notice, because its words are not in the message text. A forum topic's root message is not a reply to another member.
+A message still gets the notice while the bot's own identity is unknown, or when it replies to a message whose author is unknown or that was posted as a chat (a linked channel's post, an anonymous admin). A voice note, video note or audio file without a caption also gets the notice, because its words are not in the message text. A forum topic's root message is not a reply to another member.
### Multiple Hermes bots in one group