From 1aa6aa006ce564756232d6abb0b248628d102f72 Mon Sep 17 00:00:00 2001 From: Artemii Peretiachenko Date: Fri, 10 Apr 2026 17:51:24 +0200 Subject: [PATCH] Fix discuss channel auto-forward deletion Skip moderation for automatic forwards / channel sender messages in linked discussion groups. Made-with: Cursor --- bot/handlers.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bot/handlers.py b/bot/handlers.py index de85eb6..2691772 100644 --- a/bot/handlers.py +++ b/bot/handlers.py @@ -252,6 +252,13 @@ async def anti_spam_all_messages(message: Message, bot: Bot, cfg: Config, db: Da if not _is_allowed_chat(cfg, chat_id): return + # Discussion groups can receive automatic forwards from a linked channel. + # These messages are not user spam and must never be deleted. + if getattr(message, "is_automatic_forward", False): + return + if message.sender_chat is not None and getattr(message.sender_chat, "type", None) == "channel": + return + user = message.from_user if user is None or user.is_bot: return