Browse Source

handle matrix timeouts

subDesTagesMitExtraKaese 10 months ago
parent
commit
f9d7f83ac9
1 changed files with 8 additions and 1 deletions
  1. 8 1
      main.py

+ 8 - 1
main.py

@@ -1,6 +1,8 @@
 #!/usr/bin/env python3
 #!/usr/bin/env python3
 from urllib.parse import urlparse
 from urllib.parse import urlparse
 import os
 import os
+import time
+import asyncio
 
 
 import simplematrixbotlib as botlib
 import simplematrixbotlib as botlib
 import nio
 import nio
@@ -82,4 +84,9 @@ async def on_message(room, event):
 
 
 if __name__ == "__main__":
 if __name__ == "__main__":
   asr.load_model()
   asr.load_model()
-  bot.run()
+  try:
+    bot.run()
+  except asyncio.exceptions.TimeoutError as e:
+    print(e)
+    print("Timeout, restarting...")
+    time.sleep(5)