diff --git a/pyrogram/client/client.py b/pyrogram/client/client.py index ef3e0f26..07869a62 100644 --- a/pyrogram/client/client.py +++ b/pyrogram/client/client.py @@ -136,6 +136,7 @@ class Client: phone_number: str = None, phone_code: str or callable = None, password: str = None, + force_sms: bool = False, first_name: str = None, last_name: str = None, workers: int = 4): @@ -149,6 +150,7 @@ class Client: self.phone_code = phone_code self.first_name = first_name self.last_name = last_name + self.force_sms = force_sms self.workers = workers @@ -346,6 +348,14 @@ class Client: phone_registered = r.phone_registered phone_code_hash = r.phone_code_hash + if self.force_sms: + self.send( + functions.auth.ResendCode( + phone_number=self.phone_number, + phone_code_hash=phone_code_hash + ) + ) + while True: self.phone_code = ( input("Enter phone code: ") if self.phone_code is None