diff --git a/plugin/adapter.py b/plugin/adapter.py index f22e6f8..90a1a9d 100644 --- a/plugin/adapter.py +++ b/plugin/adapter.py @@ -1987,7 +1987,40 @@ class RocketChatAdapter(BasePlatformAdapter): # ── Phase: catch_all_change (nach Abschluss aller Interviews) ──── if state.get("phase") == "catch_all_change": single_line = text.strip() - if single_line.isdigit(): + + # Button-Klick erkennen: ONBOARD::: + 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 all_rooms = self._get_onboarding_room_list() if 0 <= index < len(all_rooms):