diff --git a/telethon/client/users.py b/telethon/client/users.py index ab05ece28..e2587a132 100644 --- a/telethon/client/users.py +++ b/telethon/client/users.py @@ -316,7 +316,9 @@ async def get_entity( # Merge users, chats and channels into a single dictionary id_entity = { - utils.get_peer_id(x): x + # `get_input_entity` might've guessed the type from a non-marked ID, + # so the only way to match that with the input is by not using marks here. + utils.get_peer_id(x, add_mark=False): x for x in itertools.chain(users, chats, channels) } @@ -329,7 +331,7 @@ async def get_entity( if isinstance(x, str): result.append(await self._get_entity_from_string(x)) elif not isinstance(x, types.InputPeerSelf): - result.append(id_entity[utils.get_peer_id(x)]) + result.append(id_entity[utils.get_peer_id(x, add_mark=False)]) else: result.append(next( u for u in id_entity.values()