Add new permissions argument to Chat.restrict method

This commit is contained in:
Alex Root Junior 2019-08-04 20:03:58 +03:00
parent 47bc628f2b
commit 870e79d7f2

View file

@ -204,6 +204,7 @@ class Chat(base.TelegramObject):
return await self.bot.unban_chat_member(self.id, user_id=user_id) return await self.bot.unban_chat_member(self.id, user_id=user_id)
async def restrict(self, user_id: base.Integer, async def restrict(self, user_id: base.Integer,
permissions: typing.Optional[ChatPermissions] = None,
until_date: typing.Union[base.Integer, None] = None, until_date: typing.Union[base.Integer, None] = None,
can_send_messages: typing.Union[base.Boolean, None] = None, can_send_messages: typing.Union[base.Boolean, None] = None,
can_send_media_messages: typing.Union[base.Boolean, None] = None, can_send_media_messages: typing.Union[base.Boolean, None] = None,
@ -218,6 +219,8 @@ class Chat(base.TelegramObject):
:param user_id: Unique identifier of the target user :param user_id: Unique identifier of the target user
:type user_id: :obj:`base.Integer` :type user_id: :obj:`base.Integer`
:param permissions: New user permissions
:type permissions: :obj:`ChatPermissions`
:param until_date: Date when restrictions will be lifted for the user, unix time. :param until_date: Date when restrictions will be lifted for the user, unix time.
:type until_date: :obj:`typing.Union[base.Integer, None]` :type until_date: :obj:`typing.Union[base.Integer, None]`
:param can_send_messages: Pass True, if the user can send text messages, contacts, locations and venues :param can_send_messages: Pass True, if the user can send text messages, contacts, locations and venues
@ -234,7 +237,9 @@ class Chat(base.TelegramObject):
:return: Returns True on success. :return: Returns True on success.
:rtype: :obj:`base.Boolean` :rtype: :obj:`base.Boolean`
""" """
return await self.bot.restrict_chat_member(self.id, user_id=user_id, until_date=until_date, return await self.bot.restrict_chat_member(self.id, user_id=user_id,
permissions=permissions,
until_date=until_date,
can_send_messages=can_send_messages, can_send_messages=can_send_messages,
can_send_media_messages=can_send_media_messages, can_send_media_messages=can_send_media_messages,
can_send_other_messages=can_send_other_messages, can_send_other_messages=can_send_other_messages,