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.
This commit is contained in:
@ -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):
|
||||
|
Reference in New Issue
Block a user