Commit 8638584

benny-dou <60535774+benny-dou@users.noreply.github.com>
2025-06-10 02:13:29
fix(history): use `from_id` as user if `from` field is not available
1 parent eaa69d7
Changed files (1)
src
history
src/history/turso.py
@@ -162,7 +162,7 @@ async def upload_exported_history_to_turso(client: Client, path: str | Path | No
 
         dt = datetime.fromtimestamp(int(info["date_unixtime"]), tz=ZoneInfo(TZ))
         uid = int(info["from_id"].removeprefix("user").removeprefix("channel"))
-        user = info["from"]
+        user = info["from"] or info["from_id"].removeprefix("user").removeprefix("channel")
         if user == data["name"] and data["type"] in ["public_channel", "private_channel"]:  # user is not shown
             user = ""
             uid = 1