mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-23 01:46:35 +03:00
Make .sign_up() return the logged user just like .sign_in()
This commit is contained in:
parent
15fd5390ae
commit
fe86b88bef
|
@ -313,16 +313,13 @@ class TelegramClient(TelegramBareClient):
|
|||
|
||||
def sign_up(self, code, first_name, last_name=''):
|
||||
"""Signs up to Telegram. Make sure you sent a code request first!"""
|
||||
result = self(
|
||||
SignUpRequest(
|
||||
phone_number=self._phone,
|
||||
phone_code_hash=self._phone_code_hash,
|
||||
phone_code=code,
|
||||
first_name=first_name,
|
||||
last_name=last_name))
|
||||
|
||||
self.session.user = result.user
|
||||
self.session.save()
|
||||
return self(SignUpRequest(
|
||||
phone_number=self._phone,
|
||||
phone_code_hash=self._phone_code_hash,
|
||||
phone_code=code,
|
||||
first_name=first_name,
|
||||
last_name=last_name
|
||||
)).user
|
||||
|
||||
def log_out(self):
|
||||
"""Logs out and deletes the current session.
|
||||
|
|
Loading…
Reference in New Issue
Block a user