Allow restricting channels (#3679)

This commit is contained in:
Devesh Pal 2022-01-25 01:39:51 +05:30 committed by GitHub
parent 0eadca670f
commit 7778e54467
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 8 deletions

View File

@ -577,9 +577,6 @@ async def edit_permissions(
))
user = await self.get_input_entity(user)
ty = helpers._entity_type(user)
if ty != helpers._EntityType.USER:
raise ValueError('You must pass a user entity')
if isinstance(user, _tl.InputPeerSelf):
raise ValueError('You cannot restrict yourself')
@ -630,7 +627,7 @@ async def get_permissions(
self: 'TelegramClient',
entity: 'hints.EntityLike',
user: 'hints.EntityLike' = None
) -> 'typing.Optional[custom.ParticipantPermissions]':
) -> 'typing.Optional[_custom.ParticipantPermissions]':
entity = await self.get_entity(entity)
if not user:
@ -639,8 +636,7 @@ async def get_permissions(
entity = await self.get_input_entity(entity)
user = await self.get_input_entity(user)
if helpers._entity_type(user) != helpers._EntityType.USER:
raise ValueError('You must pass a user entity')
if helpers._entity_type(entity) == helpers._EntityType.CHANNEL:
participant = await self(_tl.fn.channels.GetParticipant(
entity,

View File

@ -137,7 +137,7 @@ class InlineQuery(EventBuilder):
Returns a new `InlineBuilder
<telethon.tl.custom.inlinebuilder.InlineBuilder>` instance.
"""
return custom.InlineBuilder(self._client)
return _custom.InlineBuilder(self._client)
async def answer(
self, results=None, cache_time=0, *,

View File

@ -170,7 +170,7 @@ class Button:
)
@staticmethod
def mention(text, input_entity):
def mention(text, input_entity=None):
"""
Creates a new inline button linked to the profile of user.