Commit fc05d78

benny-dou <60535774+benny-dou@users.noreply.github.com>
2025-06-04 14:12:02
refactor(history): change function name [skip ci]
1 parent fe0d29d
Changed files (2)
src
src/history/sync.py
@@ -22,7 +22,7 @@ from utils import i_am_bot
 DB_COLUMNS = "mid INTEGER PRIMARY KEY, time TEXT NOT NULL, user TEXT, content TEXT, mtype TEXT, uid INTEGER, filename TEXT, mime TEXT, urls TEXT, reply INTEGER"
 
 
-async def save_history_to_d1(client: Client, message: Message) -> None:
+async def sync_history_to_d1(client: Client, message: Message) -> None:
     if not HISTORY.D1_ENABLE:
         return
     info = parse_msg(message, silent=True)
@@ -46,7 +46,7 @@ async def save_history_to_d1(client: Client, message: Message) -> None:
     await query_d1(sql, db_name=HISTORY.D1_DATABASE, params=list(records.values()), silent=True)
 
 
-async def sync_chat_history_to_d1(client: Client, chat_id: str | int) -> None:
+async def backup_chat_history(client: Client, chat_id: str | int) -> None:
     if not HISTORY.D1_ENABLE:
         return
     if await i_am_bot(client):
@@ -101,7 +101,7 @@ async def sync_chat_history_to_d1(client: Client, chat_id: str | int) -> None:
         mids = set()
 
 
-async def sync_export_history_to_d1(client: Client, path: str | Path | None = None) -> None:
+async def upload_exported_history(client: Client, path: str | Path | None = None) -> None:
     if not HISTORY.D1_ENABLE:
         return
     if path is None:
src/handler.py
@@ -11,7 +11,7 @@ from bridge.ocr import send_to_ocr_bridge
 from config import ENABLE, PREFIX, PROXY
 from danmu.entrypoint import query_danmu
 from database import del_db
-from history.sync import save_history_to_d1
+from history.sync import sync_history_to_d1
 from llm.gpt import gpt_response
 from llm.summary import ai_summary
 from messages.parser import parse_msg
@@ -87,7 +87,7 @@ async def handle_utilities(
         detail_progress (bool, optional): Show detailed progress (Only if show_proress is set to True). Defaults to False.
     """
     if kwargs.get("only_d1"):
-        await save_history_to_d1(client, message)
+        await sync_history_to_d1(client, message)
         return
     if kwargs.get("disabled"):
         return
@@ -120,7 +120,7 @@ async def handle_utilities(
     if raw_img:
         await convert_raw_img_file(client, message, **kwargs)
     if save_d1:
-        await save_history_to_d1(client, message)
+        await sync_history_to_d1(client, message)
 
 
 async def handle_social_media(