Don't log events that happen in the log chat

This commit is contained in:
blank X 2020-12-22 21:37:53 +07:00
parent aa295cffb3
commit 08b36db902
3 changed files with 5 additions and 2 deletions

View File

@ -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'):

View File

@ -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']:

View File

@ -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]