解决UnboundLocalError

This commit is contained in:
UnCLAS-Prommer
2025-08-31 12:30:11 +08:00
parent 4bee6002ff
commit aa1155cc5b
9 changed files with 65 additions and 67 deletions

View File

@@ -99,6 +99,8 @@ async def _send_to_target(
# 创建消息段
message_segment = Seg(type=message_type, data=content) # type: ignore
reply_to_platform_id = ""
anchor_message: Union["MessageRecv", None] = None
if reply_message:
anchor_message = message_dict_to_message_recv(reply_message.flatten())
if anchor_message:
@@ -107,9 +109,6 @@ async def _send_to_target(
reply_to_platform_id = (
f"{anchor_message.message_info.platform}:{anchor_message.message_info.user_info.user_id}"
)
else:
reply_to_platform_id = ""
anchor_message = None
# 构建发送消息对象
bot_message = MessageSending(

View File

@@ -124,6 +124,7 @@ class ComponentRegistry:
self._components_classes[namespaced_name] = component_class
# 根据组件类型进行特定注册(使用原始名称)
ret = False
match component_type:
case ComponentType.ACTION:
assert isinstance(component_info, ActionInfo)