diff --git a/telethon/_client/chats.py b/telethon/_client/chats.py index cd6d9726..8ab4bff6 100644 --- a/telethon/_client/chats.py +++ b/telethon/_client/chats.py @@ -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, diff --git a/telethon/_events/inlinequery.py b/telethon/_events/inlinequery.py index 76401962..59ad6baa 100644 --- a/telethon/_events/inlinequery.py +++ b/telethon/_events/inlinequery.py @@ -137,7 +137,7 @@ class InlineQuery(EventBuilder): Returns a new `InlineBuilder ` instance. """ - return custom.InlineBuilder(self._client) + return _custom.InlineBuilder(self._client) async def answer( self, results=None, cache_time=0, *, diff --git a/telethon/types/_custom/button.py b/telethon/types/_custom/button.py index 27f1aae9..0ea42d40 100644 --- a/telethon/types/_custom/button.py +++ b/telethon/types/_custom/button.py @@ -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.