From 13a3f760e6de8aa251f06bbe2a746e5f92deafd2 Mon Sep 17 00:00:00 2001 From: Rapptz Date: Sun, 10 May 2020 19:30:46 -0400 Subject: Fix timeout issues with fetching members via query_members This uses the nonce field to properly disambiguate queries. There's also some redesigning going on behind the scenes and minor clean-up. Originally I planned on working on this more to account for the more widespread chunking changes planned for gateway v7 but I realized that this would indiscriminately slow down everyone else who isn't planning on working with intents for now. I will work on the larger chunking changes in the future, should time allow for it. --- discord/client.py | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) (limited to 'discord/client.py') diff --git a/discord/client.py b/discord/client.py index f292c9d2..03845fd1 100644 --- a/discord/client.py +++ b/discord/client.py @@ -223,13 +223,13 @@ class Client: 'ready': self._handle_ready } - self._connection = ConnectionState(dispatch=self.dispatch, chunker=self._chunker, handlers=self._handlers, + self._connection = ConnectionState(dispatch=self.dispatch, handlers=self._handlers, syncer=self._syncer, http=self.http, loop=self.loop, **options) self._connection.shard_count = self.shard_count self._closed = False self._ready = asyncio.Event() - self._connection._get_websocket = lambda g: self.ws + self._connection._get_websocket = self._get_websocket if VoiceClient.warn_nacl: VoiceClient.warn_nacl = False @@ -237,26 +237,12 @@ class Client: # internals + def _get_websocket(self, guild_id=None, *, shard_id=None): + return self.ws + async def _syncer(self, guilds): await self.ws.request_sync(guilds) - async def _chunker(self, guild): - try: - guild_id = guild.id - except AttributeError: - guild_id = [s.id for s in guild] - - payload = { - 'op': 8, - 'd': { - 'guild_id': guild_id, - 'query': '', - 'limit': 0 - } - } - - await self.ws.send_as_json(payload) - def _handle_ready(self): self._ready.set() -- cgit v1.2.3