From 5aa93b8287ca4fbe1de306296d47dd43f95abf5f Mon Sep 17 00:00:00 2001 From: bakatrouble Date: Wed, 20 Mar 2019 16:20:38 +0300 Subject: [PATCH] Show TOS on signup just once while program is running (#231) --- pyrogram/client/client.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pyrogram/client/client.py b/pyrogram/client/client.py index 253cc754..737139ca 100644 --- a/pyrogram/client/client.py +++ b/pyrogram/client/client.py @@ -181,6 +181,8 @@ class Client(Methods, BaseClient): Defaults to False (normal session). """ + terms_of_service_displayed = False + def __init__(self, session_name: str, api_id: Union[int, str] = None, @@ -591,8 +593,9 @@ class Client(Methods, BaseClient): phone_code_hash = r.phone_code_hash 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") + Client.terms_of_service_displayed = True if self.force_sms: self.send(