From 0d429f55c54ce8b89a9df6222229a51be5d3a6bf Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Sat, 13 Jan 2018 12:00:53 +0100 Subject: [PATCH] Fix asking for phone on .start() --- README.rst | 1 - telethon/telegram_client.py | 10 +++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/README.rst b/README.rst index 09ddaf90..6343e6e1 100755 --- a/README.rst +++ b/README.rst @@ -36,7 +36,6 @@ Creating a client # api_hash from https://my.telegram.org, under API Development. api_id = 12345 api_hash = '0123456789abcdef0123456789abcdef' - phone = '+34600000000' client = TelegramClient('session_name', api_id, api_hash) client.start() diff --git a/telethon/telegram_client.py b/telethon/telegram_client.py index 98b22940..674e6045 100644 --- a/telethon/telegram_client.py +++ b/telethon/telegram_client.py @@ -232,14 +232,10 @@ class TelegramClient(TelegramBareClient): ) if not phone and not bot_token: - value = input('Please enter your phone/bot token: ') - phone = utils.parse_phone(phone) - if not phone: - bot_token = value - print("Note: input doesn't look like a phone, " - "using as bot token") + while not phone: + phone = utils.parse_phone(input('Please enter your phone: ')) - if phone and bot_token: + elif phone and bot_token: raise ValueError( 'You must provide either a phone number or a bot token, ' 'not both (or neither).'