mirror of
https://github.com/PaiGramTeam/PaiGram.git
synced 2024-11-16 04:35:49 +00:00
🎨 抽卡记录导入验证数据
This commit is contained in:
parent
b8c30768a6
commit
2da69d3d5e
@ -100,7 +100,7 @@ roles = {
|
|||||||
10000073: ['纳西妲', 'Nahida', 'nahida', '草王', '草神', '小吉祥草王', '草萝莉', '纳西坦'],
|
10000073: ['纳西妲', 'Nahida', 'nahida', '草王', '草神', '小吉祥草王', '草萝莉', '纳西坦'],
|
||||||
10000074: ['莱依拉', 'Layla', 'layla', '拉一拉'],
|
10000074: ['莱依拉', 'Layla', 'layla', '拉一拉'],
|
||||||
}
|
}
|
||||||
not_real_roles = ["纳西妲", "莱依拉"]
|
not_real_roles = [10000073, 10000074]
|
||||||
weapons = {
|
weapons = {
|
||||||
"磐岩结绿": ["绿箭", "绿剑"],
|
"磐岩结绿": ["绿箭", "绿剑"],
|
||||||
"斫峰之刃": ["斫峰", "盾剑"],
|
"斫峰之刃": ["斫峰", "盾剑"],
|
||||||
|
@ -56,8 +56,9 @@ class GachaItem(BaseModel):
|
|||||||
|
|
||||||
@validator("name")
|
@validator("name")
|
||||||
def name_validator(cls, v):
|
def name_validator(cls, v):
|
||||||
if (roleToId(v) or weaponToId(v)) and v not in not_real_roles:
|
if item_id := (roleToId(v) or weaponToId(v)):
|
||||||
return v
|
if item_id not in not_real_roles:
|
||||||
|
return v
|
||||||
raise ValueError("Invalid name")
|
raise ValueError("Invalid name")
|
||||||
|
|
||||||
@validator("gacha_type")
|
@validator("gacha_type")
|
||||||
|
Loading…
Reference in New Issue
Block a user