fix: update CQCode and Message classes for async initialization and processing

This commit is contained in:
KawaiiYusora
2025-03-07 01:31:03 +08:00
parent 26f99664ee
commit e0e3ee4177
5 changed files with 112 additions and 103 deletions

View File

@@ -131,7 +131,7 @@ def get_cloest_chat_from_db(db, length: int, timestamp: str):
return ''
def get_recent_group_messages(db, group_id: int, limit: int = 12) -> list:
async def get_recent_group_messages(db, group_id: int, limit: int = 12) -> list:
"""从数据库获取群组最近的消息记录
Args:
@@ -173,6 +173,7 @@ def get_recent_group_messages(db, group_id: int, limit: int = 12) -> list:
processed_plain_text=msg_data.get("processed_text", ""),
group_id=group_id
)
await msg.initialize()
message_objects.append(msg)
except KeyError:
print("[WARNING] 数据库中存在无效的消息")