1
0
forked from bot/app

🔥 小型重构

This commit is contained in:
2024-06-26 13:52:04 +08:00
parent 35823be13e
commit 8b01943d14
268 changed files with 25225 additions and 24996 deletions

0
src/utils/external/__init__.py vendored Normal file
View File

40
src/utils/external/logo.py vendored Normal file
View 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 ""