material in prank

This commit is contained in:
aurinex
2025-12-29 13:28:36 +05:00
parent 99d9741e97
commit 3b4e3d85ed
2 changed files with 8 additions and 1 deletions

View File

@ -5,12 +5,12 @@ class PrankCommandCreate(BaseModel):
name: str name: str
description: str description: str
price: int price: int
material: str
command_template: str command_template: str
server_ids: List[str] = Field( server_ids: List[str] = Field(
default=[], default=[],
description='Список серверов, где доступна команда. Использование ["*"] означает доступность на всех серверах' description='Список серверов, где доступна команда. Использование ["*"] означает доступность на всех серверах'
) )
material: str
targetDescription: Optional[str] = None # Сообщение для целевого игрока targetDescription: Optional[str] = None # Сообщение для целевого игрока
globalDescription: Optional[str] = None # Сообщение для всех остальных globalDescription: Optional[str] = None # Сообщение для всех остальных
@ -18,6 +18,7 @@ class PrankCommandUpdate(BaseModel):
name: Optional[str] = None name: Optional[str] = None
description: Optional[str] = None description: Optional[str] = None
price: Optional[int] = None price: Optional[int] = None
material: Optional[str] = None
command_template: Optional[str] = None command_template: Optional[str] = None
server_ids: Optional[List[str]] = None server_ids: Optional[List[str]] = None
targetDescription: Optional[str] = None targetDescription: Optional[str] = None
@ -29,6 +30,7 @@ class PrankCommand(BaseModel):
description: str description: str
price: int price: int
command_template: str command_template: str
material: str
server_ids: List[str] = [] server_ids: List[str] = []
class PrankExecute(BaseModel): class PrankExecute(BaseModel):

View File

@ -27,6 +27,7 @@ class PrankService:
"name": command_data.name, "name": command_data.name,
"description": command_data.description, "description": command_data.description,
"price": command_data.price, "price": command_data.price,
"material": command_data.get("material"),
"command_template": command_data.command_template, "command_template": command_data.command_template,
"server_ids": command_data.server_ids, "server_ids": command_data.server_ids,
"targetDescription": command_data.targetDescription, "targetDescription": command_data.targetDescription,
@ -49,6 +50,7 @@ class PrankService:
"name": cmd["name"], "name": cmd["name"],
"description": cmd["description"], "description": cmd["description"],
"price": cmd["price"], "price": cmd["price"],
"material": cmd.get("material"),
"command_template": cmd["command_template"], "command_template": cmd["command_template"],
"server_ids": cmd.get("server_ids", []), "server_ids": cmd.get("server_ids", []),
"targetDescription": cmd.get("targetDescription"), "targetDescription": cmd.get("targetDescription"),
@ -68,6 +70,7 @@ class PrankService:
"name": command["name"], "name": command["name"],
"description": command["description"], "description": command["description"],
"price": command["price"], "price": command["price"],
"material": command.get("material"),
"command_template": command["command_template"], "command_template": command["command_template"],
"server_ids": command.get("server_ids", []), "server_ids": command.get("server_ids", []),
"targetDescription": command.get("targetDescription"), "targetDescription": command.get("targetDescription"),
@ -88,6 +91,8 @@ class PrankService:
update["description"] = update_data.description update["description"] = update_data.description
if update_data.price is not None: if update_data.price is not None:
update["price"] = update_data.price update["price"] = update_data.price
if update_data.material is not None:
update["material"] = update_data.material
if update_data.command_template is not None: if update_data.command_template is not None:
if "{targetPlayer}" not in update_data.command_template: if "{targetPlayer}" not in update_data.command_template:
raise HTTPException(status_code=400, raise HTTPException(status_code=400,