mirror of
				https://github.com/LonamiWebs/Telethon.git
				synced 2025-11-04 01:47:27 +03:00 
			
		
		
		
	Fix asking for phone on .start()
This commit is contained in:
		
							parent
							
								
									77301378f8
								
							
						
					
					
						commit
						0d429f55c5
					
				| 
						 | 
					@ -36,7 +36,6 @@ Creating a client
 | 
				
			||||||
  # api_hash from https://my.telegram.org, under API Development.
 | 
					  # api_hash from https://my.telegram.org, under API Development.
 | 
				
			||||||
  api_id = 12345
 | 
					  api_id = 12345
 | 
				
			||||||
  api_hash = '0123456789abcdef0123456789abcdef'
 | 
					  api_hash = '0123456789abcdef0123456789abcdef'
 | 
				
			||||||
  phone = '+34600000000'
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  client = TelegramClient('session_name', api_id, api_hash)
 | 
					  client = TelegramClient('session_name', api_id, api_hash)
 | 
				
			||||||
  client.start()
 | 
					  client.start()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -232,14 +232,10 @@ class TelegramClient(TelegramBareClient):
 | 
				
			||||||
            )
 | 
					            )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if not phone and not bot_token:
 | 
					        if not phone and not bot_token:
 | 
				
			||||||
            value = input('Please enter your phone/bot token: ')
 | 
					            while not phone:
 | 
				
			||||||
            phone = utils.parse_phone(phone)
 | 
					                phone = utils.parse_phone(input('Please enter your phone: '))
 | 
				
			||||||
            if not phone:
 | 
					 | 
				
			||||||
                bot_token = value
 | 
					 | 
				
			||||||
                print("Note: input doesn't look like a phone, "
 | 
					 | 
				
			||||||
                      "using as bot token")
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if phone and bot_token:
 | 
					        elif phone and bot_token:
 | 
				
			||||||
            raise ValueError(
 | 
					            raise ValueError(
 | 
				
			||||||
                'You must provide either a phone number or a bot token, '
 | 
					                'You must provide either a phone number or a bot token, '
 | 
				
			||||||
                'not both (or neither).'
 | 
					                'not both (or neither).'
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user