Browse Source

carry over the seq_ack when resuming

pull/10210/head
DA-344 4 weeks ago
parent
commit
398bdbecd9
  1. 2
      discord/gateway.py
  2. 5
      discord/voice_state.py

2
discord/gateway.py

@ -883,6 +883,7 @@ class DiscordVoiceWebSocket:
*,
resume: bool = False,
hook: Optional[Callable[..., Coroutine[Any, Any, Any]]] = None,
seq_ack: int = -1,
) -> Self:
"""Creates a voice websocket for the :class:`VoiceClient`."""
gateway = f'wss://{state.endpoint}/?v=8'
@ -891,6 +892,7 @@ class DiscordVoiceWebSocket:
socket = await http.ws_connect(gateway, compress=15)
ws = cls(socket, loop=client.loop, hook=hook)
ws.gateway = gateway
ws.seq_ack = seq_ack
ws._connection = state
ws._max_heartbeat_timeout = 60.0
ws.thread_id = threading.get_ident()

5
discord/voice_state.py

@ -574,7 +574,10 @@ class VoiceConnectionState:
self._disconnected.clear()
async def _connect_websocket(self, resume: bool) -> DiscordVoiceWebSocket:
ws = await DiscordVoiceWebSocket.from_connection_state(self, resume=resume, hook=self.hook)
seq_ack = -1
if self.ws is not MISSING:
seq_ack = self.ws.seq_ack
ws = await DiscordVoiceWebSocket.from_connection_state(self, resume=resume, hook=self.hook, seq_ack=seq_ack)
self.state = ConnectionFlowState.websocket_connected
return ws

Loading…
Cancel
Save