Added full support of Bot API 7.6 (#1533)

* Added full support of Bot API 7.6

* Fixed imports

* fix tests (#1534)

* Fixed coverage

* Override InputPaidMedia media type to `str | InputFile`

* Added shortcut

* Fixed PaidMediaType enum

* Added changelog

---------

Co-authored-by: Oleg A <t0rr@mail.ru>
This commit is contained in:
Alex Root Junior 2024-07-06 20:31:49 +03:00 committed by GitHub
parent 3baa7383c1
commit 11efa8e186
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
97 changed files with 2058 additions and 274 deletions

View file

@ -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

View file

@ -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

View file

@ -10,3 +10,4 @@ multi_parse:
- TransactionPartnerFragment - TransactionPartnerFragment
- TransactionPartnerOther - TransactionPartnerOther
- TransactionPartnerUser - TransactionPartnerUser
- TransactionPartnerTelegramAds

View file

@ -7,9 +7,9 @@
"object": { "object": {
"anchor": "copymessage", "anchor": "copymessage",
"name": "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.", "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": "<p>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 <a href=\"#poll\">poll</a> can be copied only if the value of the field <em>correct_option_id</em> is known to the bot. The method is analogous to the method <a href=\"#forwardmessage\">forwardMessage</a>, but the copied message doesn't have a link to the original message. Returns the <a href=\"#messageid\">MessageId</a> of the sent message on success.</p>", "html_description": "<p>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 <a href=\"#poll\">poll</a> can be copied only if the value of the field <em>correct_option_id</em> is known to the bot. The method is analogous to the method <a href=\"#forwardmessage\">forwardMessage</a>, but the copied message doesn't have a link to the original message. Returns the <a href=\"#messageid\">MessageId</a> of the sent message on success.</p>",
"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.", "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": [ "annotations": [
{ {
"type": "Integer or String", "type": "Integer or String",

View file

@ -7,9 +7,9 @@
"object": { "object": {
"anchor": "copymessages", "anchor": "copymessages",
"name": "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.", "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": "<p>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 <a href=\"#poll\">poll</a> can be copied only if the value of the field <em>correct_option_id</em> is known to the bot. The method is analogous to the method <a href=\"#forwardmessages\">forwardMessages</a>, 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 <a href=\"#messageid\">MessageId</a> of the sent messages is returned.</p>", "html_description": "<p>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 <a href=\"#poll\">poll</a> can be copied only if the value of the field <em>correct_option_id</em> is known to the bot. The method is analogous to the method <a href=\"#forwardmessages\">forwardMessages</a>, 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 <a href=\"#messageid\">MessageId</a> of the sent messages is returned.</p>",
"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.", "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": [ "annotations": [
{ {
"type": "Integer or String", "type": "Integer or String",

View file

@ -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": "<p>Use this method to send paid media to channel chats. On success, the sent <a href=\"#message\">Message</a> is returned.</p>",
"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": "<td>Unique identifier for the target chat or username of the target channel (in the format <code>@channelusername</code>)</td>",
"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": "<td>The number of Telegram Stars that must be paid to buy access to the media</td>",
"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": "<td>A JSON-serialized array describing the media to be sent; up to 10 items</td>",
"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": "<td>Media caption, 0-1024 characters after entities parsing</td>",
"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": "<td>Mode for parsing entities in the media caption. See <a href=\"#formatting-options\">formatting options</a> for more details.</td>",
"rst_description": "Mode for parsing entities in the media caption. See `formatting options <https://core.telegram.org/bots/api#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": "<td>A JSON-serialized list of special entities that appear in the caption, which can be specified instead of <em>parse_mode</em></td>",
"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": "<td>Pass <em>True</em>, if the caption must be shown above the message media</td>",
"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": "<td>Sends the message <a href=\"https://telegram.org/blog/channels-2-0#silent-messages\">silently</a>. Users will receive a notification with no sound.</td>",
"rst_description": "Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. 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": "<td>Protects the contents of the sent message from forwarding and saving</td>",
"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": "<td>Description of the message to reply to</td>",
"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": "<td>Additional interface options. A JSON-serialized object for an <a href=\"/bots/features#inline-keyboards\">inline keyboard</a>, <a href=\"/bots/features#keyboards\">custom reply keyboard</a>, instructions to remove a reply keyboard or to force a reply from the user</td>",
"rst_description": "Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user\n",
"name": "reply_markup"
}
],
"category": "methods"
}
}

View file

@ -1,7 +1,7 @@
{ {
"api": { "api": {
"version": "7.5", "version": "7.6",
"release_date": "2024-06-18" "release_date": "2024-07-01"
}, },
"items": [ "items": [
{ {
@ -853,6 +853,14 @@
"name": "permissions", "name": "permissions",
"required": false "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": "<td><em>Optional</em>. <em>True</em>, if paid media messages can be sent or forwarded to the channel chat. The field is available only for channel chats.</td>",
"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", "type": "Integer",
"description": "For supergroups, the minimum allowed delay between consecutive messages sent by each unprivileged user; in seconds", "description": "For supergroups, the minimum allowed delay between consecutive messages sent by each unprivileged user; in seconds",
@ -1191,6 +1199,14 @@
"name": "document", "name": "document",
"required": false "required": false
}, },
{
"type": "PaidMediaInfo",
"description": "Message contains paid media; information about the paid media",
"html_description": "<td><em>Optional</em>. Message contains paid media; information about the paid media</td>",
"rst_description": "*Optional*. Message contains paid media; information about the paid media\n",
"name": "paid_media",
"required": false
},
{ {
"type": "Array of PhotoSize", "type": "Array of PhotoSize",
"description": "Message is a photo, available sizes of the photo", "description": "Message is a photo, available sizes of the photo",
@ -1241,9 +1257,9 @@
}, },
{ {
"type": "String", "type": "String",
"description": "Caption for the animation, audio, document, photo, video or voice", "description": "Caption for the animation, audio, document, paid media, photo, video or voice",
"html_description": "<td><em>Optional</em>. Caption for the animation, audio, document, photo, video or voice</td>", "html_description": "<td><em>Optional</em>. Caption for the animation, audio, document, paid media, photo, video or voice</td>",
"rst_description": "*Optional*. Caption for the animation, audio, document, photo, video or voice\n", "rst_description": "*Optional*. Caption for the animation, audio, document, paid media, photo, video or voice\n",
"name": "caption", "name": "caption",
"required": false "required": false
}, },
@ -1858,6 +1874,14 @@
"name": "document", "name": "document",
"required": false "required": false
}, },
{
"type": "PaidMediaInfo",
"description": "Message contains paid media; information about the paid media",
"html_description": "<td><em>Optional</em>. Message contains paid media; information about the paid media</td>",
"rst_description": "*Optional*. Message contains paid media; information about the paid media\n",
"name": "paid_media",
"required": false
},
{ {
"type": "Array of PhotoSize", "type": "Array of PhotoSize",
"description": "Message is a photo, available sizes of the photo", "description": "Message is a photo, available sizes of the photo",
@ -2299,49 +2323,49 @@
}, },
{ {
"type": "Integer", "type": "Integer",
"description": "Video width as defined by sender", "description": "Video width as defined by the sender",
"html_description": "<td>Video width as defined by sender</td>", "html_description": "<td>Video width as defined by the sender</td>",
"rst_description": "Video width as defined by sender\n", "rst_description": "Video width as defined by the sender\n",
"name": "width", "name": "width",
"required": true "required": true
}, },
{ {
"type": "Integer", "type": "Integer",
"description": "Video height as defined by sender", "description": "Video height as defined by the sender",
"html_description": "<td>Video height as defined by sender</td>", "html_description": "<td>Video height as defined by the sender</td>",
"rst_description": "Video height as defined by sender\n", "rst_description": "Video height as defined by the sender\n",
"name": "height", "name": "height",
"required": true "required": true
}, },
{ {
"type": "Integer", "type": "Integer",
"description": "Duration of the video in seconds as defined by sender", "description": "Duration of the video in seconds as defined by the sender",
"html_description": "<td>Duration of the video in seconds as defined by sender</td>", "html_description": "<td>Duration of the video in seconds as defined by the sender</td>",
"rst_description": "Duration of the video in seconds as defined by sender\n", "rst_description": "Duration of the video in seconds as defined by the sender\n",
"name": "duration", "name": "duration",
"required": true "required": true
}, },
{ {
"type": "PhotoSize", "type": "PhotoSize",
"description": "Animation thumbnail as defined by sender", "description": "Animation thumbnail as defined by the sender",
"html_description": "<td><em>Optional</em>. Animation thumbnail as defined by sender</td>", "html_description": "<td><em>Optional</em>. Animation thumbnail as defined by the sender</td>",
"rst_description": "*Optional*. Animation thumbnail as defined by sender\n", "rst_description": "*Optional*. Animation thumbnail as defined by the sender\n",
"name": "thumbnail", "name": "thumbnail",
"required": false "required": false
}, },
{ {
"type": "String", "type": "String",
"description": "Original animation filename as defined by sender", "description": "Original animation filename as defined by the sender",
"html_description": "<td><em>Optional</em>. Original animation filename as defined by sender</td>", "html_description": "<td><em>Optional</em>. Original animation filename as defined by the sender</td>",
"rst_description": "*Optional*. Original animation filename as defined by sender\n", "rst_description": "*Optional*. Original animation filename as defined by the sender\n",
"name": "file_name", "name": "file_name",
"required": false "required": false
}, },
{ {
"type": "String", "type": "String",
"description": "MIME type of the file as defined by sender", "description": "MIME type of the file as defined by the sender",
"html_description": "<td><em>Optional</em>. MIME type of the file as defined by sender</td>", "html_description": "<td><em>Optional</em>. MIME type of the file as defined by the sender</td>",
"rst_description": "*Optional*. MIME type of the file as defined by sender\n", "rst_description": "*Optional*. MIME type of the file as defined by the sender\n",
"name": "mime_type", "name": "mime_type",
"required": false "required": false
}, },
@ -2381,41 +2405,41 @@
}, },
{ {
"type": "Integer", "type": "Integer",
"description": "Duration of the audio in seconds as defined by sender", "description": "Duration of the audio in seconds as defined by the sender",
"html_description": "<td>Duration of the audio in seconds as defined by sender</td>", "html_description": "<td>Duration of the audio in seconds as defined by the sender</td>",
"rst_description": "Duration of the audio in seconds as defined by sender\n", "rst_description": "Duration of the audio in seconds as defined by the sender\n",
"name": "duration", "name": "duration",
"required": true "required": true
}, },
{ {
"type": "String", "type": "String",
"description": "Performer of the audio as defined by sender or by audio tags", "description": "Performer of the audio as defined by the sender or by audio tags",
"html_description": "<td><em>Optional</em>. Performer of the audio as defined by sender or by audio tags</td>", "html_description": "<td><em>Optional</em>. Performer of the audio as defined by the sender or by audio tags</td>",
"rst_description": "*Optional*. Performer of the audio as defined by sender or by audio tags\n", "rst_description": "*Optional*. Performer of the audio as defined by the sender or by audio tags\n",
"name": "performer", "name": "performer",
"required": false "required": false
}, },
{ {
"type": "String", "type": "String",
"description": "Title of the audio as defined by sender or by audio tags", "description": "Title of the audio as defined by the sender or by audio tags",
"html_description": "<td><em>Optional</em>. Title of the audio as defined by sender or by audio tags</td>", "html_description": "<td><em>Optional</em>. Title of the audio as defined by the sender or by audio tags</td>",
"rst_description": "*Optional*. Title of the audio as defined by sender or by audio tags\n", "rst_description": "*Optional*. Title of the audio as defined by the sender or by audio tags\n",
"name": "title", "name": "title",
"required": false "required": false
}, },
{ {
"type": "String", "type": "String",
"description": "Original filename as defined by sender", "description": "Original filename as defined by the sender",
"html_description": "<td><em>Optional</em>. Original filename as defined by sender</td>", "html_description": "<td><em>Optional</em>. Original filename as defined by the sender</td>",
"rst_description": "*Optional*. Original filename as defined by sender\n", "rst_description": "*Optional*. Original filename as defined by the sender\n",
"name": "file_name", "name": "file_name",
"required": false "required": false
}, },
{ {
"type": "String", "type": "String",
"description": "MIME type of the file as defined by sender", "description": "MIME type of the file as defined by the sender",
"html_description": "<td><em>Optional</em>. MIME type of the file as defined by sender</td>", "html_description": "<td><em>Optional</em>. MIME type of the file as defined by the sender</td>",
"rst_description": "*Optional*. MIME type of the file as defined by sender\n", "rst_description": "*Optional*. MIME type of the file as defined by the sender\n",
"name": "mime_type", "name": "mime_type",
"required": false "required": false
}, },
@ -2463,25 +2487,25 @@
}, },
{ {
"type": "PhotoSize", "type": "PhotoSize",
"description": "Document thumbnail as defined by sender", "description": "Document thumbnail as defined by the sender",
"html_description": "<td><em>Optional</em>. Document thumbnail as defined by sender</td>", "html_description": "<td><em>Optional</em>. Document thumbnail as defined by the sender</td>",
"rst_description": "*Optional*. Document thumbnail as defined by sender\n", "rst_description": "*Optional*. Document thumbnail as defined by the sender\n",
"name": "thumbnail", "name": "thumbnail",
"required": false "required": false
}, },
{ {
"type": "String", "type": "String",
"description": "Original filename as defined by sender", "description": "Original filename as defined by the sender",
"html_description": "<td><em>Optional</em>. Original filename as defined by sender</td>", "html_description": "<td><em>Optional</em>. Original filename as defined by the sender</td>",
"rst_description": "*Optional*. Original filename as defined by sender\n", "rst_description": "*Optional*. Original filename as defined by the sender\n",
"name": "file_name", "name": "file_name",
"required": false "required": false
}, },
{ {
"type": "String", "type": "String",
"description": "MIME type of the file as defined by sender", "description": "MIME type of the file as defined by the sender",
"html_description": "<td><em>Optional</em>. MIME type of the file as defined by sender</td>", "html_description": "<td><em>Optional</em>. MIME type of the file as defined by the sender</td>",
"rst_description": "*Optional*. MIME type of the file as defined by sender\n", "rst_description": "*Optional*. MIME type of the file as defined by the sender\n",
"name": "mime_type", "name": "mime_type",
"required": false "required": false
}, },
@ -2547,25 +2571,25 @@
}, },
{ {
"type": "Integer", "type": "Integer",
"description": "Video width as defined by sender", "description": "Video width as defined by the sender",
"html_description": "<td>Video width as defined by sender</td>", "html_description": "<td>Video width as defined by the sender</td>",
"rst_description": "Video width as defined by sender\n", "rst_description": "Video width as defined by the sender\n",
"name": "width", "name": "width",
"required": true "required": true
}, },
{ {
"type": "Integer", "type": "Integer",
"description": "Video height as defined by sender", "description": "Video height as defined by the sender",
"html_description": "<td>Video height as defined by sender</td>", "html_description": "<td>Video height as defined by the sender</td>",
"rst_description": "Video height as defined by sender\n", "rst_description": "Video height as defined by the sender\n",
"name": "height", "name": "height",
"required": true "required": true
}, },
{ {
"type": "Integer", "type": "Integer",
"description": "Duration of the video in seconds as defined by sender", "description": "Duration of the video in seconds as defined by the sender",
"html_description": "<td>Duration of the video in seconds as defined by sender</td>", "html_description": "<td>Duration of the video in seconds as defined by the sender</td>",
"rst_description": "Duration of the video in seconds as defined by sender\n", "rst_description": "Duration of the video in seconds as defined by the sender\n",
"name": "duration", "name": "duration",
"required": true "required": true
}, },
@ -2579,17 +2603,17 @@
}, },
{ {
"type": "String", "type": "String",
"description": "Original filename as defined by sender", "description": "Original filename as defined by the sender",
"html_description": "<td><em>Optional</em>. Original filename as defined by sender</td>", "html_description": "<td><em>Optional</em>. Original filename as defined by the sender</td>",
"rst_description": "*Optional*. Original filename as defined by sender\n", "rst_description": "*Optional*. Original filename as defined by the sender\n",
"name": "file_name", "name": "file_name",
"required": false "required": false
}, },
{ {
"type": "String", "type": "String",
"description": "MIME type of the file as defined by sender", "description": "MIME type of the file as defined by the sender",
"html_description": "<td><em>Optional</em>. MIME type of the file as defined by sender</td>", "html_description": "<td><em>Optional</em>. MIME type of the file as defined by the sender</td>",
"rst_description": "*Optional*. MIME type of the file as defined by sender\n", "rst_description": "*Optional*. MIME type of the file as defined by the sender\n",
"name": "mime_type", "name": "mime_type",
"required": false "required": false
}, },
@ -2629,17 +2653,17 @@
}, },
{ {
"type": "Integer", "type": "Integer",
"description": "Video width and height (diameter of the video message) as defined by sender", "description": "Video width and height (diameter of the video message) as defined by the sender",
"html_description": "<td>Video width and height (diameter of the video message) as defined by sender</td>", "html_description": "<td>Video width and height (diameter of the video message) as defined by the sender</td>",
"rst_description": "Video width and height (diameter of the video message) as defined by sender\n", "rst_description": "Video width and height (diameter of the video message) as defined by the sender\n",
"name": "length", "name": "length",
"required": true "required": true
}, },
{ {
"type": "Integer", "type": "Integer",
"description": "Duration of the video in seconds as defined by sender", "description": "Duration of the video in seconds as defined by the sender",
"html_description": "<td>Duration of the video in seconds as defined by sender</td>", "html_description": "<td>Duration of the video in seconds as defined by the sender</td>",
"rst_description": "Duration of the video in seconds as defined by sender\n", "rst_description": "Duration of the video in seconds as defined by the sender\n",
"name": "duration", "name": "duration",
"required": true "required": true
}, },
@ -2687,17 +2711,17 @@
}, },
{ {
"type": "Integer", "type": "Integer",
"description": "Duration of the audio in seconds as defined by sender", "description": "Duration of the audio in seconds as defined by the sender",
"html_description": "<td>Duration of the audio in seconds as defined by sender</td>", "html_description": "<td>Duration of the audio in seconds as defined by the sender</td>",
"rst_description": "Duration of the audio in seconds as defined by sender\n", "rst_description": "Duration of the audio in seconds as defined by the sender\n",
"name": "duration", "name": "duration",
"required": true "required": true
}, },
{ {
"type": "String", "type": "String",
"description": "MIME type of the file as defined by sender", "description": "MIME type of the file as defined by the sender",
"html_description": "<td><em>Optional</em>. MIME type of the file as defined by sender</td>", "html_description": "<td><em>Optional</em>. MIME type of the file as defined by the sender</td>",
"rst_description": "*Optional*. MIME type of the file as defined by sender\n", "rst_description": "*Optional*. MIME type of the file as defined by the sender\n",
"name": "mime_type", "name": "mime_type",
"required": false "required": false
}, },
@ -2712,6 +2736,135 @@
], ],
"category": "types" "category": "types"
}, },
{
"anchor": "paidmediainfo",
"name": "PaidMediaInfo",
"description": "Describes the paid media added to a message.",
"html_description": "<p>Describes the paid media added to a message.</p>",
"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": "<td>The number of Telegram Stars that must be paid to buy access to the media</td>",
"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": "<td>Information about the paid media</td>",
"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": "<p>This object describes paid media. Currently, it can be one of</p><ul>\n<li><a href=\"#paidmediapreview\">PaidMediaPreview</a></li>\n<li><a href=\"#paidmediaphoto\">PaidMediaPhoto</a></li>\n<li><a href=\"#paidmediavideo\">PaidMediaVideo</a></li>\n</ul>",
"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": "<p>The paid media isn't available before the payment.</p>",
"rst_description": "The paid media isn't available before the payment.",
"annotations": [
{
"type": "String",
"description": "Type of the paid media, always 'preview'",
"html_description": "<td>Type of the paid media, always &#8220;preview&#8221;</td>",
"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": "<td><em>Optional</em>. Media width as defined by the sender</td>",
"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": "<td><em>Optional</em>. Media height as defined by the sender</td>",
"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": "<td><em>Optional</em>. Duration of the media in seconds as defined by the sender</td>",
"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": "<p>The paid media is a photo.</p>",
"rst_description": "The paid media is a photo.",
"annotations": [
{
"type": "String",
"description": "Type of the paid media, always 'photo'",
"html_description": "<td>Type of the paid media, always &#8220;photo&#8221;</td>",
"rst_description": "Type of the paid media, always 'photo'\n",
"name": "type",
"required": true
},
{
"type": "Array of PhotoSize",
"description": "The photo",
"html_description": "<td>The photo</td>",
"rst_description": "The photo\n",
"name": "photo",
"required": true
}
],
"category": "types"
},
{
"anchor": "paidmediavideo",
"name": "PaidMediaVideo",
"description": "The paid media is a video.",
"html_description": "<p>The paid media is a video.</p>",
"rst_description": "The paid media is a video.",
"annotations": [
{
"type": "String",
"description": "Type of the paid media, always 'video'",
"html_description": "<td>Type of the paid media, always &#8220;video&#8221;</td>",
"rst_description": "Type of the paid media, always 'video'\n",
"name": "type",
"required": true
},
{
"type": "Video",
"description": "The video",
"html_description": "<td>The video</td>",
"rst_description": "The video\n",
"name": "video",
"required": true
}
],
"category": "types"
},
{ {
"anchor": "contact", "anchor": "contact",
"name": "Contact", "name": "Contact",
@ -2825,9 +2978,9 @@
{ {
"anchor": "inputpolloption", "anchor": "inputpolloption",
"name": "InputPollOption", "name": "InputPollOption",
"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": "<p>This object contains information about one answer option in a poll to send.</p>", "html_description": "<p>This object contains information about one answer option in a poll to be sent.</p>",
"rst_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 be sent.",
"annotations": [ "annotations": [
{ {
"type": "String", "type": "String",
@ -3029,17 +3182,17 @@
"annotations": [ "annotations": [
{ {
"type": "Float", "type": "Float",
"description": "Latitude as defined by sender", "description": "Latitude as defined by the sender",
"html_description": "<td>Latitude as defined by sender</td>", "html_description": "<td>Latitude as defined by the sender</td>",
"rst_description": "Latitude as defined by sender\n", "rst_description": "Latitude as defined by the sender\n",
"name": "latitude", "name": "latitude",
"required": true "required": true
}, },
{ {
"type": "Float", "type": "Float",
"description": "Longitude as defined by sender", "description": "Longitude as defined by the sender",
"html_description": "<td>Longitude as defined by sender</td>", "html_description": "<td>Longitude as defined by the sender</td>",
"rst_description": "Longitude as defined by sender\n", "rst_description": "Longitude as defined by the sender\n",
"name": "longitude", "name": "longitude",
"required": true "required": true
}, },
@ -6509,9 +6662,9 @@
}, },
{ {
"type": "WebAppInfo", "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.", "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": "<td>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 <a href=\"#answerwebappquery\">answerWebAppQuery</a>.</td>", "html_description": "<td>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 <a href=\"#answerwebappquery\">answerWebAppQuery</a>. Alternatively, a <code>t.me</code> 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.</td>",
"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", "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", "name": "web_app",
"required": true "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.", "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": [], "annotations": [],
"category": "types" "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": "<p>This object describes the paid media to be sent. Currently, it can be one of</p><ul>\n<li><a href=\"#inputpaidmediaphoto\">InputPaidMediaPhoto</a></li>\n<li><a href=\"#inputpaidmediavideo\">InputPaidMediaVideo</a></li>\n</ul>",
"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": "<p>The paid media to send is a photo.</p>",
"rst_description": "The paid media to send is a photo.",
"annotations": [
{
"type": "String",
"description": "Type of the media, must be photo",
"html_description": "<td>Type of the media, must be <em>photo</em></td>",
"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://<file_attach_name>' to upload a new one using multipart/form-data under <file_attach_name> name. More information on Sending Files",
"html_description": "<td>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 &#8220;attach://&lt;file_attach_name&gt;&#8221; to upload a new one using multipart/form-data under &lt;file_attach_name&gt; name. <a href=\"#sending-files\">More information on Sending Files &#187;</a></td>",
"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://<file_attach_name>' to upload a new one using multipart/form-data under <file_attach_name> name. :ref:`More information on Sending Files » <sending-files>`\n",
"name": "media",
"required": true
}
],
"category": "types"
},
{
"anchor": "inputpaidmediavideo",
"name": "InputPaidMediaVideo",
"description": "The paid media to send is a video.",
"html_description": "<p>The paid media to send is a video.</p>",
"rst_description": "The paid media to send is a video.",
"annotations": [
{
"type": "String",
"description": "Type of the media, must be video",
"html_description": "<td>Type of the media, must be <em>video</em></td>",
"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://<file_attach_name>' to upload a new one using multipart/form-data under <file_attach_name> name. More information on Sending Files",
"html_description": "<td>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 &#8220;attach://&lt;file_attach_name&gt;&#8221; to upload a new one using multipart/form-data under &lt;file_attach_name&gt; name. <a href=\"#sending-files\">More information on Sending Files &#187;</a></td>",
"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://<file_attach_name>' to upload a new one using multipart/form-data under <file_attach_name> name. :ref:`More information on Sending Files » <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://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files",
"html_description": "<td><em>Optional</em>. 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 &#8220;attach://&lt;file_attach_name&gt;&#8221; if the thumbnail was uploaded using multipart/form-data under &lt;file_attach_name&gt;. <a href=\"#sending-files\">More information on Sending Files &#187;</a></td>",
"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://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`\n",
"name": "thumbnail",
"required": false
},
{
"type": "Integer",
"description": "Video width",
"html_description": "<td><em>Optional</em>. Video width</td>",
"rst_description": "*Optional*. Video width\n",
"name": "width",
"required": false
},
{
"type": "Integer",
"description": "Video height",
"html_description": "<td><em>Optional</em>. Video height</td>",
"rst_description": "*Optional*. Video height\n",
"name": "height",
"required": false
},
{
"type": "Integer",
"description": "Video duration in seconds",
"html_description": "<td><em>Optional</em>. Video duration in seconds</td>",
"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": "<td><em>Optional</em>. Pass <em>True</em> if the uploaded video is suitable for streaming</td>",
"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." "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", "anchor": "copymessage",
"name": "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.", "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": "<p>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 <a href=\"#poll\">poll</a> can be copied only if the value of the field <em>correct_option_id</em> is known to the bot. The method is analogous to the method <a href=\"#forwardmessage\">forwardMessage</a>, but the copied message doesn't have a link to the original message. Returns the <a href=\"#messageid\">MessageId</a> of the sent message on success.</p>", "html_description": "<p>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 <a href=\"#poll\">poll</a> can be copied only if the value of the field <em>correct_option_id</em> is known to the bot. The method is analogous to the method <a href=\"#forwardmessage\">forwardMessage</a>, but the copied message doesn't have a link to the original message. Returns the <a href=\"#messageid\">MessageId</a> of the sent message on success.</p>",
"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.", "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": [ "annotations": [
{ {
"type": "Integer or String", "type": "Integer or String",
@ -7686,9 +7940,9 @@
{ {
"anchor": "copymessages", "anchor": "copymessages",
"name": "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.", "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": "<p>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 <a href=\"#poll\">poll</a> can be copied only if the value of the field <em>correct_option_id</em> is known to the bot. The method is analogous to the method <a href=\"#forwardmessages\">forwardMessages</a>, 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 <a href=\"#messageid\">MessageId</a> of the sent messages is returned.</p>", "html_description": "<p>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 <a href=\"#poll\">poll</a> can be copied only if the value of the field <em>correct_option_id</em> is known to the bot. The method is analogous to the method <a href=\"#forwardmessages\">forwardMessages</a>, 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 <a href=\"#messageid\">MessageId</a> of the sent messages is returned.</p>",
"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.", "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": [ "annotations": [
{ {
"type": "Integer or String", "type": "Integer or String",
@ -8667,6 +8921,104 @@
], ],
"category": "methods" "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": "<p>Use this method to send paid media to channel chats. On success, the sent <a href=\"#message\">Message</a> is returned.</p>",
"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": "<td>Unique identifier for the target chat or username of the target channel (in the format <code>@channelusername</code>)</td>",
"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": "<td>The number of Telegram Stars that must be paid to buy access to the media</td>",
"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": "<td>A JSON-serialized array describing the media to be sent; up to 10 items</td>",
"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": "<td>Media caption, 0-1024 characters after entities parsing</td>",
"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": "<td>Mode for parsing entities in the media caption. See <a href=\"#formatting-options\">formatting options</a> for more details.</td>",
"rst_description": "Mode for parsing entities in the media caption. See `formatting options <https://core.telegram.org/bots/api#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": "<td>A JSON-serialized list of special entities that appear in the caption, which can be specified instead of <em>parse_mode</em></td>",
"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": "<td>Pass <em>True</em>, if the caption must be shown above the message media</td>",
"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": "<td>Sends the message <a href=\"https://telegram.org/blog/channels-2-0#silent-messages\">silently</a>. Users will receive a notification with no sound.</td>",
"rst_description": "Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. 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": "<td>Protects the contents of the sent message from forwarding and saving</td>",
"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": "<td>Description of the message to reply to</td>",
"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": "<td>Additional interface options. A JSON-serialized object for an <a href=\"/bots/features#inline-keyboards\">inline keyboard</a>, <a href=\"/bots/features#keyboards\">custom reply keyboard</a>, instructions to remove a reply keyboard or to force a reply from the user</td>",
"rst_description": "Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user\n",
"name": "reply_markup"
}
],
"category": "methods"
},
{ {
"anchor": "sendmediagroup", "anchor": "sendmediagroup",
"name": "sendMediaGroup", "name": "sendMediaGroup",
@ -15885,9 +16237,9 @@
}, },
{ {
"type": "String", "type": "String",
"description": "Bot specified invoice payload", "description": "Bot-specified invoice payload",
"html_description": "<td>Bot specified invoice payload</td>", "html_description": "<td>Bot-specified invoice payload</td>",
"rst_description": "Bot specified invoice payload\n", "rst_description": "Bot-specified invoice payload\n",
"name": "invoice_payload", "name": "invoice_payload",
"required": true "required": true
}, },
@ -15951,9 +16303,9 @@
}, },
{ {
"type": "String", "type": "String",
"description": "Bot specified invoice payload", "description": "Bot-specified invoice payload",
"html_description": "<td>Bot specified invoice payload</td>", "html_description": "<td>Bot-specified invoice payload</td>",
"rst_description": "Bot specified invoice payload\n", "rst_description": "Bot-specified invoice payload\n",
"name": "invoice_payload", "name": "invoice_payload",
"required": true "required": true
}, },
@ -16009,9 +16361,9 @@
}, },
{ {
"type": "String", "type": "String",
"description": "Bot specified invoice payload", "description": "Bot-specified invoice payload",
"html_description": "<td>Bot specified invoice payload</td>", "html_description": "<td>Bot-specified invoice payload</td>",
"rst_description": "Bot specified invoice payload\n", "rst_description": "Bot-specified invoice payload\n",
"name": "invoice_payload", "name": "invoice_payload",
"required": true "required": true
}, },
@ -16116,12 +16468,46 @@
{ {
"anchor": "transactionpartner", "anchor": "transactionpartner",
"name": "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", "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": "<p>This object describes the source of a transaction, or its recipient for outgoing transactions. Currently, it can be one of</p><ul>\n<li><a href=\"#transactionpartnerfragment\">TransactionPartnerFragment</a></li>\n<li><a href=\"#transactionpartneruser\">TransactionPartnerUser</a></li>\n<li><a href=\"#transactionpartnerother\">TransactionPartnerOther</a></li>\n</ul>", "html_description": "<p>This object describes the source of a transaction, or its recipient for outgoing transactions. Currently, it can be one of</p><ul>\n<li><a href=\"#transactionpartneruser\">TransactionPartnerUser</a></li>\n<li><a href=\"#transactionpartnerfragment\">TransactionPartnerFragment</a></li>\n<li><a href=\"#transactionpartnertelegramads\">TransactionPartnerTelegramAds</a></li>\n<li><a href=\"#transactionpartnerother\">TransactionPartnerOther</a></li>\n</ul>",
"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`", "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": [], "annotations": [],
"category": "types" "category": "types"
}, },
{
"anchor": "transactionpartneruser",
"name": "TransactionPartnerUser",
"description": "Describes a transaction with a user.",
"html_description": "<p>Describes a transaction with a user.</p>",
"rst_description": "Describes a transaction with a user.",
"annotations": [
{
"type": "String",
"description": "Type of the transaction partner, always 'user'",
"html_description": "<td>Type of the transaction partner, always &#8220;user&#8221;</td>",
"rst_description": "Type of the transaction partner, always 'user'\n",
"name": "type",
"required": true
},
{
"type": "User",
"description": "Information about the user",
"html_description": "<td>Information about the user</td>",
"rst_description": "Information about the user\n",
"name": "user",
"required": true
},
{
"type": "String",
"description": "Bot-specified invoice payload",
"html_description": "<td><em>Optional</em>. Bot-specified invoice payload</td>",
"rst_description": "*Optional*. Bot-specified invoice payload\n",
"name": "invoice_payload",
"required": false
}
],
"category": "types"
},
{ {
"anchor": "transactionpartnerfragment", "anchor": "transactionpartnerfragment",
"name": "TransactionPartnerFragment", "name": "TransactionPartnerFragment",
@ -16149,27 +16535,19 @@
"category": "types" "category": "types"
}, },
{ {
"anchor": "transactionpartneruser", "anchor": "transactionpartnertelegramads",
"name": "TransactionPartnerUser", "name": "TransactionPartnerTelegramAds",
"description": "Describes a transaction with a user.", "description": "Describes a withdrawal transaction to the Telegram Ads platform.",
"html_description": "<p>Describes a transaction with a user.</p>", "html_description": "<p>Describes a withdrawal transaction to the Telegram Ads platform.</p>",
"rst_description": "Describes a transaction with a user.", "rst_description": "Describes a withdrawal transaction to the Telegram Ads platform.",
"annotations": [ "annotations": [
{ {
"type": "String", "type": "String",
"description": "Type of the transaction partner, always 'user'", "description": "Type of the transaction partner, always 'telegram_ads'",
"html_description": "<td>Type of the transaction partner, always &#8220;user&#8221;</td>", "html_description": "<td>Type of the transaction partner, always &#8220;telegram_ads&#8221;</td>",
"rst_description": "Type of the transaction partner, always 'user'\n", "rst_description": "Type of the transaction partner, always 'telegram_ads'\n",
"name": "type", "name": "type",
"required": true "required": true
},
{
"type": "User",
"description": "Information about the user",
"html_description": "<td>Information about the user</td>",
"rst_description": "Information about the user\n",
"name": "user",
"required": true
} }
], ],
"category": "types" "category": "types"

View file

@ -29,49 +29,49 @@
}, },
{ {
"type": "Integer", "type": "Integer",
"description": "Video width as defined by sender", "description": "Video width as defined by the sender",
"html_description": "<td>Video width as defined by sender</td>", "html_description": "<td>Video width as defined by the sender</td>",
"rst_description": "Video width as defined by sender\n", "rst_description": "Video width as defined by the sender\n",
"name": "width", "name": "width",
"required": true "required": true
}, },
{ {
"type": "Integer", "type": "Integer",
"description": "Video height as defined by sender", "description": "Video height as defined by the sender",
"html_description": "<td>Video height as defined by sender</td>", "html_description": "<td>Video height as defined by the sender</td>",
"rst_description": "Video height as defined by sender\n", "rst_description": "Video height as defined by the sender\n",
"name": "height", "name": "height",
"required": true "required": true
}, },
{ {
"type": "Integer", "type": "Integer",
"description": "Duration of the video in seconds as defined by sender", "description": "Duration of the video in seconds as defined by the sender",
"html_description": "<td>Duration of the video in seconds as defined by sender</td>", "html_description": "<td>Duration of the video in seconds as defined by the sender</td>",
"rst_description": "Duration of the video in seconds as defined by sender\n", "rst_description": "Duration of the video in seconds as defined by the sender\n",
"name": "duration", "name": "duration",
"required": true "required": true
}, },
{ {
"type": "PhotoSize", "type": "PhotoSize",
"description": "Animation thumbnail as defined by sender", "description": "Animation thumbnail as defined by the sender",
"html_description": "<td><em>Optional</em>. Animation thumbnail as defined by sender</td>", "html_description": "<td><em>Optional</em>. Animation thumbnail as defined by the sender</td>",
"rst_description": "*Optional*. Animation thumbnail as defined by sender\n", "rst_description": "*Optional*. Animation thumbnail as defined by the sender\n",
"name": "thumbnail", "name": "thumbnail",
"required": false "required": false
}, },
{ {
"type": "String", "type": "String",
"description": "Original animation filename as defined by sender", "description": "Original animation filename as defined by the sender",
"html_description": "<td><em>Optional</em>. Original animation filename as defined by sender</td>", "html_description": "<td><em>Optional</em>. Original animation filename as defined by the sender</td>",
"rst_description": "*Optional*. Original animation filename as defined by sender\n", "rst_description": "*Optional*. Original animation filename as defined by the sender\n",
"name": "file_name", "name": "file_name",
"required": false "required": false
}, },
{ {
"type": "String", "type": "String",
"description": "MIME type of the file as defined by sender", "description": "MIME type of the file as defined by the sender",
"html_description": "<td><em>Optional</em>. MIME type of the file as defined by sender</td>", "html_description": "<td><em>Optional</em>. MIME type of the file as defined by the sender</td>",
"rst_description": "*Optional*. MIME type of the file as defined by sender\n", "rst_description": "*Optional*. MIME type of the file as defined by the sender\n",
"name": "mime_type", "name": "mime_type",
"required": false "required": false
}, },

View file

@ -29,41 +29,41 @@
}, },
{ {
"type": "Integer", "type": "Integer",
"description": "Duration of the audio in seconds as defined by sender", "description": "Duration of the audio in seconds as defined by the sender",
"html_description": "<td>Duration of the audio in seconds as defined by sender</td>", "html_description": "<td>Duration of the audio in seconds as defined by the sender</td>",
"rst_description": "Duration of the audio in seconds as defined by sender\n", "rst_description": "Duration of the audio in seconds as defined by the sender\n",
"name": "duration", "name": "duration",
"required": true "required": true
}, },
{ {
"type": "String", "type": "String",
"description": "Performer of the audio as defined by sender or by audio tags", "description": "Performer of the audio as defined by the sender or by audio tags",
"html_description": "<td><em>Optional</em>. Performer of the audio as defined by sender or by audio tags</td>", "html_description": "<td><em>Optional</em>. Performer of the audio as defined by the sender or by audio tags</td>",
"rst_description": "*Optional*. Performer of the audio as defined by sender or by audio tags\n", "rst_description": "*Optional*. Performer of the audio as defined by the sender or by audio tags\n",
"name": "performer", "name": "performer",
"required": false "required": false
}, },
{ {
"type": "String", "type": "String",
"description": "Title of the audio as defined by sender or by audio tags", "description": "Title of the audio as defined by the sender or by audio tags",
"html_description": "<td><em>Optional</em>. Title of the audio as defined by sender or by audio tags</td>", "html_description": "<td><em>Optional</em>. Title of the audio as defined by the sender or by audio tags</td>",
"rst_description": "*Optional*. Title of the audio as defined by sender or by audio tags\n", "rst_description": "*Optional*. Title of the audio as defined by the sender or by audio tags\n",
"name": "title", "name": "title",
"required": false "required": false
}, },
{ {
"type": "String", "type": "String",
"description": "Original filename as defined by sender", "description": "Original filename as defined by the sender",
"html_description": "<td><em>Optional</em>. Original filename as defined by sender</td>", "html_description": "<td><em>Optional</em>. Original filename as defined by the sender</td>",
"rst_description": "*Optional*. Original filename as defined by sender\n", "rst_description": "*Optional*. Original filename as defined by the sender\n",
"name": "file_name", "name": "file_name",
"required": false "required": false
}, },
{ {
"type": "String", "type": "String",
"description": "MIME type of the file as defined by sender", "description": "MIME type of the file as defined by the sender",
"html_description": "<td><em>Optional</em>. MIME type of the file as defined by sender</td>", "html_description": "<td><em>Optional</em>. MIME type of the file as defined by the sender</td>",
"rst_description": "*Optional*. MIME type of the file as defined by sender\n", "rst_description": "*Optional*. MIME type of the file as defined by the sender\n",
"name": "mime_type", "name": "mime_type",
"required": false "required": false
}, },

View file

@ -259,6 +259,14 @@
"name": "permissions", "name": "permissions",
"required": false "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": "<td><em>Optional</em>. <em>True</em>, if paid media messages can be sent or forwarded to the channel chat. The field is available only for channel chats.</td>",
"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", "type": "Integer",
"description": "For supergroups, the minimum allowed delay between consecutive messages sent by each unprivileged user; in seconds", "description": "For supergroups, the minimum allowed delay between consecutive messages sent by each unprivileged user; in seconds",

View file

@ -29,25 +29,25 @@
}, },
{ {
"type": "PhotoSize", "type": "PhotoSize",
"description": "Document thumbnail as defined by sender", "description": "Document thumbnail as defined by the sender",
"html_description": "<td><em>Optional</em>. Document thumbnail as defined by sender</td>", "html_description": "<td><em>Optional</em>. Document thumbnail as defined by the sender</td>",
"rst_description": "*Optional*. Document thumbnail as defined by sender\n", "rst_description": "*Optional*. Document thumbnail as defined by the sender\n",
"name": "thumbnail", "name": "thumbnail",
"required": false "required": false
}, },
{ {
"type": "String", "type": "String",
"description": "Original filename as defined by sender", "description": "Original filename as defined by the sender",
"html_description": "<td><em>Optional</em>. Original filename as defined by sender</td>", "html_description": "<td><em>Optional</em>. Original filename as defined by the sender</td>",
"rst_description": "*Optional*. Original filename as defined by sender\n", "rst_description": "*Optional*. Original filename as defined by the sender\n",
"name": "file_name", "name": "file_name",
"required": false "required": false
}, },
{ {
"type": "String", "type": "String",
"description": "MIME type of the file as defined by sender", "description": "MIME type of the file as defined by the sender",
"html_description": "<td><em>Optional</em>. MIME type of the file as defined by sender</td>", "html_description": "<td><em>Optional</em>. MIME type of the file as defined by the sender</td>",
"rst_description": "*Optional*. MIME type of the file as defined by sender\n", "rst_description": "*Optional*. MIME type of the file as defined by the sender\n",
"name": "mime_type", "name": "mime_type",
"required": false "required": false
}, },

View file

@ -67,6 +67,14 @@
"name": "document", "name": "document",
"required": false "required": false
}, },
{
"type": "PaidMediaInfo",
"description": "Message contains paid media; information about the paid media",
"html_description": "<td><em>Optional</em>. Message contains paid media; information about the paid media</td>",
"rst_description": "*Optional*. Message contains paid media; information about the paid media\n",
"name": "paid_media",
"required": false
},
{ {
"type": "Array of PhotoSize", "type": "Array of PhotoSize",
"description": "Message is a photo, available sizes of the photo", "description": "Message is a photo, available sizes of the photo",

View file

@ -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": "<p>This object describes the paid media to be sent. Currently, it can be one of</p><ul>\n<li><a href=\"#inputpaidmediaphoto\">InputPaidMediaPhoto</a></li>\n<li><a href=\"#inputpaidmediavideo\">InputPaidMediaVideo</a></li>\n</ul>",
"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"
}
}

View file

@ -0,0 +1 @@
discriminator: "type"

View file

@ -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": "<p>The paid media to send is a photo.</p>",
"rst_description": "The paid media to send is a photo.",
"annotations": [
{
"type": "String",
"description": "Type of the media, must be photo",
"html_description": "<td>Type of the media, must be <em>photo</em></td>",
"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://<file_attach_name>' to upload a new one using multipart/form-data under <file_attach_name> name. More information on Sending Files",
"html_description": "<td>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 &#8220;attach://&lt;file_attach_name&gt;&#8221; to upload a new one using multipart/form-data under &lt;file_attach_name&gt; name. <a href=\"#sending-files\">More information on Sending Files &#187;</a></td>",
"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://<file_attach_name>' to upload a new one using multipart/form-data under <file_attach_name> name. :ref:`More information on Sending Files » <sending-files>`\n",
"name": "media",
"required": true
}
],
"category": "types"
}
}

View file

@ -0,0 +1,11 @@
annotations:
media:
parsed_type:
type: union
items:
- type: std
name: str
- type: entity
references:
category: types
name: InputFile

View file

@ -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": "<p>The paid media to send is a video.</p>",
"rst_description": "The paid media to send is a video.",
"annotations": [
{
"type": "String",
"description": "Type of the media, must be video",
"html_description": "<td>Type of the media, must be <em>video</em></td>",
"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://<file_attach_name>' to upload a new one using multipart/form-data under <file_attach_name> name. More information on Sending Files",
"html_description": "<td>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 &#8220;attach://&lt;file_attach_name&gt;&#8221; to upload a new one using multipart/form-data under &lt;file_attach_name&gt; name. <a href=\"#sending-files\">More information on Sending Files &#187;</a></td>",
"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://<file_attach_name>' to upload a new one using multipart/form-data under <file_attach_name> name. :ref:`More information on Sending Files » <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://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files",
"html_description": "<td><em>Optional</em>. 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 &#8220;attach://&lt;file_attach_name&gt;&#8221; if the thumbnail was uploaded using multipart/form-data under &lt;file_attach_name&gt;. <a href=\"#sending-files\">More information on Sending Files &#187;</a></td>",
"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://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`\n",
"name": "thumbnail",
"required": false
},
{
"type": "Integer",
"description": "Video width",
"html_description": "<td><em>Optional</em>. Video width</td>",
"rst_description": "*Optional*. Video width\n",
"name": "width",
"required": false
},
{
"type": "Integer",
"description": "Video height",
"html_description": "<td><em>Optional</em>. Video height</td>",
"rst_description": "*Optional*. Video height\n",
"name": "height",
"required": false
},
{
"type": "Integer",
"description": "Video duration in seconds",
"html_description": "<td><em>Optional</em>. Video duration in seconds</td>",
"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": "<td><em>Optional</em>. Pass <em>True</em> if the uploaded video is suitable for streaming</td>",
"rst_description": "*Optional*. Pass :code:`True` if the uploaded video is suitable for streaming\n",
"name": "supports_streaming",
"required": false
}
],
"category": "types"
}
}

View file

@ -0,0 +1,11 @@
annotations:
media:
parsed_type:
type: union
items:
- type: std
name: str
- type: entity
references:
category: types
name: InputFile

View file

@ -7,9 +7,9 @@
"object": { "object": {
"anchor": "inputpolloption", "anchor": "inputpolloption",
"name": "InputPollOption", "name": "InputPollOption",
"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": "<p>This object contains information about one answer option in a poll to send.</p>", "html_description": "<p>This object contains information about one answer option in a poll to be sent.</p>",
"rst_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 be sent.",
"annotations": [ "annotations": [
{ {
"type": "String", "type": "String",

View file

@ -13,17 +13,17 @@
"annotations": [ "annotations": [
{ {
"type": "Float", "type": "Float",
"description": "Latitude as defined by sender", "description": "Latitude as defined by the sender",
"html_description": "<td>Latitude as defined by sender</td>", "html_description": "<td>Latitude as defined by the sender</td>",
"rst_description": "Latitude as defined by sender\n", "rst_description": "Latitude as defined by the sender\n",
"name": "latitude", "name": "latitude",
"required": true "required": true
}, },
{ {
"type": "Float", "type": "Float",
"description": "Longitude as defined by sender", "description": "Longitude as defined by the sender",
"html_description": "<td>Longitude as defined by sender</td>", "html_description": "<td>Longitude as defined by the sender</td>",
"rst_description": "Longitude as defined by sender\n", "rst_description": "Longitude as defined by the sender\n",
"name": "longitude", "name": "longitude",
"required": true "required": true
}, },

View file

@ -29,9 +29,9 @@
}, },
{ {
"type": "WebAppInfo", "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.", "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": "<td>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 <a href=\"#answerwebappquery\">answerWebAppQuery</a>.</td>", "html_description": "<td>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 <a href=\"#answerwebappquery\">answerWebAppQuery</a>. Alternatively, a <code>t.me</code> 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.</td>",
"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", "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", "name": "web_app",
"required": true "required": true
} }

View file

@ -174,6 +174,11 @@ reply_voice:
code: *assert-chat code: *assert-chat
fill: *fill-reply fill: *fill-reply
answer_paid_media:
method: sendPaidMedia
code: *assert-chat
fill: *fill-answer
copy_to: copy_to:
method: copyMessage method: copyMessage
code: *assert-chat code: *assert-chat

View file

@ -243,6 +243,14 @@
"name": "document", "name": "document",
"required": false "required": false
}, },
{
"type": "PaidMediaInfo",
"description": "Message contains paid media; information about the paid media",
"html_description": "<td><em>Optional</em>. Message contains paid media; information about the paid media</td>",
"rst_description": "*Optional*. Message contains paid media; information about the paid media\n",
"name": "paid_media",
"required": false
},
{ {
"type": "Array of PhotoSize", "type": "Array of PhotoSize",
"description": "Message is a photo, available sizes of the photo", "description": "Message is a photo, available sizes of the photo",
@ -293,9 +301,9 @@
}, },
{ {
"type": "String", "type": "String",
"description": "Caption for the animation, audio, document, photo, video or voice", "description": "Caption for the animation, audio, document, paid media, photo, video or voice",
"html_description": "<td><em>Optional</em>. Caption for the animation, audio, document, photo, video or voice</td>", "html_description": "<td><em>Optional</em>. Caption for the animation, audio, document, paid media, photo, video or voice</td>",
"rst_description": "*Optional*. Caption for the animation, audio, document, photo, video or voice\n", "rst_description": "*Optional*. Caption for the animation, audio, document, paid media, photo, video or voice\n",
"name": "caption", "name": "caption",
"required": false "required": false
}, },

View file

@ -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": "<p>This object describes paid media. Currently, it can be one of</p><ul>\n<li><a href=\"#paidmediapreview\">PaidMediaPreview</a></li>\n<li><a href=\"#paidmediaphoto\">PaidMediaPhoto</a></li>\n<li><a href=\"#paidmediavideo\">PaidMediaVideo</a></li>\n</ul>",
"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"
}
}

View file

@ -0,0 +1 @@
discriminator: "type"

View file

@ -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": "<p>Describes the paid media added to a message.</p>",
"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": "<td>The number of Telegram Stars that must be paid to buy access to the media</td>",
"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": "<td>Information about the paid media</td>",
"rst_description": "Information about the paid media\n",
"name": "paid_media",
"required": true
}
],
"category": "types"
}
}

View file

@ -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": "<p>The paid media is a photo.</p>",
"rst_description": "The paid media is a photo.",
"annotations": [
{
"type": "String",
"description": "Type of the paid media, always 'photo'",
"html_description": "<td>Type of the paid media, always &#8220;photo&#8221;</td>",
"rst_description": "Type of the paid media, always 'photo'\n",
"name": "type",
"required": true
},
{
"type": "Array of PhotoSize",
"description": "The photo",
"html_description": "<td>The photo</td>",
"rst_description": "The photo\n",
"name": "photo",
"required": true
}
],
"category": "types"
}
}

View file

@ -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": "<p>The paid media isn't available before the payment.</p>",
"rst_description": "The paid media isn't available before the payment.",
"annotations": [
{
"type": "String",
"description": "Type of the paid media, always 'preview'",
"html_description": "<td>Type of the paid media, always &#8220;preview&#8221;</td>",
"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": "<td><em>Optional</em>. Media width as defined by the sender</td>",
"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": "<td><em>Optional</em>. Media height as defined by the sender</td>",
"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": "<td><em>Optional</em>. Duration of the media in seconds as defined by the sender</td>",
"rst_description": "*Optional*. Duration of the media in seconds as defined by the sender\n",
"name": "duration",
"required": false
}
],
"category": "types"
}
}

View file

@ -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": "<p>The paid media is a video.</p>",
"rst_description": "The paid media is a video.",
"annotations": [
{
"type": "String",
"description": "Type of the paid media, always 'video'",
"html_description": "<td>Type of the paid media, always &#8220;video&#8221;</td>",
"rst_description": "Type of the paid media, always 'video'\n",
"name": "type",
"required": true
},
{
"type": "Video",
"description": "The video",
"html_description": "<td>The video</td>",
"rst_description": "The video\n",
"name": "video",
"required": true
}
],
"category": "types"
}
}

View file

@ -45,9 +45,9 @@
}, },
{ {
"type": "String", "type": "String",
"description": "Bot specified invoice payload", "description": "Bot-specified invoice payload",
"html_description": "<td>Bot specified invoice payload</td>", "html_description": "<td>Bot-specified invoice payload</td>",
"rst_description": "Bot specified invoice payload\n", "rst_description": "Bot-specified invoice payload\n",
"name": "invoice_payload", "name": "invoice_payload",
"required": true "required": true
}, },

View file

@ -29,9 +29,9 @@
}, },
{ {
"type": "String", "type": "String",
"description": "Bot specified invoice payload", "description": "Bot-specified invoice payload",
"html_description": "<td>Bot specified invoice payload</td>", "html_description": "<td>Bot-specified invoice payload</td>",
"rst_description": "Bot specified invoice payload\n", "rst_description": "Bot-specified invoice payload\n",
"name": "invoice_payload", "name": "invoice_payload",
"required": true "required": true
}, },

View file

@ -29,9 +29,9 @@
}, },
{ {
"type": "String", "type": "String",
"description": "Bot specified invoice payload", "description": "Bot-specified invoice payload",
"html_description": "<td>Bot specified invoice payload</td>", "html_description": "<td>Bot-specified invoice payload</td>",
"rst_description": "Bot specified invoice payload\n", "rst_description": "Bot-specified invoice payload\n",
"name": "invoice_payload", "name": "invoice_payload",
"required": true "required": true
}, },

View file

@ -7,9 +7,9 @@
"object": { "object": {
"anchor": "transactionpartner", "anchor": "transactionpartner",
"name": "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", "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": "<p>This object describes the source of a transaction, or its recipient for outgoing transactions. Currently, it can be one of</p><ul>\n<li><a href=\"#transactionpartnerfragment\">TransactionPartnerFragment</a></li>\n<li><a href=\"#transactionpartneruser\">TransactionPartnerUser</a></li>\n<li><a href=\"#transactionpartnerother\">TransactionPartnerOther</a></li>\n</ul>", "html_description": "<p>This object describes the source of a transaction, or its recipient for outgoing transactions. Currently, it can be one of</p><ul>\n<li><a href=\"#transactionpartneruser\">TransactionPartnerUser</a></li>\n<li><a href=\"#transactionpartnerfragment\">TransactionPartnerFragment</a></li>\n<li><a href=\"#transactionpartnertelegramads\">TransactionPartnerTelegramAds</a></li>\n<li><a href=\"#transactionpartnerother\">TransactionPartnerOther</a></li>\n</ul>",
"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`", "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": [], "annotations": [],
"category": "types" "category": "types"
} }

