diff options
| author | Rapptz <[email protected]> | 2017-05-16 20:20:39 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2017-05-16 20:20:39 -0400 |
| commit | df90aaa610a20728435dbb402b67ec860a9ebe1c (patch) | |
| tree | 03dafa18e552b122884cd8bd319988b8a8de00a9 /discord/shard.py | |
| parent | Highlight currently visited section. (diff) | |
| download | discord.py-df90aaa610a20728435dbb402b67ec860a9ebe1c.tar.xz discord.py-df90aaa610a20728435dbb402b67ec860a9ebe1c.zip | |
Rename internal ConnectionState attribute to have an underscore.
Some people like to use that variable name apparently.
See #568 and #569.
Diffstat (limited to 'discord/shard.py')
| -rw-r--r-- | discord/shard.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/discord/shard.py b/discord/shard.py index ba0da9ff..75fd661e 100644 --- a/discord/shard.py +++ b/discord/shard.py @@ -115,8 +115,8 @@ 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, chunker=self._chunker, - syncer=self._syncer, http=self.http, loop=self.loop, **kwargs) + self._connection = AutoShardedConnectionState(dispatch=self.dispatch, chunker=self._chunker, + syncer=self._syncer, http=self.http, loop=self.loop, **kwargs) # instead of a single websocket, we have multiple # the key is the shard_id @@ -126,7 +126,7 @@ class AutoShardedClient(Client): i = (guild_id >> 22) % self.shard_count return self.shards[i].ws - self.connection._get_websocket = _get_websocket + self._connection._get_websocket = _get_websocket self._still_sharding = True @asyncio.coroutine @@ -179,7 +179,7 @@ class AutoShardedClient(Client): _guilds = sorted(guilds, key=lambda g: g.shard_id) for shard_id, sub_guilds in itertools.groupby(_guilds, key=lambda g: g.shard_id): sub_guilds = list(sub_guilds) - yield from self.connection.request_offline_members(sub_guilds, shard_id=shard_id) + yield from self._connection.request_offline_members(sub_guilds, shard_id=shard_id) @asyncio.coroutine def pending_reads(self, shard): @@ -199,7 +199,7 @@ class AutoShardedClient(Client): return (yield from self.launch_shard(gateway, shard_id)) ws.token = self.http.token - ws._connection = self.connection + ws._connection = self._connection ws._dispatch = self.dispatch ws.gateway = gateway ws.shard_id = shard_id @@ -226,7 +226,7 @@ class AutoShardedClient(Client): else: gateway = yield from self.http.get_gateway() - self.connection.shard_count = self.shard_count + self._connection.shard_count = self.shard_count shard_ids = self.shard_ids if self.shard_ids else range(self.shard_count) @@ -312,11 +312,11 @@ class AutoShardedClient(Client): for shard in self.shards.values(): yield from shard.ws.change_presence(game=game, status=status, afk=afk) - guilds = self.connection.guilds + guilds = self._connection.guilds else: shard = self.shards[shard_id] yield from shard.ws.change_presence(game=game, status=status, afk=afk) - guilds = [g for g in self.connection.guilds if g.shard_id == shard_id] + guilds = [g for g in self._connection.guilds if g.shard_id == shard_id] for guild in guilds: me = guild.me |