Третий коммит, добавление share, share_kb, а также ADMIN_ID

This commit is contained in:
2025-07-22 13:50:14 +03:00
parent 849feb7beb
commit b98123f4dc
1479 changed files with 323549 additions and 11 deletions

View File

@@ -0,0 +1,313 @@
from .add_sticker_to_set import AddStickerToSet
from .answer_callback_query import AnswerCallbackQuery
from .answer_inline_query import AnswerInlineQuery
from .answer_pre_checkout_query import AnswerPreCheckoutQuery
from .answer_shipping_query import AnswerShippingQuery
from .answer_web_app_query import AnswerWebAppQuery
from .approve_chat_join_request import ApproveChatJoinRequest
from .ban_chat_member import BanChatMember
from .ban_chat_sender_chat import BanChatSenderChat
from .base import Request, Response, TelegramMethod
from .close import Close
from .close_forum_topic import CloseForumTopic
from .close_general_forum_topic import CloseGeneralForumTopic
from .convert_gift_to_stars import ConvertGiftToStars
from .copy_message import CopyMessage
from .copy_messages import CopyMessages
from .create_chat_invite_link import CreateChatInviteLink
from .create_chat_subscription_invite_link import CreateChatSubscriptionInviteLink
from .create_forum_topic import CreateForumTopic
from .create_invoice_link import CreateInvoiceLink
from .create_new_sticker_set import CreateNewStickerSet
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
from .delete_message import DeleteMessage
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
from .edit_forum_topic import EditForumTopic
from .edit_general_forum_topic import EditGeneralForumTopic
from .edit_message_caption import EditMessageCaption
from .edit_message_live_location import EditMessageLiveLocation
from .edit_message_media import EditMessageMedia
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
from .get_chat_member import GetChatMember
from .get_chat_member_count import GetChatMemberCount
from .get_chat_menu_button import GetChatMenuButton
from .get_custom_emoji_stickers import GetCustomEmojiStickers
from .get_file import GetFile
from .get_forum_topic_icon_stickers import GetForumTopicIconStickers
from .get_game_high_scores import GetGameHighScores
from .get_me import GetMe
from .get_my_commands import GetMyCommands
from .get_my_default_administrator_rights import GetMyDefaultAdministratorRights
from .get_my_description import GetMyDescription
from .get_my_name import GetMyName
from .get_my_short_description import GetMyShortDescription
from .get_star_transactions import GetStarTransactions
from .get_sticker_set import GetStickerSet
from .get_updates import GetUpdates
from .get_user_chat_boosts import GetUserChatBoosts
from .get_user_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
from .reopen_general_forum_topic import ReopenGeneralForumTopic
from .replace_sticker_in_set import ReplaceStickerInSet
from .restrict_chat_member import RestrictChatMember
from .revoke_chat_invite_link import RevokeChatInviteLink
from .save_prepared_inline_message import SavePreparedInlineMessage
from .send_animation import SendAnimation
from .send_audio import SendAudio
from .send_chat_action import SendChatAction
from .send_contact import SendContact
from .send_dice import SendDice
from .send_document import SendDocument
from .send_game import SendGame
from .send_gift import SendGift
from .send_invoice import SendInvoice
from .send_location import SendLocation
from .send_media_group import SendMediaGroup
from .send_message import SendMessage
from .send_paid_media import SendPaidMedia
from .send_photo import SendPhoto
from .send_poll import SendPoll
from .send_sticker import SendSticker
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
from .set_chat_permissions import SetChatPermissions
from .set_chat_photo import SetChatPhoto
from .set_chat_sticker_set import SetChatStickerSet
from .set_chat_title import SetChatTitle
from .set_custom_emoji_sticker_set_thumbnail import SetCustomEmojiStickerSetThumbnail
from .set_game_score import SetGameScore
from .set_message_reaction import SetMessageReaction
from .set_my_commands import SetMyCommands
from .set_my_default_administrator_rights import SetMyDefaultAdministratorRights
from .set_my_description import SetMyDescription
from .set_my_name import SetMyName
from .set_my_short_description import SetMyShortDescription
from .set_passport_data_errors import SetPassportDataErrors
from .set_sticker_emoji_list import SetStickerEmojiList
from .set_sticker_keywords import SetStickerKeywords
from .set_sticker_mask_position import SetStickerMaskPosition
from .set_sticker_position_in_set import SetStickerPositionInSet
from .set_sticker_set_thumbnail import SetStickerSetThumbnail
from .set_sticker_set_title import SetStickerSetTitle
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
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
__all__ = (
"AddStickerToSet",
"AnswerCallbackQuery",
"AnswerInlineQuery",
"AnswerPreCheckoutQuery",
"AnswerShippingQuery",
"AnswerWebAppQuery",
"ApproveChatJoinRequest",
"BanChatMember",
"BanChatSenderChat",
"Close",
"CloseForumTopic",
"CloseGeneralForumTopic",
"ConvertGiftToStars",
"CopyMessage",
"CopyMessages",
"CreateChatInviteLink",
"CreateChatSubscriptionInviteLink",
"CreateForumTopic",
"CreateInvoiceLink",
"CreateNewStickerSet",
"DeclineChatJoinRequest",
"DeleteBusinessMessages",
"DeleteChatPhoto",
"DeleteChatStickerSet",
"DeleteForumTopic",
"DeleteMessage",
"DeleteMessages",
"DeleteMyCommands",
"DeleteStickerFromSet",
"DeleteStickerSet",
"DeleteStory",
"DeleteWebhook",
"EditChatInviteLink",
"EditChatSubscriptionInviteLink",
"EditForumTopic",
"EditGeneralForumTopic",
"EditMessageCaption",
"EditMessageLiveLocation",
"EditMessageMedia",
"EditMessageReplyMarkup",
"EditMessageText",
"EditStory",
"EditUserStarSubscription",
"ExportChatInviteLink",
"ForwardMessage",
"ForwardMessages",
"GetAvailableGifts",
"GetBusinessAccountGifts",
"GetBusinessAccountStarBalance",
"GetBusinessConnection",
"GetChat",
"GetChatAdministrators",
"GetChatMember",
"GetChatMemberCount",
"GetChatMenuButton",
"GetCustomEmojiStickers",
"GetFile",
"GetForumTopicIconStickers",
"GetGameHighScores",
"GetMe",
"GetMyCommands",
"GetMyDefaultAdministratorRights",
"GetMyDescription",
"GetMyName",
"GetMyShortDescription",
"GetStarTransactions",
"GetStickerSet",
"GetUpdates",
"GetUserChatBoosts",
"GetUserProfilePhotos",
"GetWebhookInfo",
"GiftPremiumSubscription",
"HideGeneralForumTopic",
"LeaveChat",
"LogOut",
"PinChatMessage",
"PostStory",
"PromoteChatMember",
"ReadBusinessMessage",
"RefundStarPayment",
"RemoveBusinessAccountProfilePhoto",
"RemoveChatVerification",
"RemoveUserVerification",
"ReopenForumTopic",
"ReopenGeneralForumTopic",
"ReplaceStickerInSet",
"Request",
"Response",
"RestrictChatMember",
"RevokeChatInviteLink",
"SavePreparedInlineMessage",
"SendAnimation",
"SendAudio",
"SendChatAction",
"SendContact",
"SendDice",
"SendDocument",
"SendGame",
"SendGift",
"SendInvoice",
"SendLocation",
"SendMediaGroup",
"SendMessage",
"SendPaidMedia",
"SendPhoto",
"SendPoll",
"SendSticker",
"SendVenue",
"SendVideo",
"SendVideoNote",
"SendVoice",
"SetBusinessAccountBio",
"SetBusinessAccountGiftSettings",
"SetBusinessAccountName",
"SetBusinessAccountProfilePhoto",
"SetBusinessAccountUsername",
"SetChatAdministratorCustomTitle",
"SetChatDescription",
"SetChatMenuButton",
"SetChatPermissions",
"SetChatPhoto",
"SetChatStickerSet",
"SetChatTitle",
"SetCustomEmojiStickerSetThumbnail",
"SetGameScore",
"SetMessageReaction",
"SetMyCommands",
"SetMyDefaultAdministratorRights",
"SetMyDescription",
"SetMyName",
"SetMyShortDescription",
"SetPassportDataErrors",
"SetStickerEmojiList",
"SetStickerKeywords",
"SetStickerMaskPosition",
"SetStickerPositionInSet",
"SetStickerSetThumbnail",
"SetStickerSetTitle",
"SetUserEmojiStatus",
"SetWebhook",
"StopMessageLiveLocation",
"StopPoll",
"TelegramMethod",
"TransferBusinessAccountStars",
"TransferGift",
"UnbanChatMember",
"UnbanChatSenderChat",
"UnhideGeneralForumTopic",
"UnpinAllChatMessages",
"UnpinAllForumTopicMessages",
"UnpinAllGeneralForumTopicMessages",
"UnpinChatMessage",
"UpgradeGift",
"UploadStickerFile",
"VerifyChat",
"VerifyUser",
)

View File

@@ -0,0 +1,42 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from ..types import InputSticker
from .base import TelegramMethod
class AddStickerToSet(TelegramMethod[bool]):
"""
Use this method to add a new sticker to a set created by the bot. Emoji sticker sets can have up to 200 stickers. Other sticker sets can have up to 120 stickers. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#addstickertoset
"""
__returning__ = bool
__api_method__ = "addStickerToSet"
user_id: int
"""User identifier of sticker set owner"""
name: str
"""Sticker set name"""
sticker: InputSticker
"""A JSON-serialized object with information about the added sticker. If exactly the same sticker had already been added to the set, then the set isn't changed."""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
user_id: int,
name: str,
sticker: InputSticker,
**__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, name=name, sticker=sticker, **__pydantic_kwargs)

View File

@@ -0,0 +1,56 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional
from .base import TelegramMethod
class AnswerCallbackQuery(TelegramMethod[bool]):
"""
Use this method to send answers to callback queries sent from `inline keyboards <https://core.telegram.org/bots/features#inline-keyboards>`_. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. On success, :code:`True` is returned.
Alternatively, the user can be redirected to the specified Game URL. For this option to work, you must first create a game for your bot via `@BotFather <https://t.me/botfather>`_ and accept the terms. Otherwise, you may use links like :code:`t.me/your_bot?start=XXXX` that open your bot with a parameter.
Source: https://core.telegram.org/bots/api#answercallbackquery
"""
__returning__ = bool
__api_method__ = "answerCallbackQuery"
callback_query_id: str
"""Unique identifier for the query to be answered"""
text: Optional[str] = None
"""Text of the notification. If not specified, nothing will be shown to the user, 0-200 characters"""
show_alert: Optional[bool] = None
"""If :code:`True`, an alert will be shown by the client instead of a notification at the top of the chat screen. Defaults to *false*."""
url: Optional[str] = None
"""URL that will be opened by the user's client. If you have created a :class:`aiogram.types.game.Game` and accepted the conditions via `@BotFather <https://t.me/botfather>`_, specify the URL that opens your game - note that this will only work if the query comes from a `https://core.telegram.org/bots/api#inlinekeyboardbutton <https://core.telegram.org/bots/api#inlinekeyboardbutton>`_ *callback_game* button."""
cache_time: Optional[int] = None
"""The maximum amount of time in seconds that the result of the callback query may be cached client-side. Telegram apps will support caching starting in version 3.14. Defaults to 0."""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
callback_query_id: str,
text: Optional[str] = None,
show_alert: Optional[bool] = None,
url: Optional[str] = None,
cache_time: 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__(
callback_query_id=callback_query_id,
text=text,
show_alert=show_alert,
url=url,
cache_time=cache_time,
**__pydantic_kwargs,
)

View File

@@ -0,0 +1,77 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional
from pydantic import Field
from ..types import InlineQueryResultsButton, InlineQueryResultUnion
from .base import TelegramMethod
class AnswerInlineQuery(TelegramMethod[bool]):
"""
Use this method to send answers to an inline query. On success, :code:`True` is returned.
No more than **50** results per query are allowed.
Source: https://core.telegram.org/bots/api#answerinlinequery
"""
__returning__ = bool
__api_method__ = "answerInlineQuery"
inline_query_id: str
"""Unique identifier for the answered query"""
results: list[InlineQueryResultUnion]
"""A JSON-serialized array of results for the inline query"""
cache_time: Optional[int] = None
"""The maximum amount of time in seconds that the result of the inline query may be cached on the server. Defaults to 300."""
is_personal: Optional[bool] = None
"""Pass :code:`True` if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query."""
next_offset: Optional[str] = None
"""Pass the offset that a client should send in the next query with the same text to receive more results. Pass an empty string if there are no more results or if you don't support pagination. Offset length can't exceed 64 bytes."""
button: Optional[InlineQueryResultsButton] = None
"""A JSON-serialized object describing a button to be shown above inline query results"""
switch_pm_parameter: Optional[str] = Field(None, json_schema_extra={"deprecated": True})
"""`Deep-linking <https://core.telegram.org/bots/features#deep-linking>`_ parameter for the /start message sent to the bot when user presses the switch button. 1-64 characters, only :code:`A-Z`, :code:`a-z`, :code:`0-9`, :code:`_` and :code:`-` are allowed.
.. deprecated:: API:6.7
https://core.telegram.org/bots/api-changelog#april-21-2023"""
switch_pm_text: Optional[str] = Field(None, json_schema_extra={"deprecated": True})
"""If passed, clients will display a button with specified text that switches the user to a private chat with the bot and sends the bot a start message with the parameter *switch_pm_parameter*
.. deprecated:: API:6.7
https://core.telegram.org/bots/api-changelog#april-21-2023"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
inline_query_id: str,
results: list[InlineQueryResultUnion],
cache_time: Optional[int] = None,
is_personal: Optional[bool] = None,
next_offset: Optional[str] = None,
button: Optional[InlineQueryResultsButton] = None,
switch_pm_parameter: Optional[str] = None,
switch_pm_text: 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__(
inline_query_id=inline_query_id,
results=results,
cache_time=cache_time,
is_personal=is_personal,
next_offset=next_offset,
button=button,
switch_pm_parameter=switch_pm_parameter,
switch_pm_text=switch_pm_text,
**__pydantic_kwargs,
)

View File

@@ -0,0 +1,46 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional
from .base import TelegramMethod
class AnswerPreCheckoutQuery(TelegramMethod[bool]):
"""
Once the user has confirmed their payment and shipping details, the Bot API sends the final confirmation in the form of an :class:`aiogram.types.update.Update` with the field *pre_checkout_query*. Use this method to respond to such pre-checkout queries. On success, :code:`True` is returned. **Note:** The Bot API must receive an answer within 10 seconds after the pre-checkout query was sent.
Source: https://core.telegram.org/bots/api#answerprecheckoutquery
"""
__returning__ = bool
__api_method__ = "answerPreCheckoutQuery"
pre_checkout_query_id: str
"""Unique identifier for the query to be answered"""
ok: bool
"""Specify :code:`True` if everything is alright (goods are available, etc.) and the bot is ready to proceed with the order. Use :code:`False` if there are any problems."""
error_message: Optional[str] = None
"""Required if *ok* is :code:`False`. Error message in human readable form that explains the reason for failure to proceed with the checkout (e.g. "Sorry, somebody just bought the last of our amazing black T-shirts while you were busy filling out your payment details. Please choose a different color or garment!"). Telegram will display this message to the user."""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
pre_checkout_query_id: str,
ok: bool,
error_message: 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__(
pre_checkout_query_id=pre_checkout_query_id,
ok=ok,
error_message=error_message,
**__pydantic_kwargs,
)

View File

@@ -0,0 +1,51 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional
from ..types import ShippingOption
from .base import TelegramMethod
class AnswerShippingQuery(TelegramMethod[bool]):
"""
If you sent an invoice requesting a shipping address and the parameter *is_flexible* was specified, the Bot API will send an :class:`aiogram.types.update.Update` with a *shipping_query* field to the bot. Use this method to reply to shipping queries. On success, :code:`True` is returned.
Source: https://core.telegram.org/bots/api#answershippingquery
"""
__returning__ = bool
__api_method__ = "answerShippingQuery"
shipping_query_id: str
"""Unique identifier for the query to be answered"""
ok: bool
"""Pass :code:`True` if delivery to the specified address is possible and :code:`False` if there are any problems (for example, if delivery to the specified address is not possible)"""
shipping_options: Optional[list[ShippingOption]] = None
"""Required if *ok* is :code:`True`. A JSON-serialized array of available shipping options."""
error_message: Optional[str] = None
"""Required if *ok* is :code:`False`. Error message in human readable form that explains why it is impossible to complete the order (e.g. 'Sorry, delivery to your desired address is unavailable'). Telegram will display this message to the user."""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
shipping_query_id: str,
ok: bool,
shipping_options: Optional[list[ShippingOption]] = None,
error_message: 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__(
shipping_query_id=shipping_query_id,
ok=ok,
shipping_options=shipping_options,
error_message=error_message,
**__pydantic_kwargs,
)

View File

@@ -0,0 +1,39 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from ..types import InlineQueryResultUnion, SentWebAppMessage
from .base import TelegramMethod
class AnswerWebAppQuery(TelegramMethod[SentWebAppMessage]):
"""
Use this method to set the result of an interaction with a `Web App <https://core.telegram.org/bots/webapps>`_ and send a corresponding message on behalf of the user to the chat from which the query originated. On success, a :class:`aiogram.types.sent_web_app_message.SentWebAppMessage` object is returned.
Source: https://core.telegram.org/bots/api#answerwebappquery
"""
__returning__ = SentWebAppMessage
__api_method__ = "answerWebAppQuery"
web_app_query_id: str
"""Unique identifier for the query to be answered"""
result: InlineQueryResultUnion
"""A JSON-serialized object describing the message to be sent"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
web_app_query_id: str,
result: InlineQueryResultUnion,
**__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__(web_app_query_id=web_app_query_id, result=result, **__pydantic_kwargs)

View File

@@ -0,0 +1,35 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion
from .base import TelegramMethod
class ApproveChatJoinRequest(TelegramMethod[bool]):
"""
Use this method to approve a chat join request. The bot must be an administrator in the chat for this to work and must have the *can_invite_users* administrator right. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#approvechatjoinrequest
"""
__returning__ = bool
__api_method__ = "approveChatJoinRequest"
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
user_id: int
"""Unique identifier of the target user"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__, *, chat_id: ChatIdUnion, user_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__(chat_id=chat_id, user_id=user_id, **__pydantic_kwargs)

View File

@@ -0,0 +1,51 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional
from ..types import ChatIdUnion, DateTimeUnion
from .base import TelegramMethod
class BanChatMember(TelegramMethod[bool]):
"""
Use this method to ban a user in a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the chat on their own using invite links, etc., unless `unbanned <https://core.telegram.org/bots/api#unbanchatmember>`_ first. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#banchatmember
"""
__returning__ = bool
__api_method__ = "banChatMember"
chat_id: ChatIdUnion
"""Unique identifier for the target group or username of the target supergroup or channel (in the format :code:`@channelusername`)"""
user_id: int
"""Unique identifier of the target user"""
until_date: Optional[DateTimeUnion] = None
"""Date when the user will be unbanned; Unix time. If user is banned for more than 366 days or less than 30 seconds from the current time they are considered to be banned forever. Applied for supergroups and channels only."""
revoke_messages: Optional[bool] = None
"""Pass :code:`True` to delete all messages from the chat for the user that is being removed. If :code:`False`, the user will be able to see messages in the group that were sent before the user was removed. Always :code:`True` for supergroups and channels."""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
chat_id: ChatIdUnion,
user_id: int,
until_date: Optional[DateTimeUnion] = None,
revoke_messages: 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__(
chat_id=chat_id,
user_id=user_id,
until_date=until_date,
revoke_messages=revoke_messages,
**__pydantic_kwargs,
)

View File

@@ -0,0 +1,39 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion
from .base import TelegramMethod
class BanChatSenderChat(TelegramMethod[bool]):
"""
Use this method to ban a channel chat in a supergroup or a channel. Until the chat is `unbanned <https://core.telegram.org/bots/api#unbanchatsenderchat>`_, the owner of the banned chat won't be able to send messages on behalf of **any of their channels**. The bot must be an administrator in the supergroup or channel for this to work and must have the appropriate administrator rights. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#banchatsenderchat
"""
__returning__ = bool
__api_method__ = "banChatSenderChat"
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
sender_chat_id: int
"""Unique identifier of the target sender chat"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
chat_id: ChatIdUnion,
sender_chat_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__(chat_id=chat_id, sender_chat_id=sender_chat_id, **__pydantic_kwargs)

View File

@@ -0,0 +1,95 @@
from __future__ import annotations
from abc import ABC, abstractmethod
from typing import (
TYPE_CHECKING,
Any,
ClassVar,
Dict,
Generator,
Generic,
Optional,
TypeVar,
)
from pydantic import BaseModel, ConfigDict
from pydantic.functional_validators import model_validator
from aiogram.client.context_controller import BotContextController
from ..types import InputFile, ResponseParameters
from ..types.base import UNSET_TYPE
if TYPE_CHECKING:
from ..client.bot import Bot
TelegramType = TypeVar("TelegramType", bound=Any)
class Request(BaseModel):
model_config = ConfigDict(arbitrary_types_allowed=True)
method: str
data: Dict[str, Optional[Any]]
files: Optional[Dict[str, InputFile]]
class Response(BaseModel, Generic[TelegramType]):
ok: bool
result: Optional[TelegramType] = None
description: Optional[str] = None
error_code: Optional[int] = None
parameters: Optional[ResponseParameters] = None
class TelegramMethod(BotContextController, BaseModel, Generic[TelegramType], ABC):
model_config = ConfigDict(
extra="allow",
populate_by_name=True,
arbitrary_types_allowed=True,
)
@model_validator(mode="before")
@classmethod
def remove_unset(cls, values: Dict[str, Any]) -> Dict[str, Any]:
"""
Remove UNSET before fields validation.
We use UNSET as a sentinel value for `parse_mode` and replace it to real value later.
It isn't a problem when it's just default value for a model field,
but UNSET might be passing to a model initialization from `Bot.method_name`,
so we must take care of it and remove it before fields validation.
"""
if not isinstance(values, dict):
return values
return {k: v for k, v in values.items() if not isinstance(v, UNSET_TYPE)}
if TYPE_CHECKING:
__returning__: ClassVar[Any]
__api_method__: ClassVar[str]
else:
@property
@abstractmethod
def __returning__(self) -> type:
pass
@property
@abstractmethod
def __api_method__(self) -> str:
pass
async def emit(self, bot: Bot) -> TelegramType:
return await bot(self)
def __await__(self) -> Generator[Any, None, TelegramType]:
bot = self._bot
if not bot:
raise RuntimeError(
"This method is not mounted to a any bot instance, please call it explicilty "
"with bot instance `await bot(method)`\n"
"or mount method to a bot instance `method.as_(bot)` "
"and then call it `await method`"
)
return self.emit(bot).__await__()

View File

@@ -0,0 +1,14 @@
from __future__ import annotations
from .base import TelegramMethod
class Close(TelegramMethod[bool]):
"""
Use this method to close the bot instance before moving it from one local server to another. You need to delete the webhook before calling this method to ensure that the bot isn't launched again after server restart. The method will return error 429 in the first 10 minutes after the bot is launched. Returns :code:`True` on success. Requires no parameters.
Source: https://core.telegram.org/bots/api#close
"""
__returning__ = bool
__api_method__ = "close"

View File

@@ -0,0 +1,41 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion
from .base import TelegramMethod
class CloseForumTopic(TelegramMethod[bool]):
"""
Use this method to close an open topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the *can_manage_topics* administrator rights, unless it is the creator of the topic. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#closeforumtopic
"""
__returning__ = bool
__api_method__ = "closeForumTopic"
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)"""
message_thread_id: int
"""Unique identifier for the target message thread of the forum topic"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
chat_id: ChatIdUnion,
message_thread_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__(
chat_id=chat_id, message_thread_id=message_thread_id, **__pydantic_kwargs
)

View File

@@ -0,0 +1,33 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion
from .base import TelegramMethod
class CloseGeneralForumTopic(TelegramMethod[bool]):
"""
Use this method to close an open 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the *can_manage_topics* administrator rights. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#closegeneralforumtopic
"""
__returning__ = bool
__api_method__ = "closeGeneralForumTopic"
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__, *, chat_id: ChatIdUnion, **__pydantic_kwargs: Any
) -> None:
# DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher`
# Is needed only for type checking and IDE support without any additional plugins
super().__init__(chat_id=chat_id, **__pydantic_kwargs)

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

@@ -0,0 +1,119 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union
from pydantic import Field
from ..client.default import Default
from ..types import (
ChatIdUnion,
DateTimeUnion,
MessageEntity,
MessageId,
ReplyMarkupUnion,
ReplyParameters,
)
from .base import TelegramMethod
class CopyMessage(TelegramMethod[MessageId]):
"""
Use this method to copy messages of any kind. Service messages, paid media messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied. A quiz :class:`aiogram.methods.poll.Poll` can be copied only if the value of the field *correct_option_id* is known to the bot. The method is analogous to the method :class:`aiogram.methods.forward_message.ForwardMessage`, but the copied message doesn't have a link to the original message. Returns the :class:`aiogram.types.message_id.MessageId` of the sent message on success.
Source: https://core.telegram.org/bots/api#copymessage
"""
__returning__ = MessageId
__api_method__ = "copyMessage"
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
from_chat_id: ChatIdUnion
"""Unique identifier for the chat where the original message was sent (or channel username in the format :code:`@channelusername`)"""
message_id: int
"""Message identifier in the chat specified in *from_chat_id*"""
message_thread_id: Optional[int] = None
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
video_start_timestamp: Optional[DateTimeUnion] = None
"""New start timestamp for the copied video in the message"""
caption: Optional[str] = None
"""New caption for media, 0-1024 characters after entities parsing. If not specified, the original caption is kept"""
parse_mode: Optional[Union[str, Default]] = Default("parse_mode")
"""Mode for parsing entities in the new 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 new caption, which can be specified instead of *parse_mode*"""
show_caption_above_media: Optional[Union[bool, Default]] = Default("show_caption_above_media")
"""Pass :code:`True`, if the caption must be shown above the message media. Ignored if a new caption isn't specified."""
disable_notification: Optional[bool] = None
"""Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
protect_content: Optional[Union[bool, Default]] = Default("protect_content")
"""Protects the contents of the sent message from forwarding and saving"""
allow_paid_broadcast: Optional[bool] = None
"""Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"""
reply_parameters: Optional[ReplyParameters] = None
"""Description of the message to reply to"""
reply_markup: Optional[ReplyMarkupUnion] = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user"""
allow_sending_without_reply: Optional[bool] = Field(
None, json_schema_extra={"deprecated": True}
)
"""Pass :code:`True` if the message should be sent even if the specified replied-to message is not found
.. deprecated:: API:7.0
https://core.telegram.org/bots/api-changelog#december-29-2023"""
reply_to_message_id: Optional[int] = Field(None, json_schema_extra={"deprecated": True})
"""If the message is a reply, ID of the original message
.. deprecated:: API:7.0
https://core.telegram.org/bots/api-changelog#december-29-2023"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
chat_id: ChatIdUnion,
from_chat_id: ChatIdUnion,
message_id: int,
message_thread_id: Optional[int] = None,
video_start_timestamp: Optional[DateTimeUnion] = None,
caption: Optional[str] = None,
parse_mode: Optional[Union[str, Default]] = Default("parse_mode"),
caption_entities: Optional[list[MessageEntity]] = None,
show_caption_above_media: Optional[Union[bool, Default]] = Default(
"show_caption_above_media"
),
disable_notification: Optional[bool] = None,
protect_content: Optional[Union[bool, Default]] = Default("protect_content"),
allow_paid_broadcast: Optional[bool] = None,
reply_parameters: Optional[ReplyParameters] = None,
reply_markup: Optional[ReplyMarkupUnion] = None,
allow_sending_without_reply: Optional[bool] = None,
reply_to_message_id: Optional[int] = None,
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher`
# Is needed only for type checking and IDE support without any additional plugins
super().__init__(
chat_id=chat_id,
from_chat_id=from_chat_id,
message_id=message_id,
message_thread_id=message_thread_id,
video_start_timestamp=video_start_timestamp,
caption=caption,
parse_mode=parse_mode,
caption_entities=caption_entities,
show_caption_above_media=show_caption_above_media,
disable_notification=disable_notification,
protect_content=protect_content,
allow_paid_broadcast=allow_paid_broadcast,
reply_parameters=reply_parameters,
reply_markup=reply_markup,
allow_sending_without_reply=allow_sending_without_reply,
reply_to_message_id=reply_to_message_id,
**__pydantic_kwargs,
)

View File

@@ -0,0 +1,61 @@
from typing import TYPE_CHECKING, Any, Optional
from ..types import ChatIdUnion, MessageId
from .base import TelegramMethod
class CopyMessages(TelegramMethod[list[MessageId]]):
"""
Use this method to copy messages of any kind. If some of the specified messages can't be found or copied, they are skipped. Service messages, paid media messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied. A quiz :class:`aiogram.methods.poll.Poll` can be copied only if the value of the field *correct_option_id* is known to the bot. The method is analogous to the method :class:`aiogram.methods.forward_messages.ForwardMessages`, but the copied messages don't have a link to the original message. Album grouping is kept for copied messages. On success, an array of :class:`aiogram.types.message_id.MessageId` of the sent messages is returned.
Source: https://core.telegram.org/bots/api#copymessages
"""
__returning__ = list[MessageId]
__api_method__ = "copyMessages"
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
from_chat_id: ChatIdUnion
"""Unique identifier for the chat where the original messages were sent (or channel username in the format :code:`@channelusername`)"""
message_ids: list[int]
"""A JSON-serialized list of 1-100 identifiers of messages in the chat *from_chat_id* to copy. The identifiers must be specified in a strictly increasing order."""
message_thread_id: Optional[int] = None
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
disable_notification: Optional[bool] = None
"""Sends the messages `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
protect_content: Optional[bool] = None
"""Protects the contents of the sent messages from forwarding and saving"""
remove_caption: Optional[bool] = None
"""Pass :code:`True` to copy the messages without their captions"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
chat_id: ChatIdUnion,
from_chat_id: ChatIdUnion,
message_ids: list[int],
message_thread_id: Optional[int] = None,
disable_notification: Optional[bool] = None,
protect_content: Optional[bool] = None,
remove_caption: 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__(
chat_id=chat_id,
from_chat_id=from_chat_id,
message_ids=message_ids,
message_thread_id=message_thread_id,
disable_notification=disable_notification,
protect_content=protect_content,
remove_caption=remove_caption,
**__pydantic_kwargs,
)

View File

@@ -0,0 +1,55 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional
from ..types import ChatIdUnion, ChatInviteLink, DateTimeUnion
from .base import TelegramMethod
class CreateChatInviteLink(TelegramMethod[ChatInviteLink]):
"""
Use this method to create an additional invite link for a chat. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. The link can be revoked using the method :class:`aiogram.methods.revoke_chat_invite_link.RevokeChatInviteLink`. Returns the new invite link as :class:`aiogram.types.chat_invite_link.ChatInviteLink` object.
Source: https://core.telegram.org/bots/api#createchatinvitelink
"""
__returning__ = ChatInviteLink
__api_method__ = "createChatInviteLink"
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
name: Optional[str] = None
"""Invite link name; 0-32 characters"""
expire_date: Optional[DateTimeUnion] = None
"""Point in time (Unix timestamp) when the link will expire"""
member_limit: Optional[int] = None
"""The maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999"""
creates_join_request: Optional[bool] = None
""":code:`True`, if users joining the chat via the link need to be approved by chat administrators. If :code:`True`, *member_limit* can't be specified"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
chat_id: ChatIdUnion,
name: Optional[str] = None,
expire_date: Optional[DateTimeUnion] = None,
member_limit: Optional[int] = None,
creates_join_request: 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__(
chat_id=chat_id,
name=name,
expire_date=expire_date,
member_limit=member_limit,
creates_join_request=creates_join_request,
**__pydantic_kwargs,
)

View File

@@ -0,0 +1,51 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional
from ..types import ChatIdUnion, ChatInviteLink, DateTimeUnion
from .base import TelegramMethod
class CreateChatSubscriptionInviteLink(TelegramMethod[ChatInviteLink]):
"""
Use this method to create a `subscription invite link <https://telegram.org/blog/superchannels-star-reactions-subscriptions#star-subscriptions>`_ for a channel chat. The bot must have the *can_invite_users* administrator rights. The link can be edited using the method :class:`aiogram.methods.edit_chat_subscription_invite_link.EditChatSubscriptionInviteLink` or revoked using the method :class:`aiogram.methods.revoke_chat_invite_link.RevokeChatInviteLink`. Returns the new invite link as a :class:`aiogram.types.chat_invite_link.ChatInviteLink` object.
Source: https://core.telegram.org/bots/api#createchatsubscriptioninvitelink
"""
__returning__ = ChatInviteLink
__api_method__ = "createChatSubscriptionInviteLink"
chat_id: ChatIdUnion
"""Unique identifier for the target channel chat or username of the target channel (in the format :code:`@channelusername`)"""
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-10000"""
name: Optional[str] = None
"""Invite link name; 0-32 characters"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
chat_id: ChatIdUnion,
subscription_period: DateTimeUnion,
subscription_price: int,
name: Optional[str] = None,
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher`
# Is needed only for type checking and IDE support without any additional plugins
super().__init__(
chat_id=chat_id,
subscription_period=subscription_period,
subscription_price=subscription_price,
name=name,
**__pydantic_kwargs,
)

View File

@@ -0,0 +1,51 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional
from ..types import ChatIdUnion, ForumTopic
from .base import TelegramMethod
class CreateForumTopic(TelegramMethod[ForumTopic]):
"""
Use this method to create a topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the *can_manage_topics* administrator rights. Returns information about the created topic as a :class:`aiogram.types.forum_topic.ForumTopic` object.
Source: https://core.telegram.org/bots/api#createforumtopic
"""
__returning__ = ForumTopic
__api_method__ = "createForumTopic"
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)"""
name: str
"""Topic name, 1-128 characters"""
icon_color: Optional[int] = None
"""Color of the topic icon in RGB format. Currently, must be one of 7322096 (0x6FB9F0), 16766590 (0xFFD67E), 13338331 (0xCB86DB), 9367192 (0x8EEE98), 16749490 (0xFF93B2), or 16478047 (0xFB6F5F)"""
icon_custom_emoji_id: Optional[str] = None
"""Unique identifier of the custom emoji shown as the topic icon. Use :class:`aiogram.methods.get_forum_topic_icon_stickers.GetForumTopicIconStickers` to get all allowed custom emoji identifiers."""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
chat_id: ChatIdUnion,
name: str,
icon_color: Optional[int] = None,
icon_custom_emoji_id: Optional[str] = None,
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher`
# Is needed only for type checking and IDE support without any additional plugins
super().__init__(
chat_id=chat_id,
name=name,
icon_color=icon_color,
icon_custom_emoji_id=icon_custom_emoji_id,
**__pydantic_kwargs,
)

View File

@@ -0,0 +1,123 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional
from ..types import LabeledPrice
from .base import TelegramMethod
class CreateInvoiceLink(TelegramMethod[str]):
"""
Use this method to create a link for an invoice. Returns the created invoice link as *String* on success.
Source: https://core.telegram.org/bots/api#createinvoicelink
"""
__returning__ = str
__api_method__ = "createInvoiceLink"
title: str
"""Product name, 1-32 characters"""
description: str
"""Product description, 1-255 characters"""
payload: str
"""Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use it for your internal processes."""
currency: str
"""Three-letter ISO 4217 currency code, see `more on currencies <https://core.telegram.org/bots/payments#supported-currencies>`_. Pass 'XTR' for payments in `Telegram Stars <https://t.me/BotNews/90>`_."""
prices: list[LabeledPrice]
"""Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain exactly one item for payments in `Telegram Stars <https://t.me/BotNews/90>`_."""
business_connection_id: Optional[str] = None
"""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."""
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 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
"""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*."""
provider_data: Optional[str] = None
"""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."""
photo_url: Optional[str] = None
"""URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service."""
photo_size: Optional[int] = None
"""Photo size in bytes"""
photo_width: Optional[int] = None
"""Photo width"""
photo_height: Optional[int] = None
"""Photo height"""
need_name: Optional[bool] = None
"""Pass :code:`True` if you require the user's full name to complete the order. Ignored for payments in `Telegram Stars <https://t.me/BotNews/90>`_."""
need_phone_number: Optional[bool] = None
"""Pass :code:`True` if you require the user's phone number to complete the order. Ignored for payments in `Telegram Stars <https://t.me/BotNews/90>`_."""
need_email: Optional[bool] = None
"""Pass :code:`True` if you require the user's email address to complete the order. Ignored for payments in `Telegram Stars <https://t.me/BotNews/90>`_."""
need_shipping_address: Optional[bool] = None
"""Pass :code:`True` if you require the user's shipping address to complete the order. Ignored for payments in `Telegram Stars <https://t.me/BotNews/90>`_."""
send_phone_number_to_provider: Optional[bool] = None
"""Pass :code:`True` if the user's phone number should be sent to the provider. Ignored for payments in `Telegram Stars <https://t.me/BotNews/90>`_."""
send_email_to_provider: Optional[bool] = None
"""Pass :code:`True` if the user's email address should be sent to the provider. Ignored for payments in `Telegram Stars <https://t.me/BotNews/90>`_."""
is_flexible: Optional[bool] = None
"""Pass :code:`True` if the final price depends on the shipping method. Ignored for payments in `Telegram Stars <https://t.me/BotNews/90>`_."""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
title: str,
description: str,
payload: str,
currency: str,
prices: list[LabeledPrice],
business_connection_id: Optional[str] = None,
provider_token: Optional[str] = None,
subscription_period: Optional[int] = None,
max_tip_amount: Optional[int] = None,
suggested_tip_amounts: Optional[list[int]] = None,
provider_data: Optional[str] = None,
photo_url: Optional[str] = None,
photo_size: Optional[int] = None,
photo_width: Optional[int] = None,
photo_height: Optional[int] = None,
need_name: Optional[bool] = None,
need_phone_number: Optional[bool] = None,
need_email: Optional[bool] = None,
need_shipping_address: Optional[bool] = None,
send_phone_number_to_provider: Optional[bool] = None,
send_email_to_provider: Optional[bool] = None,
is_flexible: 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__(
title=title,
description=description,
payload=payload,
currency=currency,
prices=prices,
business_connection_id=business_connection_id,
provider_token=provider_token,
subscription_period=subscription_period,
max_tip_amount=max_tip_amount,
suggested_tip_amounts=suggested_tip_amounts,
provider_data=provider_data,
photo_url=photo_url,
photo_size=photo_size,
photo_width=photo_width,
photo_height=photo_height,
need_name=need_name,
need_phone_number=need_phone_number,
need_email=need_email,
need_shipping_address=need_shipping_address,
send_phone_number_to_provider=send_phone_number_to_provider,
send_email_to_provider=send_email_to_provider,
is_flexible=is_flexible,
**__pydantic_kwargs,
)

