mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-26 03:13:45 +03:00
Fix get_permissions in chats and when using self user (#1584)
This commit is contained in:
parent
09f4c5c708
commit
ce120cba13
|
@ -1181,9 +1181,11 @@ class ChatMethods:
|
||||||
chat = await self(functions.messages.GetFullChatRequest(
|
chat = await self(functions.messages.GetFullChatRequest(
|
||||||
entity
|
entity
|
||||||
))
|
))
|
||||||
for participant in chat.participants.participants:
|
if isinstance(user, types.InputPeerSelf):
|
||||||
if participant.user_id == user.id:
|
user = await self.get_me(input_peer=True)
|
||||||
return custom.ParticipantPermissions(participant.participant, True)
|
for participant in chat.full_chat.participants.participants:
|
||||||
|
if participant.user_id == user.user_id:
|
||||||
|
return custom.ParticipantPermissions(participant, True)
|
||||||
raise errors.UserNotParticipantError(None)
|
raise errors.UserNotParticipantError(None)
|
||||||
|
|
||||||
raise ValueError('You must pass either a channel or a chat')
|
raise ValueError('You must pass either a channel or a chat')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user