enhance forward title display in message content with clearer formatting

This commit is contained in:
vvzvlad
2025-04-18 04:54:06 +03:00
parent 63a8e32e25
commit 1c77552ca9
+6 -8
View File
@@ -559,16 +559,14 @@ class PostParser:
text = text.replace('\n', '<br>') # Replace newlines with <br>
text = self._add_hyperlinks_to_raw_urls(text)
#if message.forward_origin:
# if message.forward_origin.sender_chat:
# forward_title = message.forward_origin.sender_chat.title or message.forward_origin.sender_chat.username or 'Unknown channel'
# else:
# forward_title = 'Unknown channel'
if text: # Message text
forward_title = 'Unknown channel'
if message.forward_origin and message.forward_origin.chat:
forward_title = message.forward_origin.chat.title or message.forward_origin.chat.username or 'Unknown channel'
if text:
content_body.append(f'<div class="message-text">')
if message.forward_origin: content_body.append(f"--------- FWD ---------")
if message.forward_origin: content_body.append(f"--------- FWD from {forward_title} ---------<br>")
content_body.append(f'{text}')
if message.forward_origin: content_body.append(f"--------- FWD END---------")
if message.forward_origin: content_body.append(f"<br>--------- FWD END from {forward_title} ---------")
content_body.append(f'</div><br>')
if poll := getattr(message, "poll", None): # Poll message