[3.x] Bot API 5.5 (#777)

* Re-generate API, cover changes

* Added patchnotes
This commit is contained in:
Alex Root Junior 2021-12-12 17:21:01 +02:00 committed by GitHub
parent 92ec44d8d2
commit 9ec689b562
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 333 additions and 15 deletions

View file

@ -5,6 +5,7 @@ from .answer_pre_checkout_query import AnswerPreCheckoutQuery
from .answer_shipping_query import AnswerShippingQuery
from .approve_chat_join_request import ApproveChatJoinRequest
from .ban_chat_member import BanChatMember
from .ban_chat_sender_chat import BanChatSenderChat
from .base import Request, Response, TelegramMethod
from .close import Close
from .copy_message import CopyMessage
@ -78,6 +79,7 @@ from .set_webhook import SetWebhook
from .stop_message_live_location import StopMessageLiveLocation
from .stop_poll import StopPoll
from .unban_chat_member import UnbanChatMember
from .unban_chat_sender_chat import UnbanChatSenderChat
from .unpin_all_chat_messages import UnpinAllChatMessages
from .unpin_chat_message import UnpinChatMessage
from .upload_sticker_file import UploadStickerFile
@ -120,6 +122,8 @@ __all__ = (
"RestrictChatMember",
"PromoteChatMember",
"SetChatAdministratorCustomTitle",
"BanChatSenderChat",
"UnbanChatSenderChat",
"SetChatPermissions",
"ExportChatInviteLink",
"CreateChatInviteLink",

View file

@ -0,0 +1,28 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Dict, Union
from .base import Request, TelegramMethod
if TYPE_CHECKING:
from ..client.bot import Bot
class BanChatSenderChat(TelegramMethod[bool]):
"""
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#unbanchatsenderchat>`_, 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 :code:`True` on success.
Source: https://core.telegram.org/bots/api#banchatsenderchat
"""
__returning__ = bool
chat_id: Union[int, str]
"""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"""
def build_request(self, bot: Bot) -> Request:
data: Dict[str, Any] = self.dict()
return Request(method="banChatSenderChat", data=data)

View file

@ -0,0 +1,28 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Dict, Union
from .base import Request, TelegramMethod
if TYPE_CHECKING:
from ..client.bot import Bot
class UnbanChatSenderChat(TelegramMethod[bool]):
"""
Use this method to unban a previously banned channel chat in a supergroup or channel. The bot must be an administrator for this to work and must have the appropriate administrator rights. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#unbanchatsenderchat
"""
__returning__ = bool
chat_id: Union[int, str]
"""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"""
def build_request(self, bot: Bot) -> Request:
data: Dict[str, Any] = self.dict()
return Request(method="unbanChatSenderChat", data=data)