Skip to content

Commit

Permalink
Fix asking for phone on .start()
Browse files Browse the repository at this point in the history
  • Loading branch information
Lonami committed Jan 13, 2018
1 parent 7730137 commit 0d429f5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
1 change: 0 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
10 changes: 3 additions & 7 deletions telethon/telegram_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,14 +232,10 @@ def code_callback():
)

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).'
Expand Down

0 comments on commit 0d429f5

Please sign in to comment.