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)):
|
||||
try:
|
||||
img = await get_qq_avatar(user_id)
|
||||
await img.resize(size)
|
||||
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):
|
||||
try:
|
||||
img = await aiorequests.get_img(f'https://p.qlogo.cn/gh/{group_id}/{group_id}/100', size=(110, 110))
|
||||
img = PMImage(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