Added full support for the Bot API 9.0 (#1671)

* Added full support for the Bot API 9.0

* Bump version
This commit is contained in:
Alex Root Junior 2025-04-12 23:29:48 +03:00 committed by GitHub
parent 25e9127db9
commit 2c2bd61551
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
231 changed files with 9565 additions and 389 deletions

View file

@ -1,2 +1,2 @@
__version__ = "3.19.0"
__api_version__ = "8.3"
__api_version__ = "9.0"

View file

@ -33,6 +33,7 @@ from ..methods import (
Close,
CloseForumTopic,
CloseGeneralForumTopic,
ConvertGiftToStars,
CopyMessage,
CopyMessages,
CreateChatInviteLink,
@ -41,6 +42,7 @@ from ..methods import (
CreateInvoiceLink,
CreateNewStickerSet,
DeclineChatJoinRequest,
DeleteBusinessMessages,
DeleteChatPhoto,
DeleteChatStickerSet,
DeleteForumTopic,
@ -49,6 +51,7 @@ from ..methods import (
DeleteMyCommands,
DeleteStickerFromSet,
DeleteStickerSet,
DeleteStory,
DeleteWebhook,
EditChatInviteLink,
EditChatSubscriptionInviteLink,
@ -59,11 +62,14 @@ from ..methods import (
EditMessageMedia,
EditMessageReplyMarkup,
EditMessageText,
EditStory,
EditUserStarSubscription,
ExportChatInviteLink,
ForwardMessage,
ForwardMessages,
GetAvailableGifts,
GetBusinessAccountGifts,
GetBusinessAccountStarBalance,
GetBusinessConnection,
GetChat,
GetChatAdministrators,
@ -86,12 +92,16 @@ from ..methods import (
GetUserChatBoosts,
GetUserProfilePhotos,
GetWebhookInfo,
GiftPremiumSubscription,
HideGeneralForumTopic,
LeaveChat,
LogOut,
PinChatMessage,
PostStory,
PromoteChatMember,
ReadBusinessMessage,
RefundStarPayment,
RemoveBusinessAccountProfilePhoto,
RemoveChatVerification,
RemoveUserVerification,
ReopenForumTopic,
@ -120,6 +130,11 @@ from ..methods import (
SendVideo,
SendVideoNote,
SendVoice,
SetBusinessAccountBio,
SetBusinessAccountGiftSettings,
SetBusinessAccountName,
SetBusinessAccountProfilePhoto,
SetBusinessAccountUsername,
SetChatAdministratorCustomTitle,
SetChatDescription,
SetChatMenuButton,
@ -147,6 +162,8 @@ from ..methods import (
StopMessageLiveLocation,
StopPoll,
TelegramMethod,
TransferBusinessAccountStars,
TransferGift,
UnbanChatMember,
UnbanChatSenderChat,
UnhideGeneralForumTopic,
@ -154,11 +171,13 @@ from ..methods import (
UnpinAllForumTopicMessages,
UnpinAllGeneralForumTopicMessages,
UnpinChatMessage,
UpgradeGift,
UploadStickerFile,
VerifyChat,
VerifyUser,
)
from ..types import (
AcceptedGiftTypes,
BotCommand,
BotCommandScopeUnion,
BotDescription,
@ -184,7 +203,9 @@ from ..types import (
InputMediaUnion,
InputPaidMediaUnion,
InputPollOptionUnion,
InputProfilePhotoUnion,
InputSticker,
InputStoryContentUnion,
LabeledPrice,
LinkPreviewOptions,
MaskPosition,
@ -193,6 +214,7 @@ from ..types import (
Message,
MessageEntity,
MessageId,
OwnedGifts,
PassportElementErrorUnion,
Poll,
PreparedInlineMessage,
@ -203,9 +225,12 @@ from ..types import (
ResultMenuButtonUnion,
SentWebAppMessage,
ShippingOption,
StarAmount,
StarTransactions,
Sticker,
StickerSet,
Story,
StoryArea,
Update,
User,
UserChatBoosts,
@ -932,7 +957,7 @@ class Bot:
:param prices: 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>`_.
:param business_connection_id: Unique identifier of the business connection on behalf of which the link will be created. For payments in `Telegram Stars <https://t.me/BotNews/90>`_ only.
:param provider_token: Payment provider token, obtained via `@BotFather <https://t.me/botfather>`_. Pass an empty string for payments in `Telegram Stars <https://t.me/BotNews/90>`_.
:param subscription_period: The number of seconds the subscription will be active for before the next payment. The currency must be set to 'XTR' (Telegram Stars) if the parameter is used. Currently, it must always be 2592000 (30 days) if specified. Any number of subscriptions can be active for a given bot at the same time, including multiple concurrent subscriptions from the same user. Subscription price must no exceed 2500 Telegram Stars.
:param subscription_period: The number of seconds the subscription will be active for before the next payment. The currency must be set to 'XTR' (Telegram Stars) if the parameter is used. Currently, it must always be 2592000 (30 days) if specified. Any number of subscriptions can be active for a given bot at the same time, including multiple concurrent subscriptions from the same user. Subscription price must no exceed 10000 Telegram Stars.
:param max_tip_amount: The maximum accepted amount for tips in the *smallest units* of the currency (integer, **not** float/double). For example, for a maximum tip of :code:`US$ 1.45` pass :code:`max_tip_amount = 145`. See the *exp* parameter in `currencies.json <https://core.telegram.org/bots/payments/currencies.json>`_, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0. Not supported for payments in `Telegram Stars <https://t.me/BotNews/90>`_.
:param suggested_tip_amounts: A JSON-serialized array of suggested amounts of tips in the *smallest units* of the currency (integer, **not** float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed *max_tip_amount*.
:param provider_data: JSON-serialized data about the invoice, which will be shared with the payment provider. A detailed description of required fields should be provided by the payment provider.
@ -4571,7 +4596,7 @@ class Bot:
Source: https://core.telegram.org/bots/api#sendpaidmedia
:param chat_id: 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.
:param star_count: The number of Telegram Stars that must be paid to buy access to the media; 1-2500
:param star_count: The number of Telegram Stars that must be paid to buy access to the media; 1-10000
:param media: A JSON-serialized array describing the media to be sent; up to 10 items
:param business_connection_id: Unique identifier of the business connection on behalf of which the message will be sent
:param payload: Bot-defined paid media payload, 0-128 bytes. This will not be displayed to the user, use it for your internal processes.
@ -4621,7 +4646,7 @@ class Bot:
:param chat_id: Unique identifier for the target channel chat or username of the target channel (in the format :code:`@channelusername`)
:param subscription_period: The number of seconds the subscription will be active for before the next payment. Currently, it must always be 2592000 (30 days).
:param subscription_price: 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
:param subscription_price: The amount of Telegram Stars a user must pay initially and after each subsequent subscription period to be a member of the chat; 1-10000
:param name: Invite link name; 0-32 characters
:param request_timeout: Request timeout
:return: Returns the new invite link as a :class:`aiogram.types.chat_invite_link.ChatInviteLink` object.
@ -4758,7 +4783,7 @@ class Bot:
:param user_id: Required if *chat_id* is not specified. Unique identifier of the target user who will receive the gift.
:param chat_id: Required if *user_id* is not specified. Unique identifier for the chat or username of the channel (in the format :code:`@channelusername`) that will receive the gift.
:param pay_for_upgrade: Pass :code:`True` to pay for the gift upgrade from the bot's balance, thereby making the upgrade free for the receiver
:param text: Text that will be shown along with the gift; 0-255 characters
:param text: Text that will be shown along with the gift; 0-128 characters
:param text_parse_mode: Mode for parsing entities in the text. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details. Entities other than 'bold', 'italic', 'underline', 'strikethrough', 'spoiler', and 'custom_emoji' are ignored.
:param text_entities: A JSON-serialized list of special entities that appear in the gift text. It can be specified instead of *text_parse_mode*. Entities other than 'bold', 'italic', 'underline', 'strikethrough', 'spoiler', and 'custom_emoji' are ignored.
:param request_timeout: Request timeout
@ -4887,3 +4912,507 @@ class Bot:
custom_description=custom_description,
)
return await self(call, request_timeout=request_timeout)
async def convert_gift_to_stars(
self,
business_connection_id: str,
owned_gift_id: str,
request_timeout: Optional[int] = None,
) -> bool:
"""
Converts a given regular gift to Telegram Stars. Requires the *can_convert_gifts_to_stars* business bot right. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#convertgifttostars
:param business_connection_id: Unique identifier of the business connection
:param owned_gift_id: Unique identifier of the regular gift that should be converted to Telegram Stars
:param request_timeout: Request timeout
:return: Returns :code:`True` on success.
"""
call = ConvertGiftToStars(
business_connection_id=business_connection_id,
owned_gift_id=owned_gift_id,
)
return await self(call, request_timeout=request_timeout)
async def delete_business_messages(
self,
business_connection_id: str,
message_ids: list[int],
request_timeout: Optional[int] = None,
) -> bool:
"""
Delete messages on behalf of a business account. Requires the *can_delete_outgoing_messages* business bot right to delete messages sent by the bot itself, or the *can_delete_all_messages* business bot right to delete any message. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#deletebusinessmessages
:param business_connection_id: Unique identifier of the business connection on behalf of which to delete the messages
:param message_ids: A JSON-serialized list of 1-100 identifiers of messages to delete. All messages must be from the same chat. See :class:`aiogram.methods.delete_message.DeleteMessage` for limitations on which messages can be deleted
:param request_timeout: Request timeout
:return: Returns :code:`True` on success.
"""
call = DeleteBusinessMessages(
business_connection_id=business_connection_id,
message_ids=message_ids,
)
return await self(call, request_timeout=request_timeout)
async def delete_story(
self,
business_connection_id: str,
story_id: int,
request_timeout: Optional[int] = None,
) -> bool:
"""
Deletes a story previously posted by the bot on behalf of a managed business account. Requires the *can_manage_stories* business bot right. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#deletestory
:param business_connection_id: Unique identifier of the business connection
:param story_id: Unique identifier of the story to delete
:param request_timeout: Request timeout
:return: Returns :code:`True` on success.
"""
call = DeleteStory(
business_connection_id=business_connection_id,
story_id=story_id,
)
return await self(call, request_timeout=request_timeout)
async def edit_story(
self,
business_connection_id: str,
story_id: int,
content: InputStoryContentUnion,
caption: Optional[str] = None,
parse_mode: Optional[str] = None,
caption_entities: Optional[list[MessageEntity]] = None,
areas: Optional[list[StoryArea]] = None,
request_timeout: Optional[int] = None,
) -> Story:
"""
Edits a story previously posted by the bot on behalf of a managed business account. Requires the *can_manage_stories* business bot right. Returns :class:`aiogram.types.story.Story` on success.
Source: https://core.telegram.org/bots/api#editstory
:param business_connection_id: Unique identifier of the business connection
:param story_id: Unique identifier of the story to edit
:param content: Content of the story
:param caption: Caption of the story, 0-2048 characters after entities parsing
:param parse_mode: Mode for parsing entities in the story caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details.
:param caption_entities: A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*
:param areas: A JSON-serialized list of clickable areas to be shown on the story
:param request_timeout: Request timeout
:return: Returns :class:`aiogram.types.story.Story` on success.
"""
call = EditStory(
business_connection_id=business_connection_id,
story_id=story_id,
content=content,
caption=caption,
parse_mode=parse_mode,
caption_entities=caption_entities,
areas=areas,
)
return await self(call, request_timeout=request_timeout)
async def get_business_account_gifts(
self,
business_connection_id: str,
exclude_unsaved: Optional[bool] = None,
exclude_saved: Optional[bool] = None,
exclude_unlimited: Optional[bool] = None,
exclude_limited: Optional[bool] = None,
exclude_unique: Optional[bool] = None,
sort_by_price: Optional[bool] = None,
offset: Optional[str] = None,
limit: Optional[int] = None,
request_timeout: Optional[int] = None,
) -> OwnedGifts:
"""
Returns the gifts received and owned by a managed business account. Requires the *can_view_gifts_and_stars* business bot right. Returns :class:`aiogram.types.owned_gifts.OwnedGifts` on success.
Source: https://core.telegram.org/bots/api#getbusinessaccountgifts
:param business_connection_id: Unique identifier of the business connection
:param exclude_unsaved: Pass True to exclude gifts that aren't saved to the account's profile page
:param exclude_saved: Pass True to exclude gifts that are saved to the account's profile page
:param exclude_unlimited: Pass True to exclude gifts that can be purchased an unlimited number of times
:param exclude_limited: Pass True to exclude gifts that can be purchased a limited number of times
:param exclude_unique: Pass True to exclude unique gifts
:param sort_by_price: Pass True to sort results by gift price instead of send date. Sorting is applied before pagination.
:param offset: Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results
:param limit: The maximum number of gifts to be returned; 1-100. Defaults to 100
:param request_timeout: Request timeout
:return: Returns :class:`aiogram.types.owned_gifts.OwnedGifts` on success.
"""
call = GetBusinessAccountGifts(
business_connection_id=business_connection_id,
exclude_unsaved=exclude_unsaved,
exclude_saved=exclude_saved,
exclude_unlimited=exclude_unlimited,
exclude_limited=exclude_limited,
exclude_unique=exclude_unique,
sort_by_price=sort_by_price,
offset=offset,
limit=limit,
)
return await self(call, request_timeout=request_timeout)
async def get_business_account_star_balance(
self,
business_connection_id: str,
request_timeout: Optional[int] = None,
) -> StarAmount:
"""
Returns the amount of Telegram Stars owned by a managed business account. Requires the *can_view_gifts_and_stars* business bot right. Returns :class:`aiogram.types.star_amount.StarAmount` on success.
Source: https://core.telegram.org/bots/api#getbusinessaccountstarbalance
:param business_connection_id: Unique identifier of the business connection
:param request_timeout: Request timeout
:return: Returns :class:`aiogram.types.star_amount.StarAmount` on success.
"""
call = GetBusinessAccountStarBalance(
business_connection_id=business_connection_id,
)
return await self(call, request_timeout=request_timeout)
async def gift_premium_subscription(
self,
user_id: int,
month_count: int,
star_count: int,
text: Optional[str] = None,
text_parse_mode: Optional[str] = None,
text_entities: Optional[list[MessageEntity]] = None,
request_timeout: Optional[int] = None,
) -> bool:
"""
Gifts a Telegram Premium subscription to the given user. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#giftpremiumsubscription
:param user_id: Unique identifier of the target user who will receive a Telegram Premium subscription
:param month_count: Number of months the Telegram Premium subscription will be active for the user; must be one of 3, 6, or 12
:param star_count: Number of Telegram Stars to pay for the Telegram Premium subscription; must be 1000 for 3 months, 1500 for 6 months, and 2500 for 12 months
:param text: Text that will be shown along with the service message about the subscription; 0-128 characters
:param text_parse_mode: Mode for parsing entities in the text. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details. Entities other than 'bold', 'italic', 'underline', 'strikethrough', 'spoiler', and 'custom_emoji' are ignored.
:param text_entities: A JSON-serialized list of special entities that appear in the gift text. It can be specified instead of *text_parse_mode*. Entities other than 'bold', 'italic', 'underline', 'strikethrough', 'spoiler', and 'custom_emoji' are ignored.
:param request_timeout: Request timeout
:return: Returns :code:`True` on success.
"""
call = GiftPremiumSubscription(
user_id=user_id,
month_count=month_count,
star_count=star_count,
text=text,
text_parse_mode=text_parse_mode,
text_entities=text_entities,
)
return await self(call, request_timeout=request_timeout)
async def post_story(
self,
business_connection_id: str,
content: InputStoryContentUnion,
active_period: int,
caption: Optional[str] = None,
parse_mode: Optional[str] = None,
caption_entities: Optional[list[MessageEntity]] = None,
areas: Optional[list[StoryArea]] = None,
post_to_chat_page: Optional[bool] = None,
protect_content: Optional[bool] = None,
request_timeout: Optional[int] = None,
) -> Story:
"""
Posts a story on behalf of a managed business account. Requires the *can_manage_stories* business bot right. Returns :class:`aiogram.types.story.Story` on success.
Source: https://core.telegram.org/bots/api#poststory
:param business_connection_id: Unique identifier of the business connection
:param content: Content of the story
:param active_period: 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`
:param caption: Caption of the story, 0-2048 characters after entities parsing
:param parse_mode: Mode for parsing entities in the story caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details.
:param caption_entities: A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*
:param areas: A JSON-serialized list of clickable areas to be shown on the story
:param post_to_chat_page: Pass :code:`True` to keep the story accessible after it expires
:param protect_content: Pass :code:`True` if the content of the story must be protected from forwarding and screenshotting
:param request_timeout: Request timeout
:return: Returns :class:`aiogram.types.story.Story` on success.
"""
call = PostStory(
business_connection_id=business_connection_id,
content=content,
active_period=active_period,
caption=caption,
parse_mode=parse_mode,
caption_entities=caption_entities,
areas=areas,
post_to_chat_page=post_to_chat_page,
protect_content=protect_content,
)
return await self(call, request_timeout=request_timeout)
async def read_business_message(
self,
business_connection_id: str,
chat_id: int,
message_id: int,
request_timeout: Optional[int] = None,
) -> bool:
"""
Marks incoming message as read on behalf of a business account. Requires the *can_read_messages* business bot right. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#readbusinessmessage
:param business_connection_id: Unique identifier of the business connection on behalf of which to read the message
:param chat_id: Unique identifier of the chat in which the message was received. The chat must have been active in the last 24 hours.
:param message_id: Unique identifier of the message to mark as read
:param request_timeout: Request timeout
:return: Returns :code:`True` on success.
"""
call = ReadBusinessMessage(
business_connection_id=business_connection_id,
chat_id=chat_id,
message_id=message_id,
)
return await self(call, request_timeout=request_timeout)
async def remove_business_account_profile_photo(
self,
business_connection_id: str,
is_public: Optional[bool] = None,
request_timeout: Optional[int] = None,
) -> bool:
"""
Removes the current profile photo of a managed business account. Requires the *can_edit_profile_photo* business bot right. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#removebusinessaccountprofilephoto
:param business_connection_id: Unique identifier of the business connection
:param is_public: Pass True to remove the public photo, which is visible even if the main photo is hidden by the business account's privacy settings. After the main photo is removed, the previous profile photo (if present) becomes the main photo.
:param request_timeout: Request timeout
:return: Returns :code:`True` on success.
"""
call = RemoveBusinessAccountProfilePhoto(
business_connection_id=business_connection_id,
is_public=is_public,
)
return await self(call, request_timeout=request_timeout)
async def set_business_account_bio(
self,
business_connection_id: str,
bio: Optional[str] = None,
request_timeout: Optional[int] = None,
) -> bool:
"""
Changes the bio of a managed business account. Requires the *can_change_bio* business bot right. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#setbusinessaccountbio
:param business_connection_id: Unique identifier of the business connection
:param bio: The new value of the bio for the business account; 0-140 characters
:param request_timeout: Request timeout
:return: Returns :code:`True` on success.
"""
call = SetBusinessAccountBio(
business_connection_id=business_connection_id,
bio=bio,
)
return await self(call, request_timeout=request_timeout)
async def set_business_account_gift_settings(
self,
business_connection_id: str,
show_gift_button: bool,
accepted_gift_types: AcceptedGiftTypes,
request_timeout: Optional[int] = None,
) -> bool:
"""
Changes the privacy settings pertaining to incoming gifts in a managed business account. Requires the *can_change_gift_settings* business bot right. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#setbusinessaccountgiftsettings
:param business_connection_id: Unique identifier of the business connection
:param show_gift_button: Pass True, if a button for sending a gift to the user or by the business account must always be shown in the input field
:param accepted_gift_types: Types of gifts accepted by the business account
:param request_timeout: Request timeout
:return: Returns :code:`True` on success.
"""
call = SetBusinessAccountGiftSettings(
business_connection_id=business_connection_id,
show_gift_button=show_gift_button,
accepted_gift_types=accepted_gift_types,
)
return await self(call, request_timeout=request_timeout)
async def set_business_account_name(
self,
business_connection_id: str,
first_name: str,
last_name: Optional[str] = None,
request_timeout: Optional[int] = None,
) -> bool:
"""
Changes the first and last name of a managed business account. Requires the *can_change_name* business bot right. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#setbusinessaccountname
:param business_connection_id: Unique identifier of the business connection
:param first_name: The new value of the first name for the business account; 1-64 characters
:param last_name: The new value of the last name for the business account; 0-64 characters
:param request_timeout: Request timeout
:return: Returns :code:`True` on success.
"""
call = SetBusinessAccountName(
business_connection_id=business_connection_id,
first_name=first_name,
last_name=last_name,
)
return await self(call, request_timeout=request_timeout)
async def set_business_account_profile_photo(
self,
business_connection_id: str,
photo: InputProfilePhotoUnion,
is_public: Optional[bool] = None,
request_timeout: Optional[int] = None,
) -> bool:
"""
Changes the profile photo of a managed business account. Requires the *can_edit_profile_photo* business bot right. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#setbusinessaccountprofilephoto
:param business_connection_id: Unique identifier of the business connection
:param photo: The new profile photo to set
:param is_public: Pass True to set the public photo, which will be visible even if the main photo is hidden by the business account's privacy settings. An account can have only one public photo.
:param request_timeout: Request timeout
:return: Returns :code:`True` on success.
"""
call = SetBusinessAccountProfilePhoto(
business_connection_id=business_connection_id,
photo=photo,
is_public=is_public,
)
return await self(call, request_timeout=request_timeout)
async def set_business_account_username(
self,
business_connection_id: str,
username: Optional[str] = None,
request_timeout: Optional[int] = None,
) -> bool:
"""
Changes the username of a managed business account. Requires the *can_change_username* business bot right. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#setbusinessaccountusername
:param business_connection_id: Unique identifier of the business connection
:param username: The new value of the username for the business account; 0-32 characters
:param request_timeout: Request timeout
:return: Returns :code:`True` on success.
"""
call = SetBusinessAccountUsername(
business_connection_id=business_connection_id,
username=username,
)
return await self(call, request_timeout=request_timeout)
async def transfer_business_account_stars(
self,
business_connection_id: str,
star_count: int,
request_timeout: Optional[int] = None,
) -> bool:
"""
Transfers Telegram Stars from the business account balance to the bot's balance. Requires the *can_transfer_stars* business bot right. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#transferbusinessaccountstars
:param business_connection_id: Unique identifier of the business connection
:param star_count: Number of Telegram Stars to transfer; 1-10000
:param request_timeout: Request timeout
:return: Returns :code:`True` on success.
"""
call = TransferBusinessAccountStars(
business_connection_id=business_connection_id,
star_count=star_count,
)
return await self(call, request_timeout=request_timeout)
async def transfer_gift(
self,
business_connection_id: str,
owned_gift_id: str,
new_owner_chat_id: int,
star_count: Optional[int] = None,
request_timeout: Optional[int] = None,
) -> bool:
"""
Transfers an owned unique gift to another user. Requires the *can_transfer_and_upgrade_gifts* business bot right. Requires *can_transfer_stars* business bot right if the transfer is paid. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#transfergift
:param business_connection_id: Unique identifier of the business connection
:param owned_gift_id: Unique identifier of the regular gift that should be transferred
:param new_owner_chat_id: Unique identifier of the chat which will own the gift. The chat must be active in the last 24 hours.
:param star_count: The amount of Telegram Stars that will be paid for the transfer from the business account balance. If positive, then the *can_transfer_stars* business bot right is required.
:param request_timeout: Request timeout
:return: Returns :code:`True` on success.
"""
call = TransferGift(
business_connection_id=business_connection_id,
owned_gift_id=owned_gift_id,
new_owner_chat_id=new_owner_chat_id,
star_count=star_count,
)
return await self(call, request_timeout=request_timeout)
async def upgrade_gift(
self,
business_connection_id: str,
owned_gift_id: str,
keep_original_details: Optional[bool] = None,
star_count: Optional[int] = None,
request_timeout: Optional[int] = None,
) -> bool:
"""
Upgrades a given regular gift to a unique gift. Requires the *can_transfer_and_upgrade_gifts* business bot right. Additionally requires the *can_transfer_stars* business bot right if the upgrade is paid. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#upgradegift
:param business_connection_id: Unique identifier of the business connection
:param owned_gift_id: Unique identifier of the regular gift that should be upgraded to a unique one
:param keep_original_details: Pass True to keep the original gift text, sender and receiver in the upgraded gift
:param star_count: The amount of Telegram Stars that will be paid for the upgrade from the business account balance. If :code:`gift.prepaid_upgrade_star_count > 0`, then pass 0, otherwise, the *can_transfer_stars* business bot right is required and :code:`gift.upgrade_star_count` must be passed.
:param request_timeout: Request timeout
:return: Returns :code:`True` on success.
"""
call = UpgradeGift(
business_connection_id=business_connection_id,
owned_gift_id=owned_gift_id,
keep_original_details=keep_original_details,
star_count=star_count,
)
return await self(call, request_timeout=request_timeout)

View file

@ -10,11 +10,14 @@ from .encrypted_passport_element import EncryptedPassportElement
from .inline_query_result_type import InlineQueryResultType
from .input_media_type import InputMediaType
from .input_paid_media_type import InputPaidMediaType
from .input_profile_photo_type import InputProfilePhotoType
from .input_story_content_type import InputStoryContentType
from .keyboard_button_poll_type_type import KeyboardButtonPollTypeType
from .mask_position_point import MaskPositionPoint
from .menu_button_type import MenuButtonType
from .message_entity_type import MessageEntityType
from .message_origin_type import MessageOriginType
from .owned_gift_type import OwnedGiftType
from .paid_media_type import PaidMediaType
from .parse_mode import ParseMode
from .passport_element_error_type import PassportElementErrorType
@ -23,8 +26,12 @@ from .reaction_type_type import ReactionTypeType
from .revenue_withdrawal_state_type import RevenueWithdrawalStateType
from .sticker_format import StickerFormat
from .sticker_type import StickerType
from .story_area_type_type import StoryAreaTypeType
from .topic_icon_color import TopicIconColor
from .transaction_partner_type import TransactionPartnerType
from .transaction_partner_user_transaction_type_enum import (
TransactionPartnerUserTransactionTypeEnum,
)
from .update_type import UpdateType
__all__ = (
@ -40,11 +47,14 @@ __all__ = (
"InlineQueryResultType",
"InputMediaType",
"InputPaidMediaType",
"InputProfilePhotoType",
"InputStoryContentType",
"KeyboardButtonPollTypeType",
"MaskPositionPoint",
"MenuButtonType",
"MessageEntityType",
"MessageOriginType",
"OwnedGiftType",
"PaidMediaType",
"ParseMode",
"PassportElementErrorType",
@ -53,7 +63,9 @@ __all__ = (
"RevenueWithdrawalStateType",
"StickerFormat",
"StickerType",
"StoryAreaTypeType",
"TopicIconColor",
"TransactionPartnerType",
"TransactionPartnerUserTransactionTypeEnum",
"UpdateType",
)

View file

@ -42,6 +42,8 @@ class ContentType(str, Enum):
REFUNDED_PAYMENT = "refunded_payment"
USERS_SHARED = "users_shared"
CHAT_SHARED = "chat_shared"
GIFT = "gift"
UNIQUE_GIFT = "unique_gift"
CONNECTED_WEBSITE = "connected_website"
WRITE_ACCESS_ALLOWED = "write_access_allowed"
PASSPORT_DATA = "passport_data"
@ -58,6 +60,7 @@ class ContentType(str, Enum):
GIVEAWAY = "giveaway"
GIVEAWAY_WINNERS = "giveaway_winners"
GIVEAWAY_COMPLETED = "giveaway_completed"
PAID_MESSAGE_PRICE_CHANGED = "paid_message_price_changed"
VIDEO_CHAT_SCHEDULED = "video_chat_scheduled"
VIDEO_CHAT_STARTED = "video_chat_started"
VIDEO_CHAT_ENDED = "video_chat_ended"

View file

@ -0,0 +1,12 @@
from enum import Enum
class InputProfilePhotoType(str, Enum):
"""
This object represents input profile photo type
Source: https://core.telegram.org/bots/api#inputprofilephoto
"""
STATIC = "static"
ANIMATED = "animated"

View file

@ -0,0 +1,12 @@
from enum import Enum
class InputStoryContentType(str, Enum):
"""
This object represents input story content photo type.
Source: https://core.telegram.org/bots/api#inputstorycontentphoto
"""
PHOTO = "photo"
VIDEO = "video"

View file

@ -0,0 +1,12 @@
from enum import Enum
class OwnedGiftType(str, Enum):
"""
This object represents owned gift type
Source: https://core.telegram.org/bots/api#ownedgift
"""
REGULAR = "regular"
UNIQUE = "unique"

View file

@ -0,0 +1,15 @@
from enum import Enum
class StoryAreaTypeType(str, Enum):
"""
This object represents input profile photo type
Source: https://core.telegram.org/bots/api#storyareatype
"""
LOCATION = "location"
SUGGESTED_REACTION = "suggested_reaction"
LINK = "link"
WEATHER = "weather"
UNIQUE_GIFT = "unique_gift"

View file

@ -0,0 +1,15 @@
from enum import Enum
class TransactionPartnerUserTransactionTypeEnum(str, Enum):
"""
This object represents type of the transaction that were made by partner user.
Source: https://core.telegram.org/bots/api#transactionpartneruser
"""
INVOICE_PAYMENT = "invoice_payment"
PAID_MEDIA_PAYMENT = "paid_media_payment"
GIFT_PURCHASE = "gift_purchase"
PREMIUM_PURCHASE = "premium_purchase"
BUSINESS_ACCOUNT_TRANSFER = "business_account_transfer"

View file

@ -11,6 +11,7 @@ from .base import Request, Response, TelegramMethod
from .close import Close
from .close_forum_topic import CloseForumTopic
from .close_general_forum_topic import CloseGeneralForumTopic
from .convert_gift_to_stars import ConvertGiftToStars
from .copy_message import CopyMessage
from .copy_messages import CopyMessages
from .create_chat_invite_link import CreateChatInviteLink
@ -19,6 +20,7 @@ from .create_forum_topic import CreateForumTopic
from .create_invoice_link import CreateInvoiceLink
from .create_new_sticker_set import CreateNewStickerSet
from .decline_chat_join_request import DeclineChatJoinRequest
from .delete_business_messages import DeleteBusinessMessages
from .delete_chat_photo import DeleteChatPhoto
from .delete_chat_sticker_set import DeleteChatStickerSet
from .delete_forum_topic import DeleteForumTopic
@ -27,6 +29,7 @@ from .delete_messages import DeleteMessages
from .delete_my_commands import DeleteMyCommands
from .delete_sticker_from_set import DeleteStickerFromSet
from .delete_sticker_set import DeleteStickerSet
from .delete_story import DeleteStory
from .delete_webhook import DeleteWebhook
from .edit_chat_invite_link import EditChatInviteLink
from .edit_chat_subscription_invite_link import EditChatSubscriptionInviteLink
@ -37,11 +40,14 @@ from .edit_message_live_location import EditMessageLiveLocation
from .edit_message_media import EditMessageMedia
from .edit_message_reply_markup import EditMessageReplyMarkup
from .edit_message_text import EditMessageText
from .edit_story import EditStory
from .edit_user_star_subscription import EditUserStarSubscription
from .export_chat_invite_link import ExportChatInviteLink
from .forward_message import ForwardMessage
from .forward_messages import ForwardMessages
from .get_available_gifts import GetAvailableGifts
from .get_business_account_gifts import GetBusinessAccountGifts
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
@ -64,12 +70,16 @@ from .get_updates import GetUpdates
from .get_user_chat_boosts import GetUserChatBoosts
from .get_user_profile_photos import GetUserProfilePhotos
from .get_webhook_info import GetWebhookInfo
from .gift_premium_subscription import GiftPremiumSubscription
from .hide_general_forum_topic import HideGeneralForumTopic
from .leave_chat import LeaveChat
from .log_out import LogOut
from .pin_chat_message import PinChatMessage
from .post_story import PostStory
from .promote_chat_member import PromoteChatMember
from .read_business_message import ReadBusinessMessage
from .refund_star_payment import RefundStarPayment
from .remove_business_account_profile_photo import RemoveBusinessAccountProfilePhoto
from .remove_chat_verification import RemoveChatVerification
from .remove_user_verification import RemoveUserVerification
from .reopen_forum_topic import ReopenForumTopic
@ -98,6 +108,11 @@ from .send_venue import SendVenue
from .send_video import SendVideo
from .send_video_note import SendVideoNote
from .send_voice import SendVoice
from .set_business_account_bio import SetBusinessAccountBio
from .set_business_account_gift_settings import SetBusinessAccountGiftSettings
from .set_business_account_name import SetBusinessAccountName
from .set_business_account_profile_photo import SetBusinessAccountProfilePhoto
from .set_business_account_username import SetBusinessAccountUsername
from .set_chat_administrator_custom_title import SetChatAdministratorCustomTitle
from .set_chat_description import SetChatDescription
from .set_chat_menu_button import SetChatMenuButton
@ -124,6 +139,8 @@ from .set_user_emoji_status import SetUserEmojiStatus
from .set_webhook import SetWebhook
from .stop_message_live_location import StopMessageLiveLocation
from .stop_poll import StopPoll
from .transfer_business_account_stars import TransferBusinessAccountStars
from .transfer_gift import TransferGift
from .unban_chat_member import UnbanChatMember
from .unban_chat_sender_chat import UnbanChatSenderChat
from .unhide_general_forum_topic import UnhideGeneralForumTopic
@ -131,6 +148,7 @@ from .unpin_all_chat_messages import UnpinAllChatMessages
from .unpin_all_forum_topic_messages import UnpinAllForumTopicMessages
from .unpin_all_general_forum_topic_messages import UnpinAllGeneralForumTopicMessages
from .unpin_chat_message import UnpinChatMessage
from .upgrade_gift import UpgradeGift
from .upload_sticker_file import UploadStickerFile
from .verify_chat import VerifyChat
from .verify_user import VerifyUser
@ -148,6 +166,7 @@ __all__ = (
"Close",
"CloseForumTopic",
"CloseGeneralForumTopic",
"ConvertGiftToStars",
"CopyMessage",
"CopyMessages",
"CreateChatInviteLink",
@ -156,6 +175,7 @@ __all__ = (
"CreateInvoiceLink",
"CreateNewStickerSet",
"DeclineChatJoinRequest",
"DeleteBusinessMessages",
"DeleteChatPhoto",
"DeleteChatStickerSet",
"DeleteForumTopic",
@ -164,6 +184,7 @@ __all__ = (
"DeleteMyCommands",
"DeleteStickerFromSet",
"DeleteStickerSet",
"DeleteStory",
"DeleteWebhook",
"EditChatInviteLink",
"EditChatSubscriptionInviteLink",
@ -174,11 +195,14 @@ __all__ = (
"EditMessageMedia",
"EditMessageReplyMarkup",
"EditMessageText",
"EditStory",
"EditUserStarSubscription",
"ExportChatInviteLink",
"ForwardMessage",
"ForwardMessages",
"GetAvailableGifts",
"GetBusinessAccountGifts",
"GetBusinessAccountStarBalance",
"GetBusinessConnection",
"GetChat",
"GetChatAdministrators",
@ -201,12 +225,16 @@ __all__ = (
"GetUserChatBoosts",
"GetUserProfilePhotos",
"GetWebhookInfo",
"GiftPremiumSubscription",
"HideGeneralForumTopic",
"LeaveChat",
"LogOut",
"PinChatMessage",
"PostStory",
"PromoteChatMember",
"ReadBusinessMessage",
"RefundStarPayment",
"RemoveBusinessAccountProfilePhoto",
"RemoveChatVerification",
"RemoveUserVerification",
"ReopenForumTopic",
@ -237,6 +265,11 @@ __all__ = (
"SendVideo",
"SendVideoNote",
"SendVoice",
"SetBusinessAccountBio",
"SetBusinessAccountGiftSettings",
"SetBusinessAccountName",
"SetBusinessAccountProfilePhoto",
"SetBusinessAccountUsername",
"SetChatAdministratorCustomTitle",
"SetChatDescription",
"SetChatMenuButton",
@ -264,6 +297,8 @@ __all__ = (
"StopMessageLiveLocation",
"StopPoll",
"TelegramMethod",
"TransferBusinessAccountStars",
"TransferGift",
"UnbanChatMember",
"UnbanChatSenderChat",
"UnhideGeneralForumTopic",
@ -271,6 +306,7 @@ __all__ = (
"UnpinAllForumTopicMessages",
"UnpinAllGeneralForumTopicMessages",
"UnpinChatMessage",
"UpgradeGift",
"UploadStickerFile",
"VerifyChat",
"VerifyUser",

View file

@ -0,0 +1,42 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from .base import TelegramMethod
class ConvertGiftToStars(TelegramMethod[bool]):
"""
Converts a given regular gift to Telegram Stars. Requires the *can_convert_gifts_to_stars* business bot right. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#convertgifttostars
"""
__returning__ = bool
__api_method__ = "convertGiftToStars"
business_connection_id: str
"""Unique identifier of the business connection"""
owned_gift_id: str
"""Unique identifier of the regular gift that should be converted to Telegram Stars"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
business_connection_id: str,
owned_gift_id: str,
**__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,
owned_gift_id=owned_gift_id,
**__pydantic_kwargs,
)

View file

@ -21,7 +21,7 @@ class CreateChatSubscriptionInviteLink(TelegramMethod[ChatInviteLink]):
subscription_period: DateTimeUnion
"""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"""
"""The amount of Telegram Stars a user must pay initially and after each subsequent subscription period to be a member of the chat; 1-10000"""
name: Optional[str] = None
"""Invite link name; 0-32 characters"""

View file

@ -31,7 +31,7 @@ class CreateInvoiceLink(TelegramMethod[str]):
provider_token: Optional[str] = None
"""Payment provider token, obtained via `@BotFather <https://t.me/botfather>`_. Pass an empty string for payments in `Telegram Stars <https://t.me/BotNews/90>`_."""
subscription_period: Optional[int] = None
"""The number of seconds the subscription will be active for before the next payment. The currency must be set to 'XTR' (Telegram Stars) if the parameter is used. Currently, it must always be 2592000 (30 days) if specified. Any number of subscriptions can be active for a given bot at the same time, including multiple concurrent subscriptions from the same user. Subscription price must no exceed 2500 Telegram Stars."""
"""The number of seconds the subscription will be active for before the next payment. The currency must be set to 'XTR' (Telegram Stars) if the parameter is used. Currently, it must always be 2592000 (30 days) if specified. Any number of subscriptions can be active for a given bot at the same time, including multiple concurrent subscriptions from the same user. Subscription price must no exceed 10000 Telegram Stars."""
max_tip_amount: Optional[int] = None
"""The maximum accepted amount for tips in the *smallest units* of the currency (integer, **not** float/double). For example, for a maximum tip of :code:`US$ 1.45` pass :code:`max_tip_amount = 145`. See the *exp* parameter in `currencies.json <https://core.telegram.org/bots/payments/currencies.json>`_, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0. Not supported for payments in `Telegram Stars <https://t.me/BotNews/90>`_."""
suggested_tip_amounts: Optional[list[int]] = None

View file

@ -0,0 +1,42 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from .base import TelegramMethod
class DeleteBusinessMessages(TelegramMethod[bool]):
"""
Delete messages on behalf of a business account. Requires the *can_delete_outgoing_messages* business bot right to delete messages sent by the bot itself, or the *can_delete_all_messages* business bot right to delete any message. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#deletebusinessmessages
"""
__returning__ = bool
__api_method__ = "deleteBusinessMessages"
business_connection_id: str
"""Unique identifier of the business connection on behalf of which to delete the messages"""
message_ids: list[int]
"""A JSON-serialized list of 1-100 identifiers of messages to delete. All messages must be from the same chat. See :class:`aiogram.methods.delete_message.DeleteMessage` for limitations on which messages can be deleted"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
business_connection_id: str,
message_ids: list[int],
**__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,
message_ids=message_ids,
**__pydantic_kwargs,
)

View file

@ -0,0 +1,42 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from .base import TelegramMethod
class DeleteStory(TelegramMethod[bool]):
"""
Deletes a story previously posted by the bot on behalf of a managed business account. Requires the *can_manage_stories* business bot right. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#deletestory
"""
__returning__ = bool
__api_method__ = "deleteStory"
business_connection_id: str
"""Unique identifier of the business connection"""
story_id: int
"""Unique identifier of the story to delete"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
business_connection_id: str,
story_id: int,
**__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,
story_id=story_id,
**__pydantic_kwargs,
)

View file

@ -0,0 +1,63 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional
from ..types import InputStoryContentUnion, MessageEntity, Story, StoryArea
from .base import TelegramMethod
class EditStory(TelegramMethod[Story]):
"""
Edits a story previously posted by the bot on behalf of a managed business account. Requires the *can_manage_stories* business bot right. Returns :class:`aiogram.types.story.Story` on success.
Source: https://core.telegram.org/bots/api#editstory
"""
__returning__ = Story
__api_method__ = "editStory"
business_connection_id: str
"""Unique identifier of the business connection"""
story_id: int
"""Unique identifier of the story to edit"""
content: InputStoryContentUnion
"""Content of the story"""
caption: Optional[str] = None
"""Caption of the story, 0-2048 characters after entities parsing"""
parse_mode: Optional[str] = None
"""Mode for parsing entities in the story 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*"""
areas: Optional[list[StoryArea]] = None
"""A JSON-serialized list of clickable areas to be shown on the story"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
business_connection_id: str,
story_id: int,
content: InputStoryContentUnion,
caption: Optional[str] = None,
parse_mode: Optional[str] = None,
caption_entities: Optional[list[MessageEntity]] = None,
areas: Optional[list[StoryArea]] = 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,
story_id=story_id,
content=content,
caption=caption,
parse_mode=parse_mode,
caption_entities=caption_entities,
areas=areas,
**__pydantic_kwargs,
)

View 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 GetBusinessAccountGifts(TelegramMethod[OwnedGifts]):
"""
Returns the gifts received and owned by a managed business account. Requires the *can_view_gifts_and_stars* business bot right. Returns :class:`aiogram.types.owned_gifts.OwnedGifts` on success.
Source: https://core.telegram.org/bots/api#getbusinessaccountgifts
"""
__returning__ = OwnedGifts
__api_method__ = "getBusinessAccountGifts"
business_connection_id: str
"""Unique identifier of the business connection"""
exclude_unsaved: Optional[bool] = None
"""Pass True to exclude gifts that aren't saved to the account's profile page"""
exclude_saved: Optional[bool] = None
"""Pass True to exclude gifts that are saved to the account's profile page"""
exclude_unlimited: Optional[bool] = None
"""Pass True to exclude gifts that can be purchased an unlimited number of times"""
exclude_limited: Optional[bool] = None
"""Pass True to exclude gifts that can be purchased a limited number of times"""
exclude_unique: Optional[bool] = None
"""Pass True to exclude unique gifts"""
sort_by_price: Optional[bool] = None
"""Pass 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"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
business_connection_id: str,
exclude_unsaved: Optional[bool] = None,
exclude_saved: Optional[bool] = None,
exclude_unlimited: Optional[bool] = None,
exclude_limited: 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__(
business_connection_id=business_connection_id,
exclude_unsaved=exclude_unsaved,
exclude_saved=exclude_saved,
exclude_unlimited=exclude_unlimited,
exclude_limited=exclude_limited,
exclude_unique=exclude_unique,
sort_by_price=sort_by_price,
offset=offset,
limit=limit,
**__pydantic_kwargs,
)

View file

@ -0,0 +1,33 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from ..types import StarAmount
from .base import TelegramMethod
class GetBusinessAccountStarBalance(TelegramMethod[StarAmount]):
"""
Returns the amount of Telegram Stars owned by a managed business account. Requires the *can_view_gifts_and_stars* business bot right. Returns :class:`aiogram.types.star_amount.StarAmount` on success.
Source: https://core.telegram.org/bots/api#getbusinessaccountstarbalance
"""
__returning__ = StarAmount
__api_method__ = "getBusinessAccountStarBalance"
business_connection_id: str
"""Unique identifier of the business connection"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__, *, business_connection_id: str, **__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, **__pydantic_kwargs)

View 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 GiftPremiumSubscription(TelegramMethod[bool]):
"""
Gifts a Telegram Premium subscription to the given user. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#giftpremiumsubscription
"""
__returning__ = bool
__api_method__ = "giftPremiumSubscription"
user_id: int
"""Unique identifier of the target user who will receive a Telegram Premium subscription"""
month_count: int
"""Number of months the Telegram Premium subscription will be active for the user; must be one of 3, 6, or 12"""
star_count: int
"""Number of Telegram Stars to pay for the Telegram Premium subscription; must be 1000 for 3 months, 1500 for 6 months, and 2500 for 12 months"""
text: Optional[str] = None
"""Text that will be shown along with the service message about the subscription; 0-128 characters"""
text_parse_mode: Optional[str] = None
"""Mode for parsing entities in the text. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details. Entities other than 'bold', 'italic', 'underline', 'strikethrough', 'spoiler', and 'custom_emoji' are ignored."""
text_entities: Optional[list[MessageEntity]] = None
"""A JSON-serialized list of special entities that appear in the gift text. It can be specified instead of *text_parse_mode*. Entities other than 'bold', 'italic', 'underline', 'strikethrough', 'spoiler', and 'custom_emoji' are ignored."""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
user_id: int,
month_count: int,
star_count: int,
text: Optional[str] = None,
text_parse_mode: Optional[str] = None,
text_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__(
user_id=user_id,
month_count=month_count,
star_count=star_count,
text=text,
text_parse_mode=text_parse_mode,
text_entities=text_entities,
**__pydantic_kwargs,
)

View file

@ -0,0 +1,71 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional
from ..types import InputStoryContentUnion, MessageEntity, Story, StoryArea
from .base import TelegramMethod
class PostStory(TelegramMethod[Story]):
"""
Posts a story on behalf of a managed business account. Requires the *can_manage_stories* business bot right. Returns :class:`aiogram.types.story.Story` on success.
Source: https://core.telegram.org/bots/api#poststory
"""
__returning__ = Story
__api_method__ = "postStory"
business_connection_id: str
"""Unique identifier of the business connection"""
content: InputStoryContentUnion
"""Content of the story"""
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`"""
caption: Optional[str] = None
"""Caption of the story, 0-2048 characters after entities parsing"""
parse_mode: Optional[str] = None
"""Mode for parsing entities in the story 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*"""
areas: Optional[list[StoryArea]] = None
"""A JSON-serialized list of clickable areas to be shown on the story"""
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,
content: InputStoryContentUnion,
active_period: int,
caption: Optional[str] = None,
parse_mode: Optional[str] = None,
caption_entities: Optional[list[MessageEntity]] = None,
areas: Optional[list[StoryArea]] = None,
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,
content=content,
active_period=active_period,
caption=caption,
parse_mode=parse_mode,
caption_entities=caption_entities,
areas=areas,
post_to_chat_page=post_to_chat_page,
protect_content=protect_content,
**__pydantic_kwargs,
)

View file

@ -0,0 +1,46 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from .base import TelegramMethod
class ReadBusinessMessage(TelegramMethod[bool]):
"""
Marks incoming message as read on behalf of a business account. Requires the *can_read_messages* business bot right. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#readbusinessmessage
"""
__returning__ = bool
__api_method__ = "readBusinessMessage"
business_connection_id: str
"""Unique identifier of the business connection on behalf of which to read the message"""
chat_id: int
"""Unique identifier of the chat in which the message was received. The chat must have been active in the last 24 hours."""
message_id: int
"""Unique identifier of the message to mark as read"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
business_connection_id: str,
chat_id: int,
message_id: int,
**__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,
chat_id=chat_id,
message_id=message_id,
**__pydantic_kwargs,
)

View file

@ -0,0 +1,42 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional
from .base import TelegramMethod
class RemoveBusinessAccountProfilePhoto(TelegramMethod[bool]):
"""
Removes the current profile photo of a managed business account. Requires the *can_edit_profile_photo* business bot right. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#removebusinessaccountprofilephoto
"""
__returning__ = bool
__api_method__ = "removeBusinessAccountProfilePhoto"
business_connection_id: str
"""Unique identifier of the business connection"""
is_public: Optional[bool] = None
"""Pass True to remove the public photo, which is visible even if the main photo is hidden by the business account's privacy settings. After the main photo is removed, the previous profile photo (if present) becomes the main photo."""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
business_connection_id: str,
is_public: 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,
is_public=is_public,
**__pydantic_kwargs,
)

View file

@ -26,7 +26,7 @@ class SendGift(TelegramMethod[bool]):
pay_for_upgrade: Optional[bool] = None
"""Pass :code:`True` to pay for the gift upgrade from the bot's balance, thereby making the upgrade free for the receiver"""
text: Optional[str] = None
"""Text that will be shown along with the gift; 0-255 characters"""
"""Text that will be shown along with the gift; 0-128 characters"""
text_parse_mode: Optional[str] = None
"""Mode for parsing entities in the text. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details. Entities other than 'bold', 'italic', 'underline', 'strikethrough', 'spoiler', and 'custom_emoji' are ignored."""
text_entities: Optional[list[MessageEntity]] = None

View file

@ -26,7 +26,7 @@ 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-2500"""
"""The number of Telegram Stars that must be paid to buy access to the media; 1-10000"""
media: list[InputPaidMediaUnion]
"""A JSON-serialized array describing the media to be sent; up to 10 items"""
business_connection_id: Optional[str] = None

View file

@ -0,0 +1,40 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional
from .base import TelegramMethod
class SetBusinessAccountBio(TelegramMethod[bool]):
"""
Changes the bio of a managed business account. Requires the *can_change_bio* business bot right. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#setbusinessaccountbio
"""
__returning__ = bool
__api_method__ = "setBusinessAccountBio"
business_connection_id: str
"""Unique identifier of the business connection"""
bio: Optional[str] = None
"""The new value of the bio for the business account; 0-140 characters"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
business_connection_id: str,
bio: 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__(
business_connection_id=business_connection_id, bio=bio, **__pydantic_kwargs
)

View file

@ -0,0 +1,47 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from ..types import AcceptedGiftTypes
from .base import TelegramMethod
class SetBusinessAccountGiftSettings(TelegramMethod[bool]):
"""
Changes the privacy settings pertaining to incoming gifts in a managed business account. Requires the *can_change_gift_settings* business bot right. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#setbusinessaccountgiftsettings
"""
__returning__ = bool
__api_method__ = "setBusinessAccountGiftSettings"
business_connection_id: str
"""Unique identifier of the business connection"""
show_gift_button: bool
"""Pass True, if a button for sending a gift to the user or by the business account must always be shown in the input field"""
accepted_gift_types: AcceptedGiftTypes
"""Types of gifts accepted by the business account"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
business_connection_id: str,
show_gift_button: bool,
accepted_gift_types: AcceptedGiftTypes,
**__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,
show_gift_button=show_gift_button,
accepted_gift_types=accepted_gift_types,
**__pydantic_kwargs,
)

View file

@ -0,0 +1,46 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional
from .base import TelegramMethod
class SetBusinessAccountName(TelegramMethod[bool]):
"""
Changes the first and last name of a managed business account. Requires the *can_change_name* business bot right. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#setbusinessaccountname
"""
__returning__ = bool
__api_method__ = "setBusinessAccountName"
business_connection_id: str
"""Unique identifier of the business connection"""
first_name: str
"""The new value of the first name for the business account; 1-64 characters"""
last_name: Optional[str] = None
"""The new value of the last name for the business account; 0-64 characters"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
business_connection_id: str,
first_name: str,
last_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__(
business_connection_id=business_connection_id,
first_name=first_name,
last_name=last_name,
**__pydantic_kwargs,
)

View file

@ -0,0 +1,47 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional
from ..types import InputProfilePhotoUnion
from .base import TelegramMethod
class SetBusinessAccountProfilePhoto(TelegramMethod[bool]):
"""
Changes the profile photo of a managed business account. Requires the *can_edit_profile_photo* business bot right. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#setbusinessaccountprofilephoto
"""
__returning__ = bool
__api_method__ = "setBusinessAccountProfilePhoto"
business_connection_id: str
"""Unique identifier of the business connection"""
photo: InputProfilePhotoUnion
"""The new profile photo to set"""
is_public: Optional[bool] = None
"""Pass True to set the public photo, which will be visible even if the main photo is hidden by the business account's privacy settings. An account can have only one public photo."""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
business_connection_id: str,
photo: InputProfilePhotoUnion,
is_public: 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,
photo=photo,
is_public=is_public,
**__pydantic_kwargs,
)

View file

@ -0,0 +1,42 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional
from .base import TelegramMethod
class SetBusinessAccountUsername(TelegramMethod[bool]):
"""
Changes the username of a managed business account. Requires the *can_change_username* business bot right. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#setbusinessaccountusername
"""
__returning__ = bool
__api_method__ = "setBusinessAccountUsername"
business_connection_id: str
"""Unique identifier of the business connection"""
username: Optional[str] = None
"""The new value of the username for the business account; 0-32 characters"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
business_connection_id: str,
username: 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__(
business_connection_id=business_connection_id,
username=username,
**__pydantic_kwargs,
)

View file

@ -0,0 +1,42 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from .base import TelegramMethod
class TransferBusinessAccountStars(TelegramMethod[bool]):
"""
Transfers Telegram Stars from the business account balance to the bot's balance. Requires the *can_transfer_stars* business bot right. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#transferbusinessaccountstars
"""
__returning__ = bool
__api_method__ = "transferBusinessAccountStars"
business_connection_id: str
"""Unique identifier of the business connection"""
star_count: int
"""Number of Telegram Stars to transfer; 1-10000"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
business_connection_id: str,
star_count: int,
**__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,
star_count=star_count,
**__pydantic_kwargs,
)

View file

@ -0,0 +1,50 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional
from .base import TelegramMethod
class TransferGift(TelegramMethod[bool]):
"""
Transfers an owned unique gift to another user. Requires the *can_transfer_and_upgrade_gifts* business bot right. Requires *can_transfer_stars* business bot right if the transfer is paid. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#transfergift
"""
__returning__ = bool
__api_method__ = "transferGift"
business_connection_id: str
"""Unique identifier of the business connection"""
owned_gift_id: str
"""Unique identifier of the regular gift that should be transferred"""
new_owner_chat_id: int
"""Unique identifier of the chat which will own the gift. The chat must be active in the last 24 hours."""
star_count: Optional[int] = None
"""The amount of Telegram Stars that will be paid for the transfer from the business account balance. If positive, then the *can_transfer_stars* business bot right is required."""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
business_connection_id: str,
owned_gift_id: str,
new_owner_chat_id: int,
star_count: 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__(
business_connection_id=business_connection_id,
owned_gift_id=owned_gift_id,
new_owner_chat_id=new_owner_chat_id,
star_count=star_count,
**__pydantic_kwargs,
)

View file

@ -0,0 +1,50 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional
from .base import TelegramMethod
class UpgradeGift(TelegramMethod[bool]):
"""
Upgrades a given regular gift to a unique gift. Requires the *can_transfer_and_upgrade_gifts* business bot right. Additionally requires the *can_transfer_stars* business bot right if the upgrade is paid. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#upgradegift
"""
__returning__ = bool
__api_method__ = "upgradeGift"
business_connection_id: str
"""Unique identifier of the business connection"""
owned_gift_id: str
"""Unique identifier of the regular gift that should be upgraded to a unique one"""
keep_original_details: Optional[bool] = None
"""Pass True to keep the original gift text, sender and receiver in the upgraded gift"""
star_count: Optional[int] = None
"""The amount of Telegram Stars that will be paid for the upgrade from the business account balance. If :code:`gift.prepaid_upgrade_star_count > 0`, then pass 0, otherwise, the *can_transfer_stars* business bot right is required and :code:`gift.upgrade_star_count` must be passed."""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
business_connection_id: str,
owned_gift_id: str,
keep_original_details: Optional[bool] = None,
star_count: 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__(
business_connection_id=business_connection_id,
owned_gift_id=owned_gift_id,
keep_original_details=keep_original_details,
star_count=star_count,
**__pydantic_kwargs,
)

View file

@ -1,5 +1,6 @@
from typing import List, Literal, Optional, Union
from .accepted_gift_types import AcceptedGiftTypes
from .affiliate_info import AffiliateInfo
from .animation import Animation
from .audio import Audio
@ -31,6 +32,7 @@ from .bot_command_scope_union import BotCommandScopeUnion
from .bot_description import BotDescription
from .bot_name import BotName
from .bot_short_description import BotShortDescription
from .business_bot_rights import BusinessBotRights
from .business_connection import BusinessConnection
from .business_intro import BusinessIntro
from .business_location import BusinessLocation
@ -92,6 +94,7 @@ from .game_high_score import GameHighScore
from .general_forum_topic_hidden import GeneralForumTopicHidden
from .general_forum_topic_unhidden import GeneralForumTopicUnhidden
from .gift import Gift
from .gift_info import GiftInfo
from .gifts import Gifts
from .giveaway import Giveaway
from .giveaway_completed import GiveawayCompleted
@ -144,7 +147,15 @@ from .input_paid_media_union import InputPaidMediaUnion
from .input_paid_media_video import InputPaidMediaVideo
from .input_poll_option import InputPollOption
from .input_poll_option_union import InputPollOptionUnion
from .input_profile_photo import InputProfilePhoto
from .input_profile_photo_animated import InputProfilePhotoAnimated
from .input_profile_photo_static import InputProfilePhotoStatic
from .input_profile_photo_union import InputProfilePhotoUnion
from .input_sticker import InputSticker
from .input_story_content import InputStoryContent
from .input_story_content_photo import InputStoryContentPhoto
from .input_story_content_union import InputStoryContentUnion
from .input_story_content_video import InputStoryContentVideo
from .input_text_message_content import InputTextMessageContent
from .input_venue_message_content import InputVenueMessageContent
from .invoice import Invoice
@ -156,6 +167,7 @@ from .keyboard_button_request_users import KeyboardButtonRequestUsers
from .labeled_price import LabeledPrice
from .link_preview_options import LinkPreviewOptions
from .location import Location
from .location_address import LocationAddress
from .login_url import LoginUrl
from .mask_position import MaskPosition
from .maybe_inaccessible_message import MaybeInaccessibleMessage
@ -179,6 +191,11 @@ from .message_origin_user import MessageOriginUser
from .message_reaction_count_updated import MessageReactionCountUpdated
from .message_reaction_updated import MessageReactionUpdated
from .order_info import OrderInfo
from .owned_gift import OwnedGift
from .owned_gift_regular import OwnedGiftRegular
from .owned_gift_union import OwnedGiftUnion
from .owned_gift_unique import OwnedGiftUnique
from .owned_gifts import OwnedGifts
from .paid_media import PaidMedia
from .paid_media_info import PaidMediaInfo
from .paid_media_photo import PaidMediaPhoto
@ -186,6 +203,7 @@ from .paid_media_preview import PaidMediaPreview
from .paid_media_purchased import PaidMediaPurchased
from .paid_media_union import PaidMediaUnion
from .paid_media_video import PaidMediaVideo
from .paid_message_price_changed import PaidMessagePriceChanged
from .passport_data import PassportData
from .passport_element_error import PassportElementError
from .passport_element_error_data_field import PassportElementErrorDataField
@ -232,11 +250,21 @@ from .shared_user import SharedUser
from .shipping_address import ShippingAddress
from .shipping_option import ShippingOption
from .shipping_query import ShippingQuery
from .star_amount import StarAmount
from .star_transaction import StarTransaction
from .star_transactions import StarTransactions
from .sticker import Sticker
from .sticker_set import StickerSet
from .story import Story
from .story_area import StoryArea
from .story_area_position import StoryAreaPosition
from .story_area_type import StoryAreaType
from .story_area_type_link import StoryAreaTypeLink
from .story_area_type_location import StoryAreaTypeLocation
from .story_area_type_suggested_reaction import StoryAreaTypeSuggestedReaction
from .story_area_type_union import StoryAreaTypeUnion
from .story_area_type_unique_gift import StoryAreaTypeUniqueGift
from .story_area_type_weather import StoryAreaTypeWeather
from .successful_payment import SuccessfulPayment
from .switch_inline_query_chosen_chat import SwitchInlineQueryChosenChat
from .text_quote import TextQuote
@ -249,6 +277,12 @@ from .transaction_partner_telegram_ads import TransactionPartnerTelegramAds
from .transaction_partner_telegram_api import TransactionPartnerTelegramApi
from .transaction_partner_union import TransactionPartnerUnion
from .transaction_partner_user import TransactionPartnerUser
from .unique_gift import UniqueGift
from .unique_gift_backdrop import UniqueGiftBackdrop
from .unique_gift_backdrop_colors import UniqueGiftBackdropColors
from .unique_gift_info import UniqueGiftInfo
from .unique_gift_model import UniqueGiftModel
from .unique_gift_symbol import UniqueGiftSymbol
from .update import Update
from .user import User
from .user_chat_boosts import UserChatBoosts
@ -269,6 +303,7 @@ from .webhook_info import WebhookInfo
from .write_access_allowed import WriteAccessAllowed
__all__ = (
"AcceptedGiftTypes",
"AffiliateInfo",
"Animation",
"Audio",
@ -298,6 +333,7 @@ __all__ = (
"BotName",
"BotShortDescription",
"BufferedInputFile",
"BusinessBotRights",
"BusinessConnection",
"BusinessIntro",
"BusinessLocation",
@ -361,6 +397,7 @@ __all__ = (
"GeneralForumTopicHidden",
"GeneralForumTopicUnhidden",
"Gift",
"GiftInfo",
"Gifts",
"Giveaway",
"GiveawayCompleted",
@ -413,7 +450,15 @@ __all__ = (
"InputPaidMediaVideo",
"InputPollOption",
"InputPollOptionUnion",
"InputProfilePhoto",
"InputProfilePhotoAnimated",
"InputProfilePhotoStatic",
"InputProfilePhotoUnion",
"InputSticker",
"InputStoryContent",
"InputStoryContentPhoto",
"InputStoryContentUnion",
"InputStoryContentVideo",
"InputTextMessageContent",
"InputVenueMessageContent",
"Invoice",
@ -425,6 +470,7 @@ __all__ = (
"LabeledPrice",
"LinkPreviewOptions",
"Location",
"LocationAddress",
"LoginUrl",
"MaskPosition",
"MaybeInaccessibleMessage",
@ -448,6 +494,11 @@ __all__ = (
"MessageReactionCountUpdated",
"MessageReactionUpdated",
"OrderInfo",
"OwnedGift",
"OwnedGiftRegular",
"OwnedGiftUnion",
"OwnedGiftUnique",
"OwnedGifts",
"PaidMedia",
"PaidMediaInfo",
"PaidMediaPhoto",
@ -455,6 +506,7 @@ __all__ = (
"PaidMediaPurchased",
"PaidMediaUnion",
"PaidMediaVideo",
"PaidMessagePriceChanged",
"PassportData",
"PassportElementError",
"PassportElementErrorDataField",
@ -499,11 +551,21 @@ __all__ = (
"ShippingAddress",
"ShippingOption",
"ShippingQuery",
"StarAmount",
"StarTransaction",
"StarTransactions",
"Sticker",
"StickerSet",
"Story",
"StoryArea",
"StoryAreaPosition",
"StoryAreaType",
"StoryAreaTypeLink",
"StoryAreaTypeLocation",
"StoryAreaTypeSuggestedReaction",
"StoryAreaTypeUnion",
"StoryAreaTypeUniqueGift",
"StoryAreaTypeWeather",
"SuccessfulPayment",
"SwitchInlineQueryChosenChat",
"TelegramObject",
@ -519,6 +581,12 @@ __all__ = (
"TransactionPartnerUser",
"UNSET_PARSE_MODE",
"URLInputFile",
"UniqueGift",
"UniqueGiftBackdrop",
"UniqueGiftBackdropColors",
"UniqueGiftInfo",
"UniqueGiftModel",
"UniqueGiftSymbol",
"Update",
"User",
"UserChatBoosts",

View file

@ -0,0 +1,47 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from .base import TelegramObject
class AcceptedGiftTypes(TelegramObject):
"""
This object describes the types of gifts that can be gifted to a user or a chat.
Source: https://core.telegram.org/bots/api#acceptedgifttypes
"""
unlimited_gifts: bool
"""True, if unlimited regular gifts are accepted"""
limited_gifts: bool
"""True, if limited regular gifts are accepted"""
unique_gifts: bool
"""True, if unique gifts or gifts that can be upgraded to unique for free are accepted"""
premium_subscription: bool
"""True, if a Telegram Premium subscription is accepted"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
unlimited_gifts: bool,
limited_gifts: bool,
unique_gifts: bool,
premium_subscription: bool,
**__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__(
unlimited_gifts=unlimited_gifts,
limited_gifts=limited_gifts,
unique_gifts=unique_gifts,
premium_subscription=premium_subscription,
**__pydantic_kwargs,
)

View file

@ -0,0 +1,87 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional
from .base import TelegramObject
class BusinessBotRights(TelegramObject):
"""
Represents the rights of a business bot.
Source: https://core.telegram.org/bots/api#businessbotrights
"""
can_reply: Optional[bool] = None
"""*Optional*. True, if the bot can send and edit messages in the private chats that had incoming messages in the last 24 hours"""
can_read_messages: Optional[bool] = None
"""*Optional*. True, if the bot can mark incoming private messages as read"""
can_delete_outgoing_messages: Optional[bool] = None
"""*Optional*. True, if the bot can delete messages sent by the bot"""
can_delete_all_messages: Optional[bool] = None
"""*Optional*. True, if the bot can delete all private messages in managed chats"""
can_edit_name: Optional[bool] = None
"""*Optional*. True, if the bot can edit the first and last name of the business account"""
can_edit_bio: Optional[bool] = None
"""*Optional*. True, if the bot can edit the bio of the business account"""
can_edit_profile_photo: Optional[bool] = None
"""*Optional*. True, if the bot can edit the profile photo of the business account"""
can_edit_username: Optional[bool] = None
"""*Optional*. True, if the bot can edit the username of the business account"""
can_change_gift_settings: Optional[bool] = None
"""*Optional*. True, if the bot can change the privacy settings pertaining to gifts for the business account"""
can_view_gifts_and_stars: Optional[bool] = None
"""*Optional*. True, if the bot can view gifts and the amount of Telegram Stars owned by the business account"""
can_convert_gifts_to_stars: Optional[bool] = None
"""*Optional*. True, if the bot can convert regular gifts owned by the business account to Telegram Stars"""
can_transfer_and_upgrade_gifts: Optional[bool] = None
"""*Optional*. True, if the bot can transfer and upgrade gifts owned by the business account"""
can_transfer_stars: Optional[bool] = None
"""*Optional*. True, if the bot can transfer Telegram Stars received by the business account to its own account, or use them to upgrade and transfer gifts"""
can_manage_stories: Optional[bool] = None
"""*Optional*. True, if the bot can post, edit and delete stories on behalf of the business account"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
can_reply: Optional[bool] = None,
can_read_messages: Optional[bool] = None,
can_delete_outgoing_messages: Optional[bool] = None,
can_delete_all_messages: Optional[bool] = None,
can_edit_name: Optional[bool] = None,
can_edit_bio: Optional[bool] = None,
can_edit_profile_photo: Optional[bool] = None,
can_edit_username: Optional[bool] = None,
can_change_gift_settings: Optional[bool] = None,
can_view_gifts_and_stars: Optional[bool] = None,
can_convert_gifts_to_stars: Optional[bool] = None,
can_transfer_and_upgrade_gifts: Optional[bool] = None,
can_transfer_stars: Optional[bool] = None,
can_manage_stories: 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__(
can_reply=can_reply,
can_read_messages=can_read_messages,
can_delete_outgoing_messages=can_delete_outgoing_messages,
can_delete_all_messages=can_delete_all_messages,
can_edit_name=can_edit_name,
can_edit_bio=can_edit_bio,
can_edit_profile_photo=can_edit_profile_photo,
can_edit_username=can_edit_username,
can_change_gift_settings=can_change_gift_settings,
can_view_gifts_and_stars=can_view_gifts_and_stars,
can_convert_gifts_to_stars=can_convert_gifts_to_stars,
can_transfer_and_upgrade_gifts=can_transfer_and_upgrade_gifts,
can_transfer_stars=can_transfer_stars,
can_manage_stories=can_manage_stories,
**__pydantic_kwargs,
)

View file

@ -1,11 +1,14 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from typing import TYPE_CHECKING, Any, Optional
from pydantic import Field
from .base import TelegramObject
from .custom import DateTime
if TYPE_CHECKING:
from .business_bot_rights import BusinessBotRights
from .user import User
@ -24,10 +27,15 @@ class BusinessConnection(TelegramObject):
"""Identifier of a private chat with the user who created the business connection. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier."""
date: DateTime
"""Date the connection was established in Unix time"""
can_reply: bool
"""True, if the bot can act on behalf of the business account in chats that were active in the last 24 hours"""
is_enabled: bool
"""True, if the connection is active"""
rights: Optional[BusinessBotRights] = None
"""*Optional*. Rights of the business bot"""
can_reply: Optional[bool] = Field(None, json_schema_extra={"deprecated": True})
"""True, if the bot can act on behalf of the business account in chats that were active in the last 24 hours
.. deprecated:: API:9.0
https://core.telegram.org/bots/api-changelog#april-11-2025"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
@ -40,8 +48,9 @@ class BusinessConnection(TelegramObject):
user: User,
user_chat_id: int,
date: DateTime,
can_reply: bool,
is_enabled: bool,
rights: Optional[BusinessBotRights] = None,
can_reply: Optional[bool] = None,
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!
@ -53,7 +62,8 @@ class BusinessConnection(TelegramObject):
user=user,
user_chat_id=user_chat_id,
date=date,
can_reply=can_reply,
is_enabled=is_enabled,
rights=rights,
can_reply=can_reply,
**__pydantic_kwargs,
)

View file

@ -2,10 +2,13 @@ from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional
from pydantic import Field
from .chat import Chat
from .custom import DateTime
if TYPE_CHECKING:
from .accepted_gift_types import AcceptedGiftTypes
from .birthdate import Birthdate
from .business_intro import BusinessIntro
from .business_location import BusinessLocation
@ -32,6 +35,8 @@ class ChatFullInfo(Chat):
"""Identifier of the accent color for the chat name and backgrounds of the chat photo, reply header, and link preview. See `accent colors <https://core.telegram.org/bots/api#accent-colors>`_ for more details."""
max_reaction_count: int
"""The maximum number of reactions that can be set on a message in the chat"""
accepted_gift_types: AcceptedGiftTypes
"""Information about types of gifts that are accepted by the chat or by the corresponding user for private chats"""
title: Optional[str] = None
"""*Optional*. Title, for supergroups, channels and group chats"""
username: Optional[str] = None
@ -86,8 +91,6 @@ class ChatFullInfo(Chat):
"""*Optional*. The most recent pinned message (by sending date)"""
permissions: Optional[ChatPermissions] = None
"""*Optional*. Default chat member permissions, for groups and supergroups"""
can_send_gift: Optional[bool] = None
"""*Optional*. :code:`True`, if gifts can be sent to the chat"""
can_send_paid_media: Optional[bool] = None
"""*Optional*. :code:`True`, if paid media messages can be sent or forwarded to the channel chat. The field is available only for channel chats."""
slow_mode_delay: Optional[int] = None
@ -114,6 +117,11 @@ class ChatFullInfo(Chat):
"""*Optional*. Unique identifier for the linked chat, i.e. the discussion group identifier for a channel and vice versa; for supergroups and channel chats. This identifier may be greater than 32 bits and some programming languages may have difficulty/silent defects in interpreting it. But it is smaller than 52 bits, so a signed 64 bit integer or double-precision float type are safe for storing this identifier."""
location: Optional[ChatLocation] = None
"""*Optional*. For supergroups, the location to which the supergroup is connected"""
can_send_gift: Optional[bool] = Field(None, json_schema_extra={"deprecated": True})
"""*Optional*. :code:`True`, if gifts can be sent to the chat
.. deprecated:: API:9.0
https://core.telegram.org/bots/api-changelog#april-11-2025"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
@ -126,6 +134,7 @@ class ChatFullInfo(Chat):
type: str,
accent_color_id: int,
max_reaction_count: int,
accepted_gift_types: AcceptedGiftTypes,
title: Optional[str] = None,
username: Optional[str] = None,
first_name: Optional[str] = None,
@ -153,7 +162,6 @@ class ChatFullInfo(Chat):
invite_link: Optional[str] = None,
pinned_message: Optional[Message] = None,
permissions: Optional[ChatPermissions] = None,
can_send_gift: Optional[bool] = None,
can_send_paid_media: Optional[bool] = None,
slow_mode_delay: Optional[int] = None,
unrestrict_boost_count: Optional[int] = None,
@ -167,6 +175,7 @@ class ChatFullInfo(Chat):
custom_emoji_sticker_set_name: Optional[str] = None,
linked_chat_id: Optional[int] = None,
location: Optional[ChatLocation] = None,
can_send_gift: Optional[bool] = None,
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!
@ -178,6 +187,7 @@ class ChatFullInfo(Chat):
type=type,
accent_color_id=accent_color_id,
max_reaction_count=max_reaction_count,
accepted_gift_types=accepted_gift_types,
title=title,
username=username,
first_name=first_name,
@ -205,7 +215,6 @@ class ChatFullInfo(Chat):
invite_link=invite_link,
pinned_message=pinned_message,
permissions=permissions,
can_send_gift=can_send_gift,
can_send_paid_media=can_send_paid_media,
slow_mode_delay=slow_mode_delay,
unrestrict_boost_count=unrestrict_boost_count,
@ -219,5 +228,6 @@ class ChatFullInfo(Chat):
custom_emoji_sticker_set_name=custom_emoji_sticker_set_name,
linked_chat_id=linked_chat_id,
location=location,
can_send_gift=can_send_gift,
**__pydantic_kwargs,
)

View file

@ -0,0 +1,67 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional
from .base import TelegramObject
if TYPE_CHECKING:
from .gift import Gift
from .message_entity import MessageEntity
class GiftInfo(TelegramObject):
"""
Describes a service message about a regular gift that was sent or received.
Source: https://core.telegram.org/bots/api#giftinfo
"""
gift: Gift
"""Information about the gift"""
owned_gift_id: Optional[str] = None
"""*Optional*. Unique identifier of the received gift for the bot; only present for gifts received on behalf of business accounts"""
convert_star_count: Optional[int] = None
"""*Optional*. Number of Telegram Stars that can be claimed by the receiver by converting the gift; omitted if conversion to Telegram Stars is impossible"""
prepaid_upgrade_star_count: Optional[int] = None
"""*Optional*. Number of Telegram Stars that were prepaid by the sender for the ability to upgrade the gift"""
can_be_upgraded: Optional[bool] = None
"""*Optional*. True, if the gift can be upgraded to a unique gift"""
text: Optional[str] = None
"""*Optional*. Text of the message that was added to the gift"""
entities: Optional[list[MessageEntity]] = None
"""*Optional*. Special entities that appear in the text"""
is_private: Optional[bool] = None
"""*Optional*. True, if the sender and gift text are shown only to the gift receiver; otherwise, everyone will be able to see them"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
gift: Gift,
owned_gift_id: Optional[str] = None,
convert_star_count: Optional[int] = None,
prepaid_upgrade_star_count: Optional[int] = None,
can_be_upgraded: Optional[bool] = None,
text: Optional[str] = None,
entities: Optional[list[MessageEntity]] = None,
is_private: 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__(
gift=gift,
owned_gift_id=owned_gift_id,
convert_star_count=convert_star_count,
prepaid_upgrade_star_count=prepaid_upgrade_star_count,
can_be_upgraded=can_be_upgraded,
text=text,
entities=entities,
is_private=is_private,
**__pydantic_kwargs,
)

View file

@ -2773,7 +2773,7 @@ class InaccessibleMessage(MaybeInaccessibleMessage):
Source: https://core.telegram.org/bots/api#sendpaidmedia
:param star_count: The number of Telegram Stars that must be paid to buy access to the media; 1-2500
:param star_count: The number of Telegram Stars that must be paid to buy access to the media; 1-10000
:param media: A JSON-serialized array describing the media to be sent; up to 10 items
:param business_connection_id: Unique identifier of the business connection on behalf of which the message will be sent
:param payload: Bot-defined paid media payload, 0-128 bytes. This will not be displayed to the user, use it for your internal processes.
@ -2842,7 +2842,7 @@ class InaccessibleMessage(MaybeInaccessibleMessage):
Source: https://core.telegram.org/bots/api#sendpaidmedia
:param star_count: The number of Telegram Stars that must be paid to buy access to the media; 1-2500
:param star_count: The number of Telegram Stars that must be paid to buy access to the media; 1-10000
:param media: A JSON-serialized array describing the media to be sent; up to 10 items
:param business_connection_id: Unique identifier of the business connection on behalf of which the message will be sent
:param payload: Bot-defined paid media payload, 0-128 bytes. This will not be displayed to the user, use it for your internal processes.

View file

@ -0,0 +1,14 @@
from __future__ import annotations
from .base import TelegramObject
class InputProfilePhoto(TelegramObject):
"""
This object describes a profile photo to set. Currently, it can be one of
- :class:`aiogram.types.input_profile_photo_static.InputProfilePhotoStatic`
- :class:`aiogram.types.input_profile_photo_animated.InputProfilePhotoAnimated`
Source: https://core.telegram.org/bots/api#inputprofilephoto
"""

View file

@ -0,0 +1,46 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Literal, Optional
from aiogram.enums import InputProfilePhotoType
from .input_file_union import InputFileUnion
from .input_profile_photo import InputProfilePhoto
class InputProfilePhotoAnimated(InputProfilePhoto):
"""
An animated profile photo in the MPEG4 format.
Source: https://core.telegram.org/bots/api#inputprofilephotoanimated
"""
type: Literal[InputProfilePhotoType.ANIMATED] = InputProfilePhotoType.ANIMATED
"""Type of the profile photo, must be 'animated'"""
animation: InputFileUnion
"""The animated profile photo. Profile photos can't be reused and can only be uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the photo was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`"""
main_frame_timestamp: Optional[float] = None
"""*Optional*. Timestamp in seconds of the frame that will be used as the static profile photo. Defaults to 0.0."""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
type: Literal[InputProfilePhotoType.ANIMATED] = InputProfilePhotoType.ANIMATED,
animation: InputFileUnion,
main_frame_timestamp: Optional[float] = 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__(
type=type,
animation=animation,
main_frame_timestamp=main_frame_timestamp,
**__pydantic_kwargs,
)

View file

@ -0,0 +1,38 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Literal
from aiogram.enums import InputProfilePhotoType
from .input_file_union import InputFileUnion
from .input_profile_photo import InputProfilePhoto
class InputProfilePhotoStatic(InputProfilePhoto):
"""
A static profile photo in the .JPG format.
Source: https://core.telegram.org/bots/api#inputprofilephotostatic
"""
type: Literal[InputProfilePhotoType.STATIC] = InputProfilePhotoType.STATIC
"""Type of the profile photo, must be 'static'"""
photo: InputFileUnion
"""The static profile photo. Profile photos can't be reused and can only be uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the photo was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
type: Literal[InputProfilePhotoType.STATIC] = InputProfilePhotoType.STATIC,
photo: InputFileUnion,
**__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__(type=type, photo=photo, **__pydantic_kwargs)

View file

@ -0,0 +1,6 @@
from typing import Union
from .input_profile_photo_animated import InputProfilePhotoAnimated
from .input_profile_photo_static import InputProfilePhotoStatic
InputProfilePhotoUnion = Union[InputProfilePhotoStatic, InputProfilePhotoAnimated]

View file

@ -17,7 +17,7 @@ class InputSticker(TelegramObject):
"""
sticker: InputFileUnion
"""The added sticker. Pass a *file_id* as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, upload a new one using multipart/form-data, or pass 'attach://<file_attach_name>' to upload a new one using multipart/form-data under <file_attach_name> name. Animated and video stickers can't be uploaded via HTTP URL. :ref:`More information on Sending Files » <sending-files>`"""
"""The added sticker. Pass a *file_id* as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or pass 'attach://<file_attach_name>' to upload a new file using multipart/form-data under <file_attach_name> name. Animated and video stickers can't be uploaded via HTTP URL. :ref:`More information on Sending Files » <sending-files>`"""
format: str
"""Format of the added sticker, must be one of 'static' for a **.WEBP** or **.PNG** image, 'animated' for a **.TGS** animation, 'video' for a **.WEBM** video"""
emoji_list: list[str]

View file

@ -0,0 +1,14 @@
from __future__ import annotations
from .base import TelegramObject
class InputStoryContent(TelegramObject):
"""
This object describes the content of a story to post. Currently, it can be one of
- :class:`aiogram.types.input_story_content_photo.InputStoryContentPhoto`
- :class:`aiogram.types.input_story_content_video.InputStoryContentVideo`
Source: https://core.telegram.org/bots/api#inputstorycontent
"""

View file

@ -0,0 +1,37 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Literal
from aiogram.enums import InputStoryContentType
from .input_story_content import InputStoryContent
class InputStoryContentPhoto(InputStoryContent):
"""
Describes a photo to post as a story.
Source: https://core.telegram.org/bots/api#inputstorycontentphoto
"""
type: Literal[InputStoryContentType.PHOTO] = InputStoryContentType.PHOTO
"""Type of the content, must be 'photo'"""
photo: str
"""The photo to post as a story. The photo must be of the size 1080x1920 and must not exceed 10 MB. The photo can't be reused and can only be uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the photo was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
type: Literal[InputStoryContentType.PHOTO] = InputStoryContentType.PHOTO,
photo: str,
**__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__(type=type, photo=photo, **__pydantic_kwargs)

View file

@ -0,0 +1,6 @@
from typing import Union
from .input_story_content_photo import InputStoryContentPhoto
from .input_story_content_video import InputStoryContentVideo
InputStoryContentUnion = Union[InputStoryContentPhoto, InputStoryContentVideo]

View file

@ -0,0 +1,53 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Literal, Optional
from aiogram.enums import InputStoryContentType
from .input_story_content import InputStoryContent
class InputStoryContentVideo(InputStoryContent):
"""
Describes a video to post as a story.
Source: https://core.telegram.org/bots/api#inputstorycontentvideo
"""
type: Literal[InputStoryContentType.VIDEO] = InputStoryContentType.VIDEO
"""Type of the content, must be 'video'"""
video: str
"""The video to post as a story. The video must be of the size 720x1280, streamable, encoded with H.265 codec, with key frames added each second in the MPEG4 format, and must not exceed 30 MB. The video can't be reused and can only be uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the video was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`"""
duration: Optional[float] = None
"""*Optional*. Precise duration of the video in seconds; 0-60"""
cover_frame_timestamp: Optional[float] = None
"""*Optional*. Timestamp in seconds of the frame that will be used as the static cover for the story. Defaults to 0.0."""
is_animation: Optional[bool] = None
"""*Optional*. Pass :code:`True` if the video has no sound"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
type: Literal[InputStoryContentType.VIDEO] = InputStoryContentType.VIDEO,
video: str,
duration: Optional[float] = None,
cover_frame_timestamp: Optional[float] = None,
is_animation: 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__(
type=type,
video=video,
duration=duration,
cover_frame_timestamp=cover_frame_timestamp,
is_animation=is_animation,
**__pydantic_kwargs,
)

View file

@ -0,0 +1,47 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional
from .base import TelegramObject
class LocationAddress(TelegramObject):
"""
Describes the physical address of a location.
Source: https://core.telegram.org/bots/api#locationaddress
"""
country_code: str
"""The two-letter ISO 3166-1 alpha-2 country code of the country where the location is located"""
state: Optional[str] = None
"""*Optional*. State of the location"""
city: Optional[str] = None
"""*Optional*. City of the location"""
street: Optional[str] = None
"""*Optional*. Street address of the location"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
country_code: str,
state: Optional[str] = None,
city: Optional[str] = None,
street: 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__(
country_code=country_code,
state=state,
city=city,
street=street,
**__pydantic_kwargs,
)

View file

@ -68,6 +68,7 @@ if TYPE_CHECKING:
from .game import Game
from .general_forum_topic_hidden import GeneralForumTopicHidden
from .general_forum_topic_unhidden import GeneralForumTopicUnhidden
from .gift_info import GiftInfo
from .giveaway import Giveaway
from .giveaway_completed import GiveawayCompleted
from .giveaway_created import GiveawayCreated
@ -77,7 +78,6 @@ if TYPE_CHECKING:
from .input_file_union import InputFileUnion
from .input_media_union import InputMediaUnion
from .input_paid_media_union import InputPaidMediaUnion
from .input_poll_option import InputPollOption
from .input_poll_option_union import InputPollOptionUnion
from .invoice import Invoice
from .labeled_price import LabeledPrice
@ -89,6 +89,7 @@ if TYPE_CHECKING:
from .message_entity import MessageEntity
from .message_origin_union import MessageOriginUnion
from .paid_media_info import PaidMediaInfo
from .paid_message_price_changed import PaidMessagePriceChanged
from .passport_data import PassportData
from .photo_size import PhotoSize
from .poll import Poll
@ -101,6 +102,7 @@ if TYPE_CHECKING:
from .story import Story
from .successful_payment import SuccessfulPayment
from .text_quote import TextQuote
from .unique_gift_info import UniqueGiftInfo
from .user import User
from .user_shared import UserShared
from .users_shared import UsersShared
@ -167,6 +169,8 @@ class Message(MaybeInaccessibleMessage):
"""*Optional*. The unique identifier of a media message group this message belongs to"""
author_signature: Optional[str] = None
"""*Optional*. Signature of the post author for messages in channels, or the custom title of an anonymous group administrator"""
paid_star_count: Optional[int] = None
"""*Optional*. The number of Telegram Stars that were paid by the sender of the message to send it"""
text: Optional[str] = None
"""*Optional*. For text messages, the actual UTF-8 text of the message"""
entities: Optional[list[MessageEntity]] = None
@ -249,6 +253,10 @@ class Message(MaybeInaccessibleMessage):
"""*Optional*. Service message: users were shared with the bot"""
chat_shared: Optional[ChatShared] = None
"""*Optional*. Service message: a chat was shared with the bot"""
gift: Optional[GiftInfo] = None
"""*Optional*. Service message: a regular gift was sent or received"""
unique_gift: Optional[UniqueGiftInfo] = None
"""*Optional*. Service message: a unique gift was sent or received"""
connected_website: Optional[str] = None
"""*Optional*. The domain name of the website on which the user has logged in. `More about Telegram Login » <https://core.telegram.org/widgets/login>`_"""
write_access_allowed: Optional[WriteAccessAllowed] = None
@ -281,6 +289,8 @@ class Message(MaybeInaccessibleMessage):
"""*Optional*. A giveaway with public winners was completed"""
giveaway_completed: Optional[GiveawayCompleted] = None
"""*Optional*. Service message: a giveaway without public winners was completed"""
paid_message_price_changed: Optional[PaidMessagePriceChanged] = None
"""*Optional*. Service message: the price for paid messages has changed in the chat"""
video_chat_scheduled: Optional[VideoChatScheduled] = None
"""*Optional*. Service message: video chat scheduled"""
video_chat_started: Optional[VideoChatStarted] = None
@ -358,6 +368,7 @@ class Message(MaybeInaccessibleMessage):
is_from_offline: Optional[bool] = None,
media_group_id: Optional[str] = None,
author_signature: Optional[str] = None,
paid_star_count: Optional[int] = None,
text: Optional[str] = None,
entities: Optional[list[MessageEntity]] = None,
link_preview_options: Optional[LinkPreviewOptions] = None,
@ -399,6 +410,8 @@ class Message(MaybeInaccessibleMessage):
refunded_payment: Optional[RefundedPayment] = None,
users_shared: Optional[UsersShared] = None,
chat_shared: Optional[ChatShared] = None,
gift: Optional[GiftInfo] = None,
unique_gift: Optional[UniqueGiftInfo] = None,
connected_website: Optional[str] = None,
write_access_allowed: Optional[WriteAccessAllowed] = None,
passport_data: Optional[PassportData] = None,
@ -415,6 +428,7 @@ class Message(MaybeInaccessibleMessage):
giveaway: Optional[Giveaway] = None,
giveaway_winners: Optional[GiveawayWinners] = None,
giveaway_completed: Optional[GiveawayCompleted] = None,
paid_message_price_changed: Optional[PaidMessagePriceChanged] = None,
video_chat_scheduled: Optional[VideoChatScheduled] = None,
video_chat_started: Optional[VideoChatStarted] = None,
video_chat_ended: Optional[VideoChatEnded] = None,
@ -457,6 +471,7 @@ class Message(MaybeInaccessibleMessage):
is_from_offline=is_from_offline,
media_group_id=media_group_id,
author_signature=author_signature,
paid_star_count=paid_star_count,
text=text,
entities=entities,
link_preview_options=link_preview_options,
@ -498,6 +513,8 @@ class Message(MaybeInaccessibleMessage):
refunded_payment=refunded_payment,
users_shared=users_shared,
chat_shared=chat_shared,
gift=gift,
unique_gift=unique_gift,
connected_website=connected_website,
write_access_allowed=write_access_allowed,
passport_data=passport_data,
@ -514,6 +531,7 @@ class Message(MaybeInaccessibleMessage):
giveaway=giveaway,
giveaway_winners=giveaway_winners,
giveaway_completed=giveaway_completed,
paid_message_price_changed=paid_message_price_changed,
video_chat_scheduled=video_chat_scheduled,
video_chat_started=video_chat_started,
video_chat_ended=video_chat_ended,
@ -644,7 +662,12 @@ class Message(MaybeInaccessibleMessage):
return ContentType.BOOST_ADDED
if self.refunded_payment:
return ContentType.REFUNDED_PAYMENT
if self.gift:
return ContentType.GIFT
if self.unique_gift:
return ContentType.UNIQUE_GIFT
if self.paid_message_price_changed:
return ContentType.PAID_MESSAGE_PRICE_CHANGED
return ContentType.UNKNOWN
def _unparse_entities(self, text_decoration: TextDecoration) -> str:
@ -4163,7 +4186,7 @@ class Message(MaybeInaccessibleMessage):
Source: https://core.telegram.org/bots/api#sendpaidmedia
:param star_count: The number of Telegram Stars that must be paid to buy access to the media; 1-2500
:param star_count: The number of Telegram Stars that must be paid to buy access to the media; 1-10000
:param media: A JSON-serialized array describing the media to be sent; up to 10 items
:param payload: Bot-defined paid media payload, 0-128 bytes. This will not be displayed to the user, use it for your internal processes.
:param caption: Media caption, 0-1024 characters after entities parsing
@ -4233,7 +4256,7 @@ class Message(MaybeInaccessibleMessage):
Source: https://core.telegram.org/bots/api#sendpaidmedia
:param star_count: The number of Telegram Stars that must be paid to buy access to the media; 1-2500
:param star_count: The number of Telegram Stars that must be paid to buy access to the media; 1-10000
:param media: A JSON-serialized array describing the media to be sent; up to 10 items
:param payload: Bot-defined paid media payload, 0-128 bytes. This will not be displayed to the user, use it for your internal processes.
:param caption: Media caption, 0-1024 characters after entities parsing

View file

@ -0,0 +1,14 @@
from __future__ import annotations
from .base import TelegramObject
class OwnedGift(TelegramObject):
"""
This object describes a gift received and owned by a user or a chat. Currently, it can be one of
- :class:`aiogram.types.owned_gift_regular.OwnedGiftRegular`
- :class:`aiogram.types.owned_gift_unique.OwnedGiftUnique`
Source: https://core.telegram.org/bots/api#ownedgift
"""

View file

@ -0,0 +1,90 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Literal, Optional
from aiogram.enums import OwnedGiftType
from .owned_gift import OwnedGift
if TYPE_CHECKING:
from .gift import Gift
from .message_entity import MessageEntity
from .user import User
class OwnedGiftRegular(OwnedGift):
"""
Describes a regular gift owned by a user or a chat.
Source: https://core.telegram.org/bots/api#ownedgiftregular
"""
type: Literal[OwnedGiftType.REGULAR] = OwnedGiftType.REGULAR
"""Type of the gift, always 'regular'"""
gift: Gift
"""Information about the regular gift"""
send_date: int
"""Date the gift was sent in Unix time"""
owned_gift_id: Optional[str] = None
"""*Optional*. Unique identifier of the gift for the bot; for gifts received on behalf of business accounts only"""
sender_user: Optional[User] = None
"""*Optional*. Sender of the gift if it is a known user"""
text: Optional[str] = None
"""*Optional*. Text of the message that was added to the gift"""
entities: Optional[list[MessageEntity]] = None
"""*Optional*. Special entities that appear in the text"""
is_private: Optional[bool] = None
"""*Optional*. True, if the sender and gift text are shown only to the gift receiver; otherwise, everyone will be able to see them"""
is_saved: Optional[bool] = None
"""*Optional*. True, if the gift is displayed on the account's profile page; for gifts received on behalf of business accounts only"""
can_be_upgraded: Optional[bool] = None
"""*Optional*. True, if the gift can be upgraded to a unique gift; for gifts received on behalf of business accounts only"""
was_refunded: Optional[bool] = None
"""*Optional*. True, if the gift was refunded and isn't available anymore"""
convert_star_count: Optional[int] = None
"""*Optional*. Number of Telegram Stars that can be claimed by the receiver instead of the gift; omitted if the gift cannot be converted to Telegram Stars"""
prepaid_upgrade_star_count: Optional[int] = None
"""*Optional*. Number of Telegram Stars that were paid by the sender for the ability to upgrade the gift"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
type: Literal[OwnedGiftType.REGULAR] = OwnedGiftType.REGULAR,
gift: Gift,
send_date: int,
owned_gift_id: Optional[str] = None,
sender_user: Optional[User] = None,
text: Optional[str] = None,
entities: Optional[list[MessageEntity]] = None,
is_private: Optional[bool] = None,
is_saved: Optional[bool] = None,
can_be_upgraded: Optional[bool] = None,
was_refunded: Optional[bool] = None,
convert_star_count: Optional[int] = None,
prepaid_upgrade_star_count: 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__(
type=type,
gift=gift,
send_date=send_date,
owned_gift_id=owned_gift_id,
sender_user=sender_user,
text=text,
entities=entities,
is_private=is_private,
is_saved=is_saved,
can_be_upgraded=can_be_upgraded,
was_refunded=was_refunded,
convert_star_count=convert_star_count,
prepaid_upgrade_star_count=prepaid_upgrade_star_count,
**__pydantic_kwargs,
)

View file

@ -0,0 +1,6 @@
from typing import Union
from .owned_gift_regular import OwnedGiftRegular
from .owned_gift_unique import OwnedGiftUnique
OwnedGiftUnion = Union[OwnedGiftRegular, OwnedGiftUnique]

View file

@ -0,0 +1,69 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Literal, Optional
from aiogram.enums import OwnedGiftType
from .owned_gift import OwnedGift
if TYPE_CHECKING:
from .unique_gift import UniqueGift
from .user import User
class OwnedGiftUnique(OwnedGift):
"""
Describes a unique gift received and owned by a user or a chat.
Source: https://core.telegram.org/bots/api#ownedgiftunique
"""
type: Literal[OwnedGiftType.UNIQUE] = OwnedGiftType.UNIQUE
"""Type of the gift, always 'unique'"""
gift: UniqueGift
"""Information about the unique gift"""
send_date: int
"""Date the gift was sent in Unix time"""
owned_gift_id: Optional[str] = None
"""*Optional*. Unique identifier of the received gift for the bot; for gifts received on behalf of business accounts only"""
sender_user: Optional[User] = None
"""*Optional*. Sender of the gift if it is a known user"""
is_saved: Optional[bool] = None
"""*Optional*. True, if the gift is displayed on the account's profile page; for gifts received on behalf of business accounts only"""
can_be_transferred: Optional[bool] = None
"""*Optional*. True, if the gift can be transferred to another owner; for gifts received on behalf of business accounts only"""
transfer_star_count: Optional[int] = None
"""*Optional*. Number of Telegram Stars that must be paid to transfer the gift; omitted if the bot cannot transfer the gift"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
type: Literal[OwnedGiftType.UNIQUE] = OwnedGiftType.UNIQUE,
gift: UniqueGift,
send_date: int,
owned_gift_id: Optional[str] = None,
sender_user: Optional[User] = None,
is_saved: Optional[bool] = None,
can_be_transferred: Optional[bool] = None,
transfer_star_count: 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__(
type=type,
gift=gift,
send_date=send_date,
owned_gift_id=owned_gift_id,
sender_user=sender_user,
is_saved=is_saved,
can_be_transferred=can_be_transferred,
transfer_star_count=transfer_star_count,
**__pydantic_kwargs,
)

View file

@ -0,0 +1,43 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional
from .base import TelegramObject
if TYPE_CHECKING:
from .owned_gift_union import OwnedGiftUnion
class OwnedGifts(TelegramObject):
"""
Contains the list of gifts received and owned by a user or a chat.
Source: https://core.telegram.org/bots/api#ownedgifts
"""
total_count: int
"""The total number of gifts owned by the user or the chat"""
gifts: list[OwnedGiftUnion]
"""The list of gifts"""
next_offset: Optional[str] = None
"""*Optional*. Offset for the next request. If empty, then there are no more results"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
total_count: int,
gifts: list[OwnedGiftUnion],
next_offset: 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__(
total_count=total_count, gifts=gifts, next_offset=next_offset, **__pydantic_kwargs
)

View file

@ -0,0 +1,29 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from .base import TelegramObject
class PaidMessagePriceChanged(TelegramObject):
"""
Describes a service message about a change in the price of paid messages within a chat.
Source: https://core.telegram.org/bots/api#paidmessagepricechanged
"""
paid_message_star_count: int
"""The new number of Telegram Stars that must be paid by non-administrator users of the supergroup chat for each sent message"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__, *, paid_message_star_count: int, **__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__(paid_message_star_count=paid_message_star_count, **__pydantic_kwargs)

View file

@ -0,0 +1,35 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional
from .base import TelegramObject
class StarAmount(TelegramObject):
"""
Describes an amount of Telegram Stars.
Source: https://core.telegram.org/bots/api#staramount
"""
amount: int
"""Integer amount of Telegram Stars, rounded to 0; can be negative"""
nanostar_amount: Optional[int] = None
"""*Optional*. The number of 1/1000000000 shares of Telegram Stars; from -999999999 to 999999999; can be negative if and only if *amount* is non-positive"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
amount: int,
nanostar_amount: 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__(amount=amount, nanostar_amount=nanostar_amount, **__pydantic_kwargs)

View file

@ -0,0 +1,39 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from .base import TelegramObject
if TYPE_CHECKING:
from .story_area_position import StoryAreaPosition
from .story_area_type_union import StoryAreaTypeUnion
class StoryArea(TelegramObject):
"""
Describes a clickable area on a story media.
Source: https://core.telegram.org/bots/api#storyarea
"""
position: StoryAreaPosition
"""Position of the area"""
type: StoryAreaTypeUnion
"""Type of the area"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
position: StoryAreaPosition,
type: StoryAreaTypeUnion,
**__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__(position=position, type=type, **__pydantic_kwargs)

View file

@ -0,0 +1,55 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from .base import TelegramObject
class StoryAreaPosition(TelegramObject):
"""
Describes the position of a clickable area within a story.
Source: https://core.telegram.org/bots/api#storyareaposition
"""
x_percentage: float
"""The abscissa of the area's center, as a percentage of the media width"""
y_percentage: float
"""The ordinate of the area's center, as a percentage of the media height"""
width_percentage: float
"""The width of the area's rectangle, as a percentage of the media width"""
height_percentage: float
"""The height of the area's rectangle, as a percentage of the media height"""
rotation_angle: float
"""The clockwise rotation angle of the rectangle, in degrees; 0-360"""
corner_radius_percentage: float
"""The radius of the rectangle corner rounding, as a percentage of the media width"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
x_percentage: float,
y_percentage: float,
width_percentage: float,
height_percentage: float,
rotation_angle: float,
corner_radius_percentage: float,
**__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__(
x_percentage=x_percentage,
y_percentage=y_percentage,
width_percentage=width_percentage,
height_percentage=height_percentage,
rotation_angle=rotation_angle,
corner_radius_percentage=corner_radius_percentage,
**__pydantic_kwargs,
)

View file

@ -0,0 +1,17 @@
from __future__ import annotations
from .base import TelegramObject
class StoryAreaType(TelegramObject):
"""
Describes the type of a clickable area on a story. Currently, it can be one of
- :class:`aiogram.types.story_area_type_location.StoryAreaTypeLocation`
- :class:`aiogram.types.story_area_type_suggested_reaction.StoryAreaTypeSuggestedReaction`
- :class:`aiogram.types.story_area_type_link.StoryAreaTypeLink`
- :class:`aiogram.types.story_area_type_weather.StoryAreaTypeWeather`
- :class:`aiogram.types.story_area_type_unique_gift.StoryAreaTypeUniqueGift`
Source: https://core.telegram.org/bots/api#storyareatype
"""

View file

@ -0,0 +1,37 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Literal
from aiogram.enums import StoryAreaTypeType
from .story_area_type import StoryAreaType
class StoryAreaTypeLink(StoryAreaType):
"""
Describes a story area pointing to an HTTP or tg:// link. Currently, a story can have up to 3 link areas.
Source: https://core.telegram.org/bots/api#storyareatypelink
"""
type: Literal[StoryAreaTypeType.LINK] = StoryAreaTypeType.LINK
"""Type of the area, always 'link'"""
url: str
"""HTTP or tg:// URL to be opened when the area is clicked"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
type: Literal[StoryAreaTypeType.LINK] = StoryAreaTypeType.LINK,
url: str,
**__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__(type=type, url=url, **__pydantic_kwargs)

View file

@ -0,0 +1,52 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Literal, Optional
from aiogram.enums import StoryAreaTypeType
from .story_area_type import StoryAreaType
if TYPE_CHECKING:
from .location_address import LocationAddress
class StoryAreaTypeLocation(StoryAreaType):
"""
Describes a story area pointing to a location. Currently, a story can have up to 10 location areas.
Source: https://core.telegram.org/bots/api#storyareatypelocation
"""
type: Literal[StoryAreaTypeType.LOCATION] = StoryAreaTypeType.LOCATION
"""Type of the area, always 'location'"""
latitude: float
"""Location latitude in degrees"""
longitude: float
"""Location longitude in degrees"""
address: Optional[LocationAddress] = None
"""*Optional*. Address of the location"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
type: Literal[StoryAreaTypeType.LOCATION] = StoryAreaTypeType.LOCATION,
latitude: float,
longitude: float,
address: Optional[LocationAddress] = 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__(
type=type,
latitude=latitude,
longitude=longitude,
address=address,
**__pydantic_kwargs,
)

View file

@ -0,0 +1,54 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Literal, Optional
from aiogram.enums import StoryAreaTypeType
from .story_area_type import StoryAreaType
if TYPE_CHECKING:
from .reaction_type_union import ReactionTypeUnion
class StoryAreaTypeSuggestedReaction(StoryAreaType):
"""
Describes a story area pointing to a suggested reaction. Currently, a story can have up to 5 suggested reaction areas.
Source: https://core.telegram.org/bots/api#storyareatypesuggestedreaction
"""
type: Literal[StoryAreaTypeType.SUGGESTED_REACTION] = StoryAreaTypeType.SUGGESTED_REACTION
"""Type of the area, always 'suggested_reaction'"""
reaction_type: ReactionTypeUnion
"""Type of the reaction"""
is_dark: Optional[bool] = None
"""*Optional*. Pass :code:`True` if the reaction area has a dark background"""
is_flipped: Optional[bool] = None
"""*Optional*. Pass :code:`True` if reaction area corner is flipped"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
type: Literal[
StoryAreaTypeType.SUGGESTED_REACTION
] = StoryAreaTypeType.SUGGESTED_REACTION,
reaction_type: ReactionTypeUnion,
is_dark: Optional[bool] = None,
is_flipped: 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__(
type=type,
reaction_type=reaction_type,
is_dark=is_dark,
is_flipped=is_flipped,
**__pydantic_kwargs,
)

View file

@ -0,0 +1,15 @@
from typing import Union
from .story_area_type_link import StoryAreaTypeLink
from .story_area_type_location import StoryAreaTypeLocation
from .story_area_type_suggested_reaction import StoryAreaTypeSuggestedReaction
from .story_area_type_unique_gift import StoryAreaTypeUniqueGift
from .story_area_type_weather import StoryAreaTypeWeather
StoryAreaTypeUnion = Union[
StoryAreaTypeLocation,
StoryAreaTypeSuggestedReaction,
StoryAreaTypeLink,
StoryAreaTypeWeather,
StoryAreaTypeUniqueGift,
]

View file

@ -0,0 +1,37 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Literal
from aiogram.enums import StoryAreaTypeType
from .story_area_type import StoryAreaType
class StoryAreaTypeUniqueGift(StoryAreaType):
"""
Describes a story area pointing to a unique gift. Currently, a story can have at most 1 unique gift area.
Source: https://core.telegram.org/bots/api#storyareatypeuniquegift
"""
type: Literal[StoryAreaTypeType.UNIQUE_GIFT] = StoryAreaTypeType.UNIQUE_GIFT
"""Type of the area, always 'unique_gift'"""
name: str
"""Unique name of the gift"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
type: Literal[StoryAreaTypeType.UNIQUE_GIFT] = StoryAreaTypeType.UNIQUE_GIFT,
name: str,
**__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__(type=type, name=name, **__pydantic_kwargs)

View file

@ -0,0 +1,49 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Literal
from aiogram.enums import StoryAreaTypeType
from .story_area_type import StoryAreaType
class StoryAreaTypeWeather(StoryAreaType):
"""
Describes a story area containing weather information. Currently, a story can have up to 3 weather areas.
Source: https://core.telegram.org/bots/api#storyareatypeweather
"""
type: Literal[StoryAreaTypeType.WEATHER] = StoryAreaTypeType.WEATHER
"""Type of the area, always 'weather'"""
temperature: float
"""Temperature, in degree Celsius"""
emoji: str
"""Emoji representing the weather"""
background_color: int
"""A color of the area background in the ARGB format"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
type: Literal[StoryAreaTypeType.WEATHER] = StoryAreaTypeType.WEATHER,
temperature: float,
emoji: str,
background_color: int,
**__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__(
type=type,
temperature=temperature,
emoji=emoji,
background_color=background_color,
**__pydantic_kwargs,
)

View file

@ -21,20 +21,24 @@ class TransactionPartnerUser(TransactionPartner):
type: Literal[TransactionPartnerType.USER] = TransactionPartnerType.USER
"""Type of the transaction partner, always 'user'"""
transaction_type: str
"""Type of the transaction, currently one of 'invoice_payment' for payments via invoices, 'paid_media_payment' for payments for paid media, 'gift_purchase' for gifts sent by the bot, 'premium_purchase' for Telegram Premium subscriptions gifted by the bot, 'business_account_transfer' for direct transfers from managed business accounts"""
user: User
"""Information about the user"""
affiliate: Optional[AffiliateInfo] = None
"""*Optional*. Information about the affiliate that received a commission via this transaction"""
"""*Optional*. Information about the affiliate that received a commission via this transaction. Can be available only for 'invoice_payment' and 'paid_media_payment' transactions."""
invoice_payload: Optional[str] = None
"""*Optional*. Bot-specified invoice payload"""
"""*Optional*. Bot-specified invoice payload. Can be available only for 'invoice_payment' transactions."""
subscription_period: Optional[int] = None
"""*Optional*. The duration of the paid subscription"""
"""*Optional*. The duration of the paid subscription. Can be available only for 'invoice_payment' transactions."""
paid_media: Optional[list[PaidMediaUnion]] = None
"""*Optional*. Information about the paid media bought by the user"""
"""*Optional*. Information about the paid media bought by the user; for 'paid_media_payment' transactions only"""
paid_media_payload: Optional[str] = None
"""*Optional*. Bot-specified paid media payload"""
"""*Optional*. Bot-specified paid media payload. Can be available only for 'paid_media_payment' transactions."""
gift: Optional[Gift] = None
"""*Optional*. The gift sent to the user by the bot"""
"""*Optional*. The gift sent to the user by the bot; for 'gift_purchase' transactions only"""
premium_subscription_duration: Optional[int] = None
"""*Optional*. Number of months the gifted Telegram Premium subscription will be active for; for 'premium_purchase' transactions only"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
@ -44,6 +48,7 @@ class TransactionPartnerUser(TransactionPartner):
__pydantic__self__,
*,
type: Literal[TransactionPartnerType.USER] = TransactionPartnerType.USER,
transaction_type: str,
user: User,
affiliate: Optional[AffiliateInfo] = None,
invoice_payload: Optional[str] = None,
@ -51,6 +56,7 @@ class TransactionPartnerUser(TransactionPartner):
paid_media: Optional[list[PaidMediaUnion]] = None,
paid_media_payload: Optional[str] = None,
gift: Optional[Gift] = None,
premium_subscription_duration: Optional[int] = None,
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!
@ -59,6 +65,7 @@ class TransactionPartnerUser(TransactionPartner):
super().__init__(
type=type,
transaction_type=transaction_type,
user=user,
affiliate=affiliate,
invoice_payload=invoice_payload,
@ -66,5 +73,6 @@ class TransactionPartnerUser(TransactionPartner):
paid_media=paid_media,
paid_media_payload=paid_media_payload,
gift=gift,
premium_subscription_duration=premium_subscription_duration,
**__pydantic_kwargs,
)

View file

@ -0,0 +1,60 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from .base import TelegramObject
if TYPE_CHECKING:
from .unique_gift_backdrop import UniqueGiftBackdrop
from .unique_gift_model import UniqueGiftModel
from .unique_gift_symbol import UniqueGiftSymbol
class UniqueGift(TelegramObject):
"""
This object describes a unique gift that was upgraded from a regular gift.
Source: https://core.telegram.org/bots/api#uniquegift
"""
base_name: str
"""Human-readable name of the regular gift from which this unique gift was upgraded"""
name: str
"""Unique name of the gift. This name can be used in :code:`https://t.me/nft/...` links and story areas"""
number: int
"""Unique number of the upgraded gift among gifts upgraded from the same regular gift"""
model: UniqueGiftModel
"""Model of the gift"""
symbol: UniqueGiftSymbol
"""Symbol of the gift"""
backdrop: UniqueGiftBackdrop
"""Backdrop of the gift"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
base_name: str,
name: str,
number: int,
model: UniqueGiftModel,
symbol: UniqueGiftSymbol,
backdrop: UniqueGiftBackdrop,
**__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__(
base_name=base_name,
name=name,
number=number,
model=model,
symbol=symbol,
backdrop=backdrop,
**__pydantic_kwargs,
)

View file

@ -0,0 +1,43 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from .base import TelegramObject
if TYPE_CHECKING:
from .unique_gift_backdrop_colors import UniqueGiftBackdropColors
class UniqueGiftBackdrop(TelegramObject):
"""
This object describes the backdrop of a unique gift.
Source: https://core.telegram.org/bots/api#uniquegiftbackdrop
"""
name: str
"""Name of the backdrop"""
colors: UniqueGiftBackdropColors
"""Colors of the backdrop"""
rarity_per_mille: int
"""The number of unique gifts that receive this backdrop for every 1000 gifts upgraded"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
name: str,
colors: UniqueGiftBackdropColors,
rarity_per_mille: int,
**__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__(
name=name, colors=colors, rarity_per_mille=rarity_per_mille, **__pydantic_kwargs
)

View file

@ -0,0 +1,47 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from .base import TelegramObject
class UniqueGiftBackdropColors(TelegramObject):
"""
This object describes the colors of the backdrop of a unique gift.
Source: https://core.telegram.org/bots/api#uniquegiftbackdropcolors
"""
center_color: int
"""The color in the center of the backdrop in RGB format"""
edge_color: int
"""The color on the edges of the backdrop in RGB format"""
symbol_color: int
"""The color to be applied to the symbol in RGB format"""
text_color: int
"""The color for the text on the backdrop in RGB format"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
center_color: int,
edge_color: int,
symbol_color: int,
text_color: int,
**__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__(
center_color=center_color,
edge_color=edge_color,
symbol_color=symbol_color,
text_color=text_color,
**__pydantic_kwargs,
)

View file

@ -0,0 +1,50 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional
from .base import TelegramObject
if TYPE_CHECKING:
from .unique_gift import UniqueGift
class UniqueGiftInfo(TelegramObject):
"""
Describes a service message about a unique gift that was sent or received.
Source: https://core.telegram.org/bots/api#uniquegiftinfo
"""
gift: UniqueGift
"""Information about the gift"""
origin: str
"""Origin of the gift. Currently, either 'upgrade' or 'transfer'"""
owned_gift_id: Optional[str] = None
"""*Optional*. Unique identifier of the received gift for the bot; only present for gifts received on behalf of business accounts"""
transfer_star_count: Optional[int] = None
"""*Optional*. Number of Telegram Stars that must be paid to transfer the gift; omitted if the bot cannot transfer the gift"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
gift: UniqueGift,
origin: str,
owned_gift_id: Optional[str] = None,
transfer_star_count: 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__(
gift=gift,
origin=origin,
owned_gift_id=owned_gift_id,
transfer_star_count=transfer_star_count,
**__pydantic_kwargs,
)

View file

@ -0,0 +1,43 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from .base import TelegramObject
if TYPE_CHECKING:
from .sticker import Sticker
class UniqueGiftModel(TelegramObject):
"""
This object describes the model of a unique gift.
Source: https://core.telegram.org/bots/api#uniquegiftmodel
"""
name: str
"""Name of the model"""
sticker: Sticker
"""The sticker that represents the unique gift"""
rarity_per_mille: int
"""The number of unique gifts that receive this model for every 1000 gifts upgraded"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
name: str,
sticker: Sticker,
rarity_per_mille: int,
**__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__(
name=name, sticker=sticker, rarity_per_mille=rarity_per_mille, **__pydantic_kwargs
)

View file

@ -0,0 +1,43 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from .base import TelegramObject
if TYPE_CHECKING:
from .sticker import Sticker
class UniqueGiftSymbol(TelegramObject):
"""
This object describes the symbol shown on the pattern of a unique gift.
Source: https://core.telegram.org/bots/api#uniquegiftsymbol
"""
name: str
"""Name of the symbol"""
sticker: Sticker
"""The sticker that represents the unique gift"""
rarity_per_mille: int
"""The number of unique gifts that receive this model for every 1000 gifts upgraded"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
name: str,
sticker: Sticker,
rarity_per_mille: int,
**__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__(
name=name, sticker=sticker, rarity_per_mille=rarity_per_mille, **__pydantic_kwargs
)