forked from bot/app
✨ 新增 stat rank 功能
This commit is contained in:
0
liteyuki/utils/external/__init__.py
vendored
Normal file
0
liteyuki/utils/external/__init__.py
vendored
Normal file
40
liteyuki/utils/external/logo.py
vendored
Normal file
40
liteyuki/utils/external/logo.py
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
async def get_user_icon(platform: str, user_id: str) -> str:
|
||||
"""
|
||||
获取用户头像
|
||||
Args:
|
||||
platform: qq, telegram, discord...
|
||||
user_id: 1234567890
|
||||
|
||||
Returns:
|
||||
str: 头像链接
|
||||
"""
|
||||
match platform:
|
||||
case "qq":
|
||||
return f"http://q1.qlogo.cn/g?b=qq&nk={user_id}&s=640"
|
||||
case "telegram":
|
||||
return f"https://t.me/i/userpic/320/{user_id}.jpg"
|
||||
case "discord":
|
||||
return f"https://cdn.discordapp.com/avatars/{user_id}/"
|
||||
case _:
|
||||
return ""
|
||||
|
||||
|
||||
async def get_group_icon(platform: str, group_id: str) -> str:
|
||||
"""
|
||||
获取群组头像
|
||||
Args:
|
||||
platform: qq, telegram, discord...
|
||||
group_id: 1234567890
|
||||
|
||||
Returns:
|
||||
str: 头像链接
|
||||
"""
|
||||
match platform:
|
||||
case "qq":
|
||||
return f"http://p.qlogo.cn/gh/{group_id}/{group_id}/640"
|
||||
case "telegram":
|
||||
return f"https://t.me/c/{group_id}/"
|
||||
case "discord":
|
||||
return f"https://cdn.discordapp.com/icons/{group_id}/"
|
||||
case _:
|
||||
return ""
|
0
liteyuki/utils/nb/__init__.py
Normal file
0
liteyuki/utils/nb/__init__.py
Normal file
Reference in New Issue
Block a user