diff --git a/gsuid_core/utils/image/image_tools.py b/gsuid_core/utils/image/image_tools.py index e1423f8..609b565 100644 --- a/gsuid_core/utils/image/image_tools.py +++ b/gsuid_core/utils/image/image_tools.py @@ -114,6 +114,8 @@ async def get_event_avatar( if img is None and ev.bot_id == 'onebot' and not ev.sender: img = await get_qq_avatar(ev.user_id) + elif img is None and ev.bot_id == 'qqgroup': + img = await get_qqgroup_avatar(ev.bot_self_id, ev.user_id) if img is None and avatar_path: pic_path_list = list(avatar_path.iterdir()) @@ -331,6 +333,20 @@ async def get_qq_avatar( return char_pic +async def get_qqgroup_avatar( + bot_id: Optional[Union[int, str]] = None, + qid: Optional[Union[int, str]] = None, + avatar_url: Optional[str] = None, +) -> Image.Image: + if not qid or not bot_id: + return None + avatar_url = f'https://q.qlogo.cn/qqapp/{bot_id}/{qid}/100' + char_pic = Image.open(BytesIO((await sget(avatar_url)).content)).convert( + 'RGBA' + ) + return char_pic + + async def draw_pic_with_ring( pic: Image.Image, size: int,