Refactor emoji handling

This commit is contained in:
vvzvlad
2025-04-01 16:00:37 +03:00
parent 2c06cc8ce4
commit 83e90d13a6
+4 -8
View File
@@ -576,14 +576,10 @@ class PostParser:
reactions_html = ""
if reactions := getattr(message, "reactions", None):
for reaction in reactions.reactions:
emoji = "" # Default for paid reactions
if hasattr(reaction, "emoji") and reaction.emoji:
emoji = reaction.emoji
elif hasattr(reaction, "custom_emoji_id"):
emoji = "" # Custom emoji placeholder
elif not getattr(reaction, "is_paid", False):
emoji = "" # Default for unknown reactions
if getattr(reaction, "is_paid", False): emoji = ""
elif hasattr(reaction, "emoji") and reaction.emoji: emoji = reaction.emoji
elif hasattr(reaction, "custom_emoji_id"): emoji = "" # Then check custom emoji
else: emoji = "" # Default for unknown cases
reactions_html += f'<span class="reaction">{emoji} {reaction.count}&nbsp;&nbsp;</span>'
reactions_html = reactions_html.rstrip()
first_line_parts.append(reactions_html)