mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Remove until_date from banChatSenderChat, update docs
This commit is contained in:
parent
12704b57b0
commit
889e54bb6b
2 changed files with 8 additions and 10 deletions
|
|
@ -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 <https://core.telegram.org/bots/api#unbanchatmember>`_ 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 <https://core.telegram.org/bots/api#unbanchatmember>`_,
|
||||
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)
|
||||
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue