mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2025-12-15 14:22:55 +08:00
✨ 提供qq协议端判断方法
This commit is contained in:
parent
4ed1791b30
commit
a77d350dfb
@ -156,7 +156,8 @@ class PlatformUtils:
|
||||
返回:
|
||||
UserData | None: 用户数据
|
||||
"""
|
||||
if interface := get_interface(bot):
|
||||
if not (interface := get_interface(bot)):
|
||||
return None
|
||||
member = None
|
||||
user = None
|
||||
if channel_id:
|
||||
@ -173,26 +174,26 @@ class PlatformUtils:
|
||||
user = await interface.get_user(user_id)
|
||||
if not user:
|
||||
return None
|
||||
if member:
|
||||
return UserData(
|
||||
return (
|
||||
UserData(
|
||||
name=user.name or "",
|
||||
card=member.nick,
|
||||
user_id=user.id,
|
||||
group_id=group_id,
|
||||
channel_id=channel_id,
|
||||
role=member.role.id if member.role else None,
|
||||
join_time=int(member.joined_at.timestamp())
|
||||
if member.joined_at
|
||||
else None,
|
||||
join_time=(
|
||||
int(member.joined_at.timestamp()) if member.joined_at else None
|
||||
),
|
||||
)
|
||||
else:
|
||||
return UserData(
|
||||
if member
|
||||
else UserData(
|
||||
name=user.name or "",
|
||||
user_id=user.id,
|
||||
group_id=group_id,
|
||||
channel_id=channel_id,
|
||||
)
|
||||
return None
|
||||
)
|
||||
|
||||
@classmethod
|
||||
async def get_user_avatar(
|
||||
@ -343,6 +344,23 @@ class PlatformUtils:
|
||||
return "qq" if platform.startswith("qq") else platform
|
||||
return "unknown"
|
||||
|
||||
@classmethod
|
||||
def is_forward_merge_supported(cls, t: Bot | Uninfo) -> bool:
|
||||
"""是否支持转发消息
|
||||
|
||||
参数:
|
||||
t: bot | Uninfo
|
||||
|
||||
返回:
|
||||
bool: 是否支持转发消息
|
||||
"""
|
||||
if not isinstance(t, Bot):
|
||||
return t.basic["scope"] == SupportScope.qq_client
|
||||
if interface := get_interface(t):
|
||||
info = interface.basic_info()
|
||||
return info["scope"] == SupportScope.qq_client
|
||||
return False
|
||||
|
||||
@classmethod
|
||||
async def get_group_list(
|
||||
cls, bot: Bot, only_group: bool = False
|
||||
|
||||
Loading…
Reference in New Issue
Block a user