From 5c6fdf9a71abd737e4434b7dad392c801d1673a9 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Thu, 17 Feb 2022 11:15:11 +0100 Subject: [PATCH] Return custom User from sign_in/sign_up --- telethon/_client/auth.py | 2 +- telethon/types/__init__.py | 2 ++ telethon/types/_custom/__init__.py | 2 ++ telethon/types/_custom/user.py | 3 +-- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/telethon/_client/auth.py b/telethon/_client/auth.py index 795a7f51..3c246c46 100644 --- a/telethon/_client/auth.py +++ b/telethon/_client/auth.py @@ -297,7 +297,7 @@ async def _update_session_state(self, user, save=True): ) self._phone_code_hash = None - return user + return _custom.User._new(self, user) async def _replace_session_state(self, *, save=True, **changes): diff --git a/telethon/types/__init__.py b/telethon/types/__init__.py index 2fa8cd02..665f9481 100644 --- a/telethon/types/__init__.py +++ b/telethon/types/__init__.py @@ -15,4 +15,6 @@ from ._custom import ( InlineResults, QRLogin, ParticipantPermissions, + Chat, + User, ) diff --git a/telethon/types/_custom/__init__.py b/telethon/types/_custom/__init__.py index 5637c1e2..5ee32a68 100644 --- a/telethon/types/_custom/__init__.py +++ b/telethon/types/_custom/__init__.py @@ -12,3 +12,5 @@ from .inlineresult import InlineResult from .inlineresults import InlineResults from .qrlogin import QRLogin from .participantpermissions import ParticipantPermissions +from .chat import Chat +from .user import User diff --git a/telethon/types/_custom/user.py b/telethon/types/_custom/user.py index 79e7c21e..12f2e765 100644 --- a/telethon/types/_custom/user.py +++ b/telethon/types/_custom/user.py @@ -11,7 +11,7 @@ from .inputfile import InputFile from .inputmessage import InputMessage from .button import build_reply_markup from ..._misc import utils, helpers, tlobject, markdown, html -from ... import _tl, _misc +from ..._sessions.types import Entity if TYPE_CHECKING: @@ -181,7 +181,6 @@ class User: self._user = user self._full = None - raise RuntimeError('self._i_need_to_include_participant_info') return self