mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-06-07 20:28:38 +00:00
Deprecate Client.logout
This commit is contained in:
parent
8a24a93010
commit
954dd09e18
@ -511,11 +511,14 @@ class Client:
|
|||||||
await self.http.static_login(token.strip(), bot=bot)
|
await self.http.static_login(token.strip(), bot=bot)
|
||||||
self._connection.is_bot = bot
|
self._connection.is_bot = bot
|
||||||
|
|
||||||
|
@utils.deprecated('Client.close')
|
||||||
async def logout(self):
|
async def logout(self):
|
||||||
"""|coro|
|
"""|coro|
|
||||||
|
|
||||||
Logs out of Discord and closes all connections.
|
Logs out of Discord and closes all connections.
|
||||||
|
|
||||||
|
.. deprecated:: 1.7
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
This is just an alias to :meth:`close`. If you want
|
This is just an alias to :meth:`close`. If you want
|
||||||
@ -675,7 +678,7 @@ class Client:
|
|||||||
try:
|
try:
|
||||||
loop.run_until_complete(start(*args, **kwargs))
|
loop.run_until_complete(start(*args, **kwargs))
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
loop.run_until_complete(logout())
|
loop.run_until_complete(close())
|
||||||
# cancel all tasks lingering
|
# cancel all tasks lingering
|
||||||
finally:
|
finally:
|
||||||
loop.close()
|
loop.close()
|
||||||
|
@ -201,7 +201,7 @@ to handle it, which defaults to print a traceback and ignoring the exception.
|
|||||||
.. function:: on_disconnect()
|
.. function:: on_disconnect()
|
||||||
|
|
||||||
Called when the client has disconnected from Discord, or a connection attempt to Discord has failed.
|
Called when the client has disconnected from Discord, or a connection attempt to Discord has failed.
|
||||||
This could happen either through the internet being disconnected, explicit calls to logout,
|
This could happen either through the internet being disconnected, explicit calls to close,
|
||||||
or Discord terminating the connection one way or the other.
|
or Discord terminating the connection one way or the other.
|
||||||
|
|
||||||
This function can be called many times without a corresponding :func:`on_connect` call.
|
This function can be called many times without a corresponding :func:`on_connect` call.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user