feat(qqpush): 私聊推送接口与抽卡API token读取兼容

This commit is contained in:
2026-08-15 20:50:12 +08:00
parent d2187e5545
commit cb94794e38
7 changed files with 292 additions and 33 deletions

View File

@@ -30,10 +30,21 @@ def _track_task(task: asyncio.Task) -> None:
async def handle_api_result(
bot: Bot, exception: Optional[Exception], api: str, data: Dict[str, Any], result: Any
):
"""拦截发送消息API调用监控发出的消息"""
if api not in ("send_msg", "send_group_msg", "send_private_msg") or exception:
"""拦截发送消息API调用仅对群消息进行撤回,私人消息不撤回"""
if exception:
return
# 私人消息不撤回send_private_msg 直接跳过
if api == "send_private_msg":
return
# send_msg 是通用接口,根据 message_type 区分
if api == "send_msg":
if data.get("message_type") == "private":
return # 通过 send_msg 发送的私人消息也不撤回
elif api != "send_group_msg":
return # 非消息发送 API跳过
message_id = result.get("message_id")
if not message_id:
return