修复插件注册中由于引用导致的重复

This commit is contained in:
2025-11-06 16:16:11 +08:00
parent 34da3f8459
commit 4ad222cbc7
3 changed files with 42 additions and 93 deletions

View File

@@ -19,9 +19,33 @@ async def callback_verify():
return JSONResponse({"result": "ok"})
@router.post("/callback/construct")
async def callback_receive_construct(callback_data: CallbackRequest):
"""以构造好的Callback消息进行处理, 已知方式"""
try:
# 解析指令
content = callback_data.content
command = content.split(" ")[0]
message = content[len(command):].strip()
config.Log("Info", f"识别指令: command={command}")
# 处理指令
result = await handle_command(command, message, callback_data.chatid, callback_data.creator)
if result:
return JSONResponse({"result": "ok", "message": result})
else:
return JSONResponse({"result": "ok"})
except Exception as e:
config.Log("Error", f"处理Callback异常: {e}")
if ALWAYS_RETURN_OK:
return JSONResponse({"result": "ok"})
else:
return JSONResponse({"result": "error", "message": str(e)})
@router.post("/callback")
async def callback_receive(request: Request):
"""Callback消息"""
"""接受未知的Callback消息并进行处理, 默认方式"""
try:
# 解析请求数据
data = await request.json()