From 97b0a0610e65a1557f5ae9e2c4db490833dfe9c2 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Sat, 2 Jun 2018 12:09:21 +0200 Subject: [PATCH] Support get_messages(ids=) without entity --- telethon/telegram_client.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/telethon/telegram_client.py b/telethon/telegram_client.py index 2378c104..c6f55675 100644 --- a/telethon/telegram_client.py +++ b/telethon/telegram_client.py @@ -1123,7 +1123,11 @@ class TelegramClient(TelegramBareClient): an higher limit, so you're free to set the ``batch_size`` that you think may be good. """ - entity = self.get_input_entity(entity) + # It's possible to get messages by ID without their entity, so only + # fetch the input version if we're not using IDs or if it was given. + if not ids or entity: + entity = self.get_input_entity(entity) + if ids: if not utils.is_list_like(ids): ids = (ids,)