diff options
| author | Rapptz <[email protected]> | 2020-05-10 19:30:46 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2020-05-10 19:35:45 -0400 |
| commit | 13a3f760e6de8aa251f06bbe2a746e5f92deafd2 (patch) | |
| tree | 697c61b86c7dc9ecd272a2de59aba5783eceb60a /discord/gateway.py | |
| parent | allow passing color int to role.edit (diff) | |
| download | discord.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/gateway.py')
| -rw-r--r-- | discord/gateway.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/discord/gateway.py b/discord/gateway.py index 9b0f1d81..15368d56 100644 --- a/discord/gateway.py +++ b/discord/gateway.py @@ -535,15 +535,19 @@ class DiscordWebSocket(websockets.client.WebSocketClientProtocol): } await self.send_as_json(payload) - async def request_chunks(self, guild_id, query, limit): + async def request_chunks(self, guild_id, query, limit, *, nonce=None): payload = { 'op': self.REQUEST_MEMBERS, 'd': { - 'guild_id': str(guild_id), + 'guild_id': guild_id, 'query': query, 'limit': limit } } + + if nonce: + payload['d']['nonce'] = nonce + await self.send_as_json(payload) async def voice_state(self, guild_id, channel_id, self_mute=False, self_deaf=False): |