refactor(plugin_system): 重构 send_command 以对接适配器专用命令接口

BaseAction 中的 send_command 方法已重构,从使用通用的 `command_to_stream` API 切换到新的 `adapter_command_to_stream` API。

这一变更带来了以下改进:
- **接口统一**: 所有与平台适配器直接交互的命令现在都通过专用的接口,使得逻辑更清晰。
- **参数结构化**: 调用参数从旧的 `{"name": ..., "args": ...}` 格式更新为更明确的 `action`, `params` 和 `platform`。
- **健壮的响应处理**: 现在会解析 API 返回的结构化 JSON 响应(包含 status 和 message),以实现更精确的成功/失败判断和错误日志记录。

BREAKING CHANGE: `send_command` 调用的 `command_name` 现在需要与目标平台适配器定义的 `action` 名称完全匹配。例如,在 `social_toolkit_plugin` 中,`set_emoji_like` 已更新为 `set_msg_emoji_like`。所有使用此方法的插件可能需要更新其命令名称。
This commit is contained in:
tt-P607
2025-10-01 23:49:44 +08:00
parent c833c4bdbe
commit ba5e0b0eaf
2 changed files with 12 additions and 10 deletions

View File

@@ -316,7 +316,7 @@ class SetEmojiLikeAction(BaseAction):
try:
# 使用适配器API发送贴表情命令
success = await self.send_command(
command_name="set_emoji_like",
command_name="set_msg_emoji_like",
args={"message_id": message_id, "emoji_id": emoji_id, "set": set_like},
storage_message=False,
)