From fe78cf40063de619e293c77203c56f4ca0ef5973 Mon Sep 17 00:00:00 2001 From: xtaodada Date: Mon, 21 Oct 2024 15:15:06 +0800 Subject: [PATCH] fix: bsky repost status --- defs/bsky.py | 4 ++-- models/models/bsky.py | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/defs/bsky.py b/defs/bsky.py index a8404ee..6dff556 100644 --- a/defs/bsky.py +++ b/defs/bsky.py @@ -82,8 +82,8 @@ class Timeline: if (post.is_reply or post.is_quote) and post.parent_post: text += f"{post.parent_post.author.format} {post.parent_post.status}于 {post.parent_post.time_str}\n" text += f"{post.author.format} {post.status}于 {post.time_str}\n" - if post.is_repost: - text += f"{post.repost_info.by.format} {post.status}于 {post.repost_info.time_str}\n" + if post.is_repost and post.repost_info: + text += f"{post.repost_info.by.format} 转发于 {post.repost_info.time_str}\n" text += f"点赞: {post.like_count} | 引用: {post.quote_count} | 回复: {post.reply_count} | 转发: {post.repost_count}" return text diff --git a/models/models/bsky.py b/models/models/bsky.py index 2abf9a1..19369ed 100644 --- a/models/models/bsky.py +++ b/models/models/bsky.py @@ -131,8 +131,6 @@ class HumanPost(BaseModel, frozen=False): return "引用" elif self.is_reply: return "回复" - elif self.is_repost: - return "转发" return "发表" @staticmethod @@ -192,7 +190,8 @@ class HumanPost(BaseModel, frozen=False): elif data.reason: is_repost = True repost_info = HumanRepostInfo( - by=HumanAuthor.parse(data.reason.by), at=data.reason.at + by=HumanAuthor.parse(data.reason.by), + at=data.reason.indexed_at, ) elif data.post.embed and isinstance(data.post.embed, BskyViewRecord): is_quote = True