Phone number shouldn't actually start with '+'

This commit is contained in:
Lonami Exo 2017-09-20 12:47:19 +02:00
parent 9ae4f7f641
commit b8d7b1c8af

View File

@ -282,8 +282,12 @@ class TelegramClient(TelegramBareClient):
def send_code_request(self, phone): def send_code_request(self, phone):
"""Sends a code request to the specified phone number""" """Sends a code request to the specified phone number"""
result = self( if isinstance(phone, int):
SendCodeRequest(phone, self.api_id, self.api_hash)) phone = str(phone)
elif phone.startswith('+'):
phone = phone.strip('+')
result = self(SendCodeRequest(phone, self.api_id, self.api_hash))
self._phone = phone self._phone = phone
self._phone_code_hash = result.phone_code_hash self._phone_code_hash = result.phone_code_hash
return result return result