From 2da69d3d5eb37fc74f01179489932e0dc79903a7 Mon Sep 17 00:00:00 2001 From: xtaodada Date: Sun, 9 Oct 2022 12:49:41 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20=E6=8A=BD=E5=8D=A1=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E5=AF=BC=E5=85=A5=E9=AA=8C=E8=AF=81=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- metadata/shortname.py | 2 +- modules/apihelper/gacha_log.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/metadata/shortname.py b/metadata/shortname.py index d0faf42e..4936848c 100644 --- a/metadata/shortname.py +++ b/metadata/shortname.py @@ -100,7 +100,7 @@ roles = { 10000073: ['纳西妲', 'Nahida', 'nahida', '草王', '草神', '小吉祥草王', '草萝莉', '纳西坦'], 10000074: ['莱依拉', 'Layla', 'layla', '拉一拉'], } -not_real_roles = ["纳西妲", "莱依拉"] +not_real_roles = [10000073, 10000074] weapons = { "磐岩结绿": ["绿箭", "绿剑"], "斫峰之刃": ["斫峰", "盾剑"], diff --git a/modules/apihelper/gacha_log.py b/modules/apihelper/gacha_log.py index daa77bfd..3559b371 100644 --- a/modules/apihelper/gacha_log.py +++ b/modules/apihelper/gacha_log.py @@ -56,8 +56,9 @@ class GachaItem(BaseModel): @validator("name") def name_validator(cls, v): - if (roleToId(v) or weaponToId(v)) and v not in not_real_roles: - return v + if item_id := (roleToId(v) or weaponToId(v)): + if item_id not in not_real_roles: + return v raise ValueError("Invalid name") @validator("gacha_type")