View File

@@ -0,0 +1,68 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional
from pydantic import Field
from ..types import InputSticker
from .base import TelegramMethod
class CreateNewStickerSet(TelegramMethod[bool]):
"""
Use this method to create a new sticker set owned by a user. The bot will be able to edit the sticker set thus created. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#createnewstickerset
"""
__returning__ = bool
__api_method__ = "createNewStickerSet"
user_id: int
"""User identifier of created sticker set owner"""
name: str
"""Short name of sticker set, to be used in :code:`t.me/addstickers/` URLs (e.g., *animals*). Can contain only English letters, digits and underscores. Must begin with a letter, can't contain consecutive underscores and must end in :code:`"_by_<bot_username>"`. :code:`<bot_username>` is case insensitive. 1-64 characters."""
title: str
"""Sticker set title, 1-64 characters"""
stickers: list[InputSticker]
"""A JSON-serialized list of 1-50 initial stickers to be added to the sticker set"""
sticker_type: Optional[str] = None
"""Type of stickers in the set, pass 'regular', 'mask', or 'custom_emoji'. By default, a regular sticker set is created."""
needs_repainting: Optional[bool] = None
"""Pass :code:`True` if stickers in the sticker set must be repainted to the color of text when used in messages, the accent color if used as emoji status, white on chat photos, or another appropriate color based on context; for custom emoji sticker sets only"""
sticker_format: Optional[str] = Field(None, json_schema_extra={"deprecated": True})
"""Format of stickers in the set, must be one of 'static', 'animated', 'video'
.. deprecated:: API:7.2
https://core.telegram.org/bots/api-changelog#march-31-2024"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
user_id: int,
name: str,
title: str,
stickers: list[InputSticker],
sticker_type: Optional[str] = None,
needs_repainting: Optional[bool] = None,
sticker_format: 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__(
user_id=user_id,
name=name,
title=title,
stickers=stickers,
sticker_type=sticker_type,
needs_repainting=needs_repainting,
sticker_format=sticker_format,
**__pydantic_kwargs,
)

View File

@@ -0,0 +1,35 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion
from .base import TelegramMethod
class DeclineChatJoinRequest(TelegramMethod[bool]):
"""
Use this method to decline a chat join request. The bot must be an administrator in the chat for this to work and must have the *can_invite_users* administrator right. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#declinechatjoinrequest
"""
__returning__ = bool
__api_method__ = "declineChatJoinRequest"
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
user_id: int
"""Unique identifier of the target user"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__, *, chat_id: ChatIdUnion, user_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__(chat_id=chat_id, user_id=user_id, **__pydantic_kwargs)

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,33 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion
from .base import TelegramMethod
class DeleteChatPhoto(TelegramMethod[bool]):
"""
Use this method to delete a chat photo. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#deletechatphoto
"""
__returning__ = bool
__api_method__ = "deleteChatPhoto"
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__, *, chat_id: ChatIdUnion, **__pydantic_kwargs: Any
) -> None:
# DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher`
# Is needed only for type checking and IDE support without any additional plugins
super().__init__(chat_id=chat_id, **__pydantic_kwargs)

View File

@@ -0,0 +1,33 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion
from .base import TelegramMethod
class DeleteChatStickerSet(TelegramMethod[bool]):
"""
Use this method to delete a group sticker set from a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Use the field *can_set_sticker_set* optionally returned in :class:`aiogram.methods.get_chat.GetChat` requests to check if the bot can use this method. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#deletechatstickerset
"""
__returning__ = bool
__api_method__ = "deleteChatStickerSet"
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__, *, chat_id: ChatIdUnion, **__pydantic_kwargs: Any
) -> None:
# DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher`
# Is needed only for type checking and IDE support without any additional plugins
super().__init__(chat_id=chat_id, **__pydantic_kwargs)

View File

@@ -0,0 +1,41 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion
from .base import TelegramMethod
class DeleteForumTopic(TelegramMethod[bool]):
"""
Use this method to delete a forum topic along with all its messages in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the *can_delete_messages* administrator rights. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#deleteforumtopic
"""
__returning__ = bool
__api_method__ = "deleteForumTopic"
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)"""
message_thread_id: int
"""Unique identifier for the target message thread of the forum topic"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
chat_id: ChatIdUnion,
message_thread_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__(
chat_id=chat_id, message_thread_id=message_thread_id, **__pydantic_kwargs
)

View File

@@ -0,0 +1,53 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion
from .base import TelegramMethod
class DeleteMessage(TelegramMethod[bool]):
"""
Use this method to delete a message, including service messages, with the following limitations:
- A message can only be deleted if it was sent less than 48 hours ago.
- Service messages about a supergroup, channel, or forum topic creation can't be deleted.
- A dice message in a private chat can only be deleted if it was sent more than 24 hours ago.
- Bots can delete outgoing messages in private chats, groups, and supergroups.
- Bots can delete incoming messages in private chats.
- Bots granted *can_post_messages* permissions can delete outgoing messages in channels.
- If the bot is an administrator of a group, it can delete any message there.
- If the bot has *can_delete_messages* permission in a supergroup or a channel, it can delete any message there.
Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#deletemessage
"""
__returning__ = bool
__api_method__ = "deleteMessage"
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
message_id: int
"""Identifier of the message to delete"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__, *, chat_id: ChatIdUnion, 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__(chat_id=chat_id, message_id=message_id, **__pydantic_kwargs)

View File

@@ -0,0 +1,37 @@
from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion
from .base import TelegramMethod
class DeleteMessages(TelegramMethod[bool]):
"""
Use this method to delete multiple messages simultaneously. If some of the specified messages can't be found, they are skipped. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#deletemessages
"""
__returning__ = bool
__api_method__ = "deleteMessages"
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
message_ids: list[int]
"""A JSON-serialized list of 1-100 identifiers of messages to delete. 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__,
*,
chat_id: ChatIdUnion,
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__(chat_id=chat_id, message_ids=message_ids, **__pydantic_kwargs)

View File

@@ -0,0 +1,39 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional
from ..types import BotCommandScopeUnion
from .base import TelegramMethod
class DeleteMyCommands(TelegramMethod[bool]):
"""
Use this method to delete the list of the bot's commands for the given scope and user language. After deletion, `higher level commands <https://core.telegram.org/bots/api#determining-list-of-commands>`_ will be shown to affected users. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#deletemycommands
"""
__returning__ = bool
__api_method__ = "deleteMyCommands"
scope: Optional[BotCommandScopeUnion] = None
"""A JSON-serialized object, describing scope of users for which the commands are relevant. Defaults to :class:`aiogram.types.bot_command_scope_default.BotCommandScopeDefault`."""
language_code: Optional[str] = None
"""A two-letter ISO 639-1 language code. If empty, commands will be applied to all users from the given scope, for whose language there are no dedicated commands"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
scope: Optional[BotCommandScopeUnion] = None,
language_code: 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__(scope=scope, language_code=language_code, **__pydantic_kwargs)

View File

@@ -0,0 +1,30 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from .base import TelegramMethod
class DeleteStickerFromSet(TelegramMethod[bool]):
"""
Use this method to delete a sticker from a set created by the bot. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#deletestickerfromset
"""
__returning__ = bool
__api_method__ = "deleteStickerFromSet"
sticker: str
"""File identifier of the sticker"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(__pydantic__self__, *, sticker: 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__(sticker=sticker, **__pydantic_kwargs)

View File

@@ -0,0 +1,30 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from .base import TelegramMethod
class DeleteStickerSet(TelegramMethod[bool]):
"""
Use this method to delete a sticker set that was created by the bot. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#deletestickerset
"""
__returning__ = bool
__api_method__ = "deleteStickerSet"
name: str
"""Sticker set name"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(__pydantic__self__, *, 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__(name=name, **__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,35 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional
from .base import TelegramMethod
class DeleteWebhook(TelegramMethod[bool]):
"""
Use this method to remove webhook integration if you decide to switch back to :class:`aiogram.methods.get_updates.GetUpdates`. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#deletewebhook
"""
__returning__ = bool
__api_method__ = "deleteWebhook"
drop_pending_updates: Optional[bool] = None
"""Pass :code:`True` to drop all pending updates"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
drop_pending_updates: 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__(drop_pending_updates=drop_pending_updates, **__pydantic_kwargs)

View File

@@ -0,0 +1,59 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional
from ..types import ChatIdUnion, ChatInviteLink, DateTimeUnion
from .base import TelegramMethod
class EditChatInviteLink(TelegramMethod[ChatInviteLink]):
"""
Use this method to edit a non-primary invite link created by the bot. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns the edited invite link as a :class:`aiogram.types.chat_invite_link.ChatInviteLink` object.
Source: https://core.telegram.org/bots/api#editchatinvitelink
"""
__returning__ = ChatInviteLink
__api_method__ = "editChatInviteLink"
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
invite_link: str
"""The invite link to edit"""
name: Optional[str] = None
"""Invite link name; 0-32 characters"""
expire_date: Optional[DateTimeUnion] = None
"""Point in time (Unix timestamp) when the link will expire"""
member_limit: Optional[int] = None
"""The maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999"""
creates_join_request: Optional[bool] = None
""":code:`True`, if users joining the chat via the link need to be approved by chat administrators. If :code:`True`, *member_limit* can't be specified"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
chat_id: ChatIdUnion,
invite_link: str,
name: Optional[str] = None,
expire_date: Optional[DateTimeUnion] = None,
member_limit: Optional[int] = None,
creates_join_request: 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__(
chat_id=chat_id,
invite_link=invite_link,
name=name,
expire_date=expire_date,
member_limit=member_limit,
creates_join_request=creates_join_request,
**__pydantic_kwargs,
)

View File

@@ -0,0 +1,44 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional
from ..types import ChatIdUnion, ChatInviteLink
from .base import TelegramMethod
class EditChatSubscriptionInviteLink(TelegramMethod[ChatInviteLink]):
"""
Use this method to edit a subscription invite link created by the bot. The bot must have the *can_invite_users* administrator rights. Returns the edited invite link as a :class:`aiogram.types.chat_invite_link.ChatInviteLink` object.
Source: https://core.telegram.org/bots/api#editchatsubscriptioninvitelink
"""
__returning__ = ChatInviteLink
__api_method__ = "editChatSubscriptionInviteLink"
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
invite_link: str
"""The invite link to edit"""
name: Optional[str] = None
"""Invite link name; 0-32 characters"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
chat_id: ChatIdUnion,
invite_link: str,
name: Optional[str] = None,
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher`
# Is needed only for type checking and IDE support without any additional plugins
super().__init__(
chat_id=chat_id, invite_link=invite_link, name=name, **__pydantic_kwargs
)

View File

@@ -0,0 +1,51 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional
from ..types import ChatIdUnion
from .base import TelegramMethod
class EditForumTopic(TelegramMethod[bool]):
"""
Use this method to edit name and icon of a topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the *can_manage_topics* administrator rights, unless it is the creator of the topic. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#editforumtopic
"""
__returning__ = bool
__api_method__ = "editForumTopic"
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)"""
message_thread_id: int
"""Unique identifier for the target message thread of the forum topic"""
name: Optional[str] = None
"""New topic name, 0-128 characters. If not specified or empty, the current name of the topic will be kept"""
icon_custom_emoji_id: Optional[str] = None
"""New unique identifier of the custom emoji shown as the topic icon. Use :class:`aiogram.methods.get_forum_topic_icon_stickers.GetForumTopicIconStickers` to get all allowed custom emoji identifiers. Pass an empty string to remove the icon. If not specified, the current icon will be kept"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
chat_id: ChatIdUnion,
message_thread_id: int,
name: Optional[str] = None,
icon_custom_emoji_id: Optional[str] = None,
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher`
# Is needed only for type checking and IDE support without any additional plugins
super().__init__(
chat_id=chat_id,
message_thread_id=message_thread_id,
name=name,
icon_custom_emoji_id=icon_custom_emoji_id,
**__pydantic_kwargs,
)

View File

@@ -0,0 +1,35 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion
from .base import TelegramMethod
class EditGeneralForumTopic(TelegramMethod[bool]):
"""
Use this method to edit the name of the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the *can_manage_topics* administrator rights. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#editgeneralforumtopic
"""
__returning__ = bool
__api_method__ = "editGeneralForumTopic"
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)"""
name: str
"""New topic name, 1-128 characters"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__, *, chat_id: ChatIdUnion, 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__(chat_id=chat_id, name=name, **__pydantic_kwargs)

View File

@@ -0,0 +1,74 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union
from ..client.default import Default
from ..types import ChatIdUnion, InlineKeyboardMarkup, Message, MessageEntity
from .base import TelegramMethod
class EditMessageCaption(TelegramMethod[Union[Message, bool]]):
"""
Use this method to edit captions of messages. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within **48 hours** from the time they were sent.
Source: https://core.telegram.org/bots/api#editmessagecaption
"""
__returning__ = Union[Message, bool]
__api_method__ = "editMessageCaption"
business_connection_id: Optional[str] = None
"""Unique identifier of the business connection on behalf of which the message to be edited was sent"""
chat_id: Optional[ChatIdUnion] = None
"""Required if *inline_message_id* is not specified. Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
message_id: Optional[int] = None
"""Required if *inline_message_id* is not specified. Identifier of the message to edit"""
inline_message_id: Optional[str] = None
"""Required if *chat_id* and *message_id* are not specified. Identifier of the inline message"""
caption: Optional[str] = None
"""New caption of the message, 0-1024 characters after entities parsing"""
parse_mode: Optional[Union[str, Default]] = Default("parse_mode")
"""Mode for parsing entities in the message 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*"""
show_caption_above_media: Optional[Union[bool, Default]] = Default("show_caption_above_media")
"""Pass :code:`True`, if the caption must be shown above the message media. Supported only for animation, photo and video messages."""
reply_markup: Optional[InlineKeyboardMarkup] = None
"""A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_."""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
business_connection_id: Optional[str] = None,
chat_id: Optional[ChatIdUnion] = None,
message_id: Optional[int] = None,
inline_message_id: Optional[str] = None,
caption: Optional[str] = None,
parse_mode: Optional[Union[str, Default]] = Default("parse_mode"),
caption_entities: Optional[list[MessageEntity]] = None,
show_caption_above_media: Optional[Union[bool, Default]] = Default(
"show_caption_above_media"
),
reply_markup: Optional[InlineKeyboardMarkup] = 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,
chat_id=chat_id,
message_id=message_id,
inline_message_id=inline_message_id,
caption=caption,
parse_mode=parse_mode,
caption_entities=caption_entities,
show_caption_above_media=show_caption_above_media,
reply_markup=reply_markup,
**__pydantic_kwargs,
)

View File

@@ -0,0 +1,79 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union
from ..types import ChatIdUnion, InlineKeyboardMarkup, Message
from .base import TelegramMethod
class EditMessageLiveLocation(TelegramMethod[Union[Message, bool]]):
"""
Use this method to edit live location messages. A location can be edited until its *live_period* expires or editing is explicitly disabled by a call to :class:`aiogram.methods.stop_message_live_location.StopMessageLiveLocation`. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned.
Source: https://core.telegram.org/bots/api#editmessagelivelocation
"""
__returning__ = Union[Message, bool]
__api_method__ = "editMessageLiveLocation"
latitude: float
"""Latitude of new location"""
longitude: float
"""Longitude of new location"""
business_connection_id: Optional[str] = None
"""Unique identifier of the business connection on behalf of which the message to be edited was sent"""
chat_id: Optional[ChatIdUnion] = None
"""Required if *inline_message_id* is not specified. Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
message_id: Optional[int] = None
"""Required if *inline_message_id* is not specified. Identifier of the message to edit"""
inline_message_id: Optional[str] = None
"""Required if *chat_id* and *message_id* are not specified. Identifier of the inline message"""
live_period: Optional[int] = None
"""New period in seconds during which the location can be updated, starting from the message send date. If 0x7FFFFFFF is specified, then the location can be updated forever. Otherwise, the new value must not exceed the current *live_period* by more than a day, and the live location expiration date must remain within the next 90 days. If not specified, then *live_period* remains unchanged"""
horizontal_accuracy: Optional[float] = None
"""The radius of uncertainty for the location, measured in meters; 0-1500"""
heading: Optional[int] = None
"""Direction in which the user is moving, in degrees. Must be between 1 and 360 if specified."""
proximity_alert_radius: Optional[int] = None
"""The maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified."""
reply_markup: Optional[InlineKeyboardMarkup] = None
"""A JSON-serialized object for a new `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_."""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
latitude: float,
longitude: float,
business_connection_id: Optional[str] = None,
chat_id: Optional[ChatIdUnion] = None,
message_id: Optional[int] = None,
inline_message_id: Optional[str] = None,
live_period: Optional[int] = None,
horizontal_accuracy: Optional[float] = None,
heading: Optional[int] = None,
proximity_alert_radius: Optional[int] = None,
reply_markup: Optional[InlineKeyboardMarkup] = 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__(
latitude=latitude,
longitude=longitude,
business_connection_id=business_connection_id,
chat_id=chat_id,
message_id=message_id,
inline_message_id=inline_message_id,
live_period=live_period,
horizontal_accuracy=horizontal_accuracy,
heading=heading,
proximity_alert_radius=proximity_alert_radius,
reply_markup=reply_markup,
**__pydantic_kwargs,
)

View File

@@ -0,0 +1,59 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union
from ..types import ChatIdUnion, InlineKeyboardMarkup, InputMediaUnion, Message
from .base import TelegramMethod
class EditMessageMedia(TelegramMethod[Union[Message, bool]]):
"""
Use this method to edit animation, audio, document, photo, or video messages, or to add media to text messages. If a message is part of a message album, then it can be edited only to an audio for audio albums, only to a document for document albums and to a photo or a video otherwise. When an inline message is edited, a new file can't be uploaded; use a previously uploaded file via its file_id or specify a URL. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within **48 hours** from the time they were sent.
Source: https://core.telegram.org/bots/api#editmessagemedia
"""
__returning__ = Union[Message, bool]
__api_method__ = "editMessageMedia"
media: InputMediaUnion
"""A JSON-serialized object for a new media content of the message"""
business_connection_id: Optional[str] = None
"""Unique identifier of the business connection on behalf of which the message to be edited was sent"""
chat_id: Optional[ChatIdUnion] = None
"""Required if *inline_message_id* is not specified. Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
message_id: Optional[int] = None
"""Required if *inline_message_id* is not specified. Identifier of the message to edit"""
inline_message_id: Optional[str] = None
"""Required if *chat_id* and *message_id* are not specified. Identifier of the inline message"""
reply_markup: Optional[InlineKeyboardMarkup] = None
"""A JSON-serialized object for a new `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_."""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
media: InputMediaUnion,
business_connection_id: Optional[str] = None,
chat_id: Optional[ChatIdUnion] = None,
message_id: Optional[int] = None,
inline_message_id: Optional[str] = None,
reply_markup: Optional[InlineKeyboardMarkup] = 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__(
media=media,
business_connection_id=business_connection_id,
chat_id=chat_id,
message_id=message_id,
inline_message_id=inline_message_id,
reply_markup=reply_markup,
**__pydantic_kwargs,
)

View File

@@ -0,0 +1,55 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union
from ..types import ChatIdUnion, InlineKeyboardMarkup, Message
from .base import TelegramMethod
class EditMessageReplyMarkup(TelegramMethod[Union[Message, bool]]):
"""
Use this method to edit only the reply markup of messages. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within **48 hours** from the time they were sent.
Source: https://core.telegram.org/bots/api#editmessagereplymarkup
"""
__returning__ = Union[Message, bool]
__api_method__ = "editMessageReplyMarkup"
business_connection_id: Optional[str] = None
"""Unique identifier of the business connection on behalf of which the message to be edited was sent"""
chat_id: Optional[ChatIdUnion] = None
"""Required if *inline_message_id* is not specified. Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
message_id: Optional[int] = None
"""Required if *inline_message_id* is not specified. Identifier of the message to edit"""
inline_message_id: Optional[str] = None
"""Required if *chat_id* and *message_id* are not specified. Identifier of the inline message"""
reply_markup: Optional[InlineKeyboardMarkup] = None
"""A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_."""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
business_connection_id: Optional[str] = None,
chat_id: Optional[ChatIdUnion] = None,
message_id: Optional[int] = None,
inline_message_id: Optional[str] = None,
reply_markup: Optional[InlineKeyboardMarkup] = 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,
chat_id=chat_id,
message_id=message_id,
inline_message_id=inline_message_id,
reply_markup=reply_markup,
**__pydantic_kwargs,
)

View File

@@ -0,0 +1,93 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union
from pydantic import Field
from ..client.default import Default
from ..types import (
ChatIdUnion,
InlineKeyboardMarkup,
LinkPreviewOptions,
Message,
MessageEntity,
)
from .base import TelegramMethod
class EditMessageText(TelegramMethod[Union[Message, bool]]):
"""
Use this method to edit text and `game <https://core.telegram.org/bots/api#games>`_ messages. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within **48 hours** from the time they were sent.
Source: https://core.telegram.org/bots/api#editmessagetext
"""
__returning__ = Union[Message, bool]
__api_method__ = "editMessageText"
text: str
"""New text of the message, 1-4096 characters after entities parsing"""
business_connection_id: Optional[str] = None
"""Unique identifier of the business connection on behalf of which the message to be edited was sent"""
chat_id: Optional[ChatIdUnion] = None
"""Required if *inline_message_id* is not specified. Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
message_id: Optional[int] = None
"""Required if *inline_message_id* is not specified. Identifier of the message to edit"""
inline_message_id: Optional[str] = None
"""Required if *chat_id* and *message_id* are not specified. Identifier of the inline message"""
parse_mode: Optional[Union[str, Default]] = Default("parse_mode")
"""Mode for parsing entities in the message text. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details."""
entities: Optional[list[MessageEntity]] = None
"""A JSON-serialized list of special entities that appear in message text, which can be specified instead of *parse_mode*"""
link_preview_options: Optional[Union[LinkPreviewOptions, Default]] = Default("link_preview")
"""Link preview generation options for the message"""
reply_markup: Optional[InlineKeyboardMarkup] = None
"""A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_."""
disable_web_page_preview: Optional[Union[bool, Default]] = Field(
Default("link_preview_is_disabled"), json_schema_extra={"deprecated": True}
)
"""Disables link previews for links in this message
.. deprecated:: API:7.0
https://core.telegram.org/bots/api-changelog#december-29-2023"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
text: str,
business_connection_id: Optional[str] = None,
chat_id: Optional[ChatIdUnion] = None,
message_id: Optional[int] = None,
inline_message_id: Optional[str] = None,
parse_mode: Optional[Union[str, Default]] = Default("parse_mode"),
entities: Optional[list[MessageEntity]] = None,
link_preview_options: Optional[Union[LinkPreviewOptions, Default]] = Default(
"link_preview"
),
reply_markup: Optional[InlineKeyboardMarkup] = None,
disable_web_page_preview: Optional[Union[bool, Default]] = Default(
"link_preview_is_disabled"
),
**__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__(
text=text,
business_connection_id=business_connection_id,
chat_id=chat_id,
message_id=message_id,
inline_message_id=inline_message_id,
parse_mode=parse_mode,
entities=entities,
link_preview_options=link_preview_options,
reply_markup=reply_markup,
disable_web_page_preview=disable_web_page_preview,
**__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,46 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from .base import TelegramMethod
class EditUserStarSubscription(TelegramMethod[bool]):
"""
Allows the bot to cancel or re-enable extension of a subscription paid in Telegram Stars. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#edituserstarsubscription
"""
__returning__ = bool
__api_method__ = "editUserStarSubscription"
user_id: int
"""Identifier of the user whose subscription will be edited"""
telegram_payment_charge_id: str
"""Telegram payment identifier for the subscription"""
is_canceled: bool
"""Pass :code:`True` to cancel extension of the user subscription; the subscription must be active up to the end of the current subscription period. Pass :code:`False` to allow the user to re-enable a subscription that was previously canceled by the bot."""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
user_id: int,
telegram_payment_charge_id: str,
is_canceled: 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__(
user_id=user_id,
telegram_payment_charge_id=telegram_payment_charge_id,
is_canceled=is_canceled,
**__pydantic_kwargs,
)

View File

@@ -0,0 +1,35 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion
from .base import TelegramMethod
class ExportChatInviteLink(TelegramMethod[str]):
"""
Use this method to generate a new primary invite link for a chat; any previously generated primary link is revoked. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns the new invite link as *String* on success.
Note: Each administrator in a chat generates their own invite links. Bots can't use invite links generated by other administrators. If you want your bot to work with invite links, it will need to generate its own link using :class:`aiogram.methods.export_chat_invite_link.ExportChatInviteLink` or by calling the :class:`aiogram.methods.get_chat.GetChat` method. If your bot needs to generate a new primary invite link replacing its previous one, use :class:`aiogram.methods.export_chat_invite_link.ExportChatInviteLink` again.
Source: https://core.telegram.org/bots/api#exportchatinvitelink
"""
__returning__ = str
__api_method__ = "exportChatInviteLink"
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__, *, chat_id: ChatIdUnion, **__pydantic_kwargs: Any
) -> None:
# DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher`
# Is needed only for type checking and IDE support without any additional plugins
super().__init__(chat_id=chat_id, **__pydantic_kwargs)

View File

@@ -0,0 +1,64 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union
from ..client.default import Default
from ..types import ChatIdUnion, DateTimeUnion, Message
from .base import TelegramMethod
class ForwardMessage(TelegramMethod[Message]):
"""
Use this method to forward messages of any kind. Service messages and messages with protected content can't be forwarded. On success, the sent :class:`aiogram.types.message.Message` is returned.
Source: https://core.telegram.org/bots/api#forwardmessage
"""
__returning__ = Message
__api_method__ = "forwardMessage"
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
from_chat_id: ChatIdUnion
"""Unique identifier for the chat where the original message was sent (or channel username in the format :code:`@channelusername`)"""
message_id: int
"""Message identifier in the chat specified in *from_chat_id*"""
message_thread_id: Optional[int] = None
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
video_start_timestamp: Optional[DateTimeUnion] = None
"""New start timestamp for the forwarded video in the message"""
disable_notification: Optional[bool] = None
"""Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
protect_content: Optional[Union[bool, Default]] = Default("protect_content")
"""Protects the contents of the forwarded message from forwarding and saving"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
chat_id: ChatIdUnion,
from_chat_id: ChatIdUnion,
message_id: int,
message_thread_id: Optional[int] = None,
video_start_timestamp: Optional[DateTimeUnion] = None,
disable_notification: Optional[bool] = None,
protect_content: Optional[Union[bool, Default]] = Default("protect_content"),
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher`
# Is needed only for type checking and IDE support without any additional plugins
super().__init__(
chat_id=chat_id,
from_chat_id=from_chat_id,
message_id=message_id,
message_thread_id=message_thread_id,
video_start_timestamp=video_start_timestamp,
disable_notification=disable_notification,
protect_content=protect_content,
**__pydantic_kwargs,
)

View File

@@ -0,0 +1,57 @@
from typing import TYPE_CHECKING, Any, Optional
from ..types import ChatIdUnion, MessageId
from .base import TelegramMethod
class ForwardMessages(TelegramMethod[list[MessageId]]):
"""
Use this method to forward multiple messages of any kind. If some of the specified messages can't be found or forwarded, they are skipped. Service messages and messages with protected content can't be forwarded. Album grouping is kept for forwarded messages. On success, an array of :class:`aiogram.types.message_id.MessageId` of the sent messages is returned.
Source: https://core.telegram.org/bots/api#forwardmessages
"""
__returning__ = list[MessageId]
__api_method__ = "forwardMessages"
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
from_chat_id: ChatIdUnion
"""Unique identifier for the chat where the original messages were sent (or channel username in the format :code:`@channelusername`)"""
message_ids: list[int]
"""A JSON-serialized list of 1-100 identifiers of messages in the chat *from_chat_id* to forward. The identifiers must be specified in a strictly increasing order."""
message_thread_id: Optional[int] = None
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
disable_notification: Optional[bool] = None
"""Sends the messages `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
protect_content: Optional[bool] = None
"""Protects the contents of the forwarded messages from forwarding and saving"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
chat_id: ChatIdUnion,
from_chat_id: ChatIdUnion,
message_ids: list[int],
message_thread_id: Optional[int] = None,
disable_notification: 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__(
chat_id=chat_id,
from_chat_id=from_chat_id,
message_ids=message_ids,
message_thread_id=message_thread_id,
disable_notification=disable_notification,
protect_content=protect_content,
**__pydantic_kwargs,
)

View File

@@ -0,0 +1,15 @@
from __future__ import annotations
from ..types.gifts import Gifts
from .base import TelegramMethod
class GetAvailableGifts(TelegramMethod[Gifts]):
"""
Returns the list of gifts that can be sent by the bot to users and channel chats. Requires no parameters. Returns a :class:`aiogram.types.gifts.Gifts` object.
Source: https://core.telegram.org/bots/api#getavailablegifts
"""
__returning__ = Gifts
__api_method__ = "getAvailableGifts"

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,34 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from aiogram.types import BusinessConnection
from .base import TelegramMethod
class GetBusinessConnection(TelegramMethod[BusinessConnection]):
"""
Use this method to get information about the connection of the bot with a business account. Returns a :class:`aiogram.types.business_connection.BusinessConnection` object on success.
Source: https://core.telegram.org/bots/api#getbusinessconnection
"""
__returning__ = BusinessConnection
__api_method__ = "getBusinessConnection"
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,33 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from ..types import ChatFullInfo, ChatIdUnion
from .base import TelegramMethod
class GetChat(TelegramMethod[ChatFullInfo]):
"""
Use this method to get up-to-date information about the chat. Returns a :class:`aiogram.types.chat_full_info.ChatFullInfo` object on success.
Source: https://core.telegram.org/bots/api#getchat
"""
__returning__ = ChatFullInfo
__api_method__ = "getChat"
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target supergroup or channel (in the format :code:`@channelusername`)"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__, *, chat_id: ChatIdUnion, **__pydantic_kwargs: Any
) -> None:
# DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher`
# Is needed only for type checking and IDE support without any additional plugins
super().__init__(chat_id=chat_id, **__pydantic_kwargs)

View File

@@ -0,0 +1,33 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion, ResultChatMemberUnion
from .base import TelegramMethod
class GetChatAdministrators(TelegramMethod[list[ResultChatMemberUnion]]):
"""
Use this method to get a list of administrators in a chat, which aren't bots. Returns an Array of :class:`aiogram.types.chat_member.ChatMember` objects.
Source: https://core.telegram.org/bots/api#getchatadministrators
"""
__returning__ = list[ResultChatMemberUnion]
__api_method__ = "getChatAdministrators"
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target supergroup or channel (in the format :code:`@channelusername`)"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__, *, chat_id: ChatIdUnion, **__pydantic_kwargs: Any
) -> None:
# DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher`
# Is needed only for type checking and IDE support without any additional plugins
super().__init__(chat_id=chat_id, **__pydantic_kwargs)

View File

@@ -0,0 +1,35 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion, ResultChatMemberUnion
from .base import TelegramMethod
class GetChatMember(TelegramMethod[ResultChatMemberUnion]):
"""
Use this method to get information about a member of a chat. The method is only guaranteed to work for other users if the bot is an administrator in the chat. Returns a :class:`aiogram.types.chat_member.ChatMember` object on success.
Source: https://core.telegram.org/bots/api#getchatmember
"""
__returning__ = ResultChatMemberUnion
__api_method__ = "getChatMember"
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target supergroup or channel (in the format :code:`@channelusername`)"""
user_id: int
"""Unique identifier of the target user"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__, *, chat_id: ChatIdUnion, user_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__(chat_id=chat_id, user_id=user_id, **__pydantic_kwargs)

View File

@@ -0,0 +1,33 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion
from .base import TelegramMethod
class GetChatMemberCount(TelegramMethod[int]):
"""
Use this method to get the number of members in a chat. Returns *Int* on success.
Source: https://core.telegram.org/bots/api#getchatmembercount
"""
__returning__ = int
__api_method__ = "getChatMemberCount"
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target supergroup or channel (in the format :code:`@channelusername`)"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__, *, chat_id: ChatIdUnion, **__pydantic_kwargs: Any
) -> None:
# DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher`
# Is needed only for type checking and IDE support without any additional plugins
super().__init__(chat_id=chat_id, **__pydantic_kwargs)

View File

@@ -0,0 +1,33 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional
from ..types import ResultMenuButtonUnion
from .base import TelegramMethod
class GetChatMenuButton(TelegramMethod[ResultMenuButtonUnion]):
"""
Use this method to get the current value of the bot's menu button in a private chat, or the default menu button. Returns :class:`aiogram.types.menu_button.MenuButton` on success.
Source: https://core.telegram.org/bots/api#getchatmenubutton
"""
__returning__ = ResultMenuButtonUnion
__api_method__ = "getChatMenuButton"
chat_id: Optional[int] = None
"""Unique identifier for the target private chat. If not specified, default bot's menu button will be returned"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__, *, chat_id: Optional[int] = None, **__pydantic_kwargs: Any
) -> None:
# DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher`
# Is needed only for type checking and IDE support without any additional plugins
super().__init__(chat_id=chat_id, **__pydantic_kwargs)

View File

@@ -0,0 +1,33 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from ..types import Sticker
from .base import TelegramMethod
class GetCustomEmojiStickers(TelegramMethod[list[Sticker]]):
"""
Use this method to get information about custom emoji stickers by their identifiers. Returns an Array of :class:`aiogram.types.sticker.Sticker` objects.
Source: https://core.telegram.org/bots/api#getcustomemojistickers
"""
__returning__ = list[Sticker]
__api_method__ = "getCustomEmojiStickers"
custom_emoji_ids: list[str]
"""A JSON-serialized list of custom emoji identifiers. At most 200 custom emoji identifiers can be specified."""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__, *, custom_emoji_ids: list[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__(custom_emoji_ids=custom_emoji_ids, **__pydantic_kwargs)

View File

@@ -0,0 +1,32 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from ..types import File
from .base import TelegramMethod
class GetFile(TelegramMethod[File]):
"""
Use this method to get basic information about a file and prepare it for downloading. For the moment, bots can download files of up to 20MB in size. On success, a :class:`aiogram.types.file.File` object is returned. The file can then be downloaded via the link :code:`https://api.telegram.org/file/bot<token>/<file_path>`, where :code:`<file_path>` is taken from the response. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling :class:`aiogram.methods.get_file.GetFile` again.
**Note:** This function may not preserve the original file name and MIME type. You should save the file's MIME type and name (if available) when the File object is received.
Source: https://core.telegram.org/bots/api#getfile
"""
__returning__ = File
__api_method__ = "getFile"
file_id: str
"""File identifier to get information about"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(__pydantic__self__, *, file_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__(file_id=file_id, **__pydantic_kwargs)

View File

@@ -0,0 +1,15 @@
from __future__ import annotations
from ..types import Sticker
from .base import TelegramMethod
class GetForumTopicIconStickers(TelegramMethod[list[Sticker]]):
"""
Use this method to get custom emoji stickers, which can be used as a forum topic icon by any user. Requires no parameters. Returns an Array of :class:`aiogram.types.sticker.Sticker` objects.
Source: https://core.telegram.org/bots/api#getforumtopiciconstickers
"""
__returning__ = list[Sticker]
__api_method__ = "getForumTopicIconStickers"

View File

@@ -0,0 +1,53 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional
from ..types import GameHighScore
from .base import TelegramMethod
class GetGameHighScores(TelegramMethod[list[GameHighScore]]):
"""
Use this method to get data for high score tables. Will return the score of the specified user and several of their neighbors in a game. Returns an Array of :class:`aiogram.types.game_high_score.GameHighScore` objects.
This method will currently return scores for the target user, plus two of their closest neighbors on each side. Will also return the top three users if the user and their neighbors are not among them. Please note that this behavior is subject to change.
Source: https://core.telegram.org/bots/api#getgamehighscores
"""
__returning__ = list[GameHighScore]
__api_method__ = "getGameHighScores"
user_id: int
"""Target user id"""
chat_id: Optional[int] = None
"""Required if *inline_message_id* is not specified. Unique identifier for the target chat"""
message_id: Optional[int] = None
"""Required if *inline_message_id* is not specified. Identifier of the sent message"""
inline_message_id: Optional[str] = None
"""Required if *chat_id* and *message_id* are not specified. Identifier of the inline message"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
user_id: int,
chat_id: Optional[int] = None,
message_id: Optional[int] = None,
inline_message_id: 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__(
user_id=user_id,
chat_id=chat_id,
message_id=message_id,
inline_message_id=inline_message_id,
**__pydantic_kwargs,
)

View File

@@ -0,0 +1,15 @@
from __future__ import annotations
from ..types import User
from .base import TelegramMethod
class GetMe(TelegramMethod[User]):
"""
A simple method for testing your bot's authentication token. Requires no parameters. Returns basic information about the bot in form of a :class:`aiogram.types.user.User` object.
Source: https://core.telegram.org/bots/api#getme
"""
__returning__ = User
__api_method__ = "getMe"

View File

@@ -0,0 +1,39 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional
from ..types import BotCommand, BotCommandScopeUnion
from .base import TelegramMethod
class GetMyCommands(TelegramMethod[list[BotCommand]]):
"""
Use this method to get the current list of the bot's commands for the given scope and user language. Returns an Array of :class:`aiogram.types.bot_command.BotCommand` objects. If commands aren't set, an empty list is returned.
Source: https://core.telegram.org/bots/api#getmycommands
"""
__returning__ = list[BotCommand]
__api_method__ = "getMyCommands"
scope: Optional[BotCommandScopeUnion] = None
"""A JSON-serialized object, describing scope of users. Defaults to :class:`aiogram.types.bot_command_scope_default.BotCommandScopeDefault`."""
language_code: Optional[str] = None
"""A two-letter ISO 639-1 language code or an empty string"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
scope: Optional[BotCommandScopeUnion] = None,
language_code: 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__(scope=scope, language_code=language_code, **__pydantic_kwargs)

View File

@@ -0,0 +1,33 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional
from ..types import ChatAdministratorRights
from .base import TelegramMethod
class GetMyDefaultAdministratorRights(TelegramMethod[ChatAdministratorRights]):
"""
Use this method to get the current default administrator rights of the bot. Returns :class:`aiogram.types.chat_administrator_rights.ChatAdministratorRights` on success.
Source: https://core.telegram.org/bots/api#getmydefaultadministratorrights
"""
__returning__ = ChatAdministratorRights
__api_method__ = "getMyDefaultAdministratorRights"
for_channels: Optional[bool] = None
"""Pass :code:`True` to get default administrator rights of the bot in channels. Otherwise, default administrator rights of the bot for groups and supergroups will be returned."""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__, *, for_channels: 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__(for_channels=for_channels, **__pydantic_kwargs)

View File

@@ -0,0 +1,33 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional
from ..types import BotDescription
from .base import TelegramMethod
class GetMyDescription(TelegramMethod[BotDescription]):
"""
Use this method to get the current bot description for the given user language. Returns :class:`aiogram.types.bot_description.BotDescription` on success.
Source: https://core.telegram.org/bots/api#getmydescription
"""
__returning__ = BotDescription
__api_method__ = "getMyDescription"
language_code: Optional[str] = None
"""A two-letter ISO 639-1 language code or an empty string"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__, *, language_code: 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__(language_code=language_code, **__pydantic_kwargs)

View File

@@ -0,0 +1,31 @@
from typing import TYPE_CHECKING, Any, Optional
from ..types import BotName
from .base import TelegramMethod
class GetMyName(TelegramMethod[BotName]):
"""
Use this method to get the current bot name for the given user language. Returns :class:`aiogram.types.bot_name.BotName` on success.
Source: https://core.telegram.org/bots/api#getmyname
"""
__returning__ = BotName
__api_method__ = "getMyName"
language_code: Optional[str] = None
"""A two-letter ISO 639-1 language code or an empty string"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__, *, language_code: 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__(language_code=language_code, **__pydantic_kwargs)

View File

@@ -0,0 +1,33 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional
from ..types import BotShortDescription
from .base import TelegramMethod
class GetMyShortDescription(TelegramMethod[BotShortDescription]):
"""
Use this method to get the current bot short description for the given user language. Returns :class:`aiogram.types.bot_short_description.BotShortDescription` on success.
Source: https://core.telegram.org/bots/api#getmyshortdescription
"""
__returning__ = BotShortDescription
__api_method__ = "getMyShortDescription"
language_code: Optional[str] = None
"""A two-letter ISO 639-1 language code or an empty string"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__, *, language_code: 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__(language_code=language_code, **__pydantic_kwargs)

View File

@@ -0,0 +1,39 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional
from ..types import StarTransactions
from .base import TelegramMethod
class GetStarTransactions(TelegramMethod[StarTransactions]):
"""
Returns the bot's Telegram Star transactions in chronological order. On success, returns a :class:`aiogram.types.star_transactions.StarTransactions` object.
Source: https://core.telegram.org/bots/api#getstartransactions
"""
__returning__ = StarTransactions
__api_method__ = "getStarTransactions"
offset: Optional[int] = None
"""Number of transactions to skip in the response"""
limit: Optional[int] = None
"""The maximum number of transactions to be retrieved. Values between 1-100 are accepted. Defaults to 100."""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
offset: Optional[int] = 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__(offset=offset, limit=limit, **__pydantic_kwargs)

View File

@@ -0,0 +1,31 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from ..types import StickerSet
from .base import TelegramMethod
class GetStickerSet(TelegramMethod[StickerSet]):
"""
Use this method to get a sticker set. On success, a :class:`aiogram.types.sticker_set.StickerSet` object is returned.
Source: https://core.telegram.org/bots/api#getstickerset
"""
__returning__ = StickerSet
__api_method__ = "getStickerSet"
name: str
"""Name of the sticker set"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(__pydantic__self__, *, 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__(name=name, **__pydantic_kwargs)

View File

