aboutsummaryrefslogtreecommitdiff
path: root/discord/client.py
diff options
context:
space:
mode:
authorRapptz <[email protected]>2020-05-10 19:30:46 -0400
committerRapptz <[email protected]>2020-05-10 19:35:45 -0400
commit13a3f760e6de8aa251f06bbe2a746e5f92deafd2 (patch)
tree697c61b86c7dc9ecd272a2de59aba5783eceb60a /discord/client.py
parentallow passing color int to role.edit (diff)
downloaddiscord.py-13a3f760e6de8aa251f06bbe2a746e5f92deafd2.tar.xz
discord.py-13a3f760e6de8aa251f06bbe2a746e5f92deafd2.zip
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.
Diffstat (limited to 'discord/client.py')
-rw-r--r--discord/client.py24
1 files changed, 5 insertions, 19 deletions
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()