Commit c2b66c8

benny-dou <60535774+benny-dou@users.noreply.github.com>
2025-08-26 11:15:19
chore(history): replace `offset_id` with `max_id` in `client.get_chat_history()`
1 parent 7745834
Changed files (3)
src
src/history/d1.py
@@ -97,7 +97,7 @@ async def backup_chat_history_to_d1(
     num_sync = 0
     tasks = []
     real_cid = chatinfo["chandle"] or (int(chatinfo["cid"]) if chatinfo["ctype"] in ["BOT", "PRIVATE"] else int(f"-100{chatinfo['cid']}"))
-    async for message in client.get_chat_history(real_cid, offset_id=offset_id):  # type: ignore
+    async for message in client.get_chat_history(real_cid, max_id=offset_id):  # type: ignore
         if not isinstance(message, Message) or message.empty or message.service or message.id in saved_mids:
             continue
         info = parse_msg(message, silent=True, use_cache=False)
src/history/turso.py
@@ -97,7 +97,7 @@ async def backup_chat_history_to_turso(
     num_sync = 0
     statements = []
     real_cid = chatinfo["chandle"] or (int(chatinfo["cid"]) if chatinfo["ctype"] in ["BOT", "PRIVATE"] else int(f"-100{chatinfo['cid']}"))
-    async for message in client.get_chat_history(real_cid, offset_id=offset_id):  # type: ignore
+    async for message in client.get_chat_history(real_cid, max_id=offset_id):  # type: ignore
         if not isinstance(message, Message) or message.empty or message.service or message.id in saved_mids:
             continue
         info = parse_msg(message, silent=True, use_cache=False)
src/messages/chat_history.py
@@ -119,7 +119,7 @@ async def get_history_info_list_via_telegram(
     chat = await get_chat(client, chat_id)
     if chat.id == 0:
         return []
-    async for msg in client.get_chat_history(chat_id=chat.username or chat.id, offset_id=offset_id):  # type: ignore
+    async for msg in client.get_chat_history(chat_id=chat.username or chat.id, max_id=offset_id):  # type: ignore
         # iterate messages from new to old
         retrieved += 1
         if retrieved > MAX_MESSAGE_RETRIEVED: