diff --git a/.butcher/enums/RevenueWithdrawalStateType.yml b/.butcher/enums/RevenueWithdrawalStateType.yml new file mode 100644 index 00000000..4f90e3ca --- /dev/null +++ b/.butcher/enums/RevenueWithdrawalStateType.yml @@ -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 diff --git a/.butcher/enums/TransactionPartnerType.yml b/.butcher/enums/TransactionPartnerType.yml new file mode 100644 index 00000000..55241c72 --- /dev/null +++ b/.butcher/enums/TransactionPartnerType.yml @@ -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 diff --git a/.butcher/methods/editMessageCaption/entity.json b/.butcher/methods/editMessageCaption/entity.json index 570815c7..2f154f9b 100644 --- a/.butcher/methods/editMessageCaption/entity.json +++ b/.butcher/methods/editMessageCaption/entity.json @@ -7,10 +7,18 @@ "object": { "anchor": "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.", - "html_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.

", - "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.", + "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": "

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.

", + "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": [ + { + "type": "String", + "required": false, + "description": "Unique identifier of the business connection on behalf of which the message to be edited was sent", + "html_description": "Unique identifier of the business connection on behalf of which the message to be edited was sent", + "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", "required": false, diff --git a/.butcher/methods/editMessageLiveLocation/entity.json b/.butcher/methods/editMessageLiveLocation/entity.json index f2079277..decfbacc 100644 --- a/.butcher/methods/editMessageLiveLocation/entity.json +++ b/.butcher/methods/editMessageLiveLocation/entity.json @@ -11,6 +11,14 @@ "html_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 stopMessageLiveLocation. On success, if the edited message is not an inline message, the edited Message is returned, otherwise 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": [ + { + "type": "String", + "required": false, + "description": "Unique identifier of the business connection on behalf of which the message to be edited was sent", + "html_description": "Unique identifier of the business connection on behalf of which the message to be edited was sent", + "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", "required": false, diff --git a/.butcher/methods/editMessageMedia/entity.json b/.butcher/methods/editMessageMedia/entity.json index 85e3e42a..95d72dfb 100644 --- a/.butcher/methods/editMessageMedia/entity.json +++ b/.butcher/methods/editMessageMedia/entity.json @@ -7,10 +7,18 @@ "object": { "anchor": "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.", - "html_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.

", - "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.", + "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": "

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.

", + "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": [ + { + "type": "String", + "required": false, + "description": "Unique identifier of the business connection on behalf of which the message to be edited was sent", + "html_description": "Unique identifier of the business connection on behalf of which the message to be edited was sent", + "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", "required": false, diff --git a/.butcher/methods/editMessageReplyMarkup/entity.json b/.butcher/methods/editMessageReplyMarkup/entity.json index 21295ec7..5c0bd7f8 100644 --- a/.butcher/methods/editMessageReplyMarkup/entity.json +++ b/.butcher/methods/editMessageReplyMarkup/entity.json @@ -7,10 +7,18 @@ "object": { "anchor": "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.", - "html_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.

", - "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.", + "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": "

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.

", + "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": [ + { + "type": "String", + "required": false, + "description": "Unique identifier of the business connection on behalf of which the message to be edited was sent", + "html_description": "Unique identifier of the business connection on behalf of which the message to be edited was sent", + "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", "required": false, diff --git a/.butcher/methods/editMessageText/entity.json b/.butcher/methods/editMessageText/entity.json index 129b6204..03176f3d 100644 --- a/.butcher/methods/editMessageText/entity.json +++ b/.butcher/methods/editMessageText/entity.json @@ -7,10 +7,18 @@ "object": { "anchor": "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.", - "html_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.

", - "rst_description": "Use this method to edit text and `game `_ 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.", + "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": "

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.

", + "rst_description": "Use this method to edit text and `game `_ 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": [ + { + "type": "String", + "required": false, + "description": "Unique identifier of the business connection on behalf of which the message to be edited was sent", + "html_description": "Unique identifier of the business connection on behalf of which the message to be edited was sent", + "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", "required": false, diff --git a/.butcher/methods/getStarTransactions/entity.json b/.butcher/methods/getStarTransactions/entity.json new file mode 100644 index 00000000..d13a5720 --- /dev/null +++ b/.butcher/methods/getStarTransactions/entity.json @@ -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": "

Returns the bot's Telegram Star transactions in chronological order. On success, returns a StarTransactions object.

", + "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": "Number of transactions to skip in the response", + "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": "The maximum number of transactions to be retrieved. Values between 1-100 are accepted. Defaults to 100.", + "rst_description": "The maximum number of transactions to be retrieved. Values between 1-100 are accepted. Defaults to 100.\n", + "name": "limit" + } + ], + "category": "methods" + } +} diff --git a/.butcher/methods/stopMessageLiveLocation/entity.json b/.butcher/methods/stopMessageLiveLocation/entity.json index c3cdddfb..dd33f101 100644 --- a/.butcher/methods/stopMessageLiveLocation/entity.json +++ b/.butcher/methods/stopMessageLiveLocation/entity.json @@ -11,6 +11,14 @@ "html_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 Message is returned, otherwise 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": [ + { + "type": "String", + "required": false, + "description": "Unique identifier of the business connection on behalf of which the message to be edited was sent", + "html_description": "Unique identifier of the business connection on behalf of which the message to be edited was sent", + "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", "required": false, diff --git a/.butcher/methods/stopPoll/entity.json b/.butcher/methods/stopPoll/entity.json index b735f0fb..c3d58e24 100644 --- a/.butcher/methods/stopPoll/entity.json +++ b/.butcher/methods/stopPoll/entity.json @@ -11,6 +11,14 @@ "html_description": "

Use this method to stop a poll which was sent by the bot. On success, the stopped 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": [ + { + "type": "String", + "required": false, + "description": "Unique identifier of the business connection on behalf of which the message to be edited was sent", + "html_description": "Unique identifier of the business connection on behalf of which the message to be edited was sent", + "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", "required": true, diff --git a/.butcher/schema/schema.json b/.butcher/schema/schema.json index a50ca8b3..b0db2bc6 100644 --- a/.butcher/schema/schema.json +++ b/.butcher/schema/schema.json @@ -1,7 +1,7 @@ { "api": { - "version": "7.4", - "release_date": "2024-05-28" + "version": "7.5", + "release_date": "2024-06-18" }, "items": [ { @@ -4583,9 +4583,9 @@ }, { "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.", - "html_description": "Optional. 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.", - "rst_description": "*Optional*. 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.\n", + "description": "Data to be sent in a callback query to the bot when the button is pressed, 1-64 bytes", + "html_description": "Optional. Data to be sent in a callback query to the bot when the button is pressed, 1-64 bytes", + "rst_description": "*Optional*. Data to be sent in a `callback query `_ to the bot when the button is pressed, 1-64 bytes\n", "name": "callback_data", "required": false }, @@ -11146,10 +11146,18 @@ { "anchor": "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.", - "html_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.

", - "rst_description": "Use this method to edit text and `game `_ 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.", + "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": "

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.

", + "rst_description": "Use this method to edit text and `game `_ 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": [ + { + "type": "String", + "required": false, + "description": "Unique identifier of the business connection on behalf of which the message to be edited was sent", + "html_description": "Unique identifier of the business connection on behalf of which the message to be edited was sent", + "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", "required": false, @@ -11220,10 +11228,18 @@ { "anchor": "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.", - "html_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.

", - "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.", + "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": "

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.

", + "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": [ + { + "type": "String", + "required": false, + "description": "Unique identifier of the business connection on behalf of which the message to be edited was sent", + "html_description": "Unique identifier of the business connection on behalf of which the message to be edited was sent", + "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", "required": false, @@ -11294,10 +11310,18 @@ { "anchor": "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.", - "html_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.

", - "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.", + "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": "

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.

", + "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": [ + { + "type": "String", + "required": false, + "description": "Unique identifier of the business connection on behalf of which the message to be edited was sent", + "html_description": "Unique identifier of the business connection on behalf of which the message to be edited was sent", + "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", "required": false, @@ -11348,6 +11372,14 @@ "html_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 stopMessageLiveLocation. On success, if the edited message is not an inline message, the edited Message is returned, otherwise 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": [ + { + "type": "String", + "required": false, + "description": "Unique identifier of the business connection on behalf of which the message to be edited was sent", + "html_description": "Unique identifier of the business connection on behalf of which the message to be edited was sent", + "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", "required": false, @@ -11438,6 +11470,14 @@ "html_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 Message is returned, otherwise 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": [ + { + "type": "String", + "required": false, + "description": "Unique identifier of the business connection on behalf of which the message to be edited was sent", + "html_description": "Unique identifier of the business connection on behalf of which the message to be edited was sent", + "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", "required": false, @@ -11476,10 +11516,18 @@ { "anchor": "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.", - "html_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.

", - "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.", + "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": "

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.

", + "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": [ + { + "type": "String", + "required": false, + "description": "Unique identifier of the business connection on behalf of which the message to be edited was sent", + "html_description": "Unique identifier of the business connection on behalf of which the message to be edited was sent", + "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", "required": false, @@ -11522,6 +11570,14 @@ "html_description": "

Use this method to stop a poll which was sent by the bot. On success, the stopped 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": [ + { + "type": "String", + "required": false, + "description": "Unique identifier of the business connection on behalf of which the message to be edited was sent", + "html_description": "Unique identifier of the business connection on behalf of which the message to be edited was sent", + "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", "required": true, @@ -15542,6 +15598,32 @@ ], "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": "

Returns the bot's Telegram Star transactions in chronological order. On success, returns a StarTransactions object.

", + "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": "Number of transactions to skip in the response", + "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": "The maximum number of transactions to be retrieved. Values between 1-100 are accepted. Defaults to 100.", + "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", "name": "refundStarPayment", @@ -15951,6 +16033,232 @@ } ], "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": "

This object describes the state of a revenue withdrawal operation. Currently, it can be one of

", + "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": "

The withdrawal is in progress.

", + "rst_description": "The withdrawal is in progress.", + "annotations": [ + { + "type": "String", + "description": "Type of the state, always 'pending'", + "html_description": "Type of the state, always “pending”", + "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": "

The withdrawal succeeded.

", + "rst_description": "The withdrawal succeeded.", + "annotations": [ + { + "type": "String", + "description": "Type of the state, always 'succeeded'", + "html_description": "Type of the state, always “succeeded”", + "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": "Date the withdrawal was completed in Unix time", + "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": "An HTTPS URL that can be used to see transaction details", + "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": "

The withdrawal failed and the transaction was refunded.

", + "rst_description": "The withdrawal failed and the transaction was refunded.", + "annotations": [ + { + "type": "String", + "description": "Type of the state, always 'failed'", + "html_description": "Type of the state, always “failed”", + "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": "

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

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

Describes a withdrawal transaction with Fragment.

", + "rst_description": "Describes a withdrawal transaction with Fragment.", + "annotations": [ + { + "type": "String", + "description": "Type of the transaction partner, always 'fragment'", + "html_description": "Type of the transaction partner, always “fragment”", + "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": "Optional. State of the transaction if the transaction is outgoing", + "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": "

Describes a transaction with a user.

", + "rst_description": "Describes a transaction with a user.", + "annotations": [ + { + "type": "String", + "description": "Type of the transaction partner, always 'user'", + "html_description": "Type of the transaction partner, always “user”", + "rst_description": "Type of the transaction partner, always 'user'\n", + "name": "type", + "required": true + }, + { + "type": "User", + "description": "Information about the user", + "html_description": "Information about the user", + "rst_description": "Information about the user\n", + "name": "user", + "required": true + } + ], + "category": "types" + }, + { + "anchor": "transactionpartnerother", + "name": "TransactionPartnerOther", + "description": "Describes a transaction with an unknown source or recipient.", + "html_description": "

Describes a transaction with an unknown source or recipient.

", + "rst_description": "Describes a transaction with an unknown source or recipient.", + "annotations": [ + { + "type": "String", + "description": "Type of the transaction partner, always 'other'", + "html_description": "Type of the transaction partner, always “other”", + "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": "

Describes a Telegram Star transaction.

", + "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": "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.", + "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": "Number of Telegram Stars transferred by the transaction", + "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": "Date the transaction was created in Unix time", + "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": "Optional. Source of an incoming transaction (e.g., a user purchasing goods or services, Fragment refunding a failed withdrawal). Only for incoming transactions", + "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": "Optional. Receiver of an outgoing transaction (e.g., a user for a purchase refund, Fragment for a withdrawal). Only for outgoing transactions", + "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": "

Contains a list of Telegram Star transactions.

", + "rst_description": "Contains a list of Telegram Star transactions.", + "annotations": [ + { + "type": "Array of StarTransaction", + "description": "The list of transactions", + "html_description": "The list of transactions", + "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." diff --git a/.butcher/types/InlineKeyboardButton/entity.json b/.butcher/types/InlineKeyboardButton/entity.json index 7b502151..7476ee56 100644 --- a/.butcher/types/InlineKeyboardButton/entity.json +++ b/.butcher/types/InlineKeyboardButton/entity.json @@ -29,9 +29,9 @@ }, { "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.", - "html_description": "Optional. 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.", - "rst_description": "*Optional*. 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.\n", + "description": "Data to be sent in a callback query to the bot when the button is pressed, 1-64 bytes", + "html_description": "Optional. Data to be sent in a callback query to the bot when the button is pressed, 1-64 bytes", + "rst_description": "*Optional*. Data to be sent in a `callback query `_ to the bot when the button is pressed, 1-64 bytes\n", "name": "callback_data", "required": false }, diff --git a/.butcher/types/RevenueWithdrawalState/entity.json b/.butcher/types/RevenueWithdrawalState/entity.json new file mode 100644 index 00000000..647f2684 --- /dev/null +++ b/.butcher/types/RevenueWithdrawalState/entity.json @@ -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": "

This object describes the state of a revenue withdrawal operation. Currently, it can be one of

", + "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" + } +} diff --git a/.butcher/types/RevenueWithdrawalState/subtypes.yml b/.butcher/types/RevenueWithdrawalState/subtypes.yml new file mode 100644 index 00000000..6756ad51 --- /dev/null +++ b/.butcher/types/RevenueWithdrawalState/subtypes.yml @@ -0,0 +1 @@ +discriminator: "type" diff --git a/.butcher/types/RevenueWithdrawalStateFailed/entity.json b/.butcher/types/RevenueWithdrawalStateFailed/entity.json new file mode 100644 index 00000000..bcf914e3 --- /dev/null +++ b/.butcher/types/RevenueWithdrawalStateFailed/entity.json @@ -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": "

The withdrawal failed and the transaction was refunded.

", + "rst_description": "The withdrawal failed and the transaction was refunded.", + "annotations": [ + { + "type": "String", + "description": "Type of the state, always 'failed'", + "html_description": "Type of the state, always “failed”", + "rst_description": "Type of the state, always 'failed'\n", + "name": "type", + "required": true + } + ], + "category": "types" + } +} diff --git a/.butcher/types/RevenueWithdrawalStatePending/entity.json b/.butcher/types/RevenueWithdrawalStatePending/entity.json new file mode 100644 index 00000000..99e8dc90 --- /dev/null +++ b/.butcher/types/RevenueWithdrawalStatePending/entity.json @@ -0,0 +1,25 @@ +{ + "meta": {}, + "group": { + "title": "Payments", + "anchor": "payments" + }, + "object": { + "anchor": "revenuewithdrawalstatepending", + "name": "RevenueWithdrawalStatePending", + "description": "The withdrawal is in progress.", + "html_description": "

The withdrawal is in progress.

", + "rst_description": "The withdrawal is in progress.", + "annotations": [ + { + "type": "String", + "description": "Type of the state, always 'pending'", + "html_description": "Type of the state, always “pending”", + "rst_description": "Type of the state, always 'pending'\n", + "name": "type", + "required": true + } + ], + "category": "types" + } +} diff --git a/.butcher/types/RevenueWithdrawalStateSucceeded/entity.json b/.butcher/types/RevenueWithdrawalStateSucceeded/entity.json new file mode 100644 index 00000000..2c6888d6 --- /dev/null +++ b/.butcher/types/RevenueWithdrawalStateSucceeded/entity.json @@ -0,0 +1,41 @@ +{ + "meta": {}, + "group": { + "title": "Payments", + "anchor": "payments" + }, + "object": { + "anchor": "revenuewithdrawalstatesucceeded", + "name": "RevenueWithdrawalStateSucceeded", + "description": "The withdrawal succeeded.", + "html_description": "

The withdrawal succeeded.

", + "rst_description": "The withdrawal succeeded.", + "annotations": [ + { + "type": "String", + "description": "Type of the state, always 'succeeded'", + "html_description": "Type of the state, always “succeeded”", + "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": "Date the withdrawal was completed in Unix time", + "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": "An HTTPS URL that can be used to see transaction details", + "rst_description": "An HTTPS URL that can be used to see transaction details\n", + "name": "url", + "required": true + } + ], + "category": "types" + } +} diff --git a/.butcher/types/RevenueWithdrawalStateSucceeded/replace.yml b/.butcher/types/RevenueWithdrawalStateSucceeded/replace.yml new file mode 100644 index 00000000..80c48d76 --- /dev/null +++ b/.butcher/types/RevenueWithdrawalStateSucceeded/replace.yml @@ -0,0 +1,5 @@ +annotations: + date: + parsed_type: + type: std + name: DateTime diff --git a/.butcher/types/StarTransaction/entity.json b/.butcher/types/StarTransaction/entity.json new file mode 100644 index 00000000..41879b25 --- /dev/null +++ b/.butcher/types/StarTransaction/entity.json @@ -0,0 +1,57 @@ +{ + "meta": {}, + "group": { + "title": "Payments", + "anchor": "payments" + }, + "object": { + "anchor": "startransaction", + "name": "StarTransaction", + "description": "Describes a Telegram Star transaction.", + "html_description": "

Describes a Telegram Star transaction.

", + "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": "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.", + "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": "Number of Telegram Stars transferred by the transaction", + "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": "Date the transaction was created in Unix time", + "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": "Optional. Source of an incoming transaction (e.g., a user purchasing goods or services, Fragment refunding a failed withdrawal). Only for incoming transactions", + "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": "Optional. Receiver of an outgoing transaction (e.g., a user for a purchase refund, Fragment for a withdrawal). Only for outgoing transactions", + "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" + } +} diff --git a/.butcher/types/StarTransaction/replace.yml b/.butcher/types/StarTransaction/replace.yml new file mode 100644 index 00000000..80c48d76 --- /dev/null +++ b/.butcher/types/StarTransaction/replace.yml @@ -0,0 +1,5 @@ +annotations: + date: + parsed_type: + type: std + name: DateTime diff --git a/.butcher/types/StarTransactions/entity.json b/.butcher/types/StarTransactions/entity.json new file mode 100644 index 00000000..a3983697 --- /dev/null +++ b/.butcher/types/StarTransactions/entity.json @@ -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": "

Contains a list of Telegram Star transactions.

", + "rst_description": "Contains a list of Telegram Star transactions.", + "annotations": [ + { + "type": "Array of StarTransaction", + "description": "The list of transactions", + "html_description": "The list of transactions", + "rst_description": "The list of transactions\n", + "name": "transactions", + "required": true + } + ], + "category": "types" + } +} diff --git a/.butcher/types/TransactionPartner/entity.json b/.butcher/types/TransactionPartner/entity.json new file mode 100644 index 00000000..a705938d --- /dev/null +++ b/.butcher/types/TransactionPartner/entity.json @@ -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": "

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

", + "rst_description": "This object describes the source of a transaction, or its recipient for outgoing transactions. Currently, it can be one of\n\n - :class:`aiogram.types.transaction_partner_fragment.TransactionPartnerFragment`\n - :class:`aiogram.types.transaction_partner_user.TransactionPartnerUser`\n - :class:`aiogram.types.transaction_partner_other.TransactionPartnerOther`", + "annotations": [], + "category": "types" + } +} diff --git a/.butcher/types/TransactionPartner/subtypes.yml b/.butcher/types/TransactionPartner/subtypes.yml new file mode 100644 index 00000000..6756ad51 --- /dev/null +++ b/.butcher/types/TransactionPartner/subtypes.yml @@ -0,0 +1 @@ +discriminator: "type" diff --git a/.butcher/types/TransactionPartnerFragment/entity.json b/.butcher/types/TransactionPartnerFragment/entity.json new file mode 100644 index 00000000..e4964bd4 --- /dev/null +++ b/.butcher/types/TransactionPartnerFragment/entity.json @@ -0,0 +1,33 @@ +{ + "meta": {}, + "group": { + "title": "Payments", + "anchor": "payments" + }, + "object": { + "anchor": "transactionpartnerfragment", + "name": "TransactionPartnerFragment", + "description": "Describes a withdrawal transaction with Fragment.", + "html_description": "

Describes a withdrawal transaction with Fragment.

", + "rst_description": "Describes a withdrawal transaction with Fragment.", + "annotations": [ + { + "type": "String", + "description": "Type of the transaction partner, always 'fragment'", + "html_description": "Type of the transaction partner, always “fragment”", + "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": "Optional. State of the transaction if the transaction is outgoing", + "rst_description": "*Optional*. State of the transaction if the transaction is outgoing\n", + "name": "withdrawal_state", + "required": false + } + ], + "category": "types" + } +} diff --git a/.butcher/types/TransactionPartnerOther/entity.json b/.butcher/types/TransactionPartnerOther/entity.json new file mode 100644 index 00000000..203cd32a --- /dev/null +++ b/.butcher/types/TransactionPartnerOther/entity.json @@ -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": "

Describes a transaction with an unknown source or recipient.

", + "rst_description": "Describes a transaction with an unknown source or recipient.", + "annotations": [ + { + "type": "String", + "description": "Type of the transaction partner, always 'other'", + "html_description": "Type of the transaction partner, always “other”", + "rst_description": "Type of the transaction partner, always 'other'\n", + "name": "type", + "required": true + } + ], + "category": "types" + } +} diff --git a/.butcher/types/TransactionPartnerUser/entity.json b/.butcher/types/TransactionPartnerUser/entity.json new file mode 100644 index 00000000..cb42215b --- /dev/null +++ b/.butcher/types/TransactionPartnerUser/entity.json @@ -0,0 +1,33 @@ +{ + "meta": {}, + "group": { + "title": "Payments", + "anchor": "payments" + }, + "object": { + "anchor": "transactionpartneruser", + "name": "TransactionPartnerUser", + "description": "Describes a transaction with a user.", + "html_description": "

Describes a transaction with a user.

", + "rst_description": "Describes a transaction with a user.", + "annotations": [ + { + "type": "String", + "description": "Type of the transaction partner, always 'user'", + "html_description": "Type of the transaction partner, always “user”", + "rst_description": "Type of the transaction partner, always 'user'\n", + "name": "type", + "required": true + }, + { + "type": "User", + "description": "Information about the user", + "html_description": "Information about the user", + "rst_description": "Information about the user\n", + "name": "user", + "required": true + } + ], + "category": "types" + } +} diff --git a/CHANGES/1518.feature.rst b/CHANGES/1518.feature.rst new file mode 100644 index 00000000..9bb16597 --- /dev/null +++ b/CHANGES/1518.feature.rst @@ -0,0 +1,25 @@ +Added full support of `Bot API 7.5 `_ + +- 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. diff --git a/aiogram/client/bot.py b/aiogram/client/bot.py index d083aa0c..7348d201 100644 --- a/aiogram/client/bot.py +++ b/aiogram/client/bot.py @@ -78,6 +78,7 @@ from ..methods import ( GetMyDescription, GetMyName, GetMyShortDescription, + GetStarTransactions, GetStickerSet, GetUpdates, GetUserChatBoosts, @@ -231,6 +232,7 @@ from ..types import ( ReplyParameters, SentWebAppMessage, ShippingOption, + StarTransactions, Sticker, StickerSet, Update, @@ -1342,6 +1344,7 @@ class Bot: async def edit_message_caption( self, + business_connection_id: Optional[str] = None, chat_id: Optional[Union[int, str]] = None, message_id: Optional[int] = None, inline_message_id: Optional[str] = None, @@ -1355,10 +1358,11 @@ class Bot: request_timeout: Optional[int] = None, ) -> 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 + :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 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 @@ -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 reply_markup: A JSON-serialized object for an `inline keyboard `_. :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( + business_connection_id=business_connection_id, chat_id=chat_id, message_id=message_id, inline_message_id=inline_message_id, @@ -1387,6 +1392,7 @@ class Bot: self, latitude: float, longitude: float, + business_connection_id: Optional[str] = None, chat_id: Optional[Union[int, str]] = None, message_id: Optional[int] = None, inline_message_id: Optional[str] = None, @@ -1404,6 +1410,7 @@ class Bot: :param latitude: Latitude 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 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 @@ -1419,6 +1426,7 @@ class Bot: call = EditMessageLiveLocation( latitude=latitude, longitude=longitude, + business_connection_id=business_connection_id, chat_id=chat_id, message_id=message_id, inline_message_id=inline_message_id, @@ -1439,6 +1447,7 @@ class Bot: InputMediaPhoto, InputMediaVideo, ], + business_connection_id: Optional[str] = None, chat_id: Optional[Union[int, str]] = None, message_id: Optional[int] = None, inline_message_id: Optional[str] = None, @@ -1446,21 +1455,23 @@ class Bot: request_timeout: Optional[int] = None, ) -> 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 :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 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 reply_markup: A JSON-serialized object for a new `inline keyboard `_. :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( media=media, + business_connection_id=business_connection_id, chat_id=chat_id, message_id=message_id, inline_message_id=inline_message_id, @@ -1470,6 +1481,7 @@ class Bot: async def edit_message_reply_markup( self, + business_connection_id: Optional[str] = None, chat_id: Optional[Union[int, str]] = None, message_id: Optional[int] = None, inline_message_id: Optional[str] = None, @@ -1477,19 +1489,21 @@ class Bot: request_timeout: Optional[int] = None, ) -> 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 + :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 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 reply_markup: A JSON-serialized object for an `inline keyboard `_. :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( + business_connection_id=business_connection_id, chat_id=chat_id, message_id=message_id, inline_message_id=inline_message_id, @@ -1500,6 +1514,7 @@ class Bot: async def edit_message_text( self, text: str, + business_connection_id: Optional[str] = None, chat_id: Optional[Union[int, str]] = None, message_id: Optional[int] = None, inline_message_id: Optional[str] = None, @@ -1513,11 +1528,12 @@ class Bot: request_timeout: Optional[int] = None, ) -> Union[Message, bool]: """ - Use this method to edit text and `game `_ 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 `_ 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 :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 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 @@ -1527,11 +1543,12 @@ class Bot: :param reply_markup: A JSON-serialized object for an `inline keyboard `_. :param disable_web_page_preview: Disables link previews for links in this message :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( text=text, + business_connection_id=business_connection_id, chat_id=chat_id, message_id=message_id, inline_message_id=inline_message_id, @@ -3760,6 +3777,7 @@ class Bot: async def stop_message_live_location( self, + business_connection_id: Optional[str] = None, chat_id: Optional[Union[int, str]] = None, message_id: Optional[int] = None, inline_message_id: Optional[str] = None, @@ -3771,6 +3789,7 @@ class Bot: 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 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 @@ -3780,6 +3799,7 @@ class Bot: """ call = StopMessageLiveLocation( + business_connection_id=business_connection_id, chat_id=chat_id, message_id=message_id, inline_message_id=inline_message_id, @@ -3791,6 +3811,7 @@ class Bot: self, chat_id: Union[int, str], message_id: int, + business_connection_id: Optional[str] = None, reply_markup: Optional[InlineKeyboardMarkup] = None, request_timeout: Optional[int] = None, ) -> 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 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 `_. :param request_timeout: Request timeout :return: On success, the stopped :class:`aiogram.types.poll.Poll` is returned. @@ -3809,6 +3831,7 @@ class Bot: call = StopPoll( chat_id=chat_id, message_id=message_id, + business_connection_id=business_connection_id, reply_markup=reply_markup, ) return await self(call, request_timeout=request_timeout) @@ -4589,3 +4612,26 @@ class Bot: telegram_payment_charge_id=telegram_payment_charge_id, ) 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) diff --git a/aiogram/client/session/aiohttp.py b/aiogram/client/session/aiohttp.py index 9e1d9e1b..69f36bf1 100644 --- a/aiogram/client/session/aiohttp.py +++ b/aiogram/client/session/aiohttp.py @@ -23,10 +23,11 @@ from aiohttp.http import SERVER_SOFTWARE from aiogram.__meta__ import __version__ from aiogram.methods import TelegramMethod -from .base import BaseSession + from ...exceptions import TelegramNetworkError from ...methods.base import TelegramType from ...types import InputFile +from .base import BaseSession if TYPE_CHECKING: from ..bot import Bot diff --git a/aiogram/enums/__init__.py b/aiogram/enums/__init__.py index c3d8d587..94783ac4 100644 --- a/aiogram/enums/__init__.py +++ b/aiogram/enums/__init__.py @@ -18,9 +18,11 @@ from .parse_mode import ParseMode from .passport_element_error_type import PassportElementErrorType from .poll_type import PollType from .reaction_type_type import ReactionTypeType +from .revenue_withdrawal_state_type import RevenueWithdrawalStateType from .sticker_format import StickerFormat from .sticker_type import StickerType from .topic_icon_color import TopicIconColor +from .transaction_partner_type import TransactionPartnerType from .update_type import UpdateType __all__ = ( @@ -44,8 +46,10 @@ __all__ = ( "PassportElementErrorType", "PollType", "ReactionTypeType", + "RevenueWithdrawalStateType", "StickerFormat", "StickerType", "TopicIconColor", + "TransactionPartnerType", "UpdateType", ) diff --git a/aiogram/enums/revenue_withdrawal_state_type.py b/aiogram/enums/revenue_withdrawal_state_type.py new file mode 100644 index 00000000..89a9a043 --- /dev/null +++ b/aiogram/enums/revenue_withdrawal_state_type.py @@ -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" diff --git a/aiogram/enums/transaction_partner_type.py b/aiogram/enums/transaction_partner_type.py new file mode 100644 index 00000000..4cd8340b --- /dev/null +++ b/aiogram/enums/transaction_partner_type.py @@ -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" diff --git a/aiogram/methods/__init__.py b/aiogram/methods/__init__.py index 55d86b5c..ec4c2d2e 100644 --- a/aiogram/methods/__init__.py +++ b/aiogram/methods/__init__.py @@ -54,6 +54,7 @@ from .get_my_default_administrator_rights import GetMyDefaultAdministratorRights from .get_my_description import GetMyDescription from .get_my_name import GetMyName from .get_my_short_description import GetMyShortDescription +from .get_star_transactions import GetStarTransactions from .get_sticker_set import GetStickerSet from .get_updates import GetUpdates from .get_user_chat_boosts import GetUserChatBoosts @@ -178,6 +179,7 @@ __all__ = ( "GetMyDescription", "GetMyName", "GetMyShortDescription", + "GetStarTransactions", "GetStickerSet", "GetUpdates", "GetUserChatBoosts", diff --git a/aiogram/methods/edit_message_caption.py b/aiogram/methods/edit_message_caption.py index e18b50a9..8a759d40 100644 --- a/aiogram/methods/edit_message_caption.py +++ b/aiogram/methods/edit_message_caption.py @@ -9,7 +9,7 @@ from .base import TelegramMethod class EditMessageCaption(TelegramMethod[Union[Message, bool]]): """ - Use this method to edit captions of messages. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. + 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 """ @@ -17,6 +17,8 @@ class EditMessageCaption(TelegramMethod[Union[Message, bool]]): __returning__ = Union[Message, bool] __api_method__ = "editMessageCaption" + business_connection_id: Optional[str] = None + """Unique identifier of the business connection on behalf of which the message to be edited was sent""" chat_id: Optional[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`)""" message_id: Optional[int] = None @@ -41,6 +43,7 @@ class EditMessageCaption(TelegramMethod[Union[Message, bool]]): def __init__( __pydantic__self__, *, + business_connection_id: Optional[str] = None, chat_id: Optional[Union[int, str]] = None, message_id: Optional[int] = 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 super().__init__( + business_connection_id=business_connection_id, chat_id=chat_id, message_id=message_id, inline_message_id=inline_message_id, diff --git a/aiogram/methods/edit_message_live_location.py b/aiogram/methods/edit_message_live_location.py index 7c912196..6bc5569f 100644 --- a/aiogram/methods/edit_message_live_location.py +++ b/aiogram/methods/edit_message_live_location.py @@ -20,6 +20,8 @@ class EditMessageLiveLocation(TelegramMethod[Union[Message, bool]]): """Latitude of new location""" longitude: float """Longitude of new location""" + business_connection_id: Optional[str] = None + """Unique identifier of the business connection on behalf of which the message to be edited was sent""" chat_id: Optional[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`)""" message_id: Optional[int] = None @@ -46,6 +48,7 @@ class EditMessageLiveLocation(TelegramMethod[Union[Message, bool]]): *, latitude: float, longitude: float, + business_connection_id: Optional[str] = None, chat_id: Optional[Union[int, str]] = None, message_id: Optional[int] = None, inline_message_id: Optional[str] = None, @@ -63,6 +66,7 @@ class EditMessageLiveLocation(TelegramMethod[Union[Message, bool]]): super().__init__( latitude=latitude, longitude=longitude, + business_connection_id=business_connection_id, chat_id=chat_id, message_id=message_id, inline_message_id=inline_message_id, diff --git a/aiogram/methods/edit_message_media.py b/aiogram/methods/edit_message_media.py index a354de03..b898be79 100644 --- a/aiogram/methods/edit_message_media.py +++ b/aiogram/methods/edit_message_media.py @@ -16,7 +16,7 @@ from .base import TelegramMethod 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 """ @@ -28,6 +28,8 @@ class EditMessageMedia(TelegramMethod[Union[Message, bool]]): InputMediaAnimation, InputMediaDocument, InputMediaAudio, InputMediaPhoto, InputMediaVideo ] """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 """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 @@ -51,6 +53,7 @@ class EditMessageMedia(TelegramMethod[Union[Message, bool]]): InputMediaPhoto, InputMediaVideo, ], + business_connection_id: Optional[str] = None, chat_id: Optional[Union[int, str]] = None, message_id: Optional[int] = None, inline_message_id: Optional[str] = None, @@ -63,6 +66,7 @@ class EditMessageMedia(TelegramMethod[Union[Message, bool]]): super().__init__( media=media, + business_connection_id=business_connection_id, chat_id=chat_id, message_id=message_id, inline_message_id=inline_message_id, diff --git a/aiogram/methods/edit_message_reply_markup.py b/aiogram/methods/edit_message_reply_markup.py index bc957a14..49052f35 100644 --- a/aiogram/methods/edit_message_reply_markup.py +++ b/aiogram/methods/edit_message_reply_markup.py @@ -8,7 +8,7 @@ from .base import TelegramMethod class EditMessageReplyMarkup(TelegramMethod[Union[Message, bool]]): """ - Use this method to edit only the reply markup of messages. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. + 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 """ @@ -16,6 +16,8 @@ class EditMessageReplyMarkup(TelegramMethod[Union[Message, bool]]): __returning__ = Union[Message, bool] __api_method__ = "editMessageReplyMarkup" + business_connection_id: Optional[str] = None + """Unique identifier of the business connection on behalf of which the message to be edited was sent""" chat_id: Optional[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`)""" message_id: Optional[int] = None @@ -32,6 +34,7 @@ class EditMessageReplyMarkup(TelegramMethod[Union[Message, bool]]): def __init__( __pydantic__self__, *, + business_connection_id: Optional[str] = None, chat_id: Optional[Union[int, str]] = None, message_id: Optional[int] = 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 super().__init__( + business_connection_id=business_connection_id, chat_id=chat_id, message_id=message_id, inline_message_id=inline_message_id, diff --git a/aiogram/methods/edit_message_text.py b/aiogram/methods/edit_message_text.py index 00269c37..cfaaa943 100644 --- a/aiogram/methods/edit_message_text.py +++ b/aiogram/methods/edit_message_text.py @@ -17,7 +17,7 @@ from .base import TelegramMethod class EditMessageText(TelegramMethod[Union[Message, bool]]): """ - Use this method to edit text and `game `_ 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 `_ 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 """ @@ -27,6 +27,8 @@ class EditMessageText(TelegramMethod[Union[Message, bool]]): text: str """New text of the message, 1-4096 characters after entities parsing""" + business_connection_id: Optional[str] = None + """Unique identifier of the business connection on behalf of which the message to be edited was sent""" chat_id: Optional[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`)""" message_id: Optional[int] = None @@ -57,6 +59,7 @@ class EditMessageText(TelegramMethod[Union[Message, bool]]): __pydantic__self__, *, text: str, + business_connection_id: Optional[str] = None, chat_id: Optional[Union[int, str]] = None, message_id: Optional[int] = None, inline_message_id: Optional[str] = None, @@ -75,6 +78,7 @@ class EditMessageText(TelegramMethod[Union[Message, bool]]): super().__init__( text=text, + business_connection_id=business_connection_id, chat_id=chat_id, message_id=message_id, inline_message_id=inline_message_id, diff --git a/aiogram/methods/get_star_transactions.py b/aiogram/methods/get_star_transactions.py new file mode 100644 index 00000000..ee0ea2e1 --- /dev/null +++ b/aiogram/methods/get_star_transactions.py @@ -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) diff --git a/aiogram/methods/stop_message_live_location.py b/aiogram/methods/stop_message_live_location.py index a6680955..f5fe3359 100644 --- a/aiogram/methods/stop_message_live_location.py +++ b/aiogram/methods/stop_message_live_location.py @@ -16,6 +16,8 @@ class StopMessageLiveLocation(TelegramMethod[Union[Message, bool]]): __returning__ = Union[Message, bool] __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 """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 @@ -32,6 +34,7 @@ class StopMessageLiveLocation(TelegramMethod[Union[Message, bool]]): def __init__( __pydantic__self__, *, + business_connection_id: Optional[str] = None, chat_id: Optional[Union[int, str]] = None, message_id: Optional[int] = 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 super().__init__( + business_connection_id=business_connection_id, chat_id=chat_id, message_id=message_id, inline_message_id=inline_message_id, diff --git a/aiogram/methods/stop_poll.py b/aiogram/methods/stop_poll.py index 81c46b1a..8393a522 100644 --- a/aiogram/methods/stop_poll.py +++ b/aiogram/methods/stop_poll.py @@ -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`)""" message_id: int """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 """A JSON-serialized object for a new message `inline keyboard `_.""" @@ -32,6 +34,7 @@ class StopPoll(TelegramMethod[Poll]): *, chat_id: Union[int, str], message_id: int, + business_connection_id: Optional[str] = None, reply_markup: Optional[InlineKeyboardMarkup] = None, **__pydantic_kwargs: Any, ) -> None: @@ -42,6 +45,7 @@ class StopPoll(TelegramMethod[Poll]): super().__init__( chat_id=chat_id, message_id=message_id, + business_connection_id=business_connection_id, reply_markup=reply_markup, **__pydantic_kwargs, ) diff --git a/aiogram/types/__init__.py b/aiogram/types/__init__.py index 564e31c2..c8372d35 100644 --- a/aiogram/types/__init__.py +++ b/aiogram/types/__init__.py @@ -183,17 +183,27 @@ from .reply_keyboard_markup import ReplyKeyboardMarkup from .reply_keyboard_remove import ReplyKeyboardRemove from .reply_parameters import ReplyParameters 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 .shared_user import SharedUser from .shipping_address import ShippingAddress from .shipping_option import ShippingOption from .shipping_query import ShippingQuery +from .star_transaction import StarTransaction +from .star_transactions import StarTransactions from .sticker import Sticker from .sticker_set import StickerSet from .story import Story from .successful_payment import SuccessfulPayment from .switch_inline_query_chosen_chat import SwitchInlineQueryChosenChat 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 .user import User from .user_chat_boosts import UserChatBoosts @@ -395,11 +405,17 @@ __all__ = ( "ReplyKeyboardRemove", "ReplyParameters", "ResponseParameters", + "RevenueWithdrawalState", + "RevenueWithdrawalStateFailed", + "RevenueWithdrawalStatePending", + "RevenueWithdrawalStateSucceeded", "SentWebAppMessage", "SharedUser", "ShippingAddress", "ShippingOption", "ShippingQuery", + "StarTransaction", + "StarTransactions", "Sticker", "StickerSet", "Story", @@ -407,6 +423,10 @@ __all__ = ( "SwitchInlineQueryChosenChat", "TelegramObject", "TextQuote", + "TransactionPartner", + "TransactionPartnerFragment", + "TransactionPartnerOther", + "TransactionPartnerUser", "UNSET_PARSE_MODE", "URLInputFile", "Update", diff --git a/aiogram/types/inline_keyboard_button.py b/aiogram/types/inline_keyboard_button.py index 96b4a745..fa801f2c 100644 --- a/aiogram/types/inline_keyboard_button.py +++ b/aiogram/types/inline_keyboard_button.py @@ -23,7 +23,7 @@ class InlineKeyboardButton(MutableTelegramObject): url: Optional[str] = None """*Optional*. HTTP or tg:// URL to be opened when the button is pressed. Links :code:`tg://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 - """*Optional*. 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.""" + """*Optional*. Data to be sent in a `callback query `_ to the bot when the button is pressed, 1-64 bytes""" web_app: Optional[WebAppInfo] = None """*Optional*. Description of the `Web App `_ that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the method :class:`aiogram.methods.answer_web_app_query.AnswerWebAppQuery`. 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 diff --git a/aiogram/types/message.py b/aiogram/types/message.py index 2b4b34ef..bf7f2139 100644 --- a/aiogram/types/message.py +++ b/aiogram/types/message.py @@ -3531,6 +3531,7 @@ class Message(MaybeInaccessibleMessage): def edit_text( self, text: str, + business_connection_id: Optional[str] = None, inline_message_id: Optional[str] = None, parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), entities: Optional[List[MessageEntity]] = None, @@ -3548,11 +3549,12 @@ class Message(MaybeInaccessibleMessage): - :code:`chat_id` - :code:`message_id` - Use this method to edit text and `game `_ 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 `_ 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 :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 parse_mode: Mode for parsing entities in the message text. See `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* @@ -3574,6 +3576,7 @@ class Message(MaybeInaccessibleMessage): chat_id=self.chat.id, message_id=self.message_id, text=text, + business_connection_id=business_connection_id, inline_message_id=inline_message_id, parse_mode=parse_mode, entities=entities, @@ -3636,6 +3639,7 @@ class Message(MaybeInaccessibleMessage): InputMediaPhoto, InputMediaVideo, ], + business_connection_id: Optional[str] = None, inline_message_id: Optional[str] = None, reply_markup: Optional[InlineKeyboardMarkup] = None, **kwargs: Any, @@ -3647,11 +3651,12 @@ class Message(MaybeInaccessibleMessage): - :code:`chat_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 :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 reply_markup: A JSON-serialized object for a new `inline keyboard `_. :return: instance of method :class:`aiogram.methods.edit_message_media.EditMessageMedia` @@ -3669,6 +3674,7 @@ class Message(MaybeInaccessibleMessage): chat_id=self.chat.id, message_id=self.message_id, media=media, + business_connection_id=business_connection_id, inline_message_id=inline_message_id, reply_markup=reply_markup, **kwargs, @@ -3676,6 +3682,7 @@ class Message(MaybeInaccessibleMessage): def edit_reply_markup( self, + business_connection_id: Optional[str] = None, inline_message_id: Optional[str] = None, reply_markup: Optional[InlineKeyboardMarkup] = None, **kwargs: Any, @@ -3687,10 +3694,11 @@ class Message(MaybeInaccessibleMessage): - :code:`chat_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 + :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 reply_markup: A JSON-serialized object for an `inline keyboard `_. :return: instance of method :class:`aiogram.methods.edit_message_reply_markup.EditMessageReplyMarkup` @@ -3707,6 +3715,7 @@ class Message(MaybeInaccessibleMessage): return EditMessageReplyMarkup( chat_id=self.chat.id, message_id=self.message_id, + business_connection_id=business_connection_id, inline_message_id=inline_message_id, reply_markup=reply_markup, **kwargs, @@ -3714,6 +3723,7 @@ class Message(MaybeInaccessibleMessage): def delete_reply_markup( self, + business_connection_id: Optional[str] = None, inline_message_id: Optional[str] = None, **kwargs: Any, ) -> EditMessageReplyMarkup: @@ -3725,10 +3735,11 @@ class Message(MaybeInaccessibleMessage): - :code:`message_id` - :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 + :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 :return: instance of method :class:`aiogram.methods.edit_message_reply_markup.EditMessageReplyMarkup` """ @@ -3745,6 +3756,7 @@ class Message(MaybeInaccessibleMessage): chat_id=self.chat.id, message_id=self.message_id, reply_markup=None, + business_connection_id=business_connection_id, inline_message_id=inline_message_id, **kwargs, ).as_(self._bot) @@ -3753,6 +3765,7 @@ class Message(MaybeInaccessibleMessage): self, latitude: float, longitude: float, + business_connection_id: Optional[str] = None, inline_message_id: Optional[str] = None, live_period: Optional[int] = None, horizontal_accuracy: Optional[float] = None, @@ -3774,6 +3787,7 @@ class Message(MaybeInaccessibleMessage): :param latitude: Latitude 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 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 @@ -3796,6 +3810,7 @@ class Message(MaybeInaccessibleMessage): message_id=self.message_id, latitude=latitude, longitude=longitude, + business_connection_id=business_connection_id, inline_message_id=inline_message_id, live_period=live_period, horizontal_accuracy=horizontal_accuracy, @@ -3807,6 +3822,7 @@ class Message(MaybeInaccessibleMessage): def stop_live_location( self, + business_connection_id: Optional[str] = None, inline_message_id: Optional[str] = None, reply_markup: Optional[InlineKeyboardMarkup] = None, **kwargs: Any, @@ -3822,6 +3838,7 @@ class Message(MaybeInaccessibleMessage): 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 reply_markup: A JSON-serialized object for a new `inline keyboard `_. :return: instance of method :class:`aiogram.methods.stop_message_live_location.StopMessageLiveLocation` @@ -3838,6 +3855,7 @@ class Message(MaybeInaccessibleMessage): return StopMessageLiveLocation( chat_id=self.chat.id, message_id=self.message_id, + business_connection_id=business_connection_id, inline_message_id=inline_message_id, reply_markup=reply_markup, **kwargs, @@ -3845,6 +3863,7 @@ class Message(MaybeInaccessibleMessage): def edit_caption( self, + business_connection_id: Optional[str] = None, inline_message_id: Optional[str] = None, caption: Optional[str] = None, parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), @@ -3862,10 +3881,11 @@ class Message(MaybeInaccessibleMessage): - :code:`chat_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 + :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 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 `_ for more details. @@ -3886,6 +3906,7 @@ class Message(MaybeInaccessibleMessage): return EditMessageCaption( chat_id=self.chat.id, message_id=self.message_id, + business_connection_id=business_connection_id, inline_message_id=inline_message_id, caption=caption, parse_mode=parse_mode, diff --git a/aiogram/types/revenue_withdrawal_state.py b/aiogram/types/revenue_withdrawal_state.py new file mode 100644 index 00000000..740323e0 --- /dev/null +++ b/aiogram/types/revenue_withdrawal_state.py @@ -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 + """ diff --git a/aiogram/types/revenue_withdrawal_state_failed.py b/aiogram/types/revenue_withdrawal_state_failed.py new file mode 100644 index 00000000..501a9ffb --- /dev/null +++ b/aiogram/types/revenue_withdrawal_state_failed.py @@ -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) diff --git a/aiogram/types/revenue_withdrawal_state_pending.py b/aiogram/types/revenue_withdrawal_state_pending.py new file mode 100644 index 00000000..c4e481f6 --- /dev/null +++ b/aiogram/types/revenue_withdrawal_state_pending.py @@ -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) diff --git a/aiogram/types/revenue_withdrawal_state_succeeded.py b/aiogram/types/revenue_withdrawal_state_succeeded.py new file mode 100644 index 00000000..48d45f10 --- /dev/null +++ b/aiogram/types/revenue_withdrawal_state_succeeded.py @@ -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) diff --git a/aiogram/types/star_transaction.py b/aiogram/types/star_transaction.py new file mode 100644 index 00000000..9d6648d6 --- /dev/null +++ b/aiogram/types/star_transaction.py @@ -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, + ) diff --git a/aiogram/types/star_transactions.py b/aiogram/types/star_transactions.py new file mode 100644 index 00000000..d2ee5b0f --- /dev/null +++ b/aiogram/types/star_transactions.py @@ -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) diff --git a/aiogram/types/transaction_partner.py b/aiogram/types/transaction_partner.py new file mode 100644 index 00000000..ddd6eabb --- /dev/null +++ b/aiogram/types/transaction_partner.py @@ -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 + """ diff --git a/aiogram/types/transaction_partner_fragment.py b/aiogram/types/transaction_partner_fragment.py new file mode 100644 index 00000000..350109e0 --- /dev/null +++ b/aiogram/types/transaction_partner_fragment.py @@ -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) diff --git a/aiogram/types/transaction_partner_other.py b/aiogram/types/transaction_partner_other.py new file mode 100644 index 00000000..699297e1 --- /dev/null +++ b/aiogram/types/transaction_partner_other.py @@ -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) diff --git a/aiogram/types/transaction_partner_user.py b/aiogram/types/transaction_partner_user.py new file mode 100644 index 00000000..de0b276f --- /dev/null +++ b/aiogram/types/transaction_partner_user.py @@ -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) diff --git a/docs/api/enums/index.rst b/docs/api/enums/index.rst index 756a04b5..79efa276 100644 --- a/docs/api/enums/index.rst +++ b/docs/api/enums/index.rst @@ -30,7 +30,9 @@ Here is list of all available enums: passport_element_error_type poll_type reaction_type_type + revenue_withdrawal_state_type sticker_format sticker_type topic_icon_color + transaction_partner_type update_type diff --git a/docs/api/enums/revenue_withdrawal_state_type.rst b/docs/api/enums/revenue_withdrawal_state_type.rst new file mode 100644 index 00000000..be56bc5b --- /dev/null +++ b/docs/api/enums/revenue_withdrawal_state_type.rst @@ -0,0 +1,9 @@ +########################## +RevenueWithdrawalStateType +########################## + + +.. automodule:: aiogram.enums.revenue_withdrawal_state_type + :members: + :member-order: bysource + :undoc-members: True diff --git a/docs/api/enums/transaction_partner_type.rst b/docs/api/enums/transaction_partner_type.rst new file mode 100644 index 00000000..247b5d15 --- /dev/null +++ b/docs/api/enums/transaction_partner_type.rst @@ -0,0 +1,9 @@ +###################### +TransactionPartnerType +###################### + + +.. automodule:: aiogram.enums.transaction_partner_type + :members: + :member-order: bysource + :undoc-members: True diff --git a/docs/api/methods/get_star_transactions.rst b/docs/api/methods/get_star_transactions.rst new file mode 100644 index 00000000..0e77ca9b --- /dev/null +++ b/docs/api/methods/get_star_transactions.rst @@ -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(...)) diff --git a/docs/api/methods/index.rst b/docs/api/methods/index.rst index 2325a0c6..7666b799 100644 --- a/docs/api/methods/index.rst +++ b/docs/api/methods/index.rst @@ -161,6 +161,7 @@ Payments answer_pre_checkout_query answer_shipping_query create_invoice_link + get_star_transactions refund_star_payment send_invoice diff --git a/docs/api/types/index.rst b/docs/api/types/index.rst index db2d9119..bf16d083 100644 --- a/docs/api/types/index.rst +++ b/docs/api/types/index.rst @@ -234,10 +234,20 @@ Payments labeled_price order_info pre_checkout_query + revenue_withdrawal_state + revenue_withdrawal_state_failed + revenue_withdrawal_state_pending + revenue_withdrawal_state_succeeded shipping_address shipping_option shipping_query + star_transaction + star_transactions successful_payment + transaction_partner + transaction_partner_fragment + transaction_partner_other + transaction_partner_user Getting updates =============== diff --git a/docs/api/types/revenue_withdrawal_state.rst b/docs/api/types/revenue_withdrawal_state.rst new file mode 100644 index 00000000..059a64b5 --- /dev/null +++ b/docs/api/types/revenue_withdrawal_state.rst @@ -0,0 +1,10 @@ +###################### +RevenueWithdrawalState +###################### + + +.. automodule:: aiogram.types.revenue_withdrawal_state + :members: + :member-order: bysource + :undoc-members: True + :exclude-members: model_config,model_fields diff --git a/docs/api/types/revenue_withdrawal_state_failed.rst b/docs/api/types/revenue_withdrawal_state_failed.rst new file mode 100644 index 00000000..3fbe74d9 --- /dev/null +++ b/docs/api/types/revenue_withdrawal_state_failed.rst @@ -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 diff --git a/docs/api/types/revenue_withdrawal_state_pending.rst b/docs/api/types/revenue_withdrawal_state_pending.rst new file mode 100644 index 00000000..3eecde08 --- /dev/null +++ b/docs/api/types/revenue_withdrawal_state_pending.rst @@ -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 diff --git a/docs/api/types/revenue_withdrawal_state_succeeded.rst b/docs/api/types/revenue_withdrawal_state_succeeded.rst new file mode 100644 index 00000000..4d79bbd1 --- /dev/null +++ b/docs/api/types/revenue_withdrawal_state_succeeded.rst @@ -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 diff --git a/docs/api/types/star_transaction.rst b/docs/api/types/star_transaction.rst new file mode 100644 index 00000000..1bf89d7c --- /dev/null +++ b/docs/api/types/star_transaction.rst @@ -0,0 +1,10 @@ +############### +StarTransaction +############### + + +.. automodule:: aiogram.types.star_transaction + :members: + :member-order: bysource + :undoc-members: True + :exclude-members: model_config,model_fields diff --git a/docs/api/types/star_transactions.rst b/docs/api/types/star_transactions.rst new file mode 100644 index 00000000..5ceadd1e --- /dev/null +++ b/docs/api/types/star_transactions.rst @@ -0,0 +1,10 @@ +################ +StarTransactions +################ + + +.. automodule:: aiogram.types.star_transactions + :members: + :member-order: bysource + :undoc-members: True + :exclude-members: model_config,model_fields diff --git a/docs/api/types/transaction_partner.rst b/docs/api/types/transaction_partner.rst new file mode 100644 index 00000000..2d5a3ee4 --- /dev/null +++ b/docs/api/types/transaction_partner.rst @@ -0,0 +1,10 @@ +################## +TransactionPartner +################## + + +.. automodule:: aiogram.types.transaction_partner + :members: + :member-order: bysource + :undoc-members: True + :exclude-members: model_config,model_fields diff --git a/docs/api/types/transaction_partner_fragment.rst b/docs/api/types/transaction_partner_fragment.rst new file mode 100644 index 00000000..3516bdd7 --- /dev/null +++ b/docs/api/types/transaction_partner_fragment.rst @@ -0,0 +1,10 @@ +########################## +TransactionPartnerFragment +########################## + + +.. automodule:: aiogram.types.transaction_partner_fragment + :members: + :member-order: bysource + :undoc-members: True + :exclude-members: model_config,model_fields diff --git a/docs/api/types/transaction_partner_other.rst b/docs/api/types/transaction_partner_other.rst new file mode 100644 index 00000000..0cdf3d9e --- /dev/null +++ b/docs/api/types/transaction_partner_other.rst @@ -0,0 +1,10 @@ +####################### +TransactionPartnerOther +####################### + + +.. automodule:: aiogram.types.transaction_partner_other + :members: + :member-order: bysource + :undoc-members: True + :exclude-members: model_config,model_fields diff --git a/docs/api/types/transaction_partner_user.rst b/docs/api/types/transaction_partner_user.rst new file mode 100644 index 00000000..7016653b --- /dev/null +++ b/docs/api/types/transaction_partner_user.rst @@ -0,0 +1,10 @@ +###################### +TransactionPartnerUser +###################### + + +.. automodule:: aiogram.types.transaction_partner_user + :members: + :member-order: bysource + :undoc-members: True + :exclude-members: model_config,model_fields diff --git a/examples/stars_invoice.py b/examples/stars_invoice.py new file mode 100644 index 00000000..917c491a --- /dev/null +++ b/examples/stars_invoice.py @@ -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()) diff --git a/tests/test_api/test_methods/test_get_star_transactions.py b/tests/test_api/test_methods/test_get_star_transactions.py new file mode 100644 index 00000000..5ced0fc6 --- /dev/null +++ b/tests/test_api/test_methods/test_get_star_transactions.py @@ -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