Fix discuss channel auto-forward deletion
Skip moderation for automatic forwards / channel sender messages in linked discussion groups. Made-with: Cursor
This commit is contained in:
parent
89c472708b
commit
1aa6aa006c
1 changed files with 7 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue