diff --git a/BlueArchiveUID/bauid_guide/get_char.py b/BlueArchiveUID/bauid_guide/get_char.py index 764f88a..019066f 100644 --- a/BlueArchiveUID/bauid_guide/get_char.py +++ b/BlueArchiveUID/bauid_guide/get_char.py @@ -13,6 +13,10 @@ async def get_hehedi_char_img(name: str) -> Optional[str]: name = alias_to_char_name(name) + return await _get_hehedi_char_img(name) + + +async def _get_hehedi_char_img(name: str) -> Optional[str]: path = HEHEDI_CHAR_GUIDE_PATH / f'{name}.jpg' if path.exists(): return await convert_img(path) diff --git a/BlueArchiveUID/bauid_info/draw_user_info_pic.py b/BlueArchiveUID/bauid_info/draw_user_info_pic.py index 9778d07..8e69301 100644 --- a/BlueArchiveUID/bauid_info/draw_user_info_pic.py +++ b/BlueArchiveUID/bauid_info/draw_user_info_pic.py @@ -3,6 +3,7 @@ from PIL import Image, ImageDraw from gsuid_core.models import Event +from gsuid_core.utils.cache import gs_cache from gsuid_core.utils.image.convert import convert_img from gsuid_core.utils.fonts.fonts import core_font as cf from gsuid_core.utils.image.image_tools import ( @@ -158,6 +159,7 @@ def get_bg(w: int, h: int): return img +@gs_cache() async def draw_user_info_img( _fcode: str, ev: Event, user_id: str ) -> Union[str, bytes]: diff --git a/BlueArchiveUID/bauid_ranklist/draw_rank_pic.py b/BlueArchiveUID/bauid_ranklist/draw_rank_pic.py index 4d4f8cc..71e5ebb 100644 --- a/BlueArchiveUID/bauid_ranklist/draw_rank_pic.py +++ b/BlueArchiveUID/bauid_ranklist/draw_rank_pic.py @@ -2,6 +2,7 @@ from typing import Union from PIL import Image, ImageDraw +from gsuid_core.utils.cache import gs_cache from gsuid_core.utils.image.convert import convert_img from gsuid_core.utils.fonts.fonts import core_font as cf @@ -27,6 +28,11 @@ def get_color(rank_key: int): async def draw_rank_pic(student: str) -> Union[bytes, str]: student_id = student_name_to_id(student) + return await _draw_rank_pic(student_id) + + +@gs_cache() +async def _draw_rank_pic(student_id: str) -> Union[bytes, str]: if student_id == '9999': return '要查询的角色不存在或别名未收录, 请尝试使用完整名字。'