From 83e90d13a62fda1c63a64d2986ef7f68d302fa36 Mon Sep 17 00:00:00 2001 From: vvzvlad Date: Tue, 1 Apr 2025 16:00:37 +0300 Subject: [PATCH] Refactor emoji handling --- post_parser.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/post_parser.py b/post_parser.py index e6c5383..8193d78 100644 --- a/post_parser.py +++ b/post_parser.py @@ -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'{emoji} {reaction.count}  ' reactions_html = reactions_html.rstrip() first_line_parts.append(reactions_html)