optimize stuff

This commit is contained in:
blank X 2020-11-03 20:29:48 +07:00
parent b65330eb31
commit ab330dc33b
1 changed files with 12 additions and 12 deletions

View File

@ -1,7 +1,7 @@
import html
import asyncio
from pyrogram import Client, filters
from .. import config, help_dict, slave, log_errors
from .. import config, slave, log_errors
reported = set()
lock = asyncio.Lock()
@ -48,22 +48,22 @@ async def log_reports(client, message):
reply = message.reply_to_message
if not getattr(reply, 'empty', True):
text += '\n- <b>Reportee:</b> '
if message.reply_to_message.from_user:
user_text = message.reply_to_message.from_user.first_name
if message.reply_to_message.from_user.last_name:
user_text += f' {message.reply_to_message.from_user.last_name}'
user_text = '<code>[DELETED]</code>' if message.from_user.is_deleted else html.escape(user_text or 'Empty???')
if message.reply_to_message.from_user.is_verified:
if reply.from_user:
user_text = reply.from_user.first_name
if reply.from_user.last_name:
user_text += f' {reply.from_user.last_name}'
user_text = '<code>[DELETED]</code>' if reply.from_user.is_deleted else html.escape(user_text or 'Empty???')
if reply.from_user.is_verified:
user_text += ' <code>[VERIFIED]</code>'
if message.reply_to_message.from_user.is_support:
if reply.from_user.is_support:
user_text += ' <code>[SUPPORT]</code>'
if message.reply_to_message.from_user.is_scam:
if reply.from_user.is_scam:
user_text += ' <code>[SCAM]</code>'
user_text += f' [<code>{message.reply_to_message.from_user.id}</code>]'
user_text += f' [<code>{reply.from_user.id}</code>]'
else:
user_text = 'None???'
text += f'{user_text}\n- <b><a href="{message.reply_to_message.link}">Reported Message'
mtext = message.reply_to_message.text or message.reply_to_message.caption or ''
text += f'{user_text}\n- <b><a href="{reply.link}">Reported Message'
mtext = reply.text or reply.caption or ''
if mtext.strip():
text += ':'
text += f'</a></b> {html.escape(mtext.strip()[:1000])}'