mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-02-18 04:20:57 +03:00
Allow restricting channels (#3679)
This commit is contained in:
parent
0eadca670f
commit
7778e54467
|
@ -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,
|
||||
|
|
|
@ -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, *,
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user