(Try to) force ltr on log_*
This commit is contained in:
		
							parent
							
								
									00adc73dd4
								
							
						
					
					
						commit
						50acc5843c
					
				|  | @ -6,6 +6,7 @@ from .. import config, log_errors, app_user_ids, log_ring | |||
| 
 | ||||
| logged = defaultdict(set) | ||||
| lock = asyncio.Lock() | ||||
| force_ltr = '\u200E' | ||||
| 
 | ||||
| @Client.on_message(~filters.chat(config['config']['log_chat']) & filters.incoming & filters.forwarded & (filters.group | filters.channel)) | ||||
| @log_errors | ||||
|  | @ -33,7 +34,7 @@ async def log_forwards(client, message): | |||
|         chat_text = html.escape(message.chat.title) | ||||
|         if message.chat.username: | ||||
|             chat_text = f'<a href="https://t.me/{message.chat.username}">{chat_text}</a>' | ||||
|         text = f'<b>Forwarded Event</b>\n- <b>Chat:</b> {chat_text} ' | ||||
|         text = f'<b>Forwarded Event</b>\n{force_ltr}- <b>Chat:</b> {chat_text} ' | ||||
|         if message.chat.is_verified: | ||||
|             chat_text += '<code>[VERIFIED]</code> ' | ||||
|         if message.chat.is_support: | ||||
|  | @ -72,15 +73,15 @@ async def log_forwards(client, message): | |||
|                     user_text += ' <code>[FAKE]</code>' | ||||
|             else: | ||||
|                 user_text = 'Anonymous' | ||||
|             text += f'\n- <b>Forwarder:</b> {user_text}' | ||||
|             text += f'\n{force_ltr}- <b>Forwarder:</b> {user_text}' | ||||
|         text += f'\n- <b><a href="{message.link}">Message' | ||||
|         mtext = (message.text or message.caption or '').strip() | ||||
|         if mtext: | ||||
|             text += ':' | ||||
|         text += '</a></b>' | ||||
|         if mtext: | ||||
|             text += f' {html.escape(mtext.strip()[:2000])}' | ||||
|         text += '\n- <b>Forwardee:</b> ' | ||||
|             text += f'{force_ltr} {html.escape(mtext.strip()[:2000])}' | ||||
|         text += '\n{force_ltr}- <b>Forwardee:</b> ' | ||||
|         user_text = forwardee.first_name | ||||
|         if forwardee.last_name: | ||||
|             user_text += f' {forwardee.last_name}' | ||||
|  |  | |||
|  | @ -6,6 +6,7 @@ from .. import config, log_errors, log_ring | |||
| 
 | ||||
| reported = defaultdict(set) | ||||
| lock = asyncio.Lock() | ||||
| force_ltr = '\u200E' | ||||
| 
 | ||||
