diff --git a/telethon/telegram_bare_client.py b/telethon/telegram_bare_client.py index 8a0c43d9..93453322 100644 --- a/telethon/telegram_bare_client.py +++ b/telethon/telegram_bare_client.py @@ -270,6 +270,9 @@ class TelegramBareClient: # TODO Shall we clear the _exported_sessions, or may be reused? self._first_request = True # On reconnect it will be first again + def __del__(self): + self.disconnect() + def _reconnect(self, new_dc=None): """If 'new_dc' is not set, only a call to .connect() will be made since it's assumed that the connection has been lost and the