diff options
| author | Rapptz <[email protected]> | 2019-04-25 01:57:32 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2019-04-25 01:57:32 -0400 |
| commit | 186d9a7f9cb8b28678893bd32ec6f823e5090d78 (patch) | |
| tree | 48f79232754af0deebec2b7894f3ed2451684bf9 | |
| parent | [commands] Allow passing `current` to more cooldown mapping methods. (diff) | |
| download | discord.py-186d9a7f9cb8b28678893bd32ec6f823e5090d78.tar.xz discord.py-186d9a7f9cb8b28678893bd32ec6f823e5090d78.zip | |
Use a regular boolean instead of asyncio.Event for close status.
| -rw-r--r-- | discord/client.py | 10 | ||||
| -rw-r--r-- | discord/shard.py | 2 |
2 files changed, 6 insertions, 6 deletions
diff --git a/discord/client.py b/discord/client.py index 465b9b14..8be63d35 100644 --- a/discord/client.py +++ b/discord/client.py @@ -170,7 +170,7 @@ class Client: syncer=self._syncer, http=self.http, loop=self.loop, **options) self._connection.shard_count = self.shard_count - self._closed = asyncio.Event(loop=self.loop) + self._closed = False self._ready = asyncio.Event(loop=self.loop) self._connection._get_websocket = lambda g: self.ws @@ -478,11 +478,11 @@ class Client: Closes the connection to discord. """ - if self.is_closed(): + if self._closed: return await self.http.close() - self._closed.set() + self._closed = True for voice in self.voice_clients: try: @@ -503,7 +503,7 @@ class Client: and :meth:`.is_ready` both return ``False`` along with the bot's internal cache cleared. """ - self._closed.clear() + self._closed = False self._ready.clear() self._connection.clear() self.http.recreate() @@ -591,7 +591,7 @@ class Client: def is_closed(self): """:class:`bool`: Indicates if the websocket connection is closed.""" - return self._closed.is_set() + return self._closed @property def activity(self): diff --git a/discord/shard.py b/discord/shard.py index b15b22a2..a5f5f541 100644 --- a/discord/shard.py +++ b/discord/shard.py @@ -280,7 +280,7 @@ class AutoShardedClient(Client): if self.is_closed(): return - self._closed.set() + self._closed = True for vc in self.voice_clients: try: |