Anonymous admin support for log_forwards and log_reports
This commit is contained in:
parent
bc911d5baa
commit
1dbde24525
|
@ -12,7 +12,7 @@ lock = asyncio.Lock()
|
||||||
async def log_forwards(client, message):
|
async def log_forwards(client, message):
|
||||||
if not config['config'].get('log_forwards'):
|
if not config['config'].get('log_forwards'):
|
||||||
return
|
return
|
||||||
if not message.from_user or message.from_user.id in app_user_ids:
|
if getattr(message.from_user, 'id', None) in app_user_ids:
|
||||||
return
|
return
|
||||||
for i in app_user_ids:
|
for i in app_user_ids:
|
||||||
if message.forward_from:
|
if message.forward_from:
|
||||||
|
@ -41,19 +41,24 @@ async def log_forwards(client, message):
|
||||||
chat_text += '<code>[SUPPORT]</code> '
|
chat_text += '<code>[SUPPORT]</code> '
|
||||||
if message.chat.is_scam:
|
if message.chat.is_scam:
|
||||||
chat_text += '<code>[SCAM]</code> '
|
chat_text += '<code>[SCAM]</code> '
|
||||||
text += f'[<code>{message.chat.id}</code>]\n- <b>Forwarder:</b> '
|
text += f'[<code>{message.chat.id}</code>]'
|
||||||
user_text = message.from_user.first_name
|
if message.chat.type != 'channel':
|
||||||
if message.from_user.last_name:
|
if message.from_user:
|
||||||
user_text += f' {message.from_user.last_name}'
|
user_text = message.from_user.first_name
|
||||||
user_text = '<code>[DELETED]</code>' if message.from_user.is_deleted else html.escape(user_text or 'Empty???')
|
if message.from_user.last_name:
|
||||||
if message.from_user.is_verified:
|
user_text += f' {message.from_user.last_name}'
|
||||||
user_text += ' <code>[VERIFIED]</code>'
|
user_text = '<code>[DELETED]</code>' if message.from_user.is_deleted else html.escape(user_text or 'Empty???')
|
||||||
if message.from_user.is_support:
|
if message.from_user.is_verified:
|
||||||
user_text += ' <code>[SUPPORT]</code>'
|
user_text += ' <code>[VERIFIED]</code>'
|
||||||
if message.from_user.is_scam:
|
if message.from_user.is_support:
|
||||||
user_text += ' <code>[SCAM]</code>'
|
user_text += ' <code>[SUPPORT]</code>'
|
||||||
text += f'{user_text} [<code>{message.from_user.id}</code>]\n'
|
if message.from_user.is_scam:
|
||||||
text += f'- <b><a href="{message.link}">Message'
|
user_text += ' <code>[SCAM]</code>'
|
||||||
|
user_text += f' [<code>{message.from_user.id}</code>]'
|
||||||
|
else:
|
||||||
|
user_text = 'Anonymous'
|
||||||
|
text += f'\n- <b>Forwarder:</b> {user_text}'
|
||||||
|
text += f'\n- <b><a href="{message.link}">Message'
|
||||||
mtext = (message.text or message.caption or '').strip()
|
mtext = (message.text or message.caption or '').strip()
|
||||||
if mtext:
|
if mtext:
|
||||||
text += ':'
|
text += ':'
|
||||||
|
|
|
@ -27,17 +27,21 @@ async def log_reports(client, message):
|
||||||
if message.chat.is_scam:
|
if message.chat.is_scam:
|
||||||
chat_text += '<code>[SCAM]</code> '
|
chat_text += '<code>[SCAM]</code> '
|
||||||
text += f'[<code>{message.chat.id}</code>]\n- <b>Reporter:</b> '
|
text += f'[<code>{message.chat.id}</code>]\n- <b>Reporter:</b> '
|
||||||
user_text = message.from_user.first_name
|
if message.from_user:
|
||||||
if message.from_user.last_name:
|
user_text = message.from_user.first_name
|
||||||
user_text += f' {message.from_user.last_name}'
|
if message.from_user.last_name:
|
||||||
user_text = '<code>[DELETED]</code>' if message.from_user.is_deleted else html.escape(user_text or 'Empty???')
|
user_text += f' {message.from_user.last_name}'
|
||||||
if message.from_user.is_verified:
|
user_text = '<code>[DELETED]</code>' if message.from_user.is_deleted else html.escape(user_text or 'Empty???')
|
||||||
user_text += ' <code>[VERIFIED]</code>'
|
if message.from_user.is_verified:
|
||||||
if message.from_user.is_support:
|
user_text += ' <code>[VERIFIED]</code>'
|
||||||
user_text += ' <code>[SUPPORT]</code>'
|
if message.from_user.is_support:
|
||||||
if message.from_user.is_scam:
|
user_text += ' <code>[SUPPORT]</code>'
|
||||||
user_text += ' <code>[SCAM]</code>'
|
if message.from_user.is_scam:
|
||||||
text += f'{user_text} [<code>{message.from_user.id}</code>]\n'
|
user_text += ' <code>[SCAM]</code>'
|
||||||
|
user_text += f' [<code>{message.from_user.id}</code>]'
|
||||||
|
else:
|
||||||
|
user_text = 'Anonymous'
|
||||||
|
text += f'{user_text}\n'
|
||||||
start, end = message.matches[0].span()
|
start, end = message.matches[0].span()
|
||||||
text += f'- <b><a href="{message.link}">Report Message'
|
text += f'- <b><a href="{message.link}">Report Message'
|
||||||
mtext = (message.text or message.caption or '').strip()
|
mtext = (message.text or message.caption or '').strip()
|
||||||
|
@ -62,7 +66,7 @@ async def log_reports(client, message):
|
||||||
user_text += ' <code>[SCAM]</code>'
|
user_text += ' <code>[SCAM]</code>'
|
||||||
user_text += f' [<code>{reply.from_user.id}</code>]'
|
user_text += f' [<code>{reply.from_user.id}</code>]'
|
||||||
else:
|
else:
|
||||||
user_text = 'None???'
|
user_text = 'Anonymous'
|
||||||
text += f'{user_text}\n- <b><a href="{reply.link}">Reported Message'
|
text += f'{user_text}\n- <b><a href="{reply.link}">Reported Message'
|
||||||
mtext = reply.text or reply.caption or ''
|
mtext = reply.text or reply.caption or ''
|
||||||
if mtext.strip():
|
if mtext.strip():
|
||||||
|
|
Loading…
Reference in New Issue