Not raise an exception when message.reply_to_message.from_user is None
This commit is contained in:
parent
657a857e13
commit
925d85ed7d
|
@ -48,6 +48,7 @@ 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}'
|
||||
|
@ -58,7 +59,10 @@ async def log_reports(client, message):
|
|||
user_text += ' <code>[SUPPORT]</code>'
|
||||
if message.reply_to_message.from_user.is_scam:
|
||||
user_text += ' <code>[SCAM]</code>'
|
||||
text += f'{user_text} [<code>{message.reply_to_message.from_user.id}</code>]\n- <b><a href="{message.reply_to_message.link}">Reported Message'
|
||||
user_text += f' [<code>{message.reply_to_message.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 ''
|
||||
if mtext.strip():
|
||||
text += ':'
|
||||
|
|
Loading…
Reference in New Issue