From 66d7336acb5117899e97aaaebdf51b132e74d59b Mon Sep 17 00:00:00 2001 From: overwriter <9856mmm@gmail.com> Date: Thu, 17 Jul 2025 07:58:58 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E6=88=B3=E4=B8=80?= =?UTF-8?q?=E6=88=B3=E5=B0=8F=E5=B7=A5=E5=85=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zhenxun/utils/platform.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/zhenxun/utils/platform.py b/zhenxun/utils/platform.py index 13bf4144..a7f1aa95 100644 --- a/zhenxun/utils/platform.py +++ b/zhenxun/utils/platform.py @@ -487,6 +487,40 @@ class PlatformUtils: target = Target(user_id, private=True) return target + @classmethod + async def poke( + cls, + bot: Bot, + user_id: str, + group_id: str | None = None, + ) -> bool: + """发送戳一戳 + + 参数: + bot: Bot + user_id: 用户id + group_id: 群组id + """ + try: + await bot.call_api("poke", qq=user_id) + except Exception: + try: + if group_id: + await bot.call_api( + "group_poke", user_id=user_id, group_id=group_id + ) + else: + await bot.call_api( + "friend_poke", user_id=user_id + ) + except Exception: + logger.warning( + "戳一戳发送失败,可能是协议端不支持...", + "发送戳一戳", + ) + return False + return True + class BroadcastEngine: def __init__(