mirror of
https://github.com/xuthus83/LittlePaimon.git
synced 2024-10-21 16:27:15 +08:00
🐛 修复深渊统计
因透明头像而报错的问题
This commit is contained in:
parent
5290b0fc72
commit
f2a8c38e2a
@ -13,17 +13,23 @@ from LittlePaimon.utils.message import MessageBuild
|
|||||||
|
|
||||||
|
|
||||||
async def get_user_avatar(user_id: str, size: Tuple[int, int] = (60, 60)):
|
async def get_user_avatar(user_id: str, size: Tuple[int, int] = (60, 60)):
|
||||||
img = await get_qq_avatar(user_id)
|
try:
|
||||||
await img.resize(size)
|
img = await get_qq_avatar(user_id)
|
||||||
await img.to_circle('circle')
|
await img.resize(size)
|
||||||
return img
|
await img.to_circle('circle')
|
||||||
|
return img
|
||||||
|
except Exception:
|
||||||
|
return PMImage(size=size, color=(255, 255, 255, 255))
|
||||||
|
|
||||||
|
|
||||||
async def get_group_avatar(group_id: str):
|
async def get_group_avatar(group_id: str):
|
||||||
img = await aiorequests.get_img(f'https://p.qlogo.cn/gh/{group_id}/{group_id}/100', size=(110, 110))
|
try:
|
||||||
img = PMImage(img)
|
img = await aiorequests.get_img(f'https://p.qlogo.cn/gh/{group_id}/{group_id}/100', size=(110, 110))
|
||||||
await img.to_circle('circle')
|
img = PMImage(img)
|
||||||
return img
|
await img.to_circle('circle')
|
||||||
|
return img
|
||||||
|
except Exception:
|
||||||
|
return PMImage(size=(110, 110), color=(255, 255, 255, 255))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user