aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRapptz <[email protected]>2016-12-16 18:08:12 -0500
committerRapptz <[email protected]>2016-12-16 18:29:29 -0500
commit6306fc08dbbba32df86b650b44e94d667457e2c8 (patch)
treedc6976961f6e6b314dc073a5660cd66c6e057e55
parent[commands] Run global checks in help formatter. (diff)
downloaddiscord.py-6306fc08dbbba32df86b650b44e94d667457e2c8.tar.xz
discord.py-6306fc08dbbba32df86b650b44e94d667457e2c8.zip
Discard null sequences in the gateway.
This was forbidding the Discord gateway from allowing us to RESUME properly, causing an over-abundance of READY being called.
-rw-r--r--discord/gateway.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/discord/gateway.py b/discord/gateway.py
index 297c6cde..415eed41 100644
--- a/discord/gateway.py
+++ b/discord/gateway.py
@@ -186,7 +186,7 @@ class DiscordWebSocket(websockets.client.WebSocketClientProtocol):
log.info('Created websocket connected to {}'.format(gateway))
- # poll the event for OP HELLO
+ # poll event for OP Hello
yield from ws.poll_event()
if not resume:
@@ -289,9 +289,9 @@ class DiscordWebSocket(websockets.client.WebSocketClientProtocol):
op = msg.get('op')
data = msg.get('d')
-
- if 's' in msg:
- state.sequence = msg['s']
+ seq = msg.get('s')
+ if seq is not None:
+ state.sequence = seq
if op == self.RECONNECT:
# "reconnect" can only be handled by the Client