From 889e54bb6b7861c2da1310e5fbcbc738d19e3f03 Mon Sep 17 00:00:00 2001 From: Groosha Date: Thu, 9 Dec 2021 00:35:15 +0300 Subject: [PATCH] Remove until_date from banChatSenderChat, update docs --- aiogram/client/bot.py | 9 +++++---- aiogram/methods/ban_chat_sender_chat.py | 9 +++------ 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/aiogram/client/bot.py b/aiogram/client/bot.py index a9e177ee..89399dcd 100644 --- a/aiogram/client/bot.py +++ b/aiogram/client/bot.py @@ -1476,24 +1476,25 @@ class Bot(ContextInstanceMixin["Bot"]): self, chat_id: Union[int, str], sender_chat_id: int, - until_date: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None, request_timeout: Optional[int] = None, ) -> bool: """ - Use this method to ban a channel chat in a supergroup or a channel. The owner of the chat will not be able to send messages and join live streams on behalf of the chat, unless it is `unbanned `_ first. The bot must be an administrator in the supergroup or channel for this to work and must have the appropriate administrator rights. Returns :code:`True` on success. + Use this method to ban a channel chat in a supergroup or a channel. + Until the chat is `unbanned `_, + the owner of the banned chat won't be able to send messages on behalf of any of their channels. + The bot must be an administrator in the supergroup or channel for this to work + and must have the appropriate administrator rights. Returns True on success. Source: https://core.telegram.org/bots/api#banchatsenderchat :param chat_id: Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`) :param sender_chat_id: Unique identifier of the target sender chat - :param until_date: Date when the sender chat will be unbanned, unix time. If the chat is banned for more than 366 days or less than 30 seconds from the current time they are considered to be banned forever. :param request_timeout: Request timeout :return: Returns True on success. """ call = BanChatSenderChat( chat_id=chat_id, sender_chat_id=sender_chat_id, - until_date=until_date, ) return await self(call, request_timeout=request_timeout) diff --git a/aiogram/methods/ban_chat_sender_chat.py b/aiogram/methods/ban_chat_sender_chat.py index d7a0d701..c26d23ca 100644 --- a/aiogram/methods/ban_chat_sender_chat.py +++ b/aiogram/methods/ban_chat_sender_chat.py @@ -1,7 +1,6 @@ from __future__ import annotations -import datetime -from typing import TYPE_CHECKING, Any, Dict, Optional, Union +from typing import TYPE_CHECKING, Any, Dict, Union from .base import Request, TelegramMethod @@ -12,8 +11,8 @@ if TYPE_CHECKING: class BanChatSenderChat(TelegramMethod[bool]): """ Use this method to ban a channel chat in a supergroup or a channel. - The owner of the chat will not be able to send messages and join live streams on behalf of the chat, - unless it is unbanned first. The bot must be an administrator in the supergroup or channel + Until the chat is unbanned, the owner of the banned chat won't be able to send messages + on behalf of any of their channels. The bot must be an administrator in the supergroup or channel for this to work and must have the appropriate administrator rights. Returns True on success. Source: https://core.telegram.org/bots/api#banchatsenderchat @@ -25,8 +24,6 @@ class BanChatSenderChat(TelegramMethod[bool]): """Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername)`""" sender_chat_id: int """Unique identifier of the target sender chat""" - until_date: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None - """Date when the sender chat will be unbanned, unix time. If the chat is banned for more than 366 days or less than 30 seconds from the current time they are considered to be banned forever.""" def build_request(self, bot: Bot) -> Request: data: Dict[str, Any] = self.dict()