diff --git a/.butcher/enums/InputPaidMediaType.yml b/.butcher/enums/InputPaidMediaType.yml new file mode 100644 index 00000000..4ca8e5d4 --- /dev/null +++ b/.butcher/enums/InputPaidMediaType.yml @@ -0,0 +1,12 @@ +name: InputPaidMediaType +description: | + This object represents the type of a media in a paid message. + + Source: https://core.telegram.org/bots/api#inputpaidmedia +multi_parse: + format: rst + attribute: type + regexp: '\*([a-z_]+)\*' + entities: + - InputPaidMediaPhoto + - InputPaidMediaVideo diff --git a/.butcher/enums/PaidMediaType.yml b/.butcher/enums/PaidMediaType.yml new file mode 100644 index 00000000..acbf8176 --- /dev/null +++ b/.butcher/enums/PaidMediaType.yml @@ -0,0 +1,13 @@ +name: PaidMediaType +description: | + This object represents the type of a media in a paid message. + + Source: https://core.telegram.org/bots/api#paidmedia +multi_parse: + format: rst + attribute: type + regexp: "'([a-z]+)'" + entities: + - PaidMediaPhoto + - PaidMediaPreview + - PaidMediaVideo diff --git a/.butcher/enums/TransactionPartnerType.yml b/.butcher/enums/TransactionPartnerType.yml index 55241c72..5e52ef79 100644 --- a/.butcher/enums/TransactionPartnerType.yml +++ b/.butcher/enums/TransactionPartnerType.yml @@ -10,3 +10,4 @@ multi_parse: - TransactionPartnerFragment - TransactionPartnerOther - TransactionPartnerUser + - TransactionPartnerTelegramAds diff --git a/.butcher/methods/copyMessage/entity.json b/.butcher/methods/copyMessage/entity.json index b9efc617..72ddbc3c 100644 --- a/.butcher/methods/copyMessage/entity.json +++ b/.butcher/methods/copyMessage/entity.json @@ -7,9 +7,9 @@ "object": { "anchor": "copymessage", "name": "copyMessage", - "description": "Use this method to copy messages of any kind. Service messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied. A quiz 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 forwardMessage, but the copied message doesn't have a link to the original message. Returns the MessageId of the sent message on success.", - "html_description": "

Use this method to copy messages of any kind. Service messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied. A quiz 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 forwardMessage, but the copied message doesn't have a link to the original message. Returns the MessageId of the sent message on success.

", - "rst_description": "Use this method to copy messages of any kind. Service 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.", + "description": "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 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 forwardMessage, but the copied message doesn't have a link to the original message. Returns the MessageId of the sent message on success.", + "html_description": "

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 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 forwardMessage, but the copied message doesn't have a link to the original message. Returns the MessageId of the sent message on success.

", + "rst_description": "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.", "annotations": [ { "type": "Integer or String", diff --git a/.butcher/methods/copyMessages/entity.json b/.butcher/methods/copyMessages/entity.json index dd531360..2d7340fe 100644 --- a/.butcher/methods/copyMessages/entity.json +++ b/.butcher/methods/copyMessages/entity.json @@ -7,9 +7,9 @@ "object": { "anchor": "copymessages", "name": "copyMessages", - "description": "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, giveaway messages, giveaway winners messages, and invoice messages can't be copied. A quiz 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 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 MessageId of the sent messages is returned.", - "html_description": "

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, giveaway messages, giveaway winners messages, and invoice messages can't be copied. A quiz 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 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 MessageId of the sent messages is returned.

", - "rst_description": "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, 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.", + "description": "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 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 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 MessageId of the sent messages is returned.", + "html_description": "

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 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 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 MessageId of the sent messages is returned.

", + "rst_description": "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.", "annotations": [ { "type": "Integer or String", diff --git a/.butcher/methods/sendPaidMedia/entity.json b/.butcher/methods/sendPaidMedia/entity.json new file mode 100644 index 00000000..4031c0ff --- /dev/null +++ b/.butcher/methods/sendPaidMedia/entity.json @@ -0,0 +1,105 @@ +{ + "meta": {}, + "group": { + "title": "Available methods", + "anchor": "available-methods" + }, + "object": { + "anchor": "sendpaidmedia", + "name": "sendPaidMedia", + "description": "Use this method to send paid media to channel chats. On success, the sent Message is returned.", + "html_description": "

Use this method to send paid media to channel chats. On success, the sent Message is returned.

", + "rst_description": "Use this method to send paid media to channel chats. On success, the sent :class:`aiogram.types.message.Message` is returned.", + "annotations": [ + { + "type": "Integer or String", + "required": true, + "description": "Unique identifier for the target chat or username of the target channel (in the format @channelusername)", + "html_description": "Unique identifier for the target chat or username of the target channel (in the format @channelusername)", + "rst_description": "Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)\n", + "name": "chat_id" + }, + { + "type": "Integer", + "required": true, + "description": "The number of Telegram Stars that must be paid to buy access to the media", + "html_description": "The number of Telegram Stars that must be paid to buy access to the media", + "rst_description": "The number of Telegram Stars that must be paid to buy access to the media\n", + "name": "star_count" + }, + { + "type": "Array of InputPaidMedia", + "required": true, + "description": "A JSON-serialized array describing the media to be sent; up to 10 items", + "html_description": "A JSON-serialized array describing the media to be sent; up to 10 items", + "rst_description": "A JSON-serialized array describing the media to be sent; up to 10 items\n", + "name": "media" + }, + { + "type": "String", + "required": false, + "description": "Media caption, 0-1024 characters after entities parsing", + "html_description": "Media caption, 0-1024 characters after entities parsing", + "rst_description": "Media caption, 0-1024 characters after entities parsing\n", + "name": "caption" + }, + { + "type": "String", + "required": false, + "description": "Mode for parsing entities in the media caption. See formatting options for more details.", + "html_description": "Mode for parsing entities in the media caption. See formatting options for more details.", + "rst_description": "Mode for parsing entities in the media caption. See `formatting options `_ for more details.\n", + "name": "parse_mode" + }, + { + "type": "Array of MessageEntity", + "required": false, + "description": "A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode", + "html_description": "A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode", + "rst_description": "A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*\n", + "name": "caption_entities" + }, + { + "type": "Boolean", + "required": false, + "description": "Pass True, if the caption must be shown above the message media", + "html_description": "Pass True, if the caption must be shown above the message media", + "rst_description": "Pass :code:`True`, if the caption must be shown above the message media\n", + "name": "show_caption_above_media" + }, + { + "type": "Boolean", + "required": false, + "description": "Sends the message silently. Users will receive a notification with no sound.", + "html_description": "Sends the message silently. Users will receive a notification with no sound.", + "rst_description": "Sends the message `silently `_. Users will receive a notification with no sound.\n", + "name": "disable_notification" + }, + { + "type": "Boolean", + "required": false, + "description": "Protects the contents of the sent message from forwarding and saving", + "html_description": "Protects the contents of the sent message from forwarding and saving", + "rst_description": "Protects the contents of the sent message from forwarding and saving\n", + "name": "protect_content" + }, + { + "type": "ReplyParameters", + "required": false, + "description": "Description of the message to reply to", + "html_description": "Description of the message to reply to", + "rst_description": "Description of the message to reply to\n", + "name": "reply_parameters" + }, + { + "type": "InlineKeyboardMarkup or ReplyKeyboardMarkup or ReplyKeyboardRemove or ForceReply", + "required": false, + "description": "Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user", + "html_description": "Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user", + "rst_description": "Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove a reply keyboard or to force a reply from the user\n", + "name": "reply_markup" + } + ], + "category": "methods" + } +} diff --git a/.butcher/schema/schema.json b/.butcher/schema/schema.json index b0db2bc6..11b2712c 100644 --- a/.butcher/schema/schema.json +++ b/.butcher/schema/schema.json @@ -1,7 +1,7 @@ { "api": { - "version": "7.5", - "release_date": "2024-06-18" + "version": "7.6", + "release_date": "2024-07-01" }, "items": [ { @@ -853,6 +853,14 @@ "name": "permissions", "required": false }, + { + "type": "True", + "description": "True, if paid media messages can be sent or forwarded to the channel chat. The field is available only for channel chats.", + "html_description": "Optional. True, if paid media messages can be sent or forwarded to the channel chat. The field is available only for channel chats.", + "rst_description": "*Optional*. :code:`True`, if paid media messages can be sent or forwarded to the channel chat. The field is available only for channel chats.\n", + "name": "can_send_paid_media", + "required": false + }, { "type": "Integer", "description": "For supergroups, the minimum allowed delay between consecutive messages sent by each unprivileged user; in seconds", @@ -1191,6 +1199,14 @@ "name": "document", "required": false }, + { + "type": "PaidMediaInfo", + "description": "Message contains paid media; information about the paid media", + "html_description": "Optional. Message contains paid media; information about the paid media", + "rst_description": "*Optional*. Message contains paid media; information about the paid media\n", + "name": "paid_media", + "required": false + }, { "type": "Array of PhotoSize", "description": "Message is a photo, available sizes of the photo", @@ -1241,9 +1257,9 @@ }, { "type": "String", - "description": "Caption for the animation, audio, document, photo, video or voice", - "html_description": "Optional. Caption for the animation, audio, document, photo, video or voice", - "rst_description": "*Optional*. Caption for the animation, audio, document, photo, video or voice\n", + "description": "Caption for the animation, audio, document, paid media, photo, video or voice", + "html_description": "Optional. Caption for the animation, audio, document, paid media, photo, video or voice", + "rst_description": "*Optional*. Caption for the animation, audio, document, paid media, photo, video or voice\n", "name": "caption", "required": false }, @@ -1858,6 +1874,14 @@ "name": "document", "required": false }, + { + "type": "PaidMediaInfo", + "description": "Message contains paid media; information about the paid media", + "html_description": "Optional. Message contains paid media; information about the paid media", + "rst_description": "*Optional*. Message contains paid media; information about the paid media\n", + "name": "paid_media", + "required": false + }, { "type": "Array of PhotoSize", "description": "Message is a photo, available sizes of the photo", @@ -2299,49 +2323,49 @@ }, { "type": "Integer", - "description": "Video width as defined by sender", - "html_description": "Video width as defined by sender", - "rst_description": "Video width as defined by sender\n", + "description": "Video width as defined by the sender", + "html_description": "Video width as defined by the sender", + "rst_description": "Video width as defined by the sender\n", "name": "width", "required": true }, { "type": "Integer", - "description": "Video height as defined by sender", - "html_description": "Video height as defined by sender", - "rst_description": "Video height as defined by sender\n", + "description": "Video height as defined by the sender", + "html_description": "Video height as defined by the sender", + "rst_description": "Video height as defined by the sender\n", "name": "height", "required": true }, { "type": "Integer", - "description": "Duration of the video in seconds as defined by sender", - "html_description": "Duration of the video in seconds as defined by sender", - "rst_description": "Duration of the video in seconds as defined by sender\n", + "description": "Duration of the video in seconds as defined by the sender", + "html_description": "Duration of the video in seconds as defined by the sender", + "rst_description": "Duration of the video in seconds as defined by the sender\n", "name": "duration", "required": true }, { "type": "PhotoSize", - "description": "Animation thumbnail as defined by sender", - "html_description": "Optional. Animation thumbnail as defined by sender", - "rst_description": "*Optional*. Animation thumbnail as defined by sender\n", + "description": "Animation thumbnail as defined by the sender", + "html_description": "Optional. Animation thumbnail as defined by the sender", + "rst_description": "*Optional*. Animation thumbnail as defined by the sender\n", "name": "thumbnail", "required": false }, { "type": "String", - "description": "Original animation filename as defined by sender", - "html_description": "Optional. Original animation filename as defined by sender", - "rst_description": "*Optional*. Original animation filename as defined by sender\n", + "description": "Original animation filename as defined by the sender", + "html_description": "Optional. Original animation filename as defined by the sender", + "rst_description": "*Optional*. Original animation filename as defined by the sender\n", "name": "file_name", "required": false }, { "type": "String", - "description": "MIME type of the file as defined by sender", - "html_description": "Optional. MIME type of the file as defined by sender", - "rst_description": "*Optional*. MIME type of the file as defined by sender\n", + "description": "MIME type of the file as defined by the sender", + "html_description": "Optional. MIME type of the file as defined by the sender", + "rst_description": "*Optional*. MIME type of the file as defined by the sender\n", "name": "mime_type", "required": false }, @@ -2381,41 +2405,41 @@ }, { "type": "Integer", - "description": "Duration of the audio in seconds as defined by sender", - "html_description": "Duration of the audio in seconds as defined by sender", - "rst_description": "Duration of the audio in seconds as defined by sender\n", + "description": "Duration of the audio in seconds as defined by the sender", + "html_description": "Duration of the audio in seconds as defined by the sender", + "rst_description": "Duration of the audio in seconds as defined by the sender\n", "name": "duration", "required": true }, { "type": "String", - "description": "Performer of the audio as defined by sender or by audio tags", - "html_description": "Optional. Performer of the audio as defined by sender or by audio tags", - "rst_description": "*Optional*. Performer of the audio as defined by sender or by audio tags\n", + "description": "Performer of the audio as defined by the sender or by audio tags", + "html_description": "Optional. Performer of the audio as defined by the sender or by audio tags", + "rst_description": "*Optional*. Performer of the audio as defined by the sender or by audio tags\n", "name": "performer", "required": false }, { "type": "String", - "description": "Title of the audio as defined by sender or by audio tags", - "html_description": "Optional. Title of the audio as defined by sender or by audio tags", - "rst_description": "*Optional*. Title of the audio as defined by sender or by audio tags\n", + "description": "Title of the audio as defined by the sender or by audio tags", + "html_description": "Optional. Title of the audio as defined by the sender or by audio tags", + "rst_description": "*Optional*. Title of the audio as defined by the sender or by audio tags\n", "name": "title", "required": false }, { "type": "String", - "description": "Original filename as defined by sender", - "html_description": "Optional. Original filename as defined by sender", - "rst_description": "*Optional*. Original filename as defined by sender\n", + "description": "Original filename as defined by the sender", + "html_description": "Optional. Original filename as defined by the sender", + "rst_description": "*Optional*. Original filename as defined by the sender\n", "name": "file_name", "required": false }, { "type": "String", - "description": "MIME type of the file as defined by sender", - "html_description": "Optional. MIME type of the file as defined by sender", - "rst_description": "*Optional*. MIME type of the file as defined by sender\n", + "description": "MIME type of the file as defined by the sender", + "html_description": "Optional. MIME type of the file as defined by the sender", + "rst_description": "*Optional*. MIME type of the file as defined by the sender\n", "name": "mime_type", "required": false }, @@ -2463,25 +2487,25 @@ }, { "type": "PhotoSize", - "description": "Document thumbnail as defined by sender", - "html_description": "Optional. Document thumbnail as defined by sender", - "rst_description": "*Optional*. Document thumbnail as defined by sender\n", + "description": "Document thumbnail as defined by the sender", + "html_description": "Optional. Document thumbnail as defined by the sender", + "rst_description": "*Optional*. Document thumbnail as defined by the sender\n", "name": "thumbnail", "required": false }, { "type": "String", - "description": "Original filename as defined by sender", - "html_description": "Optional. Original filename as defined by sender", - "rst_description": "*Optional*. Original filename as defined by sender\n", + "description": "Original filename as defined by the sender", + "html_description": "Optional. Original filename as defined by the sender", + "rst_description": "*Optional*. Original filename as defined by the sender\n", "name": "file_name", "required": false }, { "type": "String", - "description": "MIME type of the file as defined by sender", - "html_description": "Optional. MIME type of the file as defined by sender", - "rst_description": "*Optional*. MIME type of the file as defined by sender\n", + "description": "MIME type of the file as defined by the sender", + "html_description": "Optional. MIME type of the file as defined by the sender", + "rst_description": "*Optional*. MIME type of the file as defined by the sender\n", "name": "mime_type", "required": false }, @@ -2547,25 +2571,25 @@ }, { "type": "Integer", - "description": "Video width as defined by sender", - "html_description": "Video width as defined by sender", - "rst_description": "Video width as defined by sender\n", + "description": "Video width as defined by the sender", + "html_description": "Video width as defined by the sender", + "rst_description": "Video width as defined by the sender\n", "name": "width", "required": true }, { "type": "Integer", - "description": "Video height as defined by sender", - "html_description": "Video height as defined by sender", - "rst_description": "Video height as defined by sender\n", + "description": "Video height as defined by the sender", + "html_description": "Video height as defined by the sender", + "rst_description": "Video height as defined by the sender\n", "name": "height", "required": true }, { "type": "Integer", - "description": "Duration of the video in seconds as defined by sender", - "html_description": "Duration of the video in seconds as defined by sender", - "rst_description": "Duration of the video in seconds as defined by sender\n", + "description": "Duration of the video in seconds as defined by the sender", + "html_description": "Duration of the video in seconds as defined by the sender", + "rst_description": "Duration of the video in seconds as defined by the sender\n", "name": "duration", "required": true }, @@ -2579,17 +2603,17 @@ }, { "type": "String", - "description": "Original filename as defined by sender", - "html_description": "Optional. Original filename as defined by sender", - "rst_description": "*Optional*. Original filename as defined by sender\n", + "description": "Original filename as defined by the sender", + "html_description": "Optional. Original filename as defined by the sender", + "rst_description": "*Optional*. Original filename as defined by the sender\n", "name": "file_name", "required": false }, { "type": "String", - "description": "MIME type of the file as defined by sender", - "html_description": "Optional. MIME type of the file as defined by sender", - "rst_description": "*Optional*. MIME type of the file as defined by sender\n", + "description": "MIME type of the file as defined by the sender", + "html_description": "Optional. MIME type of the file as defined by the sender", + "rst_description": "*Optional*. MIME type of the file as defined by the sender\n", "name": "mime_type", "required": false }, @@ -2629,17 +2653,17 @@ }, { "type": "Integer", - "description": "Video width and height (diameter of the video message) as defined by sender", - "html_description": "Video width and height (diameter of the video message) as defined by sender", - "rst_description": "Video width and height (diameter of the video message) as defined by sender\n", + "description": "Video width and height (diameter of the video message) as defined by the sender", + "html_description": "Video width and height (diameter of the video message) as defined by the sender", + "rst_description": "Video width and height (diameter of the video message) as defined by the sender\n", "name": "length", "required": true }, { "type": "Integer", - "description": "Duration of the video in seconds as defined by sender", - "html_description": "Duration of the video in seconds as defined by sender", - "rst_description": "Duration of the video in seconds as defined by sender\n", + "description": "Duration of the video in seconds as defined by the sender", + "html_description": "Duration of the video in seconds as defined by the sender", + "rst_description": "Duration of the video in seconds as defined by the sender\n", "name": "duration", "required": true }, @@ -2687,17 +2711,17 @@ }, { "type": "Integer", - "description": "Duration of the audio in seconds as defined by sender", - "html_description": "Duration of the audio in seconds as defined by sender", - "rst_description": "Duration of the audio in seconds as defined by sender\n", + "description": "Duration of the audio in seconds as defined by the sender", + "html_description": "Duration of the audio in seconds as defined by the sender", + "rst_description": "Duration of the audio in seconds as defined by the sender\n", "name": "duration", "required": true }, { "type": "String", - "description": "MIME type of the file as defined by sender", - "html_description": "Optional. MIME type of the file as defined by sender", - "rst_description": "*Optional*. MIME type of the file as defined by sender\n", + "description": "MIME type of the file as defined by the sender", + "html_description": "Optional. MIME type of the file as defined by the sender", + "rst_description": "*Optional*. MIME type of the file as defined by the sender\n", "name": "mime_type", "required": false }, @@ -2712,6 +2736,135 @@ ], "category": "types" }, + { + "anchor": "paidmediainfo", + "name": "PaidMediaInfo", + "description": "Describes the paid media added to a message.", + "html_description": "

Describes the paid media added to a message.

", + "rst_description": "Describes the paid media added to a message.", + "annotations": [ + { + "type": "Integer", + "description": "The number of Telegram Stars that must be paid to buy access to the media", + "html_description": "The number of Telegram Stars that must be paid to buy access to the media", + "rst_description": "The number of Telegram Stars that must be paid to buy access to the media\n", + "name": "star_count", + "required": true + }, + { + "type": "Array of PaidMedia", + "description": "Information about the paid media", + "html_description": "Information about the paid media", + "rst_description": "Information about the paid media\n", + "name": "paid_media", + "required": true + } + ], + "category": "types" + }, + { + "anchor": "paidmedia", + "name": "PaidMedia", + "description": "This object describes paid media. Currently, it can be one of\n - PaidMediaPreview\n - PaidMediaPhoto\n - PaidMediaVideo", + "html_description": "

This object describes paid media. Currently, it can be one of

", + "rst_description": "This object describes paid media. Currently, it can be one of\n\n - :class:`aiogram.types.paid_media_preview.PaidMediaPreview`\n - :class:`aiogram.types.paid_media_photo.PaidMediaPhoto`\n - :class:`aiogram.types.paid_media_video.PaidMediaVideo`", + "annotations": [], + "category": "types" + }, + { + "anchor": "paidmediapreview", + "name": "PaidMediaPreview", + "description": "The paid media isn't available before the payment.", + "html_description": "

The paid media isn't available before the payment.

", + "rst_description": "The paid media isn't available before the payment.", + "annotations": [ + { + "type": "String", + "description": "Type of the paid media, always 'preview'", + "html_description": "Type of the paid media, always “preview”", + "rst_description": "Type of the paid media, always 'preview'\n", + "name": "type", + "required": true + }, + { + "type": "Integer", + "description": "Media width as defined by the sender", + "html_description": "Optional. Media width as defined by the sender", + "rst_description": "*Optional*. Media width as defined by the sender\n", + "name": "width", + "required": false + }, + { + "type": "Integer", + "description": "Media height as defined by the sender", + "html_description": "Optional. Media height as defined by the sender", + "rst_description": "*Optional*. Media height as defined by the sender\n", + "name": "height", + "required": false + }, + { + "type": "Integer", + "description": "Duration of the media in seconds as defined by the sender", + "html_description": "Optional. Duration of the media in seconds as defined by the sender", + "rst_description": "*Optional*. Duration of the media in seconds as defined by the sender\n", + "name": "duration", + "required": false + } + ], + "category": "types" + }, + { + "anchor": "paidmediaphoto", + "name": "PaidMediaPhoto", + "description": "The paid media is a photo.", + "html_description": "

The paid media is a photo.

", + "rst_description": "The paid media is a photo.", + "annotations": [ + { + "type": "String", + "description": "Type of the paid media, always 'photo'", + "html_description": "Type of the paid media, always “photo”", + "rst_description": "Type of the paid media, always 'photo'\n", + "name": "type", + "required": true + }, + { + "type": "Array of PhotoSize", + "description": "The photo", + "html_description": "The photo", + "rst_description": "The photo\n", + "name": "photo", + "required": true + } + ], + "category": "types" + }, + { + "anchor": "paidmediavideo", + "name": "PaidMediaVideo", + "description": "The paid media is a video.", + "html_description": "

The paid media is a video.

", + "rst_description": "The paid media is a video.", + "annotations": [ + { + "type": "String", + "description": "Type of the paid media, always 'video'", + "html_description": "Type of the paid media, always “video”", + "rst_description": "Type of the paid media, always 'video'\n", + "name": "type", + "required": true + }, + { + "type": "Video", + "description": "The video", + "html_description": "The video", + "rst_description": "The video\n", + "name": "video", + "required": true + } + ], + "category": "types" + }, { "anchor": "contact", "name": "Contact", @@ -2825,9 +2978,9 @@ { "anchor": "inputpolloption", "name": "InputPollOption", - "description": "This object contains information about one answer option in a poll to send.", - "html_description": "

This object contains information about one answer option in a poll to send.

", - "rst_description": "This object contains information about one answer option in a poll to send.", + "description": "This object contains information about one answer option in a poll to be sent.", + "html_description": "

This object contains information about one answer option in a poll to be sent.

", + "rst_description": "This object contains information about one answer option in a poll to be sent.", "annotations": [ { "type": "String", @@ -3029,17 +3182,17 @@ "annotations": [ { "type": "Float", - "description": "Latitude as defined by sender", - "html_description": "Latitude as defined by sender", - "rst_description": "Latitude as defined by sender\n", + "description": "Latitude as defined by the sender", + "html_description": "Latitude as defined by the sender", + "rst_description": "Latitude as defined by the sender\n", "name": "latitude", "required": true }, { "type": "Float", - "description": "Longitude as defined by sender", - "html_description": "Longitude as defined by sender", - "rst_description": "Longitude as defined by sender\n", + "description": "Longitude as defined by the sender", + "html_description": "Longitude as defined by the sender", + "rst_description": "Longitude as defined by the sender\n", "name": "longitude", "required": true }, @@ -6509,9 +6662,9 @@ }, { "type": "WebAppInfo", - "description": "Description of the Web App that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the method answerWebAppQuery.", - "html_description": "Description of the Web App that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the method answerWebAppQuery.", - "rst_description": "Description of the Web App that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the method :class:`aiogram.methods.answer_web_app_query.AnswerWebAppQuery`.\n", + "description": "Description of the Web App that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the method answerWebAppQuery. Alternatively, a t.me link to a Web App of the bot can be specified in the object instead of the Web App's URL, in which case the Web App will be opened as if the user pressed the link.", + "html_description": "Description of the Web App that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the method answerWebAppQuery. Alternatively, a t.me link to a Web App of the bot can be specified in the object instead of the Web App's URL, in which case the Web App will be opened as if the user pressed the link.", + "rst_description": "Description of the Web App that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the method :class:`aiogram.methods.answer_web_app_query.AnswerWebAppQuery`. Alternatively, a :code:`t.me` link to a Web App of the bot can be specified in the object instead of the Web App's URL, in which case the Web App will be opened as if the user pressed the link.\n", "name": "web_app", "required": true } @@ -7320,6 +7473,107 @@ "rst_description": "This object represents the contents of a file to be uploaded. Must be posted using multipart/form-data in the usual way that files are uploaded via the browser.", "annotations": [], "category": "types" + }, + { + "anchor": "inputpaidmedia", + "name": "InputPaidMedia", + "description": "This object describes the paid media to be sent. Currently, it can be one of\n - InputPaidMediaPhoto\n - InputPaidMediaVideo", + "html_description": "

This object describes the paid media to be sent. Currently, it can be one of

", + "rst_description": "This object describes the paid media to be sent. Currently, it can be one of\n\n - :class:`aiogram.types.input_paid_media_photo.InputPaidMediaPhoto`\n - :class:`aiogram.types.input_paid_media_video.InputPaidMediaVideo`", + "annotations": [], + "category": "types" + }, + { + "anchor": "inputpaidmediaphoto", + "name": "InputPaidMediaPhoto", + "description": "The paid media to send is a photo.", + "html_description": "

The paid media to send is a photo.

", + "rst_description": "The paid media to send is a photo.", + "annotations": [ + { + "type": "String", + "description": "Type of the media, must be photo", + "html_description": "Type of the media, must be photo", + "rst_description": "Type of the media, must be *photo*\n", + "name": "type", + "required": true + }, + { + "type": "String", + "description": "File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass 'attach://' to upload a new one using multipart/form-data under name. More information on Sending Files", + "html_description": "File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name. More information on Sending Files »", + "rst_description": "File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass 'attach://' to upload a new one using multipart/form-data under name. :ref:`More information on Sending Files » `\n", + "name": "media", + "required": true + } + ], + "category": "types" + }, + { + "anchor": "inputpaidmediavideo", + "name": "InputPaidMediaVideo", + "description": "The paid media to send is a video.", + "html_description": "

The paid media to send is a video.

", + "rst_description": "The paid media to send is a video.", + "annotations": [ + { + "type": "String", + "description": "Type of the media, must be video", + "html_description": "Type of the media, must be video", + "rst_description": "Type of the media, must be *video*\n", + "name": "type", + "required": true + }, + { + "type": "String", + "description": "File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass 'attach://' to upload a new one using multipart/form-data under name. More information on Sending Files", + "html_description": "File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name. More information on Sending Files »", + "rst_description": "File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass 'attach://' to upload a new one using multipart/form-data under name. :ref:`More information on Sending Files » `\n", + "name": "media", + "required": true + }, + { + "type": "InputFile or String", + "description": "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://' if the thumbnail was uploaded using multipart/form-data under . More information on Sending Files", + "html_description": "Optional. 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>. More information on Sending Files »", + "rst_description": "*Optional*. 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://' if the thumbnail was uploaded using multipart/form-data under . :ref:`More information on Sending Files » `\n", + "name": "thumbnail", + "required": false + }, + { + "type": "Integer", + "description": "Video width", + "html_description": "Optional. Video width", + "rst_description": "*Optional*. Video width\n", + "name": "width", + "required": false + }, + { + "type": "Integer", + "description": "Video height", + "html_description": "Optional. Video height", + "rst_description": "*Optional*. Video height\n", + "name": "height", + "required": false + }, + { + "type": "Integer", + "description": "Video duration in seconds", + "html_description": "Optional. Video duration in seconds", + "rst_description": "*Optional*. Video duration in seconds\n", + "name": "duration", + "required": false + }, + { + "type": "Boolean", + "description": "Pass True if the uploaded video is suitable for streaming", + "html_description": "Optional. Pass True if the uploaded video is suitable for streaming", + "rst_description": "*Optional*. Pass :code:`True` if the uploaded video is suitable for streaming\n", + "name": "supports_streaming", + "required": false + } + ], + "category": "types" } ], "description": "All types used in the Bot API responses are represented as JSON-objects.\nIt is safe to use 32-bit signed integers for storing all Integer fields unless otherwise noted.\nOptional fields may be not returned when irrelevant." @@ -7580,9 +7834,9 @@ { "anchor": "copymessage", "name": "copyMessage", - "description": "Use this method to copy messages of any kind. Service messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied. A quiz 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 forwardMessage, but the copied message doesn't have a link to the original message. Returns the MessageId of the sent message on success.", - "html_description": "

Use this method to copy messages of any kind. Service messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied. A quiz 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 forwardMessage, but the copied message doesn't have a link to the original message. Returns the MessageId of the sent message on success.

", - "rst_description": "Use this method to copy messages of any kind. Service 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.", + "description": "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 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 forwardMessage, but the copied message doesn't have a link to the original message. Returns the MessageId of the sent message on success.", + "html_description": "

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 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 forwardMessage, but the copied message doesn't have a link to the original message. Returns the MessageId of the sent message on success.

", + "rst_description": "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.", "annotations": [ { "type": "Integer or String", @@ -7686,9 +7940,9 @@ { "anchor": "copymessages", "name": "copyMessages", - "description": "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, giveaway messages, giveaway winners messages, and invoice messages can't be copied. A quiz 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 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 MessageId of the sent messages is returned.", - "html_description": "

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, giveaway messages, giveaway winners messages, and invoice messages can't be copied. A quiz 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 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 MessageId of the sent messages is returned.

", - "rst_description": "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, 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.", + "description": "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 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 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 MessageId of the sent messages is returned.", + "html_description": "

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 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 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 MessageId of the sent messages is returned.

", + "rst_description": "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.", "annotations": [ { "type": "Integer or String", @@ -8667,6 +8921,104 @@ ], "category": "methods" }, + { + "anchor": "sendpaidmedia", + "name": "sendPaidMedia", + "description": "Use this method to send paid media to channel chats. On success, the sent Message is returned.", + "html_description": "

Use this method to send paid media to channel chats. On success, the sent Message is returned.

", + "rst_description": "Use this method to send paid media to channel chats. On success, the sent :class:`aiogram.types.message.Message` is returned.", + "annotations": [ + { + "type": "Integer or String", + "required": true, + "description": "Unique identifier for the target chat or username of the target channel (in the format @channelusername)", + "html_description": "Unique identifier for the target chat or username of the target channel (in the format @channelusername)", + "rst_description": "Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)\n", + "name": "chat_id" + }, + { + "type": "Integer", + "required": true, + "description": "The number of Telegram Stars that must be paid to buy access to the media", + "html_description": "The number of Telegram Stars that must be paid to buy access to the media", + "rst_description": "The number of Telegram Stars that must be paid to buy access to the media\n", + "name": "star_count" + }, + { + "type": "Array of InputPaidMedia", + "required": true, + "description": "A JSON-serialized array describing the media to be sent; up to 10 items", + "html_description": "A JSON-serialized array describing the media to be sent; up to 10 items", + "rst_description": "A JSON-serialized array describing the media to be sent; up to 10 items\n", + "name": "media" + }, + { + "type": "String", + "required": false, + "description": "Media caption, 0-1024 characters after entities parsing", + "html_description": "Media caption, 0-1024 characters after entities parsing", + "rst_description": "Media caption, 0-1024 characters after entities parsing\n", + "name": "caption" + }, + { + "type": "String", + "required": false, + "description": "Mode for parsing entities in the media caption. See formatting options for more details.", + "html_description": "Mode for parsing entities in the media caption. See formatting options for more details.", + "rst_description": "Mode for parsing entities in the media caption. See `formatting options `_ for more details.\n", + "name": "parse_mode" + }, + { + "type": "Array of MessageEntity", + "required": false, + "description": "A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode", + "html_description": "A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode", + "rst_description": "A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*\n", + "name": "caption_entities" + }, + { + "type": "Boolean", + "required": false, + "description": "Pass True, if the caption must be shown above the message media", + "html_description": "Pass True, if the caption must be shown above the message media", + "rst_description": "Pass :code:`True`, if the caption must be shown above the message media\n", + "name": "show_caption_above_media" + }, + { + "type": "Boolean", + "required": false, + "description": "Sends the message silently. Users will receive a notification with no sound.", + "html_description": "Sends the message silently. Users will receive a notification with no sound.", + "rst_description": "Sends the message `silently `_. Users will receive a notification with no sound.\n", + "name": "disable_notification" + }, + { + "type": "Boolean", + "required": false, + "description": "Protects the contents of the sent message from forwarding and saving", + "html_description": "Protects the contents of the sent message from forwarding and saving", + "rst_description": "Protects the contents of the sent message from forwarding and saving\n", + "name": "protect_content" + }, + { + "type": "ReplyParameters", + "required": false, + "description": "Description of the message to reply to", + "html_description": "Description of the message to reply to", + "rst_description": "Description of the message to reply to\n", + "name": "reply_parameters" + }, + { + "type": "InlineKeyboardMarkup or ReplyKeyboardMarkup or ReplyKeyboardRemove or ForceReply", + "required": false, + "description": "Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user", + "html_description": "Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user", + "rst_description": "Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove a reply keyboard or to force a reply from the user\n", + "name": "reply_markup" + } + ], + "category": "methods" + }, { "anchor": "sendmediagroup", "name": "sendMediaGroup", @@ -15885,9 +16237,9 @@ }, { "type": "String", - "description": "Bot specified invoice payload", - "html_description": "Bot specified invoice payload", - "rst_description": "Bot specified invoice payload\n", + "description": "Bot-specified invoice payload", + "html_description": "Bot-specified invoice payload", + "rst_description": "Bot-specified invoice payload\n", "name": "invoice_payload", "required": true }, @@ -15951,9 +16303,9 @@ }, { "type": "String", - "description": "Bot specified invoice payload", - "html_description": "Bot specified invoice payload", - "rst_description": "Bot specified invoice payload\n", + "description": "Bot-specified invoice payload", + "html_description": "Bot-specified invoice payload", + "rst_description": "Bot-specified invoice payload\n", "name": "invoice_payload", "required": true }, @@ -16009,9 +16361,9 @@ }, { "type": "String", - "description": "Bot specified invoice payload", - "html_description": "Bot specified invoice payload", - "rst_description": "Bot specified invoice payload\n", + "description": "Bot-specified invoice payload", + "html_description": "Bot-specified invoice payload", + "rst_description": "Bot-specified invoice payload\n", "name": "invoice_payload", "required": true }, @@ -16116,12 +16468,46 @@ { "anchor": "transactionpartner", "name": "TransactionPartner", - "description": "This object describes the source of a transaction, or its recipient for outgoing transactions. Currently, it can be one of\n - TransactionPartnerFragment\n - TransactionPartnerUser\n - TransactionPartnerOther", - "html_description": "

This object describes the source of a transaction, or its recipient for outgoing transactions. Currently, it can be one of

", - "rst_description": "This object describes the source of a transaction, or its recipient for outgoing transactions. Currently, it can be one of\n\n - :class:`aiogram.types.transaction_partner_fragment.TransactionPartnerFragment`\n - :class:`aiogram.types.transaction_partner_user.TransactionPartnerUser`\n - :class:`aiogram.types.transaction_partner_other.TransactionPartnerOther`", + "description": "This object describes the source of a transaction, or its recipient for outgoing transactions. Currently, it can be one of\n - TransactionPartnerUser\n - TransactionPartnerFragment\n - TransactionPartnerTelegramAds\n - TransactionPartnerOther", + "html_description": "

This object describes the source of a transaction, or its recipient for outgoing transactions. Currently, it can be one of

", + "rst_description": "This object describes the source of a transaction, or its recipient for outgoing transactions. Currently, it can be one of\n\n - :class:`aiogram.types.transaction_partner_user.TransactionPartnerUser`\n - :class:`aiogram.types.transaction_partner_fragment.TransactionPartnerFragment`\n - :class:`aiogram.types.transaction_partner_telegram_ads.TransactionPartnerTelegramAds`\n - :class:`aiogram.types.transaction_partner_other.TransactionPartnerOther`", "annotations": [], "category": "types" }, + { + "anchor": "transactionpartneruser", + "name": "TransactionPartnerUser", + "description": "Describes a transaction with a user.", + "html_description": "

Describes a transaction with a user.

", + "rst_description": "Describes a transaction with a user.", + "annotations": [ + { + "type": "String", + "description": "Type of the transaction partner, always 'user'", + "html_description": "Type of the transaction partner, always “user”", + "rst_description": "Type of the transaction partner, always 'user'\n", + "name": "type", + "required": true + }, + { + "type": "User", + "description": "Information about the user", + "html_description": "Information about the user", + "rst_description": "Information about the user\n", + "name": "user", + "required": true + }, + { + "type": "String", + "description": "Bot-specified invoice payload", + "html_description": "Optional. Bot-specified invoice payload", + "rst_description": "*Optional*. Bot-specified invoice payload\n", + "name": "invoice_payload", + "required": false + } + ], + "category": "types" + }, { "anchor": "transactionpartnerfragment", "name": "TransactionPartnerFragment", @@ -16149,27 +16535,19 @@ "category": "types" }, { - "anchor": "transactionpartneruser", - "name": "TransactionPartnerUser", - "description": "Describes a transaction with a user.", - "html_description": "

Describes a transaction with a user.

", - "rst_description": "Describes a transaction with a user.", + "anchor": "transactionpartnertelegramads", + "name": "TransactionPartnerTelegramAds", + "description": "Describes a withdrawal transaction to the Telegram Ads platform.", + "html_description": "

Describes a withdrawal transaction to the Telegram Ads platform.

", + "rst_description": "Describes a withdrawal transaction to the Telegram Ads platform.", "annotations": [ { "type": "String", - "description": "Type of the transaction partner, always 'user'", - "html_description": "Type of the transaction partner, always “user”", - "rst_description": "Type of the transaction partner, always 'user'\n", + "description": "Type of the transaction partner, always 'telegram_ads'", + "html_description": "Type of the transaction partner, always “telegram_ads”", + "rst_description": "Type of the transaction partner, always 'telegram_ads'\n", "name": "type", "required": true - }, - { - "type": "User", - "description": "Information about the user", - "html_description": "Information about the user", - "rst_description": "Information about the user\n", - "name": "user", - "required": true } ], "category": "types" diff --git a/.butcher/types/Animation/entity.json b/.butcher/types/Animation/entity.json index 751e38c3..5df8ae24 100644 --- a/.butcher/types/Animation/entity.json +++ b/.butcher/types/Animation/entity.json @@ -29,49 +29,49 @@ }, { "type": "Integer", - "description": "Video width as defined by sender", - "html_description": "Video width as defined by sender", - "rst_description": "Video width as defined by sender\n", + "description": "Video width as defined by the sender", + "html_description": "Video width as defined by the sender", + "rst_description": "Video width as defined by the sender\n", "name": "width", "required": true }, { "type": "Integer", - "description": "Video height as defined by sender", - "html_description": "Video height as defined by sender", - "rst_description": "Video height as defined by sender\n", + "description": "Video height as defined by the sender", + "html_description": "Video height as defined by the sender", + "rst_description": "Video height as defined by the sender\n", "name": "height", "required": true }, { "type": "Integer", - "description": "Duration of the video in seconds as defined by sender", - "html_description": "Duration of the video in seconds as defined by sender", - "rst_description": "Duration of the video in seconds as defined by sender\n", + "description": "Duration of the video in seconds as defined by the sender", + "html_description": "Duration of the video in seconds as defined by the sender", + "rst_description": "Duration of the video in seconds as defined by the sender\n", "name": "duration", "required": true }, { "type": "PhotoSize", - "description": "Animation thumbnail as defined by sender", - "html_description": "Optional. Animation thumbnail as defined by sender", - "rst_description": "*Optional*. Animation thumbnail as defined by sender\n", + "description": "Animation thumbnail as defined by the sender", + "html_description": "Optional. Animation thumbnail as defined by the sender", + "rst_description": "*Optional*. Animation thumbnail as defined by the sender\n", "name": "thumbnail", "required": false }, { "type": "String", - "description": "Original animation filename as defined by sender", - "html_description": "Optional. Original animation filename as defined by sender", - "rst_description": "*Optional*. Original animation filename as defined by sender\n", + "description": "Original animation filename as defined by the sender", + "html_description": "Optional. Original animation filename as defined by the sender", + "rst_description": "*Optional*. Original animation filename as defined by the sender\n", "name": "file_name", "required": false }, { "type": "String", - "description": "MIME type of the file as defined by sender", - "html_description": "Optional. MIME type of the file as defined by sender", - "rst_description": "*Optional*. MIME type of the file as defined by sender\n", + "description": "MIME type of the file as defined by the sender", + "html_description": "Optional. MIME type of the file as defined by the sender", + "rst_description": "*Optional*. MIME type of the file as defined by the sender\n", "name": "mime_type", "required": false }, diff --git a/.butcher/types/Audio/entity.json b/.butcher/types/Audio/entity.json index e0b22adf..dc014e0d 100644 --- a/.butcher/types/Audio/entity.json +++ b/.butcher/types/Audio/entity.json @@ -29,41 +29,41 @@ }, { "type": "Integer", - "description": "Duration of the audio in seconds as defined by sender", - "html_description": "Duration of the audio in seconds as defined by sender", - "rst_description": "Duration of the audio in seconds as defined by sender\n", + "description": "Duration of the audio in seconds as defined by the sender", + "html_description": "Duration of the audio in seconds as defined by the sender", + "rst_description": "Duration of the audio in seconds as defined by the sender\n", "name": "duration", "required": true }, { "type": "String", - "description": "Performer of the audio as defined by sender or by audio tags", - "html_description": "Optional. Performer of the audio as defined by sender or by audio tags", - "rst_description": "*Optional*. Performer of the audio as defined by sender or by audio tags\n", + "description": "Performer of the audio as defined by the sender or by audio tags", + "html_description": "Optional. Performer of the audio as defined by the sender or by audio tags", + "rst_description": "*Optional*. Performer of the audio as defined by the sender or by audio tags\n", "name": "performer", "required": false }, { "type": "String", - "description": "Title of the audio as defined by sender or by audio tags", - "html_description": "Optional. Title of the audio as defined by sender or by audio tags", - "rst_description": "*Optional*. Title of the audio as defined by sender or by audio tags\n", + "description": "Title of the audio as defined by the sender or by audio tags", + "html_description": "Optional. Title of the audio as defined by the sender or by audio tags", + "rst_description": "*Optional*. Title of the audio as defined by the sender or by audio tags\n", "name": "title", "required": false }, { "type": "String", - "description": "Original filename as defined by sender", - "html_description": "Optional. Original filename as defined by sender", - "rst_description": "*Optional*. Original filename as defined by sender\n", + "description": "Original filename as defined by the sender", + "html_description": "Optional. Original filename as defined by the sender", + "rst_description": "*Optional*. Original filename as defined by the sender\n", "name": "file_name", "required": false }, { "type": "String", - "description": "MIME type of the file as defined by sender", - "html_description": "Optional. MIME type of the file as defined by sender", - "rst_description": "*Optional*. MIME type of the file as defined by sender\n", + "description": "MIME type of the file as defined by the sender", + "html_description": "Optional. MIME type of the file as defined by the sender", + "rst_description": "*Optional*. MIME type of the file as defined by the sender\n", "name": "mime_type", "required": false }, diff --git a/.butcher/types/ChatFullInfo/entity.json b/.butcher/types/ChatFullInfo/entity.json index 1b3045e3..0d7dac49 100644 --- a/.butcher/types/ChatFullInfo/entity.json +++ b/.butcher/types/ChatFullInfo/entity.json @@ -259,6 +259,14 @@ "name": "permissions", "required": false }, + { + "type": "True", + "description": "True, if paid media messages can be sent or forwarded to the channel chat. The field is available only for channel chats.", + "html_description": "Optional. True, if paid media messages can be sent or forwarded to the channel chat. The field is available only for channel chats.", + "rst_description": "*Optional*. :code:`True`, if paid media messages can be sent or forwarded to the channel chat. The field is available only for channel chats.\n", + "name": "can_send_paid_media", + "required": false + }, { "type": "Integer", "description": "For supergroups, the minimum allowed delay between consecutive messages sent by each unprivileged user; in seconds", diff --git a/.butcher/types/Document/entity.json b/.butcher/types/Document/entity.json index c583215d..c032fe5a 100644 --- a/.butcher/types/Document/entity.json +++ b/.butcher/types/Document/entity.json @@ -29,25 +29,25 @@ }, { "type": "PhotoSize", - "description": "Document thumbnail as defined by sender", - "html_description": "Optional. Document thumbnail as defined by sender", - "rst_description": "*Optional*. Document thumbnail as defined by sender\n", + "description": "Document thumbnail as defined by the sender", + "html_description": "Optional. Document thumbnail as defined by the sender", + "rst_description": "*Optional*. Document thumbnail as defined by the sender\n", "name": "thumbnail", "required": false }, { "type": "String", - "description": "Original filename as defined by sender", - "html_description": "Optional. Original filename as defined by sender", - "rst_description": "*Optional*. Original filename as defined by sender\n", + "description": "Original filename as defined by the sender", + "html_description": "Optional. Original filename as defined by the sender", + "rst_description": "*Optional*. Original filename as defined by the sender\n", "name": "file_name", "required": false }, { "type": "String", - "description": "MIME type of the file as defined by sender", - "html_description": "Optional. MIME type of the file as defined by sender", - "rst_description": "*Optional*. MIME type of the file as defined by sender\n", + "description": "MIME type of the file as defined by the sender", + "html_description": "Optional. MIME type of the file as defined by the sender", + "rst_description": "*Optional*. MIME type of the file as defined by the sender\n", "name": "mime_type", "required": false }, diff --git a/.butcher/types/ExternalReplyInfo/entity.json b/.butcher/types/ExternalReplyInfo/entity.json index 975e126c..312693a3 100644 --- a/.butcher/types/ExternalReplyInfo/entity.json +++ b/.butcher/types/ExternalReplyInfo/entity.json @@ -67,6 +67,14 @@ "name": "document", "required": false }, + { + "type": "PaidMediaInfo", + "description": "Message contains paid media; information about the paid media", + "html_description": "Optional. Message contains paid media; information about the paid media", + "rst_description": "*Optional*. Message contains paid media; information about the paid media\n", + "name": "paid_media", + "required": false + }, { "type": "Array of PhotoSize", "description": "Message is a photo, available sizes of the photo", diff --git a/.butcher/types/InputPaidMedia/entity.json b/.butcher/types/InputPaidMedia/entity.json new file mode 100644 index 00000000..5fe4d0a4 --- /dev/null +++ b/.butcher/types/InputPaidMedia/entity.json @@ -0,0 +1,16 @@ +{ + "meta": {}, + "group": { + "title": "Available types", + "anchor": "available-types" + }, + "object": { + "anchor": "inputpaidmedia", + "name": "InputPaidMedia", + "description": "This object describes the paid media to be sent. Currently, it can be one of\n - InputPaidMediaPhoto\n - InputPaidMediaVideo", + "html_description": "

This object describes the paid media to be sent. Currently, it can be one of

", + "rst_description": "This object describes the paid media to be sent. Currently, it can be one of\n\n - :class:`aiogram.types.input_paid_media_photo.InputPaidMediaPhoto`\n - :class:`aiogram.types.input_paid_media_video.InputPaidMediaVideo`", + "annotations": [], + "category": "types" + } +} diff --git a/.butcher/types/InputPaidMedia/subtypes.yml b/.butcher/types/InputPaidMedia/subtypes.yml new file mode 100644 index 00000000..6756ad51 --- /dev/null +++ b/.butcher/types/InputPaidMedia/subtypes.yml @@ -0,0 +1 @@ +discriminator: "type" diff --git a/.butcher/types/InputPaidMediaPhoto/entity.json b/.butcher/types/InputPaidMediaPhoto/entity.json new file mode 100644 index 00000000..adb049da --- /dev/null +++ b/.butcher/types/InputPaidMediaPhoto/entity.json @@ -0,0 +1,33 @@ +{ + "meta": {}, + "group": { + "title": "Available types", + "anchor": "available-types" + }, + "object": { + "anchor": "inputpaidmediaphoto", + "name": "InputPaidMediaPhoto", + "description": "The paid media to send is a photo.", + "html_description": "

The paid media to send is a photo.

", + "rst_description": "The paid media to send is a photo.", + "annotations": [ + { + "type": "String", + "description": "Type of the media, must be photo", + "html_description": "Type of the media, must be photo", + "rst_description": "Type of the media, must be *photo*\n", + "name": "type", + "required": true + }, + { + "type": "String", + "description": "File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass 'attach://' to upload a new one using multipart/form-data under name. More information on Sending Files", + "html_description": "File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name. More information on Sending Files »", + "rst_description": "File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass 'attach://' to upload a new one using multipart/form-data under name. :ref:`More information on Sending Files » `\n", + "name": "media", + "required": true + } + ], + "category": "types" + } +} diff --git a/.butcher/types/InputPaidMediaPhoto/replace.yml b/.butcher/types/InputPaidMediaPhoto/replace.yml new file mode 100644 index 00000000..17ac606b --- /dev/null +++ b/.butcher/types/InputPaidMediaPhoto/replace.yml @@ -0,0 +1,11 @@ +annotations: + media: + parsed_type: + type: union + items: + - type: std + name: str + - type: entity + references: + category: types + name: InputFile diff --git a/.butcher/types/InputPaidMediaVideo/entity.json b/.butcher/types/InputPaidMediaVideo/entity.json new file mode 100644 index 00000000..a04bf3df --- /dev/null +++ b/.butcher/types/InputPaidMediaVideo/entity.json @@ -0,0 +1,73 @@ +{ + "meta": {}, + "group": { + "title": "Available types", + "anchor": "available-types" + }, + "object": { + "anchor": "inputpaidmediavideo", + "name": "InputPaidMediaVideo", + "description": "The paid media to send is a video.", + "html_description": "

The paid media to send is a video.

