mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-06-03 18:42:43 +00:00
Check if we're closed before attempting to do a reconnect.
This commit is contained in:
parent
a0cdb19c5f
commit
5461bfb475
@ -399,6 +399,9 @@ class Client:
|
||||
yield from self.close()
|
||||
raise
|
||||
|
||||
if self.is_closed():
|
||||
return
|
||||
|
||||
# We should only get this when an unhandled close code happens,
|
||||
# such as a clean disconnect (1000) or a bad state (bad token, no sharding, etc)
|
||||
# sometimes, discord sends us 1000 for unknown reasons so we should reconnect
|
||||
|
@ -234,11 +234,12 @@ class AutoShardedClient(Client):
|
||||
if self.is_closed():
|
||||
return
|
||||
|
||||
self._closed.set()
|
||||
|
||||
for shard in self.shards.values():
|
||||
yield from shard.ws.close()
|
||||
|
||||
yield from self.http.close()
|
||||
self._closed.set()
|
||||
|
||||
@asyncio.coroutine
|
||||
def change_presence(self, *, game=None, status=None, afk=False, shard_id=None):
|
||||
|
Loading…
x
Reference in New Issue
Block a user