🐛 当解析旅行者数据错误时、跳过旅行者

Signed-off-by: Karako <karakohear@gmail.com>
This commit is contained in:
Karako 2022-10-16 20:57:35 +08:00
parent 3b1a46837d
commit cf7012bed0
No known key found for this signature in database
GPG Key ID: 5920831B0095D4A0

View File

@ -66,7 +66,14 @@ class AvatarListPlugin(Plugin, BasePlugin):
for num, character in enumerate(characters): for num, character in enumerate(characters):
if num == max_length: # 若已经有 max_length 个角色 if num == max_length: # 若已经有 max_length 个角色
break break
detail = await client.get_character_details(character) try:
detail = await client.get_character_details(character)
except Exception as e: # pylint: disable=W0703
if character.name == "旅行者":
logger.debug(f"解析旅行者数据时遇到了错误:{e}")
continue
else:
raise e
if character.id == 10000005: # 针对男草主 if character.id == 10000005: # 针对男草主
talents = [] talents = []
for talent in detail.talents: for talent in detail.talents:
@ -202,5 +209,5 @@ class AvatarData(Model):
avatar: Character avatar: Character
detail: CalculatorCharacterDetails detail: CalculatorCharacterDetails
icon: str icon: str
weapon: str weapon: Optional[str]
skills: Iterable[SkillData] skills: Iterable[SkillData]