mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2025-12-15 14:22:55 +08:00
Merge e93fc1463e into 61251ce137
This commit is contained in:
commit
8b1e4525db
@ -487,6 +487,34 @@ class PlatformUtils:
|
|||||||
target = Target(user_id, private=True)
|
target = Target(user_id, private=True)
|
||||||
return target
|
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
|
||||||
|
"""
|
||||||
|
platform = PlatformUtils.get_platform(bot)
|
||||||
|
if platform == "qq":
|
||||||
|
await bot.call_api("send_poke", user_id=user_id, group_id=group_id)
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
await bot.call_api("poke", qq=user_id)
|
||||||
|
except Exception:
|
||||||
|
logger.warning(
|
||||||
|
"戳一戳发送失败,可能是协议端不支持...",
|
||||||
|
"发送戳一戳",
|
||||||
|
)
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
class BroadcastEngine:
|
class BroadcastEngine:
|
||||||
def __init__(
|
def __init__(
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user