(Try to) sprinkle force LTR at the right places

This commit is contained in:
blank X 2021-04-04 14:36:52 +07:00
parent 2f4b5302bd
commit afe1c2e1ea
Signed by: blankie
GPG Key ID: CC15FC822C7F61F5
3 changed files with 20 additions and 20 deletions

View File

@ -34,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{force_ltr}- <b>Chat:</b> {chat_text} '
text = f'<b>Forwarded Event</b>\n- <b>Chat:</b> {chat_text}{force_ltr} '
if message.chat.is_verified:
chat_text += '<code>[VERIFIED]</code> '
if message.chat.is_support:
@ -73,15 +73,15 @@ async def log_forwards(client, message):
user_text += ' <code>[FAKE]</code>'
else:
user_text = 'Anonymous'
text += f'\n{force_ltr}- <b>Forwarder:</b> {user_text}'
text += f'\n- <b>Forwarder:</b> {user_text}{force_ltr}'
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'{force_ltr} {html.escape(mtext.strip()[:2000])}'
text += f'\n{force_ltr}- <b>Forwardee:</b> '
text += f' {html.escape(mtext.strip()[:2000])}{force_ltr}'
text += '\n- <b>Forwardee:</b> '
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 += ' <code>[SCAM]</code>'
if getattr(forwardee, 'is_fake', None):
user_text += ' <code>[FAKE]</code>'
text += f'{user_text} [<code>{forwardee.id}</code>]'
text += f'{user_text}{force_ltr} [<code>{forwardee.id}</code>]'
log_ring.append(text)
logged[message.chat.id].add(message.message_id)

View File

@ -19,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{force_ltr}- <b>Chat:</b> {chat_text} '
text = f'<b>Report Event</b>\n- <b>Chat:</b> {chat_text}{force_ltr} '
if message.chat.is_verified:
chat_text += '<code>[VERIFIED]</code> '
if message.chat.is_support:
@ -28,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{force_ltr}- <b>Reporter:</b> '
text += f'[<code>{message.chat.id}</code>]\n- <b>Reporter:</b> '
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 += ' <code>[FAKE]</code>'
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}- <b><a href="{message.link}">Report Message'
text += f'- <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'{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}- <b>Reportee:</b> '
text += '\n- <b>Reportee:</b> '
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 += ' <code>[FAKE]</code>'
else:
user_text = 'Anonymous'
text += f'{user_text}\n{force_ltr}- <b><a href="{reply.link}">Reported Message'
text += f'{user_text}{force_ltr}\n- <b><a href="{reply.link}">Reported Message'
mtext = reply.text or reply.caption or ''
if mtext.strip():
text += ':'
text += f'</a></b>{force_ltr} {html.escape(mtext.strip()[:1000])}'
text += f'</a></b> {html.escape(mtext.strip()[:1000])}{force_ltr}'
log_ring.append(text)
reported[message.chat.id].add(message.message_id)

View File

@ -9,7 +9,7 @@ def sexy_user_name(user):
text = user.first_name
if user.last_name:
text += ' ' + user.last_name
return f'{"<code>[DELETED]</code>" if user.deleted else html.escape(text or "Empty???")} [<code>{user.id}</code>]'
return f'{"<code>[DELETED]</code>" if user.deleted else (html.escape(text or "Empty???") + force_ltr)} [<code>{user.id}</code>]'
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"<b>{'User Join Event' if is_join else 'User Add Event'}</b>\n{force_ltr}- <b>Chat:</b> "
text = f"<b>{'User Join Event' if is_join else 'User Add Event'}</b>\n- <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>'
text += f"{atext} [<code>{sexy_chat_id}</code>]\n"
text += f"{atext}{force_ltr} [<code>{sexy_chat_id}</code>]\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}- <b>User:</b> {adder}\n'
text += f'- <b>User:</b> {adder}\n'
if isinstance(action, MessageActionChatJoinedByLink):
text += f'{force_ltr}- <b>Inviter:</b> {sexy_user_name(users[action.inviter_id])}'
text += f'- <b>Inviter:</b> {sexy_user_name(users[action.inviter_id])}'
else:
text += f'{force_ltr}- <b>Adder:</b> {adder}\n{force_ltr}- <b>Added Users:</b>\n'
text += f'- <b>Adder:</b> {adder}\n- <b>Added Users:</b>\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