Rewrite chunking to work with intents.

This slows down chunking significantly for bots in a large number of
guilds since it goes down from 75 guilds/request to 1 guild/request.
However the logic was rewritten to fire the chunking request
immediately after receiving the GUILD_CREATE rather than waiting for
all the guilds in the ready stream before doing it.
This commit is contained in:
Rapptz
2020-09-04 08:09:41 -04:00
parent ec7b8edcc2
commit 930761e058
3 changed files with 91 additions and 174 deletions

View File

@ -370,7 +370,7 @@ class DiscordWebSocket:
}
if state._intents is not None:
payload['d']['intents'] = state._intents
payload['d']['intents'] = state._intents.value
await self.call_hooks('before_identify', self.shard_id, initial=self._initial_identify)
await self.send_as_json(payload)