fix: reconnect re-waits for chat; fallback to chat list on join lobby

This commit is contained in:
Oliver Hofmann 2026-05-17 13:23:49 +02:00
parent 2fee448e0b
commit 98274d0917
2 changed files with 20 additions and 6 deletions

18
main.py
View File

@ -90,7 +90,6 @@ def main():
if meeting_url:
print("Navigiere zur Meeting-URL...")
page.goto(meeting_url)
# Check whether we landed on a chat/channel (good) or join lobby (fallback)
try:
page.wait_for_selector(
"[data-tid='channel-pane-message'], [data-tid='chat-pane-message']",
@ -98,11 +97,22 @@ def main():
)
print("Chat direkt erreicht.")
except Exception:
print("Join-Lobby erkannt — bitte im Browser-Fenster zum Chat navigieren:")
print(" Linke Sidebar → Chat oder Kanal → laufendes Meeting\n")
# Join-Lobby or redirect — try navigating to Teams chat list instead.
# The meeting chat is accessible from Chat sidebar without joining the call.
print("Join-Lobby erkannt — navigiere zur Chat-Übersicht...")
page.goto(TEAMS_URL + "/#/conversations/")
try:
page.wait_for_selector(
"[data-tid='channel-pane-message'], [data-tid='chat-pane-message']",
timeout=5000,
)
print("Chat erkannt.")
except Exception:
print("Bitte im Browser-Fenster zum laufenden Meeting-Chat navigieren:")
print(" Linke Sidebar → Chat → laufendes Meeting anklicken\n")
else:
print("\nBitte im Browser-Fenster zum Meeting-Chat navigieren:")
print(" Linke Sidebar → Chat oder Kanal → laufendes Meeting\n")
print(" Linke Sidebar → Chat → laufendes Meeting anklicken\n")
print("\nPoste '!start Name' im Chat um zu beginnen.\n")

View File

@ -149,9 +149,13 @@ class Monitor:
while True:
try:
new_msgs = self.poll_new_messages()
except Exception:
print("Verbindung verloren, reconnecting...")
except Exception as e:
print(f"Verbindung verloren ({type(e).__name__}: {e!s:.120}), warte auf Chat...")
time.sleep(2)
try:
self.wait_for_chat()
except Exception:
pass
continue
for msg in new_msgs: