From bd270aed68b94ac39552fc379b2e4b7ca2fef1e9 Mon Sep 17 00:00:00 2001 From: Soulter <905617992@qq.com> Date: Sun, 20 Jul 2025 22:52:14 +0800 Subject: [PATCH] fix: handle event construction errors in message reply processing --- .../sources/aiocqhttp/aiocqhttp_platform_adapter.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/astrbot/core/platform/sources/aiocqhttp/aiocqhttp_platform_adapter.py b/astrbot/core/platform/sources/aiocqhttp/aiocqhttp_platform_adapter.py index 1991bf393..7329ab603 100644 --- a/astrbot/core/platform/sources/aiocqhttp/aiocqhttp_platform_adapter.py +++ b/astrbot/core/platform/sources/aiocqhttp/aiocqhttp_platform_adapter.py @@ -272,8 +272,14 @@ class AiocqhttpAdapter(Platform): ) # 添加必要的 post_type 字段,防止 Event.from_payload 报错 reply_event_data["post_type"] = "message" + new_event = Event.from_payload(reply_event_data) + if not new_event: + logger.error( + f"无法从回复消息数据构造 Event 对象: {reply_event_data}" + ) + continue abm_reply = await self._convert_handle_message_event( - Event.from_payload(reply_event_data), get_reply=False + new_event, get_reply=False ) reply_seg = Reply(