From afe1c2e1ea8e8e0dabbc296573fe1ba3fb2f58a5 Mon Sep 17 00:00:00 2001 From: blank X Date: Sun, 4 Apr 2021 14:36:52 +0700 Subject: [PATCH] (Try to) sprinkle force LTR at the right places --- sukuinote/plugins/log_forwards.py | 10 +++++----- sukuinote/plugins/log_reports.py | 16 ++++++++-------- sukuinote/plugins/log_user_joins.py | 14 +++++++------- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/sukuinote/plugins/log_forwards.py b/sukuinote/plugins/log_forwards.py index 64a1f28..d8728d5 100644 --- a/sukuinote/plugins/log_forwards.py +++ b/sukuinote/plugins/log_forwards.py @@ -34,7 +34,7 @@ async def log_forwards(client, message): chat_text = html.escape(message.chat.title) if message.chat.username: chat_text = f'{chat_text}' - text = f'Forwarded Event\n{force_ltr}- Chat: {chat_text} ' + text = f'Forwarded Event\n- Chat: {chat_text}{force_ltr} ' if message.chat.is_verified: chat_text += '[VERIFIED] ' if message.chat.is_support: @@ -73,15 +73,15 @@ async def log_forwards(client, message): user_text += ' [FAKE]' else: user_text = 'Anonymous' - text += f'\n{force_ltr}- Forwarder: {user_text}' + text += f'\n- Forwarder: {user_text}{force_ltr}' text += f'\n- Message' mtext = (message.text or message.caption or '').strip() if mtext: text += ':' text += '' if mtext: - text += f'{force_ltr} {html.escape(mtext.strip()[:2000])}' - text += f'\n{force_ltr}- Forwardee: ' + text += f' {html.escape(mtext.strip()[:2000])}{force_ltr}' + text += '\n- Forwardee: ' user_text = forwardee.first_name if forwardee.last_name: user_text += f' {forwardee.last_name}' @@ -94,6 +94,6 @@ async def log_forwards(client, message): user_text += ' [SCAM]' if getattr(forwardee, 'is_fake', None): user_text += ' [FAKE]' - text += f'{user_text} [{forwardee.id}]' + text += f'{user_text}{force_ltr} [{forwardee.id}]' log_ring.append(text) logged[message.chat.id].add(message.message_id) diff --git a/sukuinote/plugins/log_reports.py b/sukuinote/plugins/log_reports.py index e3c63e5..e6a2392 100644 --- a/sukuinote/plugins/log_reports.py +++ b/sukuinote/plugins/log_reports.py @@ -19,7 +19,7 @@ async def log_reports(client, message): chat_text = html.escape(message.chat.title) if message.chat.username: chat_text = f'{chat_text}' - text = f'Report Event\n{force_ltr}- Chat: {chat_text} ' + text = f'Report Event\n- Chat: {chat_text}{force_ltr} ' if message.chat.is_verified: chat_text += '[VERIFIED] ' if message.chat.is_support: @@ -28,7 +28,7 @@ async def log_reports(client, message): chat_text += '[SCAM] ' if getattr(message.chat, 'is_fake', None): chat_text += '[FAKE] ' - text += f'[{message.chat.id}]\n{force_ltr}- Reporter: ' + text += f'[{message.chat.id}]\n- Reporter: ' if message.from_user: user_text = message.from_user.first_name if message.from_user.last_name: @@ -57,18 +57,18 @@ async def log_reports(client, message): user_text += ' [FAKE]' else: user_text = 'Anonymous' - text += f'{user_text}\n' + text += f'{user_text}{force_ltr}\n' start, end = message.matches[0].span() - text += f'{force_ltr}- Report Message' + text += f'- Report Message' mtext = (message.text or message.caption or '').strip() if start or end < len(mtext): text += ':' text += '' if start or end < len(mtext): - text += f'{force_ltr} {html.escape(mtext.strip()[:1000])}' + text += f' {html.escape(mtext.strip()[:1000])}{force_ltr}' reply = message.reply_to_message if not getattr(reply, 'empty', True): - text += f'\n{force_ltr}- Reportee: ' + text += '\n- Reportee: ' if reply.from_user: user_text = reply.from_user.first_name if reply.from_user.last_name: @@ -97,10 +97,10 @@ async def log_reports(client, message): user_text += ' [FAKE]' else: user_text = 'Anonymous' - text += f'{user_text}\n{force_ltr}- Reported Message' + text += f'{user_text}{force_ltr}\n- Reported Message' mtext = reply.text or reply.caption or '' if mtext.strip(): text += ':' - text += f'{force_ltr} {html.escape(mtext.strip()[:1000])}' + text += f' {html.escape(mtext.strip()[:1000])}{force_ltr}' log_ring.append(text) reported[message.chat.id].add(message.message_id) diff --git a/sukuinote/plugins/log_user_joins.py b/sukuinote/plugins/log_user_joins.py index 8e76012..2a7bb3c 100644 --- a/sukuinote/plugins/log_user_joins.py +++ b/sukuinote/plugins/log_user_joins.py @@ -9,7 +9,7 @@ def sexy_user_name(user): text = user.first_name if user.last_name: text += ' ' + user.last_name - return f'{"[DELETED]" if user.deleted else html.escape(text or "Empty???")} [{user.id}]' + return f'{"[DELETED]" if user.deleted else (html.escape(text or "Empty???") + force_ltr)} [{user.id}]' handled = defaultdict(set) lock = asyncio.Lock() @@ -41,11 +41,11 @@ async def log_user_joins(client, update, users, chats): raise ContinuePropagation if not is_join and not config['config']['log_user_adds']: raise ContinuePropagation - text = f"{'User Join Event' if is_join else 'User Add Event'}\n{force_ltr}- Chat: " + text = f"{'User Join Event' if is_join else 'User Add Event'}\n- Chat: " atext = html.escape(chats[chat_id].title) if getattr(chats[chat_id], 'username', None): atext = f'{atext}' - text += f"{atext} [{sexy_chat_id}]\n" + text += f"{atext}{force_ltr} [{sexy_chat_id}]\n" async with lock: if message.id not in handled[sexy_chat_id]: if isinstance(message.from_id, PeerUser): @@ -53,13 +53,13 @@ async def log_user_joins(client, update, users, chats): else: adder = 'Anonymous' if is_join: - text += f'{force_ltr}- User: {adder}\n' + text += f'- User: {adder}\n' if isinstance(action, MessageActionChatJoinedByLink): - text += f'{force_ltr}- Inviter: {sexy_user_name(users[action.inviter_id])}' + text += f'- Inviter: {sexy_user_name(users[action.inviter_id])}' else: - text += f'{force_ltr}- Adder: {adder}\n{force_ltr}- Added Users:\n' + text += f'- Adder: {adder}\n- Added Users:\n' for user in action.users: - text += f'{force_ltr}--- {sexy_user_name(users[user])}\n' + text += f'--- {sexy_user_name(users[user])}\n' log_ring.append(text) handled[sexy_chat_id].add(message.id) return