Skip to content

Commit 33f8bdf

Browse files
authored
fix: use int nonce for heartbeat instead of float for VoiceGateway (#1727)
Fixes #1726 VoiceGateway no longer accepts a string or a float in the heartbeat nonce and instead immediately disconnects the client with code 4020. Fixed send_heartbeat to use an uint64 instead of a float for the nonce.
1 parent ecf7b9e commit 33f8bdf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

interactions/api/voice/voice_gateway.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ def send_packet(self, data: bytes, encoder, needs_encode=True) -> None:
350350
self.timestamp += encoder.samples_per_frame
351351

352352
async def send_heartbeat(self) -> None:
353-
await self.send_json({"op": OP.HEARTBEAT, "d": random.uniform(0.0, 1.0)})
353+
await self.send_json({"op": OP.HEARTBEAT, "d": random.getrandbits(64)})
354354
self.logger.debug("❤ Voice Connection is sending Heartbeat")
355355

356356
async def _identify(self) -> None:

0 commit comments

Comments
 (0)