diff --git a/astrbot/core/platform/sources/aiocqhttp/aiocqhttp_platform_adapter.py b/astrbot/core/platform/sources/aiocqhttp/aiocqhttp_platform_adapter.py index 52dd21d56..496726822 100644 --- a/astrbot/core/platform/sources/aiocqhttp/aiocqhttp_platform_adapter.py +++ b/astrbot/core/platform/sources/aiocqhttp/aiocqhttp_platform_adapter.py @@ -385,10 +385,25 @@ async def _convert_handle_message_event( logger.error(f"获取 @ 用户信息失败: {e},此消息段将被忽略。") message_str += "".join(at_parts) + elif t == "markdown": + text = m["data"].get("markdown") or m["data"].get("content", "") + abm.message.append(Plain(text=text)) + message_str += text else: for m in m_group: - a = ComponentTypes[t](**m["data"]) - abm.message.append(a) + try: + if t not in ComponentTypes: + logger.warning( + f"不支持的消息段类型,已忽略: {t}, data={m['data']}" + ) + continue + a = ComponentTypes[t](**m["data"]) + abm.message.append(a) + except Exception as e: + logger.exception( + f"消息段解析失败: type={t}, data={m['data']}. {e}" + ) + continue abm.timestamp = int(time.time()) abm.message_str = message_str