From afc49486f34e4f9d399138fab3b30e052db7d838 Mon Sep 17 00:00:00 2001 From: Chummy Date: Wed, 25 Feb 2026 07:10:55 +0000 Subject: [PATCH] supersede: replay changes from #1664 Automated conflict recovery onto latest dev. --- src/channels/telegram.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/channels/telegram.rs b/src/channels/telegram.rs index f0d8103e6..f687fcf90 100644 --- a/src/channels/telegram.rs +++ b/src/channels/telegram.rs @@ -1058,6 +1058,21 @@ Allowlist Telegram username (without '@') or numeric user ID.", return None; } + // Check mention_only for group messages (apply to caption for attachments) + let is_group = Self::is_group_message(message); + if self.mention_only && is_group { + let bot_username = self.bot_username.lock(); + if let Some(ref bot_username) = *bot_username { + let text_to_check = attachment.caption.as_deref().unwrap_or(""); + if !Self::contains_bot_mention(text_to_check, bot_username) { + return None; + } + } else { + // Bot username unknown, can't verify mention + return None; + } + } + let chat_id = message .get("chat") .and_then(|chat| chat.get("id")) @@ -1209,6 +1224,13 @@ Allowlist Telegram username (without '@') or numeric user ID.", return None; } + // Voice messages have no text to mention the bot, so ignore in mention_only mode when in groups. + // Private chats are always processed. + let is_group = Self::is_group_message(message); + if self.mention_only && is_group { + return None; + } + let chat_id = message .get("chat") .and_then(|chat| chat.get("id"))