From a2bae8374ec72a85d9f5ef9e0b2dd6516dfde7c1 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Fri, 19 Oct 2018 16:57:46 +0200 Subject: [PATCH] Fix .get_entity('me') not working from c31635c (#1024) --- telethon/client/users.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/telethon/client/users.py b/telethon/client/users.py index 56cc39ca..022e996b 100644 --- a/telethon/client/users.py +++ b/telethon/client/users.py @@ -362,6 +362,8 @@ class UserMethods(TelegramBaseClient): except errors.BotMethodInvalidError: raise ValueError('Cannot get entity by phone number as a ' 'bot (try using integer IDs, not strings)') + elif string.lower() in ('me', 'self'): + return await self.get_me() else: username, is_join_chat = utils.parse_username(string) if is_join_chat: @@ -376,9 +378,6 @@ class UserMethods(TelegramBaseClient): elif isinstance(invite, types.ChatInviteAlready): return invite.chat elif username: - if username in ('me', 'self'): - return await self.get_me() - try: result = await self( functions.contacts.ResolveUsernameRequest(username))