From 0dfa2320704ea54a4c271dd8b71820c588cd789b Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Sat, 2 Sep 2023 01:18:10 +0200 Subject: [PATCH] Fix user login --- client/src/telethon/_impl/client/client/auth.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client/src/telethon/_impl/client/client/auth.py b/client/src/telethon/_impl/client/client/auth.py index f3a7a2f9..1463f973 100644 --- a/client/src/telethon/_impl/client/client/auth.py +++ b/client/src/telethon/_impl/client/client/auth.py @@ -28,7 +28,7 @@ async def is_authorized(self: Client) -> bool: async def complete_login(self: Client, auth: abcs.auth.Authorization) -> User: assert isinstance(auth, types.auth.Authorization) assert isinstance(auth.user, types.User) - user = User(auth.user) + user = User._from_raw(auth.user) self._config.session.user = SessionUser( id=user.id, dc=self._dc_id, @@ -67,7 +67,7 @@ async def bot_sign_in(self: Client, token: str) -> User: try: result = await self(request) except RpcError as e: - if e.name == "USER_MIGRATE": + if e.code == 303: await handle_migrate(self, e.value) result = await self(request) else: @@ -96,7 +96,7 @@ async def request_login_code(self: Client, phone: str) -> LoginToken: try: result = await self(request) except RpcError as e: - if e.name == "USER_MIGRATE": + if e.code == 303: await handle_migrate(self, e.value) result = await self(request) else: