mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-01 10:49:58 +03:00
move InputPeerSelf overwrite to the chat block
just to reduce pointless get_me calls
This commit is contained in:
parent
cd214fef96
commit
70dc90746a
|
@ -1171,8 +1171,6 @@ class ChatMethods:
|
||||||
user = await self.get_input_entity(user)
|
user = await self.get_input_entity(user)
|
||||||
if helpers._entity_type(user) != helpers._EntityType.USER:
|
if helpers._entity_type(user) != helpers._EntityType.USER:
|
||||||
raise ValueError('You must pass a user entity')
|
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:
|
if helpers._entity_type(entity) == helpers._EntityType.CHANNEL:
|
||||||
participant = await self(functions.channels.GetParticipantRequest(
|
participant = await self(functions.channels.GetParticipantRequest(
|
||||||
entity,
|
entity,
|
||||||
|
@ -1183,6 +1181,8 @@ class ChatMethods:
|
||||||
chat = await self(functions.messages.GetFullChatRequest(
|
chat = await self(functions.messages.GetFullChatRequest(
|
||||||
entity
|
entity
|
||||||
))
|
))
|
||||||
|
if isinstance(user, types.InputPeerSelf):
|
||||||
|
user = await self.get_me(input_peer=True)
|
||||||
for participant in chat.full_chat.participants.participants:
|
for participant in chat.full_chat.participants.participants:
|
||||||
if participant.user_id == user.user_id:
|
if participant.user_id == user.user_id:
|
||||||
return custom.ParticipantPermissions(participant, True)
|
return custom.ParticipantPermissions(participant, True)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user