Make phone and password kwargs in start

This commit is contained in:
Lonami Exo 2022-02-17 11:26:35 +01:00
parent 5c6fdf9a71
commit 77a98fed2c
2 changed files with 2 additions and 1 deletions

View File

@ -983,3 +983,4 @@ send_code_request now returns a custom type (reducing raw api).
sign_in no longer has phone or phone_hash (these are impl details, and now it's less error prone). also mandatory code=. also no longer is a no-op if already logged in. different error for sign up required.
send code / sign in now only expect a single phone. resend code with new phone is send code, not resend.
sign_up code is also now a kwarg. and no longer noop if already loggedin.
start also mandates phone= or password= as kwarg.

View File

@ -313,9 +313,9 @@ class TelegramClient:
@forward_call(auth.start)
def start(
self: 'TelegramClient',
*,
phone: typing.Callable[[], str] = lambda: input('Please enter your phone (or bot token): '),
password: typing.Callable[[], str] = lambda: getpass.getpass('Please enter your password: '),
*,
bot_token: str = None,
code_callback: typing.Callable[[], typing.Union[str, int]] = None,
first_name: str = 'New User',