From 70dc90746a21b7d6b8db6a90b465bb03657a9c48 Mon Sep 17 00:00:00 2001 From: Nick80835 Date: Mon, 5 Oct 2020 11:43:11 -0400 Subject: [PATCH] move InputPeerSelf overwrite to the chat block just to reduce pointless get_me calls --- telethon/client/chats.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/telethon/client/chats.py b/telethon/client/chats.py index b95e1dfb..90b1dd0b 100644 --- a/telethon/client/chats.py +++ b/telethon/client/chats.py @@ -1171,8 +1171,6 @@ class ChatMethods: user = await self.get_input_entity(user) if helpers._entity_type(user) != helpers._EntityType.USER: raise ValueError('You must pass a user entity') - if isinstance(user, types.InputPeerSelf): - user = await self.get_me(input_peer=True) if helpers._entity_type(entity) == helpers._EntityType.CHANNEL: participant = await self(functions.channels.GetParticipantRequest( entity, @@ -1183,6 +1181,8 @@ class ChatMethods: chat = await self(functions.messages.GetFullChatRequest( entity )) + if isinstance(user, types.InputPeerSelf): + user = await self.get_me(input_peer=True) for participant in chat.full_chat.participants.participants: if participant.user_id == user.user_id: return custom.ParticipantPermissions(participant, True)