TelegramClient: Perform disconnection on class destruction (#74)

This commit is contained in:
Dmitry D. Chernov 2017-05-06 21:40:42 +10:00 committed by Lonami
parent ff469acb81
commit a49e50d04d

View File

@ -43,7 +43,7 @@ class TelegramClient:
# Current TelegramClient version
__version__ = '0.8'
# region Initialization
# region Default methods of class
def __init__(self, session, api_id, api_hash, proxy=None):
"""Initializes the Telegram client with the specified API ID and Hash.
@ -82,6 +82,10 @@ class TelegramClient:
# We need to be signed in before we can listen for updates
self.signed_in = False
def __del__(self):
"""Releases the Telegram client, performing disconnection."""
self.disconnect()
# endregion
# region Connecting