diff --git a/sukuinote/plugins/log_reports.py b/sukuinote/plugins/log_reports.py index c2569f2..e3e7546 100644 --- a/sukuinote/plugins/log_reports.py +++ b/sukuinote/plugins/log_reports.py @@ -48,17 +48,21 @@ async def log_reports(client, message): reply = message.reply_to_message if not getattr(reply, 'empty', True): text += '\n- Reportee: ' - 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 = '[DELETED]' if message.from_user.is_deleted else html.escape(user_text or 'Empty???') - if message.reply_to_message.from_user.is_verified: - user_text += ' [VERIFIED]' - if message.reply_to_message.from_user.is_support: - user_text += ' [SUPPORT]' - if message.reply_to_message.from_user.is_scam: - user_text += ' [SCAM]' - text += f'{user_text} [{message.reply_to_message.from_user.id}]\n- Reported Message' + 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 = '[DELETED]' if message.from_user.is_deleted else html.escape(user_text or 'Empty???') + if message.reply_to_message.from_user.is_verified: + user_text += ' [VERIFIED]' + if message.reply_to_message.from_user.is_support: + user_text += ' [SUPPORT]' + if message.reply_to_message.from_user.is_scam: + user_text += ' [SCAM]' + user_text += f' [{message.reply_to_message.from_user.id}]' + else: + user_text = 'None???' + text += f'{user_text}\n- Reported Message' mtext = message.reply_to_message.text or message.reply_to_message.caption or '' if mtext.strip(): text += ':'