View file

@ -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": "<p>Describes a withdrawal transaction to the Telegram Ads platform.</p>",
"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": "<td>Type of the transaction partner, always &#8220;telegram_ads&#8221;</td>",
"rst_description": "Type of the transaction partner, always 'telegram_ads'\n",
"name": "type",
"required": true
}
],
"category": "types"
}
}

View file

@ -26,6 +26,14 @@
"rst_description": "Information about the user\n", "rst_description": "Information about the user\n",
"name": "user", "name": "user",
"required": true "required": true
},
{
"type": "String",
"description": "Bot-specified invoice payload",
"html_description": "<td><em>Optional</em>. Bot-specified invoice payload</td>",
"rst_description": "*Optional*. Bot-specified invoice payload\n",
"name": "invoice_payload",
"required": false
} }
], ],
"category": "types" "category": "types"

View file

@ -29,25 +29,25 @@
}, },
{ {
"type": "Integer", "type": "Integer",
"description": "Video width as defined by sender", "description": "Video width as defined by the sender",
"html_description": "<td>Video width as defined by sender</td>", "html_description": "<td>Video width as defined by the sender</td>",
"rst_description": "Video width as defined by sender\n", "rst_description": "Video width as defined by the sender\n",
"name": "width", "name": "width",
"required": true "required": true
}, },
{ {
"type": "Integer", "type": "Integer",
"description": "Video height as defined by sender", "description": "Video height as defined by the sender",
"html_description": "<td>Video height as defined by sender</td>", "html_description": "<td>Video height as defined by the sender</td>",
"rst_description": "Video height as defined by sender\n", "rst_description": "Video height as defined by the sender\n",
"name": "height", "name": "height",
"required": true "required": true
}, },
{ {
"type": "Integer", "type": "Integer",
"description": "Duration of the video in seconds as defined by sender", "description": "Duration of the video in seconds as defined by the sender",
"html_description": "<td>Duration of the video in seconds as defined by sender</td>", "html_description": "<td>Duration of the video in seconds as defined by the sender</td>",
"rst_description": "Duration of the video in seconds as defined by sender\n", "rst_description": "Duration of the video in seconds as defined by the sender\n",
"name": "duration", "name": "duration",
"required": true "required": true
}, },
@ -61,17 +61,17 @@
}, },
{ {
"type": "String", "type": "String",
"description": "Original filename as defined by sender", "description": "Original filename as defined by the sender",
"html_description": "<td><em>Optional</em>. Original filename as defined by sender</td>", "html_description": "<td><em>Optional</em>. Original filename as defined by the sender</td>",
"rst_description": "*Optional*. Original filename as defined by sender\n", "rst_description": "*Optional*. Original filename as defined by the sender\n",
"name": "file_name", "name": "file_name",
"required": false "required": false
}, },
{ {
"type": "String", "type": "String",
"description": "MIME type of the file as defined by sender", "description": "MIME type of the file as defined by the sender",
"html_description": "<td><em>Optional</em>. MIME type of the file as defined by sender</td>", "html_description": "<td><em>Optional</em>. MIME type of the file as defined by the sender</td>",
"rst_description": "*Optional*. MIME type of the file as defined by sender\n", "rst_description": "*Optional*. MIME type of the file as defined by the sender\n",
"name": "mime_type", "name": "mime_type",
"required": false "required": false
}, },

View file

@ -29,17 +29,17 @@
}, },
{ {
"type": "Integer", "type": "Integer",
"description": "Video width and height (diameter of the video message) as defined by sender", "description": "Video width and height (diameter of the video message) as defined by the sender",
"html_description": "<td>Video width and height (diameter of the video message) as defined by sender</td>", "html_description": "<td>Video width and height (diameter of the video message) as defined by the sender</td>",
"rst_description": "Video width and height (diameter of the video message) as defined by sender\n", "rst_description": "Video width and height (diameter of the video message) as defined by the sender\n",
"name": "length", "name": "length",
"required": true "required": true
}, },
{ {
"type": "Integer", "type": "Integer",
"description": "Duration of the video in seconds as defined by sender", "description": "Duration of the video in seconds as defined by the sender",
"html_description": "<td>Duration of the video in seconds as defined by sender</td>", "html_description": "<td>Duration of the video in seconds as defined by the sender</td>",
"rst_description": "Duration of the video in seconds as defined by sender\n", "rst_description": "Duration of the video in seconds as defined by the sender\n",
"name": "duration", "name": "duration",
"required": true "required": true
}, },

View file

@ -29,17 +29,17 @@
}, },
{ {
"type": "Integer", "type": "Integer",
"description": "Duration of the audio in seconds as defined by sender", "description": "Duration of the audio in seconds as defined by the sender",
"html_description": "<td>Duration of the audio in seconds as defined by sender</td>", "html_description": "<td>Duration of the audio in seconds as defined by the sender</td>",
"rst_description": "Duration of the audio in seconds as defined by sender\n", "rst_description": "Duration of the audio in seconds as defined by the sender\n",
"name": "duration", "name": "duration",
"required": true "required": true
}, },
{ {
"type": "String", "type": "String",
"description": "MIME type of the file as defined by sender", "description": "MIME type of the file as defined by the sender",
"html_description": "<td><em>Optional</em>. MIME type of the file as defined by sender</td>", "html_description": "<td><em>Optional</em>. MIME type of the file as defined by the sender</td>",
"rst_description": "*Optional*. MIME type of the file as defined by sender\n", "rst_description": "*Optional*. MIME type of the file as defined by the sender\n",
"name": "mime_type", "name": "mime_type",
"required": false "required": false
}, },

30
CHANGES/1533.feature.rst Normal file
View file

@ -0,0 +1,30 @@
Added full support of `Bot API 7.6 <https://core.telegram.org/bots/api-changelog#july-01-2024>`_
- 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`.

View file

@ -106,6 +106,7 @@ from ..methods import (
SendLocation, SendLocation,
SendMediaGroup, SendMediaGroup,
SendMessage, SendMessage,
SendPaidMedia,
SendPhoto, SendPhoto,
SendPoll, SendPoll,
SendSticker, SendSticker,
@ -204,6 +205,8 @@ from ..types import (
InputMediaDocument, InputMediaDocument,
InputMediaPhoto, InputMediaPhoto,
InputMediaVideo, InputMediaVideo,
InputPaidMediaPhoto,
InputPaidMediaVideo,
InputPollOption, InputPollOption,
InputSticker, InputSticker,
LabeledPrice, LabeledPrice,
@ -862,7 +865,7 @@ class Bot:
request_timeout: Optional[int] = None, request_timeout: Optional[int] = None,
) -> MessageId: ) -> 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 Source: https://core.telegram.org/bots/api#copymessage
@ -4405,7 +4408,7 @@ class Bot:
request_timeout: Optional[int] = None, request_timeout: Optional[int] = None,
) -> List[MessageId]: ) -> 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 Source: https://core.telegram.org/bots/api#copymessages
@ -4635,3 +4638,55 @@ class Bot:
limit=limit, limit=limit,
) )
return await self(call, request_timeout=request_timeout) 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 <https://core.telegram.org/bots/api#formatting-options>`_ for more details.
:param caption_entities: A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*
:param show_caption_above_media: Pass :code:`True`, if the caption must be shown above the message media
:param disable_notification: Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. 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 <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user
: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)

View file

@ -9,11 +9,13 @@ from .dice_emoji import DiceEmoji
from .encrypted_passport_element import EncryptedPassportElement from .encrypted_passport_element import EncryptedPassportElement
from .inline_query_result_type import InlineQueryResultType from .inline_query_result_type import InlineQueryResultType
from .input_media_type import InputMediaType from .input_media_type import InputMediaType
from .input_paid_media_type import InputPaidMediaType
from .keyboard_button_poll_type_type import KeyboardButtonPollTypeType from .keyboard_button_poll_type_type import KeyboardButtonPollTypeType
from .mask_position_point import MaskPositionPoint from .mask_position_point import MaskPositionPoint
from .menu_button_type import MenuButtonType from .menu_button_type import MenuButtonType
from .message_entity_type import MessageEntityType from .message_entity_type import MessageEntityType
from .message_origin_type import MessageOriginType from .message_origin_type import MessageOriginType
from .paid_media_type import PaidMediaType
from .parse_mode import ParseMode from .parse_mode import ParseMode
from .passport_element_error_type import PassportElementErrorType from .passport_element_error_type import PassportElementErrorType
from .poll_type import PollType from .poll_type import PollType
@ -37,11 +39,13 @@ __all__ = (
"EncryptedPassportElement", "EncryptedPassportElement",
"InlineQueryResultType", "InlineQueryResultType",
"InputMediaType", "InputMediaType",
"InputPaidMediaType",
"KeyboardButtonPollTypeType", "KeyboardButtonPollTypeType",
"MaskPositionPoint", "MaskPositionPoint",
"MenuButtonType", "MenuButtonType",
"MessageEntityType", "MessageEntityType",
"MessageOriginType", "MessageOriginType",
"PaidMediaType",
"ParseMode", "ParseMode",
"PassportElementErrorType", "PassportElementErrorType",
"PollType", "PollType",

View file

@ -12,6 +12,7 @@ class ContentType(str, Enum):
ANIMATION = "animation" ANIMATION = "animation"
AUDIO = "audio" AUDIO = "audio"
DOCUMENT = "document" DOCUMENT = "document"
PAID_MEDIA = "paid_media"
PHOTO = "photo" PHOTO = "photo"
STICKER = "sticker" STICKER = "sticker"
STORY = "story" STORY = "story"

View file

@ -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"

View file

@ -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"

View file

@ -11,3 +11,4 @@ class TransactionPartnerType(str, Enum):
FRAGMENT = "fragment" FRAGMENT = "fragment"
OTHER = "other" OTHER = "other"
USER = "user" USER = "user"
TELEGRAM_ADS = "telegram_ads"

View file

@ -82,6 +82,7 @@ from .send_invoice import SendInvoice
from .send_location import SendLocation from .send_location import SendLocation
from .send_media_group import SendMediaGroup from .send_media_group import SendMediaGroup
from .send_message import SendMessage from .send_message import SendMessage
from .send_paid_media import SendPaidMedia
from .send_photo import SendPhoto from .send_photo import SendPhoto
from .send_poll import SendPoll from .send_poll import SendPoll
from .send_sticker import SendSticker from .send_sticker import SendSticker
@ -209,6 +210,7 @@ __all__ = (
"SendLocation", "SendLocation",
"SendMediaGroup", "SendMediaGroup",
"SendMessage", "SendMessage",
"SendPaidMedia",
"SendPhoto", "SendPhoto",
"SendPoll", "SendPoll",
"SendSticker", "SendSticker",

View file

@ -19,7 +19,7 @@ from .base import TelegramMethod
class CopyMessage(TelegramMethod[MessageId]): 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 Source: https://core.telegram.org/bots/api#copymessage
""" """

View file

@ -6,7 +6,7 @@ from .base import TelegramMethod
class CopyMessages(TelegramMethod[List[MessageId]]): 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 Source: https://core.telegram.org/bots/api#copymessages
""" """

View file

@ -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 <https://core.telegram.org/bots/api#formatting-options>`_ for more details."""
caption_entities: Optional[List[MessageEntity]] = None
"""A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*"""
show_caption_above_media: Optional[bool] = None
"""Pass :code:`True`, if the caption must be shown above the message media"""
disable_notification: Optional[bool] = None
"""Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
protect_content: Optional[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 <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user"""
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,
)

View file

@ -123,6 +123,9 @@ from .input_media_document import InputMediaDocument
from .input_media_photo import InputMediaPhoto from .input_media_photo import InputMediaPhoto
from .input_media_video import InputMediaVideo from .input_media_video import InputMediaVideo
from .input_message_content import InputMessageContent 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_poll_option import InputPollOption
from .input_sticker import InputSticker from .input_sticker import InputSticker
from .input_text_message_content import InputTextMessageContent 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_count_updated import MessageReactionCountUpdated
from .message_reaction_updated import MessageReactionUpdated from .message_reaction_updated import MessageReactionUpdated
from .order_info import OrderInfo 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_data import PassportData
from .passport_element_error import PassportElementError from .passport_element_error import PassportElementError
from .passport_element_error_data_field import PassportElementErrorDataField 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 import TransactionPartner
from .transaction_partner_fragment import TransactionPartnerFragment from .transaction_partner_fragment import TransactionPartnerFragment
from .transaction_partner_other import TransactionPartnerOther from .transaction_partner_other import TransactionPartnerOther
from .transaction_partner_telegram_ads import TransactionPartnerTelegramAds
from .transaction_partner_user import TransactionPartnerUser from .transaction_partner_user import TransactionPartnerUser
from .update import Update from .update import Update
from .user import User from .user import User
@ -347,6 +356,9 @@ __all__ = (
"InputMediaPhoto", "InputMediaPhoto",
"InputMediaVideo", "InputMediaVideo",
"InputMessageContent", "InputMessageContent",
"InputPaidMedia",
"InputPaidMediaPhoto",
"InputPaidMediaVideo",
"InputPollOption", "InputPollOption",
"InputSticker", "InputSticker",
"InputTextMessageContent", "InputTextMessageContent",
@ -379,6 +391,11 @@ __all__ = (
"MessageReactionCountUpdated", "MessageReactionCountUpdated",
"MessageReactionUpdated", "MessageReactionUpdated",
"OrderInfo", "OrderInfo",
"PaidMedia",
"PaidMediaInfo",
"PaidMediaPhoto",
"PaidMediaPreview",
"PaidMediaVideo",
"PassportData", "PassportData",
"PassportElementError", "PassportElementError",
"PassportElementErrorDataField", "PassportElementErrorDataField",
@ -426,6 +443,7 @@ __all__ = (
"TransactionPartner", "TransactionPartner",
"TransactionPartnerFragment", "TransactionPartnerFragment",
"TransactionPartnerOther", "TransactionPartnerOther",
"TransactionPartnerTelegramAds",
"TransactionPartnerUser", "TransactionPartnerUser",
"UNSET_PARSE_MODE", "UNSET_PARSE_MODE",
"URLInputFile", "URLInputFile",

View file

@ -20,17 +20,17 @@ class Animation(TelegramObject):
file_unique_id: str 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.""" """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 width: int
"""Video width as defined by sender""" """Video width as defined by the sender"""
height: int height: int
"""Video height as defined by sender""" """Video height as defined by the sender"""
duration: int 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 thumbnail: Optional[PhotoSize] = None
"""*Optional*. Animation thumbnail as defined by sender""" """*Optional*. Animation thumbnail as defined by the sender"""
file_name: Optional[str] = None 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 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 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.""" """*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."""

View file

@ -20,15 +20,15 @@ class Audio(TelegramObject):
file_unique_id: str 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.""" """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: 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 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 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 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 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 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.""" """*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 thumbnail: Optional[PhotoSize] = None

View file

@ -87,6 +87,8 @@ class ChatFullInfo(Chat):
"""*Optional*. The most recent pinned message (by sending date)""" """*Optional*. The most recent pinned message (by sending date)"""
permissions: Optional[ChatPermissions] = None permissions: Optional[ChatPermissions] = None
"""*Optional*. Default chat member permissions, for groups and supergroups""" """*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 slow_mode_delay: Optional[int] = None
"""*Optional*. For supergroups, the minimum allowed delay between consecutive messages sent by each unprivileged user; in seconds""" """*Optional*. For supergroups, the minimum allowed delay between consecutive messages sent by each unprivileged user; in seconds"""
unrestrict_boost_count: Optional[int] = None unrestrict_boost_count: Optional[int] = None
@ -152,6 +154,7 @@ class ChatFullInfo(Chat):
invite_link: Optional[str] = None, invite_link: Optional[str] = None,
pinned_message: Optional[Message] = None, pinned_message: Optional[Message] = None,
permissions: Optional[ChatPermissions] = None, permissions: Optional[ChatPermissions] = None,
can_send_paid_media: Optional[bool] = None,
slow_mode_delay: Optional[int] = None, slow_mode_delay: Optional[int] = None,
unrestrict_boost_count: Optional[int] = None, unrestrict_boost_count: Optional[int] = None,
message_auto_delete_time: Optional[int] = None, message_auto_delete_time: Optional[int] = None,
@ -202,6 +205,7 @@ class ChatFullInfo(Chat):
invite_link=invite_link, invite_link=invite_link,
pinned_message=pinned_message, pinned_message=pinned_message,
permissions=permissions, permissions=permissions,
can_send_paid_media=can_send_paid_media,
slow_mode_delay=slow_mode_delay, slow_mode_delay=slow_mode_delay,
unrestrict_boost_count=unrestrict_boost_count, unrestrict_boost_count=unrestrict_boost_count,
message_auto_delete_time=message_auto_delete_time, message_auto_delete_time=message_auto_delete_time,

View file

@ -1,7 +1,6 @@
import sys import sys
from datetime import datetime from datetime import datetime, timezone
from datetime import timezone
from pydantic import PlainSerializer from pydantic import PlainSerializer
from typing_extensions import Annotated from typing_extensions import Annotated

View file

@ -20,11 +20,11 @@ class Document(TelegramObject):
file_unique_id: str 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.""" """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 thumbnail: Optional[PhotoSize] = None
"""*Optional*. Document thumbnail as defined by sender""" """*Optional*. Document thumbnail as defined by the sender"""
file_name: Optional[str] = None 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 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 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.""" """*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."""

View file

@ -21,6 +21,7 @@ if TYPE_CHECKING:
from .message_origin_chat import MessageOriginChat from .message_origin_chat import MessageOriginChat
from .message_origin_hidden_user import MessageOriginHiddenUser from .message_origin_hidden_user import MessageOriginHiddenUser
from .message_origin_user import MessageOriginUser from .message_origin_user import MessageOriginUser
from .paid_media_info import PaidMediaInfo
from .photo_size import PhotoSize from .photo_size import PhotoSize
from .poll import Poll from .poll import Poll
from .sticker import Sticker from .sticker import Sticker
@ -54,6 +55,8 @@ class ExternalReplyInfo(TelegramObject):
"""*Optional*. Message is an audio file, information about the file""" """*Optional*. Message is an audio file, information about the file"""
document: Optional[Document] = None document: Optional[Document] = None
"""*Optional*. Message is a general file, information about the file""" """*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 photo: Optional[List[PhotoSize]] = None
"""*Optional*. Message is a photo, available sizes of the photo""" """*Optional*. Message is a photo, available sizes of the photo"""
sticker: Optional[Sticker] = None sticker: Optional[Sticker] = None
@ -103,6 +106,7 @@ class ExternalReplyInfo(TelegramObject):
animation: Optional[Animation] = None, animation: Optional[Animation] = None,
audio: Optional[Audio] = None, audio: Optional[Audio] = None,
document: Optional[Document] = None, document: Optional[Document] = None,
paid_media: Optional[PaidMediaInfo] = None,
photo: Optional[List[PhotoSize]] = None, photo: Optional[List[PhotoSize]] = None,
sticker: Optional[Sticker] = None, sticker: Optional[Sticker] = None,
story: Optional[Story] = None, story: Optional[Story] = None,
@ -133,6 +137,7 @@ class ExternalReplyInfo(TelegramObject):
animation=animation, animation=animation,
audio=audio, audio=audio,
document=document, document=document,
paid_media=paid_media,
photo=photo, photo=photo,
sticker=sticker, sticker=sticker,
story=story, story=story,

View file

@ -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
"""

View file

@ -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://<file_attach_name>' to upload a new one using multipart/form-data under <file_attach_name> name. :ref:`More information on Sending Files » <sending-files>`"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
type: Literal[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)

View file

@ -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://<file_attach_name>' to upload a new one using multipart/form-data under <file_attach_name> name. :ref:`More information on Sending Files » <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://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <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,
)

View file

@ -11,7 +11,7 @@ if TYPE_CHECKING:
class InputPollOption(TelegramObject): 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 Source: https://core.telegram.org/bots/api#inputpolloption
""" """

View file

@ -13,9 +13,9 @@ class Location(TelegramObject):
""" """
latitude: float latitude: float
"""Latitude as defined by sender""" """Latitude as defined by the sender"""
longitude: float longitude: float
"""Longitude as defined by sender""" """Longitude as defined by the sender"""
horizontal_accuracy: Optional[float] = None horizontal_accuracy: Optional[float] = None
"""*Optional*. The radius of uncertainty for the location, measured in meters; 0-1500""" """*Optional*. The radius of uncertainty for the location, measured in meters; 0-1500"""
live_period: Optional[int] = None live_period: Optional[int] = None

View file

@ -26,7 +26,7 @@ class MenuButton(MutableTelegramObject):
text: Optional[str] = None text: Optional[str] = None
"""*Optional*. Text on the button""" """*Optional*. Text on the button"""
web_app: Optional[WebAppInfo] = None 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: if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -21,7 +21,7 @@ class MenuButtonWebApp(MenuButton):
text: str text: str
"""Text on the button""" """Text on the button"""
web_app: WebAppInfo 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: if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -10,11 +10,11 @@ from aiogram.utils.text_decorations import (
html_decoration, html_decoration,
markdown_decoration, markdown_decoration,
) )
from . import InputPaidMediaPhoto, InputPaidMediaVideo
from ..client.default import Default from ..client.default import Default
from ..enums import ContentType from ..enums import ContentType
from .custom import DateTime from .custom import DateTime
from .input_poll_option import InputPollOption
from .maybe_inaccessible_message import MaybeInaccessibleMessage from .maybe_inaccessible_message import MaybeInaccessibleMessage
if TYPE_CHECKING: if TYPE_CHECKING:
@ -48,6 +48,7 @@ if TYPE_CHECKING:
SetMessageReaction, SetMessageReaction,
StopMessageLiveLocation, StopMessageLiveLocation,
UnpinChatMessage, UnpinChatMessage,
SendPaidMedia,
) )
from .animation import Animation from .animation import Animation
from .audio import Audio from .audio import Audio
@ -79,6 +80,7 @@ if TYPE_CHECKING:
from .input_media_document import InputMediaDocument from .input_media_document import InputMediaDocument
from .input_media_photo import InputMediaPhoto from .input_media_photo import InputMediaPhoto
from .input_media_video import InputMediaVideo from .input_media_video import InputMediaVideo
from .input_poll_option import InputPollOption
from .invoice import Invoice from .invoice import Invoice
from .labeled_price import LabeledPrice from .labeled_price import LabeledPrice
from .link_preview_options import LinkPreviewOptions from .link_preview_options import LinkPreviewOptions
@ -89,6 +91,7 @@ if TYPE_CHECKING:
from .message_origin_chat import MessageOriginChat from .message_origin_chat import MessageOriginChat
from .message_origin_hidden_user import MessageOriginHiddenUser from .message_origin_hidden_user import MessageOriginHiddenUser
from .message_origin_user import MessageOriginUser from .message_origin_user import MessageOriginUser
from .paid_media_info import PaidMediaInfo
from .passport_data import PassportData from .passport_data import PassportData
from .photo_size import PhotoSize from .photo_size import PhotoSize
from .poll import Poll from .poll import Poll
@ -184,6 +187,8 @@ class Message(MaybeInaccessibleMessage):
"""*Optional*. Message is an audio file, information about the file""" """*Optional*. Message is an audio file, information about the file"""
document: Optional[Document] = None document: Optional[Document] = None
"""*Optional*. Message is a general file, information about the file""" """*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 photo: Optional[List[PhotoSize]] = None
"""*Optional*. Message is a photo, available sizes of the photo""" """*Optional*. Message is a photo, available sizes of the photo"""
sticker: Optional[Sticker] = None sticker: Optional[Sticker] = None
@ -197,7 +202,7 @@ class Message(MaybeInaccessibleMessage):
voice: Optional[Voice] = None voice: Optional[Voice] = None
"""*Optional*. Message is a voice message, information about the file""" """*Optional*. Message is a voice message, information about the file"""
caption: Optional[str] = None 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 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""" """*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 show_caption_above_media: Optional[bool] = None
@ -371,6 +376,7 @@ class Message(MaybeInaccessibleMessage):
animation: Optional[Animation] = None, animation: Optional[Animation] = None,
audio: Optional[Audio] = None, audio: Optional[Audio] = None,
document: Optional[Document] = None, document: Optional[Document] = None,
paid_media: Optional[PaidMediaInfo] = None,
photo: Optional[List[PhotoSize]] = None, photo: Optional[List[PhotoSize]] = None,
sticker: Optional[Sticker] = None, sticker: Optional[Sticker] = None,
story: Optional[Story] = None, story: Optional[Story] = None,
@ -468,6 +474,7 @@ class Message(MaybeInaccessibleMessage):
animation=animation, animation=animation,
audio=audio, audio=audio,
document=document, document=document,
paid_media=paid_media,
photo=photo, photo=photo,
sticker=sticker, sticker=sticker,
story=story, story=story,
@ -590,6 +597,8 @@ class Message(MaybeInaccessibleMessage):
return ContentType.SUPERGROUP_CHAT_CREATED return ContentType.SUPERGROUP_CHAT_CREATED
if self.channel_chat_created: if self.channel_chat_created:
return ContentType.CHANNEL_CHAT_CREATED return ContentType.CHANNEL_CHAT_CREATED
if self.paid_media:
return ContentType.PAID_MEDIA
if self.passport_data: if self.passport_data:
return ContentType.PASSPORT_DATA return ContentType.PASSPORT_DATA
if self.proximity_alert_triggered: if self.proximity_alert_triggered:
@ -3430,6 +3439,8 @@ class Message(MaybeInaccessibleMessage):
**kwargs, **kwargs,
).as_(self._bot) ).as_(self._bot)
if self.poll: if self.poll:
from .input_poll_option import InputPollOption
return SendPoll( return SendPoll(
question=self.poll.question, question=self.poll.question,
options=[ options=[
@ -3483,7 +3494,7 @@ class Message(MaybeInaccessibleMessage):
- :code:`from_chat_id` - :code:`from_chat_id`
- :code:`message_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 Source: https://core.telegram.org/bots/api#copymessage
@ -4090,3 +4101,69 @@ class Message(MaybeInaccessibleMessage):
is_big=is_big, is_big=is_big,
**kwargs, **kwargs,
).as_(self._bot) ).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 <https://core.telegram.org/bots/api#formatting-options>`_ for more details.
:param caption_entities: A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*
:param show_caption_above_media: Pass :code:`True`, if the caption must be shown above the message media
:param disable_notification: Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. 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 <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user
: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)

View file

@ -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
"""

View file

@ -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)

View file

@ -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)

View file

@ -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
)

View file

@ -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)

View file

@ -28,7 +28,7 @@ class PreCheckoutQuery(TelegramObject):
total_amount: int 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 <https://core.telegram.org/bots/payments/currencies.json>`_, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies).""" """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 <https://core.telegram.org/bots/payments/currencies.json>`_, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies)."""
invoice_payload: str invoice_payload: str
"""Bot specified invoice payload""" """Bot-specified invoice payload"""
shipping_option_id: Optional[str] = None shipping_option_id: Optional[str] = None
"""*Optional*. Identifier of the shipping option chosen by the user""" """*Optional*. Identifier of the shipping option chosen by the user"""
order_info: Optional[OrderInfo] = None order_info: Optional[OrderInfo] = None

View file

@ -25,7 +25,7 @@ class ShippingQuery(TelegramObject):
from_user: User = Field(..., alias="from") from_user: User = Field(..., alias="from")
"""User who sent the query""" """User who sent the query"""
invoice_payload: str invoice_payload: str
"""Bot specified invoice payload""" """Bot-specified invoice payload"""
shipping_address: ShippingAddress shipping_address: ShippingAddress
"""User specified shipping address""" """User specified shipping address"""

View file

@ -8,6 +8,7 @@ from .custom import DateTime
if TYPE_CHECKING: if TYPE_CHECKING:
from .transaction_partner_fragment import TransactionPartnerFragment from .transaction_partner_fragment import TransactionPartnerFragment
from .transaction_partner_other import TransactionPartnerOther from .transaction_partner_other import TransactionPartnerOther
from .transaction_partner_telegram_ads import TransactionPartnerTelegramAds
from .transaction_partner_user import TransactionPartnerUser from .transaction_partner_user import TransactionPartnerUser
@ -25,11 +26,21 @@ class StarTransaction(TelegramObject):
date: DateTime date: DateTime
"""Date the transaction was created in Unix time""" """Date the transaction was created in Unix time"""
source: Optional[ source: Optional[
Union[TransactionPartnerFragment, TransactionPartnerUser, TransactionPartnerOther] Union[
TransactionPartnerUser,
TransactionPartnerFragment,
TransactionPartnerTelegramAds,
TransactionPartnerOther,
]
] = None ] = None
"""*Optional*. Source of an incoming transaction (e.g., a user purchasing goods or services, Fragment refunding a failed withdrawal). Only for incoming transactions""" """*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[ receiver: Optional[
Union[TransactionPartnerFragment, TransactionPartnerUser, TransactionPartnerOther] Union[
TransactionPartnerUser,
TransactionPartnerFragment,
TransactionPartnerTelegramAds,
TransactionPartnerOther,
]
] = None ] = None
"""*Optional*. Receiver of an outgoing transaction (e.g., a user for a purchase refund, Fragment for a withdrawal). Only for outgoing transactions""" """*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, amount: int,
date: DateTime, date: DateTime,
source: Optional[ source: Optional[
Union[TransactionPartnerFragment, TransactionPartnerUser, TransactionPartnerOther] Union[
TransactionPartnerUser,
TransactionPartnerFragment,
TransactionPartnerTelegramAds,
TransactionPartnerOther,
]
] = None, ] = None,
receiver: Optional[ receiver: Optional[
Union[TransactionPartnerFragment, TransactionPartnerUser, TransactionPartnerOther] Union[
TransactionPartnerUser,
TransactionPartnerFragment,
TransactionPartnerTelegramAds,
TransactionPartnerOther,
]
] = None, ] = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:

View file

@ -20,7 +20,7 @@ class SuccessfulPayment(TelegramObject):
total_amount: int 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 <https://core.telegram.org/bots/payments/currencies.json>`_, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies).""" """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 <https://core.telegram.org/bots/payments/currencies.json>`_, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies)."""
invoice_payload: str invoice_payload: str
"""Bot specified invoice payload""" """Bot-specified invoice payload"""
telegram_payment_charge_id: str telegram_payment_charge_id: str
"""Telegram payment identifier""" """Telegram payment identifier"""
provider_payment_charge_id: str provider_payment_charge_id: str

View file

@ -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 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_user.TransactionPartnerUser`
- :class:`aiogram.types.transaction_partner_fragment.TransactionPartnerFragment`
- :class:`aiogram.types.transaction_partner_telegram_ads.TransactionPartnerTelegramAds`
- :class:`aiogram.types.transaction_partner_other.TransactionPartnerOther` - :class:`aiogram.types.transaction_partner_other.TransactionPartnerOther`
Source: https://core.telegram.org/bots/api#transactionpartner Source: https://core.telegram.org/bots/api#transactionpartner

View file

@ -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)

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Literal from typing import TYPE_CHECKING, Any, Literal, Optional
from ..enums import TransactionPartnerType from ..enums import TransactionPartnerType
from .transaction_partner import TransactionPartner from .transaction_partner import TransactionPartner
@ -20,6 +20,8 @@ class TransactionPartnerUser(TransactionPartner):
"""Type of the transaction partner, always 'user'""" """Type of the transaction partner, always 'user'"""
user: User user: User
"""Information about the user""" """Information about the user"""
invoice_payload: Optional[str] = None
"""*Optional*. Bot-specified invoice payload"""
if TYPE_CHECKING: if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!
@ -30,10 +32,13 @@ class TransactionPartnerUser(TransactionPartner):
*, *,
type: Literal[TransactionPartnerType.USER] = TransactionPartnerType.USER, type: Literal[TransactionPartnerType.USER] = TransactionPartnerType.USER,
user: User, user: User,
invoice_payload: Optional[str] = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher` # This method was auto-generated via `butcher`
# Is needed only for type checking and IDE support without any additional plugins # 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
)

View file

@ -20,17 +20,17 @@ class Video(TelegramObject):
file_unique_id: str 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.""" """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 width: int
"""Video width as defined by sender""" """Video width as defined by the sender"""
height: int height: int
"""Video height as defined by sender""" """Video height as defined by the sender"""
duration: int 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 thumbnail: Optional[PhotoSize] = None
"""*Optional*. Video thumbnail""" """*Optional*. Video thumbnail"""
file_name: Optional[str] = None 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 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 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.""" """*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."""

View file

@ -20,9 +20,9 @@ class VideoNote(TelegramObject):
file_unique_id: str 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.""" """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 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: 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 thumbnail: Optional[PhotoSize] = None
"""*Optional*. Video thumbnail""" """*Optional*. Video thumbnail"""
file_size: Optional[int] = None file_size: Optional[int] = None

View file

@ -17,9 +17,9 @@ class Voice(TelegramObject):
file_unique_id: str 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.""" """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: 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 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 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.""" """*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."""

View file

@ -21,11 +21,13 @@ Here is list of all available enums:
encrypted_passport_element encrypted_passport_element
inline_query_result_type inline_query_result_type
input_media_type input_media_type
input_paid_media_type
keyboard_button_poll_type_type keyboard_button_poll_type_type
mask_position_point mask_position_point
menu_button_type menu_button_type
message_entity_type message_entity_type
message_origin_type message_origin_type
paid_media_type
parse_mode parse_mode
passport_element_error_type passport_element_error_type
poll_type poll_type

View file

@ -0,0 +1,9 @@
##################
InputPaidMediaType
##################
.. automodule:: aiogram.enums.input_paid_media_type
:members:
:member-order: bysource
:undoc-members: True

View file

@ -0,0 +1,9 @@
#############
PaidMediaType
#############
.. automodule:: aiogram.enums.paid_media_type
:members:
:member-order: bysource
:undoc-members: True

View file

@ -90,6 +90,7 @@ Available methods
send_location send_location
send_media_group send_media_group
send_message send_message
send_paid_media
send_photo send_photo
send_poll send_poll
send_venue send_venue

View file

@ -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`

View file

@ -95,6 +95,9 @@ Available types
input_media_document input_media_document
input_media_photo input_media_photo
input_media_video input_media_video
input_paid_media
input_paid_media_photo
input_paid_media_video
input_poll_option input_poll_option
keyboard_button keyboard_button
keyboard_button_poll_type keyboard_button_poll_type
@ -120,6 +123,11 @@ Available types
message_origin_user message_origin_user
message_reaction_count_updated message_reaction_count_updated
message_reaction_updated message_reaction_updated
paid_media
paid_media_info
paid_media_photo
paid_media_preview
paid_media_video
photo_size photo_size
poll poll
poll_answer poll_answer
@ -247,6 +255,7 @@ Payments
transaction_partner transaction_partner
transaction_partner_fragment transaction_partner_fragment
transaction_partner_other transaction_partner_other
transaction_partner_telegram_ads
transaction_partner_user transaction_partner_user
Getting updates Getting updates

View file

@ -0,0 +1,10 @@
##############
InputPaidMedia
##############
.. automodule:: aiogram.types.input_paid_media
:members:
:member-order: bysource
:undoc-members: True
:exclude-members: model_config,model_fields

View file

@ -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

View file

@ -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

View file

@ -0,0 +1,10 @@
#########
PaidMedia
#########
.. automodule:: aiogram.types.paid_media
:members:
:member-order: bysource
:undoc-members: True
:exclude-members: model_config,model_fields

View file

@ -0,0 +1,10 @@
#############
PaidMediaInfo
#############
.. automodule:: aiogram.types.paid_media_info
:members:
:member-order: bysource
:undoc-members: True
:exclude-members: model_config,model_fields

View file

@ -0,0 +1,10 @@
##############
PaidMediaPhoto
##############
.. automodule:: aiogram.types.paid_media_photo
:members:
:member-order: bysource
:undoc-members: True
:exclude-members: model_config,model_fields

View file

@ -0,0 +1,10 @@
################
PaidMediaPreview
################
.. automodule:: aiogram.types.paid_media_preview
:members:
:member-order: bysource
:undoc-members: True
:exclude-members: model_config,model_fields

View file

@ -0,0 +1,10 @@
##############
PaidMediaVideo
##############
.. automodule:: aiogram.types.paid_media_video
:members:
:member-order: bysource
:undoc-members: True
:exclude-members: model_config,model_fields

View file

@ -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

View file

@ -4,7 +4,6 @@ from os import getenv
from typing import Any, Dict, Union from typing import Any, Dict, Union
from aiohttp import web from aiohttp import web
from finite_state_machine import form_router
from aiogram import Bot, Dispatcher, F, Router from aiogram import Bot, Dispatcher, F, Router
from aiogram.client.session.aiohttp import AiohttpSession from aiogram.client.session.aiohttp import AiohttpSession
@ -19,6 +18,7 @@ from aiogram.webhook.aiohttp_server import (
TokenBasedRequestHandler, TokenBasedRequestHandler,
setup_application, setup_application,
) )
from finite_state_machine import form_router
main_router = Router() main_router = Router()

View file

@ -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

View file

@ -35,6 +35,7 @@ from aiogram.methods import (
StopMessageLiveLocation, StopMessageLiveLocation,
TelegramMethod, TelegramMethod,
UnpinChatMessage, UnpinChatMessage,
SendPaidMedia,
) )
from aiogram.types import ( from aiogram.types import (
UNSET_PARSE_MODE, UNSET_PARSE_MODE,
@ -68,6 +69,8 @@ from aiogram.types import (
Location, Location,
MessageAutoDeleteTimerChanged, MessageAutoDeleteTimerChanged,
MessageEntity, MessageEntity,
PaidMediaInfo,
PaidMediaPhoto,
PassportData, PassportData,
PhotoSize, PhotoSize,
Poll, Poll,
@ -331,6 +334,22 @@ TEST_MESSAGE_CHANNEL_CHAT_CREATED = Message(
chat=Chat(id=-10042, type="channel"), chat=Chat(id=-10042, type="channel"),
from_user=User(id=42, is_bot=False, first_name="Test"), 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( TEST_MESSAGE_PASSPORT_DATA = Message(
message_id=42, message_id=42,
date=datetime.datetime.now(), date=datetime.datetime.now(),
@ -603,6 +622,7 @@ MESSAGES_AND_CONTENT_TYPES = [
[TEST_MESSAGE_GROUP_CHAT_CREATED, ContentType.GROUP_CHAT_CREATED], [TEST_MESSAGE_GROUP_CHAT_CREATED, ContentType.GROUP_CHAT_CREATED],
[TEST_MESSAGE_SUPERGROUP_CHAT_CREATED, ContentType.SUPERGROUP_CHAT_CREATED], [TEST_MESSAGE_SUPERGROUP_CHAT_CREATED, ContentType.SUPERGROUP_CHAT_CREATED],
[TEST_MESSAGE_CHANNEL_CHAT_CREATED, ContentType.CHANNEL_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_PASSPORT_DATA, ContentType.PASSPORT_DATA],
[TEST_MESSAGE_PROXIMITY_ALERT_TRIGGERED, ContentType.PROXIMITY_ALERT_TRIGGERED], [TEST_MESSAGE_PROXIMITY_ALERT_TRIGGERED, ContentType.PROXIMITY_ALERT_TRIGGERED],
[TEST_MESSAGE_POLL, ContentType.POLL], [TEST_MESSAGE_POLL, ContentType.POLL],
@ -669,6 +689,7 @@ MESSAGES_AND_COPY_METHODS = [
[TEST_MESSAGE_GROUP_CHAT_CREATED, None], [TEST_MESSAGE_GROUP_CHAT_CREATED, None],
[TEST_MESSAGE_SUPERGROUP_CHAT_CREATED, None], [TEST_MESSAGE_SUPERGROUP_CHAT_CREATED, None],
[TEST_MESSAGE_CHANNEL_CHAT_CREATED, None], [TEST_MESSAGE_CHANNEL_CHAT_CREATED, None],
[TEST_MESSAGE_PAID_MEDIA, None],
[TEST_MESSAGE_PASSPORT_DATA, None], [TEST_MESSAGE_PASSPORT_DATA, None],
[TEST_MESSAGE_PROXIMITY_ALERT_TRIGGERED, None], [TEST_MESSAGE_PROXIMITY_ALERT_TRIGGERED, None],
[TEST_MESSAGE_POLL, SendPoll], [TEST_MESSAGE_POLL, SendPoll],
@ -778,6 +799,7 @@ class TestMessage:
["video", dict(video="video"), SendVideo], ["video", dict(video="video"), SendVideo],
["video_note", dict(video_note="video_note"), SendVideoNote], ["video_note", dict(video_note="video_note"), SendVideoNote],
["voice", dict(voice="voice"), SendVoice], ["voice", dict(voice="voice"), SendVoice],
["paid_media", dict(media=[], star_count=42), SendPaidMedia],
], ],
) )
@pytest.mark.parametrize("alias_type", ["reply", "answer"]) @pytest.mark.parametrize("alias_type", ["reply", "answer"])
@ -805,9 +827,14 @@ class TestMessage:
SendVideo, SendVideo,
SendVideoNote, SendVideoNote,
SendVoice, 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 = Message(
message_id=42, chat=Chat(id=42, type="private"), date=datetime.datetime.now() 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 isinstance(api_method, method_class)
assert api_method.chat_id == message.chat.id assert api_method.chat_id == message.chat.id
if alias_type == "reply": if hasattr(api_method, "reply_to_message_id"):
assert api_method.reply_to_message_id == message.message_id if alias_type == "reply":
else: assert api_method.reply_to_message_id == message.message_id
assert api_method.reply_to_message_id is None else:
assert api_method.reply_to_message_id is None
for key, value in kwargs.items(): for key, value in kwargs.items():
assert getattr(api_method, key) == value assert getattr(api_method, key) == value