Add support for viewing emoji reacts

This commit is contained in:
Ngô Ngọc Đức Huy 2024-02-14 17:26:06 +07:00
parent ae6999e111
commit 7ea714e61c
Signed by: xarvos
GPG key ID: 904AF1C7CDF695C3
2 changed files with 14 additions and 0 deletions

View file

@ -224,6 +224,15 @@ class FilterResult:
status_matches: Optional[str]
@dataclass
class EmojiReaction:
account_ids: List[str]
count: int
me: bool
name: str
url: Optional[str]
@dataclass
class Status:
"""
@ -260,6 +269,7 @@ class Status:
bookmarked: Optional[bool]
pinned: Optional[bool]
filtered: Optional[List[FilterResult]]
emoji_reactions: Optional[List[EmojiReaction]]
@property
def original(self) -> "Status":

View file

@ -292,6 +292,9 @@ def print_status(status: Status, width: int = 80):
if display_name:
spacing -= wcswidth(display_name) + 1
reacts = '\n'.join([f'{react.count} × {react.name}'
for react in status.emoji_reactions])
print_out(
f"<green>{display_name}</green>" if display_name else "",
f"<blue>{username}</blue>",
@ -315,6 +318,7 @@ def print_status(status: Status, width: int = 80):
print_out()
print_out(
f"Reacts:\n{reacts}\n" if reacts else "",
f"ID <yellow>{status_id}</yellow> ",
f"↲ In reply to <yellow>{in_reply_to_id}</yellow> " if in_reply_to_id else "",
f"↻ <blue>@{reblogged_by.acct}</blue> boosted " if reblogged_by else "",