Commit 034452b

benny-dou <60535774+benny-dou@users.noreply.github.com>
2025-06-10 18:53:21
fix(history): handle anonymous users in query results
1 parent d0e1cc7
Changed files (2)
src
src/history/query.py
@@ -195,6 +195,7 @@ async def query_turso(client: Client, table_name: str, match_time: str, user: st
     for row in rows:
         row_info = {col["name"]: x["value"] for x, col in zip(row, cols, strict=True)}
         url = f"https://t.me/c/{cid}/{row_info['mid']}"
-        texts += f"๐Ÿ‘ค[{row_info['fullname']}]({url}) {row_info['time']}{mtype_emoji(row_info['mtype'])}:\n{row_info['content']}\n"
+        username = row_info["fullname"] or "ๅŒฟๅ"
+        texts += f"๐Ÿ‘ค[{username}]({url}) {row_info['time']}{mtype_emoji(row_info['mtype'])}:\n{row_info['content']}\n"
         count += 1
     return {"texts": texts.strip(), "count": count}
src/history/utils.py
@@ -149,6 +149,4 @@ def mtype_emoji(mtype: str) -> str:
         "voice": "๐ŸŽค",
         "web_page": "๐ŸŒ",
     }
-    if mtype in emojis:
-        return "|" + emojis[mtype]
-    return ""
+    return emojis.get(mtype, "")