diff --git a/CHANGELOG.md b/CHANGELOG.md index a1a4edb7d3..c717c55347 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,9 @@ These changes are available on the `master` branch, but have not yet been releas - Fixed the type-hinting of `SlashCommandGroup.walk_commands()` to reflect actual behavior. ([#1852](https://github.com/Pycord-Development/pycord/pull/1852)) +- Fixed the voice ip discovery due to the recent + [announced change](https://discord.com/channels/613425648685547541/697138785317814292/1080623873629884486). + ([#1955](https://github.com/Pycord-Development/pycord/pull/1955)) ## [2.4.0] - 2023-02-10 diff --git a/discord/gateway.py b/discord/gateway.py index d337dda69f..bd13f22e46 100644 --- a/discord/gateway.py +++ b/discord/gateway.py @@ -892,16 +892,16 @@ async def initial_connection(self, data): state.voice_port = data["port"] state.endpoint_ip = data["ip"] - packet = bytearray(70) + packet = bytearray(74) struct.pack_into(">H", packet, 0, 1) # 1 = Send struct.pack_into(">H", packet, 2, 70) # 70 = Length struct.pack_into(">I", packet, 4, state.ssrc) state.socket.sendto(packet, (state.endpoint_ip, state.voice_port)) - recv = await self.loop.sock_recv(state.socket, 70) + recv = await self.loop.sock_recv(state.socket, 74) _log.debug("received packet in initial_connection: %s", recv) - # the ip is ascii starting at the 4th byte and ending at the first null - ip_start = 4 + # the ip is ascii starting at the 8th byte and ending at the first null + ip_start = 8 ip_end = recv.index(0, ip_start) state.ip = recv[ip_start:ip_end].decode("ascii")