Added full support of Bot API 7.5 (#1518)

* Added full support of Bot API 7.5

* Added changelog

* Update date type in RevenueWithdrawalStateSucceeded

* Added example
This commit is contained in:
Alex Root Junior 2024-06-19 00:54:22 +03:00 committed by GitHub
parent dcfc9632f3
commit 1f7bbeb355
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
72 changed files with 1629 additions and 51 deletions

View file

@ -0,0 +1,12 @@
name: RevenueWithdrawalStateType
description: |
This object represents a revenue withdrawal state type
Source: https://core.telegram.org/bots/api#revenuewithdrawalstate
multi_parse:
attribute: type
regexp: "'([a-z_]+)'"
entities:
- RevenueWithdrawalStateFailed
- RevenueWithdrawalStatePending
- RevenueWithdrawalStateSucceeded

View file

@ -0,0 +1,12 @@
name: TransactionPartnerType
description: |
This object represents a type of transaction partner.
Source: https://core.telegram.org/bots/api#transactionpartner
multi_parse:
attribute: type
regexp: "'([a-z_]+)'"
entities:
- TransactionPartnerFragment
- TransactionPartnerOther
- TransactionPartnerUser

View file

@ -7,10 +7,18 @@
"object": { "object": {
"anchor": "editmessagecaption", "anchor": "editmessagecaption",
"name": "editMessageCaption", "name": "editMessageCaption",
"description": "Use this method to edit captions of messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned.", "description": "Use this method to edit captions of messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent.",
"html_description": "<p>Use this method to edit captions of messages. On success, if the edited message is not an inline message, the edited <a href=\"#message\">Message</a> is returned, otherwise <em>True</em> is returned.</p>", "html_description": "<p>Use this method to edit captions of messages. On success, if the edited message is not an inline message, the edited <a href=\"#message\">Message</a> is returned, otherwise <em>True</em> is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within <strong>48 hours</strong> from the time they were sent.</p>",
"rst_description": "Use this method to edit captions of messages. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned.", "rst_description": "Use this method to edit captions of messages. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within **48 hours** from the time they were sent.",
"annotations": [ "annotations": [
{
"type": "String",
"required": false,
"description": "Unique identifier of the business connection on behalf of which the message to be edited was sent",
"html_description": "<td>Unique identifier of the business connection on behalf of which the message to be edited was sent</td>",
"rst_description": "Unique identifier of the business connection on behalf of which the message to be edited was sent\n",
"name": "business_connection_id"
},
{ {
"type": "Integer or String", "type": "Integer or String",
"required": false, "required": false,

View file

@ -11,6 +11,14 @@
"html_description": "<p>Use this method to edit live location messages. A location can be edited until its <em>live_period</em> expires or editing is explicitly disabled by a call to <a href=\"#stopmessagelivelocation\">stopMessageLiveLocation</a>. On success, if the edited message is not an inline message, the edited <a href=\"#message\">Message</a> is returned, otherwise <em>True</em> is returned.</p>", "html_description": "<p>Use this method to edit live location messages. A location can be edited until its <em>live_period</em> expires or editing is explicitly disabled by a call to <a href=\"#stopmessagelivelocation\">stopMessageLiveLocation</a>. On success, if the edited message is not an inline message, the edited <a href=\"#message\">Message</a> is returned, otherwise <em>True</em> is returned.</p>",
"rst_description": "Use this method to edit live location messages. A location can be edited until its *live_period* expires or editing is explicitly disabled by a call to :class:`aiogram.methods.stop_message_live_location.StopMessageLiveLocation`. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned.", "rst_description": "Use this method to edit live location messages. A location can be edited until its *live_period* expires or editing is explicitly disabled by a call to :class:`aiogram.methods.stop_message_live_location.StopMessageLiveLocation`. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned.",
"annotations": [ "annotations": [
{
"type": "String",
"required": false,
"description": "Unique identifier of the business connection on behalf of which the message to be edited was sent",
"html_description": "<td>Unique identifier of the business connection on behalf of which the message to be edited was sent</td>",
"rst_description": "Unique identifier of the business connection on behalf of which the message to be edited was sent\n",
"name": "business_connection_id"
},
{ {
"type": "Integer or String", "type": "Integer or String",
"required": false, "required": false,

View file

@ -7,10 +7,18 @@
"object": { "object": {
"anchor": "editmessagemedia", "anchor": "editmessagemedia",
"name": "editMessageMedia", "name": "editMessageMedia",
"description": "Use this method to edit animation, audio, document, photo, or video messages. If a message is part of a message album, then it can be edited only to an audio for audio albums, only to a document for document albums and to a photo or a video otherwise. When an inline message is edited, a new file can't be uploaded; use a previously uploaded file via its file_id or specify a URL. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned.", "description": "Use this method to edit animation, audio, document, photo, or video messages. If a message is part of a message album, then it can be edited only to an audio for audio albums, only to a document for document albums and to a photo or a video otherwise. When an inline message is edited, a new file can't be uploaded; use a previously uploaded file via its file_id or specify a URL. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent.",
"html_description": "<p>Use this method to edit animation, audio, document, photo, or video messages. If a message is part of a message album, then it can be edited only to an audio for audio albums, only to a document for document albums and to a photo or a video otherwise. When an inline message is edited, a new file can't be uploaded; use a previously uploaded file via its file_id or specify a URL. On success, if the edited message is not an inline message, the edited <a href=\"#message\">Message</a> is returned, otherwise <em>True</em> is returned.</p>", "html_description": "<p>Use this method to edit animation, audio, document, photo, or video messages. If a message is part of a message album, then it can be edited only to an audio for audio albums, only to a document for document albums and to a photo or a video otherwise. When an inline message is edited, a new file can't be uploaded; use a previously uploaded file via its file_id or specify a URL. On success, if the edited message is not an inline message, the edited <a href=\"#message\">Message</a> is returned, otherwise <em>True</em> is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within <strong>48 hours</strong> from the time they were sent.</p>",
"rst_description": "Use this method to edit animation, audio, document, photo, or video messages. If a message is part of a message album, then it can be edited only to an audio for audio albums, only to a document for document albums and to a photo or a video otherwise. When an inline message is edited, a new file can't be uploaded; use a previously uploaded file via its file_id or specify a URL. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned.", "rst_description": "Use this method to edit animation, audio, document, photo, or video messages. If a message is part of a message album, then it can be edited only to an audio for audio albums, only to a document for document albums and to a photo or a video otherwise. When an inline message is edited, a new file can't be uploaded; use a previously uploaded file via its file_id or specify a URL. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within **48 hours** from the time they were sent.",
"annotations": [ "annotations": [
{
"type": "String",
"required": false,
"description": "Unique identifier of the business connection on behalf of which the message to be edited was sent",
"html_description": "<td>Unique identifier of the business connection on behalf of which the message to be edited was sent</td>",
"rst_description": "Unique identifier of the business connection on behalf of which the message to be edited was sent\n",
"name": "business_connection_id"
},
{ {
"type": "Integer or String", "type": "Integer or String",
"required": false, "required": false,

View file

@ -7,10 +7,18 @@
"object": { "object": {
"anchor": "editmessagereplymarkup", "anchor": "editmessagereplymarkup",
"name": "editMessageReplyMarkup", "name": "editMessageReplyMarkup",
"description": "Use this method to edit only the reply markup of messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned.", "description": "Use this method to edit only the reply markup of messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent.",
"html_description": "<p>Use this method to edit only the reply markup of messages. On success, if the edited message is not an inline message, the edited <a href=\"#message\">Message</a> is returned, otherwise <em>True</em> is returned.</p>", "html_description": "<p>Use this method to edit only the reply markup of messages. On success, if the edited message is not an inline message, the edited <a href=\"#message\">Message</a> is returned, otherwise <em>True</em> is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within <strong>48 hours</strong> from the time they were sent.</p>",
"rst_description": "Use this method to edit only the reply markup of messages. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned.", "rst_description": "Use this method to edit only the reply markup of messages. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within **48 hours** from the time they were sent.",
"annotations": [ "annotations": [
{
"type": "String",
"required": false,
"description": "Unique identifier of the business connection on behalf of which the message to be edited was sent",
"html_description": "<td>Unique identifier of the business connection on behalf of which the message to be edited was sent</td>",
"rst_description": "Unique identifier of the business connection on behalf of which the message to be edited was sent\n",
"name": "business_connection_id"
},
{ {
"type": "Integer or String", "type": "Integer or String",
"required": false, "required": false,

View file

@ -7,10 +7,18 @@
"object": { "object": {
"anchor": "editmessagetext", "anchor": "editmessagetext",
"name": "editMessageText", "name": "editMessageText",
"description": "Use this method to edit text and game messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned.", "description": "Use this method to edit text and game messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent.",
"html_description": "<p>Use this method to edit text and <a href=\"#games\">game</a> messages. On success, if the edited message is not an inline message, the edited <a href=\"#message\">Message</a> is returned, otherwise <em>True</em> is returned.</p>", "html_description": "<p>Use this method to edit text and <a href=\"#games\">game</a> messages. On success, if the edited message is not an inline message, the edited <a href=\"#message\">Message</a> is returned, otherwise <em>True</em> is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within <strong>48 hours</strong> from the time they were sent.</p>",
"rst_description": "Use this method to edit text and `game <https://core.telegram.org/bots/api#games>`_ messages. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned.", "rst_description": "Use this method to edit text and `game <https://core.telegram.org/bots/api#games>`_ messages. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within **48 hours** from the time they were sent.",
"annotations": [ "annotations": [
{
"type": "String",
"required": false,
"description": "Unique identifier of the business connection on behalf of which the message to be edited was sent",
"html_description": "<td>Unique identifier of the business connection on behalf of which the message to be edited was sent</td>",
"rst_description": "Unique identifier of the business connection on behalf of which the message to be edited was sent\n",
"name": "business_connection_id"
},
{ {
"type": "Integer or String", "type": "Integer or String",
"required": false, "required": false,

View file

@ -0,0 +1,33 @@
{
"meta": {},
"group": {
"title": "Payments",
"anchor": "payments"
},
"object": {
"anchor": "getstartransactions",
"name": "getStarTransactions",
"description": "Returns the bot's Telegram Star transactions in chronological order. On success, returns a StarTransactions object.",
"html_description": "<p>Returns the bot's Telegram Star transactions in chronological order. On success, returns a <a href=\"#startransactions\">StarTransactions</a> object.</p>",
"rst_description": "Returns the bot's Telegram Star transactions in chronological order. On success, returns a :class:`aiogram.types.star_transactions.StarTransactions` object.",
"annotations": [
{
"type": "Integer",
"required": false,
"description": "Number of transactions to skip in the response",
"html_description": "<td>Number of transactions to skip in the response</td>",
"rst_description": "Number of transactions to skip in the response\n",
"name": "offset"
},
{
"type": "Integer",
"required": false,
"description": "The maximum number of transactions to be retrieved. Values between 1-100 are accepted. Defaults to 100.",
"html_description": "<td>The maximum number of transactions to be retrieved. Values between 1-100 are accepted. Defaults to 100.</td>",
"rst_description": "The maximum number of transactions to be retrieved. Values between 1-100 are accepted. Defaults to 100.\n",
"name": "limit"
}
],
"category": "methods"
}
}

View file

@ -11,6 +11,14 @@
"html_description": "<p>Use this method to stop updating a live location message before <em>live_period</em> expires. On success, if the message is not an inline message, the edited <a href=\"#message\">Message</a> is returned, otherwise <em>True</em> is returned.</p>", "html_description": "<p>Use this method to stop updating a live location message before <em>live_period</em> expires. On success, if the message is not an inline message, the edited <a href=\"#message\">Message</a> is returned, otherwise <em>True</em> is returned.</p>",
"rst_description": "Use this method to stop updating a live location message before *live_period* expires. On success, if the message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned.", "rst_description": "Use this method to stop updating a live location message before *live_period* expires. On success, if the message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned.",
"annotations": [ "annotations": [
{
"type": "String",
"required": false,
"description": "Unique identifier of the business connection on behalf of which the message to be edited was sent",
"html_description": "<td>Unique identifier of the business connection on behalf of which the message to be edited was sent</td>",
"rst_description": "Unique identifier of the business connection on behalf of which the message to be edited was sent\n",
"name": "business_connection_id"
},
{ {
"type": "Integer or String", "type": "Integer or String",
"required": false, "required": false,

View file

@ -11,6 +11,14 @@
"html_description": "<p>Use this method to stop a poll which was sent by the bot. On success, the stopped <a href=\"#poll\">Poll</a> is returned.</p>", "html_description": "<p>Use this method to stop a poll which was sent by the bot. On success, the stopped <a href=\"#poll\">Poll</a> is returned.</p>",
"rst_description": "Use this method to stop a poll which was sent by the bot. On success, the stopped :class:`aiogram.types.poll.Poll` is returned.", "rst_description": "Use this method to stop a poll which was sent by the bot. On success, the stopped :class:`aiogram.types.poll.Poll` is returned.",
"annotations": [ "annotations": [
{
"type": "String",
"required": false,
"description": "Unique identifier of the business connection on behalf of which the message to be edited was sent",
"html_description": "<td>Unique identifier of the business connection on behalf of which the message to be edited was sent</td>",
"rst_description": "Unique identifier of the business connection on behalf of which the message to be edited was sent\n",
"name": "business_connection_id"
},
{ {
"type": "Integer or String", "type": "Integer or String",
"required": true, "required": true,

View file

@ -1,7 +1,7 @@
{ {
"api": { "api": {
"version": "7.4", "version": "7.5",
"release_date": "2024-05-28" "release_date": "2024-06-18"
}, },
"items": [ "items": [
{ {
@ -4583,9 +4583,9 @@
}, },
{ {
"type": "String", "type": "String",
"description": "Data to be sent in a callback query to the bot when button is pressed, 1-64 bytes. Not supported for messages sent on behalf of a Telegram Business account.", "description": "Data to be sent in a callback query to the bot when the button is pressed, 1-64 bytes",
"html_description": "<td><em>Optional</em>. Data to be sent in a <a href=\"#callbackquery\">callback query</a> to the bot when button is pressed, 1-64 bytes. Not supported for messages sent on behalf of a Telegram Business account.</td>", "html_description": "<td><em>Optional</em>. Data to be sent in a <a href=\"#callbackquery\">callback query</a> to the bot when the button is pressed, 1-64 bytes</td>",
"rst_description": "*Optional*. Data to be sent in a `callback query <https://core.telegram.org/bots/api#callbackquery>`_ to the bot when button is pressed, 1-64 bytes. Not supported for messages sent on behalf of a Telegram Business account.\n", "rst_description": "*Optional*. Data to be sent in a `callback query <https://core.telegram.org/bots/api#callbackquery>`_ to the bot when the button is pressed, 1-64 bytes\n",
"name": "callback_data", "name": "callback_data",
"required": false "required": false
}, },
@ -11146,10 +11146,18 @@
{ {
"anchor": "editmessagetext", "anchor": "editmessagetext",
"name": "editMessageText", "name": "editMessageText",
"description": "Use this method to edit text and game messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned.", "description": "Use this method to edit text and game messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent.",
"html_description": "<p>Use this method to edit text and <a href=\"#games\">game</a> messages. On success, if the edited message is not an inline message, the edited <a href=\"#message\">Message</a> is returned, otherwise <em>True</em> is returned.</p>", "html_description": "<p>Use this method to edit text and <a href=\"#games\">game</a> messages. On success, if the edited message is not an inline message, the edited <a href=\"#message\">Message</a> is returned, otherwise <em>True</em> is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within <strong>48 hours</strong> from the time they were sent.</p>",
"rst_description": "Use this method to edit text and `game <https://core.telegram.org/bots/api#games>`_ messages. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned.", "rst_description": "Use this method to edit text and `game <https://core.telegram.org/bots/api#games>`_ messages. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within **48 hours** from the time they were sent.",
"annotations": [ "annotations": [
{
"type": "String",
"required": false,
"description": "Unique identifier of the business connection on behalf of which the message to be edited was sent",
"html_description": "<td>Unique identifier of the business connection on behalf of which the message to be edited was sent</td>",
"rst_description": "Unique identifier of the business connection on behalf of which the message to be edited was sent\n",
"name": "business_connection_id"
},
{ {
"type": "Integer or String", "type": "Integer or String",
"required": false, "required": false,
@ -11220,10 +11228,18 @@
{ {
"anchor": "editmessagecaption", "anchor": "editmessagecaption",
"name": "editMessageCaption", "name": "editMessageCaption",
"description": "Use this method to edit captions of messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned.", "description": "Use this method to edit captions of messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent.",
"html_description": "<p>Use this method to edit captions of messages. On success, if the edited message is not an inline message, the edited <a href=\"#message\">Message</a> is returned, otherwise <em>True</em> is returned.</p>", "html_description": "<p>Use this method to edit captions of messages. On success, if the edited message is not an inline message, the edited <a href=\"#message\">Message</a> is returned, otherwise <em>True</em> is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within <strong>48 hours</strong> from the time they were sent.</p>",
"rst_description": "Use this method to edit captions of messages. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned.", "rst_description": "Use this method to edit captions of messages. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within **48 hours** from the time they were sent.",
"annotations": [ "annotations": [
{
"type": "String",
"required": false,
"description": "Unique identifier of the business connection on behalf of which the message to be edited was sent",
"html_description": "<td>Unique identifier of the business connection on behalf of which the message to be edited was sent</td>",
"rst_description": "Unique identifier of the business connection on behalf of which the message to be edited was sent\n",
"name": "business_connection_id"
},
{ {
"type": "Integer or String", "type": "Integer or String",
"required": false, "required": false,
@ -11294,10 +11310,18 @@
{ {
"anchor": "editmessagemedia", "anchor": "editmessagemedia",
"name": "editMessageMedia", "name": "editMessageMedia",
"description": "Use this method to edit animation, audio, document, photo, or video messages. If a message is part of a message album, then it can be edited only to an audio for audio albums, only to a document for document albums and to a photo or a video otherwise. When an inline message is edited, a new file can't be uploaded; use a previously uploaded file via its file_id or specify a URL. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned.", "description": "Use this method to edit animation, audio, document, photo, or video messages. If a message is part of a message album, then it can be edited only to an audio for audio albums, only to a document for document albums and to a photo or a video otherwise. When an inline message is edited, a new file can't be uploaded; use a previously uploaded file via its file_id or specify a URL. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent.",
"html_description": "<p>Use this method to edit animation, audio, document, photo, or video messages. If a message is part of a message album, then it can be edited only to an audio for audio albums, only to a document for document albums and to a photo or a video otherwise. When an inline message is edited, a new file can't be uploaded; use a previously uploaded file via its file_id or specify a URL. On success, if the edited message is not an inline message, the edited <a href=\"#message\">Message</a> is returned, otherwise <em>True</em> is returned.</p>", "html_description": "<p>Use this method to edit animation, audio, document, photo, or video messages. If a message is part of a message album, then it can be edited only to an audio for audio albums, only to a document for document albums and to a photo or a video otherwise. When an inline message is edited, a new file can't be uploaded; use a previously uploaded file via its file_id or specify a URL. On success, if the edited message is not an inline message, the edited <a href=\"#message\">Message</a> is returned, otherwise <em>True</em> is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within <strong>48 hours</strong> from the time they were sent.</p>",
"rst_description": "Use this method to edit animation, audio, document, photo, or video messages. If a message is part of a message album, then it can be edited only to an audio for audio albums, only to a document for document albums and to a photo or a video otherwise. When an inline message is edited, a new file can't be uploaded; use a previously uploaded file via its file_id or specify a URL. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned.", "rst_description": "Use this method to edit animation, audio, document, photo, or video messages. If a message is part of a message album, then it can be edited only to an audio for audio albums, only to a document for document albums and to a photo or a video otherwise. When an inline message is edited, a new file can't be uploaded; use a previously uploaded file via its file_id or specify a URL. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within **48 hours** from the time they were sent.",
"annotations": [ "annotations": [
{
"type": "String",
"required": false,
"description": "Unique identifier of the business connection on behalf of which the message to be edited was sent",
"html_description": "<td>Unique identifier of the business connection on behalf of which the message to be edited was sent</td>",
"rst_description": "Unique identifier of the business connection on behalf of which the message to be edited was sent\n",
"name": "business_connection_id"
},
{ {
"type": "Integer or String", "type": "Integer or String",
"required": false, "required": false,
@ -11348,6 +11372,14 @@
"html_description": "<p>Use this method to edit live location messages. A location can be edited until its <em>live_period</em> expires or editing is explicitly disabled by a call to <a href=\"#stopmessagelivelocation\">stopMessageLiveLocation</a>. On success, if the edited message is not an inline message, the edited <a href=\"#message\">Message</a> is returned, otherwise <em>True</em> is returned.</p>", "html_description": "<p>Use this method to edit live location messages. A location can be edited until its <em>live_period</em> expires or editing is explicitly disabled by a call to <a href=\"#stopmessagelivelocation\">stopMessageLiveLocation</a>. On success, if the edited message is not an inline message, the edited <a href=\"#message\">Message</a> is returned, otherwise <em>True</em> is returned.</p>",
"rst_description": "Use this method to edit live location messages. A location can be edited until its *live_period* expires or editing is explicitly disabled by a call to :class:`aiogram.methods.stop_message_live_location.StopMessageLiveLocation`. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned.", "rst_description": "Use this method to edit live location messages. A location can be edited until its *live_period* expires or editing is explicitly disabled by a call to :class:`aiogram.methods.stop_message_live_location.StopMessageLiveLocation`. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned.",
"annotations": [ "annotations": [
{
"type": "String",
"required": false,
"description": "Unique identifier of the business connection on behalf of which the message to be edited was sent",
"html_description": "<td>Unique identifier of the business connection on behalf of which the message to be edited was sent</td>",
"rst_description": "Unique identifier of the business connection on behalf of which the message to be edited was sent\n",
"name": "business_connection_id"
},
{ {
"type": "Integer or String", "type": "Integer or String",
"required": false, "required": false,
@ -11438,6 +11470,14 @@
"html_description": "<p>Use this method to stop updating a live location message before <em>live_period</em> expires. On success, if the message is not an inline message, the edited <a href=\"#message\">Message</a> is returned, otherwise <em>True</em> is returned.</p>", "html_description": "<p>Use this method to stop updating a live location message before <em>live_period</em> expires. On success, if the message is not an inline message, the edited <a href=\"#message\">Message</a> is returned, otherwise <em>True</em> is returned.</p>",
"rst_description": "Use this method to stop updating a live location message before *live_period* expires. On success, if the message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned.", "rst_description": "Use this method to stop updating a live location message before *live_period* expires. On success, if the message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned.",
"annotations": [ "annotations": [
{
"type": "String",
"required": false,
"description": "Unique identifier of the business connection on behalf of which the message to be edited was sent",
"html_description": "<td>Unique identifier of the business connection on behalf of which the message to be edited was sent</td>",
"rst_description": "Unique identifier of the business connection on behalf of which the message to be edited was sent\n",
"name": "business_connection_id"
},
{ {
"type": "Integer or String", "type": "Integer or String",
"required": false, "required": false,
@ -11476,10 +11516,18 @@
{ {
"anchor": "editmessagereplymarkup", "anchor": "editmessagereplymarkup",
"name": "editMessageReplyMarkup", "name": "editMessageReplyMarkup",
"description": "Use this method to edit only the reply markup of messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned.", "description": "Use this method to edit only the reply markup of messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent.",
"html_description": "<p>Use this method to edit only the reply markup of messages. On success, if the edited message is not an inline message, the edited <a href=\"#message\">Message</a> is returned, otherwise <em>True</em> is returned.</p>", "html_description": "<p>Use this method to edit only the reply markup of messages. On success, if the edited message is not an inline message, the edited <a href=\"#message\">Message</a> is returned, otherwise <em>True</em> is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within <strong>48 hours</strong> from the time they were sent.</p>",
"rst_description": "Use this method to edit only the reply markup of messages. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned.", "rst_description": "Use this method to edit only the reply markup of messages. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within **48 hours** from the time they were sent.",
"annotations": [ "annotations": [
{
"type": "String",
"required": false,
"description": "Unique identifier of the business connection on behalf of which the message to be edited was sent",
"html_description": "<td>Unique identifier of the business connection on behalf of which the message to be edited was sent</td>",
"rst_description": "Unique identifier of the business connection on behalf of which the message to be edited was sent\n",
"name": "business_connection_id"
},
{ {
"type": "Integer or String", "type": "Integer or String",
"required": false, "required": false,
@ -11522,6 +11570,14 @@
"html_description": "<p>Use this method to stop a poll which was sent by the bot. On success, the stopped <a href=\"#poll\">Poll</a> is returned.</p>", "html_description": "<p>Use this method to stop a poll which was sent by the bot. On success, the stopped <a href=\"#poll\">Poll</a> is returned.</p>",
"rst_description": "Use this method to stop a poll which was sent by the bot. On success, the stopped :class:`aiogram.types.poll.Poll` is returned.", "rst_description": "Use this method to stop a poll which was sent by the bot. On success, the stopped :class:`aiogram.types.poll.Poll` is returned.",
"annotations": [ "annotations": [
{
"type": "String",
"required": false,
"description": "Unique identifier of the business connection on behalf of which the message to be edited was sent",
"html_description": "<td>Unique identifier of the business connection on behalf of which the message to be edited was sent</td>",
"rst_description": "Unique identifier of the business connection on behalf of which the message to be edited was sent\n",
"name": "business_connection_id"
},
{ {
"type": "Integer or String", "type": "Integer or String",
"required": true, "required": true,
@ -15542,6 +15598,32 @@
], ],
"category": "methods" "category": "methods"
}, },
{
"anchor": "getstartransactions",
"name": "getStarTransactions",
"description": "Returns the bot's Telegram Star transactions in chronological order. On success, returns a StarTransactions object.",
"html_description": "<p>Returns the bot's Telegram Star transactions in chronological order. On success, returns a <a href=\"#startransactions\">StarTransactions</a> object.</p>",
"rst_description": "Returns the bot's Telegram Star transactions in chronological order. On success, returns a :class:`aiogram.types.star_transactions.StarTransactions` object.",
"annotations": [
{
"type": "Integer",
"required": false,
"description": "Number of transactions to skip in the response",
"html_description": "<td>Number of transactions to skip in the response</td>",
"rst_description": "Number of transactions to skip in the response\n",
"name": "offset"
},
{
"type": "Integer",
"required": false,
"description": "The maximum number of transactions to be retrieved. Values between 1-100 are accepted. Defaults to 100.",
"html_description": "<td>The maximum number of transactions to be retrieved. Values between 1-100 are accepted. Defaults to 100.</td>",
"rst_description": "The maximum number of transactions to be retrieved. Values between 1-100 are accepted. Defaults to 100.\n",
"name": "limit"
}
],
"category": "methods"
},
{ {
"anchor": "refundstarpayment", "anchor": "refundstarpayment",
"name": "refundStarPayment", "name": "refundStarPayment",
@ -15951,6 +16033,232 @@
} }
], ],
"category": "types" "category": "types"
},
{
"anchor": "revenuewithdrawalstate",
"name": "RevenueWithdrawalState",
"description": "This object describes the state of a revenue withdrawal operation. Currently, it can be one of\n - RevenueWithdrawalStatePending\n - RevenueWithdrawalStateSucceeded\n - RevenueWithdrawalStateFailed",
"html_description": "<p>This object describes the state of a revenue withdrawal operation. Currently, it can be one of</p><ul>\n<li><a href=\"#revenuewithdrawalstatepending\">RevenueWithdrawalStatePending</a></li>\n<li><a href=\"#revenuewithdrawalstatesucceeded\">RevenueWithdrawalStateSucceeded</a></li>\n<li><a href=\"#revenuewithdrawalstatefailed\">RevenueWithdrawalStateFailed</a></li>\n</ul>",
"rst_description": "This object describes the state of a revenue withdrawal operation. Currently, it can be one of\n\n - :class:`aiogram.types.revenue_withdrawal_state_pending.RevenueWithdrawalStatePending`\n - :class:`aiogram.types.revenue_withdrawal_state_succeeded.RevenueWithdrawalStateSucceeded`\n - :class:`aiogram.types.revenue_withdrawal_state_failed.RevenueWithdrawalStateFailed`",
"annotations": [],
"category": "types"
},
{
"anchor": "revenuewithdrawalstatepending",
"name": "RevenueWithdrawalStatePending",
"description": "The withdrawal is in progress.",
"html_description": "<p>The withdrawal is in progress.</p>",
"rst_description": "The withdrawal is in progress.",
"annotations": [
{
"type": "String",
"description": "Type of the state, always 'pending'",
"html_description": "<td>Type of the state, always &#8220;pending&#8221;</td>",
"rst_description": "Type of the state, always 'pending'\n",
"name": "type",
"required": true
}
],
"category": "types"
},
{
"anchor": "revenuewithdrawalstatesucceeded",
"name": "RevenueWithdrawalStateSucceeded",
"description": "The withdrawal succeeded.",
"html_description": "<p>The withdrawal succeeded.</p>",
"rst_description": "The withdrawal succeeded.",
"annotations": [
{
"type": "String",
"description": "Type of the state, always 'succeeded'",
"html_description": "<td>Type of the state, always &#8220;succeeded&#8221;</td>",
"rst_description": "Type of the state, always 'succeeded'\n",
"name": "type",
"required": true
},
{
"type": "Integer",
"description": "Date the withdrawal was completed in Unix time",
"html_description": "<td>Date the withdrawal was completed in Unix time</td>",
"rst_description": "Date the withdrawal was completed in Unix time\n",
"name": "date",
"required": true
},
{
"type": "String",
"description": "An HTTPS URL that can be used to see transaction details",
"html_description": "<td>An HTTPS URL that can be used to see transaction details</td>",
"rst_description": "An HTTPS URL that can be used to see transaction details\n",
"name": "url",
"required": true
}
],
"category": "types"
},
{
"anchor": "revenuewithdrawalstatefailed",
"name": "RevenueWithdrawalStateFailed",
"description": "The withdrawal failed and the transaction was refunded.",
"html_description": "<p>The withdrawal failed and the transaction was refunded.</p>",
"rst_description": "The withdrawal failed and the transaction was refunded.",
"annotations": [
{
"type": "String",
"description": "Type of the state, always 'failed'",
"html_description": "<td>Type of the state, always &#8220;failed&#8221;</td>",
"rst_description": "Type of the state, always 'failed'\n",
"name": "type",
"required": true
}
],
"category": "types"
},
{
"anchor": "transactionpartner",
"name": "TransactionPartner",
"description": "This object describes the source of a transaction, or its recipient for outgoing transactions. Currently, it can be one of\n - TransactionPartnerFragment\n - TransactionPartnerUser\n - TransactionPartnerOther",
"html_description": "<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>",
"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`",
"annotations": [],
"category": "types"
},
{
"anchor": "transactionpartnerfragment",
"name": "TransactionPartnerFragment",
"description": "Describes a withdrawal transaction with Fragment.",
"html_description": "<p>Describes a withdrawal transaction with Fragment.</p>",
"rst_description": "Describes a withdrawal transaction with Fragment.",
"annotations": [
{
"type": "String",
"description": "Type of the transaction partner, always 'fragment'",
"html_description": "<td>Type of the transaction partner, always &#8220;fragment&#8221;</td>",
"rst_description": "Type of the transaction partner, always 'fragment'\n",
"name": "type",
"required": true
},
{
"type": "RevenueWithdrawalState",
"description": "State of the transaction if the transaction is outgoing",
"html_description": "<td><em>Optional</em>. State of the transaction if the transaction is outgoing</td>",
"rst_description": "*Optional*. State of the transaction if the transaction is outgoing\n",
"name": "withdrawal_state",
"required": false
}
],
"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
}
],
"category": "types"
},
{
"anchor": "transactionpartnerother",
"name": "TransactionPartnerOther",
"description": "Describes a transaction with an unknown source or recipient.",
"html_description": "<p>Describes a transaction with an unknown source or recipient.</p>",
"rst_description": "Describes a transaction with an unknown source or recipient.",
"annotations": [
{
"type": "String",
"description": "Type of the transaction partner, always 'other'",
"html_description": "<td>Type of the transaction partner, always &#8220;other&#8221;</td>",
"rst_description": "Type of the transaction partner, always 'other'\n",
"name": "type",
"required": true
}
],
"category": "types"
},
{
"anchor": "startransaction",
"name": "StarTransaction",
"description": "Describes a Telegram Star transaction.",
"html_description": "<p>Describes a Telegram Star transaction.</p>",
"rst_description": "Describes a Telegram Star transaction.",
"annotations": [
{
"type": "String",
"description": "Unique identifier of the transaction. Coincides with the identifer of the original transaction for refund transactions. Coincides with SuccessfulPayment.telegram_payment_charge_id for successful incoming payments from users.",
"html_description": "<td>Unique identifier of the transaction. Coincides with the identifer of the original transaction for refund transactions. Coincides with <em>SuccessfulPayment.telegram_payment_charge_id</em> for successful incoming payments from users.</td>",
"rst_description": "Unique identifier of the transaction. Coincides with the identifer of the original transaction for refund transactions. Coincides with *SuccessfulPayment.telegram_payment_charge_id* for successful incoming payments from users.\n",
"name": "id",
"required": true
},
{
"type": "Integer",
"description": "Number of Telegram Stars transferred by the transaction",
"html_description": "<td>Number of Telegram Stars transferred by the transaction</td>",
"rst_description": "Number of Telegram Stars transferred by the transaction\n",
"name": "amount",
"required": true
},
{
"type": "Integer",
"description": "Date the transaction was created in Unix time",
"html_description": "<td>Date the transaction was created in Unix time</td>",
"rst_description": "Date the transaction was created in Unix time\n",
"name": "date",
"required": true
},
{
"type": "TransactionPartner",
"description": "Source of an incoming transaction (e.g., a user purchasing goods or services, Fragment refunding a failed withdrawal). Only for incoming transactions",
"html_description": "<td><em>Optional</em>. Source of an incoming transaction (e.g., a user purchasing goods or services, Fragment refunding a failed withdrawal). Only for incoming transactions</td>",
"rst_description": "*Optional*. Source of an incoming transaction (e.g., a user purchasing goods or services, Fragment refunding a failed withdrawal). Only for incoming transactions\n",
"name": "source",
"required": false
},
{
"type": "TransactionPartner",
"description": "Receiver of an outgoing transaction (e.g., a user for a purchase refund, Fragment for a withdrawal). Only for outgoing transactions",
"html_description": "<td><em>Optional</em>. Receiver of an outgoing transaction (e.g., a user for a purchase refund, Fragment for a withdrawal). Only for outgoing transactions</td>",
"rst_description": "*Optional*. Receiver of an outgoing transaction (e.g., a user for a purchase refund, Fragment for a withdrawal). Only for outgoing transactions\n",
"name": "receiver",
"required": false
}
],
"category": "types"
},
{
"anchor": "startransactions",
"name": "StarTransactions",
"description": "Contains a list of Telegram Star transactions.",
"html_description": "<p>Contains a list of Telegram Star transactions.</p>",
"rst_description": "Contains a list of Telegram Star transactions.",
"annotations": [
{
"type": "Array of StarTransaction",
"description": "The list of transactions",
"html_description": "<td>The list of transactions</td>",
"rst_description": "The list of transactions\n",
"name": "transactions",
"required": true
}
],
"category": "types"
} }
], ],
"description": "Your bot can accept payments from Telegram users. Please see the introduction to payments for more details on the process and how to set up payments for your bot." "description": "Your bot can accept payments from Telegram users. Please see the introduction to payments for more details on the process and how to set up payments for your bot."

View file

@ -29,9 +29,9 @@
}, },
{ {
"type": "String", "type": "String",
"description": "Data to be sent in a callback query to the bot when button is pressed, 1-64 bytes. Not supported for messages sent on behalf of a Telegram Business account.", "description": "Data to be sent in a callback query to the bot when the button is pressed, 1-64 bytes",
"html_description": "<td><em>Optional</em>. Data to be sent in a <a href=\"#callbackquery\">callback query</a> to the bot when button is pressed, 1-64 bytes. Not supported for messages sent on behalf of a Telegram Business account.</td>", "html_description": "<td><em>Optional</em>. Data to be sent in a <a href=\"#callbackquery\">callback query</a> to the bot when the button is pressed, 1-64 bytes</td>",
"rst_description": "*Optional*. Data to be sent in a `callback query <https://core.telegram.org/bots/api#callbackquery>`_ to the bot when button is pressed, 1-64 bytes. Not supported for messages sent on behalf of a Telegram Business account.\n", "rst_description": "*Optional*. Data to be sent in a `callback query <https://core.telegram.org/bots/api#callbackquery>`_ to the bot when the button is pressed, 1-64 bytes\n",
"name": "callback_data", "name": "callback_data",
"required": false "required": false
}, },

View file

@ -0,0 +1,16 @@
{
"meta": {},
"group": {
"title": "Payments",
"anchor": "payments"
},
"object": {
"anchor": "revenuewithdrawalstate",
"name": "RevenueWithdrawalState",
"description": "This object describes the state of a revenue withdrawal operation. Currently, it can be one of\n - RevenueWithdrawalStatePending\n - RevenueWithdrawalStateSucceeded\n - RevenueWithdrawalStateFailed",
"html_description": "<p>This object describes the state of a revenue withdrawal operation. Currently, it can be one of</p><ul>\n<li><a href=\"#revenuewithdrawalstatepending\">RevenueWithdrawalStatePending</a></li>\n<li><a href=\"#revenuewithdrawalstatesucceeded\">RevenueWithdrawalStateSucceeded</a></li>\n<li><a href=\"#revenuewithdrawalstatefailed\">RevenueWithdrawalStateFailed</a></li>\n</ul>",
"rst_description": "This object describes the state of a revenue withdrawal operation. Currently, it can be one of\n\n - :class:`aiogram.types.revenue_withdrawal_state_pending.RevenueWithdrawalStatePending`\n - :class:`aiogram.types.revenue_withdrawal_state_succeeded.RevenueWithdrawalStateSucceeded`\n - :class:`aiogram.types.revenue_withdrawal_state_failed.RevenueWithdrawalStateFailed`",
"annotations": [],
"category": "types"
}
}

View file

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

View file

@ -0,0 +1,25 @@
{
"meta": {},
"group": {
"title": "Payments",
"anchor": "payments"
},
"object": {
"anchor": "revenuewithdrawalstatefailed",
"name": "RevenueWithdrawalStateFailed",
"description": "The withdrawal failed and the transaction was refunded.",
"html_description": "<p>The withdrawal failed and the transaction was refunded.</p>",
"rst_description": "The withdrawal failed and the transaction was refunded.",
"annotations": [
{
"type": "String",
"description": "Type of the state, always 'failed'",
"html_description": "<td>Type of the state, always &#8220;failed&#8221;</td>",
"rst_description": "Type of the state, always 'failed'\n",
"name": "type",
"required": true
}
],
"category": "types"
}
}

View file

@ -0,0 +1,25 @@
{
"meta": {},
"group": {
"title": "Payments",
"anchor": "payments"
},
"object": {
"anchor": "revenuewithdrawalstatepending",
"name": "RevenueWithdrawalStatePending",
"description": "The withdrawal is in progress.",
"html_description": "<p>The withdrawal is in progress.</p>",
"rst_description": "The withdrawal is in progress.",
"annotations": [
{
"type": "String",
"description": "Type of the state, always 'pending'",
"html_description": "<td>Type of the state, always &#8220;pending&#8221;</td>",
"rst_description": "Type of the state, always 'pending'\n",
"name": "type",
"required": true
}
],
"category": "types"
}
}

View file

@ -0,0 +1,41 @@
{
"meta": {},
"group": {
"title": "Payments",
"anchor": "payments"
},
"object": {
"anchor": "revenuewithdrawalstatesucceeded",
"name": "RevenueWithdrawalStateSucceeded",
"description": "The withdrawal succeeded.",
"html_description": "<p>The withdrawal succeeded.</p>",
"rst_description": "The withdrawal succeeded.",
"annotations": [
{
"type": "String",
"description": "Type of the state, always 'succeeded'",
"html_description": "<td>Type of the state, always &#8220;succeeded&#8221;</td>",
"rst_description": "Type of the state, always 'succeeded'\n",
"name": "type",
"required": true
},
{
"type": "Integer",
"description": "Date the withdrawal was completed in Unix time",
"html_description": "<td>Date the withdrawal was completed in Unix time</td>",
"rst_description": "Date the withdrawal was completed in Unix time\n",
"name": "date",
"required": true
},
{
"type": "String",
"description": "An HTTPS URL that can be used to see transaction details",
"html_description": "<td>An HTTPS URL that can be used to see transaction details</td>",
"rst_description": "An HTTPS URL that can be used to see transaction details\n",
"name": "url",
"required": true
}
],
"category": "types"
}
}

View file

@ -0,0 +1,5 @@
annotations:
date:
parsed_type:
type: std
name: DateTime

View file

@ -0,0 +1,57 @@
{
"meta": {},
"group": {
"title": "Payments",
"anchor": "payments"
},
"object": {
"anchor": "startransaction",
"name": "StarTransaction",
"description": "Describes a Telegram Star transaction.",
"html_description": "<p>Describes a Telegram Star transaction.</p>",
"rst_description": "Describes a Telegram Star transaction.",
"annotations": [
{
"type": "String",
"description": "Unique identifier of the transaction. Coincides with the identifer of the original transaction for refund transactions. Coincides with SuccessfulPayment.telegram_payment_charge_id for successful incoming payments from users.",
"html_description": "<td>Unique identifier of the transaction. Coincides with the identifer of the original transaction for refund transactions. Coincides with <em>SuccessfulPayment.telegram_payment_charge_id</em> for successful incoming payments from users.</td>",
"rst_description": "Unique identifier of the transaction. Coincides with the identifer of the original transaction for refund transactions. Coincides with *SuccessfulPayment.telegram_payment_charge_id* for successful incoming payments from users.\n",
"name": "id",
"required": true
},
{
"type": "Integer",
"description": "Number of Telegram Stars transferred by the transaction",
"html_description": "<td>Number of Telegram Stars transferred by the transaction</td>",
"rst_description": "Number of Telegram Stars transferred by the transaction\n",
"name": "amount",
"required": true
},
{
"type": "Integer",
"description": "Date the transaction was created in Unix time",
"html_description": "<td>Date the transaction was created in Unix time</td>",
"rst_description": "Date the transaction was created in Unix time\n",
"name": "date",
"required": true
},
{
"type": "TransactionPartner",
"description": "Source of an incoming transaction (e.g., a user purchasing goods or services, Fragment refunding a failed withdrawal). Only for incoming transactions",
"html_description": "<td><em>Optional</em>. Source of an incoming transaction (e.g., a user purchasing goods or services, Fragment refunding a failed withdrawal). Only for incoming transactions</td>",
"rst_description": "*Optional*. Source of an incoming transaction (e.g., a user purchasing goods or services, Fragment refunding a failed withdrawal). Only for incoming transactions\n",
"name": "source",
"required": false
},
{
"type": "TransactionPartner",
"description": "Receiver of an outgoing transaction (e.g., a user for a purchase refund, Fragment for a withdrawal). Only for outgoing transactions",
"html_description": "<td><em>Optional</em>. Receiver of an outgoing transaction (e.g., a user for a purchase refund, Fragment for a withdrawal). Only for outgoing transactions</td>",
"rst_description": "*Optional*. Receiver of an outgoing transaction (e.g., a user for a purchase refund, Fragment for a withdrawal). Only for outgoing transactions\n",
"name": "receiver",
"required": false
}
],
"category": "types"
}
}

View file

@ -0,0 +1,5 @@
annotations:
date:
parsed_type:
type: std
name: DateTime

View file

@ -0,0 +1,25 @@
{
"meta": {},
"group": {
"title": "Payments",
"anchor": "payments"
},
"object": {
"anchor": "startransactions",
"name": "StarTransactions",
"description": "Contains a list of Telegram Star transactions.",
"html_description": "<p>Contains a list of Telegram Star transactions.</p>",
"rst_description": "Contains a list of Telegram Star transactions.",
"annotations": [
{
"type": "Array of StarTransaction",
"description": "The list of transactions",
"html_description": "<td>The list of transactions</td>",
"rst_description": "The list of transactions\n",
"name": "transactions",
"required": true
}
],
"category": "types"
}
}

View file

@ -0,0 +1,16 @@
{
"meta": {},
"group": {
"title": "Payments",
"anchor": "payments"
},
"object": {
"anchor": "transactionpartner",
"name": "TransactionPartner",
"description": "This object describes the source of a transaction, or its recipient for outgoing transactions. Currently, it can be one of\n - TransactionPartnerFragment\n - TransactionPartnerUser\n - TransactionPartnerOther",
"html_description": "<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>",
"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`",
"annotations": [],
"category": "types"
}
}

View file

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

View file

@ -0,0 +1,33 @@
{
"meta": {},
"group": {
"title": "Payments",
"anchor": "payments"
},
"object": {
"anchor": "transactionpartnerfragment",
"name": "TransactionPartnerFragment",
"description": "Describes a withdrawal transaction with Fragment.",
"html_description": "<p>Describes a withdrawal transaction with Fragment.</p>",
"rst_description": "Describes a withdrawal transaction with Fragment.",
"annotations": [
{
"type": "String",
"description": "Type of the transaction partner, always 'fragment'",
"html_description": "<td>Type of the transaction partner, always &#8220;fragment&#8221;</td>",
"rst_description": "Type of the transaction partner, always 'fragment'\n",
"name": "type",
"required": true
},
{
"type": "RevenueWithdrawalState",
"description": "State of the transaction if the transaction is outgoing",
"html_description": "<td><em>Optional</em>. State of the transaction if the transaction is outgoing</td>",
"rst_description": "*Optional*. State of the transaction if the transaction is outgoing\n",
"name": "withdrawal_state",
"required": false
}
],
"category": "types"
}
}

View file

@ -0,0 +1,25 @@
{
"meta": {},
"group": {
"title": "Payments",
"anchor": "payments"
},
"object": {
"anchor": "transactionpartnerother",
"name": "TransactionPartnerOther",
"description": "Describes a transaction with an unknown source or recipient.",
"html_description": "<p>Describes a transaction with an unknown source or recipient.</p>",
"rst_description": "Describes a transaction with an unknown source or recipient.",
"annotations": [
{
"type": "String",
"description": "Type of the transaction partner, always 'other'",
"html_description": "<td>Type of the transaction partner, always &#8220;other&#8221;</td>",
"rst_description": "Type of the transaction partner, always 'other'\n",
"name": "type",
"required": true
}
],
"category": "types"
}
}

View file

@ -0,0 +1,33 @@
{
"meta": {},
"group": {
"title": "Payments",
"anchor": "payments"
},
"object": {
"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
}
],
"category": "types"
}
}

25
CHANGES/1518.feature.rst Normal file
View file

@ -0,0 +1,25 @@
Added full support of `Bot API 7.5 <https://core.telegram.org/bots/api-changelog#june-18-2024>`_
- Added the classes :class:`aiogram.types.star_transactions.StarTransactions`,
:class:`aiogram.types.star_transaction.StarTransaction`,
:class:`aiogram.types.transaction_partner.TransactionPartner`
and :class:`aiogram.types.revenue_withdrawal_state.RevenueWithdrawalState`,
containing information about Telegram Star transactions involving the bot.
- Added the method :class:`aiogram.methods.get_star_transactions.GetStarTransactions`
that can be used to get the list of all Telegram Star transactions for the bot.
- Added support for callback buttons in
:class:`aiogram.types.inline_keyboard_markup.InlineKeyboardMarkup`
for messages sent on behalf of a business account.
- Added support for callback queries originating from a message sent
on behalf of a business account.
- Added the parameter :code:`business_connection_id` to the methods
:class:`aiogram.methods.edit_message_text.EditMessageText`,
:class:`aiogram.methods.edit_message_media.EditMessageMedia`,
:class:`aiogram.methods.edit_message_caption.EditMessageCaption`,
:class:`aiogram.methods.edit_message_live_location.EditMessageLiveLocation`,
:class:`aiogram.methods.stop_message_live_location.StopMessageLiveLocation`
and :class:`aiogram.methods.edit_message_reply_markup.EditMessageReplyMarkup`,
allowing the bot to edit business messages.
- Added the parameter :code:`business_connection_id` to the method
:class:`aiogram.methods.stop_poll.StopPoll`,
allowing the bot to stop polls it sent on behalf of a business account.

View file

@ -78,6 +78,7 @@ from ..methods import (
GetMyDescription, GetMyDescription,
GetMyName, GetMyName,
GetMyShortDescription, GetMyShortDescription,
GetStarTransactions,
GetStickerSet, GetStickerSet,
GetUpdates, GetUpdates,
GetUserChatBoosts, GetUserChatBoosts,
@ -231,6 +232,7 @@ from ..types import (
ReplyParameters, ReplyParameters,
SentWebAppMessage, SentWebAppMessage,
ShippingOption, ShippingOption,
StarTransactions,
Sticker, Sticker,
StickerSet, StickerSet,
Update, Update,
@ -1342,6 +1344,7 @@ class Bot:
async def edit_message_caption( async def edit_message_caption(
self, self,
business_connection_id: Optional[str] = None,
chat_id: Optional[Union[int, str]] = None, chat_id: Optional[Union[int, str]] = None,
message_id: Optional[int] = None, message_id: Optional[int] = None,
inline_message_id: Optional[str] = None, inline_message_id: Optional[str] = None,
@ -1355,10 +1358,11 @@ class Bot:
request_timeout: Optional[int] = None, request_timeout: Optional[int] = None,
) -> Union[Message, bool]: ) -> Union[Message, bool]:
""" """
Use this method to edit captions of messages. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. Use this method to edit captions of messages. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within **48 hours** from the time they were sent.
Source: https://core.telegram.org/bots/api#editmessagecaption Source: https://core.telegram.org/bots/api#editmessagecaption
:param business_connection_id: Unique identifier of the business connection on behalf of which the message to be edited was sent
:param chat_id: Required if *inline_message_id* is not specified. Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`) :param chat_id: Required if *inline_message_id* is not specified. Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)
:param message_id: Required if *inline_message_id* is not specified. Identifier of the message to edit :param message_id: Required if *inline_message_id* is not specified. Identifier of the message to edit
:param inline_message_id: Required if *chat_id* and *message_id* are not specified. Identifier of the inline message :param inline_message_id: Required if *chat_id* and *message_id* are not specified. Identifier of the inline message
@ -1368,10 +1372,11 @@ class Bot:
:param show_caption_above_media: Pass :code:`True`, if the caption must be shown above the message media. Supported only for animation, photo and video messages. :param show_caption_above_media: Pass :code:`True`, if the caption must be shown above the message media. Supported only for animation, photo and video messages.
:param reply_markup: A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_. :param reply_markup: A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_.
:param request_timeout: Request timeout :param request_timeout: Request timeout
:return: On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. :return: Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within **48 hours** from the time they were sent.
""" """
call = EditMessageCaption( call = EditMessageCaption(
business_connection_id=business_connection_id,
chat_id=chat_id, chat_id=chat_id,
message_id=message_id, message_id=message_id,
inline_message_id=inline_message_id, inline_message_id=inline_message_id,
@ -1387,6 +1392,7 @@ class Bot:
self, self,
latitude: float, latitude: float,
longitude: float, longitude: float,
business_connection_id: Optional[str] = None,
chat_id: Optional[Union[int, str]] = None, chat_id: Optional[Union[int, str]] = None,
message_id: Optional[int] = None, message_id: Optional[int] = None,
inline_message_id: Optional[str] = None, inline_message_id: Optional[str] = None,
@ -1404,6 +1410,7 @@ class Bot:
:param latitude: Latitude of new location :param latitude: Latitude of new location
:param longitude: Longitude of new location :param longitude: Longitude of new location
:param business_connection_id: Unique identifier of the business connection on behalf of which the message to be edited was sent
:param chat_id: Required if *inline_message_id* is not specified. Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`) :param chat_id: Required if *inline_message_id* is not specified. Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)
:param message_id: Required if *inline_message_id* is not specified. Identifier of the message to edit :param message_id: Required if *inline_message_id* is not specified. Identifier of the message to edit
:param inline_message_id: Required if *chat_id* and *message_id* are not specified. Identifier of the inline message :param inline_message_id: Required if *chat_id* and *message_id* are not specified. Identifier of the inline message
@ -1419,6 +1426,7 @@ class Bot:
call = EditMessageLiveLocation( call = EditMessageLiveLocation(
latitude=latitude, latitude=latitude,
longitude=longitude, longitude=longitude,
business_connection_id=business_connection_id,
chat_id=chat_id, chat_id=chat_id,
message_id=message_id, message_id=message_id,
inline_message_id=inline_message_id, inline_message_id=inline_message_id,
@ -1439,6 +1447,7 @@ class Bot:
InputMediaPhoto, InputMediaPhoto,
InputMediaVideo, InputMediaVideo,
], ],
business_connection_id: Optional[str] = None,
chat_id: Optional[Union[int, str]] = None, chat_id: Optional[Union[int, str]] = None,
message_id: Optional[int] = None, message_id: Optional[int] = None,
inline_message_id: Optional[str] = None, inline_message_id: Optional[str] = None,
@ -1446,21 +1455,23 @@ class Bot:
request_timeout: Optional[int] = None, request_timeout: Optional[int] = None,
) -> Union[Message, bool]: ) -> Union[Message, bool]:
""" """
Use this method to edit animation, audio, document, photo, or video messages. If a message is part of a message album, then it can be edited only to an audio for audio albums, only to a document for document albums and to a photo or a video otherwise. When an inline message is edited, a new file can't be uploaded; use a previously uploaded file via its file_id or specify a URL. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. Use this method to edit animation, audio, document, photo, or video messages. If a message is part of a message album, then it can be edited only to an audio for audio albums, only to a document for document albums and to a photo or a video otherwise. When an inline message is edited, a new file can't be uploaded; use a previously uploaded file via its file_id or specify a URL. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within **48 hours** from the time they were sent.
Source: https://core.telegram.org/bots/api#editmessagemedia Source: https://core.telegram.org/bots/api#editmessagemedia
:param media: A JSON-serialized object for a new media content of the message :param media: A JSON-serialized object for a new media content of the message
:param business_connection_id: Unique identifier of the business connection on behalf of which the message to be edited was sent
:param chat_id: Required if *inline_message_id* is not specified. Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`) :param chat_id: Required if *inline_message_id* is not specified. Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)
:param message_id: Required if *inline_message_id* is not specified. Identifier of the message to edit :param message_id: Required if *inline_message_id* is not specified. Identifier of the message to edit
:param inline_message_id: Required if *chat_id* and *message_id* are not specified. Identifier of the inline message :param inline_message_id: Required if *chat_id* and *message_id* are not specified. Identifier of the inline message
:param reply_markup: A JSON-serialized object for a new `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_. :param reply_markup: A JSON-serialized object for a new `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_.
:param request_timeout: Request timeout :param request_timeout: Request timeout
:return: On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. :return: Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within **48 hours** from the time they were sent.
""" """
call = EditMessageMedia( call = EditMessageMedia(
media=media, media=media,
business_connection_id=business_connection_id,
chat_id=chat_id, chat_id=chat_id,
message_id=message_id, message_id=message_id,
inline_message_id=inline_message_id, inline_message_id=inline_message_id,
@ -1470,6 +1481,7 @@ class Bot:
async def edit_message_reply_markup( async def edit_message_reply_markup(
self, self,
business_connection_id: Optional[str] = None,
chat_id: Optional[Union[int, str]] = None, chat_id: Optional[Union[int, str]] = None,
message_id: Optional[int] = None, message_id: Optional[int] = None,
inline_message_id: Optional[str] = None, inline_message_id: Optional[str] = None,
@ -1477,19 +1489,21 @@ class Bot:
request_timeout: Optional[int] = None, request_timeout: Optional[int] = None,
) -> Union[Message, bool]: ) -> Union[Message, bool]:
""" """
Use this method to edit only the reply markup of messages. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. Use this method to edit only the reply markup of messages. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within **48 hours** from the time they were sent.
Source: https://core.telegram.org/bots/api#editmessagereplymarkup Source: https://core.telegram.org/bots/api#editmessagereplymarkup
:param business_connection_id: Unique identifier of the business connection on behalf of which the message to be edited was sent
:param chat_id: Required if *inline_message_id* is not specified. Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`) :param chat_id: Required if *inline_message_id* is not specified. Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)
:param message_id: Required if *inline_message_id* is not specified. Identifier of the message to edit :param message_id: Required if *inline_message_id* is not specified. Identifier of the message to edit
:param inline_message_id: Required if *chat_id* and *message_id* are not specified. Identifier of the inline message :param inline_message_id: Required if *chat_id* and *message_id* are not specified. Identifier of the inline message
:param reply_markup: A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_. :param reply_markup: A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_.
:param request_timeout: Request timeout :param request_timeout: Request timeout
:return: On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. :return: Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within **48 hours** from the time they were sent.
""" """
call = EditMessageReplyMarkup( call = EditMessageReplyMarkup(
business_connection_id=business_connection_id,
chat_id=chat_id, chat_id=chat_id,
message_id=message_id, message_id=message_id,
inline_message_id=inline_message_id, inline_message_id=inline_message_id,
@ -1500,6 +1514,7 @@ class Bot:
async def edit_message_text( async def edit_message_text(
self, self,
text: str, text: str,
business_connection_id: Optional[str] = None,
chat_id: Optional[Union[int, str]] = None, chat_id: Optional[Union[int, str]] = None,
message_id: Optional[int] = None, message_id: Optional[int] = None,
inline_message_id: Optional[str] = None, inline_message_id: Optional[str] = None,
@ -1513,11 +1528,12 @@ class Bot:
request_timeout: Optional[int] = None, request_timeout: Optional[int] = None,
) -> Union[Message, bool]: ) -> Union[Message, bool]:
""" """
Use this method to edit text and `game <https://core.telegram.org/bots/api#games>`_ messages. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. Use this method to edit text and `game <https://core.telegram.org/bots/api#games>`_ messages. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within **48 hours** from the time they were sent.
Source: https://core.telegram.org/bots/api#editmessagetext Source: https://core.telegram.org/bots/api#editmessagetext
:param text: New text of the message, 1-4096 characters after entities parsing :param text: New text of the message, 1-4096 characters after entities parsing
:param business_connection_id: Unique identifier of the business connection on behalf of which the message to be edited was sent
:param chat_id: Required if *inline_message_id* is not specified. Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`) :param chat_id: Required if *inline_message_id* is not specified. Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)
:param message_id: Required if *inline_message_id* is not specified. Identifier of the message to edit :param message_id: Required if *inline_message_id* is not specified. Identifier of the message to edit
:param inline_message_id: Required if *chat_id* and *message_id* are not specified. Identifier of the inline message :param inline_message_id: Required if *chat_id* and *message_id* are not specified. Identifier of the inline message
@ -1527,11 +1543,12 @@ class Bot:
:param reply_markup: A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_. :param reply_markup: A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_.
:param disable_web_page_preview: Disables link previews for links in this message :param disable_web_page_preview: Disables link previews for links in this message
:param request_timeout: Request timeout :param request_timeout: Request timeout
:return: On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. :return: Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within **48 hours** from the time they were sent.
""" """
call = EditMessageText( call = EditMessageText(
text=text, text=text,
business_connection_id=business_connection_id,
chat_id=chat_id, chat_id=chat_id,
message_id=message_id, message_id=message_id,
inline_message_id=inline_message_id, inline_message_id=inline_message_id,
@ -3760,6 +3777,7 @@ class Bot:
async def stop_message_live_location( async def stop_message_live_location(
self, self,
business_connection_id: Optional[str] = None,
chat_id: Optional[Union[int, str]] = None, chat_id: Optional[Union[int, str]] = None,
message_id: Optional[int] = None, message_id: Optional[int] = None,
inline_message_id: Optional[str] = None, inline_message_id: Optional[str] = None,
@ -3771,6 +3789,7 @@ class Bot:
Source: https://core.telegram.org/bots/api#stopmessagelivelocation Source: https://core.telegram.org/bots/api#stopmessagelivelocation
:param business_connection_id: Unique identifier of the business connection on behalf of which the message to be edited was sent
:param chat_id: Required if *inline_message_id* is not specified. Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`) :param chat_id: Required if *inline_message_id* is not specified. Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)
:param message_id: Required if *inline_message_id* is not specified. Identifier of the message with live location to stop :param message_id: Required if *inline_message_id* is not specified. Identifier of the message with live location to stop
:param inline_message_id: Required if *chat_id* and *message_id* are not specified. Identifier of the inline message :param inline_message_id: Required if *chat_id* and *message_id* are not specified. Identifier of the inline message
@ -3780,6 +3799,7 @@ class Bot:
""" """
call = StopMessageLiveLocation( call = StopMessageLiveLocation(
business_connection_id=business_connection_id,
chat_id=chat_id, chat_id=chat_id,
message_id=message_id, message_id=message_id,
inline_message_id=inline_message_id, inline_message_id=inline_message_id,
@ -3791,6 +3811,7 @@ class Bot:
self, self,
chat_id: Union[int, str], chat_id: Union[int, str],
message_id: int, message_id: int,
business_connection_id: Optional[str] = None,
reply_markup: Optional[InlineKeyboardMarkup] = None, reply_markup: Optional[InlineKeyboardMarkup] = None,
request_timeout: Optional[int] = None, request_timeout: Optional[int] = None,
) -> Poll: ) -> Poll:
@ -3801,6 +3822,7 @@ class Bot:
:param chat_id: Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`) :param chat_id: Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)
:param message_id: Identifier of the original message with the poll :param message_id: Identifier of the original message with the poll
:param business_connection_id: Unique identifier of the business connection on behalf of which the message to be edited was sent
:param reply_markup: A JSON-serialized object for a new message `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_. :param reply_markup: A JSON-serialized object for a new message `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_.
:param request_timeout: Request timeout :param request_timeout: Request timeout
:return: On success, the stopped :class:`aiogram.types.poll.Poll` is returned. :return: On success, the stopped :class:`aiogram.types.poll.Poll` is returned.
@ -3809,6 +3831,7 @@ class Bot:
call = StopPoll( call = StopPoll(
chat_id=chat_id, chat_id=chat_id,
message_id=message_id, message_id=message_id,
business_connection_id=business_connection_id,
reply_markup=reply_markup, reply_markup=reply_markup,
) )
return await self(call, request_timeout=request_timeout) return await self(call, request_timeout=request_timeout)
@ -4589,3 +4612,26 @@ class Bot:
telegram_payment_charge_id=telegram_payment_charge_id, telegram_payment_charge_id=telegram_payment_charge_id,
) )
return await self(call, request_timeout=request_timeout) return await self(call, request_timeout=request_timeout)
async def get_star_transactions(
self,
offset: Optional[int] = None,
limit: Optional[int] = None,
request_timeout: Optional[int] = None,
) -> StarTransactions:
"""
Returns the bot's Telegram Star transactions in chronological order. On success, returns a :class:`aiogram.types.star_transactions.StarTransactions` object.
Source: https://core.telegram.org/bots/api#getstartransactions
:param offset: Number of transactions to skip in the response
:param limit: The maximum number of transactions to be retrieved. Values between 1-100 are accepted. Defaults to 100.
:param request_timeout: Request timeout
:return: On success, returns a :class:`aiogram.types.star_transactions.StarTransactions` object.
"""
call = GetStarTransactions(
offset=offset,
limit=limit,
)
return await self(call, request_timeout=request_timeout)

View file

@ -23,10 +23,11 @@ from aiohttp.http import SERVER_SOFTWARE
from aiogram.__meta__ import __version__ from aiogram.__meta__ import __version__
from aiogram.methods import TelegramMethod from aiogram.methods import TelegramMethod
from .base import BaseSession
from ...exceptions import TelegramNetworkError from ...exceptions import TelegramNetworkError
from ...methods.base import TelegramType from ...methods.base import TelegramType
from ...types import InputFile from ...types import InputFile
from .base import BaseSession
if TYPE_CHECKING: if TYPE_CHECKING:
from ..bot import Bot from ..bot import Bot

View file

@ -18,9 +18,11 @@ 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
from .reaction_type_type import ReactionTypeType from .reaction_type_type import ReactionTypeType
from .revenue_withdrawal_state_type import RevenueWithdrawalStateType
from .sticker_format import StickerFormat from .sticker_format import StickerFormat
from .sticker_type import StickerType from .sticker_type import StickerType
from .topic_icon_color import TopicIconColor from .topic_icon_color import TopicIconColor
from .transaction_partner_type import TransactionPartnerType
from .update_type import UpdateType from .update_type import UpdateType
__all__ = ( __all__ = (
@ -44,8 +46,10 @@ __all__ = (
"PassportElementErrorType", "PassportElementErrorType",
"PollType", "PollType",
"ReactionTypeType", "ReactionTypeType",
"RevenueWithdrawalStateType",
"StickerFormat", "StickerFormat",
"StickerType", "StickerType",
"TopicIconColor", "TopicIconColor",
"TransactionPartnerType",
"UpdateType", "UpdateType",
) )

View file

@ -0,0 +1,13 @@
from enum import Enum
class RevenueWithdrawalStateType(str, Enum):
"""
This object represents a revenue withdrawal state type
Source: https://core.telegram.org/bots/api#revenuewithdrawalstate
"""
FAILED = "failed"
PENDING = "pending"
SUCCEEDED = "succeeded"

View file

@ -0,0 +1,13 @@
from enum import Enum
class TransactionPartnerType(str, Enum):
"""
This object represents a type of transaction partner.
Source: https://core.telegram.org/bots/api#transactionpartner
"""
FRAGMENT = "fragment"
OTHER = "other"
USER = "user"

View file

@ -54,6 +54,7 @@ from .get_my_default_administrator_rights import GetMyDefaultAdministratorRights
from .get_my_description import GetMyDescription from .get_my_description import GetMyDescription
from .get_my_name import GetMyName from .get_my_name import GetMyName
from .get_my_short_description import GetMyShortDescription from .get_my_short_description import GetMyShortDescription
from .get_star_transactions import GetStarTransactions
from .get_sticker_set import GetStickerSet from .get_sticker_set import GetStickerSet
from .get_updates import GetUpdates from .get_updates import GetUpdates
from .get_user_chat_boosts import GetUserChatBoosts from .get_user_chat_boosts import GetUserChatBoosts
@ -178,6 +179,7 @@ __all__ = (
"GetMyDescription", "GetMyDescription",
"GetMyName", "GetMyName",
"GetMyShortDescription", "GetMyShortDescription",
"GetStarTransactions",
"GetStickerSet", "GetStickerSet",
"GetUpdates", "GetUpdates",
"GetUserChatBoosts", "GetUserChatBoosts",

View file

@ -9,7 +9,7 @@ from .base import TelegramMethod
class EditMessageCaption(TelegramMethod[Union[Message, bool]]): class EditMessageCaption(TelegramMethod[Union[Message, bool]]):
""" """
Use this method to edit captions of messages. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. Use this method to edit captions of messages. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within **48 hours** from the time they were sent.
Source: https://core.telegram.org/bots/api#editmessagecaption Source: https://core.telegram.org/bots/api#editmessagecaption
""" """
@ -17,6 +17,8 @@ class EditMessageCaption(TelegramMethod[Union[Message, bool]]):
__returning__ = Union[Message, bool] __returning__ = Union[Message, bool]
__api_method__ = "editMessageCaption" __api_method__ = "editMessageCaption"
business_connection_id: Optional[str] = None
"""Unique identifier of the business connection on behalf of which the message to be edited was sent"""
chat_id: Optional[Union[int, str]] = None chat_id: Optional[Union[int, str]] = None
"""Required if *inline_message_id* is not specified. Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)""" """Required if *inline_message_id* is not specified. Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
message_id: Optional[int] = None message_id: Optional[int] = None
@ -41,6 +43,7 @@ class EditMessageCaption(TelegramMethod[Union[Message, bool]]):
def __init__( def __init__(
__pydantic__self__, __pydantic__self__,
*, *,
business_connection_id: Optional[str] = None,
chat_id: Optional[Union[int, str]] = None, chat_id: Optional[Union[int, str]] = None,
message_id: Optional[int] = None, message_id: Optional[int] = None,
inline_message_id: Optional[str] = None, inline_message_id: Optional[str] = None,
@ -58,6 +61,7 @@ class EditMessageCaption(TelegramMethod[Union[Message, bool]]):
# 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__( super().__init__(
business_connection_id=business_connection_id,
chat_id=chat_id, chat_id=chat_id,
message_id=message_id, message_id=message_id,
inline_message_id=inline_message_id, inline_message_id=inline_message_id,

View file

@ -20,6 +20,8 @@ class EditMessageLiveLocation(TelegramMethod[Union[Message, bool]]):
"""Latitude of new location""" """Latitude of new location"""
longitude: float longitude: float
"""Longitude of new location""" """Longitude of new location"""
business_connection_id: Optional[str] = None
"""Unique identifier of the business connection on behalf of which the message to be edited was sent"""
chat_id: Optional[Union[int, str]] = None chat_id: Optional[Union[int, str]] = None
"""Required if *inline_message_id* is not specified. Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)""" """Required if *inline_message_id* is not specified. Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
message_id: Optional[int] = None message_id: Optional[int] = None
@ -46,6 +48,7 @@ class EditMessageLiveLocation(TelegramMethod[Union[Message, bool]]):
*, *,
latitude: float, latitude: float,
longitude: float, longitude: float,
business_connection_id: Optional[str] = None,
chat_id: Optional[Union[int, str]] = None, chat_id: Optional[Union[int, str]] = None,
message_id: Optional[int] = None, message_id: Optional[int] = None,
inline_message_id: Optional[str] = None, inline_message_id: Optional[str] = None,
@ -63,6 +66,7 @@ class EditMessageLiveLocation(TelegramMethod[Union[Message, bool]]):
super().__init__( super().__init__(
latitude=latitude, latitude=latitude,
longitude=longitude, longitude=longitude,
business_connection_id=business_connection_id,
chat_id=chat_id, chat_id=chat_id,
message_id=message_id, message_id=message_id,
inline_message_id=inline_message_id, inline_message_id=inline_message_id,

View file

@ -16,7 +16,7 @@ from .base import TelegramMethod
class EditMessageMedia(TelegramMethod[Union[Message, bool]]): class EditMessageMedia(TelegramMethod[Union[Message, bool]]):
""" """
Use this method to edit animation, audio, document, photo, or video messages. If a message is part of a message album, then it can be edited only to an audio for audio albums, only to a document for document albums and to a photo or a video otherwise. When an inline message is edited, a new file can't be uploaded; use a previously uploaded file via its file_id or specify a URL. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. Use this method to edit animation, audio, document, photo, or video messages. If a message is part of a message album, then it can be edited only to an audio for audio albums, only to a document for document albums and to a photo or a video otherwise. When an inline message is edited, a new file can't be uploaded; use a previously uploaded file via its file_id or specify a URL. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within **48 hours** from the time they were sent.
Source: https://core.telegram.org/bots/api#editmessagemedia Source: https://core.telegram.org/bots/api#editmessagemedia
""" """
@ -28,6 +28,8 @@ class EditMessageMedia(TelegramMethod[Union[Message, bool]]):
InputMediaAnimation, InputMediaDocument, InputMediaAudio, InputMediaPhoto, InputMediaVideo InputMediaAnimation, InputMediaDocument, InputMediaAudio, InputMediaPhoto, InputMediaVideo
] ]
"""A JSON-serialized object for a new media content of the message""" """A JSON-serialized object for a new media content of the message"""
business_connection_id: Optional[str] = None
"""Unique identifier of the business connection on behalf of which the message to be edited was sent"""
chat_id: Optional[Union[int, str]] = None chat_id: Optional[Union[int, str]] = None
"""Required if *inline_message_id* is not specified. Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)""" """Required if *inline_message_id* is not specified. Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
message_id: Optional[int] = None message_id: Optional[int] = None
@ -51,6 +53,7 @@ class EditMessageMedia(TelegramMethod[Union[Message, bool]]):
InputMediaPhoto, InputMediaPhoto,
InputMediaVideo, InputMediaVideo,
], ],
business_connection_id: Optional[str] = None,
chat_id: Optional[Union[int, str]] = None, chat_id: Optional[Union[int, str]] = None,
message_id: Optional[int] = None, message_id: Optional[int] = None,
inline_message_id: Optional[str] = None, inline_message_id: Optional[str] = None,
@ -63,6 +66,7 @@ class EditMessageMedia(TelegramMethod[Union[Message, bool]]):
super().__init__( super().__init__(
media=media, media=media,
business_connection_id=business_connection_id,
chat_id=chat_id, chat_id=chat_id,
message_id=message_id, message_id=message_id,
inline_message_id=inline_message_id, inline_message_id=inline_message_id,

View file

@ -8,7 +8,7 @@ from .base import TelegramMethod
class EditMessageReplyMarkup(TelegramMethod[Union[Message, bool]]): class EditMessageReplyMarkup(TelegramMethod[Union[Message, bool]]):
""" """
Use this method to edit only the reply markup of messages. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. Use this method to edit only the reply markup of messages. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within **48 hours** from the time they were sent.
Source: https://core.telegram.org/bots/api#editmessagereplymarkup Source: https://core.telegram.org/bots/api#editmessagereplymarkup
""" """
@ -16,6 +16,8 @@ class EditMessageReplyMarkup(TelegramMethod[Union[Message, bool]]):
__returning__ = Union[Message, bool] __returning__ = Union[Message, bool]
__api_method__ = "editMessageReplyMarkup" __api_method__ = "editMessageReplyMarkup"
business_connection_id: Optional[str] = None
"""Unique identifier of the business connection on behalf of which the message to be edited was sent"""
chat_id: Optional[Union[int, str]] = None chat_id: Optional[Union[int, str]] = None
"""Required if *inline_message_id* is not specified. Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)""" """Required if *inline_message_id* is not specified. Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
message_id: Optional[int] = None message_id: Optional[int] = None
@ -32,6 +34,7 @@ class EditMessageReplyMarkup(TelegramMethod[Union[Message, bool]]):
def __init__( def __init__(
__pydantic__self__, __pydantic__self__,
*, *,
business_connection_id: Optional[str] = None,
chat_id: Optional[Union[int, str]] = None, chat_id: Optional[Union[int, str]] = None,
message_id: Optional[int] = None, message_id: Optional[int] = None,
inline_message_id: Optional[str] = None, inline_message_id: Optional[str] = None,
@ -43,6 +46,7 @@ class EditMessageReplyMarkup(TelegramMethod[Union[Message, bool]]):
# 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__( super().__init__(
business_connection_id=business_connection_id,
chat_id=chat_id, chat_id=chat_id,
message_id=message_id, message_id=message_id,
inline_message_id=inline_message_id, inline_message_id=inline_message_id,

View file

@ -17,7 +17,7 @@ from .base import TelegramMethod
class EditMessageText(TelegramMethod[Union[Message, bool]]): class EditMessageText(TelegramMethod[Union[Message, bool]]):
""" """
Use this method to edit text and `game <https://core.telegram.org/bots/api#games>`_ messages. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. Use this method to edit text and `game <https://core.telegram.org/bots/api#games>`_ messages. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within **48 hours** from the time they were sent.
Source: https://core.telegram.org/bots/api#editmessagetext Source: https://core.telegram.org/bots/api#editmessagetext
""" """
@ -27,6 +27,8 @@ class EditMessageText(TelegramMethod[Union[Message, bool]]):
text: str text: str
"""New text of the message, 1-4096 characters after entities parsing""" """New text of the message, 1-4096 characters after entities parsing"""
business_connection_id: Optional[str] = None
"""Unique identifier of the business connection on behalf of which the message to be edited was sent"""
chat_id: Optional[Union[int, str]] = None chat_id: Optional[Union[int, str]] = None
"""Required if *inline_message_id* is not specified. Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)""" """Required if *inline_message_id* is not specified. Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
message_id: Optional[int] = None message_id: Optional[int] = None
@ -57,6 +59,7 @@ class EditMessageText(TelegramMethod[Union[Message, bool]]):
__pydantic__self__, __pydantic__self__,
*, *,
text: str, text: str,
business_connection_id: Optional[str] = None,
chat_id: Optional[Union[int, str]] = None, chat_id: Optional[Union[int, str]] = None,
message_id: Optional[int] = None, message_id: Optional[int] = None,
inline_message_id: Optional[str] = None, inline_message_id: Optional[str] = None,
@ -75,6 +78,7 @@ class EditMessageText(TelegramMethod[Union[Message, bool]]):
super().__init__( super().__init__(
text=text, text=text,
business_connection_id=business_connection_id,
chat_id=chat_id, chat_id=chat_id,
message_id=message_id, message_id=message_id,
inline_message_id=inline_message_id, inline_message_id=inline_message_id,

View file

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

View file

@ -16,6 +16,8 @@ class StopMessageLiveLocation(TelegramMethod[Union[Message, bool]]):
__returning__ = Union[Message, bool] __returning__ = Union[Message, bool]
__api_method__ = "stopMessageLiveLocation" __api_method__ = "stopMessageLiveLocation"
business_connection_id: Optional[str] = None
"""Unique identifier of the business connection on behalf of which the message to be edited was sent"""
chat_id: Optional[Union[int, str]] = None chat_id: Optional[Union[int, str]] = None
"""Required if *inline_message_id* is not specified. Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)""" """Required if *inline_message_id* is not specified. Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
message_id: Optional[int] = None message_id: Optional[int] = None
@ -32,6 +34,7 @@ class StopMessageLiveLocation(TelegramMethod[Union[Message, bool]]):
def __init__( def __init__(
__pydantic__self__, __pydantic__self__,
*, *,
business_connection_id: Optional[str] = None,
chat_id: Optional[Union[int, str]] = None, chat_id: Optional[Union[int, str]] = None,
message_id: Optional[int] = None, message_id: Optional[int] = None,
inline_message_id: Optional[str] = None, inline_message_id: Optional[str] = None,
@ -43,6 +46,7 @@ class StopMessageLiveLocation(TelegramMethod[Union[Message, bool]]):
# 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__( super().__init__(
business_connection_id=business_connection_id,
chat_id=chat_id, chat_id=chat_id,
message_id=message_id, message_id=message_id,
inline_message_id=inline_message_id, inline_message_id=inline_message_id,

View file

@ -20,6 +20,8 @@ class StopPoll(TelegramMethod[Poll]):
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)""" """Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
message_id: int message_id: int
"""Identifier of the original message with the poll""" """Identifier of the original message with the poll"""
business_connection_id: Optional[str] = None
"""Unique identifier of the business connection on behalf of which the message to be edited was sent"""
reply_markup: Optional[InlineKeyboardMarkup] = None reply_markup: Optional[InlineKeyboardMarkup] = None
"""A JSON-serialized object for a new message `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_.""" """A JSON-serialized object for a new message `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_."""
@ -32,6 +34,7 @@ class StopPoll(TelegramMethod[Poll]):
*, *,
chat_id: Union[int, str], chat_id: Union[int, str],
message_id: int, message_id: int,
business_connection_id: Optional[str] = None,
reply_markup: Optional[InlineKeyboardMarkup] = None, reply_markup: Optional[InlineKeyboardMarkup] = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
@ -42,6 +45,7 @@ class StopPoll(TelegramMethod[Poll]):
super().__init__( super().__init__(
chat_id=chat_id, chat_id=chat_id,
message_id=message_id, message_id=message_id,
business_connection_id=business_connection_id,
reply_markup=reply_markup, reply_markup=reply_markup,
**__pydantic_kwargs, **__pydantic_kwargs,
) )

View file

@ -183,17 +183,27 @@ from .reply_keyboard_markup import ReplyKeyboardMarkup
from .reply_keyboard_remove import ReplyKeyboardRemove from .reply_keyboard_remove import ReplyKeyboardRemove
from .reply_parameters import ReplyParameters from .reply_parameters import ReplyParameters
from .response_parameters import ResponseParameters from .response_parameters import ResponseParameters
from .revenue_withdrawal_state import RevenueWithdrawalState
from .revenue_withdrawal_state_failed import RevenueWithdrawalStateFailed
from .revenue_withdrawal_state_pending import RevenueWithdrawalStatePending
from .revenue_withdrawal_state_succeeded import RevenueWithdrawalStateSucceeded
from .sent_web_app_message import SentWebAppMessage from .sent_web_app_message import SentWebAppMessage
from .shared_user import SharedUser from .shared_user import SharedUser
from .shipping_address import ShippingAddress from .shipping_address import ShippingAddress
from .shipping_option import ShippingOption from .shipping_option import ShippingOption
from .shipping_query import ShippingQuery from .shipping_query import ShippingQuery
from .star_transaction import StarTransaction
from .star_transactions import StarTransactions
from .sticker import Sticker from .sticker import Sticker
from .sticker_set import StickerSet from .sticker_set import StickerSet
from .story import Story from .story import Story
from .successful_payment import SuccessfulPayment from .successful_payment import SuccessfulPayment
from .switch_inline_query_chosen_chat import SwitchInlineQueryChosenChat from .switch_inline_query_chosen_chat import SwitchInlineQueryChosenChat
from .text_quote import TextQuote from .text_quote import TextQuote
from .transaction_partner import TransactionPartner
from .transaction_partner_fragment import TransactionPartnerFragment
from .transaction_partner_other import TransactionPartnerOther
from .transaction_partner_user import TransactionPartnerUser
from .update import Update from .update import Update
from .user import User from .user import User
from .user_chat_boosts import UserChatBoosts from .user_chat_boosts import UserChatBoosts
@ -395,11 +405,17 @@ __all__ = (
"ReplyKeyboardRemove", "ReplyKeyboardRemove",
"ReplyParameters", "ReplyParameters",
"ResponseParameters", "ResponseParameters",
"RevenueWithdrawalState",
"RevenueWithdrawalStateFailed",
"RevenueWithdrawalStatePending",
"RevenueWithdrawalStateSucceeded",
"SentWebAppMessage", "SentWebAppMessage",
"SharedUser", "SharedUser",
"ShippingAddress", "ShippingAddress",
"ShippingOption", "ShippingOption",
"ShippingQuery", "ShippingQuery",
"StarTransaction",
"StarTransactions",
"Sticker", "Sticker",
"StickerSet", "StickerSet",
"Story", "Story",
@ -407,6 +423,10 @@ __all__ = (
"SwitchInlineQueryChosenChat", "SwitchInlineQueryChosenChat",
"TelegramObject", "TelegramObject",
"TextQuote", "TextQuote",
"TransactionPartner",
"TransactionPartnerFragment",
"TransactionPartnerOther",
"TransactionPartnerUser",
"UNSET_PARSE_MODE", "UNSET_PARSE_MODE",
"URLInputFile", "URLInputFile",
"Update", "Update",

View file

@ -23,7 +23,7 @@ class InlineKeyboardButton(MutableTelegramObject):
url: Optional[str] = None url: Optional[str] = None
"""*Optional*. HTTP or tg:// URL to be opened when the button is pressed. Links :code:`tg://user?id=<user_id>` can be used to mention a user by their identifier without using a username, if this is allowed by their privacy settings.""" """*Optional*. HTTP or tg:// URL to be opened when the button is pressed. Links :code:`tg://user?id=<user_id>` can be used to mention a user by their identifier without using a username, if this is allowed by their privacy settings."""
callback_data: Optional[str] = None callback_data: Optional[str] = None
"""*Optional*. Data to be sent in a `callback query <https://core.telegram.org/bots/api#callbackquery>`_ to the bot when button is pressed, 1-64 bytes. Not supported for messages sent on behalf of a Telegram Business account.""" """*Optional*. Data to be sent in a `callback query <https://core.telegram.org/bots/api#callbackquery>`_ to the bot when the button is pressed, 1-64 bytes"""
web_app: Optional[WebAppInfo] = None web_app: Optional[WebAppInfo] = None
"""*Optional*. Description of the `Web App <https://core.telegram.org/bots/webapps>`_ 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`. Available only in private chats between a user and the bot. Not supported for messages sent on behalf of a Telegram Business account.""" """*Optional*. Description of the `Web App <https://core.telegram.org/bots/webapps>`_ 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`. Available only in private chats between a user and the bot. Not supported for messages sent on behalf of a Telegram Business account."""
login_url: Optional[LoginUrl] = None login_url: Optional[LoginUrl] = None

View file

@ -3531,6 +3531,7 @@ class Message(MaybeInaccessibleMessage):
def edit_text( def edit_text(
self, self,
text: str, text: str,
business_connection_id: Optional[str] = None,
inline_message_id: Optional[str] = None, inline_message_id: Optional[str] = None,
parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), parse_mode: Optional[Union[str, Default]] = Default("parse_mode"),
entities: Optional[List[MessageEntity]] = None, entities: Optional[List[MessageEntity]] = None,
@ -3548,11 +3549,12 @@ class Message(MaybeInaccessibleMessage):
- :code:`chat_id` - :code:`chat_id`
- :code:`message_id` - :code:`message_id`
Use this method to edit text and `game <https://core.telegram.org/bots/api#games>`_ messages. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. Use this method to edit text and `game <https://core.telegram.org/bots/api#games>`_ messages. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within **48 hours** from the time they were sent.
Source: https://core.telegram.org/bots/api#editmessagetext Source: https://core.telegram.org/bots/api#editmessagetext
:param text: New text of the message, 1-4096 characters after entities parsing :param text: New text of the message, 1-4096 characters after entities parsing
:param business_connection_id: Unique identifier of the business connection on behalf of which the message to be edited was sent
:param inline_message_id: Required if *chat_id* and *message_id* are not specified. Identifier of the inline message :param inline_message_id: Required if *chat_id* and *message_id* are not specified. Identifier of the inline message
:param parse_mode: Mode for parsing entities in the message text. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details. :param parse_mode: Mode for parsing entities in the message text. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details.
:param entities: A JSON-serialized list of special entities that appear in message text, which can be specified instead of *parse_mode* :param entities: A JSON-serialized list of special entities that appear in message text, which can be specified instead of *parse_mode*
@ -3574,6 +3576,7 @@ class Message(MaybeInaccessibleMessage):
chat_id=self.chat.id, chat_id=self.chat.id,
message_id=self.message_id, message_id=self.message_id,
text=text, text=text,
business_connection_id=business_connection_id,
inline_message_id=inline_message_id, inline_message_id=inline_message_id,
parse_mode=parse_mode, parse_mode=parse_mode,
entities=entities, entities=entities,
@ -3636,6 +3639,7 @@ class Message(MaybeInaccessibleMessage):
InputMediaPhoto, InputMediaPhoto,
InputMediaVideo, InputMediaVideo,
], ],
business_connection_id: Optional[str] = None,
inline_message_id: Optional[str] = None, inline_message_id: Optional[str] = None,
reply_markup: Optional[InlineKeyboardMarkup] = None, reply_markup: Optional[InlineKeyboardMarkup] = None,
**kwargs: Any, **kwargs: Any,
@ -3647,11 +3651,12 @@ class Message(MaybeInaccessibleMessage):
- :code:`chat_id` - :code:`chat_id`
- :code:`message_id` - :code:`message_id`
Use this method to edit animation, audio, document, photo, or video messages. If a message is part of a message album, then it can be edited only to an audio for audio albums, only to a document for document albums and to a photo or a video otherwise. When an inline message is edited, a new file can't be uploaded; use a previously uploaded file via its file_id or specify a URL. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. Use this method to edit animation, audio, document, photo, or video messages. If a message is part of a message album, then it can be edited only to an audio for audio albums, only to a document for document albums and to a photo or a video otherwise. When an inline message is edited, a new file can't be uploaded; use a previously uploaded file via its file_id or specify a URL. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within **48 hours** from the time they were sent.
Source: https://core.telegram.org/bots/api#editmessagemedia Source: https://core.telegram.org/bots/api#editmessagemedia
:param media: A JSON-serialized object for a new media content of the message :param media: A JSON-serialized object for a new media content of the message
:param business_connection_id: Unique identifier of the business connection on behalf of which the message to be edited was sent
:param inline_message_id: Required if *chat_id* and *message_id* are not specified. Identifier of the inline message :param inline_message_id: Required if *chat_id* and *message_id* are not specified. Identifier of the inline message
:param reply_markup: A JSON-serialized object for a new `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_. :param reply_markup: A JSON-serialized object for a new `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_.
:return: instance of method :class:`aiogram.methods.edit_message_media.EditMessageMedia` :return: instance of method :class:`aiogram.methods.edit_message_media.EditMessageMedia`
@ -3669,6 +3674,7 @@ class Message(MaybeInaccessibleMessage):
chat_id=self.chat.id, chat_id=self.chat.id,
message_id=self.message_id, message_id=self.message_id,
media=media, media=media,
business_connection_id=business_connection_id,
inline_message_id=inline_message_id, inline_message_id=inline_message_id,
reply_markup=reply_markup, reply_markup=reply_markup,
**kwargs, **kwargs,
@ -3676,6 +3682,7 @@ class Message(MaybeInaccessibleMessage):
def edit_reply_markup( def edit_reply_markup(
self, self,
business_connection_id: Optional[str] = None,
inline_message_id: Optional[str] = None, inline_message_id: Optional[str] = None,
reply_markup: Optional[InlineKeyboardMarkup] = None, reply_markup: Optional[InlineKeyboardMarkup] = None,
**kwargs: Any, **kwargs: Any,
@ -3687,10 +3694,11 @@ class Message(MaybeInaccessibleMessage):
- :code:`chat_id` - :code:`chat_id`
- :code:`message_id` - :code:`message_id`
Use this method to edit only the reply markup of messages. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. Use this method to edit only the reply markup of messages. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within **48 hours** from the time they were sent.
Source: https://core.telegram.org/bots/api#editmessagereplymarkup Source: https://core.telegram.org/bots/api#editmessagereplymarkup
:param business_connection_id: Unique identifier of the business connection on behalf of which the message to be edited was sent
:param inline_message_id: Required if *chat_id* and *message_id* are not specified. Identifier of the inline message :param inline_message_id: Required if *chat_id* and *message_id* are not specified. Identifier of the inline message
:param reply_markup: A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_. :param reply_markup: A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_.
:return: instance of method :class:`aiogram.methods.edit_message_reply_markup.EditMessageReplyMarkup` :return: instance of method :class:`aiogram.methods.edit_message_reply_markup.EditMessageReplyMarkup`
@ -3707,6 +3715,7 @@ class Message(MaybeInaccessibleMessage):
return EditMessageReplyMarkup( return EditMessageReplyMarkup(
chat_id=self.chat.id, chat_id=self.chat.id,
message_id=self.message_id, message_id=self.message_id,
business_connection_id=business_connection_id,
inline_message_id=inline_message_id, inline_message_id=inline_message_id,
reply_markup=reply_markup, reply_markup=reply_markup,
**kwargs, **kwargs,
@ -3714,6 +3723,7 @@ class Message(MaybeInaccessibleMessage):
def delete_reply_markup( def delete_reply_markup(
self, self,
business_connection_id: Optional[str] = None,
inline_message_id: Optional[str] = None, inline_message_id: Optional[str] = None,
**kwargs: Any, **kwargs: Any,
) -> EditMessageReplyMarkup: ) -> EditMessageReplyMarkup:
@ -3725,10 +3735,11 @@ class Message(MaybeInaccessibleMessage):
- :code:`message_id` - :code:`message_id`
- :code:`reply_markup` - :code:`reply_markup`
Use this method to edit only the reply markup of messages. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. Use this method to edit only the reply markup of messages. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within **48 hours** from the time they were sent.
Source: https://core.telegram.org/bots/api#editmessagereplymarkup Source: https://core.telegram.org/bots/api#editmessagereplymarkup
:param business_connection_id: Unique identifier of the business connection on behalf of which the message to be edited was sent
:param inline_message_id: Required if *chat_id* and *message_id* are not specified. Identifier of the inline message :param inline_message_id: Required if *chat_id* and *message_id* are not specified. Identifier of the inline message
:return: instance of method :class:`aiogram.methods.edit_message_reply_markup.EditMessageReplyMarkup` :return: instance of method :class:`aiogram.methods.edit_message_reply_markup.EditMessageReplyMarkup`
""" """
@ -3745,6 +3756,7 @@ class Message(MaybeInaccessibleMessage):
chat_id=self.chat.id, chat_id=self.chat.id,
message_id=self.message_id, message_id=self.message_id,
reply_markup=None, reply_markup=None,
business_connection_id=business_connection_id,
inline_message_id=inline_message_id, inline_message_id=inline_message_id,
**kwargs, **kwargs,
).as_(self._bot) ).as_(self._bot)
@ -3753,6 +3765,7 @@ class Message(MaybeInaccessibleMessage):
self, self,
latitude: float, latitude: float,
longitude: float, longitude: float,
business_connection_id: Optional[str] = None,
inline_message_id: Optional[str] = None, inline_message_id: Optional[str] = None,
live_period: Optional[int] = None, live_period: Optional[int] = None,
horizontal_accuracy: Optional[float] = None, horizontal_accuracy: Optional[float] = None,
@ -3774,6 +3787,7 @@ class Message(MaybeInaccessibleMessage):
:param latitude: Latitude of new location :param latitude: Latitude of new location
:param longitude: Longitude of new location :param longitude: Longitude of new location
:param business_connection_id: Unique identifier of the business connection on behalf of which the message to be edited was sent
:param inline_message_id: Required if *chat_id* and *message_id* are not specified. Identifier of the inline message :param inline_message_id: Required if *chat_id* and *message_id* are not specified. Identifier of the inline message
:param live_period: New period in seconds during which the location can be updated, starting from the message send date. If 0x7FFFFFFF is specified, then the location can be updated forever. Otherwise, the new value must not exceed the current *live_period* by more than a day, and the live location expiration date must remain within the next 90 days. If not specified, then *live_period* remains unchanged :param live_period: New period in seconds during which the location can be updated, starting from the message send date. If 0x7FFFFFFF is specified, then the location can be updated forever. Otherwise, the new value must not exceed the current *live_period* by more than a day, and the live location expiration date must remain within the next 90 days. If not specified, then *live_period* remains unchanged
:param horizontal_accuracy: The radius of uncertainty for the location, measured in meters; 0-1500 :param horizontal_accuracy: The radius of uncertainty for the location, measured in meters; 0-1500
@ -3796,6 +3810,7 @@ class Message(MaybeInaccessibleMessage):
message_id=self.message_id, message_id=self.message_id,
latitude=latitude, latitude=latitude,
longitude=longitude, longitude=longitude,
business_connection_id=business_connection_id,
inline_message_id=inline_message_id, inline_message_id=inline_message_id,
live_period=live_period, live_period=live_period,
horizontal_accuracy=horizontal_accuracy, horizontal_accuracy=horizontal_accuracy,
@ -3807,6 +3822,7 @@ class Message(MaybeInaccessibleMessage):
def stop_live_location( def stop_live_location(
self, self,
business_connection_id: Optional[str] = None,
inline_message_id: Optional[str] = None, inline_message_id: Optional[str] = None,
reply_markup: Optional[InlineKeyboardMarkup] = None, reply_markup: Optional[InlineKeyboardMarkup] = None,
**kwargs: Any, **kwargs: Any,
@ -3822,6 +3838,7 @@ class Message(MaybeInaccessibleMessage):
Source: https://core.telegram.org/bots/api#stopmessagelivelocation Source: https://core.telegram.org/bots/api#stopmessagelivelocation
:param business_connection_id: Unique identifier of the business connection on behalf of which the message to be edited was sent
:param inline_message_id: Required if *chat_id* and *message_id* are not specified. Identifier of the inline message :param inline_message_id: Required if *chat_id* and *message_id* are not specified. Identifier of the inline message
:param reply_markup: A JSON-serialized object for a new `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_. :param reply_markup: A JSON-serialized object for a new `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_.
:return: instance of method :class:`aiogram.methods.stop_message_live_location.StopMessageLiveLocation` :return: instance of method :class:`aiogram.methods.stop_message_live_location.StopMessageLiveLocation`
@ -3838,6 +3855,7 @@ class Message(MaybeInaccessibleMessage):
return StopMessageLiveLocation( return StopMessageLiveLocation(
chat_id=self.chat.id, chat_id=self.chat.id,
message_id=self.message_id, message_id=self.message_id,
business_connection_id=business_connection_id,
inline_message_id=inline_message_id, inline_message_id=inline_message_id,
reply_markup=reply_markup, reply_markup=reply_markup,
**kwargs, **kwargs,
@ -3845,6 +3863,7 @@ class Message(MaybeInaccessibleMessage):
def edit_caption( def edit_caption(
self, self,
business_connection_id: Optional[str] = None,
inline_message_id: Optional[str] = None, inline_message_id: Optional[str] = None,
caption: Optional[str] = None, caption: Optional[str] = None,
parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), parse_mode: Optional[Union[str, Default]] = Default("parse_mode"),
@ -3862,10 +3881,11 @@ class Message(MaybeInaccessibleMessage):
- :code:`chat_id` - :code:`chat_id`
- :code:`message_id` - :code:`message_id`
Use this method to edit captions of messages. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. Use this method to edit captions of messages. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within **48 hours** from the time they were sent.
Source: https://core.telegram.org/bots/api#editmessagecaption Source: https://core.telegram.org/bots/api#editmessagecaption
:param business_connection_id: Unique identifier of the business connection on behalf of which the message to be edited was sent
:param inline_message_id: Required if *chat_id* and *message_id* are not specified. Identifier of the inline message :param inline_message_id: Required if *chat_id* and *message_id* are not specified. Identifier of the inline message
:param caption: New caption of the message, 0-1024 characters after entities parsing :param caption: New caption of the message, 0-1024 characters after entities parsing
:param parse_mode: Mode for parsing entities in the message caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details. :param parse_mode: Mode for parsing entities in the message caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details.
@ -3886,6 +3906,7 @@ class Message(MaybeInaccessibleMessage):
return EditMessageCaption( return EditMessageCaption(
chat_id=self.chat.id, chat_id=self.chat.id,
message_id=self.message_id, message_id=self.message_id,
business_connection_id=business_connection_id,
inline_message_id=inline_message_id, inline_message_id=inline_message_id,
caption=caption, caption=caption,
parse_mode=parse_mode, parse_mode=parse_mode,

View file

@ -0,0 +1,15 @@
from __future__ import annotations
from .base import TelegramObject
class RevenueWithdrawalState(TelegramObject):
"""
This object describes the state of a revenue withdrawal operation. Currently, it can be one of
- :class:`aiogram.types.revenue_withdrawal_state_pending.RevenueWithdrawalStatePending`
- :class:`aiogram.types.revenue_withdrawal_state_succeeded.RevenueWithdrawalStateSucceeded`
- :class:`aiogram.types.revenue_withdrawal_state_failed.RevenueWithdrawalStateFailed`
Source: https://core.telegram.org/bots/api#revenuewithdrawalstate
"""

View file

@ -0,0 +1,33 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Literal
from ..enums import RevenueWithdrawalStateType
from .revenue_withdrawal_state import RevenueWithdrawalState
class RevenueWithdrawalStateFailed(RevenueWithdrawalState):
"""
The withdrawal failed and the transaction was refunded.
Source: https://core.telegram.org/bots/api#revenuewithdrawalstatefailed
"""
type: Literal[RevenueWithdrawalStateType.FAILED] = RevenueWithdrawalStateType.FAILED
"""Type of the state, always 'failed'"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
type: Literal[RevenueWithdrawalStateType.FAILED] = RevenueWithdrawalStateType.FAILED,
**__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

@ -0,0 +1,33 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Literal
from ..enums import RevenueWithdrawalStateType
from .revenue_withdrawal_state import RevenueWithdrawalState
class RevenueWithdrawalStatePending(RevenueWithdrawalState):
"""
The withdrawal is in progress.
Source: https://core.telegram.org/bots/api#revenuewithdrawalstatepending
"""
type: Literal[RevenueWithdrawalStateType.PENDING] = RevenueWithdrawalStateType.PENDING
"""Type of the state, always 'pending'"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
type: Literal[RevenueWithdrawalStateType.PENDING] = RevenueWithdrawalStateType.PENDING,
**__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

@ -0,0 +1,42 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Literal
from ..enums import RevenueWithdrawalStateType
from .custom import DateTime
from .revenue_withdrawal_state import RevenueWithdrawalState
class RevenueWithdrawalStateSucceeded(RevenueWithdrawalState):
"""
The withdrawal succeeded.
Source: https://core.telegram.org/bots/api#revenuewithdrawalstatesucceeded
"""
type: Literal[RevenueWithdrawalStateType.SUCCEEDED] = RevenueWithdrawalStateType.SUCCEEDED
"""Type of the state, always 'succeeded'"""
date: DateTime
"""Date the withdrawal was completed in Unix time"""
url: str
"""An HTTPS URL that can be used to see transaction details"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
type: Literal[
RevenueWithdrawalStateType.SUCCEEDED
] = RevenueWithdrawalStateType.SUCCEEDED,
date: DateTime,
url: str,
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher`
# Is needed only for type checking and IDE support without any additional plugins
super().__init__(type=type, date=date, url=url, **__pydantic_kwargs)

View file

@ -0,0 +1,65 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union
from .base import TelegramObject
from .custom import DateTime
if TYPE_CHECKING:
from .transaction_partner_fragment import TransactionPartnerFragment
from .transaction_partner_other import TransactionPartnerOther
from .transaction_partner_user import TransactionPartnerUser
class StarTransaction(TelegramObject):
"""
Describes a Telegram Star transaction.
Source: https://core.telegram.org/bots/api#startransaction
"""
id: str
"""Unique identifier of the transaction. Coincides with the identifer of the original transaction for refund transactions. Coincides with *SuccessfulPayment.telegram_payment_charge_id* for successful incoming payments from users."""
amount: int
"""Number of Telegram Stars transferred by the transaction"""
date: DateTime
"""Date the transaction was created in Unix time"""
source: Optional[
Union[TransactionPartnerFragment, TransactionPartnerUser, TransactionPartnerOther]
] = None
"""*Optional*. Source of an incoming transaction (e.g., a user purchasing goods or services, Fragment refunding a failed withdrawal). Only for incoming transactions"""
receiver: Optional[
Union[TransactionPartnerFragment, TransactionPartnerUser, TransactionPartnerOther]
] = None
"""*Optional*. Receiver of an outgoing transaction (e.g., a user for a purchase refund, Fragment for a withdrawal). Only for outgoing transactions"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
id: str,
amount: int,
date: DateTime,
source: Optional[
Union[TransactionPartnerFragment, TransactionPartnerUser, TransactionPartnerOther]
] = None,
receiver: Optional[
Union[TransactionPartnerFragment, TransactionPartnerUser, TransactionPartnerOther]
] = 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__(
id=id,
amount=amount,
date=date,
source=source,
receiver=receiver,
**__pydantic_kwargs,
)

View file

@ -0,0 +1,32 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, List
from .base import TelegramObject
if TYPE_CHECKING:
from .star_transaction import StarTransaction
class StarTransactions(TelegramObject):
"""
Contains a list of Telegram Star transactions.
Source: https://core.telegram.org/bots/api#startransactions
"""
transactions: List[StarTransaction]
"""The list of transactions"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__, *, transactions: List[StarTransaction], **__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__(transactions=transactions, **__pydantic_kwargs)

View file

@ -0,0 +1,13 @@
from .base import TelegramObject
class TransactionPartner(TelegramObject):
"""
This object describes the source of a transaction, or its recipient for outgoing transactions. Currently, it can be one of
- :class:`aiogram.types.transaction_partner_fragment.TransactionPartnerFragment`
- :class:`aiogram.types.transaction_partner_user.TransactionPartnerUser`
- :class:`aiogram.types.transaction_partner_other.TransactionPartnerOther`
Source: https://core.telegram.org/bots/api#transactionpartner
"""

View file

@ -0,0 +1,53 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Literal, Optional, Union
from ..enums import TransactionPartnerType
from .transaction_partner import TransactionPartner
if TYPE_CHECKING:
from .revenue_withdrawal_state_failed import RevenueWithdrawalStateFailed
from .revenue_withdrawal_state_pending import RevenueWithdrawalStatePending
from .revenue_withdrawal_state_succeeded import RevenueWithdrawalStateSucceeded
class TransactionPartnerFragment(TransactionPartner):
"""
Describes a withdrawal transaction with Fragment.
Source: https://core.telegram.org/bots/api#transactionpartnerfragment
"""
type: Literal[TransactionPartnerType.FRAGMENT] = TransactionPartnerType.FRAGMENT
"""Type of the transaction partner, always 'fragment'"""
withdrawal_state: Optional[
Union[
RevenueWithdrawalStatePending,
RevenueWithdrawalStateSucceeded,
RevenueWithdrawalStateFailed,
]
] = None
"""*Optional*. State of the transaction if the transaction is outgoing"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
type: Literal[TransactionPartnerType.FRAGMENT] = TransactionPartnerType.FRAGMENT,
withdrawal_state: Optional[
Union[
RevenueWithdrawalStatePending,
RevenueWithdrawalStateSucceeded,
RevenueWithdrawalStateFailed,
]
] = 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, withdrawal_state=withdrawal_state, **__pydantic_kwargs)

View file

@ -0,0 +1,33 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Literal
from ..enums import TransactionPartnerType
from .transaction_partner import TransactionPartner
class TransactionPartnerOther(TransactionPartner):
"""
Describes a transaction with an unknown source or recipient.
Source: https://core.telegram.org/bots/api#transactionpartnerother
"""
type: Literal[TransactionPartnerType.OTHER] = TransactionPartnerType.OTHER
"""Type of the transaction partner, always 'other'"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
type: Literal[TransactionPartnerType.OTHER] = TransactionPartnerType.OTHER,
**__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

@ -0,0 +1,39 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Literal
from ..enums import TransactionPartnerType
from .transaction_partner import TransactionPartner
if TYPE_CHECKING:
from .user import User
class TransactionPartnerUser(TransactionPartner):
"""
Describes a transaction with a user.
Source: https://core.telegram.org/bots/api#transactionpartneruser
"""
type: Literal[TransactionPartnerType.USER] = TransactionPartnerType.USER
"""Type of the transaction partner, always 'user'"""
user: User
"""Information about the user"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
type: Literal[TransactionPartnerType.USER] = TransactionPartnerType.USER,
user: User,
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher`
# Is needed only for type checking and IDE support without any additional plugins
super().__init__(type=type, user=user, **__pydantic_kwargs)

View file

@ -30,7 +30,9 @@ Here is list of all available enums:
passport_element_error_type passport_element_error_type
poll_type poll_type
reaction_type_type reaction_type_type
revenue_withdrawal_state_type
sticker_format sticker_format
sticker_type sticker_type
topic_icon_color topic_icon_color
transaction_partner_type
update_type update_type

View file

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

View file

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

View file

@ -0,0 +1,38 @@
###################
getStarTransactions
###################
Returns: :obj:`StarTransactions`
.. automodule:: aiogram.methods.get_star_transactions
:members:
:member-order: bysource
:undoc-members: True
:exclude-members: model_config,model_fields
Usage
=====
As bot method
-------------
.. code-block::
result: StarTransactions = await bot.get_star_transactions(...)
Method as object
----------------
Imports:
- :code:`from aiogram.methods.get_star_transactions import GetStarTransactions`
- alias: :code:`from aiogram.methods import GetStarTransactions`
With specific bot
~~~~~~~~~~~~~~~~~
.. code-block:: python
result: StarTransactions = await bot(GetStarTransactions(...))

View file

@ -161,6 +161,7 @@ Payments
answer_pre_checkout_query answer_pre_checkout_query
answer_shipping_query answer_shipping_query
create_invoice_link create_invoice_link
get_star_transactions
refund_star_payment refund_star_payment
send_invoice send_invoice

View file

@ -234,10 +234,20 @@ Payments
labeled_price labeled_price
order_info order_info
pre_checkout_query pre_checkout_query
revenue_withdrawal_state
revenue_withdrawal_state_failed
revenue_withdrawal_state_pending
revenue_withdrawal_state_succeeded
shipping_address shipping_address
shipping_option shipping_option
shipping_query shipping_query
star_transaction
star_transactions
successful_payment successful_payment
transaction_partner
transaction_partner_fragment
transaction_partner_other
transaction_partner_user
Getting updates Getting updates
=============== ===============

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

64
examples/stars_invoice.py Normal file
View file

@ -0,0 +1,64 @@
import asyncio
import logging
from os import getenv
from aiogram import Bot, Dispatcher, F, Router
from aiogram.filters import Command
from aiogram.types import LabeledPrice, Message, PreCheckoutQuery
TOKEN = getenv("BOT_TOKEN")
GOODS = { # Fake storage for goods, in real life it should be a database
"demo": 1,
"another": 0,
}
logger = logging.getLogger(__name__)
invoices_router = Router(name=__name__)
@invoices_router.message(Command("start"))
async def command_start(message: Message) -> None:
# Send demo invoice to user, the payment will be refunded after successful payment
await message.answer_invoice(
title="Demo invoice",
description="Demo invoice description",
prices=[
LabeledPrice(label="Demo", amount=42),
],
payload="demo",
currency="XTR",
)
@invoices_router.pre_checkout_query(F.invoice_payload == "demo")
async def pre_checkout_query(query: PreCheckoutQuery) -> None:
# if your product is available for sale,
# confirm that you are ready to accept payment
if GOODS.get(query.invoice_payload) > 0:
await query.answer(ok=True)
else:
await query.answer(ok=False, error_message="The product is out of stock")
@invoices_router.message(F.successful_payment)
async def successful_payment(message: Message, bot: Bot) -> None:
await bot.refund_star_payment(
user_id=message.from_user.id,
telegram_payment_charge_id=message.successful_payment.telegram_payment_charge_id,
)
await message.answer("Thanks. Your payment has been refunded.")
async def main() -> None:
bot = Bot(token=TOKEN)
dispatcher = Dispatcher()
dispatcher.include_router(invoices_router)
await dispatcher.start_polling(bot)
if __name__ == "__main__":
logging.basicConfig(level=logging.INFO)
asyncio.run(main())

View file

@ -0,0 +1,46 @@
from datetime import datetime
from aiogram.methods import GetStarTransactions
from aiogram.types import (
File,
StarTransaction,
StarTransactions,
TransactionPartnerUser,
User,
)
from tests.mocked_bot import MockedBot
class TestGetStarTransactions:
async def test_bot_method(self, bot: MockedBot):
user = User(id=42, is_bot=False, first_name="Test")
prepare_result = bot.add_result_for(
GetStarTransactions,
ok=True,
result=StarTransactions(
transactions=[
StarTransaction(
id="test1",
user=user,
amount=1,
date=datetime.now(),
source=TransactionPartnerUser(
user=user,
),
),
StarTransaction(
id="test2",
user=user,
amount=1,
date=datetime.now(),
receiver=TransactionPartnerUser(
user=user,
),
),
]
),
)
response: File = await bot.get_star_transactions(limit=10, offset=0)
request = bot.get_request()
assert response == prepare_result.result