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