mirror of https://gitlab.com/litecord/litecord.git
gateway: allow nullable seq but invalidate if received
This commit is contained in:
parent
a2f892192d
commit
ae5c0bd0e3
|
|
@ -121,7 +121,7 @@ RESUME_SCHEMA = {
|
||||||
"schema": {
|
"schema": {
|
||||||
"token": {"type": "string", "required": True},
|
"token": {"type": "string", "required": True},
|
||||||
"session_id": {"type": "string", "required": True},
|
"session_id": {"type": "string", "required": True},
|
||||||
"seq": {"type": "number", "required": True},
|
"seq": {"type": "number", "required": True, "nullable": True},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -958,6 +958,12 @@ class GatewayWebsocket:
|
||||||
async def handle_6(self, payload: Dict[str, Any]):
|
async def handle_6(self, payload: Dict[str, Any]):
|
||||||
"""Handle OP 6 Resume."""
|
"""Handle OP 6 Resume."""
|
||||||
payload = validate(payload, RESUME_SCHEMA)
|
payload = validate(payload, RESUME_SCHEMA)
|
||||||
|
|
||||||
|
# HACK: this is a hack for discord.js that attempts to resume
|
||||||
|
# with a null sequence.
|
||||||
|
if data["seq"] is None:
|
||||||
|
return await self.invalidate_session(False)
|
||||||
|
|
||||||
data = payload["d"]
|
data = payload["d"]
|
||||||
token, sess_id, seq = data["token"], data["session_id"], data["seq"]
|
token, sess_id, seq = data["token"], data["session_id"], data["seq"]
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue