mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Added full support of Bot API 7.9 (#1560)
* Added full support of Bot API 7.9 * Added changelog * Try to fix towncrier * Fixed towncrier check
This commit is contained in:
parent
1c323ecc97
commit
c3a08664d3
48 changed files with 817 additions and 114 deletions
|
|
@ -14,6 +14,7 @@ from .close_general_forum_topic import CloseGeneralForumTopic
|
|||
from .copy_message import CopyMessage
|
||||
from .copy_messages import CopyMessages
|
||||
from .create_chat_invite_link import CreateChatInviteLink
|
||||
from .create_chat_subscription_invite_link import CreateChatSubscriptionInviteLink
|
||||
from .create_forum_topic import CreateForumTopic
|
||||
from .create_invoice_link import CreateInvoiceLink
|
||||
from .create_new_sticker_set import CreateNewStickerSet
|
||||
|
|
@ -28,6 +29,7 @@ from .delete_sticker_from_set import DeleteStickerFromSet
|
|||
from .delete_sticker_set import DeleteStickerSet
|
||||
from .delete_webhook import DeleteWebhook
|
||||
from .edit_chat_invite_link import EditChatInviteLink
|
||||
from .edit_chat_subscription_invite_link import EditChatSubscriptionInviteLink
|
||||
from .edit_forum_topic import EditForumTopic
|
||||
from .edit_general_forum_topic import EditGeneralForumTopic
|
||||
from .edit_message_caption import EditMessageCaption
|
||||
|
|
@ -140,6 +142,7 @@ __all__ = (
|
|||
"CopyMessage",
|
||||
"CopyMessages",
|
||||
"CreateChatInviteLink",
|
||||
"CreateChatSubscriptionInviteLink",
|
||||
"CreateForumTopic",
|
||||
"CreateInvoiceLink",
|
||||
"CreateNewStickerSet",
|
||||
|
|
@ -154,6 +157,7 @@ __all__ = (
|
|||
"DeleteStickerSet",
|
||||
"DeleteWebhook",
|
||||
"EditChatInviteLink",
|
||||
"EditChatSubscriptionInviteLink",
|
||||
"EditForumTopic",
|
||||
"EditGeneralForumTopic",
|
||||
"EditMessageCaption",
|
||||
|
|
|
|||
52
aiogram/methods/create_chat_subscription_invite_link.py
Normal file
52
aiogram/methods/create_chat_subscription_invite_link.py
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import datetime
|
||||
from typing import TYPE_CHECKING, Any, Optional, Union
|
||||
|
||||
from ..types import ChatInviteLink
|
||||
from .base import TelegramMethod
|
||||
|
||||
|
||||
class CreateChatSubscriptionInviteLink(TelegramMethod[ChatInviteLink]):
|
||||
"""
|
||||
Use this method to create a `subscription invite link <https://telegram.org/blog/superchannels-star-reactions-subscriptions#star-subscriptions>`_ for a channel chat. The bot must have the *can_invite_users* administrator rights. The link can be edited using the method :class:`aiogram.methods.edit_chat_subscription_invite_link.EditChatSubscriptionInviteLink` or revoked using the method :class:`aiogram.methods.revoke_chat_invite_link.RevokeChatInviteLink`. Returns the new invite link as a :class:`aiogram.types.chat_invite_link.ChatInviteLink` object.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#createchatsubscriptioninvitelink
|
||||
"""
|
||||
|
||||
__returning__ = ChatInviteLink
|
||||
__api_method__ = "createChatSubscriptionInviteLink"
|
||||
|
||||
chat_id: Union[int, str]
|
||||
"""Unique identifier for the target channel chat or username of the target channel (in the format :code:`@channelusername`)"""
|
||||
subscription_period: Union[datetime.datetime, datetime.timedelta, int]
|
||||
"""The number of seconds the subscription will be active for before the next payment. Currently, it must always be 2592000 (30 days)."""
|
||||
subscription_price: int
|
||||
"""The amount of Telegram Stars a user must pay initially and after each subsequent subscription period to be a member of the chat; 1-2500"""
|
||||
name: Optional[str] = None
|
||||
"""Invite link name; 0-32 characters"""
|
||||
|
||||
if TYPE_CHECKING:
|
||||
# DO NOT EDIT MANUALLY!!!
|
||||
# This section was auto-generated via `butcher`
|
||||
|
||||
def __init__(
|
||||
__pydantic__self__,
|
||||
*,
|
||||
chat_id: Union[int, str],
|
||||
subscription_period: Union[datetime.datetime, datetime.timedelta, int],
|
||||
subscription_price: int,
|
||||
name: Optional[str] = None,
|
||||
**__pydantic_kwargs: Any,
|
||||
) -> None:
|
||||
# DO NOT EDIT MANUALLY!!!
|
||||
# This method was auto-generated via `butcher`
|
||||
# Is needed only for type checking and IDE support without any additional plugins
|
||||
|
||||
super().__init__(
|
||||
chat_id=chat_id,
|
||||
subscription_period=subscription_period,
|
||||
subscription_price=subscription_price,
|
||||
name=name,
|
||||
**__pydantic_kwargs,
|
||||
)
|
||||
44
aiogram/methods/edit_chat_subscription_invite_link.py
Normal file
44
aiogram/methods/edit_chat_subscription_invite_link.py
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING, Any, Optional, Union
|
||||
|
||||
from ..types import ChatInviteLink
|
||||
from .base import TelegramMethod
|
||||
|
||||
|
||||
class EditChatSubscriptionInviteLink(TelegramMethod[ChatInviteLink]):
|
||||
"""
|
||||
Use this method to edit a subscription invite link created by the bot. The bot must have the *can_invite_users* administrator rights. Returns the edited invite link as a :class:`aiogram.types.chat_invite_link.ChatInviteLink` object.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#editchatsubscriptioninvitelink
|
||||
"""
|
||||
|
||||
__returning__ = ChatInviteLink
|
||||
__api_method__ = "editChatSubscriptionInviteLink"
|
||||
|
||||
chat_id: Union[int, str]
|
||||
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
|
||||
invite_link: str
|
||||
"""The invite link to edit"""
|
||||
name: Optional[str] = None
|
||||
"""Invite link name; 0-32 characters"""
|
||||
|
||||
if TYPE_CHECKING:
|
||||
# DO NOT EDIT MANUALLY!!!
|
||||
# This section was auto-generated via `butcher`
|
||||
|
||||
def __init__(
|
||||
__pydantic__self__,
|
||||
*,
|
||||
chat_id: Union[int, str],
|
||||
invite_link: str,
|
||||
name: Optional[str] = None,
|
||||
**__pydantic_kwargs: Any,
|
||||
) -> None:
|
||||
# DO NOT EDIT MANUALLY!!!
|
||||
# This method was auto-generated via `butcher`
|
||||
# Is needed only for type checking and IDE support without any additional plugins
|
||||
|
||||
super().__init__(
|
||||
chat_id=chat_id, invite_link=invite_link, name=name, **__pydantic_kwargs
|
||||
)
|
||||
|
|
@ -7,7 +7,7 @@ from .base import TelegramMethod
|
|||
|
||||
class EditForumTopic(TelegramMethod[bool]):
|
||||
"""
|
||||
Use this method to edit name and icon of a 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, unless it is the creator of the topic. Returns :code:`True` on success.
|
||||
Use this method to edit name and icon of a 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, unless it is the creator of the topic. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#editforumtopic
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ from .base import TelegramMethod
|
|||
|
||||
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.
|
||||
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 the *can_manage_topics* administrator rights. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#editgeneralforumtopic
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ from .base import TelegramMethod
|
|||
|
||||
class SendPaidMedia(TelegramMethod[Message]):
|
||||
"""
|
||||
Use this method to send paid media to channel chats. On success, the sent :class:`aiogram.types.message.Message` is returned.
|
||||
Use this method to send paid media. On success, the sent :class:`aiogram.types.message.Message` is returned.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#sendpaidmedia
|
||||
"""
|
||||
|
|
@ -27,11 +27,13 @@ class SendPaidMedia(TelegramMethod[Message]):
|
|||
__api_method__ = "sendPaidMedia"
|
||||
|
||||
chat_id: Union[int, str]
|
||||
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
|
||||
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`). If the chat is a channel, all Telegram Star proceeds from this media will be credited to the chat's balance. Otherwise, they will be credited to the bot's balance."""
|
||||
star_count: int
|
||||
"""The number of Telegram Stars that must be paid to buy access to the media"""
|
||||
media: List[Union[InputPaidMediaPhoto, InputPaidMediaVideo]]
|
||||
"""A JSON-serialized array describing the media to be sent; up to 10 items"""
|
||||
business_connection_id: Optional[str] = None
|
||||
"""Unique identifier of the business connection on behalf of which the message will be sent"""
|
||||
caption: Optional[str] = None
|
||||
"""Media caption, 0-1024 characters after entities parsing"""
|
||||
parse_mode: Optional[str] = None
|
||||
|
|
@ -61,6 +63,7 @@ class SendPaidMedia(TelegramMethod[Message]):
|
|||
chat_id: Union[int, str],
|
||||
star_count: int,
|
||||
media: List[Union[InputPaidMediaPhoto, InputPaidMediaVideo]],
|
||||
business_connection_id: Optional[str] = None,
|
||||
caption: Optional[str] = None,
|
||||
parse_mode: Optional[str] = None,
|
||||
caption_entities: Optional[List[MessageEntity]] = None,
|
||||
|
|
@ -81,6 +84,7 @@ class SendPaidMedia(TelegramMethod[Message]):
|
|||
chat_id=chat_id,
|
||||
star_count=star_count,
|
||||
media=media,
|
||||
business_connection_id=business_connection_id,
|
||||
caption=caption,
|
||||
parse_mode=parse_mode,
|
||||
caption_entities=caption_entities,
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
from typing import TYPE_CHECKING, Any, List, Optional, Union
|
||||
|
||||
from ..types import ReactionTypeCustomEmoji, ReactionTypeEmoji
|
||||
from ..types import ReactionTypeCustomEmoji, ReactionTypeEmoji, ReactionTypePaid
|
||||
from .base import TelegramMethod
|
||||
|
||||
|
||||
class SetMessageReaction(TelegramMethod[bool]):
|
||||
"""
|
||||
Use this method to change the chosen reactions on a message. Service messages can't be reacted to. Automatically forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel. Returns :code:`True` on success.
|
||||
Use this method to change the chosen reactions on a message. Service messages can't be reacted to. Automatically forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel. Bots can't use paid reactions. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#setmessagereaction
|
||||
"""
|
||||
|
|
@ -18,8 +18,10 @@ class SetMessageReaction(TelegramMethod[bool]):
|
|||
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
|
||||
message_id: int
|
||||
"""Identifier of the target message. If the message belongs to a media group, the reaction is set to the first non-deleted message in the group instead."""
|
||||
reaction: Optional[List[Union[ReactionTypeEmoji, ReactionTypeCustomEmoji]]] = None
|
||||
"""A JSON-serialized list of reaction types to set on the message. Currently, as non-premium users, bots can set up to one reaction per message. A custom emoji reaction can be used if it is either already present on the message or explicitly allowed by chat administrators."""
|
||||
reaction: Optional[
|
||||
List[Union[ReactionTypeEmoji, ReactionTypeCustomEmoji, ReactionTypePaid]]
|
||||
] = None
|
||||
"""A JSON-serialized list of reaction types to set on the message. Currently, as non-premium users, bots can set up to one reaction per message. A custom emoji reaction can be used if it is either already present on the message or explicitly allowed by chat administrators. Paid reactions can't be used by bots."""
|
||||
is_big: Optional[bool] = None
|
||||
"""Pass :code:`True` to set the reaction with a big animation"""
|
||||
|
||||
|
|
@ -32,7 +34,9 @@ class SetMessageReaction(TelegramMethod[bool]):
|
|||
*,
|
||||
chat_id: Union[int, str],
|
||||
message_id: int,
|
||||
reaction: Optional[List[Union[ReactionTypeEmoji, ReactionTypeCustomEmoji]]] = None,
|
||||
reaction: Optional[
|
||||
List[Union[ReactionTypeEmoji, ReactionTypeCustomEmoji, ReactionTypePaid]]
|
||||
] = None,
|
||||
is_big: Optional[bool] = None,
|
||||
**__pydantic_kwargs: Any,
|
||||
) -> None:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue