diff --git a/docs/source/pyrogram/Client.rst b/docs/source/pyrogram/Client.rst index 9a1b0509..f9e50d3e 100644 --- a/docs/source/pyrogram/Client.rst +++ b/docs/source/pyrogram/Client.rst @@ -13,6 +13,7 @@ Utilities start stop + restart idle run add_handler diff --git a/pyrogram/client/client.py b/pyrogram/client/client.py index 7b5c1aea..61a3775b 100644 --- a/pyrogram/client/client.py +++ b/pyrogram/client/client.py @@ -374,6 +374,16 @@ class Client(Methods, BaseClient): return self + def restart(self): + """Use this method to restart the Client. + Requires no parameters. + + Raises: + ``ConnectionError`` in case you try to restart a stopped Client. + """ + self.stop() + self.start() + def idle(self, stop_signals: tuple = (SIGINT, SIGTERM, SIGABRT)): """Blocks the program execution until one of the signals are received, then gently stop the Client by closing the underlying connection.