🐛 Fix playcard data get invalid key

This commit is contained in:
xtaodada 2023-12-07 15:09:34 +08:00
parent dc32f88f84
commit bc8d0f8244
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659

View File

@ -68,7 +68,7 @@ class PlayerCardsFile:
if old_data is None: if old_data is None:
await self.save_json(self.get_file_path(uid), data) await self.save_json(self.get_file_path(uid), data)
return data return data
data["avatarInfoList"] = data.get("avatars") or [] data["avatarInfoList"] = data.get("avatarInfoList") or []
characters = [i.get("avatarId", 0) for i in data["avatarInfoList"]] characters = [i.get("avatarId", 0) for i in data["avatarInfoList"]]
for i in old_data["avatarInfoList"]: for i in old_data["avatarInfoList"]:
if i.get("avatarId", 0) not in characters: if i.get("avatarId", 0) not in characters: