Fixes for dialoge
This commit is contained in:
1 parent
b1f47a5c18
commit
6db39f0d51
3 files changed
+27
-11
No files matched your search
+16
-8
@@ -605,8 +605,10 @@ class BelkiDialog:
|
||||
return "Похоже, здесь данные для ЛУ или ЗУ. Укажите навык: ЛУ или ЗУ."
|
||||
return None
|
||||
if command.lower() in ("/лу", "/зу"):
|
||||
self._states[peer_id] = {"mode": "coaching", "skill": "ЛУ" if command.lower() == "/лу" else "ЗУ"}
|
||||
return self._ask_next(self._states[peer_id])
|
||||
state = {"mode": "coaching", "skill": "ЛУ" if command.lower() == "/лу" else "ЗУ"}
|
||||
self._apply_known_profile(peer_id, state)
|
||||
self._states[peer_id] = state
|
||||
return self._ask_next(state)
|
||||
if command.lower().startswith(("/лу ", "/лазание ", "/зу ", "/зоркость ")):
|
||||
try:
|
||||
parsed = parse_text_command(command)
|
||||
@@ -621,8 +623,10 @@ class BelkiDialog:
|
||||
self._states[peer_id] = {**parsed, "awaiting_attachments": True}
|
||||
return "Пришлите сюда скриншоты для этого отчёта. После загрузки всех фотографий нажмите «Готово»."
|
||||
if command.lower() in ("/урок", "/тренировка"):
|
||||
self._states[peer_id] = {"mode": "training"}
|
||||
return self._ask_next(self._states[peer_id])
|
||||
state = {"mode": "training"}
|
||||
self._apply_known_profile(peer_id, state)
|
||||
self._states[peer_id] = state
|
||||
return self._ask_next(state)
|
||||
if command.lower() in ("/осмотр", "/осмотры"):
|
||||
state = {"mode": "inspection"}
|
||||
self._apply_known_profile(peer_id, state)
|
||||
@@ -639,11 +643,15 @@ class BelkiDialog:
|
||||
return None
|
||||
|
||||
def _apply_known_profile(self, actor_id: int, state: dict[str, Any]) -> None:
|
||||
"""Use the author's saved character for self-referential inspections."""
|
||||
if state.get("mode") != "inspection" or self._has_field(state, "character"):
|
||||
return
|
||||
"""Use the author's saved character as the default report participant."""
|
||||
profile = self.identity_directory.profile(actor_id=actor_id)
|
||||
if profile:
|
||||
if not profile:
|
||||
return
|
||||
if state.get("mode") in ("coaching", "training") and not self._has_field(state, "escort"):
|
||||
state["escort_name"] = profile.name
|
||||
state["escort_id"] = profile.character_id
|
||||
state["escort"] = True
|
||||
elif state.get("mode") == "inspection" and not self._has_field(state, "character"):
|
||||
state["character_name"] = profile.name
|
||||
state["character_id"] = profile.character_id
|
||||
|
||||
|
||||
Reference in new issue
Block a user