fix(identity): validate persistent character pairs

This commit is contained in:
nyan404 committed 2026-08-25 04:07:51 +03:00
1 parent 0aec421ad2
commit 6af34d4706
8 files changed
+44 -1

No files matched your search

+4 -1
View File
@@ -115,7 +115,10 @@ def _person(value: str) -> tuple[str, int]:
match = _PERSON_RE.fullmatch(value)
if not match:
raise ValueError("Укажите имя и ID в формате Имя [12345]")
return match.group("name").strip(), int(match.group("id"))
character_id = int(match.group("id"))
if character_id <= 0:
raise ValueError("ID персонажа должен быть положительным числом")
return match.group("name").strip(), character_id
def _natural_people(text: str) -> tuple[list[tuple[str, int]], list[tuple[str, int]], list[tuple[str, int]]]: