refactor(chat): 将消息获取相关函数重构为异步

将 `chat_message_builder` 中的多个同步消息获取函数(如 `get_raw_msg_by_timestamp`)及其调用全部修改为异步函数。这统一了数据库查询的异步模式,提高了代码一致性和可维护性。

主要改动包括:
- 将 `chat_message_builder.py` 中的数据库查询函数标记为 `async` 并使用 `await`。
- 更新了 `message_api.py`、`mood_manager.py` 和 `qzone_service.py` 中对这些函数的调用,以适应异步接口。
- 调整了 `message_api.py` 中的函数签名和返回类型提示,以反映异步特性。
This commit is contained in:
minecraft1024a
2025-10-02 17:32:02 +08:00
committed by Windpicker-owo
parent 00a9a71702
commit 944876227a
4 changed files with 44 additions and 40 deletions

View File

@@ -221,7 +221,7 @@ class QZoneService:
for chat_id in group.chat_ids:
# 使用正确的函数获取历史消息
messages = get_raw_msg_by_timestamp_with_chat(
messages = await get_raw_msg_by_timestamp_with_chat(
chat_id=chat_id,
timestamp_start=start_time,
timestamp_end=end_time,