diff --git a/.butcher/methods/sendPaidMedia/entity.json b/.butcher/methods/sendPaidMedia/entity.json
index 1588fd5c..9e6621e0 100644
--- a/.butcher/methods/sendPaidMedia/entity.json
+++ b/.butcher/methods/sendPaidMedia/entity.json
@@ -30,9 +30,9 @@
{
"type": "Integer",
"required": true,
- "description": "The number of Telegram Stars that must be paid to buy access to the media",
- "html_description": "
The number of Telegram Stars that must be paid to buy access to the media | ",
- "rst_description": "The number of Telegram Stars that must be paid to buy access to the media\n",
+ "description": "The number of Telegram Stars that must be paid to buy access to the media; 1-2500",
+ "html_description": "The number of Telegram Stars that must be paid to buy access to the media; 1-2500 | ",
+ "rst_description": "The number of Telegram Stars that must be paid to buy access to the media; 1-2500\n",
"name": "star_count"
},
{
@@ -43,6 +43,14 @@
"rst_description": "A JSON-serialized array describing the media to be sent; up to 10 items\n",
"name": "media"
},
+ {
+ "type": "String",
+ "required": false,
+ "description": "Bot-defined paid media payload, 0-128 bytes. This will not be displayed to the user, use it for your internal processes.",
+ "html_description": "Bot-defined paid media payload, 0-128 bytes. This will not be displayed to the user, use it for your internal processes. | ",
+ "rst_description": "Bot-defined paid media payload, 0-128 bytes. This will not be displayed to the user, use it for your internal processes.\n",
+ "name": "payload"
+ },
{
"type": "String",
"required": false,
diff --git a/.butcher/schema/schema.json b/.butcher/schema/schema.json
index 0bbd1b0a..c4882dd0 100644
--- a/.butcher/schema/schema.json
+++ b/.butcher/schema/schema.json
@@ -1,7 +1,7 @@
{
"api": {
- "version": "7.9",
- "release_date": "2024-08-14"
+ "version": "7.10",
+ "release_date": "2024-09-06"
},
"items": [
{
@@ -143,6 +143,14 @@
"name": "pre_checkout_query",
"required": false
},
+ {
+ "type": "PaidMediaPurchased",
+ "description": "A user purchased paid media with a non-empty payload sent by the bot in a non-channel chat",
+ "html_description": "Optional. A user purchased paid media with a non-empty payload sent by the bot in a non-channel chat | ",
+ "rst_description": "*Optional*. A user purchased paid media with a non-empty payload sent by the bot in a non-channel chat\n",
+ "name": "purchased_paid_media",
+ "required": false
+ },
{
"type": "Poll",
"description": "New poll state. Bots receive only updates about manually stopped polls and polls, which are sent by the bot",
@@ -4029,10 +4037,19 @@
{
"anchor": "giveawaycreated",
"name": "GiveawayCreated",
- "description": "This object represents a service message about the creation of a scheduled giveaway. Currently holds no information.",
- "html_description": "This object represents a service message about the creation of a scheduled giveaway. Currently holds no information.
",
- "rst_description": "This object represents a service message about the creation of a scheduled giveaway. Currently holds no information.",
- "annotations": [],
+ "description": "This object represents a service message about the creation of a scheduled giveaway.",
+ "html_description": "This object represents a service message about the creation of a scheduled giveaway.
",
+ "rst_description": "This object represents a service message about the creation of a scheduled giveaway.",
+ "annotations": [
+ {
+ "type": "Integer",
+ "description": "The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only",
+ "html_description": "Optional. The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only | ",
+ "rst_description": "*Optional*. The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only\n",
+ "name": "prize_star_count",
+ "required": false
+ }
+ ],
"category": "types"
},
{
@@ -4100,9 +4117,17 @@
},
{
"type": "Integer",
- "description": "The number of months the Telegram Premium subscription won from the giveaway will be active for",
- "html_description": "Optional. The number of months the Telegram Premium subscription won from the giveaway will be active for | ",
- "rst_description": "*Optional*. The number of months the Telegram Premium subscription won from the giveaway will be active for\n",
+ "description": "The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only",
+ "html_description": "Optional. The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only | ",
+ "rst_description": "*Optional*. The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only\n",
+ "name": "prize_star_count",
+ "required": false
+ },
+ {
+ "type": "Integer",
+ "description": "The number of months the Telegram Premium subscription won from the giveaway will be active for; for Telegram Premium giveaways only",
+ "html_description": "Optional. The number of months the Telegram Premium subscription won from the giveaway will be active for; for Telegram Premium giveaways only | ",
+ "rst_description": "*Optional*. The number of months the Telegram Premium subscription won from the giveaway will be active for; for Telegram Premium giveaways only\n",
"name": "premium_subscription_month_count",
"required": false
}
@@ -4166,9 +4191,17 @@
},
{
"type": "Integer",
- "description": "The number of months the Telegram Premium subscription won from the giveaway will be active for",
- "html_description": "Optional. The number of months the Telegram Premium subscription won from the giveaway will be active for | ",
- "rst_description": "*Optional*. The number of months the Telegram Premium subscription won from the giveaway will be active for\n",
+ "description": "The number of Telegram Stars that were split between giveaway winners; for Telegram Star giveaways only",
+ "html_description": "Optional. The number of Telegram Stars that were split between giveaway winners; for Telegram Star giveaways only | ",
+ "rst_description": "*Optional*. The number of Telegram Stars that were split between giveaway winners; for Telegram Star giveaways only\n",
+ "name": "prize_star_count",
+ "required": false
+ },
+ {
+ "type": "Integer",
+ "description": "The number of months the Telegram Premium subscription won from the giveaway will be active for; for Telegram Premium giveaways only",
+ "html_description": "Optional. The number of months the Telegram Premium subscription won from the giveaway will be active for; for Telegram Premium giveaways only | ",
+ "rst_description": "*Optional*. The number of months the Telegram Premium subscription won from the giveaway will be active for; for Telegram Premium giveaways only\n",
"name": "premium_subscription_month_count",
"required": false
},
@@ -4237,6 +4270,14 @@
"rst_description": "*Optional*. Message with the giveaway that was completed, if it wasn't deleted\n",
"name": "giveaway_message",
"required": false
+ },
+ {
+ "type": "True",
+ "description": "True, if the giveaway is a Telegram Star giveaway. Otherwise, currently, the giveaway is a Telegram Premium giveaway.",
+ "html_description": "Optional. True, if the giveaway is a Telegram Star giveaway. Otherwise, currently, the giveaway is a Telegram Premium giveaway. | ",
+ "rst_description": "*Optional*. :code:`True`, if the giveaway is a Telegram Star giveaway. Otherwise, currently, the giveaway is a Telegram Premium giveaway.\n",
+ "name": "is_star_giveaway",
+ "required": false
}
],
"category": "types"
@@ -6811,9 +6852,9 @@
{
"anchor": "chatboostsourcegiveaway",
"name": "ChatBoostSourceGiveaway",
- "description": "The boost was obtained by the creation of a Telegram Premium giveaway. This boosts the chat 4 times for the duration of the corresponding Telegram Premium subscription.",
- "html_description": "The boost was obtained by the creation of a Telegram Premium giveaway. This boosts the chat 4 times for the duration of the corresponding Telegram Premium subscription.
",
- "rst_description": "The boost was obtained by the creation of a Telegram Premium giveaway. This boosts the chat 4 times for the duration of the corresponding Telegram Premium subscription.",
+ "description": "The boost was obtained by the creation of a Telegram Premium or a Telegram Star giveaway. This boosts the chat 4 times for the duration of the corresponding Telegram Premium subscription for Telegram Premium giveaways and prize_star_count / 500 times for one year for Telegram Star giveaways.",
+ "html_description": "The boost was obtained by the creation of a Telegram Premium or a Telegram Star giveaway. This boosts the chat 4 times for the duration of the corresponding Telegram Premium subscription for Telegram Premium giveaways and prize_star_count / 500 times for one year for Telegram Star giveaways.
",
+ "rst_description": "The boost was obtained by the creation of a Telegram Premium or a Telegram Star giveaway. This boosts the chat 4 times for the duration of the corresponding Telegram Premium subscription for Telegram Premium giveaways and *prize_star_count* / 500 times for one year for Telegram Star giveaways.",
"annotations": [
{
"type": "String",
@@ -6833,12 +6874,20 @@
},
{
"type": "User",
- "description": "User that won the prize in the giveaway if any",
- "html_description": "Optional. User that won the prize in the giveaway if any | ",
- "rst_description": "*Optional*. User that won the prize in the giveaway if any\n",
+ "description": "User that won the prize in the giveaway if any; for Telegram Premium giveaways only",
+ "html_description": "Optional. User that won the prize in the giveaway if any; for Telegram Premium giveaways only | ",
+ "rst_description": "*Optional*. User that won the prize in the giveaway if any; for Telegram Premium giveaways only\n",
"name": "user",
"required": false
},
+ {
+ "type": "Integer",
+ "description": "The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only",
+ "html_description": "Optional. The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only | ",
+ "rst_description": "*Optional*. The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only\n",
+ "name": "prize_star_count",
+ "required": false
+ },
{
"type": "True",
"description": "True, if the giveaway was completed, but there was no user to win the prize",
@@ -9005,9 +9054,9 @@
{
"type": "Integer",
"required": true,
- "description": "The number of Telegram Stars that must be paid to buy access to the media",
- "html_description": "The number of Telegram Stars that must be paid to buy access to the media | ",
- "rst_description": "The number of Telegram Stars that must be paid to buy access to the media\n",
+ "description": "The number of Telegram Stars that must be paid to buy access to the media; 1-2500",
+ "html_description": "The number of Telegram Stars that must be paid to buy access to the media; 1-2500 | ",
+ "rst_description": "The number of Telegram Stars that must be paid to buy access to the media; 1-2500\n",
"name": "star_count"
},
{
@@ -9018,6 +9067,14 @@
"rst_description": "A JSON-serialized array describing the media to be sent; up to 10 items\n",
"name": "media"
},
+ {
+ "type": "String",
+ "required": false,
+ "description": "Bot-defined paid media payload, 0-128 bytes. This will not be displayed to the user, use it for your internal processes.",
+ "html_description": "Bot-defined paid media payload, 0-128 bytes. This will not be displayed to the user, use it for your internal processes. | ",
+ "rst_description": "Bot-defined paid media payload, 0-128 bytes. This will not be displayed to the user, use it for your internal processes.\n",
+ "name": "payload"
+ },
{
"type": "String",
"required": false,
@@ -16594,6 +16651,32 @@
],
"category": "types"
},
+ {
+ "anchor": "paidmediapurchased",
+ "name": "PaidMediaPurchased",
+ "description": "This object contains information about a paid media purchase.",
+ "html_description": "This object contains information about a paid media purchase.
",
+ "rst_description": "This object contains information about a paid media purchase.",
+ "annotations": [
+ {
+ "type": "User",
+ "description": "User who purchased the media",
+ "html_description": "User who purchased the media | ",
+ "rst_description": "User who purchased the media\n",
+ "name": "from",
+ "required": true
+ },
+ {
+ "type": "String",
+ "description": "Bot-specified paid media payload",
+ "html_description": "Bot-specified paid media payload | ",
+ "rst_description": "Bot-specified paid media payload\n",
+ "name": "paid_media_payload",
+ "required": true
+ }
+ ],
+ "category": "types"
+ },
{
"anchor": "revenuewithdrawalstate",
"name": "RevenueWithdrawalState",
@@ -16720,6 +16803,14 @@
"rst_description": "*Optional*. Information about the paid media bought by the user\n",
"name": "paid_media",
"required": false
+ },
+ {
+ "type": "String",
+ "description": "Bot-specified paid media payload",
+ "html_description": "Optional. Bot-specified paid media payload | ",
+ "rst_description": "*Optional*. Bot-specified paid media payload\n",
+ "name": "paid_media_payload",
+ "required": false
}
],
"category": "types"
diff --git a/.butcher/types/ChatBoostSourceGiveaway/entity.json b/.butcher/types/ChatBoostSourceGiveaway/entity.json
index f01133f3..a530eaf0 100644
--- a/.butcher/types/ChatBoostSourceGiveaway/entity.json
+++ b/.butcher/types/ChatBoostSourceGiveaway/entity.json
@@ -7,9 +7,9 @@
"object": {
"anchor": "chatboostsourcegiveaway",
"name": "ChatBoostSourceGiveaway",
- "description": "The boost was obtained by the creation of a Telegram Premium giveaway. This boosts the chat 4 times for the duration of the corresponding Telegram Premium subscription.",
- "html_description": "The boost was obtained by the creation of a Telegram Premium giveaway. This boosts the chat 4 times for the duration of the corresponding Telegram Premium subscription.
",
- "rst_description": "The boost was obtained by the creation of a Telegram Premium giveaway. This boosts the chat 4 times for the duration of the corresponding Telegram Premium subscription.",
+ "description": "The boost was obtained by the creation of a Telegram Premium or a Telegram Star giveaway. This boosts the chat 4 times for the duration of the corresponding Telegram Premium subscription for Telegram Premium giveaways and prize_star_count / 500 times for one year for Telegram Star giveaways.",
+ "html_description": "The boost was obtained by the creation of a Telegram Premium or a Telegram Star giveaway. This boosts the chat 4 times for the duration of the corresponding Telegram Premium subscription for Telegram Premium giveaways and prize_star_count / 500 times for one year for Telegram Star giveaways.
",
+ "rst_description": "The boost was obtained by the creation of a Telegram Premium or a Telegram Star giveaway. This boosts the chat 4 times for the duration of the corresponding Telegram Premium subscription for Telegram Premium giveaways and *prize_star_count* / 500 times for one year for Telegram Star giveaways.",
"annotations": [
{
"type": "String",
@@ -29,12 +29,20 @@
},
{
"type": "User",
- "description": "User that won the prize in the giveaway if any",
- "html_description": "Optional. User that won the prize in the giveaway if any | ",
- "rst_description": "*Optional*. User that won the prize in the giveaway if any\n",
+ "description": "User that won the prize in the giveaway if any; for Telegram Premium giveaways only",
+ "html_description": "Optional. User that won the prize in the giveaway if any; for Telegram Premium giveaways only | ",
+ "rst_description": "*Optional*. User that won the prize in the giveaway if any; for Telegram Premium giveaways only\n",
"name": "user",
"required": false
},
+ {
+ "type": "Integer",
+ "description": "The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only",
+ "html_description": "Optional. The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only | ",
+ "rst_description": "*Optional*. The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only\n",
+ "name": "prize_star_count",
+ "required": false
+ },
{
"type": "True",
"description": "True, if the giveaway was completed, but there was no user to win the prize",
diff --git a/.butcher/types/Giveaway/entity.json b/.butcher/types/Giveaway/entity.json
index 53178a8c..ad326982 100644
--- a/.butcher/types/Giveaway/entity.json
+++ b/.butcher/types/Giveaway/entity.json
@@ -69,9 +69,17 @@
},
{
"type": "Integer",
- "description": "The number of months the Telegram Premium subscription won from the giveaway will be active for",
- "html_description": "Optional. The number of months the Telegram Premium subscription won from the giveaway will be active for | ",
- "rst_description": "*Optional*. The number of months the Telegram Premium subscription won from the giveaway will be active for\n",
+ "description": "The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only",
+ "html_description": "Optional. The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only | ",
+ "rst_description": "*Optional*. The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only\n",
+ "name": "prize_star_count",
+ "required": false
+ },
+ {
+ "type": "Integer",
+ "description": "The number of months the Telegram Premium subscription won from the giveaway will be active for; for Telegram Premium giveaways only",
+ "html_description": "Optional. The number of months the Telegram Premium subscription won from the giveaway will be active for; for Telegram Premium giveaways only | ",
+ "rst_description": "*Optional*. The number of months the Telegram Premium subscription won from the giveaway will be active for; for Telegram Premium giveaways only\n",
"name": "premium_subscription_month_count",
"required": false
}
diff --git a/.butcher/types/GiveawayCompleted/entity.json b/.butcher/types/GiveawayCompleted/entity.json
index 169d3446..e1ecec54 100644
--- a/.butcher/types/GiveawayCompleted/entity.json
+++ b/.butcher/types/GiveawayCompleted/entity.json
@@ -34,6 +34,14 @@
"rst_description": "*Optional*. Message with the giveaway that was completed, if it wasn't deleted\n",
"name": "giveaway_message",
"required": false
+ },
+ {
+ "type": "True",
+ "description": "True, if the giveaway is a Telegram Star giveaway. Otherwise, currently, the giveaway is a Telegram Premium giveaway.",
+ "html_description": "Optional. True, if the giveaway is a Telegram Star giveaway. Otherwise, currently, the giveaway is a Telegram Premium giveaway. | ",
+ "rst_description": "*Optional*. :code:`True`, if the giveaway is a Telegram Star giveaway. Otherwise, currently, the giveaway is a Telegram Premium giveaway.\n",
+ "name": "is_star_giveaway",
+ "required": false
}
],
"category": "types"
diff --git a/.butcher/types/GiveawayCreated/entity.json b/.butcher/types/GiveawayCreated/entity.json
index 38e68bf3..1cf7ca10 100644
--- a/.butcher/types/GiveawayCreated/entity.json
+++ b/.butcher/types/GiveawayCreated/entity.json
@@ -7,10 +7,19 @@
"object": {
"anchor": "giveawaycreated",
"name": "GiveawayCreated",
- "description": "This object represents a service message about the creation of a scheduled giveaway. Currently holds no information.",
- "html_description": "This object represents a service message about the creation of a scheduled giveaway. Currently holds no information.
",
- "rst_description": "This object represents a service message about the creation of a scheduled giveaway. Currently holds no information.",
- "annotations": [],
+ "description": "This object represents a service message about the creation of a scheduled giveaway.",
+ "html_description": "This object represents a service message about the creation of a scheduled giveaway.
",
+ "rst_description": "This object represents a service message about the creation of a scheduled giveaway.",
+ "annotations": [
+ {
+ "type": "Integer",
+ "description": "The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only",
+ "html_description": "Optional. The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only | ",
+ "rst_description": "*Optional*. The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only\n",
+ "name": "prize_star_count",
+ "required": false
+ }
+ ],
"category": "types"
}
}
diff --git a/.butcher/types/GiveawayWinners/entity.json b/.butcher/types/GiveawayWinners/entity.json
index 76628b90..6843f7a7 100644
--- a/.butcher/types/GiveawayWinners/entity.json
+++ b/.butcher/types/GiveawayWinners/entity.json
@@ -61,9 +61,17 @@
},
{
"type": "Integer",
- "description": "The number of months the Telegram Premium subscription won from the giveaway will be active for",
- "html_description": "Optional. The number of months the Telegram Premium subscription won from the giveaway will be active for | ",
- "rst_description": "*Optional*. The number of months the Telegram Premium subscription won from the giveaway will be active for\n",
+ "description": "The number of Telegram Stars that were split between giveaway winners; for Telegram Star giveaways only",
+ "html_description": "Optional. The number of Telegram Stars that were split between giveaway winners; for Telegram Star giveaways only | ",
+ "rst_description": "*Optional*. The number of Telegram Stars that were split between giveaway winners; for Telegram Star giveaways only\n",
+ "name": "prize_star_count",
+ "required": false
+ },
+ {
+ "type": "Integer",
+ "description": "The number of months the Telegram Premium subscription won from the giveaway will be active for; for Telegram Premium giveaways only",
+ "html_description": "Optional. The number of months the Telegram Premium subscription won from the giveaway will be active for; for Telegram Premium giveaways only | ",
+ "rst_description": "*Optional*. The number of months the Telegram Premium subscription won from the giveaway will be active for; for Telegram Premium giveaways only\n",
"name": "premium_subscription_month_count",
"required": false
},
diff --git a/.butcher/types/PaidMediaPurchased/entity.json b/.butcher/types/PaidMediaPurchased/entity.json
new file mode 100644
index 00000000..0823946e
--- /dev/null
+++ b/.butcher/types/PaidMediaPurchased/entity.json
@@ -0,0 +1,33 @@
+{
+ "meta": {},
+ "group": {
+ "title": "Payments",
+ "anchor": "payments"
+ },
+ "object": {
+ "anchor": "paidmediapurchased",
+ "name": "PaidMediaPurchased",
+ "description": "This object contains information about a paid media purchase.",
+ "html_description": "This object contains information about a paid media purchase.
",
+ "rst_description": "This object contains information about a paid media purchase.",
+ "annotations": [
+ {
+ "type": "User",
+ "description": "User who purchased the media",
+ "html_description": "User who purchased the media | ",
+ "rst_description": "User who purchased the media\n",
+ "name": "from",
+ "required": true
+ },
+ {
+ "type": "String",
+ "description": "Bot-specified paid media payload",
+ "html_description": "Bot-specified paid media payload | ",
+ "rst_description": "Bot-specified paid media payload\n",
+ "name": "paid_media_payload",
+ "required": true
+ }
+ ],
+ "category": "types"
+ }
+}
diff --git a/.butcher/types/TransactionPartnerUser/entity.json b/.butcher/types/TransactionPartnerUser/entity.json
index 45ac0d68..ee2e06ce 100644
--- a/.butcher/types/TransactionPartnerUser/entity.json
+++ b/.butcher/types/TransactionPartnerUser/entity.json
@@ -42,6 +42,14 @@
"rst_description": "*Optional*. Information about the paid media bought by the user\n",
"name": "paid_media",
"required": false
+ },
+ {
+ "type": "String",
+ "description": "Bot-specified paid media payload",
+ "html_description": "Optional. Bot-specified paid media payload | ",
+ "rst_description": "*Optional*. Bot-specified paid media payload\n",
+ "name": "paid_media_payload",
+ "required": false
}
],
"category": "types"
diff --git a/.butcher/types/Update/entity.json b/.butcher/types/Update/entity.json
index ce43e9f9..256b073b 100644
--- a/.butcher/types/Update/entity.json
+++ b/.butcher/types/Update/entity.json
@@ -139,6 +139,14 @@
"name": "pre_checkout_query",
"required": false
},
+ {
+ "type": "PaidMediaPurchased",
+ "description": "A user purchased paid media with a non-empty payload sent by the bot in a non-channel chat",
+ "html_description": "Optional. A user purchased paid media with a non-empty payload sent by the bot in a non-channel chat | ",
+ "rst_description": "*Optional*. A user purchased paid media with a non-empty payload sent by the bot in a non-channel chat\n",
+ "name": "purchased_paid_media",
+ "required": false
+ },
{
"type": "Poll",
"description": "New poll state. Bots receive only updates about manually stopped polls and polls, which are sent by the bot",
diff --git a/aiogram/client/bot.py b/aiogram/client/bot.py
index 498fe3c9..ef885788 100644
--- a/aiogram/client/bot.py
+++ b/aiogram/client/bot.py
@@ -4658,6 +4658,7 @@ class Bot:
star_count: int,
media: List[Union[InputPaidMediaPhoto, InputPaidMediaVideo]],
business_connection_id: Optional[str] = None,
+ payload: Optional[str] = None,
caption: Optional[str] = None,
parse_mode: Optional[str] = None,
caption_entities: Optional[List[MessageEntity]] = None,
@@ -4676,9 +4677,10 @@ class Bot:
Source: https://core.telegram.org/bots/api#sendpaidmedia
:param chat_id: Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`). If the chat is a channel, all Telegram Star proceeds from this media will be credited to the chat's balance. Otherwise, they will be credited to the bot's balance.
- :param star_count: The number of Telegram Stars that must be paid to buy access to the media
+ :param star_count: The number of Telegram Stars that must be paid to buy access to the media; 1-2500
:param media: A JSON-serialized array describing the media to be sent; up to 10 items
:param business_connection_id: Unique identifier of the business connection on behalf of which the message will be sent
+ :param payload: Bot-defined paid media payload, 0-128 bytes. This will not be displayed to the user, use it for your internal processes.
:param caption: Media caption, 0-1024 characters after entities parsing
:param parse_mode: Mode for parsing entities in the media caption. See `formatting options `_ for more details.
:param caption_entities: A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*
@@ -4696,6 +4698,7 @@ class Bot:
star_count=star_count,
media=media,
business_connection_id=business_connection_id,
+ payload=payload,
caption=caption,
parse_mode=parse_mode,
caption_entities=caption_entities,
diff --git a/aiogram/dispatcher/router.py b/aiogram/dispatcher/router.py
index 400c1c09..da6d7099 100644
--- a/aiogram/dispatcher/router.py
+++ b/aiogram/dispatcher/router.py
@@ -70,6 +70,9 @@ class Router:
router=self, event_name="edited_business_message"
)
self.business_message = TelegramEventObserver(router=self, event_name="business_message")
+ self.purchased_paid_media = TelegramEventObserver(
+ router=self, event_name="purchased_paid_media"
+ )
self.errors = self.error = TelegramEventObserver(router=self, event_name="error")
diff --git a/aiogram/enums/update_type.py b/aiogram/enums/update_type.py
index 16fe0e2c..2629264d 100644
--- a/aiogram/enums/update_type.py
+++ b/aiogram/enums/update_type.py
@@ -23,6 +23,7 @@ class UpdateType(str, Enum):
CALLBACK_QUERY = "callback_query"
SHIPPING_QUERY = "shipping_query"
PRE_CHECKOUT_QUERY = "pre_checkout_query"
+ PURCHASED_PAID_MEDIA = "purchased_paid_media"
POLL = "poll"
POLL_ANSWER = "poll_answer"
MY_CHAT_MEMBER = "my_chat_member"
diff --git a/aiogram/methods/send_paid_media.py b/aiogram/methods/send_paid_media.py
index dd847f5a..eba103bb 100644
--- a/aiogram/methods/send_paid_media.py
+++ b/aiogram/methods/send_paid_media.py
@@ -29,11 +29,13 @@ class SendPaidMedia(TelegramMethod[Message]):
chat_id: Union[int, str]
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`). If the chat is a channel, all Telegram Star proceeds from this media will be credited to the chat's balance. Otherwise, they will be credited to the bot's balance."""
star_count: int
- """The number of Telegram Stars that must be paid to buy access to the media"""
+ """The number of Telegram Stars that must be paid to buy access to the media; 1-2500"""
media: List[Union[InputPaidMediaPhoto, InputPaidMediaVideo]]
"""A JSON-serialized array describing the media to be sent; up to 10 items"""
business_connection_id: Optional[str] = None
"""Unique identifier of the business connection on behalf of which the message will be sent"""
+ payload: Optional[str] = None
+ """Bot-defined paid media payload, 0-128 bytes. This will not be displayed to the user, use it for your internal processes."""
caption: Optional[str] = None
"""Media caption, 0-1024 characters after entities parsing"""
parse_mode: Optional[str] = None
@@ -64,6 +66,7 @@ class SendPaidMedia(TelegramMethod[Message]):
star_count: int,
media: List[Union[InputPaidMediaPhoto, InputPaidMediaVideo]],
business_connection_id: Optional[str] = None,
+ payload: Optional[str] = None,
caption: Optional[str] = None,
parse_mode: Optional[str] = None,
caption_entities: Optional[List[MessageEntity]] = None,
@@ -85,6 +88,7 @@ class SendPaidMedia(TelegramMethod[Message]):
star_count=star_count,
media=media,
business_connection_id=business_connection_id,
+ payload=payload,
caption=caption,
parse_mode=parse_mode,
caption_entities=caption_entities,
diff --git a/aiogram/types/__init__.py b/aiogram/types/__init__.py
index 97442b35..52e52ff8 100644
--- a/aiogram/types/__init__.py
+++ b/aiogram/types/__init__.py
@@ -233,6 +233,7 @@ from .web_app_data import WebAppData
from .web_app_info import WebAppInfo
from .webhook_info import WebhookInfo
from .write_access_allowed import WriteAccessAllowed
+from .paid_media_purchased import PaidMediaPurchased
__all__ = (
"Animation",
@@ -397,6 +398,7 @@ __all__ = (
"PaidMediaInfo",
"PaidMediaPhoto",
"PaidMediaPreview",
+ "PaidMediaPurchased",
"PaidMediaVideo",
"PassportData",
"PassportElementError",
diff --git a/aiogram/types/chat_boost_source_giveaway.py b/aiogram/types/chat_boost_source_giveaway.py
index dbb81507..3e109ddc 100644
--- a/aiogram/types/chat_boost_source_giveaway.py
+++ b/aiogram/types/chat_boost_source_giveaway.py
@@ -11,7 +11,7 @@ if TYPE_CHECKING:
class ChatBoostSourceGiveaway(ChatBoostSource):
"""
- The boost was obtained by the creation of a Telegram Premium giveaway. This boosts the chat 4 times for the duration of the corresponding Telegram Premium subscription.
+ The boost was obtained by the creation of a Telegram Premium or a Telegram Star giveaway. This boosts the chat 4 times for the duration of the corresponding Telegram Premium subscription for Telegram Premium giveaways and *prize_star_count* / 500 times for one year for Telegram Star giveaways.
Source: https://core.telegram.org/bots/api#chatboostsourcegiveaway
"""
@@ -21,7 +21,9 @@ class ChatBoostSourceGiveaway(ChatBoostSource):
giveaway_message_id: int
"""Identifier of a message in the chat with the giveaway; the message could have been deleted already. May be 0 if the message isn't sent yet."""
user: Optional[User] = None
- """*Optional*. User that won the prize in the giveaway if any"""
+ """*Optional*. User that won the prize in the giveaway if any; for Telegram Premium giveaways only"""
+ prize_star_count: Optional[int] = None
+ """*Optional*. The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only"""
is_unclaimed: Optional[bool] = None
"""*Optional*. True, if the giveaway was completed, but there was no user to win the prize"""
@@ -35,6 +37,7 @@ class ChatBoostSourceGiveaway(ChatBoostSource):
source: Literal[ChatBoostSourceType.GIVEAWAY] = ChatBoostSourceType.GIVEAWAY,
giveaway_message_id: int,
user: Optional[User] = None,
+ prize_star_count: Optional[int] = None,
is_unclaimed: Optional[bool] = None,
**__pydantic_kwargs: Any,
) -> None:
@@ -46,6 +49,7 @@ class ChatBoostSourceGiveaway(ChatBoostSource):
source=source,
giveaway_message_id=giveaway_message_id,
user=user,
+ prize_star_count=prize_star_count,
is_unclaimed=is_unclaimed,
**__pydantic_kwargs,
)
diff --git a/aiogram/types/giveaway.py b/aiogram/types/giveaway.py
index 1fa4f508..e80513e7 100644
--- a/aiogram/types/giveaway.py
+++ b/aiogram/types/giveaway.py
@@ -30,8 +30,10 @@ class Giveaway(TelegramObject):
"""*Optional*. Description of additional giveaway prize"""
country_codes: Optional[List[str]] = None
"""*Optional*. A list of two-letter `ISO 3166-1 alpha-2 `_ country codes indicating the countries from which eligible users for the giveaway must come. If empty, then all users can participate in the giveaway. Users with a phone number that was bought on Fragment can always participate in giveaways."""
+ prize_star_count: Optional[int] = None
+ """*Optional*. The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only"""
premium_subscription_month_count: Optional[int] = None
- """*Optional*. The number of months the Telegram Premium subscription won from the giveaway will be active for"""
+ """*Optional*. The number of months the Telegram Premium subscription won from the giveaway will be active for; for Telegram Premium giveaways only"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
@@ -47,6 +49,7 @@ class Giveaway(TelegramObject):
has_public_winners: Optional[bool] = None,
prize_description: Optional[str] = None,
country_codes: Optional[List[str]] = None,
+ prize_star_count: Optional[int] = None,
premium_subscription_month_count: Optional[int] = None,
**__pydantic_kwargs: Any,
) -> None:
@@ -62,6 +65,7 @@ class Giveaway(TelegramObject):
has_public_winners=has_public_winners,
prize_description=prize_description,
country_codes=country_codes,
+ prize_star_count=prize_star_count,
premium_subscription_month_count=premium_subscription_month_count,
**__pydantic_kwargs,
)
diff --git a/aiogram/types/giveaway_completed.py b/aiogram/types/giveaway_completed.py
index 71d525af..54a371c4 100644
--- a/aiogram/types/giveaway_completed.py
+++ b/aiogram/types/giveaway_completed.py
@@ -21,6 +21,8 @@ class GiveawayCompleted(TelegramObject):
"""*Optional*. Number of undistributed prizes"""
giveaway_message: Optional[Message] = None
"""*Optional*. Message with the giveaway that was completed, if it wasn't deleted"""
+ is_star_giveaway: Optional[bool] = None
+ """*Optional*. :code:`True`, if the giveaway is a Telegram Star giveaway. Otherwise, currently, the giveaway is a Telegram Premium giveaway."""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
@@ -32,6 +34,7 @@ class GiveawayCompleted(TelegramObject):
winner_count: int,
unclaimed_prize_count: Optional[int] = None,
giveaway_message: Optional[Message] = None,
+ is_star_giveaway: Optional[bool] = None,
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!
@@ -42,5 +45,6 @@ class GiveawayCompleted(TelegramObject):
winner_count=winner_count,
unclaimed_prize_count=unclaimed_prize_count,
giveaway_message=giveaway_message,
+ is_star_giveaway=is_star_giveaway,
**__pydantic_kwargs,
)
diff --git a/aiogram/types/giveaway_created.py b/aiogram/types/giveaway_created.py
index cd66d75a..78bb0f14 100644
--- a/aiogram/types/giveaway_created.py
+++ b/aiogram/types/giveaway_created.py
@@ -1,9 +1,29 @@
+from __future__ import annotations
+
+from typing import TYPE_CHECKING, Any, Optional
+
from .base import TelegramObject
class GiveawayCreated(TelegramObject):
"""
- This object represents a service message about the creation of a scheduled giveaway. Currently holds no information.
+ This object represents a service message about the creation of a scheduled giveaway.
Source: https://core.telegram.org/bots/api#giveawaycreated
"""
+
+ prize_star_count: Optional[int] = None
+ """*Optional*. The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__, *, prize_star_count: 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__(prize_star_count=prize_star_count, **__pydantic_kwargs)
diff --git a/aiogram/types/giveaway_winners.py b/aiogram/types/giveaway_winners.py
index 8a501f88..5abcec8d 100644
--- a/aiogram/types/giveaway_winners.py
+++ b/aiogram/types/giveaway_winners.py
@@ -29,8 +29,10 @@ class GiveawayWinners(TelegramObject):
"""List of up to 100 winners of the giveaway"""
additional_chat_count: Optional[int] = None
"""*Optional*. The number of other chats the user had to join in order to be eligible for the giveaway"""
+ prize_star_count: Optional[int] = None
+ """*Optional*. The number of Telegram Stars that were split between giveaway winners; for Telegram Star giveaways only"""
premium_subscription_month_count: Optional[int] = None
- """*Optional*. The number of months the Telegram Premium subscription won from the giveaway will be active for"""
+ """*Optional*. The number of months the Telegram Premium subscription won from the giveaway will be active for; for Telegram Premium giveaways only"""
unclaimed_prize_count: Optional[int] = None
"""*Optional*. Number of undistributed prizes"""
only_new_members: Optional[bool] = None
@@ -53,6 +55,7 @@ class GiveawayWinners(TelegramObject):
winner_count: int,
winners: List[User],
additional_chat_count: Optional[int] = None,
+ prize_star_count: Optional[int] = None,
premium_subscription_month_count: Optional[int] = None,
unclaimed_prize_count: Optional[int] = None,
only_new_members: Optional[bool] = None,
@@ -71,6 +74,7 @@ class GiveawayWinners(TelegramObject):
winner_count=winner_count,
winners=winners,
additional_chat_count=additional_chat_count,
+ prize_star_count=prize_star_count,
premium_subscription_month_count=premium_subscription_month_count,
unclaimed_prize_count=unclaimed_prize_count,
only_new_members=only_new_members,
diff --git a/aiogram/types/message.py b/aiogram/types/message.py
index ed6180f2..2e6e5efb 100644
--- a/aiogram/types/message.py
+++ b/aiogram/types/message.py
@@ -4103,6 +4103,7 @@ class Message(MaybeInaccessibleMessage):
self,
star_count: int,
media: List[Union[InputPaidMediaPhoto, InputPaidMediaVideo]],
+ payload: Optional[str] = None,
caption: Optional[str] = None,
parse_mode: Optional[str] = None,
caption_entities: Optional[List[MessageEntity]] = None,
@@ -4127,8 +4128,9 @@ class Message(MaybeInaccessibleMessage):
Source: https://core.telegram.org/bots/api#sendpaidmedia
- :param star_count: The number of Telegram Stars that must be paid to buy access to the media
+ :param star_count: The number of Telegram Stars that must be paid to buy access to the media; 1-2500
:param media: A JSON-serialized array describing the media to be sent; up to 10 items
+ :param payload: Bot-defined paid media payload, 0-128 bytes. This will not be displayed to the user, use it for your internal processes.
:param caption: Media caption, 0-1024 characters after entities parsing
:param parse_mode: Mode for parsing entities in the media caption. See `formatting options `_ for more details.
:param caption_entities: A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*
@@ -4154,6 +4156,7 @@ class Message(MaybeInaccessibleMessage):
business_connection_id=self.business_connection_id,
star_count=star_count,
media=media,
+ payload=payload,
caption=caption,
parse_mode=parse_mode,
caption_entities=caption_entities,
@@ -4169,6 +4172,7 @@ class Message(MaybeInaccessibleMessage):
self,
star_count: int,
media: List[Union[InputPaidMediaPhoto, InputPaidMediaVideo]],
+ payload: Optional[str] = None,
caption: Optional[str] = None,
parse_mode: Optional[str] = None,
caption_entities: Optional[List[MessageEntity]] = None,
@@ -4193,8 +4197,9 @@ class Message(MaybeInaccessibleMessage):
Source: https://core.telegram.org/bots/api#sendpaidmedia
- :param star_count: The number of Telegram Stars that must be paid to buy access to the media
+ :param star_count: The number of Telegram Stars that must be paid to buy access to the media; 1-2500
:param media: A JSON-serialized array describing the media to be sent; up to 10 items
+ :param payload: Bot-defined paid media payload, 0-128 bytes. This will not be displayed to the user, use it for your internal processes.
:param caption: Media caption, 0-1024 characters after entities parsing
:param parse_mode: Mode for parsing entities in the media caption. See `formatting options `_ for more details.
:param caption_entities: A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*
@@ -4220,6 +4225,7 @@ class Message(MaybeInaccessibleMessage):
reply_parameters=self.as_reply_parameters(),
star_count=star_count,
media=media,
+ payload=payload,
caption=caption,
parse_mode=parse_mode,
caption_entities=caption_entities,
diff --git a/aiogram/types/paid_media_purchased.py b/aiogram/types/paid_media_purchased.py
new file mode 100644
index 00000000..c115adbd
--- /dev/null
+++ b/aiogram/types/paid_media_purchased.py
@@ -0,0 +1,42 @@
+from __future__ import annotations
+
+from typing import TYPE_CHECKING, Any
+
+from pydantic import Field
+
+from .base import TelegramObject
+
+if TYPE_CHECKING:
+ from .user import User
+
+
+class PaidMediaPurchased(TelegramObject):
+ """
+ This object contains information about a paid media purchase.
+
+ Source: https://core.telegram.org/bots/api#paidmediapurchased
+ """
+
+ from_user: User = Field(..., alias="from")
+ """User who purchased the media"""
+ paid_media_payload: str
+ """Bot-specified paid media payload"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ from_user: User,
+ paid_media_payload: 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__(
+ from_user=from_user, paid_media_payload=paid_media_payload, **__pydantic_kwargs
+ )
diff --git a/aiogram/types/transaction_partner_user.py b/aiogram/types/transaction_partner_user.py
index 260c9a12..92eb9cb0 100644
--- a/aiogram/types/transaction_partner_user.py
+++ b/aiogram/types/transaction_partner_user.py
@@ -27,6 +27,8 @@ class TransactionPartnerUser(TransactionPartner):
"""*Optional*. Bot-specified invoice payload"""
paid_media: Optional[List[Union[PaidMediaPreview, PaidMediaPhoto, PaidMediaVideo]]] = None
"""*Optional*. Information about the paid media bought by the user"""
+ paid_media_payload: Optional[str] = None
+ """*Optional*. Bot-specified paid media payload"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
@@ -41,6 +43,7 @@ class TransactionPartnerUser(TransactionPartner):
paid_media: Optional[
List[Union[PaidMediaPreview, PaidMediaPhoto, PaidMediaVideo]]
] = None,
+ paid_media_payload: Optional[str] = None,
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!
@@ -52,5 +55,6 @@ class TransactionPartnerUser(TransactionPartner):
user=user,
invoice_payload=invoice_payload,
paid_media=paid_media,
+ paid_media_payload=paid_media_payload,
**__pydantic_kwargs,
)
diff --git a/aiogram/types/update.py b/aiogram/types/update.py
index 0533996d..d3347da4 100644
--- a/aiogram/types/update.py
+++ b/aiogram/types/update.py
@@ -2,8 +2,8 @@ from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, cast
-from ..utils.mypy_hacks import lru_cache
from .base import TelegramObject
+from ..utils.mypy_hacks import lru_cache
if TYPE_CHECKING:
from .business_connection import BusinessConnection
@@ -22,6 +22,7 @@ if TYPE_CHECKING:
from .poll_answer import PollAnswer
from .pre_checkout_query import PreCheckoutQuery
from .shipping_query import ShippingQuery
+ from .paid_media_purchased import PaidMediaPurchased
class Update(TelegramObject):
@@ -65,6 +66,8 @@ class Update(TelegramObject):
"""*Optional*. New incoming shipping query. Only for invoices with flexible price"""
pre_checkout_query: Optional[PreCheckoutQuery] = None
"""*Optional*. New incoming pre-checkout query. Contains full information about checkout"""
+ purchased_paid_media: Optional[PaidMediaPurchased] = None
+ """*Optional*. A user purchased paid media with a non-empty payload sent by the bot in a non-channel chat"""
poll: Optional[Poll] = None
"""*Optional*. New poll state. Bots receive only updates about manually stopped polls and polls, which are sent by the bot"""
poll_answer: Optional[PollAnswer] = None
@@ -103,6 +106,7 @@ class Update(TelegramObject):
callback_query: Optional[CallbackQuery] = None,
shipping_query: Optional[ShippingQuery] = None,
pre_checkout_query: Optional[PreCheckoutQuery] = None,
+ purchased_paid_media: Optional[PaidMediaPurchased] = None,
poll: Optional[Poll] = None,
poll_answer: Optional[PollAnswer] = None,
my_chat_member: Optional[ChatMemberUpdated] = None,
@@ -133,6 +137,7 @@ class Update(TelegramObject):
callback_query=callback_query,
shipping_query=shipping_query,
pre_checkout_query=pre_checkout_query,
+ purchased_paid_media=purchased_paid_media,
poll=poll,
poll_answer=poll_answer,
my_chat_member=my_chat_member,
@@ -199,6 +204,8 @@ class Update(TelegramObject):
return "edited_business_message"
if self.business_message:
return "business_message"
+ if self.purchased_paid_media:
+ return "purchased_paid_media"
raise UpdateTypeLookupError("Update does not contain any known event type.")
diff --git a/docs/api/types/index.rst b/docs/api/types/index.rst
index 96204ad7..ae16f951 100644
--- a/docs/api/types/index.rst
+++ b/docs/api/types/index.rst
@@ -212,6 +212,34 @@ Stickers
sticker
sticker_set
+Payments
+========
+
+.. toctree::
+ :maxdepth: 1
+
+ invoice
+ labeled_price
+ order_info
+ paid_media_purchased
+ pre_checkout_query
+ refunded_payment
+ 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_telegram_ads
+ transaction_partner_user
+
Telegram Passport
=================
@@ -233,33 +261,6 @@ Telegram Passport
passport_element_error_unspecified
passport_file
-Payments
-========
-
-.. toctree::
- :maxdepth: 1
-
- invoice
- labeled_price
- order_info
- pre_checkout_query
- refunded_payment
- 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_telegram_ads
- transaction_partner_user
-
Getting updates
===============
diff --git a/docs/api/types/paid_media_purchased.rst b/docs/api/types/paid_media_purchased.rst
new file mode 100644
index 00000000..5af1f9e2
--- /dev/null
+++ b/docs/api/types/paid_media_purchased.rst
@@ -0,0 +1,10 @@
+##################
+PaidMediaPurchased
+##################
+
+
+.. automodule:: aiogram.types.paid_media_purchased
+ :members:
+ :member-order: bysource
+ :undoc-members: True
+ :exclude-members: model_config,model_fields
diff --git a/tests/test_api/test_types/test_message.py b/tests/test_api/test_types/test_message.py
index f6c1226b..0b53ce1d 100644
--- a/tests/test_api/test_types/test_message.py
+++ b/tests/test_api/test_types/test_message.py
@@ -527,7 +527,7 @@ TEST_MESSAGE_GIVEAWAY_CREATED = Message(
date=datetime.datetime.now(),
chat=Chat(id=42, type="private"),
from_user=None,
- giveaway_created=GiveawayCreated(),
+ giveaway_created=GiveawayCreated(prize_star_count=42),
)
TEST_MESSAGE_GIVEAWAY_WINNERS = Message(
message_id=42,