From 0303f7fb774789d3d5d389625b122eab8ed8d519 Mon Sep 17 00:00:00 2001 From: cynic Date: Tue, 1 Feb 2022 09:07:09 -0500 Subject: [PATCH 1/2] have you tried turning it off and on again --- client.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/client.py b/client.py index 8872151..b9028a7 100644 --- a/client.py +++ b/client.py @@ -53,7 +53,12 @@ class client(): self.user = res["d"]["user"] self.plugman.handle(res["t"], res["d"], self) def run(self): - asyncio.run(self.shit()) + while True: + try: + asyncio.run(self.shit()) + except websockets.exceptions.ConnectionClosedError: + pass + def get_channel(self, id): endpoint = f"https://discordapp.com/api/channels/{id}" headers = {"Authorization": "Bot {0}".format(self.config["token"]), "User-Agent": "mbdf (cynic.moe, v1)", "Content-Type": "application/json"} From 7c24860ad028cc15685c686a730dba216a850e82 Mon Sep 17 00:00:00 2001 From: cynic Date: Thu, 3 Feb 2022 09:44:51 -0500 Subject: [PATCH 2/2] cover /all/ websocket connection disconnects with a retry --- client.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/client.py b/client.py index b9028a7..ae4dac0 100644 --- a/client.py +++ b/client.py @@ -56,8 +56,12 @@ class client(): while True: try: asyncio.run(self.shit()) + except websockets.exceptions.ConnectionClosed: + pass except websockets.exceptions.ConnectionClosedError: pass + except websockets.exceptions.ConnectionClosedOK: + pass def get_channel(self, id): endpoint = f"https://discordapp.com/api/channels/{id}"