From 2bf612cd67190fca202258e89c0b6b6d4dbeb6f4 Mon Sep 17 00:00:00 2001 From: Rapptz Date: Tue, 15 Mar 2022 06:51:19 -0400 Subject: [PATCH] Fix Client.close erroring if done before proper async initialisation --- discord/client.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/discord/client.py b/discord/client.py index 682547a8e..9d972b9df 100644 --- a/discord/client.py +++ b/discord/client.py @@ -627,7 +627,10 @@ class Client: await self.ws.close(code=1000) await self.http.close() - self._ready.clear() + + if self._ready is not MISSING: + self._ready.clear() + self.loop = MISSING def clear(self) -> None: