From f2a8c38e2a746c6f7bdbe23545011f67ae6eaaa6 Mon Sep 17 00:00:00 2001 From: CMHopeSunshine <277073121@qq.com> Date: Sat, 1 Oct 2022 13:46:03 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20=E4=BF=AE=E5=A4=8D`=E6=B7=B1=E6=B8=8A?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1`=E5=9B=A0=E9=80=8F=E6=98=8E=E5=A4=B4?= =?UTF-8?q?=E5=83=8F=E8=80=8C=E6=8A=A5=E9=94=99=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugins/Paimon_Info/abyss_statistics.py | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/LittlePaimon/plugins/Paimon_Info/abyss_statistics.py b/LittlePaimon/plugins/Paimon_Info/abyss_statistics.py index d7cf67d..56457ab 100644 --- a/LittlePaimon/plugins/Paimon_Info/abyss_statistics.py +++ b/LittlePaimon/plugins/Paimon_Info/abyss_statistics.py @@ -13,17 +13,23 @@ from LittlePaimon.utils.message import MessageBuild async def get_user_avatar(user_id: str, size: Tuple[int, int] = (60, 60)): - img = await get_qq_avatar(user_id) - await img.resize(size) - await img.to_circle('circle') - return img + 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): - 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 + 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))