From 1cdf8798881a12008a0aa01616ce827227aa7372 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Sun, 1 Oct 2017 16:53:47 +0200 Subject: [PATCH] Fix .get_input_entity failing for chats --- telethon/telegram_client.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/telethon/telegram_client.py b/telethon/telegram_client.py index 56c55fa6..0d1db461 100644 --- a/telethon/telegram_client.py +++ b/telethon/telegram_client.py @@ -849,12 +849,12 @@ class TelegramClient(TelegramBareClient): if isinstance(input_entity, InputPeerUser): return self(GetUsersRequest([input_entity]))[0] elif isinstance(input_entity, InputPeerChat): - return self(GetChatsRequest([input_entity.chat_id]))[0] + return self(GetChatsRequest([input_entity.chat_id])).chats[0] elif isinstance(input_entity, InputPeerChannel): - return self(GetChannelsRequest([input_entity]))[0] + return self(GetChannelsRequest([input_entity])).chats[0] if isinstance(entity, str): - stripped_phone = re.sub(r'[+-()\s]', '', entity) + stripped_phone = re.sub(r'[+()\s-]', '', entity) if stripped_phone.isdigit(): contacts = self(GetContactsRequest(0)) try: