Show TOS on signup just once while program is running (#231)

This commit is contained in:
bakatrouble 2019-03-20 16:20:38 +03:00 committed by Dan
parent 9d701bc226
commit 5aa93b8287

View File

@ -181,6 +181,8 @@ class Client(Methods, BaseClient):
Defaults to False (normal session). Defaults to False (normal session).
""" """
terms_of_service_displayed = False
def __init__(self, def __init__(self,
session_name: str, session_name: str,
api_id: Union[int, str] = None, api_id: Union[int, str] = None,
@ -591,8 +593,9 @@ class Client(Methods, BaseClient):
phone_code_hash = r.phone_code_hash phone_code_hash = r.phone_code_hash
terms_of_service = r.terms_of_service terms_of_service = r.terms_of_service
if terms_of_service: if terms_of_service and not Client.terms_of_service_displayed:
print("\n" + terms_of_service.text + "\n") print("\n" + terms_of_service.text + "\n")
Client.terms_of_service_displayed = True
if self.force_sms: if self.force_sms:
self.send( self.send(