From 870e79d7f20f6935a6a374db5aa8fa886e58a796 Mon Sep 17 00:00:00 2001 From: Alex Root Junior Date: Sun, 4 Aug 2019 20:03:58 +0300 Subject: [PATCH] Add new permissions argument to Chat.restrict method --- aiogram/types/chat.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/aiogram/types/chat.py b/aiogram/types/chat.py index 68746f0e..f5c521a5 100644 --- a/aiogram/types/chat.py +++ b/aiogram/types/chat.py @@ -204,6 +204,7 @@ class Chat(base.TelegramObject): return await self.bot.unban_chat_member(self.id, user_id=user_id) async def restrict(self, user_id: base.Integer, + permissions: typing.Optional[ChatPermissions] = None, until_date: typing.Union[base.Integer, None] = None, can_send_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 :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. :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 @@ -234,7 +237,9 @@ class Chat(base.TelegramObject): :return: Returns True on success. :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_media_messages=can_send_media_messages, can_send_other_messages=can_send_other_messages,