mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
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:
parent
25e9127db9
commit
2c2bd61551
231 changed files with 9565 additions and 389 deletions
|
|
@ -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",
|
||||
|
|
|
|||
42
aiogram/methods/convert_gift_to_stars.py
Normal file
42
aiogram/methods/convert_gift_to_stars.py
Normal 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,
|
||||
)
|
||||
|
|
@ -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"""
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
42
aiogram/methods/delete_business_messages.py
Normal file
42
aiogram/methods/delete_business_messages.py
Normal 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,
|
||||
)
|
||||
42
aiogram/methods/delete_story.py
Normal file
42
aiogram/methods/delete_story.py
Normal 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,
|
||||
)
|
||||
63
aiogram/methods/edit_story.py
Normal file
63
aiogram/methods/edit_story.py
Normal 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,
|
||||
)
|
||||
71
aiogram/methods/get_business_account_gifts.py
Normal file
71
aiogram/methods/get_business_account_gifts.py
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING, Any, Optional
|
||||
|
||||
from ..types import OwnedGifts
|
||||
from .base import TelegramMethod
|
||||
|
||||
|
||||
class 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,
|
||||
)
|
||||
33
aiogram/methods/get_business_account_star_balance.py
Normal file
33
aiogram/methods/get_business_account_star_balance.py
Normal 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)
|
||||
59
aiogram/methods/gift_premium_subscription.py
Normal file
59
aiogram/methods/gift_premium_subscription.py
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING, Any, Optional
|
||||
|
||||
from ..types import MessageEntity
|
||||
from .base import TelegramMethod
|
||||
|
||||
|
||||
class 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,
|
||||
)
|
||||
71
aiogram/methods/post_story.py
Normal file
71
aiogram/methods/post_story.py
Normal 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,
|
||||
)
|
||||
46
aiogram/methods/read_business_message.py
Normal file
46
aiogram/methods/read_business_message.py
Normal 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,
|
||||
)
|
||||
42
aiogram/methods/remove_business_account_profile_photo.py
Normal file
42
aiogram/methods/remove_business_account_profile_photo.py
Normal 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,
|
||||
)
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
40
aiogram/methods/set_business_account_bio.py
Normal file
40
aiogram/methods/set_business_account_bio.py
Normal 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
|
||||
)
|
||||
47
aiogram/methods/set_business_account_gift_settings.py
Normal file
47
aiogram/methods/set_business_account_gift_settings.py
Normal 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,
|
||||
)
|
||||
46
aiogram/methods/set_business_account_name.py
Normal file
46
aiogram/methods/set_business_account_name.py
Normal 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,
|
||||
)
|
||||
47
aiogram/methods/set_business_account_profile_photo.py
Normal file
47
aiogram/methods/set_business_account_profile_photo.py
Normal 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,
|
||||
)
|
||||
42
aiogram/methods/set_business_account_username.py
Normal file
42
aiogram/methods/set_business_account_username.py
Normal 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,
|
||||
)
|
||||
42
aiogram/methods/transfer_business_account_stars.py
Normal file
42
aiogram/methods/transfer_business_account_stars.py
Normal 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,
|
||||
)
|
||||
50
aiogram/methods/transfer_gift.py
Normal file
50
aiogram/methods/transfer_gift.py
Normal 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,
|
||||
)
|
||||
50
aiogram/methods/upgrade_gift.py
Normal file
50
aiogram/methods/upgrade_gift.py
Normal 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,
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue