mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Added full support of Telegram Bot API 9.3 (#1747)
* Added full support of Telegram Bot API 9.3 * Fixed tests that fails * Add tests for `GetChatGifts`, `GetUserGifts`, `RepostStory`, and `SendMessageDraft` methods * Added changelog record
This commit is contained in:
parent
ce4ddb77f4
commit
dcff0f99c7
132 changed files with 2993 additions and 457 deletions
|
|
@ -54,6 +54,7 @@ from .get_business_account_star_balance import GetBusinessAccountStarBalance
|
|||
from .get_business_connection import GetBusinessConnection
|
||||
from .get_chat import GetChat
|
||||
from .get_chat_administrators import GetChatAdministrators
|
||||
from .get_chat_gifts import GetChatGifts
|
||||
from .get_chat_member import GetChatMember
|
||||
from .get_chat_member_count import GetChatMemberCount
|
||||
from .get_chat_menu_button import GetChatMenuButton
|
||||
|
|
@ -72,6 +73,7 @@ from .get_star_transactions import GetStarTransactions
|
|||
from .get_sticker_set import GetStickerSet
|
||||
from .get_updates import GetUpdates
|
||||
from .get_user_chat_boosts import GetUserChatBoosts
|
||||
from .get_user_gifts import GetUserGifts
|
||||
from .get_user_profile_photos import GetUserProfilePhotos
|
||||
from .get_webhook_info import GetWebhookInfo
|
||||
from .gift_premium_subscription import GiftPremiumSubscription
|
||||
|
|
@ -89,6 +91,7 @@ from .remove_user_verification import RemoveUserVerification
|
|||
from .reopen_forum_topic import ReopenForumTopic
|
||||
from .reopen_general_forum_topic import ReopenGeneralForumTopic
|
||||
from .replace_sticker_in_set import ReplaceStickerInSet
|
||||
from .repost_story import RepostStory
|
||||
from .restrict_chat_member import RestrictChatMember
|
||||
from .revoke_chat_invite_link import RevokeChatInviteLink
|
||||
from .save_prepared_inline_message import SavePreparedInlineMessage
|
||||
|
|
@ -105,6 +108,7 @@ from .send_invoice import SendInvoice
|
|||
from .send_location import SendLocation
|
||||
from .send_media_group import SendMediaGroup
|
||||
from .send_message import SendMessage
|
||||
from .send_message_draft import SendMessageDraft
|
||||
from .send_paid_media import SendPaidMedia
|
||||
from .send_photo import SendPhoto
|
||||
from .send_poll import SendPoll
|
||||
|
|
@ -214,6 +218,7 @@ __all__ = (
|
|||
"GetBusinessConnection",
|
||||
"GetChat",
|
||||
"GetChatAdministrators",
|
||||
"GetChatGifts",
|
||||
"GetChatMember",
|
||||
"GetChatMemberCount",
|
||||
"GetChatMenuButton",
|
||||
|
|
@ -232,6 +237,7 @@ __all__ = (
|
|||
"GetStickerSet",
|
||||
"GetUpdates",
|
||||
"GetUserChatBoosts",
|
||||
"GetUserGifts",
|
||||
"GetUserProfilePhotos",
|
||||
"GetWebhookInfo",
|
||||
"GiftPremiumSubscription",
|
||||
|
|
@ -249,6 +255,7 @@ __all__ = (
|
|||
"ReopenForumTopic",
|
||||
"ReopenGeneralForumTopic",
|
||||
"ReplaceStickerInSet",
|
||||
"RepostStory",
|
||||
"Request",
|
||||
"Response",
|
||||
"RestrictChatMember",
|
||||
|
|
@ -267,6 +274,7 @@ __all__ = (
|
|||
"SendLocation",
|
||||
"SendMediaGroup",
|
||||
"SendMessage",
|
||||
"SendMessageDraft",
|
||||
"SendPaidMedia",
|
||||
"SendPhoto",
|
||||
"SendPoll",
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class CopyMessage(TelegramMethod[MessageId]):
|
|||
message_id: int
|
||||
"""Message identifier in the chat specified in *from_chat_id*"""
|
||||
message_thread_id: Optional[int] = None
|
||||
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
|
||||
"""Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"""
|
||||
direct_messages_topic_id: Optional[int] = None
|
||||
"""Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"""
|
||||
video_start_timestamp: Optional[DateTimeUnion] = None
|
||||
|
|
@ -53,6 +53,8 @@ class CopyMessage(TelegramMethod[MessageId]):
|
|||
"""Protects the contents of the sent message from forwarding and saving"""
|
||||
allow_paid_broadcast: Optional[bool] = None
|
||||
"""Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"""
|
||||
message_effect_id: Optional[str] = None
|
||||
"""Unique identifier of the message effect to be added to the message; only available when copying to private chats"""
|
||||
suggested_post_parameters: Optional[SuggestedPostParameters] = None
|
||||
"""A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."""
|
||||
reply_parameters: Optional[ReplyParameters] = None
|
||||
|
|
@ -94,6 +96,7 @@ class CopyMessage(TelegramMethod[MessageId]):
|
|||
disable_notification: Optional[bool] = None,
|
||||
protect_content: Optional[Union[bool, Default]] = Default("protect_content"),
|
||||
allow_paid_broadcast: Optional[bool] = None,
|
||||
message_effect_id: Optional[str] = None,
|
||||
suggested_post_parameters: Optional[SuggestedPostParameters] = None,
|
||||
reply_parameters: Optional[ReplyParameters] = None,
|
||||
reply_markup: Optional[ReplyMarkupUnion] = None,
|
||||
|
|
@ -119,6 +122,7 @@ class CopyMessage(TelegramMethod[MessageId]):
|
|||
disable_notification=disable_notification,
|
||||
protect_content=protect_content,
|
||||
allow_paid_broadcast=allow_paid_broadcast,
|
||||
message_effect_id=message_effect_id,
|
||||
suggested_post_parameters=suggested_post_parameters,
|
||||
reply_parameters=reply_parameters,
|
||||
reply_markup=reply_markup,
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class CopyMessages(TelegramMethod[list[MessageId]]):
|
|||
message_ids: list[int]
|
||||
"""A JSON-serialized list of 1-100 identifiers of messages in the chat *from_chat_id* to copy. The identifiers must be specified in a strictly increasing order."""
|
||||
message_thread_id: Optional[int] = None
|
||||
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
|
||||
"""Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"""
|
||||
direct_messages_topic_id: Optional[int] = None
|
||||
"""Identifier of the direct messages topic to which the messages will be sent; required if the messages are sent to a direct messages chat"""
|
||||
disable_notification: Optional[bool] = None
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ from .base import TelegramMethod
|
|||
|
||||
class DeleteForumTopic(TelegramMethod[bool]):
|
||||
"""
|
||||
Use this method to delete a forum topic along with all its messages in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the *can_delete_messages* administrator rights. Returns :code:`True` on success.
|
||||
Use this method to delete a forum topic along with all its messages in a forum supergroup chat or a private chat with a user. In the case of a supergroup chat the bot must be an administrator in the chat for this to work and must have the *can_delete_messages* administrator rights. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#deleteforumtopic
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -8,7 +8,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 the *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 or a private chat with a user. In the case of a 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
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ class ForwardMessage(TelegramMethod[Message]):
|
|||
message_id: int
|
||||
"""Message identifier in the chat specified in *from_chat_id*"""
|
||||
message_thread_id: Optional[int] = None
|
||||
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
|
||||
"""Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"""
|
||||
direct_messages_topic_id: Optional[int] = None
|
||||
"""Identifier of the direct messages topic to which the message will be forwarded; required if the message is forwarded to a direct messages chat"""
|
||||
video_start_timestamp: Optional[DateTimeUnion] = None
|
||||
|
|
@ -33,6 +33,8 @@ class ForwardMessage(TelegramMethod[Message]):
|
|||
"""Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
|
||||
protect_content: Optional[Union[bool, Default]] = Default("protect_content")
|
||||
"""Protects the contents of the forwarded message from forwarding and saving"""
|
||||
message_effect_id: Optional[str] = None
|
||||
"""Unique identifier of the message effect to be added to the message; only available when forwarding to private chats"""
|
||||
suggested_post_parameters: Optional[SuggestedPostParameters] = None
|
||||
"""A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only"""
|
||||
|
||||
|
|
@ -51,6 +53,7 @@ class ForwardMessage(TelegramMethod[Message]):
|
|||
video_start_timestamp: Optional[DateTimeUnion] = None,
|
||||
disable_notification: Optional[bool] = None,
|
||||
protect_content: Optional[Union[bool, Default]] = Default("protect_content"),
|
||||
message_effect_id: Optional[str] = None,
|
||||
suggested_post_parameters: Optional[SuggestedPostParameters] = None,
|
||||
**__pydantic_kwargs: Any,
|
||||
) -> None:
|
||||
|
|
@ -67,6 +70,7 @@ class ForwardMessage(TelegramMethod[Message]):
|
|||
video_start_timestamp=video_start_timestamp,
|
||||
disable_notification=disable_notification,
|
||||
protect_content=protect_content,
|
||||
message_effect_id=message_effect_id,
|
||||
suggested_post_parameters=suggested_post_parameters,
|
||||
**__pydantic_kwargs,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class ForwardMessages(TelegramMethod[list[MessageId]]):
|
|||
message_ids: list[int]
|
||||
"""A JSON-serialized list of 1-100 identifiers of messages in the chat *from_chat_id* to forward. The identifiers must be specified in a strictly increasing order."""
|
||||
message_thread_id: Optional[int] = None
|
||||
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
|
||||
"""Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"""
|
||||
direct_messages_topic_id: Optional[int] = None
|
||||
"""Identifier of the direct messages topic to which the messages will be forwarded; required if the messages are forwarded to a direct messages chat"""
|
||||
disable_notification: Optional[bool] = None
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ from __future__ import annotations
|
|||
|
||||
from typing import TYPE_CHECKING, Any, Optional
|
||||
|
||||
from pydantic import Field
|
||||
|
||||
from ..types import OwnedGifts
|
||||
from .base import TelegramMethod
|
||||
|
||||
|
|
@ -24,16 +26,25 @@ class GetBusinessAccountGifts(TelegramMethod[OwnedGifts]):
|
|||
"""Pass :code:`True` to exclude gifts that are saved to the account's profile page"""
|
||||
exclude_unlimited: Optional[bool] = None
|
||||
"""Pass :code:`True` to exclude gifts that can be purchased an unlimited number of times"""
|
||||
exclude_limited: Optional[bool] = None
|
||||
"""Pass :code:`True` to exclude gifts that can be purchased a limited number of times"""
|
||||
exclude_limited_upgradable: Optional[bool] = None
|
||||
"""Pass :code:`True` to exclude gifts that can be purchased a limited number of times and can be upgraded to unique"""
|
||||
exclude_limited_non_upgradable: Optional[bool] = None
|
||||
"""Pass :code:`True` to exclude gifts that can be purchased a limited number of times and can't be upgraded to unique"""
|
||||
exclude_unique: Optional[bool] = None
|
||||
"""Pass :code:`True` to exclude unique gifts"""
|
||||
exclude_from_blockchain: Optional[bool] = None
|
||||
"""Pass :code:`True` to exclude gifts that were assigned from the TON blockchain and can't be resold or transferred in Telegram"""
|
||||
sort_by_price: Optional[bool] = None
|
||||
"""Pass :code:`True` to sort results by gift price instead of send date. Sorting is applied before pagination."""
|
||||
offset: Optional[str] = None
|
||||
"""Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results"""
|
||||
limit: Optional[int] = None
|
||||
"""The maximum number of gifts to be returned; 1-100. Defaults to 100"""
|
||||
exclude_limited: Optional[bool] = Field(None, json_schema_extra={"deprecated": True})
|
||||
"""Pass :code:`True` to exclude gifts that can be purchased a limited number of times
|
||||
|
||||
.. deprecated:: API:9.3
|
||||
https://core.telegram.org/bots/api-changelog#december-31-2025"""
|
||||
|
||||
if TYPE_CHECKING:
|
||||
# DO NOT EDIT MANUALLY!!!
|
||||
|
|
@ -46,11 +57,14 @@ class GetBusinessAccountGifts(TelegramMethod[OwnedGifts]):
|
|||
exclude_unsaved: Optional[bool] = None,
|
||||
exclude_saved: Optional[bool] = None,
|
||||
exclude_unlimited: Optional[bool] = None,
|
||||
exclude_limited: Optional[bool] = None,
|
||||
exclude_limited_upgradable: Optional[bool] = None,
|
||||
exclude_limited_non_upgradable: Optional[bool] = None,
|
||||
exclude_unique: Optional[bool] = None,
|
||||
exclude_from_blockchain: Optional[bool] = None,
|
||||
sort_by_price: Optional[bool] = None,
|
||||
offset: Optional[str] = None,
|
||||
limit: Optional[int] = None,
|
||||
exclude_limited: Optional[bool] = None,
|
||||
**__pydantic_kwargs: Any,
|
||||
) -> None:
|
||||
# DO NOT EDIT MANUALLY!!!
|
||||
|
|
@ -62,10 +76,13 @@ class GetBusinessAccountGifts(TelegramMethod[OwnedGifts]):
|
|||
exclude_unsaved=exclude_unsaved,
|
||||
exclude_saved=exclude_saved,
|
||||
exclude_unlimited=exclude_unlimited,
|
||||
exclude_limited=exclude_limited,
|
||||
exclude_limited_upgradable=exclude_limited_upgradable,
|
||||
exclude_limited_non_upgradable=exclude_limited_non_upgradable,
|
||||
exclude_unique=exclude_unique,
|
||||
exclude_from_blockchain=exclude_from_blockchain,
|
||||
sort_by_price=sort_by_price,
|
||||
offset=offset,
|
||||
limit=limit,
|
||||
exclude_limited=exclude_limited,
|
||||
**__pydantic_kwargs,
|
||||
)
|
||||
|
|
|
|||
79
aiogram/methods/get_chat_gifts.py
Normal file
79
aiogram/methods/get_chat_gifts.py
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING, Any, Optional
|
||||
|
||||
from ..types import ChatIdUnion, OwnedGifts
|
||||
from .base import TelegramMethod
|
||||
|
||||
|
||||
class GetChatGifts(TelegramMethod[OwnedGifts]):
|
||||
"""
|
||||
Returns the gifts owned by a chat. Returns :class:`aiogram.types.owned_gifts.OwnedGifts` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#getchatgifts
|
||||
"""
|
||||
|
||||
__returning__ = OwnedGifts
|
||||
__api_method__ = "getChatGifts"
|
||||
|
||||
chat_id: ChatIdUnion
|
||||
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
|
||||
exclude_unsaved: Optional[bool] = None
|
||||
"""Pass :code:`True` to exclude gifts that aren't saved to the chat's profile page. Always :code:`True`, unless the bot has the *can_post_messages* administrator right in the channel."""
|
||||
exclude_saved: Optional[bool] = None
|
||||
"""Pass :code:`True` to exclude gifts that are saved to the chat's profile page. Always :code:`False`, unless the bot has the *can_post_messages* administrator right in the channel."""
|
||||
exclude_unlimited: Optional[bool] = None
|
||||
"""Pass :code:`True` to exclude gifts that can be purchased an unlimited number of times"""
|
||||
exclude_limited_upgradable: Optional[bool] = None
|
||||
"""Pass :code:`True` to exclude gifts that can be purchased a limited number of times and can be upgraded to unique"""
|
||||
exclude_limited_non_upgradable: Optional[bool] = None
|
||||
"""Pass :code:`True` to exclude gifts that can be purchased a limited number of times and can't be upgraded to unique"""
|
||||
exclude_from_blockchain: Optional[bool] = None
|
||||
"""Pass :code:`True` to exclude gifts that were assigned from the TON blockchain and can't be resold or transferred in Telegram"""
|
||||
exclude_unique: Optional[bool] = None
|
||||
"""Pass :code:`True` to exclude unique gifts"""
|
||||
sort_by_price: Optional[bool] = None
|
||||
"""Pass :code:`True` to sort results by gift price instead of send date. Sorting is applied before pagination."""
|
||||
offset: Optional[str] = None
|
||||
"""Offset of the first entry to return as received from the previous request; use an empty string to get the first chunk of results"""
|
||||
limit: Optional[int] = None
|
||||
"""The maximum number of gifts to be returned; 1-100. Defaults to 100"""
|
||||
|
||||
if TYPE_CHECKING:
|
||||
# DO NOT EDIT MANUALLY!!!
|
||||
# This section was auto-generated via `butcher`
|
||||
|
||||
def __init__(
|
||||
__pydantic__self__,
|
||||
*,
|
||||
chat_id: ChatIdUnion,
|
||||
exclude_unsaved: Optional[bool] = None,
|
||||
exclude_saved: Optional[bool] = None,
|
||||
exclude_unlimited: Optional[bool] = None,
|
||||
exclude_limited_upgradable: Optional[bool] = None,
|
||||
exclude_limited_non_upgradable: Optional[bool] = None,
|
||||
exclude_from_blockchain: Optional[bool] = None,
|
||||
exclude_unique: Optional[bool] = None,
|
||||
sort_by_price: Optional[bool] = None,
|
||||
offset: Optional[str] = None,
|
||||
limit: Optional[int] = 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,
|
||||
exclude_unsaved=exclude_unsaved,
|
||||
exclude_saved=exclude_saved,
|
||||
exclude_unlimited=exclude_unlimited,
|
||||
exclude_limited_upgradable=exclude_limited_upgradable,
|
||||
exclude_limited_non_upgradable=exclude_limited_non_upgradable,
|
||||
exclude_from_blockchain=exclude_from_blockchain,
|
||||
exclude_unique=exclude_unique,
|
||||
sort_by_price=sort_by_price,
|
||||
offset=offset,
|
||||
limit=limit,
|
||||
**__pydantic_kwargs,
|
||||
)
|
||||
71
aiogram/methods/get_user_gifts.py
Normal file
71
aiogram/methods/get_user_gifts.py
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING, Any, Optional
|
||||
|
||||
from ..types import OwnedGifts
|
||||
from .base import TelegramMethod
|
||||
|
||||
|
||||
class GetUserGifts(TelegramMethod[OwnedGifts]):
|
||||
"""
|
||||
Returns the gifts owned and hosted by a user. Returns :class:`aiogram.types.owned_gifts.OwnedGifts` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#getusergifts
|
||||
"""
|
||||
|
||||
__returning__ = OwnedGifts
|
||||
__api_method__ = "getUserGifts"
|
||||
|
||||
user_id: int
|
||||
"""Unique identifier of the user"""
|
||||
exclude_unlimited: Optional[bool] = None
|
||||
"""Pass :code:`True` to exclude gifts that can be purchased an unlimited number of times"""
|
||||
exclude_limited_upgradable: Optional[bool] = None
|
||||
"""Pass :code:`True` to exclude gifts that can be purchased a limited number of times and can be upgraded to unique"""
|
||||
exclude_limited_non_upgradable: Optional[bool] = None
|
||||
"""Pass :code:`True` to exclude gifts that can be purchased a limited number of times and can't be upgraded to unique"""
|
||||
exclude_from_blockchain: Optional[bool] = None
|
||||
"""Pass :code:`True` to exclude gifts that were assigned from the TON blockchain and can't be resold or transferred in Telegram"""
|
||||
exclude_unique: Optional[bool] = None
|
||||
"""Pass :code:`True` to exclude unique gifts"""
|
||||
sort_by_price: Optional[bool] = None
|
||||
"""Pass :code:`True` to sort results by gift price instead of send date. Sorting is applied before pagination."""
|
||||
offset: Optional[str] = None
|
||||
"""Offset of the first entry to return as received from the previous request; use an empty string to get the first chunk of results"""
|
||||
limit: Optional[int] = None
|
||||
"""The maximum number of gifts to be returned; 1-100. Defaults to 100"""
|
||||
|
||||
if TYPE_CHECKING:
|
||||
# DO NOT EDIT MANUALLY!!!
|
||||
# This section was auto-generated via `butcher`
|
||||
|
||||
def __init__(
|
||||
__pydantic__self__,
|
||||
*,
|
||||
user_id: int,
|
||||
exclude_unlimited: Optional[bool] = None,
|
||||
exclude_limited_upgradable: Optional[bool] = None,
|
||||
exclude_limited_non_upgradable: Optional[bool] = None,
|
||||
exclude_from_blockchain: Optional[bool] = None,
|
||||
exclude_unique: Optional[bool] = None,
|
||||
sort_by_price: Optional[bool] = None,
|
||||
offset: Optional[str] = None,
|
||||
limit: Optional[int] = 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__(
|
||||
user_id=user_id,
|
||||
exclude_unlimited=exclude_unlimited,
|
||||
exclude_limited_upgradable=exclude_limited_upgradable,
|
||||
exclude_limited_non_upgradable=exclude_limited_non_upgradable,
|
||||
exclude_from_blockchain=exclude_from_blockchain,
|
||||
exclude_unique=exclude_unique,
|
||||
sort_by_price=sort_by_price,
|
||||
offset=offset,
|
||||
limit=limit,
|
||||
**__pydantic_kwargs,
|
||||
)
|
||||
|
|
@ -29,7 +29,7 @@ class PromoteChatMember(TelegramMethod[bool]):
|
|||
can_manage_video_chats: Optional[bool] = None
|
||||
"""Pass :code:`True` if the administrator can manage video chats"""
|
||||
can_restrict_members: Optional[bool] = None
|
||||
"""Pass :code:`True` if the administrator can restrict, ban or unban chat members, or access supergroup statistics"""
|
||||
"""Pass :code:`True` if the administrator can restrict, ban or unban chat members, or access supergroup statistics. For backward compatibility, defaults to :code:`True` for promotions of channel administrators"""
|
||||
can_promote_members: Optional[bool] = None
|
||||
"""Pass :code:`True` if the administrator can add new administrators with a subset of their own privileges or demote administrators that they have promoted, directly or indirectly (promoted by administrators that were appointed by him)"""
|
||||
can_change_info: Optional[bool] = None
|
||||
|
|
|
|||
59
aiogram/methods/repost_story.py
Normal file
59
aiogram/methods/repost_story.py
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING, Any, Optional
|
||||
|
||||
from ..types import Story
|
||||
from .base import TelegramMethod
|
||||
|
||||
|
||||
class RepostStory(TelegramMethod[Story]):
|
||||
"""
|
||||
Reposts a story on behalf of a business account from another business account. Both business accounts must be managed by the same bot, and the story on the source account must have been posted (or reposted) by the bot. Requires the *can_manage_stories* business bot right for both business accounts. Returns :class:`aiogram.types.story.Story` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#repoststory
|
||||
"""
|
||||
|
||||
__returning__ = Story
|
||||
__api_method__ = "repostStory"
|
||||
|
||||
business_connection_id: str
|
||||
"""Unique identifier of the business connection"""
|
||||
from_chat_id: int
|
||||
"""Unique identifier of the chat which posted the story that should be reposted"""
|
||||
from_story_id: int
|
||||
"""Unique identifier of the story that should be reposted"""
|
||||
active_period: int
|
||||
"""Period after which the story is moved to the archive, in seconds; must be one of :code:`6 * 3600`, :code:`12 * 3600`, :code:`86400`, or :code:`2 * 86400`"""
|
||||
post_to_chat_page: Optional[bool] = None
|
||||
"""Pass :code:`True` to keep the story accessible after it expires"""
|
||||
protect_content: Optional[bool] = None
|
||||
"""Pass :code:`True` if the content of the story must be protected from forwarding and screenshotting"""
|
||||
|
||||
if TYPE_CHECKING:
|
||||
# DO NOT EDIT MANUALLY!!!
|
||||
# This section was auto-generated via `butcher`
|
||||
|
||||
def __init__(
|
||||
__pydantic__self__,
|
||||
*,
|
||||
business_connection_id: str,
|
||||
from_chat_id: int,
|
||||
from_story_id: int,
|
||||
active_period: int,
|
||||
post_to_chat_page: Optional[bool] = None,
|
||||
protect_content: Optional[bool] = 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__(
|
||||
business_connection_id=business_connection_id,
|
||||
from_chat_id=from_chat_id,
|
||||
from_story_id=from_story_id,
|
||||
active_period=active_period,
|
||||
post_to_chat_page=post_to_chat_page,
|
||||
protect_content=protect_content,
|
||||
**__pydantic_kwargs,
|
||||
)
|
||||
|
|
@ -35,7 +35,7 @@ class SendAnimation(TelegramMethod[Message]):
|
|||
business_connection_id: Optional[str] = None
|
||||
"""Unique identifier of the business connection on behalf of which the message will be sent"""
|
||||
message_thread_id: Optional[int] = None
|
||||
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
|
||||
"""Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"""
|
||||
direct_messages_topic_id: Optional[int] = None
|
||||
"""Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"""
|
||||
duration: Optional[int] = None
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class SendAudio(TelegramMethod[Message]):
|
|||
business_connection_id: Optional[str] = None
|
||||
"""Unique identifier of the business connection on behalf of which the message will be sent"""
|
||||
message_thread_id: Optional[int] = None
|
||||
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
|
||||
"""Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"""
|
||||
direct_messages_topic_id: Optional[int] = None
|
||||
"""Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"""
|
||||
caption: Optional[str] = None
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ class SendChatAction(TelegramMethod[bool]):
|
|||
business_connection_id: Optional[str] = None
|
||||
"""Unique identifier of the business connection on behalf of which the action will be sent"""
|
||||
message_thread_id: Optional[int] = None
|
||||
"""Unique identifier for the target message thread; for supergroups only"""
|
||||
"""Unique identifier for the target message thread or topic of a forum; for supergroups and private chats of bots with forum topic mode enabled only"""
|
||||
|
||||
if TYPE_CHECKING:
|
||||
# DO NOT EDIT MANUALLY!!!
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class SendContact(TelegramMethod[Message]):
|
|||
business_connection_id: Optional[str] = None
|
||||
"""Unique identifier of the business connection on behalf of which the message will be sent"""
|
||||
message_thread_id: Optional[int] = None
|
||||
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
|
||||
"""Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"""
|
||||
direct_messages_topic_id: Optional[int] = None
|
||||
"""Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"""
|
||||
last_name: Optional[str] = None
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ class SendDice(TelegramMethod[Message]):
|
|||
business_connection_id: Optional[str] = None
|
||||
"""Unique identifier of the business connection on behalf of which the message will be sent"""
|
||||
message_thread_id: Optional[int] = None
|
||||
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
|
||||
"""Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"""
|
||||
direct_messages_topic_id: Optional[int] = None
|
||||
"""Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"""
|
||||
emoji: Optional[str] = None
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class SendDocument(TelegramMethod[Message]):
|
|||
business_connection_id: Optional[str] = None
|
||||
"""Unique identifier of the business connection on behalf of which the message will be sent"""
|
||||
message_thread_id: Optional[int] = None
|
||||
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
|
||||
"""Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"""
|
||||
direct_messages_topic_id: Optional[int] = None
|
||||
"""Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"""
|
||||
thumbnail: Optional[InputFile] = None
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class SendGame(TelegramMethod[Message]):
|
|||
business_connection_id: Optional[str] = None
|
||||
"""Unique identifier of the business connection on behalf of which the message will be sent"""
|
||||
message_thread_id: Optional[int] = None
|
||||
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
|
||||
"""Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"""
|
||||
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[Union[bool, Default]] = Default("protect_content")
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ class SendGift(TelegramMethod[bool]):
|
|||
__api_method__ = "sendGift"
|
||||
|
||||
gift_id: str
|
||||
"""Identifier of the gift"""
|
||||
"""Identifier of the gift; limited gifts can't be sent to channel chats"""
|
||||
user_id: Optional[int] = None
|
||||
"""Required if *chat_id* is not specified. Unique identifier of the target user who will receive the gift."""
|
||||
chat_id: Optional[ChatIdUnion] = None
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ class SendInvoice(TelegramMethod[Message]):
|
|||
prices: list[LabeledPrice]
|
||||
"""Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain exactly one item for payments in `Telegram Stars <https://t.me/BotNews/90>`_."""
|
||||
message_thread_id: Optional[int] = None
|
||||
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
|
||||
"""Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"""
|
||||
direct_messages_topic_id: Optional[int] = None
|
||||
"""Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"""
|
||||
provider_token: Optional[str] = None
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class SendLocation(TelegramMethod[Message]):
|
|||
business_connection_id: Optional[str] = None
|
||||
"""Unique identifier of the business connection on behalf of which the message will be sent"""
|
||||
message_thread_id: Optional[int] = None
|
||||
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
|
||||
"""Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"""
|
||||
direct_messages_topic_id: Optional[int] = None
|
||||
"""Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"""
|
||||
horizontal_accuracy: Optional[float] = None
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class SendMediaGroup(TelegramMethod[list[Message]]):
|
|||
business_connection_id: Optional[str] = None
|
||||
"""Unique identifier of the business connection on behalf of which the message will be sent"""
|
||||
message_thread_id: Optional[int] = None
|
||||
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
|
||||
"""Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"""
|
||||
direct_messages_topic_id: Optional[int] = None
|
||||
"""Identifier of the direct messages topic to which the messages will be sent; required if the messages are sent to a direct messages chat"""
|
||||
disable_notification: Optional[bool] = None
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class SendMessage(TelegramMethod[Message]):
|
|||
business_connection_id: Optional[str] = None
|
||||
"""Unique identifier of the business connection on behalf of which the message will be sent"""
|
||||
message_thread_id: Optional[int] = None
|
||||
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
|
||||
"""Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"""
|
||||
direct_messages_topic_id: Optional[int] = None
|
||||
"""Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"""
|
||||
parse_mode: Optional[Union[str, Default]] = Default("parse_mode")
|
||||
|
|
|
|||
59
aiogram/methods/send_message_draft.py
Normal file
59
aiogram/methods/send_message_draft.py
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING, Any, Optional
|
||||
|
||||
from ..types import MessageEntity
|
||||
from .base import TelegramMethod
|
||||
|
||||
|
||||
class SendMessageDraft(TelegramMethod[bool]):
|
||||
"""
|
||||
Use this method to stream a partial message to a user while the message is being generated; supported only for bots with forum topic mode enabled. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#sendmessagedraft
|
||||
"""
|
||||
|
||||
__returning__ = bool
|
||||
__api_method__ = "sendMessageDraft"
|
||||
|
||||
chat_id: int
|
||||
"""Unique identifier for the target private chat"""
|
||||
draft_id: int
|
||||
"""Unique identifier of the message draft; must be non-zero. Changes of drafts with the same identifier are animated"""
|
||||
text: str
|
||||
"""Text of the message to be sent, 1-4096 characters after entities parsing"""
|
||||
message_thread_id: Optional[int] = None
|
||||
"""Unique identifier for the target message thread"""
|
||||
parse_mode: Optional[str] = None
|
||||
"""Mode for parsing entities in the message text. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details."""
|
||||
entities: Optional[list[MessageEntity]] = None
|
||||
"""A JSON-serialized list of special entities that appear in message text, which can be specified instead of *parse_mode*"""
|
||||
|
||||
if TYPE_CHECKING:
|
||||
# DO NOT EDIT MANUALLY!!!
|
||||
# This section was auto-generated via `butcher`
|
||||
|
||||
def __init__(
|
||||
__pydantic__self__,
|
||||
*,
|
||||
chat_id: int,
|
||||
draft_id: int,
|
||||
text: str,
|
||||
message_thread_id: Optional[int] = None,
|
||||
parse_mode: Optional[str] = None,
|
||||
entities: Optional[list[MessageEntity]] = 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,
|
||||
draft_id=draft_id,
|
||||
text=text,
|
||||
message_thread_id=message_thread_id,
|
||||
parse_mode=parse_mode,
|
||||
entities=entities,
|
||||
**__pydantic_kwargs,
|
||||
)
|
||||
|
|
@ -27,13 +27,13 @@ class SendPaidMedia(TelegramMethod[Message]):
|
|||
chat_id: ChatIdUnion
|
||||
"""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; 1-10000"""
|
||||
"""The number of Telegram Stars that must be paid to buy access to the media; 1-25000"""
|
||||
media: list[InputPaidMediaUnion]
|
||||
"""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"""
|
||||
message_thread_id: Optional[int] = None
|
||||
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
|
||||
"""Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"""
|
||||
direct_messages_topic_id: Optional[int] = None
|
||||
"""Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"""
|
||||
payload: Optional[str] = None
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class SendPhoto(TelegramMethod[Message]):
|
|||
business_connection_id: Optional[str] = None
|
||||
"""Unique identifier of the business connection on behalf of which the message will be sent"""
|
||||
message_thread_id: Optional[int] = None
|
||||
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
|
||||
"""Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"""
|
||||
direct_messages_topic_id: Optional[int] = None
|
||||
"""Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"""
|
||||
caption: Optional[str] = None
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class SendPoll(TelegramMethod[Message]):
|
|||
business_connection_id: Optional[str] = None
|
||||
"""Unique identifier of the business connection on behalf of which the message will be sent"""
|
||||
message_thread_id: Optional[int] = None
|
||||
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
|
||||
"""Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"""
|
||||
question_parse_mode: Optional[Union[str, Default]] = Default("parse_mode")
|
||||
"""Mode for parsing entities in the question. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details. Currently, only custom emoji entities are allowed"""
|
||||
question_entities: Optional[list[MessageEntity]] = None
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class SendSticker(TelegramMethod[Message]):
|
|||
business_connection_id: Optional[str] = None
|
||||
"""Unique identifier of the business connection on behalf of which the message will be sent"""
|
||||
message_thread_id: Optional[int] = None
|
||||
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
|
||||
"""Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"""
|
||||
direct_messages_topic_id: Optional[int] = None
|
||||
"""Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"""
|
||||
emoji: Optional[str] = None
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ class SendVenue(TelegramMethod[Message]):
|
|||
business_connection_id: Optional[str] = None
|
||||
"""Unique identifier of the business connection on behalf of which the message will be sent"""
|
||||
message_thread_id: Optional[int] = None
|
||||
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
|
||||
"""Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"""
|
||||
direct_messages_topic_id: Optional[int] = None
|
||||
"""Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"""
|
||||
foursquare_id: Optional[str] = None
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class SendVideo(TelegramMethod[Message]):
|
|||
business_connection_id: Optional[str] = None
|
||||
"""Unique identifier of the business connection on behalf of which the message will be sent"""
|
||||
message_thread_id: Optional[int] = None
|
||||
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
|
||||
"""Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"""
|
||||
direct_messages_topic_id: Optional[int] = None
|
||||
"""Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"""
|
||||
duration: Optional[int] = None
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class SendVideoNote(TelegramMethod[Message]):
|
|||
business_connection_id: Optional[str] = None
|
||||
"""Unique identifier of the business connection on behalf of which the message will be sent"""
|
||||
message_thread_id: Optional[int] = None
|
||||
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
|
||||
"""Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"""
|
||||
direct_messages_topic_id: Optional[int] = None
|
||||
"""Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"""
|
||||
duration: Optional[int] = None
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class SendVoice(TelegramMethod[Message]):
|
|||
business_connection_id: Optional[str] = None
|
||||
"""Unique identifier of the business connection on behalf of which the message will be sent"""
|
||||
message_thread_id: Optional[int] = None
|
||||
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
|
||||
"""Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"""
|
||||
direct_messages_topic_id: Optional[int] = None
|
||||
"""Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"""
|
||||
caption: Optional[str] = None
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ from .base import TelegramMethod
|
|||
|
||||
class UnpinAllForumTopicMessages(TelegramMethod[bool]):
|
||||
"""
|
||||
Use this method to clear the list of pinned messages in a forum topic. The bot must be an administrator in the chat for this to work and must have the *can_pin_messages* administrator right in the supergroup. Returns :code:`True` on success.
|
||||
Use this method to clear the list of pinned messages in a forum topic in a forum supergroup chat or a private chat with a user. In the case of a supergroup chat the bot must be an administrator in the chat for this to work and must have the *can_pin_messages* administrator right in the supergroup. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#unpinallforumtopicmessages
|
||||
"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue