mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Added full support of Bot API 6.4 (#1088)
* Remove warnings about pytest asyncio mode * Update Bot API to 6.4 * Bump version * Added changelog * Update translations
This commit is contained in:
parent
b93b75804c
commit
730485e43a
239 changed files with 2522 additions and 892 deletions
|
|
@ -10,6 +10,7 @@ from .ban_chat_sender_chat import BanChatSenderChat
|
|||
from .base import Request, Response, TelegramMethod
|
||||
from .close import Close
|
||||
from .close_forum_topic import CloseForumTopic
|
||||
from .close_general_forum_topic import CloseGeneralForumTopic
|
||||
from .copy_message import CopyMessage
|
||||
from .create_chat_invite_link import CreateChatInviteLink
|
||||
from .create_forum_topic import CreateForumTopic
|
||||
|
|
@ -25,6 +26,7 @@ from .delete_sticker_from_set import DeleteStickerFromSet
|
|||
from .delete_webhook import DeleteWebhook
|
||||
from .edit_chat_invite_link import EditChatInviteLink
|
||||
from .edit_forum_topic import EditForumTopic
|
||||
from .edit_general_forum_topic import EditGeneralForumTopic
|
||||
from .edit_message_caption import EditMessageCaption
|
||||
from .edit_message_live_location import EditMessageLiveLocation
|
||||
from .edit_message_media import EditMessageMedia
|
||||
|
|
@ -48,11 +50,13 @@ from .get_sticker_set import GetStickerSet
|
|||
from .get_updates import GetUpdates
|
||||
from .get_user_profile_photos import GetUserProfilePhotos
|
||||
from .get_webhook_info import GetWebhookInfo
|
||||
from .hide_general_forum_topic import HideGeneralForumTopic
|
||||
from .leave_chat import LeaveChat
|
||||
from .log_out import LogOut
|
||||
from .pin_chat_message import PinChatMessage
|
||||
from .promote_chat_member import PromoteChatMember
|
||||
from .reopen_forum_topic import ReopenForumTopic
|
||||
from .reopen_general_forum_topic import ReopenGeneralForumTopic
|
||||
from .restrict_chat_member import RestrictChatMember
|
||||
from .revoke_chat_invite_link import RevokeChatInviteLink
|
||||
from .send_animation import SendAnimation
|
||||
|
|
@ -91,109 +95,115 @@ 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 .unhide_general_forum_topic import UnhideGeneralForumTopic
|
||||
from .unpin_all_chat_messages import UnpinAllChatMessages
|
||||
from .unpin_all_forum_topic_messages import UnpinAllForumTopicMessages
|
||||
from .unpin_chat_message import UnpinChatMessage
|
||||
from .upload_sticker_file import UploadStickerFile
|
||||
|
||||
__all__ = (
|
||||
"TelegramMethod",
|
||||
"Request",
|
||||
"Response",
|
||||
"GetUpdates",
|
||||
"SetWebhook",
|
||||
"DeleteWebhook",
|
||||
"GetWebhookInfo",
|
||||
"GetMe",
|
||||
"LogOut",
|
||||
"Close",
|
||||
"SendMessage",
|
||||
"ForwardMessage",
|
||||
"CopyMessage",
|
||||
"SendPhoto",
|
||||
"SendAudio",
|
||||
"SendDocument",
|
||||
"SendVideo",
|
||||
"SendAnimation",
|
||||
"SendVoice",
|
||||
"SendVideoNote",
|
||||
"SendMediaGroup",
|
||||
"SendLocation",
|
||||
"EditMessageLiveLocation",
|
||||
"StopMessageLiveLocation",
|
||||
"SendVenue",
|
||||
"SendContact",
|
||||
"SendPoll",
|
||||
"SendDice",
|
||||
"SendChatAction",
|
||||
"GetUserProfilePhotos",
|
||||
"GetFile",
|
||||
"BanChatMember",
|
||||
"UnbanChatMember",
|
||||
"RestrictChatMember",
|
||||
"PromoteChatMember",
|
||||
"SetChatAdministratorCustomTitle",
|
||||
"BanChatSenderChat",
|
||||
"UnbanChatSenderChat",
|
||||
"SetChatPermissions",
|
||||
"ExportChatInviteLink",
|
||||
"CreateChatInviteLink",
|
||||
"EditChatInviteLink",
|
||||
"RevokeChatInviteLink",
|
||||
"ApproveChatJoinRequest",
|
||||
"DeclineChatJoinRequest",
|
||||
"SetChatPhoto",
|
||||
"DeleteChatPhoto",
|
||||
"SetChatTitle",
|
||||
"SetChatDescription",
|
||||
"PinChatMessage",
|
||||
"UnpinChatMessage",
|
||||
"UnpinAllChatMessages",
|
||||
"LeaveChat",
|
||||
"GetChat",
|
||||
"GetChatAdministrators",
|
||||
"GetChatMemberCount",
|
||||
"GetChatMember",
|
||||
"SetChatStickerSet",
|
||||
"DeleteChatStickerSet",
|
||||
"GetForumTopicIconStickers",
|
||||
"CreateForumTopic",
|
||||
"EditForumTopic",
|
||||
"CloseForumTopic",
|
||||
"ReopenForumTopic",
|
||||
"DeleteForumTopic",
|
||||
"UnpinAllForumTopicMessages",
|
||||
"AddStickerToSet",
|
||||
"AnswerCallbackQuery",
|
||||
"SetMyCommands",
|
||||
"AnswerInlineQuery",
|
||||
"AnswerPreCheckoutQuery",
|
||||
"AnswerShippingQuery",
|
||||
"AnswerWebAppQuery",
|
||||
"ApproveChatJoinRequest",
|
||||
"BanChatMember",
|
||||
"BanChatSenderChat",
|
||||
"Close",
|
||||
"CloseForumTopic",
|
||||
"CloseGeneralForumTopic",
|
||||
"CopyMessage",
|
||||
"CreateChatInviteLink",
|
||||
"CreateForumTopic",
|
||||
"CreateInvoiceLink",
|
||||
"CreateNewStickerSet",
|
||||
"DeclineChatJoinRequest",
|
||||
"DeleteChatPhoto",
|
||||
"DeleteChatStickerSet",
|
||||
"DeleteForumTopic",
|
||||
"DeleteMessage",
|
||||
"DeleteMyCommands",
|
||||
"GetMyCommands",
|
||||
"SetChatMenuButton",
|
||||
"GetChatMenuButton",
|
||||
"SetMyDefaultAdministratorRights",
|
||||
"GetMyDefaultAdministratorRights",
|
||||
"EditMessageText",
|
||||
"DeleteStickerFromSet",
|
||||
"DeleteWebhook",
|
||||
"EditChatInviteLink",
|
||||
"EditForumTopic",
|
||||
"EditGeneralForumTopic",
|
||||
"EditMessageCaption",
|
||||
"EditMessageLiveLocation",
|
||||
"EditMessageMedia",
|
||||
"EditMessageReplyMarkup",
|
||||
"StopPoll",
|
||||
"DeleteMessage",
|
||||
"SendSticker",
|
||||
"GetStickerSet",
|
||||
"EditMessageText",
|
||||
"ExportChatInviteLink",
|
||||
"ForwardMessage",
|
||||
"GetChat",
|
||||
"GetChatAdministrators",
|
||||
"GetChatMember",
|
||||
"GetChatMemberCount",
|
||||
"GetChatMenuButton",
|
||||
"GetCustomEmojiStickers",
|
||||
"UploadStickerFile",
|
||||
"CreateNewStickerSet",
|
||||
"AddStickerToSet",
|
||||
"SetStickerPositionInSet",
|
||||
"DeleteStickerFromSet",
|
||||
"SetStickerSetThumb",
|
||||
"AnswerInlineQuery",
|
||||
"AnswerWebAppQuery",
|
||||
"SendInvoice",
|
||||
"CreateInvoiceLink",
|
||||
"AnswerShippingQuery",
|
||||
"AnswerPreCheckoutQuery",
|
||||
"SetPassportDataErrors",
|
||||
"SendGame",
|
||||
"SetGameScore",
|
||||
"GetFile",
|
||||
"GetForumTopicIconStickers",
|
||||
"GetGameHighScores",
|
||||
"GetMe",
|
||||
"GetMyCommands",
|
||||
"GetMyDefaultAdministratorRights",
|
||||
"GetStickerSet",
|
||||
"GetUpdates",
|
||||
"GetUserProfilePhotos",
|
||||
"GetWebhookInfo",
|
||||
"HideGeneralForumTopic",
|
||||
"LeaveChat",
|
||||
"LogOut",
|
||||
"PinChatMessage",
|
||||
"PromoteChatMember",
|
||||
"ReopenForumTopic",
|
||||
"ReopenGeneralForumTopic",
|
||||
"Request",
|
||||
"Response",
|
||||
"RestrictChatMember",
|
||||
"RevokeChatInviteLink",
|
||||
"SendAnimation",
|
||||
"SendAudio",
|
||||
"SendChatAction",
|
||||
"SendContact",
|
||||
"SendDice",
|
||||
"SendDocument",
|
||||
"SendGame",
|
||||
"SendInvoice",
|
||||
"SendLocation",
|
||||
"SendMediaGroup",
|
||||
"SendMessage",
|
||||
"SendPhoto",
|
||||
"SendPoll",
|
||||
"SendSticker",
|
||||
"SendVenue",
|
||||
"SendVideo",
|
||||
"SendVideoNote",
|
||||
"SendVoice",
|
||||
"SetChatAdministratorCustomTitle",
|
||||
"SetChatDescription",
|
||||
"SetChatMenuButton",
|
||||
"SetChatPermissions",
|
||||
"SetChatPhoto",
|
||||
"SetChatStickerSet",
|
||||
"SetChatTitle",
|
||||
"SetGameScore",
|
||||
"SetMyCommands",
|
||||
"SetMyDefaultAdministratorRights",
|
||||
"SetPassportDataErrors",
|
||||
"SetStickerPositionInSet",
|
||||
"SetStickerSetThumb",
|
||||
"SetWebhook",
|
||||
"StopMessageLiveLocation",
|
||||
"StopPoll",
|
||||
"TelegramMethod",
|
||||
"UnbanChatMember",
|
||||
"UnbanChatSenderChat",
|
||||
"UnhideGeneralForumTopic",
|
||||
"UnpinAllChatMessages",
|
||||
"UnpinAllForumTopicMessages",
|
||||
"UnpinChatMessage",
|
||||
"UploadStickerFile",
|
||||
)
|
||||
|
|
|
|||
26
aiogram/methods/close_general_forum_topic.py
Normal file
26
aiogram/methods/close_general_forum_topic.py
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
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 CloseGeneralForumTopic(TelegramMethod[bool]):
|
||||
"""
|
||||
Use this method to close an open 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the *can_manage_topics* administrator rights. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#closegeneralforumtopic
|
||||
"""
|
||||
|
||||
__returning__ = bool
|
||||
|
||||
chat_id: Union[int, str]
|
||||
"""Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)"""
|
||||
|
||||
def build_request(self, bot: Bot) -> Request:
|
||||
data: Dict[str, Any] = self.dict()
|
||||
|
||||
return Request(method="closeGeneralForumTopic", data=data)
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING, Any, Dict, Union
|
||||
from typing import TYPE_CHECKING, Any, Dict, Optional, Union
|
||||
|
||||
from .base import Request, TelegramMethod
|
||||
|
||||
|
|
@ -21,10 +21,10 @@ class EditForumTopic(TelegramMethod[bool]):
|
|||
"""Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)"""
|
||||
message_thread_id: int
|
||||
"""Unique identifier for the target message thread of the forum topic"""
|
||||
name: str
|
||||
"""New topic name, 1-128 characters"""
|
||||
icon_custom_emoji_id: str
|
||||
"""New unique identifier of the custom emoji shown as the topic icon. Use :class:`aiogram.methods.get_forum_topic_icon_stickers.GetForumTopicIconStickers` to get all allowed custom emoji identifiers."""
|
||||
name: Optional[str] = None
|
||||
"""New topic name, 0-128 characters. If not specififed or empty, the current name of the topic will be kept"""
|
||||
icon_custom_emoji_id: Optional[str] = None
|
||||
"""New unique identifier of the custom emoji shown as the topic icon. Use :class:`aiogram.methods.get_forum_topic_icon_stickers.GetForumTopicIconStickers` to get all allowed custom emoji identifiers. Pass an empty string to remove the icon. If not specified, the current icon will be kept"""
|
||||
|
||||
def build_request(self, bot: Bot) -> Request:
|
||||
data: Dict[str, Any] = self.dict()
|
||||
|
|
|
|||
28
aiogram/methods/edit_general_forum_topic.py
Normal file
28
aiogram/methods/edit_general_forum_topic.py
Normal 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 EditGeneralForumTopic(TelegramMethod[bool]):
|
||||
"""
|
||||
Use this method to edit the name of the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have *can_manage_topics* administrator rights. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#editgeneralforumtopic
|
||||
"""
|
||||
|
||||
__returning__ = bool
|
||||
|
||||
chat_id: Union[int, str]
|
||||
"""Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)"""
|
||||
name: str
|
||||
"""New topic name, 1-128 characters"""
|
||||
|
||||
def build_request(self, bot: Bot) -> Request:
|
||||
data: Dict[str, Any] = self.dict()
|
||||
|
||||
return Request(method="editGeneralForumTopic", data=data)
|
||||
|
|
@ -29,7 +29,7 @@ class GetChatMember(
|
|||
]
|
||||
):
|
||||
"""
|
||||
Use this method to get information about a member of a chat. Returns a :class:`aiogram.types.chat_member.ChatMember` object on success.
|
||||
Use this method to get information about a member of a chat. The method is guaranteed to work only if the bot is an administrator in the chat. Returns a :class:`aiogram.types.chat_member.ChatMember` object on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#getchatmember
|
||||
"""
|
||||
|
|
|
|||
26
aiogram/methods/hide_general_forum_topic.py
Normal file
26
aiogram/methods/hide_general_forum_topic.py
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
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 HideGeneralForumTopic(TelegramMethod[bool]):
|
||||
"""
|
||||
Use this method to hide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the *can_manage_topics* administrator rights. The topic will be automatically closed if it was open. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#hidegeneralforumtopic
|
||||
"""
|
||||
|
||||
__returning__ = bool
|
||||
|
||||
chat_id: Union[int, str]
|
||||
"""Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)"""
|
||||
|
||||
def build_request(self, bot: Bot) -> Request:
|
||||
data: Dict[str, Any] = self.dict()
|
||||
|
||||
return Request(method="hideGeneralForumTopic", data=data)
|
||||
26
aiogram/methods/reopen_general_forum_topic.py
Normal file
26
aiogram/methods/reopen_general_forum_topic.py
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
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 ReopenGeneralForumTopic(TelegramMethod[bool]):
|
||||
"""
|
||||
Use this method to reopen a closed 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the *can_manage_topics* administrator rights. The topic will be automatically unhidden if it was hidden. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#reopengeneralforumtopic
|
||||
"""
|
||||
|
||||
__returning__ = bool
|
||||
|
||||
chat_id: Union[int, str]
|
||||
"""Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)"""
|
||||
|
||||
def build_request(self, bot: Bot) -> Request:
|
||||
data: Dict[str, Any] = self.dict()
|
||||
|
||||
return Request(method="reopenGeneralForumTopic", data=data)
|
||||
|
|
@ -47,6 +47,8 @@ class SendAnimation(TelegramMethod[Message]):
|
|||
"""Mode for parsing entities in the animation caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details."""
|
||||
caption_entities: Optional[List[MessageEntity]] = None
|
||||
"""A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*"""
|
||||
has_spoiler: Optional[bool] = None
|
||||
"""Pass :code:`True` if the animation needs to be covered with a spoiler animation"""
|
||||
disable_notification: Optional[bool] = None
|
||||
"""Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
|
||||
protect_content: Optional[bool] = None
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING, Any, Dict, Union
|
||||
from typing import TYPE_CHECKING, Any, Dict, Optional, Union
|
||||
|
||||
from .base import Request, TelegramMethod
|
||||
|
||||
|
|
@ -25,6 +25,8 @@ class SendChatAction(TelegramMethod[bool]):
|
|||
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
|
||||
action: str
|
||||
"""Type of action to broadcast. Choose one, depending on what the user is about to receive: *typing* for `text messages <https://core.telegram.org/bots/api#sendmessage>`_, *upload_photo* for `photos <https://core.telegram.org/bots/api#sendphoto>`_, *record_video* or *upload_video* for `videos <https://core.telegram.org/bots/api#sendvideo>`_, *record_voice* or *upload_voice* for `voice notes <https://core.telegram.org/bots/api#sendvoice>`_, *upload_document* for `general files <https://core.telegram.org/bots/api#senddocument>`_, *choose_sticker* for `stickers <https://core.telegram.org/bots/api#sendsticker>`_, *find_location* for `location data <https://core.telegram.org/bots/api#sendlocation>`_, *record_video_note* or *upload_video_note* for `video notes <https://core.telegram.org/bots/api#sendvideonote>`_."""
|
||||
message_thread_id: Optional[int] = None
|
||||
"""Unique identifier for the target message thread; supergroups only"""
|
||||
|
||||
def build_request(self, bot: Bot) -> Request:
|
||||
data: Dict[str, Any] = self.dict()
|
||||
|
|
|
|||
|
|
@ -39,6 +39,8 @@ class SendPhoto(TelegramMethod[Message]):
|
|||
"""Mode for parsing entities in the photo caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details."""
|
||||
caption_entities: Optional[List[MessageEntity]] = None
|
||||
"""A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*"""
|
||||
has_spoiler: Optional[bool] = None
|
||||
"""Pass :code:`True` if the photo needs to be covered with a spoiler animation"""
|
||||
disable_notification: Optional[bool] = None
|
||||
"""Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
|
||||
protect_content: Optional[bool] = None
|
||||
|
|
|
|||
|
|
@ -47,6 +47,8 @@ class SendVideo(TelegramMethod[Message]):
|
|||
"""Mode for parsing entities in the video caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details."""
|
||||
caption_entities: Optional[List[MessageEntity]] = None
|
||||
"""A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*"""
|
||||
has_spoiler: Optional[bool] = None
|
||||
"""Pass :code:`True` if the video needs to be covered with a spoiler animation"""
|
||||
supports_streaming: Optional[bool] = None
|
||||
"""Pass :code:`True` if the uploaded video is suitable for streaming"""
|
||||
disable_notification: Optional[bool] = None
|
||||
|
|
|
|||
26
aiogram/methods/unhide_general_forum_topic.py
Normal file
26
aiogram/methods/unhide_general_forum_topic.py
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
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 UnhideGeneralForumTopic(TelegramMethod[bool]):
|
||||
"""
|
||||
Use this method to unhide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the *can_manage_topics* administrator rights. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#unhidegeneralforumtopic
|
||||
"""
|
||||
|
||||
__returning__ = bool
|
||||
|
||||
chat_id: Union[int, str]
|
||||
"""Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)"""
|
||||
|
||||
def build_request(self, bot: Bot) -> Request:
|
||||
data: Dict[str, Any] = self.dict()
|
||||
|
||||
return Request(method="unhideGeneralForumTopic", data=data)
|
||||
Loading…
Add table
Add a link
Reference in a new issue