feat(qqpush): 私聊推送接口与抽卡API token读取兼容
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user