@@ -0,0 +1,57 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional
from ..types import Update
from .base import TelegramMethod
class GetUpdates(TelegramMethod[list[Update]]):
"""
Use this method to receive incoming updates using long polling (`wiki <https://en.wikipedia.org/wiki/Push_technology#Long_polling>`_). Returns an Array of :class:`aiogram.types.update.Update` objects.
**Notes**
**1.** This method will not work if an outgoing webhook is set up.
**2.** In order to avoid getting duplicate updates, recalculate *offset* after each server response.
Source: https://core.telegram.org/bots/api#getupdates
"""
__returning__ = list[Update]
__api_method__ = "getUpdates"
offset: Optional[int] = None
"""Identifier of the first update to be returned. Must be greater by one than the highest among the identifiers of previously received updates. By default, updates starting with the earliest unconfirmed update are returned. An update is considered confirmed as soon as :class:`aiogram.methods.get_updates.GetUpdates` is called with an *offset* higher than its *update_id*. The negative offset can be specified to retrieve updates starting from *-offset* update from the end of the updates queue. All previous updates will be forgotten."""
limit: Optional[int] = None
"""Limits the number of updates to be retrieved. Values between 1-100 are accepted. Defaults to 100."""
timeout: Optional[int] = None
"""Timeout in seconds for long polling. Defaults to 0, i.e. usual short polling. Should be positive, short polling should be used for testing purposes only."""
allowed_updates: Optional[list[str]] = None
"""A JSON-serialized list of the update types you want your bot to receive. For example, specify :code:`["message", "edited_channel_post", "callback_query"]` to only receive updates of these types. See :class:`aiogram.types.update.Update` for a complete list of available update types. Specify an empty list to receive all update types except *chat_member*, *message_reaction*, and *message_reaction_count* (default). If not specified, the previous setting will be used."""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
offset: Optional[int] = None,
limit: Optional[int] = None,
timeout: Optional[int] = None,
allowed_updates: Optional[list[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__(
offset=offset,
limit=limit,
timeout=timeout,
allowed_updates=allowed_updates,
**__pydantic_kwargs,
)

View File

@@ -0,0 +1,33 @@
from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion, UserChatBoosts
from .base import TelegramMethod
class GetUserChatBoosts(TelegramMethod[UserChatBoosts]):
"""
Use this method to get the list of boosts added to a chat by a user. Requires administrator rights in the chat. Returns a :class:`aiogram.types.user_chat_boosts.UserChatBoosts` object.
Source: https://core.telegram.org/bots/api#getuserchatboosts
"""
__returning__ = UserChatBoosts
__api_method__ = "getUserChatBoosts"
chat_id: ChatIdUnion
"""Unique identifier for the chat or username of the channel (in the format :code:`@channelusername`)"""
user_id: int
"""Unique identifier of the target user"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__, *, chat_id: ChatIdUnion, user_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__(chat_id=chat_id, user_id=user_id, **__pydantic_kwargs)

View File

@@ -0,0 +1,42 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional
from ..types import UserProfilePhotos
from .base import TelegramMethod
class GetUserProfilePhotos(TelegramMethod[UserProfilePhotos]):
"""
Use this method to get a list of profile pictures for a user. Returns a :class:`aiogram.types.user_profile_photos.UserProfilePhotos` object.
Source: https://core.telegram.org/bots/api#getuserprofilephotos
"""
__returning__ = UserProfilePhotos
__api_method__ = "getUserProfilePhotos"
user_id: int
"""Unique identifier of the target user"""
offset: Optional[int] = None
"""Sequential number of the first photo to be returned. By default, all photos are returned."""
limit: Optional[int] = None
"""Limits the number of photos to be retrieved. Values between 1-100 are accepted. Defaults to 100."""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
user_id: int,
offset: Optional[int] = None,
limit: Optional[int] = None,
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher`
# Is needed only for type checking and IDE support without any additional plugins
super().__init__(user_id=user_id, offset=offset, limit=limit, **__pydantic_kwargs)

View File

@@ -0,0 +1,15 @@
from __future__ import annotations
from ..types import WebhookInfo
from .base import TelegramMethod
class GetWebhookInfo(TelegramMethod[WebhookInfo]):
"""
Use this method to get current webhook status. Requires no parameters. On success, returns a :class:`aiogram.types.webhook_info.WebhookInfo` object. If the bot is using :class:`aiogram.methods.get_updates.GetUpdates`, will return an object with the *url* field empty.
Source: https://core.telegram.org/bots/api#getwebhookinfo
"""
__returning__ = WebhookInfo
__api_method__ = "getWebhookInfo"

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,33 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion
from .base import TelegramMethod
class HideGeneralForumTopic(TelegramMethod[bool]):
"""
Use this method to hide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the *can_manage_topics* administrator rights. The topic will be automatically closed if it was open. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#hidegeneralforumtopic
"""
__returning__ = bool
__api_method__ = "hideGeneralForumTopic"
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__, *, chat_id: ChatIdUnion, **__pydantic_kwargs: Any
) -> None:
# DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher`
# Is needed only for type checking and IDE support without any additional plugins
super().__init__(chat_id=chat_id, **__pydantic_kwargs)

View File

@@ -0,0 +1,33 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion
from .base import TelegramMethod
class LeaveChat(TelegramMethod[bool]):
"""
Use this method for your bot to leave a group, supergroup or channel. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#leavechat
"""
__returning__ = bool
__api_method__ = "leaveChat"
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target supergroup or channel (in the format :code:`@channelusername`)"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__, *, chat_id: ChatIdUnion, **__pydantic_kwargs: Any
) -> None:
# DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher`
# Is needed only for type checking and IDE support without any additional plugins
super().__init__(chat_id=chat_id, **__pydantic_kwargs)

View File

@@ -0,0 +1,14 @@
from __future__ import annotations
from .base import TelegramMethod
class LogOut(TelegramMethod[bool]):
"""
Use this method to log out from the cloud Bot API server before launching the bot locally. You **must** log out the bot before running it locally, otherwise there is no guarantee that the bot will receive updates. After a successful call, you can immediately log in on a local server, but will not be able to log in back to the cloud Bot API server for 10 minutes. Returns :code:`True` on success. Requires no parameters.
Source: https://core.telegram.org/bots/api#logout
"""
__returning__ = bool
__api_method__ = "logOut"

View File

@@ -0,0 +1,51 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional
from ..types import ChatIdUnion
from .base import TelegramMethod
class PinChatMessage(TelegramMethod[bool]):
"""
Use this method to add a message to the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' administrator right in a supergroup or 'can_edit_messages' administrator right in a channel. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#pinchatmessage
"""
__returning__ = bool
__api_method__ = "pinChatMessage"
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
message_id: int
"""Identifier of a message to pin"""
business_connection_id: Optional[str] = None
"""Unique identifier of the business connection on behalf of which the message will be pinned"""
disable_notification: Optional[bool] = None
"""Pass :code:`True` if it is not necessary to send a notification to all chat members about the new pinned message. Notifications are always disabled in channels and private chats."""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
chat_id: ChatIdUnion,
message_id: int,
business_connection_id: Optional[str] = None,
disable_notification: 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__(
chat_id=chat_id,
message_id=message_id,
business_connection_id=business_connection_id,
disable_notification=disable_notification,
**__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,103 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional
from ..types import ChatIdUnion
from .base import TelegramMethod
class PromoteChatMember(TelegramMethod[bool]):
"""
Use this method to promote or demote a user in a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Pass :code:`False` for all boolean parameters to demote a user. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#promotechatmember
"""
__returning__ = bool
__api_method__ = "promoteChatMember"
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
user_id: int
"""Unique identifier of the target user"""
is_anonymous: Optional[bool] = None
"""Pass :code:`True` if the administrator's presence in the chat is hidden"""
can_manage_chat: Optional[bool] = None
"""Pass :code:`True` if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report spam messages and ignore slow mode. Implied by any other administrator privilege."""
can_delete_messages: Optional[bool] = None
"""Pass :code:`True` if the administrator can delete messages of other users"""
can_manage_video_chats: Optional[bool] = None
"""Pass :code:`True` if the administrator can manage video chats"""
can_restrict_members: Optional[bool] = None
"""Pass :code:`True` if the administrator can restrict, ban or unban chat members, or access supergroup statistics"""
can_promote_members: Optional[bool] = None
"""Pass :code:`True` if the administrator can add new administrators with a subset of their own privileges or demote administrators that they have promoted, directly or indirectly (promoted by administrators that were appointed by him)"""
can_change_info: Optional[bool] = None
"""Pass :code:`True` if the administrator can change chat title, photo and other settings"""
can_invite_users: Optional[bool] = None
"""Pass :code:`True` if the administrator can invite new users to the chat"""
can_post_stories: Optional[bool] = None
"""Pass :code:`True` if the administrator can post stories to the chat"""
can_edit_stories: Optional[bool] = None
"""Pass :code:`True` if the administrator can edit stories posted by other users, post stories to the chat page, pin chat stories, and access the chat's story archive"""
can_delete_stories: Optional[bool] = None
"""Pass :code:`True` if the administrator can delete stories posted by other users"""
can_post_messages: Optional[bool] = None
"""Pass :code:`True` if the administrator can post messages in the channel, or access channel statistics; for channels only"""
can_edit_messages: Optional[bool] = None
"""Pass :code:`True` if the administrator can edit messages of other users and can pin messages; for channels only"""
can_pin_messages: Optional[bool] = None
"""Pass :code:`True` if the administrator can pin messages; for supergroups only"""
can_manage_topics: Optional[bool] = None
"""Pass :code:`True` if the user is allowed to create, rename, close, and reopen forum topics; for supergroups only"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
chat_id: ChatIdUnion,
user_id: int,
is_anonymous: Optional[bool] = None,
can_manage_chat: Optional[bool] = None,
can_delete_messages: Optional[bool] = None,
can_manage_video_chats: Optional[bool] = None,
can_restrict_members: Optional[bool] = None,
can_promote_members: Optional[bool] = None,
can_change_info: Optional[bool] = None,
can_invite_users: Optional[bool] = None,
can_post_stories: Optional[bool] = None,
can_edit_stories: Optional[bool] = None,
can_delete_stories: Optional[bool] = None,
can_post_messages: Optional[bool] = None,
can_edit_messages: Optional[bool] = None,
can_pin_messages: Optional[bool] = None,
can_manage_topics: 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__(
chat_id=chat_id,
user_id=user_id,
is_anonymous=is_anonymous,
can_manage_chat=can_manage_chat,
can_delete_messages=can_delete_messages,
can_manage_video_chats=can_manage_video_chats,
can_restrict_members=can_restrict_members,
can_promote_members=can_promote_members,
can_change_info=can_change_info,
can_invite_users=can_invite_users,
can_post_stories=can_post_stories,
can_edit_stories=can_edit_stories,
can_delete_stories=can_delete_stories,
can_post_messages=can_post_messages,
can_edit_messages=can_edit_messages,
can_pin_messages=can_pin_messages,
can_manage_topics=can_manage_topics,
**__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
from .base import TelegramMethod
class RefundStarPayment(TelegramMethod[bool]):
"""
Refunds a successful payment in `Telegram Stars <https://t.me/BotNews/90>`_. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#refundstarpayment
"""
__returning__ = bool
__api_method__ = "refundStarPayment"
user_id: int
"""Identifier of the user whose payment will be refunded"""
telegram_payment_charge_id: str
"""Telegram payment identifier"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
user_id: int,
telegram_payment_charge_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__(
user_id=user_id,
telegram_payment_charge_id=telegram_payment_charge_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

@@ -0,0 +1,33 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion
from .base import TelegramMethod
class RemoveChatVerification(TelegramMethod[bool]):
"""
Removes verification from a chat that is currently verified `on behalf of the organization <https://telegram.org/verify#third-party-verification>`_ represented by the bot. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#removechatverification
"""
__returning__ = bool
__api_method__ = "removeChatVerification"
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__, *, chat_id: ChatIdUnion, **__pydantic_kwargs: Any
) -> None:
# DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher`
# Is needed only for type checking and IDE support without any additional plugins
super().__init__(chat_id=chat_id, **__pydantic_kwargs)

View File

@@ -0,0 +1,30 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from .base import TelegramMethod
class RemoveUserVerification(TelegramMethod[bool]):
"""
Removes verification from a user who is currently verified `on behalf of the organization <https://telegram.org/verify#third-party-verification>`_ represented by the bot. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#removeuserverification
"""
__returning__ = bool
__api_method__ = "removeUserVerification"
user_id: int
"""Unique identifier of the target user"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(__pydantic__self__, *, user_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__(user_id=user_id, **__pydantic_kwargs)

View File

@@ -0,0 +1,41 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion
from .base import TelegramMethod
class ReopenForumTopic(TelegramMethod[bool]):
"""
Use this method to reopen a closed topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the *can_manage_topics* administrator rights, unless it is the creator of the topic. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#reopenforumtopic
"""
__returning__ = bool
__api_method__ = "reopenForumTopic"
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)"""
message_thread_id: int
"""Unique identifier for the target message thread of the forum topic"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
chat_id: ChatIdUnion,
message_thread_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__(
chat_id=chat_id, message_thread_id=message_thread_id, **__pydantic_kwargs
)

View File

@@ -0,0 +1,33 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion
from .base import TelegramMethod
class ReopenGeneralForumTopic(TelegramMethod[bool]):
"""
Use this method to reopen a closed 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the *can_manage_topics* administrator rights. The topic will be automatically unhidden if it was hidden. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#reopengeneralforumtopic
"""
__returning__ = bool
__api_method__ = "reopenGeneralForumTopic"
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__, *, chat_id: ChatIdUnion, **__pydantic_kwargs: Any
) -> None:
# DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher`
# Is needed only for type checking and IDE support without any additional plugins
super().__init__(chat_id=chat_id, **__pydantic_kwargs)

View File

@@ -0,0 +1,51 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from ..types import InputSticker
from .base import TelegramMethod
class ReplaceStickerInSet(TelegramMethod[bool]):
"""
Use this method to replace an existing sticker in a sticker set with a new one. The method is equivalent to calling :class:`aiogram.methods.delete_sticker_from_set.DeleteStickerFromSet`, then :class:`aiogram.methods.add_sticker_to_set.AddStickerToSet`, then :class:`aiogram.methods.set_sticker_position_in_set.SetStickerPositionInSet`. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#replacestickerinset
"""
__returning__ = bool
__api_method__ = "replaceStickerInSet"
user_id: int
"""User identifier of the sticker set owner"""
name: str
"""Sticker set name"""
old_sticker: str
"""File identifier of the replaced sticker"""
sticker: InputSticker
"""A JSON-serialized object with information about the added sticker. If exactly the same sticker had already been added to the set, then the set remains unchanged."""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
user_id: int,
name: str,
old_sticker: str,
sticker: InputSticker,
**__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,
name=name,
old_sticker=old_sticker,
sticker=sticker,
**__pydantic_kwargs,
)

View File

@@ -0,0 +1,55 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional
from ..types import ChatIdUnion, ChatPermissions, DateTimeUnion
from .base import TelegramMethod
class RestrictChatMember(TelegramMethod[bool]):
"""
Use this method to restrict a user in a supergroup. The bot must be an administrator in the supergroup for this to work and must have the appropriate administrator rights. Pass :code:`True` for all permissions to lift restrictions from a user. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#restrictchatmember
"""
__returning__ = bool
__api_method__ = "restrictChatMember"
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)"""
user_id: int
"""Unique identifier of the target user"""
permissions: ChatPermissions
"""A JSON-serialized object for new user permissions"""
use_independent_chat_permissions: Optional[bool] = None
"""Pass :code:`True` if chat permissions are set independently. Otherwise, the *can_send_other_messages* and *can_add_web_page_previews* permissions will imply the *can_send_messages*, *can_send_audios*, *can_send_documents*, *can_send_photos*, *can_send_videos*, *can_send_video_notes*, and *can_send_voice_notes* permissions; the *can_send_polls* permission will imply the *can_send_messages* permission."""
until_date: Optional[DateTimeUnion] = None
"""Date when restrictions will be lifted for the user; Unix time. If user is restricted for more than 366 days or less than 30 seconds from the current time, they are considered to be restricted forever"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
chat_id: ChatIdUnion,
user_id: int,
permissions: ChatPermissions,
use_independent_chat_permissions: Optional[bool] = None,
until_date: Optional[DateTimeUnion] = None,
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher`
# Is needed only for type checking and IDE support without any additional plugins
super().__init__(
chat_id=chat_id,
user_id=user_id,
permissions=permissions,
use_independent_chat_permissions=use_independent_chat_permissions,
until_date=until_date,
**__pydantic_kwargs,
)

View File

@@ -0,0 +1,35 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion, ChatInviteLink
from .base import TelegramMethod
class RevokeChatInviteLink(TelegramMethod[ChatInviteLink]):
"""
Use this method to revoke an invite link created by the bot. If the primary link is revoked, a new link is automatically generated. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns the revoked invite link as :class:`aiogram.types.chat_invite_link.ChatInviteLink` object.
Source: https://core.telegram.org/bots/api#revokechatinvitelink
"""
__returning__ = ChatInviteLink
__api_method__ = "revokeChatInviteLink"
chat_id: ChatIdUnion
"""Unique identifier of the target chat or username of the target channel (in the format :code:`@channelusername`)"""
invite_link: str
"""The invite link to revoke"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__, *, chat_id: ChatIdUnion, invite_link: 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__(chat_id=chat_id, invite_link=invite_link, **__pydantic_kwargs)

View File

@@ -0,0 +1,59 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional
from ..types import InlineQueryResultUnion, PreparedInlineMessage
from .base import TelegramMethod
class SavePreparedInlineMessage(TelegramMethod[PreparedInlineMessage]):
"""
Stores a message that can be sent by a user of a Mini App. Returns a :class:`aiogram.types.prepared_inline_message.PreparedInlineMessage` object.
Source: https://core.telegram.org/bots/api#savepreparedinlinemessage
"""
__returning__ = PreparedInlineMessage
__api_method__ = "savePreparedInlineMessage"
user_id: int
"""Unique identifier of the target user that can use the prepared message"""
result: InlineQueryResultUnion
"""A JSON-serialized object describing the message to be sent"""
allow_user_chats: Optional[bool] = None
"""Pass :code:`True` if the message can be sent to private chats with users"""
allow_bot_chats: Optional[bool] = None
"""Pass :code:`True` if the message can be sent to private chats with bots"""
allow_group_chats: Optional[bool] = None
"""Pass :code:`True` if the message can be sent to group and supergroup chats"""
allow_channel_chats: Optional[bool] = None
"""Pass :code:`True` if the message can be sent to channel chats"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
user_id: int,
result: InlineQueryResultUnion,
allow_user_chats: Optional[bool] = None,
allow_bot_chats: Optional[bool] = None,
allow_group_chats: Optional[bool] = None,
allow_channel_chats: 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__(
user_id=user_id,
result=result,
allow_user_chats=allow_user_chats,
allow_bot_chats=allow_bot_chats,
allow_group_chats=allow_group_chats,
allow_channel_chats=allow_channel_chats,
**__pydantic_kwargs,
)

View File

@@ -0,0 +1,140 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union
from pydantic import Field
from ..client.default import Default
from ..types import (
ChatIdUnion,
InputFile,
InputFileUnion,
Message,
MessageEntity,
ReplyMarkupUnion,
ReplyParameters,
)
from .base import TelegramMethod
class SendAnimation(TelegramMethod[Message]):
"""
Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). On success, the sent :class:`aiogram.types.message.Message` is returned. Bots can currently send animation files of up to 50 MB in size, this limit may be changed in the future.
Source: https://core.telegram.org/bots/api#sendanimation
"""
__returning__ = Message
__api_method__ = "sendAnimation"
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
animation: InputFileUnion
"""Animation to send. Pass a file_id as String to send an animation that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an animation from the Internet, or upload a new animation using multipart/form-data. :ref:`More information on Sending Files » <sending-files>`"""
business_connection_id: Optional[str] = None
"""Unique identifier of the business connection on behalf of which the message will be sent"""
message_thread_id: Optional[int] = None
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
duration: Optional[int] = None
"""Duration of sent animation in seconds"""
width: Optional[int] = None
"""Animation width"""
height: Optional[int] = None
"""Animation height"""
thumbnail: Optional[InputFile] = None
"""Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`"""
caption: Optional[str] = None
"""Animation caption (may also be used when resending animation by *file_id*), 0-1024 characters after entities parsing"""
parse_mode: Optional[Union[str, Default]] = Default("parse_mode")
"""Mode for parsing entities in the animation caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details."""
caption_entities: Optional[list[MessageEntity]] = None
"""A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*"""
show_caption_above_media: Optional[Union[bool, Default]] = Default("show_caption_above_media")
"""Pass :code:`True`, if the caption must be shown above the message media"""
has_spoiler: Optional[bool] = None
"""Pass :code:`True` if the animation needs to be covered with a spoiler animation"""
disable_notification: Optional[bool] = None
"""Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
protect_content: Optional[Union[bool, Default]] = Default("protect_content")
"""Protects the contents of the sent message from forwarding and saving"""
allow_paid_broadcast: Optional[bool] = None
"""Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"""
message_effect_id: Optional[str] = None
"""Unique identifier of the message effect to be added to the message; for private chats only"""
reply_parameters: Optional[ReplyParameters] = None
"""Description of the message to reply to"""
reply_markup: Optional[ReplyMarkupUnion] = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user"""
allow_sending_without_reply: Optional[bool] = Field(
None, json_schema_extra={"deprecated": True}
)
"""Pass :code:`True` if the message should be sent even if the specified replied-to message is not found
.. deprecated:: API:7.0
https://core.telegram.org/bots/api-changelog#december-29-2023"""
reply_to_message_id: Optional[int] = Field(None, json_schema_extra={"deprecated": True})
"""If the message is a reply, ID of the original message
.. deprecated:: API:7.0
https://core.telegram.org/bots/api-changelog#december-29-2023"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
chat_id: ChatIdUnion,
animation: InputFileUnion,
business_connection_id: Optional[str] = None,
message_thread_id: Optional[int] = None,
duration: Optional[int] = None,
width: Optional[int] = None,
height: Optional[int] = None,
thumbnail: Optional[InputFile] = None,
caption: Optional[str] = None,
parse_mode: Optional[Union[str, Default]] = Default("parse_mode"),
caption_entities: Optional[list[MessageEntity]] = None,
show_caption_above_media: Optional[Union[bool, Default]] = Default(
"show_caption_above_media"
),
has_spoiler: Optional[bool] = None,
disable_notification: Optional[bool] = None,
protect_content: Optional[Union[bool, Default]] = Default("protect_content"),
allow_paid_broadcast: Optional[bool] = None,
message_effect_id: Optional[str] = None,
reply_parameters: Optional[ReplyParameters] = None,
reply_markup: Optional[ReplyMarkupUnion] = None,
allow_sending_without_reply: Optional[bool] = None,
reply_to_message_id: Optional[int] = None,
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher`
# Is needed only for type checking and IDE support without any additional plugins
super().__init__(
chat_id=chat_id,
animation=animation,
business_connection_id=business_connection_id,
message_thread_id=message_thread_id,
duration=duration,
width=width,
height=height,
thumbnail=thumbnail,
caption=caption,
parse_mode=parse_mode,
caption_entities=caption_entities,
show_caption_above_media=show_caption_above_media,
has_spoiler=has_spoiler,
disable_notification=disable_notification,
protect_content=protect_content,
allow_paid_broadcast=allow_paid_broadcast,
message_effect_id=message_effect_id,
reply_parameters=reply_parameters,
reply_markup=reply_markup,
allow_sending_without_reply=allow_sending_without_reply,
reply_to_message_id=reply_to_message_id,
**__pydantic_kwargs,
)

View File

@@ -0,0 +1,131 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union
from pydantic import Field
from ..client.default import Default
from ..types import (
ChatIdUnion,
InputFile,
InputFileUnion,
Message,
MessageEntity,
ReplyMarkupUnion,
ReplyParameters,
)
from .base import TelegramMethod
class SendAudio(TelegramMethod[Message]):
"""
Use this method to send audio files, if you want Telegram clients to display them in the music player. Your audio must be in the .MP3 or .M4A format. On success, the sent :class:`aiogram.types.message.Message` is returned. Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future.
For sending voice messages, use the :class:`aiogram.methods.send_voice.SendVoice` method instead.
Source: https://core.telegram.org/bots/api#sendaudio
"""
__returning__ = Message
__api_method__ = "sendAudio"
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
audio: InputFileUnion
"""Audio file to send. Pass a file_id as String to send an audio file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an audio file from the Internet, or upload a new one using multipart/form-data. :ref:`More information on Sending Files » <sending-files>`"""
business_connection_id: Optional[str] = None
"""Unique identifier of the business connection on behalf of which the message will be sent"""
message_thread_id: Optional[int] = None
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
caption: Optional[str] = None
"""Audio caption, 0-1024 characters after entities parsing"""
parse_mode: Optional[Union[str, Default]] = Default("parse_mode")
"""Mode for parsing entities in the audio 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*"""
duration: Optional[int] = None
"""Duration of the audio in seconds"""
performer: Optional[str] = None
"""Performer"""
title: Optional[str] = None
"""Track name"""
thumbnail: Optional[InputFile] = None
"""Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`"""
disable_notification: Optional[bool] = None
"""Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
protect_content: Optional[Union[bool, Default]] = Default("protect_content")
"""Protects the contents of the sent message from forwarding and saving"""
allow_paid_broadcast: Optional[bool] = None
"""Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"""
message_effect_id: Optional[str] = None
"""Unique identifier of the message effect to be added to the message; for private chats only"""
reply_parameters: Optional[ReplyParameters] = None
"""Description of the message to reply to"""
reply_markup: Optional[ReplyMarkupUnion] = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user"""
allow_sending_without_reply: Optional[bool] = Field(
None, json_schema_extra={"deprecated": True}
)
"""Pass :code:`True` if the message should be sent even if the specified replied-to message is not found
.. deprecated:: API:7.0
https://core.telegram.org/bots/api-changelog#december-29-2023"""
reply_to_message_id: Optional[int] = Field(None, json_schema_extra={"deprecated": True})
"""If the message is a reply, ID of the original message
.. deprecated:: API:7.0
https://core.telegram.org/bots/api-changelog#december-29-2023"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
chat_id: ChatIdUnion,
audio: InputFileUnion,
business_connection_id: Optional[str] = None,
message_thread_id: Optional[int] = None,
caption: Optional[str] = None,
parse_mode: Optional[Union[str, Default]] = Default("parse_mode"),
caption_entities: Optional[list[MessageEntity]] = None,
duration: Optional[int] = None,
performer: Optional[str] = None,
title: Optional[str] = None,
thumbnail: Optional[InputFile] = None,
disable_notification: Optional[bool] = None,
protect_content: Optional[Union[bool, Default]] = Default("protect_content"),
allow_paid_broadcast: Optional[bool] = None,
message_effect_id: Optional[str] = None,
reply_parameters: Optional[ReplyParameters] = None,
reply_markup: Optional[ReplyMarkupUnion] = None,
allow_sending_without_reply: Optional[bool] = None,
reply_to_message_id: Optional[int] = None,
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher`
# Is needed only for type checking and IDE support without any additional plugins
super().__init__(
chat_id=chat_id,
audio=audio,
business_connection_id=business_connection_id,
message_thread_id=message_thread_id,
caption=caption,
parse_mode=parse_mode,
caption_entities=caption_entities,
duration=duration,
performer=performer,
title=title,
thumbnail=thumbnail,
disable_notification=disable_notification,
protect_content=protect_content,
allow_paid_broadcast=allow_paid_broadcast,
message_effect_id=message_effect_id,
reply_parameters=reply_parameters,
reply_markup=reply_markup,
allow_sending_without_reply=allow_sending_without_reply,
reply_to_message_id=reply_to_message_id,
**__pydantic_kwargs,
)

View File

@@ -0,0 +1,55 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional
from ..types import ChatIdUnion
from .base import TelegramMethod
class SendChatAction(TelegramMethod[bool]):
"""
Use this method when you need to tell the user that something is happening on the bot's side. The status is set for 5 seconds or less (when a message arrives from your bot, Telegram clients clear its typing status). Returns :code:`True` on success.
Example: The `ImageBot <https://t.me/imagebot>`_ needs some time to process a request and upload the image. Instead of sending a text message along the lines of 'Retrieving image, please wait…', the bot may use :class:`aiogram.methods.send_chat_action.SendChatAction` with *action* = *upload_photo*. The user will see a 'sending photo' status for the bot.
We only recommend using this method when a response from the bot will take a **noticeable** amount of time to arrive.
Source: https://core.telegram.org/bots/api#sendchataction
"""
__returning__ = bool
__api_method__ = "sendChatAction"
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
action: str
"""Type of action to broadcast. Choose one, depending on what the user is about to receive: *typing* for `text messages <https://core.telegram.org/bots/api#sendmessage>`_, *upload_photo* for `photos <https://core.telegram.org/bots/api#sendphoto>`_, *record_video* or *upload_video* for `videos <https://core.telegram.org/bots/api#sendvideo>`_, *record_voice* or *upload_voice* for `voice notes <https://core.telegram.org/bots/api#sendvoice>`_, *upload_document* for `general files <https://core.telegram.org/bots/api#senddocument>`_, *choose_sticker* for `stickers <https://core.telegram.org/bots/api#sendsticker>`_, *find_location* for `location data <https://core.telegram.org/bots/api#sendlocation>`_, *record_video_note* or *upload_video_note* for `video notes <https://core.telegram.org/bots/api#sendvideonote>`_."""
business_connection_id: Optional[str] = None
"""Unique identifier of the business connection on behalf of which the action will be sent"""
message_thread_id: Optional[int] = None
"""Unique identifier for the target message thread; for supergroups only"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
chat_id: ChatIdUnion,
action: str,
business_connection_id: Optional[str] = None,
message_thread_id: Optional[int] = None,
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher`
# Is needed only for type checking and IDE support without any additional plugins
super().__init__(
chat_id=chat_id,
action=action,
business_connection_id=business_connection_id,
message_thread_id=message_thread_id,
**__pydantic_kwargs,
)

View File

@@ -0,0 +1,106 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union
from pydantic import Field
from ..client.default import Default
from ..types import ChatIdUnion, Message, ReplyMarkupUnion, ReplyParameters
from .base import TelegramMethod
class SendContact(TelegramMethod[Message]):
"""
Use this method to send phone contacts. On success, the sent :class:`aiogram.types.message.Message` is returned.
Source: https://core.telegram.org/bots/api#sendcontact
"""
__returning__ = Message
__api_method__ = "sendContact"
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
phone_number: str
"""Contact's phone number"""
first_name: str
"""Contact's first name"""
business_connection_id: Optional[str] = None
"""Unique identifier of the business connection on behalf of which the message will be sent"""
message_thread_id: Optional[int] = None
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
last_name: Optional[str] = None
"""Contact's last name"""
vcard: Optional[str] = None
"""Additional data about the contact in the form of a `vCard <https://en.wikipedia.org/wiki/VCard>`_, 0-2048 bytes"""
disable_notification: Optional[bool] = None
"""Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
protect_content: Optional[Union[bool, Default]] = Default("protect_content")
"""Protects the contents of the sent message from forwarding and saving"""
allow_paid_broadcast: Optional[bool] = None
"""Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"""
message_effect_id: Optional[str] = None
"""Unique identifier of the message effect to be added to the message; for private chats only"""
reply_parameters: Optional[ReplyParameters] = None
"""Description of the message to reply to"""
reply_markup: Optional[ReplyMarkupUnion] = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user"""
allow_sending_without_reply: Optional[bool] = Field(
None, json_schema_extra={"deprecated": True}
)
"""Pass :code:`True` if the message should be sent even if the specified replied-to message is not found
.. deprecated:: API:7.0
https://core.telegram.org/bots/api-changelog#december-29-2023"""
reply_to_message_id: Optional[int] = Field(None, json_schema_extra={"deprecated": True})
"""If the message is a reply, ID of the original message
.. deprecated:: API:7.0
https://core.telegram.org/bots/api-changelog#december-29-2023"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
chat_id: ChatIdUnion,
phone_number: str,
first_name: str,
business_connection_id: Optional[str] = None,
message_thread_id: Optional[int] = None,
last_name: Optional[str] = None,
vcard: Optional[str] = None,
disable_notification: Optional[bool] = None,
protect_content: Optional[Union[bool, Default]] = Default("protect_content"),
allow_paid_broadcast: Optional[bool] = None,
message_effect_id: Optional[str] = None,
reply_parameters: Optional[ReplyParameters] = None,
reply_markup: Optional[ReplyMarkupUnion] = None,
allow_sending_without_reply: Optional[bool] = None,
reply_to_message_id: Optional[int] = None,
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher`
# Is needed only for type checking and IDE support without any additional plugins
super().__init__(
chat_id=chat_id,
phone_number=phone_number,
first_name=first_name,
business_connection_id=business_connection_id,
message_thread_id=message_thread_id,
last_name=last_name,
vcard=vcard,
disable_notification=disable_notification,
protect_content=protect_content,
allow_paid_broadcast=allow_paid_broadcast,
message_effect_id=message_effect_id,
reply_parameters=reply_parameters,
reply_markup=reply_markup,
allow_sending_without_reply=allow_sending_without_reply,
reply_to_message_id=reply_to_message_id,
**__pydantic_kwargs,
)

View File

@@ -0,0 +1,94 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union
from pydantic import Field
from ..client.default import Default
from ..types import ChatIdUnion, Message, ReplyMarkupUnion, ReplyParameters
from .base import TelegramMethod
class SendDice(TelegramMethod[Message]):
"""
Use this method to send an animated emoji that will display a random value. On success, the sent :class:`aiogram.types.message.Message` is returned.
Source: https://core.telegram.org/bots/api#senddice
"""
__returning__ = Message
__api_method__ = "sendDice"
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
business_connection_id: Optional[str] = None
"""Unique identifier of the business connection on behalf of which the message will be sent"""
message_thread_id: Optional[int] = None
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
emoji: Optional[str] = None
"""Emoji on which the dice throw animation is based. Currently, must be one of '🎲', '🎯', '🏀', '', '🎳', or '🎰'. Dice can have values 1-6 for '🎲', '🎯' and '🎳', values 1-5 for '🏀' and '', and values 1-64 for '🎰'. Defaults to '🎲'"""
disable_notification: Optional[bool] = None
"""Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
protect_content: Optional[Union[bool, Default]] = Default("protect_content")
"""Protects the contents of the sent message from forwarding"""
allow_paid_broadcast: Optional[bool] = None
"""Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"""
message_effect_id: Optional[str] = None
"""Unique identifier of the message effect to be added to the message; for private chats only"""
reply_parameters: Optional[ReplyParameters] = None
"""Description of the message to reply to"""
reply_markup: Optional[ReplyMarkupUnion] = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user"""
allow_sending_without_reply: Optional[bool] = Field(
None, json_schema_extra={"deprecated": True}
)
"""Pass :code:`True` if the message should be sent even if the specified replied-to message is not found
.. deprecated:: API:7.0
https://core.telegram.org/bots/api-changelog#december-29-2023"""
reply_to_message_id: Optional[int] = Field(None, json_schema_extra={"deprecated": True})
"""If the message is a reply, ID of the original message
.. deprecated:: API:7.0
https://core.telegram.org/bots/api-changelog#december-29-2023"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
chat_id: ChatIdUnion,
business_connection_id: Optional[str] = None,
message_thread_id: Optional[int] = None,
emoji: Optional[str] = None,
disable_notification: Optional[bool] = None,
protect_content: Optional[Union[bool, Default]] = Default("protect_content"),
allow_paid_broadcast: Optional[bool] = None,
message_effect_id: Optional[str] = None,
reply_parameters: Optional[ReplyParameters] = None,
reply_markup: Optional[ReplyMarkupUnion] = None,
allow_sending_without_reply: Optional[bool] = None,
reply_to_message_id: Optional[int] = None,
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher`
# Is needed only for type checking and IDE support without any additional plugins
super().__init__(
chat_id=chat_id,
business_connection_id=business_connection_id,
message_thread_id=message_thread_id,
emoji=emoji,
disable_notification=disable_notification,
protect_content=protect_content,
allow_paid_broadcast=allow_paid_broadcast,
message_effect_id=message_effect_id,
reply_parameters=reply_parameters,
reply_markup=reply_markup,
allow_sending_without_reply=allow_sending_without_reply,
reply_to_message_id=reply_to_message_id,
**__pydantic_kwargs,
)

View File

@@ -0,0 +1,122 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union
from pydantic import Field
from ..client.default import Default
from ..types import (
ChatIdUnion,
InputFile,
InputFileUnion,
Message,
MessageEntity,
ReplyMarkupUnion,
ReplyParameters,
)
from .base import TelegramMethod
class SendDocument(TelegramMethod[Message]):
"""
Use this method to send general files. On success, the sent :class:`aiogram.types.message.Message` is returned. Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future.
Source: https://core.telegram.org/bots/api#senddocument
"""
__returning__ = Message
__api_method__ = "sendDocument"
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
document: InputFileUnion
"""File to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. :ref:`More information on Sending Files » <sending-files>`"""
business_connection_id: Optional[str] = None
"""Unique identifier of the business connection on behalf of which the message will be sent"""
message_thread_id: Optional[int] = None
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
thumbnail: Optional[InputFile] = None
"""Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`"""
caption: Optional[str] = None
"""Document caption (may also be used when resending documents by *file_id*), 0-1024 characters after entities parsing"""
parse_mode: Optional[Union[str, Default]] = Default("parse_mode")
"""Mode for parsing entities in the document 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*"""
disable_content_type_detection: Optional[bool] = None
"""Disables automatic server-side content type detection for files uploaded using multipart/form-data"""
disable_notification: Optional[bool] = None
"""Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
protect_content: Optional[Union[bool, Default]] = Default("protect_content")
"""Protects the contents of the sent message from forwarding and saving"""
allow_paid_broadcast: Optional[bool] = None
"""Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"""
message_effect_id: Optional[str] = None
"""Unique identifier of the message effect to be added to the message; for private chats only"""
reply_parameters: Optional[ReplyParameters] = None
"""Description of the message to reply to"""
reply_markup: Optional[ReplyMarkupUnion] = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user"""
allow_sending_without_reply: Optional[bool] = Field(
None, json_schema_extra={"deprecated": True}
)
"""Pass :code:`True` if the message should be sent even if the specified replied-to message is not found
.. deprecated:: API:7.0
https://core.telegram.org/bots/api-changelog#december-29-2023"""
reply_to_message_id: Optional[int] = Field(None, json_schema_extra={"deprecated": True})
"""If the message is a reply, ID of the original message
.. deprecated:: API:7.0
https://core.telegram.org/bots/api-changelog#december-29-2023"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
chat_id: ChatIdUnion,
document: InputFileUnion,
business_connection_id: Optional[str] = None,
message_thread_id: Optional[int] = None,
thumbnail: Optional[InputFile] = None,
caption: Optional[str] = None,
parse_mode: Optional[Union[str, Default]] = Default("parse_mode"),
caption_entities: Optional[list[MessageEntity]] = None,
disable_content_type_detection: Optional[bool] = None,
disable_notification: Optional[bool] = None,
protect_content: Optional[Union[bool, Default]] = Default("protect_content"),
allow_paid_broadcast: Optional[bool] = None,
message_effect_id: Optional[str] = None,
reply_parameters: Optional[ReplyParameters] = None,
reply_markup: Optional[ReplyMarkupUnion] = None,
allow_sending_without_reply: Optional[bool] = None,
reply_to_message_id: Optional[int] = None,
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher`
# Is needed only for type checking and IDE support without any additional plugins
super().__init__(
chat_id=chat_id,
document=document,
business_connection_id=business_connection_id,
message_thread_id=message_thread_id,
thumbnail=thumbnail,
caption=caption,
parse_mode=parse_mode,
caption_entities=caption_entities,
disable_content_type_detection=disable_content_type_detection,
disable_notification=disable_notification,
protect_content=protect_content,
allow_paid_broadcast=allow_paid_broadcast,
message_effect_id=message_effect_id,
reply_parameters=reply_parameters,
reply_markup=reply_markup,
allow_sending_without_reply=allow_sending_without_reply,
reply_to_message_id=reply_to_message_id,
**__pydantic_kwargs,
)

View File

@@ -0,0 +1,94 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union
from pydantic import Field
from ..client.default import Default
from ..types import InlineKeyboardMarkup, Message, ReplyParameters
from .base import TelegramMethod
class SendGame(TelegramMethod[Message]):
"""
Use this method to send a game. On success, the sent :class:`aiogram.types.message.Message` is returned.
Source: https://core.telegram.org/bots/api#sendgame
"""
__returning__ = Message
__api_method__ = "sendGame"
chat_id: int
"""Unique identifier for the target chat"""
game_short_name: str
"""Short name of the game, serves as the unique identifier for the game. Set up your games via `@BotFather <https://t.me/botfather>`_."""
business_connection_id: Optional[str] = None
"""Unique identifier of the business connection on behalf of which the message will be sent"""
message_thread_id: Optional[int] = None
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
disable_notification: Optional[bool] = None
"""Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
protect_content: Optional[Union[bool, Default]] = Default("protect_content")
"""Protects the contents of the sent message from forwarding and saving"""
allow_paid_broadcast: Optional[bool] = None
"""Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"""
message_effect_id: Optional[str] = None
"""Unique identifier of the message effect to be added to the message; for private chats only"""
reply_parameters: Optional[ReplyParameters] = None
"""Description of the message to reply to"""
reply_markup: Optional[InlineKeyboardMarkup] = None
"""A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_. If empty, one 'Play game_title' button will be shown. If not empty, the first button must launch the game."""
allow_sending_without_reply: Optional[bool] = Field(
None, json_schema_extra={"deprecated": True}
)
"""Pass :code:`True` if the message should be sent even if the specified replied-to message is not found
.. deprecated:: API:7.0
https://core.telegram.org/bots/api-changelog#december-29-2023"""
reply_to_message_id: Optional[int] = Field(None, json_schema_extra={"deprecated": True})
"""If the message is a reply, ID of the original message
.. deprecated:: API:7.0
https://core.telegram.org/bots/api-changelog#december-29-2023"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
chat_id: int,
game_short_name: str,
business_connection_id: Optional[str] = None,
message_thread_id: Optional[int] = None,
disable_notification: Optional[bool] = None,
protect_content: Optional[Union[bool, Default]] = Default("protect_content"),
allow_paid_broadcast: Optional[bool] = None,
message_effect_id: Optional[str] = None,
reply_parameters: Optional[ReplyParameters] = None,
reply_markup: Optional[InlineKeyboardMarkup] = None,
allow_sending_without_reply: Optional[bool] = None,
reply_to_message_id: Optional[int] = None,
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher`
# Is needed only for type checking and IDE support without any additional plugins
super().__init__(
chat_id=chat_id,
game_short_name=game_short_name,
business_connection_id=business_connection_id,
message_thread_id=message_thread_id,
disable_notification=disable_notification,
protect_content=protect_content,
allow_paid_broadcast=allow_paid_broadcast,
message_effect_id=message_effect_id,
reply_parameters=reply_parameters,
reply_markup=reply_markup,
allow_sending_without_reply=allow_sending_without_reply,
reply_to_message_id=reply_to_message_id,
**__pydantic_kwargs,
)

View File

@@ -0,0 +1,64 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional
from ..types import ChatIdUnion
from ..types.message_entity import MessageEntity
from .base import TelegramMethod
class SendGift(TelegramMethod[bool]):
"""
Sends a gift to the given user or channel chat. The gift can't be converted to Telegram Stars by the receiver. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#sendgift
"""
__returning__ = bool
__api_method__ = "sendGift"
gift_id: str
"""Identifier of the gift"""
user_id: Optional[int] = None
"""Required if *chat_id* is not specified. Unique identifier of the target user who will receive the gift."""
chat_id: Optional[ChatIdUnion] = None
"""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."""
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-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__,
*,
gift_id: str,
user_id: Optional[int] = None,
chat_id: Optional[ChatIdUnion] = None,
pay_for_upgrade: Optional[bool] = None,
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__(
gift_id=gift_id,
user_id=user_id,
chat_id=chat_id,
pay_for_upgrade=pay_for_upgrade,
text=text,
text_parse_mode=text_parse_mode,
text_entities=text_entities,
**__pydantic_kwargs,
)

View File

@@ -0,0 +1,176 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union
from pydantic import Field
from ..client.default import Default
from ..types import (
ChatIdUnion,
InlineKeyboardMarkup,
LabeledPrice,
Message,
ReplyParameters,
)
from .base import TelegramMethod
class SendInvoice(TelegramMethod[Message]):
"""
Use this method to send invoices. On success, the sent :class:`aiogram.types.message.Message` is returned.
Source: https://core.telegram.org/bots/api#sendinvoice
"""
__returning__ = Message
__api_method__ = "sendInvoice"
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
title: str
"""Product name, 1-32 characters"""
description: str
"""Product description, 1-255 characters"""
payload: str
"""Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use it for your internal processes."""
currency: str
"""Three-letter ISO 4217 currency code, see `more on currencies <https://core.telegram.org/bots/payments#supported-currencies>`_. Pass 'XTR' for payments in `Telegram Stars <https://t.me/BotNews/90>`_."""
prices: list[LabeledPrice]
"""Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain exactly one item for payments in `Telegram Stars <https://t.me/BotNews/90>`_."""
message_thread_id: Optional[int] = None
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
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>`_."""
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
"""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*."""
start_parameter: Optional[str] = None
"""Unique deep-linking parameter. If left empty, **forwarded copies** of the sent message will have a *Pay* button, allowing multiple users to pay directly from the forwarded message, using the same invoice. If non-empty, forwarded copies of the sent message will have a *URL* button with a deep link to the bot (instead of a *Pay* button), with the value used as the start parameter"""
provider_data: Optional[str] = None
"""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."""
photo_url: Optional[str] = None
"""URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service. People like it better when they see what they are paying for."""
photo_size: Optional[int] = None
"""Photo size in bytes"""
photo_width: Optional[int] = None
"""Photo width"""
photo_height: Optional[int] = None
"""Photo height"""
need_name: Optional[bool] = None
"""Pass :code:`True` if you require the user's full name to complete the order. Ignored for payments in `Telegram Stars <https://t.me/BotNews/90>`_."""
need_phone_number: Optional[bool] = None
"""Pass :code:`True` if you require the user's phone number to complete the order. Ignored for payments in `Telegram Stars <https://t.me/BotNews/90>`_."""
need_email: Optional[bool] = None
"""Pass :code:`True` if you require the user's email address to complete the order. Ignored for payments in `Telegram Stars <https://t.me/BotNews/90>`_."""
need_shipping_address: Optional[bool] = None
"""Pass :code:`True` if you require the user's shipping address to complete the order. Ignored for payments in `Telegram Stars <https://t.me/BotNews/90>`_."""
send_phone_number_to_provider: Optional[bool] = None
"""Pass :code:`True` if the user's phone number should be sent to the provider. Ignored for payments in `Telegram Stars <https://t.me/BotNews/90>`_."""
send_email_to_provider: Optional[bool] = None
"""Pass :code:`True` if the user's email address should be sent to the provider. Ignored for payments in `Telegram Stars <https://t.me/BotNews/90>`_."""
is_flexible: Optional[bool] = None
"""Pass :code:`True` if the final price depends on the shipping method. Ignored for payments in `Telegram Stars <https://t.me/BotNews/90>`_."""
disable_notification: Optional[bool] = None
"""Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
protect_content: Optional[Union[bool, Default]] = Default("protect_content")
"""Protects the contents of the sent message from forwarding and saving"""
allow_paid_broadcast: Optional[bool] = None
"""Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"""
message_effect_id: Optional[str] = None
"""Unique identifier of the message effect to be added to the message; for private chats only"""
reply_parameters: Optional[ReplyParameters] = None
"""Description of the message to reply to"""
reply_markup: Optional[InlineKeyboardMarkup] = None
"""A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_. If empty, one 'Pay :code:`total price`' button will be shown. If not empty, the first button must be a Pay button."""
allow_sending_without_reply: Optional[bool] = Field(
None, json_schema_extra={"deprecated": True}
)
"""Pass :code:`True` if the message should be sent even if the specified replied-to message is not found
.. deprecated:: API:7.0
https://core.telegram.org/bots/api-changelog#december-29-2023"""
reply_to_message_id: Optional[int] = Field(None, json_schema_extra={"deprecated": True})
"""If the message is a reply, ID of the original message
.. deprecated:: API:7.0
https://core.telegram.org/bots/api-changelog#december-29-2023"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
chat_id: ChatIdUnion,
title: str,
description: str,
payload: str,
currency: str,
prices: list[LabeledPrice],
message_thread_id: Optional[int] = None,
provider_token: Optional[str] = None,
max_tip_amount: Optional[int] = None,
suggested_tip_amounts: Optional[list[int]] = None,
start_parameter: Optional[str] = None,
provider_data: Optional[str] = None,
photo_url: Optional[str] = None,
photo_size: Optional[int] = None,
photo_width: Optional[int] = None,
photo_height: Optional[int] = None,
need_name: Optional[bool] = None,
need_phone_number: Optional[bool] = None,
need_email: Optional[bool] = None,
need_shipping_address: Optional[bool] = None,
send_phone_number_to_provider: Optional[bool] = None,
send_email_to_provider: Optional[bool] = None,
is_flexible: Optional[bool] = None,
disable_notification: Optional[bool] = None,
protect_content: Optional[Union[bool, Default]] = Default("protect_content"),
allow_paid_broadcast: Optional[bool] = None,
message_effect_id: Optional[str] = None,
reply_parameters: Optional[ReplyParameters] = None,
reply_markup: Optional[InlineKeyboardMarkup] = None,
allow_sending_without_reply: Optional[bool] = None,
reply_to_message_id: Optional[int] = None,
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher`
# Is needed only for type checking and IDE support without any additional plugins
super().__init__(
chat_id=chat_id,
title=title,
description=description,
payload=payload,
currency=currency,
prices=prices,
message_thread_id=message_thread_id,
provider_token=provider_token,
max_tip_amount=max_tip_amount,
suggested_tip_amounts=suggested_tip_amounts,
start_parameter=start_parameter,
provider_data=provider_data,
photo_url=photo_url,
photo_size=photo_size,
photo_width=photo_width,
photo_height=photo_height,
need_name=need_name,
need_phone_number=need_phone_number,
need_email=need_email,
need_shipping_address=need_shipping_address,
send_phone_number_to_provider=send_phone_number_to_provider,
send_email_to_provider=send_email_to_provider,
is_flexible=is_flexible,
disable_notification=disable_notification,
protect_content=protect_content,
allow_paid_broadcast=allow_paid_broadcast,
message_effect_id=message_effect_id,
reply_parameters=reply_parameters,
reply_markup=reply_markup,
allow_sending_without_reply=allow_sending_without_reply,
reply_to_message_id=reply_to_message_id,
**__pydantic_kwargs,
)

Some files were not shown because too many files have changed in this diff Show More