From 08b36db90246c233a170366d6bfcfddf805919e6 Mon Sep 17 00:00:00 2001 From: blank X Date: Tue, 22 Dec 2020 21:37:53 +0700 Subject: [PATCH] Don't log events that happen in the log chat --- sukuinote/plugins/log_forwards.py | 2 +- sukuinote/plugins/log_reports.py | 2 +- sukuinote/plugins/log_user_joins.py | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/sukuinote/plugins/log_forwards.py b/sukuinote/plugins/log_forwards.py index 8936005..246178e 100644 --- a/sukuinote/plugins/log_forwards.py +++ b/sukuinote/plugins/log_forwards.py @@ -7,7 +7,7 @@ from .. import config, slave, log_errors, app_user_ids logged = set() lock = asyncio.Lock() -@Client.on_message(filters.incoming & filters.forwarded & (filters.group | filters.channel)) +@Client.on_message(~filters.chat(config['config']['log_chat']) & filters.incoming & filters.forwarded & (filters.group | filters.channel)) @log_errors async def log_forwards(client, message): if not config['config'].get('log_forwards'): diff --git a/sukuinote/plugins/log_reports.py b/sukuinote/plugins/log_reports.py index 2a9713e..8f34cc6 100644 --- a/sukuinote/plugins/log_reports.py +++ b/sukuinote/plugins/log_reports.py @@ -7,7 +7,7 @@ from .. import config, slave, log_errors reported = set() lock = asyncio.Lock() -@Client.on_message(filters.regex(r'(?:^|\s+)@admins?(?:$|\W+)|^[/!](?:report|admins?)(?:$|\W+)') & filters.group) +@Client.on_message(~filters.chat(config['config']['log_chat']) & filters.regex(r'(?:^|\s+)@admins?(?:$|\W+)|^[/!](?:report|admins?)(?:$|\W+)') & filters.group) @log_errors async def log_reports(client, message): if not config['config']['log_reports']: diff --git a/sukuinote/plugins/log_user_joins.py b/sukuinote/plugins/log_user_joins.py index f5e4255..91f5816 100644 --- a/sukuinote/plugins/log_user_joins.py +++ b/sukuinote/plugins/log_user_joins.py @@ -29,6 +29,9 @@ async def log_user_joins(client, update, users, chats): sexy_chat_id = -chat_id else: return + peer = await client.resolve_peer(config['config']['log_chat']) + if peer == message.to_id: + return is_join = isinstance(action, MessageActionChatJoinedByLink) if not is_join: is_join = action.users == [message.from_id]