supersede: replay changes from #1664

Automated conflict recovery onto latest dev.
This commit is contained in:
Chummy 2026-02-25 07:10:55 +00:00 committed by Chum Yin
parent 8bbf256fa9
commit afc49486f3

View File

@ -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"))