fix: Catch-All-Phase erkennt Button-Klicks (ONBOARD:<rid>::<emoji>)

- Button-Payload wird geparst: Raum-ID extrahiert, Catch-All gesetzt
- Überspringen-Button erkannt (⏭️ / "Überspringen" / "ONBOARD")
- Text-Eingabe (Ziffern/überspringen) weiterhin unterstützt als Fallback
This commit is contained in:
Bernd (Hermes)
2026-07-14 13:01:28 +02:00
parent af970a3c9f
commit 8e22af952a
+34 -1
View File
@@ -1987,7 +1987,40 @@ class RocketChatAdapter(BasePlatformAdapter):
# ── Phase: catch_all_change (nach Abschluss aller Interviews) ──── # ── Phase: catch_all_change (nach Abschluss aller Interviews) ────
if state.get("phase") == "catch_all_change": if state.get("phase") == "catch_all_change":
single_line = text.strip() single_line = text.strip()
if single_line.isdigit():
# Button-Klick erkennen: ONBOARD:<room_id>::<emoji>
if single_line.startswith("ONBOARD:"):
parts = single_line.split("::", 1)
payload = parts[0].replace("ONBOARD:", "") # room_id or "ONBOARD"
button_label = parts[1] if len(parts) > 1 else ""
# Überspringen-Button
if "Überspringen" in button_label or "⏭️" in button_label or payload == "ONBOARD":
await self._post_message_with_retry(operator_room_id, "👍 Catch-All bleibt unverändert.")
logger.info("[rocketchat] Catch-All unverändert (Button: Überspringen)")
else:
# Raum-Button → room_id als Catch-All setzen
all_rooms = self._get_onboarding_room_list()
dm_room_id = state.get("operator_room_id", "")
# Raum anhand ID finden
room_name = None
for rid, name, is_catch in all_rooms:
if rid == payload:
room_name = name
if rid == dm_room_id:
await self._post_message_with_retry(operator_room_id,
f"👍 {name} ist bereits der Catch-All-Raum — bleibt unverändert.")
logger.info("[rocketchat] Catch-All bleibt DM (kein Wechsel nötig)")
else:
self._set_catch_all(rid)
await self._post_message_with_retry(operator_room_id,
f"🎯 {name} ist jetzt der Catch-All-Raum.")
logger.info("[rocketchat] Catch-All geändert zu: %s (Button)", name)
break
if room_name is None:
await self._post_message_with_retry(operator_room_id, "❌ Raum nicht gefunden. Bitte erneut versuchen.")
return
elif single_line.isdigit():
index = int(single_line) - 1 index = int(single_line) - 1
all_rooms = self._get_onboarding_room_list() all_rooms = self._get_onboarding_room_list()
if 0 <= index < len(all_rooms): if 0 <= index < len(all_rooms):