| @Client.on_message(~filters.chat(config['config']['log_chat']) & filters.regex(r'(?:^|\s+)@admins?(?:$|\W+)|^[/!](?:report|admins?)(?:$|\W+)') & filters.group) | ||||
| @log_errors | ||||
|  | @ -18,7 +19,7 @@ async def log_reports(client, message): | |||
|         chat_text = html.escape(message.chat.title) | ||||
|         if message.chat.username: | ||||
|             chat_text = f'<a href="https://t.me/{message.chat.username}">{chat_text}</a>' | ||||
|         text = f'<b>Report Event</b>\n- <b>Chat:</b> {chat_text} ' | ||||
|         text = f'<b>Report Event</b>\n{force_ltr}- <b>Chat:</b> {chat_text} ' | ||||
|         if message.chat.is_verified: | ||||
|             chat_text += '<code>[VERIFIED]</code> ' | ||||
|         if message.chat.is_support: | ||||
|  | @ -27,7 +28,7 @@ async def log_reports(client, message): | |||
|             chat_text += '<code>[SCAM]</code> ' | ||||
|         if getattr(message.chat, 'is_fake', None): | ||||
|             chat_text += '<code>[FAKE]</code> ' | ||||
|         text += f'[<code>{message.chat.id}</code>]\n- <b>Reporter:</b> ' | ||||
|         text += f'[<code>{message.chat.id}</code>]\n{force_ltr}- <b>Reporter:</b> ' | ||||
|         if message.from_user: | ||||
|             user_text = message.from_user.first_name | ||||
|             if message.from_user.last_name: | ||||
|  | @ -58,16 +59,16 @@ async def log_reports(client, message): | |||
|             user_text = 'Anonymous' | ||||
|         text += f'{user_text}\n' | ||||
|         start, end = message.matches[0].span() | ||||
|         text += f'- <b><a href="{message.link}">Report Message' | ||||
|         text += f'{force_ltr}- <b><a href="{message.link}">Report Message' | ||||
|         mtext = (message.text or message.caption or '').strip() | ||||
|         if start or end < len(mtext): | ||||
|             text += ':' | ||||
|         text += '</a></b>' | ||||
|         if start or end < len(mtext): | ||||
|             text += f' {html.escape(mtext.strip()[:1000])}' | ||||
|             text += f'{force_ltr} {html.escape(mtext.strip()[:1000])}' | ||||
|         reply = message.reply_to_message | ||||
|         if not getattr(reply, 'empty', True): | ||||
|             text += '\n- <b>Reportee:</b> ' | ||||
|             text += '\n{force_ltr}- <b>Reportee:</b> ' | ||||
|             if reply.from_user: | ||||
|                 user_text = reply.from_user.first_name | ||||
|                 if reply.from_user.last_name: | ||||
|  | @ -96,10 +97,10 @@ async def log_reports(client, message): | |||
|                     user_text += ' <code>[FAKE]</code>' | ||||
|             else: | ||||
|                 user_text = 'Anonymous' | ||||
|             text += f'{user_text}\n- <b><a href="{reply.link}">Reported Message' | ||||
|             text += f'{user_text}\n{force_ltr}- <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])}' | ||||
|             text += f'</a></b>{force_ltr} {html.escape(mtext.strip()[:1000])}' | ||||
|         log_ring.append(text) | ||||
|         reported[message.chat.id].add(message.message_id) | ||||
|  |  | |||
|  | @ -13,6 +13,8 @@ def sexy_user_name(user): | |||
| 
 | ||||
| handled = defaultdict(set) | ||||
| lock = asyncio.Lock() | ||||
| force_ltr = '\u200E' | ||||
| 
 | ||||
| @Client.on_raw_update() | ||||
| @log_errors | ||||
| async def log_user_joins(client, update, users, chats): | ||||
|  | @ -39,7 +41,7 @@ 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"<b>{'User Join Event' if is_join else 'User Add Event'}</b>\n- <b>Chat:</b> " | ||||
|                 text = f"<b>{'User Join Event' if is_join else 'User Add Event'}</b>\n{force_ltr}- <b>Chat:</b> " | ||||
|                 atext = html.escape(chats[chat_id].title) | ||||
|                 if getattr(chats[chat_id], 'username', None): | ||||
|                     atext = f'<a href="https://t.me/{chats[chat_id].username}">{atext}</a>' | ||||
|  | @ -51,13 +53,13 @@ async def log_user_joins(client, update, users, chats): | |||
|                         else: | ||||
|                             adder = 'Anonymous' | ||||
|                         if is_join: | ||||
|                             text += f'- <b>User:</b> {adder}\n' | ||||
|                             text += f'{force_ltr}- <b>User:</b> {adder}\n' | ||||
|                             if isinstance(action, MessageActionChatJoinedByLink): | ||||
|                                 text += f'- <b>Inviter:</b> {sexy_user_name(users[action.inviter_id])}' | ||||
|                                 text += f'{force_ltr}- <b>Inviter:</b> {sexy_user_name(users[action.inviter_id])}' | ||||
|                         else: | ||||
|                             text += f'- <b>Adder:</b> {adder}\n- <b>Added Users:</b>\n' | ||||
|                             text += f'{force_ltr}- <b>Adder:</b> {adder}\n{force_ltr}- <b>Added Users:</b>\n' | ||||
|                             for user in action.users: | ||||
|                                 text += f'--- {sexy_user_name(users[user])}\n' | ||||
|                                 text += f'{force_ltr}--- {sexy_user_name(users[user])}\n' | ||||
|                         log_ring.append(text) | ||||
|                         handled[sexy_chat_id].add(message.id) | ||||
|                         return | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue