🐛 Fix KeyError in abyss_team

This commit is contained in:
xtaodada 2023-10-19 22:47:06 +08:00 committed by 洛水居室
parent 055740edc1
commit ab99b3fe92
No known key found for this signature in database
GPG Key ID: C9DE87DA724B88FC
2 changed files with 3 additions and 3 deletions

View File

@ -761,9 +761,9 @@ def roleToId(name: str) -> int | None:
# noinspection PyPep8Naming # noinspection PyPep8Naming
@functools.lru_cache() @functools.lru_cache()
def idToName(id: int) -> str | None: def idToName(cid: int) -> str | None:
"""从角色ID获取正式名""" """从角色ID获取正式名"""
return roles[id][0] if id in roles else None return roles[cid][0] if cid in roles else None
# noinspection PyPep8Naming # noinspection PyPep8Naming

View File

@ -100,7 +100,7 @@ class AbyssTeamPlugin(Plugin):
{ {
"icon": (await self.assets_service.avatar(cid).icon()).as_uri(), "icon": (await self.assets_service.avatar(cid).icon()).as_uri(),
"name": idToName(cid), "name": idToName(cid),
"star": AVATAR_DATA[str(cid)]["rank"], "star": AVATAR_DATA[str(cid)]["rank"] if cid not in {10000005, 10000007} else 5,
"hava": True, "hava": True,
} }
for cid in id_list for cid in id_list