From 27216892547bb073777056379d549a6dc42872cb Mon Sep 17 00:00:00 2001 From: Rapptz Date: Mon, 24 Sep 2018 23:22:49 -0400 Subject: Optimise tight loops in DiscordGateway.received_message * type(x) is y is faster than isinstance(x, y) * Re-arrange if-statements for common statements * Drop handler getattr for most events that don't use it --- discord/shard.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'discord/shard.py') diff --git a/discord/shard.py b/discord/shard.py index 55600e56..d0da4151 100644 --- a/discord/shard.py +++ b/discord/shard.py @@ -124,7 +124,8 @@ class AutoShardedClient(Client): raise ClientException('shard_ids parameter must be a list or a tuple.') self._connection = AutoShardedConnectionState(dispatch=self.dispatch, chunker=self._chunker, - syncer=self._syncer, http=self.http, loop=self.loop, **kwargs) + handlers=self._handlers, syncer=self._syncer, + http=self.http, loop=self.loop, **kwargs) # instead of a single websocket, we have multiple # the key is the shard_id -- cgit v1.2.3