Add chunk_guilds_at_startup and deprecate fetch_offline_members

This commit is contained in:
Rapptz
2020-09-24 01:17:04 -04:00
parent 2974663367
commit 005a80303f
3 changed files with 34 additions and 16 deletions

View File

@ -295,10 +295,6 @@ class AutoShardedClient(Client):
elif not isinstance(self.shard_ids, (list, tuple)):
raise ClientException('shard_ids parameter must be a list or a tuple.')
self._connection = AutoShardedConnectionState(dispatch=self.dispatch,
handlers=self._handlers, syncer=self._syncer,
hooks=self._hooks, http=self.http, loop=self.loop, **kwargs)
# instead of a single websocket, we have multiple
# the key is the shard_id
self.__shards = {}
@ -311,6 +307,11 @@ class AutoShardedClient(Client):
shard_id = (guild_id >> 22) % self.shard_count
return self.__shards[shard_id].ws
def _get_state(self, **options):
return AutoShardedConnectionState(dispatch=self.dispatch,
handlers=self._handlers, syncer=self._syncer,
hooks=self._hooks, http=self.http, loop=self.loop, **options)
@property
def latency(self):
""":class:`float`: Measures latency between a HEARTBEAT and a HEARTBEAT_ACK in seconds.