Commit f50130d

benny-dou <60535774+benny-dou@users.noreply.github.com>
2026-06-16 09:21:46
chore(twitter): improve twitter status
1 parent a2f0ab9
Changed files (1)
src
preview
src/preview/twitter.py
@@ -53,9 +53,10 @@ async def preview_twitter(
         if await copy_messages_from_db(client, message, key=db_key, kv=kv, **kwargs):
             return
         logger.warning("❌从缓存中转发失败, 尝试重新解析...")
+    link_preview = LinkPreviewOptions(is_disabled=False, show_above_text=True, url=f"https://fixupx.com/{handle}/status/{post_id}")
     if kwargs.get("show_progress") and "progress" not in kwargs:
-        res = await send2tg(client, message, texts=f"🔗正在解析推特链接\n{url}", **kwargs)
-        kwargs["progress"] = res[0]
+        status = await message.reply_text(f"🔗正在解析推特链接\n{url}", link_preview_options=link_preview)
+        kwargs["progress"] = status
 
     api_url = f"{API.FXTWITTER}/2/thread/{post_id}?lang=zh-cn"
     logger.info(f"Twitter preview: {api_url}")
@@ -64,7 +65,6 @@ async def preview_twitter(
     resp = await hx_req(api_url, headers=headers, proxy=PROXY.TWITTER, check_kv={"status.id": post_id})
     if resp.get("hx_error"):
         if status := kwargs.get("progress"):
-            link_preview = LinkPreviewOptions(is_disabled=False, show_above_text=True, url=f"https://fixupx.com/{handle}/status/{post_id}")
             await status.edit_text(f"❌推特解析失败\n{url}", link_preview_options=link_preview)
         return
     resp = trim(resp)