", + "rst_description": "The paid media to send is a video.", + "annotations": [ + { + "type": "String", + "description": "Type of the media, must be video", + "html_description": "Type of the media, must be video", + "rst_description": "Type of the media, must be *video*\n", + "name": "type", + "required": true + }, + { + "type": "String", + "description": "File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass 'attach://' to upload a new one using multipart/form-data under name. More information on Sending Files", + "html_description": "File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name. More information on Sending Files »", + "rst_description": "File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass 'attach://' to upload a new one using multipart/form-data under name. :ref:`More information on Sending Files » `\n", + "name": "media", + "required": true + }, + { + "type": "InputFile or String", + "description": "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://' if the thumbnail was uploaded using multipart/form-data under . More information on Sending Files", + "html_description": "Optional. 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>. More information on Sending Files »", + "rst_description": "*Optional*. 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://' if the thumbnail was uploaded using multipart/form-data under . :ref:`More information on Sending Files » `\n", + "name": "thumbnail", + "required": false + }, + { + "type": "Integer", + "description": "Video width", + "html_description": "Optional. Video width", + "rst_description": "*Optional*. Video width\n", + "name": "width", + "required": false + }, + { + "type": "Integer", + "description": "Video height", + "html_description": "Optional. Video height", + "rst_description": "*Optional*. Video height\n", + "name": "height", + "required": false + }, + { + "type": "Integer", + "description": "Video duration in seconds", + "html_description": "Optional. Video duration in seconds", + "rst_description": "*Optional*. Video duration in seconds\n", + "name": "duration", + "required": false + }, + { + "type": "Boolean", + "description": "Pass True if the uploaded video is suitable for streaming", + "html_description": "Optional. Pass True if the uploaded video is suitable for streaming", + "rst_description": "*Optional*. Pass :code:`True` if the uploaded video is suitable for streaming\n", + "name": "supports_streaming", + "required": false + } + ], + "category": "types" + } +} diff --git a/.butcher/types/InputPaidMediaVideo/replace.yml b/.butcher/types/InputPaidMediaVideo/replace.yml new file mode 100644 index 00000000..17ac606b --- /dev/null +++ b/.butcher/types/InputPaidMediaVideo/replace.yml @@ -0,0 +1,11 @@ +annotations: + media: + parsed_type: + type: union + items: + - type: std + name: str + - type: entity + references: + category: types + name: InputFile diff --git a/.butcher/types/InputPollOption/entity.json b/.butcher/types/InputPollOption/entity.json index 7c0034a5..f1720718 100644 --- a/.butcher/types/InputPollOption/entity.json +++ b/.butcher/types/InputPollOption/entity.json @@ -7,9 +7,9 @@ "object": { "anchor": "inputpolloption", "name": "InputPollOption", - "description": "This object contains information about one answer option in a poll to send.", - "html_description": "

This object contains information about one answer option in a poll to send.

", - "rst_description": "This object contains information about one answer option in a poll to send.", + "description": "This object contains information about one answer option in a poll to be sent.", + "html_description": "

This object contains information about one answer option in a poll to be sent.

", + "rst_description": "This object contains information about one answer option in a poll to be sent.", "annotations": [ { "type": "String", diff --git a/.butcher/types/Location/entity.json b/.butcher/types/Location/entity.json index a62b44aa..32aa2bc2 100644 --- a/.butcher/types/Location/entity.json +++ b/.butcher/types/Location/entity.json @@ -13,17 +13,17 @@ "annotations": [ { "type": "Float", - "description": "Latitude as defined by sender", - "html_description": "Latitude as defined by sender", - "rst_description": "Latitude as defined by sender\n", + "description": "Latitude as defined by the sender", + "html_description": "Latitude as defined by the sender", + "rst_description": "Latitude as defined by the sender\n", "name": "latitude", "required": true }, { "type": "Float", - "description": "Longitude as defined by sender", - "html_description": "Longitude as defined by sender", - "rst_description": "Longitude as defined by sender\n", + "description": "Longitude as defined by the sender", + "html_description": "Longitude as defined by the sender", + "rst_description": "Longitude as defined by the sender\n", "name": "longitude", "required": true }, diff --git a/.butcher/types/MenuButtonWebApp/entity.json b/.butcher/types/MenuButtonWebApp/entity.json index 6f763e9e..ff0a26ff 100644 --- a/.butcher/types/MenuButtonWebApp/entity.json +++ b/.butcher/types/MenuButtonWebApp/entity.json @@ -29,9 +29,9 @@ }, { "type": "WebAppInfo", - "description": "Description of the Web App that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the method answerWebAppQuery.", - "html_description": "Description of the Web App that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the method answerWebAppQuery.", - "rst_description": "Description of the Web App that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the method :class:`aiogram.methods.answer_web_app_query.AnswerWebAppQuery`.\n", + "description": "Description of the Web App that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the method answerWebAppQuery. Alternatively, a t.me link to a Web App of the bot can be specified in the object instead of the Web App's URL, in which case the Web App will be opened as if the user pressed the link.", + "html_description": "Description of the Web App that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the method answerWebAppQuery. Alternatively, a t.me link to a Web App of the bot can be specified in the object instead of the Web App's URL, in which case the Web App will be opened as if the user pressed the link.", + "rst_description": "Description of the Web App that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the method :class:`aiogram.methods.answer_web_app_query.AnswerWebAppQuery`. Alternatively, a :code:`t.me` link to a Web App of the bot can be specified in the object instead of the Web App's URL, in which case the Web App will be opened as if the user pressed the link.\n", "name": "web_app", "required": true } diff --git a/.butcher/types/Message/aliases.yml b/.butcher/types/Message/aliases.yml index 3168f30d..d68f3060 100644 --- a/.butcher/types/Message/aliases.yml +++ b/.butcher/types/Message/aliases.yml @@ -174,6 +174,11 @@ reply_voice: code: *assert-chat fill: *fill-reply +answer_paid_media: + method: sendPaidMedia + code: *assert-chat + fill: *fill-answer + copy_to: method: copyMessage code: *assert-chat diff --git a/.butcher/types/Message/entity.json b/.butcher/types/Message/entity.json index 229c9c7d..3a90d9fd 100644 --- a/.butcher/types/Message/entity.json +++ b/.butcher/types/Message/entity.json @@ -243,6 +243,14 @@ "name": "document", "required": false }, + { + "type": "PaidMediaInfo", + "description": "Message contains paid media; information about the paid media", + "html_description": "Optional. Message contains paid media; information about the paid media", + "rst_description": "*Optional*. Message contains paid media; information about the paid media\n", + "name": "paid_media", + "required": false + }, { "type": "Array of PhotoSize", "description": "Message is a photo, available sizes of the photo", @@ -293,9 +301,9 @@ }, { "type": "String", - "description": "Caption for the animation, audio, document, photo, video or voice", - "html_description": "Optional. Caption for the animation, audio, document, photo, video or voice", - "rst_description": "*Optional*. Caption for the animation, audio, document, photo, video or voice\n", + "description": "Caption for the animation, audio, document, paid media, photo, video or voice", + "html_description": "Optional. Caption for the animation, audio, document, paid media, photo, video or voice", + "rst_description": "*Optional*. Caption for the animation, audio, document, paid media, photo, video or voice\n", "name": "caption", "required": false }, diff --git a/.butcher/types/PaidMedia/entity.json b/.butcher/types/PaidMedia/entity.json new file mode 100644 index 00000000..cce6bf8b --- /dev/null +++ b/.butcher/types/PaidMedia/entity.json @@ -0,0 +1,16 @@ +{ + "meta": {}, + "group": { + "title": "Available types", + "anchor": "available-types" + }, + "object": { + "anchor": "paidmedia", + "name": "PaidMedia", + "description": "This object describes paid media. Currently, it can be one of\n - PaidMediaPreview\n - PaidMediaPhoto\n - PaidMediaVideo", + "html_description": "

This object describes paid media. Currently, it can be one of

", + "rst_description": "This object describes paid media. Currently, it can be one of\n\n - :class:`aiogram.types.paid_media_preview.PaidMediaPreview`\n - :class:`aiogram.types.paid_media_photo.PaidMediaPhoto`\n - :class:`aiogram.types.paid_media_video.PaidMediaVideo`", + "annotations": [], + "category": "types" + } +} diff --git a/.butcher/types/PaidMedia/subtypes.yml b/.butcher/types/PaidMedia/subtypes.yml new file mode 100644 index 00000000..6756ad51 --- /dev/null +++ b/.butcher/types/PaidMedia/subtypes.yml @@ -0,0 +1 @@ +discriminator: "type" diff --git a/.butcher/types/PaidMediaInfo/entity.json b/.butcher/types/PaidMediaInfo/entity.json new file mode 100644 index 00000000..f4ed8526 --- /dev/null +++ b/.butcher/types/PaidMediaInfo/entity.json @@ -0,0 +1,33 @@ +{ + "meta": {}, + "group": { + "title": "Available types", + "anchor": "available-types" + }, + "object": { + "anchor": "paidmediainfo", + "name": "PaidMediaInfo", + "description": "Describes the paid media added to a message.", + "html_description": "

Describes the paid media added to a message.

", + "rst_description": "Describes the paid media added to a message.", + "annotations": [ + { + "type": "Integer", + "description": "The number of Telegram Stars that must be paid to buy access to the media", + "html_description": "The number of Telegram Stars that must be paid to buy access to the media", + "rst_description": "The number of Telegram Stars that must be paid to buy access to the media\n", + "name": "star_count", + "required": true + }, + { + "type": "Array of PaidMedia", + "description": "Information about the paid media", + "html_description": "Information about the paid media", + "rst_description": "Information about the paid media\n", + "name": "paid_media", + "required": true + } + ], + "category": "types" + } +} diff --git a/.butcher/types/PaidMediaPhoto/entity.json b/.butcher/types/PaidMediaPhoto/entity.json new file mode 100644 index 00000000..a2a9ecab --- /dev/null +++ b/.butcher/types/PaidMediaPhoto/entity.json @@ -0,0 +1,33 @@ +{ + "meta": {}, + "group": { + "title": "Available types", + "anchor": "available-types" + }, + "object": { + "anchor": "paidmediaphoto", + "name": "PaidMediaPhoto", + "description": "The paid media is a photo.", + "html_description": "

The paid media is a photo.

", + "rst_description": "The paid media is a photo.", + "annotations": [ + { + "type": "String", + "description": "Type of the paid media, always 'photo'", + "html_description": "Type of the paid media, always “photo”", + "rst_description": "Type of the paid media, always 'photo'\n", + "name": "type", + "required": true + }, + { + "type": "Array of PhotoSize", + "description": "The photo", + "html_description": "The photo", + "rst_description": "The photo\n", + "name": "photo", + "required": true + } + ], + "category": "types" + } +} diff --git a/.butcher/types/PaidMediaPreview/entity.json b/.butcher/types/PaidMediaPreview/entity.json new file mode 100644 index 00000000..a54e137f --- /dev/null +++ b/.butcher/types/PaidMediaPreview/entity.json @@ -0,0 +1,49 @@ +{ + "meta": {}, + "group": { + "title": "Available types", + "anchor": "available-types" + }, + "object": { + "anchor": "paidmediapreview", + "name": "PaidMediaPreview", + "description": "The paid media isn't available before the payment.", + "html_description": "

The paid media isn't available before the payment.

", + "rst_description": "The paid media isn't available before the payment.", + "annotations": [ + { + "type": "String", + "description": "Type of the paid media, always 'preview'", + "html_description": "Type of the paid media, always “preview”", + "rst_description": "Type of the paid media, always 'preview'\n", + "name": "type", + "required": true + }, + { + "type": "Integer", + "description": "Media width as defined by the sender", + "html_description": "Optional. Media width as defined by the sender", + "rst_description": "*Optional*. Media width as defined by the sender\n", + "name": "width", + "required": false + }, + { + "type": "Integer", + "description": "Media height as defined by the sender", + "html_description": "Optional. Media height as defined by the sender", + "rst_description": "*Optional*. Media height as defined by the sender\n", + "name": "height", + "required": false + }, + { + "type": "Integer", + "description": "Duration of the media in seconds as defined by the sender", + "html_description": "Optional. Duration of the media in seconds as defined by the sender", + "rst_description": "*Optional*. Duration of the media in seconds as defined by the sender\n", + "name": "duration", + "required": false + } + ], + "category": "types" + } +} diff --git a/.butcher/types/PaidMediaVideo/entity.json b/.butcher/types/PaidMediaVideo/entity.json new file mode 100644 index 00000000..b4433d9d --- /dev/null +++ b/.butcher/types/PaidMediaVideo/entity.json @@ -0,0 +1,33 @@ +{ + "meta": {}, + "group": { + "title": "Available types", + "anchor": "available-types" + }, + "object": { + "anchor": "paidmediavideo", + "name": "PaidMediaVideo", + "description": "The paid media is a video.", + "html_description": "

The paid media is a video.

", + "rst_description": "The paid media is a video.", + "annotations": [ + { + "type": "String", + "description": "Type of the paid media, always 'video'", + "html_description": "Type of the paid media, always “video”", + "rst_description": "Type of the paid media, always 'video'\n", + "name": "type", + "required": true + }, + { + "type": "Video", + "description": "The video", + "html_description": "The video", + "rst_description": "The video\n", + "name": "video", + "required": true + } + ], + "category": "types" + } +} diff --git a/.butcher/types/PreCheckoutQuery/entity.json b/.butcher/types/PreCheckoutQuery/entity.json index 9a8218e9..a524fc5f 100644 --- a/.butcher/types/PreCheckoutQuery/entity.json +++ b/.butcher/types/PreCheckoutQuery/entity.json @@ -45,9 +45,9 @@ }, { "type": "String", - "description": "Bot specified invoice payload", - "html_description": "Bot specified invoice payload", - "rst_description": "Bot specified invoice payload\n", + "description": "Bot-specified invoice payload", + "html_description": "Bot-specified invoice payload", + "rst_description": "Bot-specified invoice payload\n", "name": "invoice_payload", "required": true }, diff --git a/.butcher/types/ShippingQuery/entity.json b/.butcher/types/ShippingQuery/entity.json index 607f7e57..4d6cd4f1 100644 --- a/.butcher/types/ShippingQuery/entity.json +++ b/.butcher/types/ShippingQuery/entity.json @@ -29,9 +29,9 @@ }, { "type": "String", - "description": "Bot specified invoice payload", - "html_description": "Bot specified invoice payload", - "rst_description": "Bot specified invoice payload\n", + "description": "Bot-specified invoice payload", + "html_description": "Bot-specified invoice payload", + "rst_description": "Bot-specified invoice payload\n", "name": "invoice_payload", "required": true }, diff --git a/.butcher/types/SuccessfulPayment/entity.json b/.butcher/types/SuccessfulPayment/entity.json index b555d08b..4ae3510e 100644 --- a/.butcher/types/SuccessfulPayment/entity.json +++ b/.butcher/types/SuccessfulPayment/entity.json @@ -29,9 +29,9 @@ }, { "type": "String", - "description": "Bot specified invoice payload", - "html_description": "Bot specified invoice payload", - "rst_description": "Bot specified invoice payload\n", + "description": "Bot-specified invoice payload", + "html_description": "Bot-specified invoice payload", + "rst_description": "Bot-specified invoice payload\n", "name": "invoice_payload", "required": true }, diff --git a/.butcher/types/TransactionPartner/entity.json b/.butcher/types/TransactionPartner/entity.json index a705938d..ae4ca0e6 100644 --- a/.butcher/types/TransactionPartner/entity.json +++ b/.butcher/types/TransactionPartner/entity.json @@ -7,9 +7,9 @@ "object": { "anchor": "transactionpartner", "name": "TransactionPartner", - "description": "This object describes the source of a transaction, or its recipient for outgoing transactions. Currently, it can be one of\n - TransactionPartnerFragment\n - TransactionPartnerUser\n - TransactionPartnerOther", - "html_description": "

This object describes the source of a transaction, or its recipient for outgoing transactions. Currently, it can be one of

", - "rst_description": "This object describes the source of a transaction, or its recipient for outgoing transactions. Currently, it can be one of\n\n - :class:`aiogram.types.transaction_partner_fragment.TransactionPartnerFragment`\n - :class:`aiogram.types.transaction_partner_user.TransactionPartnerUser`\n - :class:`aiogram.types.transaction_partner_other.TransactionPartnerOther`", + "description": "This object describes the source of a transaction, or its recipient for outgoing transactions. Currently, it can be one of\n - TransactionPartnerUser\n - TransactionPartnerFragment\n - TransactionPartnerTelegramAds\n - TransactionPartnerOther", + "html_description": "

This object describes the source of a transaction, or its recipient for outgoing transactions. Currently, it can be one of

", + "rst_description": "This object describes the source of a transaction, or its recipient for outgoing transactions. Currently, it can be one of\n\n - :class:`aiogram.types.transaction_partner_user.TransactionPartnerUser`\n - :class:`aiogram.types.transaction_partner_fragment.TransactionPartnerFragment`\n - :class:`aiogram.types.transaction_partner_telegram_ads.TransactionPartnerTelegramAds`\n - :class:`aiogram.types.transaction_partner_other.TransactionPartnerOther`", "annotations": [], "category": "types" } diff --git a/.butcher/types/TransactionPartnerTelegramAds/entity.json b/.butcher/types/TransactionPartnerTelegramAds/entity.json new file mode 100644 index 00000000..2af27d5c --- /dev/null +++ b/.butcher/types/TransactionPartnerTelegramAds/entity.json @@ -0,0 +1,25 @@ +{ + "meta": {}, + "group": { + "title": "Payments", + "anchor": "payments" + }, + "object": { + "anchor": "transactionpartnertelegramads", + "name": "TransactionPartnerTelegramAds", + "description": "Describes a withdrawal transaction to the Telegram Ads platform.", + "html_description": "

Describes a withdrawal transaction to the Telegram Ads platform.

", + "rst_description": "Describes a withdrawal transaction to the Telegram Ads platform.", + "annotations": [ + { + "type": "String", + "description": "Type of the transaction partner, always 'telegram_ads'", + "html_description": "Type of the transaction partner, always “telegram_ads”", + "rst_description": "Type of the transaction partner, always 'telegram_ads'\n", + "name": "type", + "required": true + } + ], + "category": "types" + } +} diff --git a/.butcher/types/TransactionPartnerUser/entity.json b/.butcher/types/TransactionPartnerUser/entity.json index cb42215b..b8a616fc 100644 --- a/.butcher/types/TransactionPartnerUser/entity.json +++ b/.butcher/types/TransactionPartnerUser/entity.json @@ -26,6 +26,14 @@ "rst_description": "Information about the user\n", "name": "user", "required": true + }, + { + "type": "String", + "description": "Bot-specified invoice payload", + "html_description": "Optional. Bot-specified invoice payload", + "rst_description": "*Optional*. Bot-specified invoice payload\n", + "name": "invoice_payload", + "required": false } ], "category": "types" diff --git a/.butcher/types/Video/entity.json b/.butcher/types/Video/entity.json index b98f44ba..b025a605 100644 --- a/.butcher/types/Video/entity.json +++ b/.butcher/types/Video/entity.json @@ -29,25 +29,25 @@ }, { "type": "Integer", - "description": "Video width as defined by sender", - "html_description": "Video width as defined by sender", - "rst_description": "Video width as defined by sender\n", + "description": "Video width as defined by the sender", + "html_description": "Video width as defined by the sender", + "rst_description": "Video width as defined by the sender\n", "name": "width", "required": true }, { "type": "Integer", - "description": "Video height as defined by sender", - "html_description": "Video height as defined by sender", - "rst_description": "Video height as defined by sender\n", + "description": "Video height as defined by the sender", + "html_description": "Video height as defined by the sender", + "rst_description": "Video height as defined by the sender\n", "name": "height", "required": true }, { "type": "Integer", - "description": "Duration of the video in seconds as defined by sender", - "html_description": "Duration of the video in seconds as defined by sender", - "rst_description": "Duration of the video in seconds as defined by sender\n", + "description": "Duration of the video in seconds as defined by the sender", + "html_description": "Duration of the video in seconds as defined by the sender", + "rst_description": "Duration of the video in seconds as defined by the sender\n", "name": "duration", "required": true }, @@ -61,17 +61,17 @@ }, { "type": "String", - "description": "Original filename as defined by sender", - "html_description": "Optional. Original filename as defined by sender", - "rst_description": "*Optional*. Original filename as defined by sender\n", + "description": "Original filename as defined by the sender", + "html_description": "Optional. Original filename as defined by the sender", + "rst_description": "*Optional*. Original filename as defined by the sender\n", "name": "file_name", "required": false }, { "type": "String", - "description": "MIME type of the file as defined by sender", - "html_description": "Optional. MIME type of the file as defined by sender", - "rst_description": "*Optional*. MIME type of the file as defined by sender\n", + "description": "MIME type of the file as defined by the sender", + "html_description": "Optional. MIME type of the file as defined by the sender", + "rst_description": "*Optional*. MIME type of the file as defined by the sender\n", "name": "mime_type", "required": false }, diff --git a/.butcher/types/VideoNote/entity.json b/.butcher/types/VideoNote/entity.json index da99d65c..ee6e4f18 100644 --- a/.butcher/types/VideoNote/entity.json +++ b/.butcher/types/VideoNote/entity.json @@ -29,17 +29,17 @@ }, { "type": "Integer", - "description": "Video width and height (diameter of the video message) as defined by sender", - "html_description": "Video width and height (diameter of the video message) as defined by sender", - "rst_description": "Video width and height (diameter of the video message) as defined by sender\n", + "description": "Video width and height (diameter of the video message) as defined by the sender", + "html_description": "Video width and height (diameter of the video message) as defined by the sender", + "rst_description": "Video width and height (diameter of the video message) as defined by the sender\n", "name": "length", "required": true }, { "type": "Integer", - "description": "Duration of the video in seconds as defined by sender", - "html_description": "Duration of the video in seconds as defined by sender", - "rst_description": "Duration of the video in seconds as defined by sender\n", + "description": "Duration of the video in seconds as defined by the sender", + "html_description": "Duration of the video in seconds as defined by the sender", + "rst_description": "Duration of the video in seconds as defined by the sender\n", "name": "duration", "required": true }, diff --git a/.butcher/types/Voice/entity.json b/.butcher/types/Voice/entity.json index f19f9536..0bfae946 100644 --- a/.butcher/types/Voice/entity.json +++ b/.butcher/types/Voice/entity.json @@ -29,17 +29,17 @@ }, { "type": "Integer", - "description": "Duration of the audio in seconds as defined by sender", - "html_description": "Duration of the audio in seconds as defined by sender", - "rst_description": "Duration of the audio in seconds as defined by sender\n", + "description": "Duration of the audio in seconds as defined by the sender", + "html_description": "Duration of the audio in seconds as defined by the sender", + "rst_description": "Duration of the audio in seconds as defined by the sender\n", "name": "duration", "required": true }, { "type": "String", - "description": "MIME type of the file as defined by sender", - "html_description": "Optional. MIME type of the file as defined by sender", - "rst_description": "*Optional*. MIME type of the file as defined by sender\n", + "description": "MIME type of the file as defined by the sender", + "html_description": "Optional. MIME type of the file as defined by the sender", + "rst_description": "*Optional*. MIME type of the file as defined by the sender\n", "name": "mime_type", "required": false }, diff --git a/CHANGES/1533.feature.rst b/CHANGES/1533.feature.rst new file mode 100644 index 00000000..89315c4e --- /dev/null +++ b/CHANGES/1533.feature.rst @@ -0,0 +1,30 @@ +Added full support of `Bot API 7.6 `_ + +- Added the classes :class:`aiogram.types.paid_media.PaidMedia`, + :class:`aiogram.types.paid_media_info.PaidMediaInfo`, + :class:`aiogram.types.paid_media_preview.PaidMediaPreview`, + :class:`aiogram.types.paid_media_photo.PaidMediaPhoto` + and :class:`aiogram.types.paid_media_video.PaidMediaVideo`, + containing information about paid media. +- Added the method :class:`aiogram.methods.send_paid_media.SendPaidMedia` + and the classes :class:`aiogram.types.input_paid_media.InputPaidMedia`, + :class:`aiogram.types.input_paid_media_photo.InputPaidMediaPhoto` + and :class:`aiogram.types.input_paid_media_video.InputPaidMediaVideo`, + to support sending paid media. +- Documented that the methods :class:`aiogram.methods.copy_message.CopyMessage` + and :class:`aiogram.methods.copy_messages.CopyMessages` cannot be used to copy paid media. +- Added the field :code:`can_send_paid_media` to the class + :class:`aiogram.types.chat_full_info.ChatFullInfo`. +- Added the field :code:`paid_media` to the classes + :class:`aiogram.types.message.Message` and + :class:`aiogram.types.external_reply_info.ExternalReplyInfo`. +- Added the class + :class:`aiogram.types.transaction_partner_telegram_ads.TransactionPartnerTelegramAds`, + containing information about Telegram Star transactions involving the Telegram Ads Platform. +- Added the field :code:`invoice_payload` to the class + :class:`aiogram.types.transaction_partner_user.TransactionPartnerUser`, + containing the bot-specified invoice payload. +- Changed the default opening mode for Direct Link Mini Apps. +- Added support for launching Web Apps via t.me link in the class + :class:`aiogram.types.menu_button_web_app.MenuButtonWebApp`. +- Added the field :code:`section_separator_color` to the class :code:`ThemeParams`. diff --git a/aiogram/client/bot.py b/aiogram/client/bot.py index 7348d201..0981bbf5 100644 --- a/aiogram/client/bot.py +++ b/aiogram/client/bot.py @@ -106,6 +106,7 @@ from ..methods import ( SendLocation, SendMediaGroup, SendMessage, + SendPaidMedia, SendPhoto, SendPoll, SendSticker, @@ -204,6 +205,8 @@ from ..types import ( InputMediaDocument, InputMediaPhoto, InputMediaVideo, + InputPaidMediaPhoto, + InputPaidMediaVideo, InputPollOption, InputSticker, LabeledPrice, @@ -862,7 +865,7 @@ class Bot: request_timeout: Optional[int] = None, ) -> MessageId: """ - Use this method to copy messages of any kind. Service 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. + 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 @@ -4405,7 +4408,7 @@ class Bot: request_timeout: Optional[int] = None, ) -> 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, 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. + 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 @@ -4635,3 +4638,55 @@ class Bot: limit=limit, ) return await self(call, request_timeout=request_timeout) + + async def send_paid_media( + self, + chat_id: Union[int, str], + star_count: int, + media: List[Union[InputPaidMediaPhoto, InputPaidMediaVideo]], + caption: Optional[str] = None, + parse_mode: Optional[str] = None, + caption_entities: Optional[List[MessageEntity]] = None, + show_caption_above_media: Optional[bool] = None, + disable_notification: Optional[bool] = None, + protect_content: Optional[bool] = None, + reply_parameters: Optional[ReplyParameters] = None, + reply_markup: Optional[ + Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply] + ] = None, + request_timeout: Optional[int] = None, + ) -> Message: + """ + Use this method to send paid media to channel chats. On success, the sent :class:`aiogram.types.message.Message` is returned. + + Source: https://core.telegram.org/bots/api#sendpaidmedia + + :param chat_id: Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`) + :param star_count: The number of Telegram Stars that must be paid to buy access to the media + :param media: A JSON-serialized array describing the media to be sent; up to 10 items + :param caption: Media caption, 0-1024 characters after entities parsing + :param parse_mode: Mode for parsing entities in the media caption. See `formatting options `_ for more details. + :param caption_entities: A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode* + :param show_caption_above_media: Pass :code:`True`, if the caption must be shown above the message media + :param disable_notification: Sends the message `silently `_. Users will receive a notification with no sound. + :param protect_content: Protects the contents of the sent message from forwarding and saving + :param reply_parameters: Description of the message to reply to + :param reply_markup: Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove a reply keyboard or to force a reply from the user + :param request_timeout: Request timeout + :return: On success, the sent :class:`aiogram.types.message.Message` is returned. + """ + + call = SendPaidMedia( + chat_id=chat_id, + star_count=star_count, + media=media, + 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, + reply_parameters=reply_parameters, + reply_markup=reply_markup, + ) + return await self(call, request_timeout=request_timeout) diff --git a/aiogram/enums/__init__.py b/aiogram/enums/__init__.py index 94783ac4..f8c4532a 100644 --- a/aiogram/enums/__init__.py +++ b/aiogram/enums/__init__.py @@ -9,11 +9,13 @@ from .dice_emoji import DiceEmoji from .encrypted_passport_element import EncryptedPassportElement from .inline_query_result_type import InlineQueryResultType from .input_media_type import InputMediaType +from .input_paid_media_type import InputPaidMediaType from .keyboard_button_poll_type_type import KeyboardButtonPollTypeType from .mask_position_point import MaskPositionPoint from .menu_button_type import MenuButtonType from .message_entity_type import MessageEntityType from .message_origin_type import MessageOriginType +from .paid_media_type import PaidMediaType from .parse_mode import ParseMode from .passport_element_error_type import PassportElementErrorType from .poll_type import PollType @@ -37,11 +39,13 @@ __all__ = ( "EncryptedPassportElement", "InlineQueryResultType", "InputMediaType", + "InputPaidMediaType", "KeyboardButtonPollTypeType", "MaskPositionPoint", "MenuButtonType", "MessageEntityType", "MessageOriginType", + "PaidMediaType", "ParseMode", "PassportElementErrorType", "PollType", diff --git a/aiogram/enums/content_type.py b/aiogram/enums/content_type.py index 4f631a62..8e40dd42 100644 --- a/aiogram/enums/content_type.py +++ b/aiogram/enums/content_type.py @@ -12,6 +12,7 @@ class ContentType(str, Enum): ANIMATION = "animation" AUDIO = "audio" DOCUMENT = "document" + PAID_MEDIA = "paid_media" PHOTO = "photo" STICKER = "sticker" STORY = "story" diff --git a/aiogram/enums/input_paid_media_type.py b/aiogram/enums/input_paid_media_type.py new file mode 100644 index 00000000..fc132e22 --- /dev/null +++ b/aiogram/enums/input_paid_media_type.py @@ -0,0 +1,12 @@ +from enum import Enum + + +class InputPaidMediaType(str, Enum): + """ + This object represents the type of a media in a paid message. + + Source: https://core.telegram.org/bots/api#inputpaidmedia + """ + + PHOTO = "photo" + VIDEO = "video" diff --git a/aiogram/enums/paid_media_type.py b/aiogram/enums/paid_media_type.py new file mode 100644 index 00000000..930028f1 --- /dev/null +++ b/aiogram/enums/paid_media_type.py @@ -0,0 +1,13 @@ +from enum import Enum + + +class PaidMediaType(str, Enum): + """ + This object represents the type of a media in a paid message. + + Source: https://core.telegram.org/bots/api#paidmedia + """ + + PHOTO = "photo" + PREVIEW = "preview" + VIDEO = "video" diff --git a/aiogram/enums/transaction_partner_type.py b/aiogram/enums/transaction_partner_type.py index 4cd8340b..b335ac09 100644 --- a/aiogram/enums/transaction_partner_type.py +++ b/aiogram/enums/transaction_partner_type.py @@ -11,3 +11,4 @@ class TransactionPartnerType(str, Enum): FRAGMENT = "fragment" OTHER = "other" USER = "user" + TELEGRAM_ADS = "telegram_ads" diff --git a/aiogram/methods/__init__.py b/aiogram/methods/__init__.py index ec4c2d2e..dca24d62 100644 --- a/aiogram/methods/__init__.py +++ b/aiogram/methods/__init__.py @@ -82,6 +82,7 @@ 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 @@ -209,6 +210,7 @@ __all__ = ( "SendLocation", "SendMediaGroup", "SendMessage", + "SendPaidMedia", "SendPhoto", "SendPoll", "SendSticker", diff --git a/aiogram/methods/copy_message.py b/aiogram/methods/copy_message.py index 2614ddbf..ca44f93e 100644 --- a/aiogram/methods/copy_message.py +++ b/aiogram/methods/copy_message.py @@ -19,7 +19,7 @@ from .base import TelegramMethod class CopyMessage(TelegramMethod[MessageId]): """ - Use this method to copy messages of any kind. Service 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. + 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 """ diff --git a/aiogram/methods/copy_messages.py b/aiogram/methods/copy_messages.py index d85e3105..c734d0a7 100644 --- a/aiogram/methods/copy_messages.py +++ b/aiogram/methods/copy_messages.py @@ -6,7 +6,7 @@ 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, 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. + 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 """ diff --git a/aiogram/methods/send_paid_media.py b/aiogram/methods/send_paid_media.py new file mode 100644 index 00000000..03b37a6e --- /dev/null +++ b/aiogram/methods/send_paid_media.py @@ -0,0 +1,93 @@ +from __future__ import annotations + +from typing import TYPE_CHECKING, Any, List, Optional, Union + +from ..types import ( + ForceReply, + InlineKeyboardMarkup, + InputPaidMediaPhoto, + InputPaidMediaVideo, + Message, + MessageEntity, + ReplyKeyboardMarkup, + ReplyKeyboardRemove, + ReplyParameters, +) +from .base import TelegramMethod + + +class SendPaidMedia(TelegramMethod[Message]): + """ + Use this method to send paid media to channel chats. On success, the sent :class:`aiogram.types.message.Message` is returned. + + Source: https://core.telegram.org/bots/api#sendpaidmedia + """ + + __returning__ = Message + __api_method__ = "sendPaidMedia" + + chat_id: Union[int, str] + """Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)""" + star_count: int + """The number of Telegram Stars that must be paid to buy access to the media""" + media: List[Union[InputPaidMediaPhoto, InputPaidMediaVideo]] + """A JSON-serialized array describing the media to be sent; up to 10 items""" + caption: Optional[str] = None + """Media caption, 0-1024 characters after entities parsing""" + parse_mode: Optional[str] = None + """Mode for parsing entities in the media caption. See `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[bool] = None + """Pass :code:`True`, if the caption must be shown above the message media""" + disable_notification: Optional[bool] = None + """Sends the message `silently `_. Users will receive a notification with no sound.""" + protect_content: Optional[bool] = None + """Protects the contents of the sent message from forwarding and saving""" + reply_parameters: Optional[ReplyParameters] = None + """Description of the message to reply to""" + reply_markup: Optional[ + Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply] + ] = None + """Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove a reply keyboard or to force a reply from the user""" + + if TYPE_CHECKING: + # DO NOT EDIT MANUALLY!!! + # This section was auto-generated via `butcher` + + def __init__( + __pydantic__self__, + *, + chat_id: Union[int, str], + star_count: int, + media: List[Union[InputPaidMediaPhoto, InputPaidMediaVideo]], + caption: Optional[str] = None, + parse_mode: Optional[str] = None, + caption_entities: Optional[List[MessageEntity]] = None, + show_caption_above_media: Optional[bool] = None, + disable_notification: Optional[bool] = None, + protect_content: Optional[bool] = None, + reply_parameters: Optional[ReplyParameters] = None, + reply_markup: Optional[ + Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply] + ] = 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, + star_count=star_count, + media=media, + 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, + reply_parameters=reply_parameters, + reply_markup=reply_markup, + **__pydantic_kwargs, + ) diff --git a/aiogram/types/__init__.py b/aiogram/types/__init__.py index c8372d35..740bf5dd 100644 --- a/aiogram/types/__init__.py +++ b/aiogram/types/__init__.py @@ -123,6 +123,9 @@ from .input_media_document import InputMediaDocument from .input_media_photo import InputMediaPhoto from .input_media_video import InputMediaVideo from .input_message_content import InputMessageContent +from .input_paid_media import InputPaidMedia +from .input_paid_media_photo import InputPaidMediaPhoto +from .input_paid_media_video import InputPaidMediaVideo from .input_poll_option import InputPollOption from .input_sticker import InputSticker from .input_text_message_content import InputTextMessageContent @@ -155,6 +158,11 @@ from .message_origin_user import MessageOriginUser from .message_reaction_count_updated import MessageReactionCountUpdated from .message_reaction_updated import MessageReactionUpdated from .order_info import OrderInfo +from .paid_media import PaidMedia +from .paid_media_info import PaidMediaInfo +from .paid_media_photo import PaidMediaPhoto +from .paid_media_preview import PaidMediaPreview +from .paid_media_video import PaidMediaVideo from .passport_data import PassportData from .passport_element_error import PassportElementError from .passport_element_error_data_field import PassportElementErrorDataField @@ -203,6 +211,7 @@ from .text_quote import TextQuote from .transaction_partner import TransactionPartner from .transaction_partner_fragment import TransactionPartnerFragment from .transaction_partner_other import TransactionPartnerOther +from .transaction_partner_telegram_ads import TransactionPartnerTelegramAds from .transaction_partner_user import TransactionPartnerUser from .update import Update from .user import User @@ -347,6 +356,9 @@ __all__ = ( "InputMediaPhoto", "InputMediaVideo", "InputMessageContent", + "InputPaidMedia", + "InputPaidMediaPhoto", + "InputPaidMediaVideo", "InputPollOption", "InputSticker", "InputTextMessageContent", @@ -379,6 +391,11 @@ __all__ = ( "MessageReactionCountUpdated", "MessageReactionUpdated", "OrderInfo", + "PaidMedia", + "PaidMediaInfo", + "PaidMediaPhoto", + "PaidMediaPreview", + "PaidMediaVideo", "PassportData", "PassportElementError", "PassportElementErrorDataField", @@ -426,6 +443,7 @@ __all__ = ( "TransactionPartner", "TransactionPartnerFragment", "TransactionPartnerOther", + "TransactionPartnerTelegramAds", "TransactionPartnerUser", "UNSET_PARSE_MODE", "URLInputFile", diff --git a/aiogram/types/animation.py b/aiogram/types/animation.py index 856a5b37..1fb45b71 100644 --- a/aiogram/types/animation.py +++ b/aiogram/types/animation.py @@ -20,17 +20,17 @@ class Animation(TelegramObject): file_unique_id: str """Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.""" width: int - """Video width as defined by sender""" + """Video width as defined by the sender""" height: int - """Video height as defined by sender""" + """Video height as defined by the sender""" duration: int - """Duration of the video in seconds as defined by sender""" + """Duration of the video in seconds as defined by the sender""" thumbnail: Optional[PhotoSize] = None - """*Optional*. Animation thumbnail as defined by sender""" + """*Optional*. Animation thumbnail as defined by the sender""" file_name: Optional[str] = None - """*Optional*. Original animation filename as defined by sender""" + """*Optional*. Original animation filename as defined by the sender""" mime_type: Optional[str] = None - """*Optional*. MIME type of the file as defined by sender""" + """*Optional*. MIME type of the file as defined by the sender""" file_size: Optional[int] = None """*Optional*. File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value.""" diff --git a/aiogram/types/audio.py b/aiogram/types/audio.py index f42e3bf2..8c114126 100644 --- a/aiogram/types/audio.py +++ b/aiogram/types/audio.py @@ -20,15 +20,15 @@ class Audio(TelegramObject): file_unique_id: str """Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.""" duration: int - """Duration of the audio in seconds as defined by sender""" + """Duration of the audio in seconds as defined by the sender""" performer: Optional[str] = None - """*Optional*. Performer of the audio as defined by sender or by audio tags""" + """*Optional*. Performer of the audio as defined by the sender or by audio tags""" title: Optional[str] = None - """*Optional*. Title of the audio as defined by sender or by audio tags""" + """*Optional*. Title of the audio as defined by the sender or by audio tags""" file_name: Optional[str] = None - """*Optional*. Original filename as defined by sender""" + """*Optional*. Original filename as defined by the sender""" mime_type: Optional[str] = None - """*Optional*. MIME type of the file as defined by sender""" + """*Optional*. MIME type of the file as defined by the sender""" file_size: Optional[int] = None """*Optional*. File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value.""" thumbnail: Optional[PhotoSize] = None diff --git a/aiogram/types/chat_full_info.py b/aiogram/types/chat_full_info.py index 4c5e446f..78126929 100644 --- a/aiogram/types/chat_full_info.py +++ b/aiogram/types/chat_full_info.py @@ -87,6 +87,8 @@ class ChatFullInfo(Chat): """*Optional*. The most recent pinned message (by sending date)""" permissions: Optional[ChatPermissions] = None """*Optional*. Default chat member permissions, for groups and supergroups""" + can_send_paid_media: Optional[bool] = None + """*Optional*. :code:`True`, if paid media messages can be sent or forwarded to the channel chat. The field is available only for channel chats.""" slow_mode_delay: Optional[int] = None """*Optional*. For supergroups, the minimum allowed delay between consecutive messages sent by each unprivileged user; in seconds""" unrestrict_boost_count: Optional[int] = None @@ -152,6 +154,7 @@ class ChatFullInfo(Chat): invite_link: Optional[str] = None, pinned_message: Optional[Message] = None, permissions: Optional[ChatPermissions] = None, + can_send_paid_media: Optional[bool] = None, slow_mode_delay: Optional[int] = None, unrestrict_boost_count: Optional[int] = None, message_auto_delete_time: Optional[int] = None, @@ -202,6 +205,7 @@ class ChatFullInfo(Chat): invite_link=invite_link, pinned_message=pinned_message, permissions=permissions, + can_send_paid_media=can_send_paid_media, slow_mode_delay=slow_mode_delay, unrestrict_boost_count=unrestrict_boost_count, message_auto_delete_time=message_auto_delete_time, diff --git a/aiogram/types/custom.py b/aiogram/types/custom.py index 06eae70a..8617fa64 100644 --- a/aiogram/types/custom.py +++ b/aiogram/types/custom.py @@ -1,7 +1,6 @@ import sys -from datetime import datetime +from datetime import datetime, timezone -from datetime import timezone from pydantic import PlainSerializer from typing_extensions import Annotated diff --git a/aiogram/types/document.py b/aiogram/types/document.py index 83139076..18acff7a 100644 --- a/aiogram/types/document.py +++ b/aiogram/types/document.py @@ -20,11 +20,11 @@ class Document(TelegramObject): file_unique_id: str """Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.""" thumbnail: Optional[PhotoSize] = None - """*Optional*. Document thumbnail as defined by sender""" + """*Optional*. Document thumbnail as defined by the sender""" file_name: Optional[str] = None - """*Optional*. Original filename as defined by sender""" + """*Optional*. Original filename as defined by the sender""" mime_type: Optional[str] = None - """*Optional*. MIME type of the file as defined by sender""" + """*Optional*. MIME type of the file as defined by the sender""" file_size: Optional[int] = None """*Optional*. File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value.""" diff --git a/aiogram/types/external_reply_info.py b/aiogram/types/external_reply_info.py index d66f70ba..0f13a850 100644 --- a/aiogram/types/external_reply_info.py +++ b/aiogram/types/external_reply_info.py @@ -21,6 +21,7 @@ if TYPE_CHECKING: from .message_origin_chat import MessageOriginChat from .message_origin_hidden_user import MessageOriginHiddenUser from .message_origin_user import MessageOriginUser + from .paid_media_info import PaidMediaInfo from .photo_size import PhotoSize from .poll import Poll from .sticker import Sticker @@ -54,6 +55,8 @@ class ExternalReplyInfo(TelegramObject): """*Optional*. Message is an audio file, information about the file""" document: Optional[Document] = None """*Optional*. Message is a general file, information about the file""" + paid_media: Optional[PaidMediaInfo] = None + """*Optional*. Message contains paid media; information about the paid media""" photo: Optional[List[PhotoSize]] = None """*Optional*. Message is a photo, available sizes of the photo""" sticker: Optional[Sticker] = None @@ -103,6 +106,7 @@ class ExternalReplyInfo(TelegramObject): animation: Optional[Animation] = None, audio: Optional[Audio] = None, document: Optional[Document] = None, + paid_media: Optional[PaidMediaInfo] = None, photo: Optional[List[PhotoSize]] = None, sticker: Optional[Sticker] = None, story: Optional[Story] = None, @@ -133,6 +137,7 @@ class ExternalReplyInfo(TelegramObject): animation=animation, audio=audio, document=document, + paid_media=paid_media, photo=photo, sticker=sticker, story=story, diff --git a/aiogram/types/input_paid_media.py b/aiogram/types/input_paid_media.py new file mode 100644 index 00000000..9d3193d3 --- /dev/null +++ b/aiogram/types/input_paid_media.py @@ -0,0 +1,12 @@ +from .base import TelegramObject + + +class InputPaidMedia(TelegramObject): + """ + This object describes the paid media to be sent. Currently, it can be one of + + - :class:`aiogram.types.input_paid_media_photo.InputPaidMediaPhoto` + - :class:`aiogram.types.input_paid_media_video.InputPaidMediaVideo` + + Source: https://core.telegram.org/bots/api#inputpaidmedia + """ diff --git a/aiogram/types/input_paid_media_photo.py b/aiogram/types/input_paid_media_photo.py new file mode 100644 index 00000000..66b5201d --- /dev/null +++ b/aiogram/types/input_paid_media_photo.py @@ -0,0 +1,37 @@ +from __future__ import annotations + +from typing import TYPE_CHECKING, Any, Literal, Union + +from ..enums import InputPaidMediaType +from .input_paid_media import InputPaidMedia +from .input_file import InputFile + + +class InputPaidMediaPhoto(InputPaidMedia): + """ + The paid media to send is a photo. + + Source: https://core.telegram.org/bots/api#inputpaidmediaphoto + """ + + type: Literal[InputPaidMediaType.PHOTO] = InputPaidMediaType.PHOTO + """Type of the media, must be *photo*""" + media: Union[str, InputFile] + """File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass 'attach://' to upload a new one using multipart/form-data under name. :ref:`More information on Sending Files » `""" + + if TYPE_CHECKING: + # DO NOT EDIT MANUALLY!!! + # This section was auto-generated via `butcher` + + def __init__( + __pydantic__self__, + *, + type: Literal[InputPaidMediaType.PHOTO] = InputPaidMediaType.PHOTO, + media: Union[str, InputFile], + **__pydantic_kwargs: Any, + ) -> None: + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + # Is needed only for type checking and IDE support without any additional plugins + + super().__init__(type=type, media=media, **__pydantic_kwargs) diff --git a/aiogram/types/input_paid_media_video.py b/aiogram/types/input_paid_media_video.py new file mode 100644 index 00000000..4511afbb --- /dev/null +++ b/aiogram/types/input_paid_media_video.py @@ -0,0 +1,61 @@ +from __future__ import annotations + +from typing import TYPE_CHECKING, Any, Literal, Optional, Union + +from ..enums import InputPaidMediaType +from .input_file import InputFile +from .input_paid_media import InputPaidMedia + + +class InputPaidMediaVideo(InputPaidMedia): + """ + The paid media to send is a video. + + Source: https://core.telegram.org/bots/api#inputpaidmediavideo + """ + + type: Literal[InputPaidMediaType.VIDEO] = InputPaidMediaType.VIDEO + """Type of the media, must be *video*""" + media: Union[str, InputFile] + """File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass 'attach://' to upload a new one using multipart/form-data under name. :ref:`More information on Sending Files » `""" + thumbnail: Optional[Union[InputFile, str]] = None + """*Optional*. 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://' if the thumbnail was uploaded using multipart/form-data under . :ref:`More information on Sending Files » `""" + width: Optional[int] = None + """*Optional*. Video width""" + height: Optional[int] = None + """*Optional*. Video height""" + duration: Optional[int] = None + """*Optional*. Video duration in seconds""" + supports_streaming: Optional[bool] = None + """*Optional*. Pass :code:`True` if the uploaded video is suitable for streaming""" + + if TYPE_CHECKING: + # DO NOT EDIT MANUALLY!!! + # This section was auto-generated via `butcher` + + def __init__( + __pydantic__self__, + *, + type: Literal[InputPaidMediaType.VIDEO] = InputPaidMediaType.VIDEO, + media: Union[str, InputFile], + thumbnail: Optional[Union[InputFile, str]] = None, + width: Optional[int] = None, + height: Optional[int] = None, + duration: Optional[int] = None, + supports_streaming: Optional[bool] = None, + **__pydantic_kwargs: Any, + ) -> None: + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + # Is needed only for type checking and IDE support without any additional plugins + + super().__init__( + type=type, + media=media, + thumbnail=thumbnail, + width=width, + height=height, + duration=duration, + supports_streaming=supports_streaming, + **__pydantic_kwargs, + ) diff --git a/aiogram/types/input_poll_option.py b/aiogram/types/input_poll_option.py index 8cfe29ad..7bca9f6f 100644 --- a/aiogram/types/input_poll_option.py +++ b/aiogram/types/input_poll_option.py @@ -11,7 +11,7 @@ if TYPE_CHECKING: class InputPollOption(TelegramObject): """ - This object contains information about one answer option in a poll to send. + This object contains information about one answer option in a poll to be sent. Source: https://core.telegram.org/bots/api#inputpolloption """ diff --git a/aiogram/types/location.py b/aiogram/types/location.py index 50e55021..32673dae 100644 --- a/aiogram/types/location.py +++ b/aiogram/types/location.py @@ -13,9 +13,9 @@ class Location(TelegramObject): """ latitude: float - """Latitude as defined by sender""" + """Latitude as defined by the sender""" longitude: float - """Longitude as defined by sender""" + """Longitude as defined by the sender""" horizontal_accuracy: Optional[float] = None """*Optional*. The radius of uncertainty for the location, measured in meters; 0-1500""" live_period: Optional[int] = None diff --git a/aiogram/types/menu_button.py b/aiogram/types/menu_button.py index a06814c9..4c4fbf3b 100644 --- a/aiogram/types/menu_button.py +++ b/aiogram/types/menu_button.py @@ -26,7 +26,7 @@ class MenuButton(MutableTelegramObject): text: Optional[str] = None """*Optional*. Text on the button""" web_app: Optional[WebAppInfo] = None - """*Optional*. Description of the Web App that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the method :class:`aiogram.methods.answer_web_app_query.AnswerWebAppQuery`.""" + """*Optional*. Description of the Web App that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the method :class:`aiogram.methods.answer_web_app_query.AnswerWebAppQuery`. Alternatively, a :code:`t.me` link to a Web App of the bot can be specified in the object instead of the Web App's URL, in which case the Web App will be opened as if the user pressed the link.""" if TYPE_CHECKING: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/menu_button_web_app.py b/aiogram/types/menu_button_web_app.py index bd285211..0fc9e412 100644 --- a/aiogram/types/menu_button_web_app.py +++ b/aiogram/types/menu_button_web_app.py @@ -21,7 +21,7 @@ class MenuButtonWebApp(MenuButton): text: str """Text on the button""" web_app: WebAppInfo - """Description of the Web App that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the method :class:`aiogram.methods.answer_web_app_query.AnswerWebAppQuery`.""" + """Description of the Web App that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the method :class:`aiogram.methods.answer_web_app_query.AnswerWebAppQuery`. Alternatively, a :code:`t.me` link to a Web App of the bot can be specified in the object instead of the Web App's URL, in which case the Web App will be opened as if the user pressed the link.""" if TYPE_CHECKING: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/message.py b/aiogram/types/message.py index bf7f2139..d0bff9ef 100644 --- a/aiogram/types/message.py +++ b/aiogram/types/message.py @@ -10,11 +10,11 @@ from aiogram.utils.text_decorations import ( html_decoration, markdown_decoration, ) +from . import InputPaidMediaPhoto, InputPaidMediaVideo from ..client.default import Default from ..enums import ContentType from .custom import DateTime -from .input_poll_option import InputPollOption from .maybe_inaccessible_message import MaybeInaccessibleMessage if TYPE_CHECKING: @@ -48,6 +48,7 @@ if TYPE_CHECKING: SetMessageReaction, StopMessageLiveLocation, UnpinChatMessage, + SendPaidMedia, ) from .animation import Animation from .audio import Audio @@ -79,6 +80,7 @@ if TYPE_CHECKING: from .input_media_document import InputMediaDocument from .input_media_photo import InputMediaPhoto from .input_media_video import InputMediaVideo + from .input_poll_option import InputPollOption from .invoice import Invoice from .labeled_price import LabeledPrice from .link_preview_options import LinkPreviewOptions @@ -89,6 +91,7 @@ if TYPE_CHECKING: from .message_origin_chat import MessageOriginChat from .message_origin_hidden_user import MessageOriginHiddenUser from .message_origin_user import MessageOriginUser + from .paid_media_info import PaidMediaInfo from .passport_data import PassportData from .photo_size import PhotoSize from .poll import Poll @@ -184,6 +187,8 @@ class Message(MaybeInaccessibleMessage): """*Optional*. Message is an audio file, information about the file""" document: Optional[Document] = None """*Optional*. Message is a general file, information about the file""" + paid_media: Optional[PaidMediaInfo] = None + """*Optional*. Message contains paid media; information about the paid media""" photo: Optional[List[PhotoSize]] = None """*Optional*. Message is a photo, available sizes of the photo""" sticker: Optional[Sticker] = None @@ -197,7 +202,7 @@ class Message(MaybeInaccessibleMessage): voice: Optional[Voice] = None """*Optional*. Message is a voice message, information about the file""" caption: Optional[str] = None - """*Optional*. Caption for the animation, audio, document, photo, video or voice""" + """*Optional*. Caption for the animation, audio, document, paid media, photo, video or voice""" caption_entities: Optional[List[MessageEntity]] = None """*Optional*. For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in the caption""" show_caption_above_media: Optional[bool] = None @@ -371,6 +376,7 @@ class Message(MaybeInaccessibleMessage): animation: Optional[Animation] = None, audio: Optional[Audio] = None, document: Optional[Document] = None, + paid_media: Optional[PaidMediaInfo] = None, photo: Optional[List[PhotoSize]] = None, sticker: Optional[Sticker] = None, story: Optional[Story] = None, @@ -468,6 +474,7 @@ class Message(MaybeInaccessibleMessage): animation=animation, audio=audio, document=document, + paid_media=paid_media, photo=photo, sticker=sticker, story=story, @@ -590,6 +597,8 @@ class Message(MaybeInaccessibleMessage): return ContentType.SUPERGROUP_CHAT_CREATED if self.channel_chat_created: return ContentType.CHANNEL_CHAT_CREATED + if self.paid_media: + return ContentType.PAID_MEDIA if self.passport_data: return ContentType.PASSPORT_DATA if self.proximity_alert_triggered: @@ -3430,6 +3439,8 @@ class Message(MaybeInaccessibleMessage): **kwargs, ).as_(self._bot) if self.poll: + from .input_poll_option import InputPollOption + return SendPoll( question=self.poll.question, options=[ @@ -3483,7 +3494,7 @@ class Message(MaybeInaccessibleMessage): - :code:`from_chat_id` - :code:`message_id` - Use this method to copy messages of any kind. Service 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. + 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 @@ -4090,3 +4101,69 @@ class Message(MaybeInaccessibleMessage): is_big=is_big, **kwargs, ).as_(self._bot) + + def answer_paid_media( + self, + star_count: int, + media: List[Union[InputPaidMediaPhoto, InputPaidMediaVideo]], + caption: Optional[str] = None, + parse_mode: Optional[str] = None, + caption_entities: Optional[List[MessageEntity]] = None, + show_caption_above_media: Optional[bool] = None, + disable_notification: Optional[bool] = None, + protect_content: Optional[bool] = None, + reply_parameters: Optional[ReplyParameters] = None, + reply_markup: Optional[ + Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply] + ] = None, + **kwargs: Any, + ) -> SendPaidMedia: + """ + Shortcut for method :class:`aiogram.methods.send_paid_media.SendPaidMedia` + will automatically fill method attributes: + + - :code:`chat_id` + - :code:`message_thread_id` + - :code:`business_connection_id` + + Use this method to send paid media to channel chats. On success, the sent :class:`aiogram.types.message.Message` is returned. + + Source: https://core.telegram.org/bots/api#sendpaidmedia + + :param star_count: The number of Telegram Stars that must be paid to buy access to the media + :param media: A JSON-serialized array describing the media to be sent; up to 10 items + :param caption: Media caption, 0-1024 characters after entities parsing + :param parse_mode: Mode for parsing entities in the media caption. See `formatting options `_ for more details. + :param caption_entities: A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode* + :param show_caption_above_media: Pass :code:`True`, if the caption must be shown above the message media + :param disable_notification: Sends the message `silently `_. Users will receive a notification with no sound. + :param protect_content: Protects the contents of the sent message from forwarding and saving + :param reply_parameters: Description of the message to reply to + :param reply_markup: Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove a reply keyboard or to force a reply from the user + :return: instance of method :class:`aiogram.methods.send_paid_media.SendPaidMedia` + """ + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import SendPaidMedia + + assert ( + self.chat is not None + ), "This method can be used only if chat is present in the message." + + return SendPaidMedia( + chat_id=self.chat.id, + message_thread_id=self.message_thread_id if self.is_topic_message else None, + business_connection_id=self.business_connection_id, + star_count=star_count, + media=media, + 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, + reply_parameters=reply_parameters, + reply_markup=reply_markup, + **kwargs, + ).as_(self._bot) diff --git a/aiogram/types/paid_media.py b/aiogram/types/paid_media.py new file mode 100644 index 00000000..d17c44d3 --- /dev/null +++ b/aiogram/types/paid_media.py @@ -0,0 +1,13 @@ +from .base import TelegramObject + + +class PaidMedia(TelegramObject): + """ + This object describes paid media. Currently, it can be one of + + - :class:`aiogram.types.paid_media_preview.PaidMediaPreview` + - :class:`aiogram.types.paid_media_photo.PaidMediaPhoto` + - :class:`aiogram.types.paid_media_video.PaidMediaVideo` + + Source: https://core.telegram.org/bots/api#paidmedia + """ diff --git a/aiogram/types/paid_media_info.py b/aiogram/types/paid_media_info.py new file mode 100644 index 00000000..db5bbf0a --- /dev/null +++ b/aiogram/types/paid_media_info.py @@ -0,0 +1,40 @@ +from __future__ import annotations + +from typing import TYPE_CHECKING, Any, List, Union + +from .base import TelegramObject + +if TYPE_CHECKING: + from .paid_media_photo import PaidMediaPhoto + from .paid_media_preview import PaidMediaPreview + from .paid_media_video import PaidMediaVideo + + +class PaidMediaInfo(TelegramObject): + """ + Describes the paid media added to a message. + + Source: https://core.telegram.org/bots/api#paidmediainfo + """ + + star_count: int + """The number of Telegram Stars that must be paid to buy access to the media""" + paid_media: List[Union[PaidMediaPreview, PaidMediaPhoto, PaidMediaVideo]] + """Information about the paid media""" + + if TYPE_CHECKING: + # DO NOT EDIT MANUALLY!!! + # This section was auto-generated via `butcher` + + def __init__( + __pydantic__self__, + *, + star_count: int, + paid_media: List[Union[PaidMediaPreview, PaidMediaPhoto, PaidMediaVideo]], + **__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__(star_count=star_count, paid_media=paid_media, **__pydantic_kwargs) diff --git a/aiogram/types/paid_media_photo.py b/aiogram/types/paid_media_photo.py new file mode 100644 index 00000000..fed3747a --- /dev/null +++ b/aiogram/types/paid_media_photo.py @@ -0,0 +1,39 @@ +from __future__ import annotations + +from typing import TYPE_CHECKING, Any, List, Literal + +from .paid_media import PaidMedia +from ..enums import PaidMediaType + +if TYPE_CHECKING: + from .photo_size import PhotoSize + + +class PaidMediaPhoto(PaidMedia): + """ + The paid media is a photo. + + Source: https://core.telegram.org/bots/api#paidmediaphoto + """ + + type: Literal[PaidMediaType.PHOTO] = PaidMediaType.PHOTO + """Type of the paid media, always 'photo'""" + photo: List[PhotoSize] + """The photo""" + + if TYPE_CHECKING: + # DO NOT EDIT MANUALLY!!! + # This section was auto-generated via `butcher` + + def __init__( + __pydantic__self__, + *, + type: Literal[PaidMediaType.PHOTO] = PaidMediaType.PHOTO, + photo: List[PhotoSize], + **__pydantic_kwargs: Any, + ) -> None: + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + # Is needed only for type checking and IDE support without any additional plugins + + super().__init__(type=type, photo=photo, **__pydantic_kwargs) diff --git a/aiogram/types/paid_media_preview.py b/aiogram/types/paid_media_preview.py new file mode 100644 index 00000000..cd7980d3 --- /dev/null +++ b/aiogram/types/paid_media_preview.py @@ -0,0 +1,44 @@ +from __future__ import annotations + +from typing import TYPE_CHECKING, Any, Literal, Optional + +from .paid_media import PaidMedia +from ..enums import PaidMediaType + + +class PaidMediaPreview(PaidMedia): + """ + The paid media isn't available before the payment. + + Source: https://core.telegram.org/bots/api#paidmediapreview + """ + + type: Literal[PaidMediaType.PREVIEW] = PaidMediaType.PREVIEW + """Type of the paid media, always 'preview'""" + width: Optional[int] = None + """*Optional*. Media width as defined by the sender""" + height: Optional[int] = None + """*Optional*. Media height as defined by the sender""" + duration: Optional[int] = None + """*Optional*. Duration of the media in seconds as defined by the sender""" + + if TYPE_CHECKING: + # DO NOT EDIT MANUALLY!!! + # This section was auto-generated via `butcher` + + def __init__( + __pydantic__self__, + *, + type: Literal[PaidMediaType.PREVIEW] = PaidMediaType.PREVIEW, + width: Optional[int] = None, + height: Optional[int] = None, + duration: Optional[int] = None, + **__pydantic_kwargs: Any, + ) -> None: + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + # Is needed only for type checking and IDE support without any additional plugins + + super().__init__( + type=type, width=width, height=height, duration=duration, **__pydantic_kwargs + ) diff --git a/aiogram/types/paid_media_video.py b/aiogram/types/paid_media_video.py new file mode 100644 index 00000000..b2511ea9 --- /dev/null +++ b/aiogram/types/paid_media_video.py @@ -0,0 +1,39 @@ +from __future__ import annotations + +from typing import TYPE_CHECKING, Any, Literal + +from .paid_media import PaidMedia +from ..enums import PaidMediaType + +if TYPE_CHECKING: + from .video import Video + + +class PaidMediaVideo(PaidMedia): + """ + The paid media is a video. + + Source: https://core.telegram.org/bots/api#paidmediavideo + """ + + type: Literal[PaidMediaType.VIDEO] = PaidMediaType.VIDEO + """Type of the paid media, always 'video'""" + video: Video + """The video""" + + if TYPE_CHECKING: + # DO NOT EDIT MANUALLY!!! + # This section was auto-generated via `butcher` + + def __init__( + __pydantic__self__, + *, + type: Literal[PaidMediaType.VIDEO] = PaidMediaType.VIDEO, + video: Video, + **__pydantic_kwargs: Any, + ) -> None: + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + # Is needed only for type checking and IDE support without any additional plugins + + super().__init__(type=type, video=video, **__pydantic_kwargs) diff --git a/aiogram/types/pre_checkout_query.py b/aiogram/types/pre_checkout_query.py index 7733113f..41bda8ca 100644 --- a/aiogram/types/pre_checkout_query.py +++ b/aiogram/types/pre_checkout_query.py @@ -28,7 +28,7 @@ class PreCheckoutQuery(TelegramObject): total_amount: int """Total price in the *smallest units* of the currency (integer, **not** float/double). For example, for a price of :code:`US$ 1.45` pass :code:`amount = 145`. See the *exp* parameter in `currencies.json `_, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies).""" invoice_payload: str - """Bot specified invoice payload""" + """Bot-specified invoice payload""" shipping_option_id: Optional[str] = None """*Optional*. Identifier of the shipping option chosen by the user""" order_info: Optional[OrderInfo] = None diff --git a/aiogram/types/shipping_query.py b/aiogram/types/shipping_query.py index 8f3cd88d..61b4ae42 100644 --- a/aiogram/types/shipping_query.py +++ b/aiogram/types/shipping_query.py @@ -25,7 +25,7 @@ class ShippingQuery(TelegramObject): from_user: User = Field(..., alias="from") """User who sent the query""" invoice_payload: str - """Bot specified invoice payload""" + """Bot-specified invoice payload""" shipping_address: ShippingAddress """User specified shipping address""" diff --git a/aiogram/types/star_transaction.py b/aiogram/types/star_transaction.py index 9d6648d6..5d680af7 100644 --- a/aiogram/types/star_transaction.py +++ b/aiogram/types/star_transaction.py @@ -8,6 +8,7 @@ from .custom import DateTime if TYPE_CHECKING: from .transaction_partner_fragment import TransactionPartnerFragment from .transaction_partner_other import TransactionPartnerOther + from .transaction_partner_telegram_ads import TransactionPartnerTelegramAds from .transaction_partner_user import TransactionPartnerUser @@ -25,11 +26,21 @@ class StarTransaction(TelegramObject): date: DateTime """Date the transaction was created in Unix time""" source: Optional[ - Union[TransactionPartnerFragment, TransactionPartnerUser, TransactionPartnerOther] + Union[ + TransactionPartnerUser, + TransactionPartnerFragment, + TransactionPartnerTelegramAds, + TransactionPartnerOther, + ] ] = None """*Optional*. Source of an incoming transaction (e.g., a user purchasing goods or services, Fragment refunding a failed withdrawal). Only for incoming transactions""" receiver: Optional[ - Union[TransactionPartnerFragment, TransactionPartnerUser, TransactionPartnerOther] + Union[ + TransactionPartnerUser, + TransactionPartnerFragment, + TransactionPartnerTelegramAds, + TransactionPartnerOther, + ] ] = None """*Optional*. Receiver of an outgoing transaction (e.g., a user for a purchase refund, Fragment for a withdrawal). Only for outgoing transactions""" @@ -44,10 +55,20 @@ class StarTransaction(TelegramObject): amount: int, date: DateTime, source: Optional[ - Union[TransactionPartnerFragment, TransactionPartnerUser, TransactionPartnerOther] + Union[ + TransactionPartnerUser, + TransactionPartnerFragment, + TransactionPartnerTelegramAds, + TransactionPartnerOther, + ] ] = None, receiver: Optional[ - Union[TransactionPartnerFragment, TransactionPartnerUser, TransactionPartnerOther] + Union[ + TransactionPartnerUser, + TransactionPartnerFragment, + TransactionPartnerTelegramAds, + TransactionPartnerOther, + ] ] = None, **__pydantic_kwargs: Any, ) -> None: diff --git a/aiogram/types/successful_payment.py b/aiogram/types/successful_payment.py index c6543cec..30d43561 100644 --- a/aiogram/types/successful_payment.py +++ b/aiogram/types/successful_payment.py @@ -20,7 +20,7 @@ class SuccessfulPayment(TelegramObject): total_amount: int """Total price in the *smallest units* of the currency (integer, **not** float/double). For example, for a price of :code:`US$ 1.45` pass :code:`amount = 145`. See the *exp* parameter in `currencies.json `_, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies).""" invoice_payload: str - """Bot specified invoice payload""" + """Bot-specified invoice payload""" telegram_payment_charge_id: str """Telegram payment identifier""" provider_payment_charge_id: str diff --git a/aiogram/types/transaction_partner.py b/aiogram/types/transaction_partner.py index ddd6eabb..a26b0fcd 100644 --- a/aiogram/types/transaction_partner.py +++ b/aiogram/types/transaction_partner.py @@ -5,8 +5,9 @@ class TransactionPartner(TelegramObject): """ This object describes the source of a transaction, or its recipient for outgoing transactions. Currently, it can be one of - - :class:`aiogram.types.transaction_partner_fragment.TransactionPartnerFragment` - :class:`aiogram.types.transaction_partner_user.TransactionPartnerUser` + - :class:`aiogram.types.transaction_partner_fragment.TransactionPartnerFragment` + - :class:`aiogram.types.transaction_partner_telegram_ads.TransactionPartnerTelegramAds` - :class:`aiogram.types.transaction_partner_other.TransactionPartnerOther` Source: https://core.telegram.org/bots/api#transactionpartner diff --git a/aiogram/types/transaction_partner_telegram_ads.py b/aiogram/types/transaction_partner_telegram_ads.py new file mode 100644 index 00000000..5df8eb60 --- /dev/null +++ b/aiogram/types/transaction_partner_telegram_ads.py @@ -0,0 +1,35 @@ +from __future__ import annotations + +from typing import TYPE_CHECKING, Any, Literal + +from ..enums import TransactionPartnerType +from .transaction_partner import TransactionPartner + + +class TransactionPartnerTelegramAds(TransactionPartner): + """ + Describes a withdrawal transaction to the Telegram Ads platform. + + Source: https://core.telegram.org/bots/api#transactionpartnertelegramads + """ + + type: Literal[TransactionPartnerType.TELEGRAM_ADS] = TransactionPartnerType.TELEGRAM_ADS + """Type of the transaction partner, always 'telegram_ads'""" + + if TYPE_CHECKING: + # DO NOT EDIT MANUALLY!!! + # This section was auto-generated via `butcher` + + def __init__( + __pydantic__self__, + *, + type: Literal[ + TransactionPartnerType.TELEGRAM_ADS + ] = TransactionPartnerType.TELEGRAM_ADS, + **__pydantic_kwargs: Any, + ) -> None: + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + # Is needed only for type checking and IDE support without any additional plugins + + super().__init__(type=type, **__pydantic_kwargs) diff --git a/aiogram/types/transaction_partner_user.py b/aiogram/types/transaction_partner_user.py index de0b276f..4489dc11 100644 --- a/aiogram/types/transaction_partner_user.py +++ b/aiogram/types/transaction_partner_user.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Literal +from typing import TYPE_CHECKING, Any, Literal, Optional from ..enums import TransactionPartnerType from .transaction_partner import TransactionPartner @@ -20,6 +20,8 @@ class TransactionPartnerUser(TransactionPartner): """Type of the transaction partner, always 'user'""" user: User """Information about the user""" + invoice_payload: Optional[str] = None + """*Optional*. Bot-specified invoice payload""" if TYPE_CHECKING: # DO NOT EDIT MANUALLY!!! @@ -30,10 +32,13 @@ class TransactionPartnerUser(TransactionPartner): *, type: Literal[TransactionPartnerType.USER] = TransactionPartnerType.USER, user: User, + invoice_payload: 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__(type=type, user=user, **__pydantic_kwargs) + super().__init__( + type=type, user=user, invoice_payload=invoice_payload, **__pydantic_kwargs + ) diff --git a/aiogram/types/video.py b/aiogram/types/video.py index e9936091..e8ecf1f4 100644 --- a/aiogram/types/video.py +++ b/aiogram/types/video.py @@ -20,17 +20,17 @@ class Video(TelegramObject): file_unique_id: str """Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.""" width: int - """Video width as defined by sender""" + """Video width as defined by the sender""" height: int - """Video height as defined by sender""" + """Video height as defined by the sender""" duration: int - """Duration of the video in seconds as defined by sender""" + """Duration of the video in seconds as defined by the sender""" thumbnail: Optional[PhotoSize] = None """*Optional*. Video thumbnail""" file_name: Optional[str] = None - """*Optional*. Original filename as defined by sender""" + """*Optional*. Original filename as defined by the sender""" mime_type: Optional[str] = None - """*Optional*. MIME type of the file as defined by sender""" + """*Optional*. MIME type of the file as defined by the sender""" file_size: Optional[int] = None """*Optional*. File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value.""" diff --git a/aiogram/types/video_note.py b/aiogram/types/video_note.py index 4caa1170..5be85028 100644 --- a/aiogram/types/video_note.py +++ b/aiogram/types/video_note.py @@ -20,9 +20,9 @@ class VideoNote(TelegramObject): file_unique_id: str """Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.""" length: int - """Video width and height (diameter of the video message) as defined by sender""" + """Video width and height (diameter of the video message) as defined by the sender""" duration: int - """Duration of the video in seconds as defined by sender""" + """Duration of the video in seconds as defined by the sender""" thumbnail: Optional[PhotoSize] = None """*Optional*. Video thumbnail""" file_size: Optional[int] = None diff --git a/aiogram/types/voice.py b/aiogram/types/voice.py index d16729c9..d5e0abcd 100644 --- a/aiogram/types/voice.py +++ b/aiogram/types/voice.py @@ -17,9 +17,9 @@ class Voice(TelegramObject): file_unique_id: str """Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.""" duration: int - """Duration of the audio in seconds as defined by sender""" + """Duration of the audio in seconds as defined by the sender""" mime_type: Optional[str] = None - """*Optional*. MIME type of the file as defined by sender""" + """*Optional*. MIME type of the file as defined by the sender""" file_size: Optional[int] = None """*Optional*. File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value.""" diff --git a/docs/api/enums/index.rst b/docs/api/enums/index.rst index 79efa276..08f5457a 100644 --- a/docs/api/enums/index.rst +++ b/docs/api/enums/index.rst @@ -21,11 +21,13 @@ Here is list of all available enums: encrypted_passport_element inline_query_result_type input_media_type + input_paid_media_type keyboard_button_poll_type_type mask_position_point menu_button_type message_entity_type message_origin_type + paid_media_type parse_mode passport_element_error_type poll_type diff --git a/docs/api/enums/input_paid_media_type.rst b/docs/api/enums/input_paid_media_type.rst new file mode 100644 index 00000000..a666773f --- /dev/null +++ b/docs/api/enums/input_paid_media_type.rst @@ -0,0 +1,9 @@ +################## +InputPaidMediaType +################## + + +.. automodule:: aiogram.enums.input_paid_media_type + :members: + :member-order: bysource + :undoc-members: True diff --git a/docs/api/enums/paid_media_type.rst b/docs/api/enums/paid_media_type.rst new file mode 100644 index 00000000..1ad89633 --- /dev/null +++ b/docs/api/enums/paid_media_type.rst @@ -0,0 +1,9 @@ +############# +PaidMediaType +############# + + +.. automodule:: aiogram.enums.paid_media_type + :members: + :member-order: bysource + :undoc-members: True diff --git a/docs/api/methods/index.rst b/docs/api/methods/index.rst index 7666b799..f9de2188 100644 --- a/docs/api/methods/index.rst +++ b/docs/api/methods/index.rst @@ -90,6 +90,7 @@ Available methods send_location send_media_group send_message + send_paid_media send_photo send_poll send_venue diff --git a/docs/api/methods/send_paid_media.rst b/docs/api/methods/send_paid_media.rst new file mode 100644 index 00000000..1916511d --- /dev/null +++ b/docs/api/methods/send_paid_media.rst @@ -0,0 +1,51 @@ +############# +sendPaidMedia +############# + +Returns: :obj:`Message` + +.. automodule:: aiogram.methods.send_paid_media + :members: + :member-order: bysource + :undoc-members: True + :exclude-members: model_config,model_fields + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: Message = await bot.send_paid_media(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods.send_paid_media import SendPaidMedia` +- alias: :code:`from aiogram.methods import SendPaidMedia` + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + result: Message = await bot(SendPaidMedia(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + return SendPaidMedia(...) + + +As shortcut from received object +-------------------------------- + +- :meth:`aiogram.types.message.Message.answer_paid_media` diff --git a/docs/api/types/index.rst b/docs/api/types/index.rst index bf16d083..a007b354 100644 --- a/docs/api/types/index.rst +++ b/docs/api/types/index.rst @@ -95,6 +95,9 @@ Available types input_media_document input_media_photo input_media_video + input_paid_media + input_paid_media_photo + input_paid_media_video input_poll_option keyboard_button keyboard_button_poll_type @@ -120,6 +123,11 @@ Available types message_origin_user message_reaction_count_updated message_reaction_updated + paid_media + paid_media_info + paid_media_photo + paid_media_preview + paid_media_video photo_size poll poll_answer @@ -247,6 +255,7 @@ Payments transaction_partner transaction_partner_fragment transaction_partner_other + transaction_partner_telegram_ads transaction_partner_user Getting updates diff --git a/docs/api/types/input_paid_media.rst b/docs/api/types/input_paid_media.rst new file mode 100644 index 00000000..6d140432 --- /dev/null +++ b/docs/api/types/input_paid_media.rst @@ -0,0 +1,10 @@ +############## +InputPaidMedia +############## + + +.. automodule:: aiogram.types.input_paid_media + :members: + :member-order: bysource + :undoc-members: True + :exclude-members: model_config,model_fields diff --git a/docs/api/types/input_paid_media_photo.rst b/docs/api/types/input_paid_media_photo.rst new file mode 100644 index 00000000..ecaf00a6 --- /dev/null +++ b/docs/api/types/input_paid_media_photo.rst @@ -0,0 +1,10 @@ +################### +InputPaidMediaPhoto +################### + + +.. automodule:: aiogram.types.input_paid_media_photo + :members: + :member-order: bysource + :undoc-members: True + :exclude-members: model_config,model_fields diff --git a/docs/api/types/input_paid_media_video.rst b/docs/api/types/input_paid_media_video.rst new file mode 100644 index 00000000..305d8f04 --- /dev/null +++ b/docs/api/types/input_paid_media_video.rst @@ -0,0 +1,10 @@ +################### +InputPaidMediaVideo +################### + + +.. automodule:: aiogram.types.input_paid_media_video + :members: + :member-order: bysource + :undoc-members: True + :exclude-members: model_config,model_fields diff --git a/docs/api/types/paid_media.rst b/docs/api/types/paid_media.rst new file mode 100644 index 00000000..1e10cf31 --- /dev/null +++ b/docs/api/types/paid_media.rst @@ -0,0 +1,10 @@ +######### +PaidMedia +######### + + +.. automodule:: aiogram.types.paid_media + :members: + :member-order: bysource + :undoc-members: True + :exclude-members: model_config,model_fields diff --git a/docs/api/types/paid_media_info.rst b/docs/api/types/paid_media_info.rst new file mode 100644 index 00000000..94797a81 --- /dev/null +++ b/docs/api/types/paid_media_info.rst @@ -0,0 +1,10 @@ +############# +PaidMediaInfo +############# + + +.. automodule:: aiogram.types.paid_media_info + :members: + :member-order: bysource + :undoc-members: True + :exclude-members: model_config,model_fields diff --git a/docs/api/types/paid_media_photo.rst b/docs/api/types/paid_media_photo.rst new file mode 100644 index 00000000..e14f0c16 --- /dev/null +++ b/docs/api/types/paid_media_photo.rst @@ -0,0 +1,10 @@ +############## +PaidMediaPhoto +############## + + +.. automodule:: aiogram.types.paid_media_photo + :members: + :member-order: bysource + :undoc-members: True + :exclude-members: model_config,model_fields diff --git a/docs/api/types/paid_media_preview.rst b/docs/api/types/paid_media_preview.rst new file mode 100644 index 00000000..8a27b282 --- /dev/null +++ b/docs/api/types/paid_media_preview.rst @@ -0,0 +1,10 @@ +################ +PaidMediaPreview +################ + + +.. automodule:: aiogram.types.paid_media_preview + :members: + :member-order: bysource + :undoc-members: True + :exclude-members: model_config,model_fields diff --git a/docs/api/types/paid_media_video.rst b/docs/api/types/paid_media_video.rst new file mode 100644 index 00000000..0a2b9e3d --- /dev/null +++ b/docs/api/types/paid_media_video.rst @@ -0,0 +1,10 @@ +############## +PaidMediaVideo +############## + + +.. automodule:: aiogram.types.paid_media_video + :members: + :member-order: bysource + :undoc-members: True + :exclude-members: model_config,model_fields diff --git a/docs/api/types/transaction_partner_telegram_ads.rst b/docs/api/types/transaction_partner_telegram_ads.rst new file mode 100644 index 00000000..545d277e --- /dev/null +++ b/docs/api/types/transaction_partner_telegram_ads.rst @@ -0,0 +1,10 @@ +############################# +TransactionPartnerTelegramAds +############################# + + +.. automodule:: aiogram.types.transaction_partner_telegram_ads + :members: + :member-order: bysource + :undoc-members: True + :exclude-members: model_config,model_fields diff --git a/examples/multibot.py b/examples/multibot.py index d5dbe5fc..82fac4a1 100644 --- a/examples/multibot.py +++ b/examples/multibot.py @@ -4,7 +4,6 @@ from os import getenv from typing import Any, Dict, Union from aiohttp import web -from finite_state_machine import form_router from aiogram import Bot, Dispatcher, F, Router from aiogram.client.session.aiohttp import AiohttpSession @@ -19,6 +18,7 @@ from aiogram.webhook.aiohttp_server import ( TokenBasedRequestHandler, setup_application, ) +from finite_state_machine import form_router main_router = Router() diff --git a/tests/test_api/test_methods/test_send_paid_media.py b/tests/test_api/test_methods/test_send_paid_media.py new file mode 100755 index 00000000..e9f9588e --- /dev/null +++ b/tests/test_api/test_methods/test_send_paid_media.py @@ -0,0 +1,43 @@ +import datetime + +from aiogram.methods import SendPaidMedia +from aiogram.types import ( + Message, + Chat, + PaidMediaPhoto, + PaidMediaInfo, + PhotoSize, + InputPaidMediaPhoto, +) +from tests.mocked_bot import MockedBot + + +class TestSendPaidMedia: + async def test_bot_method(self, bot: MockedBot): + prepare_result = bot.add_result_for( + SendPaidMedia, + ok=True, + result=Message( + message_id=42, + date=datetime.datetime.now(), + chat=Chat(id=42, type="private"), + paid_media=PaidMediaInfo( + paid_media=[ + PaidMediaPhoto( + photo=[ + PhotoSize( + file_id="test", width=42, height=42, file_unique_id="test" + ) + ] + ) + ], + star_count=1, + ), + ), + ) + + response: Message = await bot.send_paid_media( + chat_id=-42, star_count=1, media=[InputPaidMediaPhoto(media="file_id")] + ) + request = bot.get_request() + assert response == prepare_result.result diff --git a/tests/test_api/test_types/test_message.py b/tests/test_api/test_types/test_message.py index be29070e..78649c1c 100644 --- a/tests/test_api/test_types/test_message.py +++ b/tests/test_api/test_types/test_message.py @@ -35,6 +35,7 @@ from aiogram.methods import ( StopMessageLiveLocation, TelegramMethod, UnpinChatMessage, + SendPaidMedia, ) from aiogram.types import ( UNSET_PARSE_MODE, @@ -68,6 +69,8 @@ from aiogram.types import ( Location, MessageAutoDeleteTimerChanged, MessageEntity, + PaidMediaInfo, + PaidMediaPhoto, PassportData, PhotoSize, Poll, @@ -331,6 +334,22 @@ TEST_MESSAGE_CHANNEL_CHAT_CREATED = Message( chat=Chat(id=-10042, type="channel"), from_user=User(id=42, is_bot=False, first_name="Test"), ) +TEST_MESSAGE_PAID_MEDIA = Message( + message_id=42, + date=datetime.datetime.now(), + paid_media=PaidMediaInfo( + star_count=100500, + paid_media=[ + PaidMediaPhoto( + photo=[ + PhotoSize(file_id="file id", file_unique_id="file id", width=42, height=42) + ], + ) + ], + ), + chat=Chat(id=42, type="private"), + from_user=User(id=42, is_bot=False, first_name="Test"), +) TEST_MESSAGE_PASSPORT_DATA = Message( message_id=42, date=datetime.datetime.now(), @@ -603,6 +622,7 @@ MESSAGES_AND_CONTENT_TYPES = [ [TEST_MESSAGE_GROUP_CHAT_CREATED, ContentType.GROUP_CHAT_CREATED], [TEST_MESSAGE_SUPERGROUP_CHAT_CREATED, ContentType.SUPERGROUP_CHAT_CREATED], [TEST_MESSAGE_CHANNEL_CHAT_CREATED, ContentType.CHANNEL_CHAT_CREATED], + [TEST_MESSAGE_PAID_MEDIA, ContentType.PAID_MEDIA], [TEST_MESSAGE_PASSPORT_DATA, ContentType.PASSPORT_DATA], [TEST_MESSAGE_PROXIMITY_ALERT_TRIGGERED, ContentType.PROXIMITY_ALERT_TRIGGERED], [TEST_MESSAGE_POLL, ContentType.POLL], @@ -669,6 +689,7 @@ MESSAGES_AND_COPY_METHODS = [ [TEST_MESSAGE_GROUP_CHAT_CREATED, None], [TEST_MESSAGE_SUPERGROUP_CHAT_CREATED, None], [TEST_MESSAGE_CHANNEL_CHAT_CREATED, None], + [TEST_MESSAGE_PAID_MEDIA, None], [TEST_MESSAGE_PASSPORT_DATA, None], [TEST_MESSAGE_PROXIMITY_ALERT_TRIGGERED, None], [TEST_MESSAGE_POLL, SendPoll], @@ -778,6 +799,7 @@ class TestMessage: ["video", dict(video="video"), SendVideo], ["video_note", dict(video_note="video_note"), SendVideoNote], ["voice", dict(voice="voice"), SendVoice], + ["paid_media", dict(media=[], star_count=42), SendPaidMedia], ], ) @pytest.mark.parametrize("alias_type", ["reply", "answer"]) @@ -805,9 +827,14 @@ class TestMessage: SendVideo, SendVideoNote, SendVoice, + SendPaidMedia, ] ], ): + if alias_for_method == "paid_media" and alias_type == "reply": + # Replies should be completely reworked + pytest.skip("Reply alias for paid media is not implemented yet.") + message = Message( message_id=42, chat=Chat(id=42, type="private"), date=datetime.datetime.now() ) @@ -820,10 +847,11 @@ class TestMessage: assert isinstance(api_method, method_class) assert api_method.chat_id == message.chat.id - if alias_type == "reply": - assert api_method.reply_to_message_id == message.message_id - else: - assert api_method.reply_to_message_id is None + if hasattr(api_method, "reply_to_message_id"): + if alias_type == "reply": + assert api_method.reply_to_message_id == message.message_id + else: + assert api_method.reply_to_message_id is None for key, value in kwargs.items(): assert getattr(api_method, key) == value