mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-04-20 17:11:59 +03:00
Fixes for get and edit perms
This commit is contained in:
parent
730a8ed380
commit
adbae54649
|
@ -1109,9 +1109,6 @@ class ChatMethods:
|
|||
await client.edit_permissions(chat, user)
|
||||
"""
|
||||
entity = await self.get_input_entity(entity)
|
||||
ty = helpers._entity_type(entity)
|
||||
if ty != helpers._EntityType.CHANNEL:
|
||||
raise ValueError('You must pass either a channel or a supergroup')
|
||||
|
||||
rights = types.ChatBannedRights(
|
||||
until_date=until_date,
|
||||
|
@ -1135,6 +1132,10 @@ class ChatMethods:
|
|||
banned_rights=rights
|
||||
))
|
||||
|
||||
ty = helpers._entity_type(entity)
|
||||
if ty != helpers._EntityType.CHANNEL:
|
||||
raise ValueError('You must pass either a channel or a supergroup')
|
||||
|
||||
user = await self.get_input_entity(user)
|
||||
ty = helpers._entity_type(user)
|
||||
if ty != helpers._EntityType.USER:
|
||||
|
@ -1259,7 +1260,7 @@ class ChatMethods:
|
|||
if isinstance(entity, types.Channel):
|
||||
FullChat = await self(functions.channels.GetFullChannelRequest(entity))
|
||||
elif isinstance(entity, types.Chat):
|
||||
FullChat = await self(functions.messages.GetFullChatRequest(entity))
|
||||
FullChat = await self(functions.messages.GetFullChatRequest(entity.id))
|
||||
else:
|
||||
return
|
||||
return FullChat.chats[0].default_banned_rights
|
||||
|
@ -1276,7 +1277,7 @@ class ChatMethods:
|
|||
return custom.ParticipantPermissions(participant.participant, False)
|
||||
elif helpers._entity_type(entity) == helpers._EntityType.CHAT:
|
||||
chat = await self(functions.messages.GetFullChatRequest(
|
||||
entity
|
||||
entity.chat_id
|
||||
))
|
||||
if isinstance(user, types.InputPeerSelf):
|
||||
user = await self.get_me(input_peer=True)
|
||||
|
|
Loading…
Reference in New Issue
Block a user