diff --git a/core/dependence/assets.py b/core/dependence/assets.py index e035b558..fed55f2f 100644 --- a/core/dependence/assets.py +++ b/core/dependence/assets.py @@ -392,6 +392,9 @@ class _NamecardAssets(_AssetsService): profile: ICON_TYPE """个人资料名片背景""" + NAME_CARD_DEFAULT: int = 210189 + """默认名片 ID""" + @cached_property def game_name(self) -> str: return NAMECARD_DATA[str(self.id)]["icon"] @@ -410,6 +413,8 @@ class _NamecardAssets(_AssetsService): raise ValueError(avatar_id) def __call__(self, target: int) -> "_NamecardAssets": + if target == 0: + target = self.NAME_CARD_DEFAULT result = _NamecardAssets(self.client) target = int(target) if not isinstance(target, int) else target if target > 10000000: diff --git a/plugins/genshin/avatar_list.py b/plugins/genshin/avatar_list.py index 9b820251..9b9cc5f6 100644 --- a/plugins/genshin/avatar_list.py +++ b/plugins/genshin/avatar_list.py @@ -151,7 +151,7 @@ class AvatarListPlugin(Plugin): except Exception as exc: # pylint: disable=W0703 logger.error("卡片信息请求失败 %s", str(exc)) if name_card is None: # 默认 - name_card = (await self.assets_service.namecard(210001).navbar()).as_uri() + name_card = (await self.assets_service.namecard(0).navbar()).as_uri() return name_card, avatar, nickname, rarity @handler.command("avatars", cookie=True, block=False) diff --git a/plugins/tools/player_info.py b/plugins/tools/player_info.py index 6a14b7f8..ee471705 100644 --- a/plugins/tools/player_info.py +++ b/plugins/tools/player_info.py @@ -43,7 +43,7 @@ class PlayerInfoSystem(Plugin): except Exception as exc: # pylint: disable=W0703 logger.error("卡片信息请求失败 %s", str(exc)) if name_card is None: # 默认 - name_card = (await self.assets_service.namecard(210001).navbar()).as_uri() + name_card = (await self.assets_service.namecard(0).navbar()).as_uri() return name_card, avatar, nickname, rarity async def get_name_card(self, player_id: int, user_id: int): @@ -56,5 +56,5 @@ class PlayerInfoSystem(Plugin): except Exception as exc: # pylint: disable=W0703 logger.error("卡片信息请求失败 %s", str(exc)) if name_card is None: # 默认 - name_card = (await self.assets_service.namecard(210001).navbar()).as_uri() + name_card = (await self.assets_service.namecard(0).navbar()).as_uri() return name_card