aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRapptz <[email protected]>2020-09-09 21:18:41 -0400
committerRapptz <[email protected]>2020-09-09 21:18:41 -0400
commitf8808dba9b9039bba769a94547080a303dbcfc4e (patch)
treee9c4455f607856d6871468de799a0af8ff2ede02
parentHandle cloudflare bans on webhook requests (diff)
downloaddiscord.py-f8808dba9b9039bba769a94547080a303dbcfc4e.tar.xz
discord.py-f8808dba9b9039bba769a94547080a303dbcfc4e.zip
Guard uses of the keep alive thread in case they're None
Fixes #5800
-rw-r--r--discord/gateway.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/discord/gateway.py b/discord/gateway.py
index a4a39186..81ff69b8 100644
--- a/discord/gateway.py
+++ b/discord/gateway.py
@@ -398,12 +398,14 @@ class DiscordWebSocket:
raise ReconnectWebSocket(self.shard_id)
if op == self.HEARTBEAT_ACK:
- self._keep_alive.ack()
+ if self._keep_alive:
+ self._keep_alive.ack()
return
if op == self.HEARTBEAT:
- beat = self._keep_alive.get_payload()
- await self.send_as_json(beat)
+ if self._keep_alive:
+ beat = self._keep_alive.get_payload()
+ await self.send_as_json(beat)
return
if op == self.HELLO: