refactor(api): 优化撤回消息的函数调用
将 `adapter_command_to_stream` 的直接调用重构为使用更通用的 `command_to_stream` 函数。 此更改统一了命令分发逻辑,提高了代码的可维护性。
This commit is contained in:
@@ -511,9 +511,11 @@ async def recall_message(message_id: str, stream_id: str) -> bool:
|
||||
Returns:
|
||||
bool: 是否成功
|
||||
"""
|
||||
response = await adapter_command_to_stream(
|
||||
action="delete_msg",
|
||||
params={"message_id": message_id},
|
||||
stream_id=stream_id,
|
||||
)
|
||||
return response.get("status") == "ok"
|
||||
command_data = {"name": "delete_msg", "args": message_id}
|
||||
|
||||
success = await command_to_stream(
|
||||
command=command_data,
|
||||
stream_id=stream_id,
|
||||
storage_message=True,
|
||||
)
|
||||
return success
|
||||
Reference in New Issue
Block a user