Commit f2ca4be

benny-dou <60535774+benny-dou@users.noreply.github.com>
2025-08-17 18:40:42
style(github): improve GitHub preview message formatting
1 parent 7ba1f2a
Changed files (1)
src
preview
src/preview/github.py
@@ -33,20 +33,20 @@ async def preview_github(client: Client, message: Message, url: str, gh_user: st
     msg = ""
     if desc := resp["description"]:
         msg += f"**{desc}**\n"
-
     msg += f"📦[{full_repo}](https://github.com/{full_repo})\n"
     if upstream := glom(resp, "parent.full_name", default=""):
         msg += f"⬆️上游: [{upstream}](https://github.com/{upstream})\n"
 
     msg += f"⭐️Star: {resp['stargazers_count']}\n"
-    msg += f"🔀Fork: {resp['forks_count']}\n"
-    msg += f"👁Watch: {resp['stargazers_count']}\n"
-    msg += f"❔Issues: {resp['open_issues_count']}\n"
+    msg += f"👁Watch: {resp['subscribers_count']}\n"
+    msg += f"🔀[Fork](https://github.com/{full_repo}/forks): {resp['forks_count']}\n"
+    msg += f"❔[Issues](https://github.com/{full_repo}/issues): {resp['open_issues_count']}\n"
 
     if lcen := glom(resp, "license.spdx_id", default=""):
         msg += f"📄License: {lcen}\n"
     msg += f"🕒创建日期: {convert_dt(resp['created_at']):%Y-%m-%d %H:%M:%S}\n"
-    msg += f"🔄最新推送: {delta_time(resp['pushed_at'])}\n"
+    default_branch = resp.get("default_branch", "main")
+    msg += f"🔄[最新推送](https://github.com/{full_repo}/commits/{default_branch}): {delta_time(resp['pushed_at'])}\n"
     if tags := glom(resp, "topics", default=[]):
         msg += "🏷️Tags:"
         for tag in tags: