diff --git a/.apiversion b/.apiversion
index a95c9963..fbf1779b 100644
--- a/.apiversion
+++ b/.apiversion
@@ -1 +1 @@
-7.8
+7.9
diff --git a/.butcher/methods/createChatSubscriptionInviteLink/entity.json b/.butcher/methods/createChatSubscriptionInviteLink/entity.json
new file mode 100644
index 00000000..48872035
--- /dev/null
+++ b/.butcher/methods/createChatSubscriptionInviteLink/entity.json
@@ -0,0 +1,49 @@
+{
+ "meta": {},
+ "group": {
+ "title": "Available methods",
+ "anchor": "available-methods"
+ },
+ "object": {
+ "anchor": "createchatsubscriptioninvitelink",
+ "name": "createChatSubscriptionInviteLink",
+ "description": "Use this method to create a subscription invite link for a channel chat. The bot must have the can_invite_users administrator rights. The link can be edited using the method editChatSubscriptionInviteLink or revoked using the method revokeChatInviteLink. Returns the new invite link as a ChatInviteLink object.",
+ "html_description": "
`_ for a channel chat. The bot must have the *can_invite_users* administrator rights. The link can be edited using the method :class:`aiogram.methods.edit_chat_subscription_invite_link.EditChatSubscriptionInviteLink` or revoked using the method :class:`aiogram.methods.revoke_chat_invite_link.RevokeChatInviteLink`. Returns the new invite link as a :class:`aiogram.types.chat_invite_link.ChatInviteLink` object.",
+ "annotations": [
+ {
+ "type": "Integer or String",
+ "required": true,
+ "description": "Unique identifier for the target channel chat or username of the target channel (in the format @channelusername)",
+ "html_description": "Unique identifier for the target channel chat or username of the target channel (in the format @channelusername) | ",
+ "rst_description": "Unique identifier for the target channel chat or username of the target channel (in the format :code:`@channelusername`)\n",
+ "name": "chat_id"
+ },
+ {
+ "type": "String",
+ "required": false,
+ "description": "Invite link name; 0-32 characters",
+ "html_description": "Invite link name; 0-32 characters | ",
+ "rst_description": "Invite link name; 0-32 characters\n",
+ "name": "name"
+ },
+ {
+ "type": "Integer",
+ "required": true,
+ "description": "The number of seconds the subscription will be active for before the next payment. Currently, it must always be 2592000 (30 days).",
+ "html_description": "The number of seconds the subscription will be active for before the next payment. Currently, it must always be 2592000 (30 days). | ",
+ "rst_description": "The number of seconds the subscription will be active for before the next payment. Currently, it must always be 2592000 (30 days).\n",
+ "name": "subscription_period"
+ },
+ {
+ "type": "Integer",
+ "required": true,
+ "description": "The amount of Telegram Stars a user must pay initially and after each subsequent subscription period to be a member of the chat; 1-2500",
+ "html_description": "The amount of Telegram Stars a user must pay initially and after each subsequent subscription period to be a member of the chat; 1-2500 | ",
+ "rst_description": "The amount of Telegram Stars a user must pay initially and after each subsequent subscription period to be a member of the chat; 1-2500\n",
+ "name": "subscription_price"
+ }
+ ],
+ "category": "methods"
+ }
+}
diff --git a/.butcher/methods/createChatSubscriptionInviteLink/replace.yml b/.butcher/methods/createChatSubscriptionInviteLink/replace.yml
new file mode 100644
index 00000000..c9af8218
--- /dev/null
+++ b/.butcher/methods/createChatSubscriptionInviteLink/replace.yml
@@ -0,0 +1,11 @@
+annotations:
+ subscription_period:
+ parsed_type:
+ type: union
+ items:
+ - type: std
+ name: datetime.datetime
+ - type: std
+ name: datetime.timedelta
+ - type: std
+ name: int
diff --git a/.butcher/methods/editChatSubscriptionInviteLink/entity.json b/.butcher/methods/editChatSubscriptionInviteLink/entity.json
new file mode 100644
index 00000000..0e3747bc
--- /dev/null
+++ b/.butcher/methods/editChatSubscriptionInviteLink/entity.json
@@ -0,0 +1,41 @@
+{
+ "meta": {},
+ "group": {
+ "title": "Available methods",
+ "anchor": "available-methods"
+ },
+ "object": {
+ "anchor": "editchatsubscriptioninvitelink",
+ "name": "editChatSubscriptionInviteLink",
+ "description": "Use this method to edit a subscription invite link created by the bot. The bot must have the can_invite_users administrator rights. Returns the edited invite link as a ChatInviteLink object.",
+ "html_description": "Use this method to edit a subscription invite link created by the bot. The bot must have the can_invite_users administrator rights. Returns the edited invite link as a ChatInviteLink object.
",
+ "rst_description": "Use this method to edit a subscription invite link created by the bot. The bot must have the *can_invite_users* administrator rights. Returns the edited invite link as a :class:`aiogram.types.chat_invite_link.ChatInviteLink` object.",
+ "annotations": [
+ {
+ "type": "Integer or String",
+ "required": true,
+ "description": "Unique identifier for the target chat or username of the target channel (in the format @channelusername)",
+ "html_description": "Unique identifier for the target chat or username of the target channel (in the format @channelusername) | ",
+ "rst_description": "Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)\n",
+ "name": "chat_id"
+ },
+ {
+ "type": "String",
+ "required": true,
+ "description": "The invite link to edit",
+ "html_description": "The invite link to edit | ",
+ "rst_description": "The invite link to edit\n",
+ "name": "invite_link"
+ },
+ {
+ "type": "String",
+ "required": false,
+ "description": "Invite link name; 0-32 characters",
+ "html_description": "Invite link name; 0-32 characters | ",
+ "rst_description": "Invite link name; 0-32 characters\n",
+ "name": "name"
+ }
+ ],
+ "category": "methods"
+ }
+}
diff --git a/.butcher/methods/editForumTopic/entity.json b/.butcher/methods/editForumTopic/entity.json
index c76f2157..02261e1f 100644
--- a/.butcher/methods/editForumTopic/entity.json
+++ b/.butcher/methods/editForumTopic/entity.json
@@ -7,9 +7,9 @@
"object": {
"anchor": "editforumtopic",
"name": "editForumTopic",
- "description": "Use this method to edit name and icon of a topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have can_manage_topics administrator rights, unless it is the creator of the topic. Returns True on success.",
- "html_description": "Use this method to edit name and icon of a topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have can_manage_topics administrator rights, unless it is the creator of the topic. Returns True on success.
",
- "rst_description": "Use this method to edit name and icon of a topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have *can_manage_topics* administrator rights, unless it is the creator of the topic. Returns :code:`True` on success.",
+ "description": "Use this method to edit name and icon of a topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic. Returns True on success.",
+ "html_description": "Use this method to edit name and icon of a topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic. Returns True on success.
",
+ "rst_description": "Use this method to edit name and icon of a topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the *can_manage_topics* administrator rights, unless it is the creator of the topic. Returns :code:`True` on success.",
"annotations": [
{
"type": "Integer or String",
diff --git a/.butcher/methods/editGeneralForumTopic/entity.json b/.butcher/methods/editGeneralForumTopic/entity.json
index 6bc78e96..64065e3a 100644
--- a/.butcher/methods/editGeneralForumTopic/entity.json
+++ b/.butcher/methods/editGeneralForumTopic/entity.json
@@ -7,9 +7,9 @@
"object": {
"anchor": "editgeneralforumtopic",
"name": "editGeneralForumTopic",
- "description": "Use this method to edit the name of the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have can_manage_topics administrator rights. Returns True on success.",
- "html_description": "Use this method to edit the name of the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have can_manage_topics administrator rights. Returns True on success.
",
- "rst_description": "Use this method to edit the name of the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have *can_manage_topics* administrator rights. Returns :code:`True` on success.",
+ "description": "Use this method to edit the name of the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. Returns True on success.",
+ "html_description": "Use this method to edit the name of the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. Returns True on success.
",
+ "rst_description": "Use this method to edit the name of the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the *can_manage_topics* administrator rights. Returns :code:`True` on success.",
"annotations": [
{
"type": "Integer or String",
diff --git a/.butcher/methods/sendPaidMedia/entity.json b/.butcher/methods/sendPaidMedia/entity.json
index 4031c0ff..1588fd5c 100644
--- a/.butcher/methods/sendPaidMedia/entity.json
+++ b/.butcher/methods/sendPaidMedia/entity.json
@@ -7,16 +7,24 @@
"object": {
"anchor": "sendpaidmedia",
"name": "sendPaidMedia",
- "description": "Use this method to send paid media to channel chats. On success, the sent Message is returned.",
- "html_description": "Use this method to send paid media to channel chats. On success, the sent Message is returned.
",
- "rst_description": "Use this method to send paid media to channel chats. On success, the sent :class:`aiogram.types.message.Message` is returned.",
+ "description": "Use this method to send paid media. On success, the sent Message is returned.",
+ "html_description": "Use this method to send paid media. On success, the sent Message is returned.
",
+ "rst_description": "Use this method to send paid media. On success, the sent :class:`aiogram.types.message.Message` is returned.",
"annotations": [
+ {
+ "type": "String",
+ "required": false,
+ "description": "Unique identifier of the business connection on behalf of which the message will be sent",
+ "html_description": "Unique identifier of the business connection on behalf of which the message will be sent | ",
+ "rst_description": "Unique identifier of the business connection on behalf of which the message will be sent\n",
+ "name": "business_connection_id"
+ },
{
"type": "Integer or String",
"required": true,
- "description": "Unique identifier for the target chat or username of the target channel (in the format @channelusername)",
- "html_description": "Unique identifier for the target chat or username of the target channel (in the format @channelusername) | ",
- "rst_description": "Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)\n",
+ "description": "Unique identifier for the target chat or username of the target channel (in the format @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.",
+ "html_description": "Unique identifier for the target chat or username of the target channel (in the format @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. | ",
+ "rst_description": "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.\n",
"name": "chat_id"
},
{
diff --git a/.butcher/methods/setMessageReaction/entity.json b/.butcher/methods/setMessageReaction/entity.json
index e26f914c..b79269da 100644
--- a/.butcher/methods/setMessageReaction/entity.json
+++ b/.butcher/methods/setMessageReaction/entity.json
@@ -7,9 +7,9 @@
"object": {
"anchor": "setmessagereaction",
"name": "setMessageReaction",
- "description": "Use this method to change the chosen reactions on a message. Service messages can't be reacted to. Automatically forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel. Returns True on success.",
- "html_description": "Use this method to change the chosen reactions on a message. Service messages can't be reacted to. Automatically forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel. Returns True on success.
",
- "rst_description": "Use this method to change the chosen reactions on a message. Service messages can't be reacted to. Automatically forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel. Returns :code:`True` on success.",
+ "description": "Use this method to change the chosen reactions on a message. Service messages can't be reacted to. Automatically forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel. Bots can't use paid reactions. Returns True on success.",
+ "html_description": "Use this method to change the chosen reactions on a message. Service messages can't be reacted to. Automatically forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel. Bots can't use paid reactions. Returns True on success.
",
+ "rst_description": "Use this method to change the chosen reactions on a message. Service messages can't be reacted to. Automatically forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel. Bots can't use paid reactions. Returns :code:`True` on success.",
"annotations": [
{
"type": "Integer or String",
@@ -30,9 +30,9 @@
{
"type": "Array of ReactionType",
"required": false,
- "description": "A JSON-serialized list of reaction types to set on the message. Currently, as non-premium users, bots can set up to one reaction per message. A custom emoji reaction can be used if it is either already present on the message or explicitly allowed by chat administrators.",
- "html_description": "A JSON-serialized list of reaction types to set on the message. Currently, as non-premium users, bots can set up to one reaction per message. A custom emoji reaction can be used if it is either already present on the message or explicitly allowed by chat administrators. | ",
- "rst_description": "A JSON-serialized list of reaction types to set on the message. Currently, as non-premium users, bots can set up to one reaction per message. A custom emoji reaction can be used if it is either already present on the message or explicitly allowed by chat administrators.\n",
+ "description": "A JSON-serialized list of reaction types to set on the message. Currently, as non-premium users, bots can set up to one reaction per message. A custom emoji reaction can be used if it is either already present on the message or explicitly allowed by chat administrators. Paid reactions can't be used by bots.",
+ "html_description": "A JSON-serialized list of reaction types to set on the message. Currently, as non-premium users, bots can set up to one reaction per message. A custom emoji reaction can be used if it is either already present on the message or explicitly allowed by chat administrators. Paid reactions can't be used by bots. | ",
+ "rst_description": "A JSON-serialized list of reaction types to set on the message. Currently, as non-premium users, bots can set up to one reaction per message. A custom emoji reaction can be used if it is either already present on the message or explicitly allowed by chat administrators. Paid reactions can't be used by bots.\n",
"name": "reaction"
},
{
diff --git a/.butcher/schema/schema.json b/.butcher/schema/schema.json
index e076f99c..9d08a7eb 100644
--- a/.butcher/schema/schema.json
+++ b/.butcher/schema/schema.json
@@ -1,7 +1,7 @@
{
"api": {
- "version": "7.8",
- "release_date": "2024-07-31"
+ "version": "7.9",
+ "release_date": "2024-08-14"
},
"items": [
{
@@ -993,17 +993,17 @@
},
{
"type": "User",
- "description": "Sender of the message; empty for messages sent to channels. For backward compatibility, the field contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat.",
- "html_description": "Optional. Sender of the message; empty for messages sent to channels. For backward compatibility, the field contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat. | ",
- "rst_description": "*Optional*. Sender of the message; empty for messages sent to channels. For backward compatibility, the field contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat.\n",
+ "description": "Sender of the message; may be empty for messages sent to channels. For backward compatibility, if the message was sent on behalf of a chat, the field contains a fake sender user in non-channel chats",
+ "html_description": "Optional. Sender of the message; may be empty for messages sent to channels. For backward compatibility, if the message was sent on behalf of a chat, the field contains a fake sender user in non-channel chats | ",
+ "rst_description": "*Optional*. Sender of the message; may be empty for messages sent to channels. For backward compatibility, if the message was sent on behalf of a chat, the field contains a fake sender user in non-channel chats\n",
"name": "from",
"required": false
},
{
"type": "Chat",
- "description": "Sender of the message, sent on behalf of a chat. For example, the channel itself for channel posts, the supergroup itself for messages from anonymous group administrators, the linked channel for messages automatically forwarded to the discussion group. For backward compatibility, the field from contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat.",
- "html_description": "Optional. Sender of the message, sent on behalf of a chat. For example, the channel itself for channel posts, the supergroup itself for messages from anonymous group administrators, the linked channel for messages automatically forwarded to the discussion group. For backward compatibility, the field from contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat. | ",
- "rst_description": "*Optional*. Sender of the message, sent on behalf of a chat. For example, the channel itself for channel posts, the supergroup itself for messages from anonymous group administrators, the linked channel for messages automatically forwarded to the discussion group. For backward compatibility, the field *from* contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat.\n",
+ "description": "Sender of the message when sent on behalf of a chat. For example, the supergroup itself for messages sent by its anonymous administrators or a linked channel for messages automatically forwarded to the channel's discussion group. For backward compatibility, if the message was sent on behalf of a chat, the field from contains a fake sender user in non-channel chats.",
+ "html_description": "Optional. Sender of the message when sent on behalf of a chat. For example, the supergroup itself for messages sent by its anonymous administrators or a linked channel for messages automatically forwarded to the channel's discussion group. For backward compatibility, if the message was sent on behalf of a chat, the field from contains a fake sender user in non-channel chats. | ",
+ "rst_description": "*Optional*. Sender of the message when sent on behalf of a chat. For example, the supergroup itself for messages sent by its anonymous administrators or a linked channel for messages automatically forwarded to the channel's discussion group. For backward compatibility, if the message was sent on behalf of a chat, the field *from* contains a fake sender user in non-channel chats.\n",
"name": "sender_chat",
"required": false
},
@@ -5572,6 +5572,14 @@
"rst_description": "Information about the user\n",
"name": "user",
"required": true
+ },
+ {
+ "type": "Integer",
+ "description": "Date when the user's subscription will expire; Unix time",
+ "html_description": "Optional. Date when the user's subscription will expire; Unix time | ",
+ "rst_description": "*Optional*. Date when the user's subscription will expire; Unix time\n",
+ "name": "until_date",
+ "required": false
}
],
"category": "types"
@@ -6145,9 +6153,9 @@
{
"anchor": "reactiontype",
"name": "ReactionType",
- "description": "This object describes the type of a reaction. Currently, it can be one of\n - ReactionTypeEmoji\n - ReactionTypeCustomEmoji",
- "html_description": "This object describes the type of a reaction. Currently, it can be one of
",
- "rst_description": "This object describes the type of a reaction. Currently, it can be one of\n\n - :class:`aiogram.types.reaction_type_emoji.ReactionTypeEmoji`\n - :class:`aiogram.types.reaction_type_custom_emoji.ReactionTypeCustomEmoji`",
+ "description": "This object describes the type of a reaction. Currently, it can be one of\n - ReactionTypeEmoji\n - ReactionTypeCustomEmoji\n - ReactionTypePaid",
+ "html_description": "This object describes the type of a reaction. Currently, it can be one of
",
+ "rst_description": "This object describes the type of a reaction. Currently, it can be one of\n\n - :class:`aiogram.types.reaction_type_emoji.ReactionTypeEmoji`\n - :class:`aiogram.types.reaction_type_custom_emoji.ReactionTypeCustomEmoji`\n - :class:`aiogram.types.reaction_type_paid.ReactionTypePaid`",
"annotations": [],
"category": "types"
},
@@ -6203,6 +6211,24 @@
],
"category": "types"
},
+ {
+ "anchor": "reactiontypepaid",
+ "name": "ReactionTypePaid",
+ "description": "The reaction is paid.",
+ "html_description": "The reaction is paid.
",
+ "rst_description": "The reaction is paid.",
+ "annotations": [
+ {
+ "type": "String",
+ "description": "Type of the reaction, always 'paid'",
+ "html_description": "Type of the reaction, always “paid” | ",
+ "rst_description": "Type of the reaction, always 'paid'\n",
+ "name": "type",
+ "required": true
+ }
+ ],
+ "category": "types"
+ },
{
"anchor": "reactioncount",
"name": "ReactionCount",
@@ -8940,16 +8966,24 @@
{
"anchor": "sendpaidmedia",
"name": "sendPaidMedia",
- "description": "Use this method to send paid media to channel chats. On success, the sent Message is returned.",
- "html_description": "Use this method to send paid media to channel chats. On success, the sent Message is returned.
",
- "rst_description": "Use this method to send paid media to channel chats. On success, the sent :class:`aiogram.types.message.Message` is returned.",
+ "description": "Use this method to send paid media. On success, the sent Message is returned.",
+ "html_description": "Use this method to send paid media. On success, the sent Message is returned.
",
+ "rst_description": "Use this method to send paid media. On success, the sent :class:`aiogram.types.message.Message` is returned.",
"annotations": [
+ {
+ "type": "String",
+ "required": false,
+ "description": "Unique identifier of the business connection on behalf of which the message will be sent",
+ "html_description": "Unique identifier of the business connection on behalf of which the message will be sent | ",
+ "rst_description": "Unique identifier of the business connection on behalf of which the message will be sent\n",
+ "name": "business_connection_id"
+ },
{
"type": "Integer or String",
"required": true,
- "description": "Unique identifier for the target chat or username of the target channel (in the format @channelusername)",
- "html_description": "Unique identifier for the target chat or username of the target channel (in the format @channelusername) | ",
- "rst_description": "Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)\n",
+ "description": "Unique identifier for the target chat or username of the target channel (in the format @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.",
+ "html_description": "Unique identifier for the target chat or username of the target channel (in the format @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. | ",
+ "rst_description": "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.\n",
"name": "chat_id"
},
{
@@ -9788,9 +9822,9 @@
{
"anchor": "setmessagereaction",
"name": "setMessageReaction",
- "description": "Use this method to change the chosen reactions on a message. Service messages can't be reacted to. Automatically forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel. Returns True on success.",
- "html_description": "Use this method to change the chosen reactions on a message. Service messages can't be reacted to. Automatically forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel. Returns True on success.
",
- "rst_description": "Use this method to change the chosen reactions on a message. Service messages can't be reacted to. Automatically forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel. Returns :code:`True` on success.",
+ "description": "Use this method to change the chosen reactions on a message. Service messages can't be reacted to. Automatically forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel. Bots can't use paid reactions. Returns True on success.",
+ "html_description": "Use this method to change the chosen reactions on a message. Service messages can't be reacted to. Automatically forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel. Bots can't use paid reactions. Returns True on success.
",
+ "rst_description": "Use this method to change the chosen reactions on a message. Service messages can't be reacted to. Automatically forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel. Bots can't use paid reactions. Returns :code:`True` on success.",
"annotations": [
{
"type": "Integer or String",
@@ -9811,9 +9845,9 @@
{
"type": "Array of ReactionType",
"required": false,
- "description": "A JSON-serialized list of reaction types to set on the message. Currently, as non-premium users, bots can set up to one reaction per message. A custom emoji reaction can be used if it is either already present on the message or explicitly allowed by chat administrators.",
- "html_description": "A JSON-serialized list of reaction types to set on the message. Currently, as non-premium users, bots can set up to one reaction per message. A custom emoji reaction can be used if it is either already present on the message or explicitly allowed by chat administrators. | ",
- "rst_description": "A JSON-serialized list of reaction types to set on the message. Currently, as non-premium users, bots can set up to one reaction per message. A custom emoji reaction can be used if it is either already present on the message or explicitly allowed by chat administrators.\n",
+ "description": "A JSON-serialized list of reaction types to set on the message. Currently, as non-premium users, bots can set up to one reaction per message. A custom emoji reaction can be used if it is either already present on the message or explicitly allowed by chat administrators. Paid reactions can't be used by bots.",
+ "html_description": "A JSON-serialized list of reaction types to set on the message. Currently, as non-premium users, bots can set up to one reaction per message. A custom emoji reaction can be used if it is either already present on the message or explicitly allowed by chat administrators. Paid reactions can't be used by bots. | ",
+ "rst_description": "A JSON-serialized list of reaction types to set on the message. Currently, as non-premium users, bots can set up to one reaction per message. A custom emoji reaction can be used if it is either already present on the message or explicitly allowed by chat administrators. Paid reactions can't be used by bots.\n",
"name": "reaction"
},
{
@@ -10397,6 +10431,82 @@
],
"category": "methods"
},
+ {
+ "anchor": "createchatsubscriptioninvitelink",
+ "name": "createChatSubscriptionInviteLink",
+ "description": "Use this method to create a subscription invite link for a channel chat. The bot must have the can_invite_users administrator rights. The link can be edited using the method editChatSubscriptionInviteLink or revoked using the method revokeChatInviteLink. Returns the new invite link as a ChatInviteLink object.",
+ "html_description": "Use this method to create a subscription invite link for a channel chat. The bot must have the can_invite_users administrator rights. The link can be edited using the method editChatSubscriptionInviteLink or revoked using the method revokeChatInviteLink. Returns the new invite link as a ChatInviteLink object.
",
+ "rst_description": "Use this method to create a `subscription invite link `_ for a channel chat. The bot must have the *can_invite_users* administrator rights. The link can be edited using the method :class:`aiogram.methods.edit_chat_subscription_invite_link.EditChatSubscriptionInviteLink` or revoked using the method :class:`aiogram.methods.revoke_chat_invite_link.RevokeChatInviteLink`. Returns the new invite link as a :class:`aiogram.types.chat_invite_link.ChatInviteLink` object.",
+ "annotations": [
+ {
+ "type": "Integer or String",
+ "required": true,
+ "description": "Unique identifier for the target channel chat or username of the target channel (in the format @channelusername)",
+ "html_description": "Unique identifier for the target channel chat or username of the target channel (in the format @channelusername) | ",
+ "rst_description": "Unique identifier for the target channel chat or username of the target channel (in the format :code:`@channelusername`)\n",
+ "name": "chat_id"
+ },
+ {
+ "type": "String",
+ "required": false,
+ "description": "Invite link name; 0-32 characters",
+ "html_description": "Invite link name; 0-32 characters | ",
+ "rst_description": "Invite link name; 0-32 characters\n",
+ "name": "name"
+ },
+ {
+ "type": "Integer",
+ "required": true,
+ "description": "The number of seconds the subscription will be active for before the next payment. Currently, it must always be 2592000 (30 days).",
+ "html_description": "The number of seconds the subscription will be active for before the next payment. Currently, it must always be 2592000 (30 days). | ",
+ "rst_description": "The number of seconds the subscription will be active for before the next payment. Currently, it must always be 2592000 (30 days).\n",
+ "name": "subscription_period"
+ },
+ {
+ "type": "Integer",
+ "required": true,
+ "description": "The amount of Telegram Stars a user must pay initially and after each subsequent subscription period to be a member of the chat; 1-2500",
+ "html_description": "The amount of Telegram Stars a user must pay initially and after each subsequent subscription period to be a member of the chat; 1-2500 | ",
+ "rst_description": "The amount of Telegram Stars a user must pay initially and after each subsequent subscription period to be a member of the chat; 1-2500\n",
+ "name": "subscription_price"
+ }
+ ],
+ "category": "methods"
+ },
+ {
+ "anchor": "editchatsubscriptioninvitelink",
+ "name": "editChatSubscriptionInviteLink",
+ "description": "Use this method to edit a subscription invite link created by the bot. The bot must have the can_invite_users administrator rights. Returns the edited invite link as a ChatInviteLink object.",
+ "html_description": "Use this method to edit a subscription invite link created by the bot. The bot must have the can_invite_users administrator rights. Returns the edited invite link as a ChatInviteLink object.
",
+ "rst_description": "Use this method to edit a subscription invite link created by the bot. The bot must have the *can_invite_users* administrator rights. Returns the edited invite link as a :class:`aiogram.types.chat_invite_link.ChatInviteLink` object.",
+ "annotations": [
+ {
+ "type": "Integer or String",
+ "required": true,
+ "description": "Unique identifier for the target chat or username of the target channel (in the format @channelusername)",
+ "html_description": "Unique identifier for the target chat or username of the target channel (in the format @channelusername) | ",
+ "rst_description": "Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)\n",
+ "name": "chat_id"
+ },
+ {
+ "type": "String",
+ "required": true,
+ "description": "The invite link to edit",
+ "html_description": "The invite link to edit | ",
+ "rst_description": "The invite link to edit\n",
+ "name": "invite_link"
+ },
+ {
+ "type": "String",
+ "required": false,
+ "description": "Invite link name; 0-32 characters",
+ "html_description": "Invite link name; 0-32 characters | ",
+ "rst_description": "Invite link name; 0-32 characters\n",
+ "name": "name"
+ }
+ ],
+ "category": "methods"
+ },
{
"anchor": "revokechatinvitelink",
"name": "revokeChatInviteLink",
@@ -10861,9 +10971,9 @@
{
"anchor": "editforumtopic",
"name": "editForumTopic",
- "description": "Use this method to edit name and icon of a topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have can_manage_topics administrator rights, unless it is the creator of the topic. Returns True on success.",
- "html_description": "Use this method to edit name and icon of a topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have can_manage_topics administrator rights, unless it is the creator of the topic. Returns True on success.
",
- "rst_description": "Use this method to edit name and icon of a topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have *can_manage_topics* administrator rights, unless it is the creator of the topic. Returns :code:`True` on success.",
+ "description": "Use this method to edit name and icon of a topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic. Returns True on success.",
+ "html_description": "Use this method to edit name and icon of a topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic. Returns True on success.
",
+ "rst_description": "Use this method to edit name and icon of a topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the *can_manage_topics* administrator rights, unless it is the creator of the topic. Returns :code:`True` on success.",
"annotations": [
{
"type": "Integer or String",
@@ -11007,9 +11117,9 @@
{
"anchor": "editgeneralforumtopic",
"name": "editGeneralForumTopic",
- "description": "Use this method to edit the name of the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have can_manage_topics administrator rights. Returns True on success.",
- "html_description": "Use this method to edit the name of the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have can_manage_topics administrator rights. Returns True on success.
",
- "rst_description": "Use this method to edit the name of the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have *can_manage_topics* administrator rights. Returns :code:`True` on success.",
+ "description": "Use this method to edit the name of the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. Returns True on success.",
+ "html_description": "Use this method to edit the name of the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. Returns True on success.
",
+ "rst_description": "Use this method to edit the name of the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the *can_manage_topics* administrator rights. Returns :code:`True` on success.",
"annotations": [
{
"type": "Integer or String",
@@ -16586,6 +16696,14 @@
"rst_description": "*Optional*. Bot-specified invoice payload\n",
"name": "invoice_payload",
"required": false
+ },
+ {
+ "type": "Array of PaidMedia",
+ "description": "Information about the paid media bought by the user",
+ "html_description": "Optional. Information about the paid media bought by the user | ",
+ "rst_description": "*Optional*. Information about the paid media bought by the user\n",
+ "name": "paid_media",
+ "required": false
}
],
"category": "types"
diff --git a/.butcher/types/ChatMemberMember/entity.json b/.butcher/types/ChatMemberMember/entity.json
index 90d6016a..c9988ee7 100644
--- a/.butcher/types/ChatMemberMember/entity.json
+++ b/.butcher/types/ChatMemberMember/entity.json
@@ -26,6 +26,14 @@
"rst_description": "Information about the user\n",
"name": "user",
"required": true
+ },
+ {
+ "type": "Integer",
+ "description": "Date when the user's subscription will expire; Unix time",
+ "html_description": "Optional. Date when the user's subscription will expire; Unix time | ",
+ "rst_description": "*Optional*. Date when the user's subscription will expire; Unix time\n",
+ "name": "until_date",
+ "required": false
}
],
"category": "types"
diff --git a/.butcher/types/ChatMemberMember/replace.yml b/.butcher/types/ChatMemberMember/replace.yml
new file mode 100644
index 00000000..e264e991
--- /dev/null
+++ b/.butcher/types/ChatMemberMember/replace.yml
@@ -0,0 +1,5 @@
+annotations:
+ until_date:
+ parsed_type:
+ type: std
+ name: DateTime
diff --git a/.butcher/types/Message/entity.json b/.butcher/types/Message/entity.json
index 57809854..7e31e2af 100644
--- a/.butcher/types/Message/entity.json
+++ b/.butcher/types/Message/entity.json
@@ -29,17 +29,17 @@
},
{
"type": "User",
- "description": "Sender of the message; empty for messages sent to channels. For backward compatibility, the field contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat.",
- "html_description": "Optional. Sender of the message; empty for messages sent to channels. For backward compatibility, the field contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat. | ",
- "rst_description": "*Optional*. Sender of the message; empty for messages sent to channels. For backward compatibility, the field contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat.\n",
+ "description": "Sender of the message; may be empty for messages sent to channels. For backward compatibility, if the message was sent on behalf of a chat, the field contains a fake sender user in non-channel chats",
+ "html_description": "Optional. Sender of the message; may be empty for messages sent to channels. For backward compatibility, if the message was sent on behalf of a chat, the field contains a fake sender user in non-channel chats | ",
+ "rst_description": "*Optional*. Sender of the message; may be empty for messages sent to channels. For backward compatibility, if the message was sent on behalf of a chat, the field contains a fake sender user in non-channel chats\n",
"name": "from",
"required": false
},
{
"type": "Chat",
- "description": "Sender of the message, sent on behalf of a chat. For example, the channel itself for channel posts, the supergroup itself for messages from anonymous group administrators, the linked channel for messages automatically forwarded to the discussion group. For backward compatibility, the field from contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat.",
- "html_description": "Optional. Sender of the message, sent on behalf of a chat. For example, the channel itself for channel posts, the supergroup itself for messages from anonymous group administrators, the linked channel for messages automatically forwarded to the discussion group. For backward compatibility, the field from contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat. | ",
- "rst_description": "*Optional*. Sender of the message, sent on behalf of a chat. For example, the channel itself for channel posts, the supergroup itself for messages from anonymous group administrators, the linked channel for messages automatically forwarded to the discussion group. For backward compatibility, the field *from* contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat.\n",
+ "description": "Sender of the message when sent on behalf of a chat. For example, the supergroup itself for messages sent by its anonymous administrators or a linked channel for messages automatically forwarded to the channel's discussion group. For backward compatibility, if the message was sent on behalf of a chat, the field from contains a fake sender user in non-channel chats.",
+ "html_description": "Optional. Sender of the message when sent on behalf of a chat. For example, the supergroup itself for messages sent by its anonymous administrators or a linked channel for messages automatically forwarded to the channel's discussion group. For backward compatibility, if the message was sent on behalf of a chat, the field from contains a fake sender user in non-channel chats. | ",
+ "rst_description": "*Optional*. Sender of the message when sent on behalf of a chat. For example, the supergroup itself for messages sent by its anonymous administrators or a linked channel for messages automatically forwarded to the channel's discussion group. For backward compatibility, if the message was sent on behalf of a chat, the field *from* contains a fake sender user in non-channel chats.\n",
"name": "sender_chat",
"required": false
},
diff --git a/.butcher/types/ReactionType/entity.json b/.butcher/types/ReactionType/entity.json
index e37dcce3..8063b1a7 100644
--- a/.butcher/types/ReactionType/entity.json
+++ b/.butcher/types/ReactionType/entity.json
@@ -7,9 +7,9 @@
"object": {
"anchor": "reactiontype",
"name": "ReactionType",
- "description": "This object describes the type of a reaction. Currently, it can be one of\n - ReactionTypeEmoji\n - ReactionTypeCustomEmoji",
- "html_description": "This object describes the type of a reaction. Currently, it can be one of
",
- "rst_description": "This object describes the type of a reaction. Currently, it can be one of\n\n - :class:`aiogram.types.reaction_type_emoji.ReactionTypeEmoji`\n - :class:`aiogram.types.reaction_type_custom_emoji.ReactionTypeCustomEmoji`",
+ "description": "This object describes the type of a reaction. Currently, it can be one of\n - ReactionTypeEmoji\n - ReactionTypeCustomEmoji\n - ReactionTypePaid",
+ "html_description": "This object describes the type of a reaction. Currently, it can be one of
",
+ "rst_description": "This object describes the type of a reaction. Currently, it can be one of\n\n - :class:`aiogram.types.reaction_type_emoji.ReactionTypeEmoji`\n - :class:`aiogram.types.reaction_type_custom_emoji.ReactionTypeCustomEmoji`\n - :class:`aiogram.types.reaction_type_paid.ReactionTypePaid`",
"annotations": [],
"category": "types"
}
diff --git a/.butcher/types/ReactionTypePaid/entity.json b/.butcher/types/ReactionTypePaid/entity.json
new file mode 100644
index 00000000..9fb16cc7
--- /dev/null
+++ b/.butcher/types/ReactionTypePaid/entity.json
@@ -0,0 +1,25 @@
+{
+ "meta": {},
+ "group": {
+ "title": "Available types",
+ "anchor": "available-types"
+ },
+ "object": {
+ "anchor": "reactiontypepaid",
+ "name": "ReactionTypePaid",
+ "description": "The reaction is paid.",
+ "html_description": "The reaction is paid.
",
+ "rst_description": "The reaction is paid.",
+ "annotations": [
+ {
+ "type": "String",
+ "description": "Type of the reaction, always 'paid'",
+ "html_description": "Type of the reaction, always “paid” | ",
+ "rst_description": "Type of the reaction, always 'paid'\n",
+ "name": "type",
+ "required": true
+ }
+ ],
+ "category": "types"
+ }
+}
diff --git a/.butcher/types/TransactionPartnerUser/entity.json b/.butcher/types/TransactionPartnerUser/entity.json
index b8a616fc..45ac0d68 100644
--- a/.butcher/types/TransactionPartnerUser/entity.json
+++ b/.butcher/types/TransactionPartnerUser/entity.json
@@ -34,6 +34,14 @@
"rst_description": "*Optional*. Bot-specified invoice payload\n",
"name": "invoice_payload",
"required": false
+ },
+ {
+ "type": "Array of PaidMedia",
+ "description": "Information about the paid media bought by the user",
+ "html_description": "Optional. Information about the paid media bought by the user | ",
+ "rst_description": "*Optional*. Information about the paid media bought by the user\n",
+ "name": "paid_media",
+ "required": false
}
],
"category": "types"
diff --git a/Makefile b/Makefile
index d079bb16..104b4c7a 100644
--- a/Makefile
+++ b/Makefile
@@ -102,9 +102,14 @@ build: clean
.PHONY: bump
bump:
hatch version $(args)
- cat .butcher/schema/schema.json | jq '.api.version' -r > .apiversion
python scripts/bump_versions.py
+update-api:
+ butcher parse
+ butcher refresh
+ butcher apply all
+ @$(MAKE) bump
+
.PHONY: towncrier-build
towncrier-build:
hatch run docs:towncrier build --yes
diff --git a/README.rst b/README.rst
index 736cbda1..87a88e6f 100644
--- a/README.rst
+++ b/README.rst
@@ -52,7 +52,7 @@ Features
- Asynchronous (`asyncio docs `_, :pep:`492`)
- Has type hints (:pep:`484`) and can be used with `mypy `_
- Supports `PyPy `_
-- Supports `Telegram Bot API 7.8 `_ and gets fast updates to the latest versions of the Bot API
+- Supports `Telegram Bot API 7.9 `_ and gets fast updates to the latest versions of the Bot API
- Telegram Bot API integration code was `autogenerated `_ and can be easily re-generated when API gets updated
- Updates router (Blueprints)
- Has Finite State Machine
diff --git a/aiogram/__meta__.py b/aiogram/__meta__.py
index cabe9dd4..4a9570e0 100644
--- a/aiogram/__meta__.py
+++ b/aiogram/__meta__.py
@@ -1,2 +1,2 @@
__version__ = "3.11.0"
-__api_version__ = "7.8"
+__api_version__ = "7.9"
diff --git a/aiogram/client/bot.py b/aiogram/client/bot.py
index c51a7d62..397e1a11 100644
--- a/aiogram/client/bot.py
+++ b/aiogram/client/bot.py
@@ -38,6 +38,7 @@ from ..methods import (
CopyMessage,
CopyMessages,
CreateChatInviteLink,
+ CreateChatSubscriptionInviteLink,
CreateForumTopic,
CreateInvoiceLink,
CreateNewStickerSet,
@@ -52,6 +53,7 @@ from ..methods import (
DeleteStickerSet,
DeleteWebhook,
EditChatInviteLink,
+ EditChatSubscriptionInviteLink,
EditForumTopic,
EditGeneralForumTopic,
EditMessageCaption,
@@ -230,6 +232,7 @@ from ..types import (
Poll,
ReactionTypeCustomEmoji,
ReactionTypeEmoji,
+ ReactionTypePaid,
ReplyKeyboardMarkup,
ReplyKeyboardRemove,
ReplyParameters,
@@ -1325,7 +1328,7 @@ class Bot:
request_timeout: Optional[int] = None,
) -> bool:
"""
- Use this method to edit name and icon of a topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have *can_manage_topics* administrator rights, unless it is the creator of the topic. Returns :code:`True` on success.
+ Use this method to edit name and icon of a topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the *can_manage_topics* administrator rights, unless it is the creator of the topic. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#editforumtopic
@@ -4013,7 +4016,7 @@ class Bot:
request_timeout: Optional[int] = None,
) -> bool:
"""
- Use this method to edit the name of the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have *can_manage_topics* administrator rights. Returns :code:`True` on success.
+ Use this method to edit the name of the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the *can_manage_topics* administrator rights. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#editgeneralforumtopic
@@ -4525,18 +4528,20 @@ class Bot:
self,
chat_id: Union[int, str],
message_id: int,
- reaction: Optional[List[Union[ReactionTypeEmoji, ReactionTypeCustomEmoji]]] = None,
+ reaction: Optional[
+ List[Union[ReactionTypeEmoji, ReactionTypeCustomEmoji, ReactionTypePaid]]
+ ] = None,
is_big: Optional[bool] = None,
request_timeout: Optional[int] = None,
) -> bool:
"""
- Use this method to change the chosen reactions on a message. Service messages can't be reacted to. Automatically forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel. Returns :code:`True` on success.
+ Use this method to change the chosen reactions on a message. Service messages can't be reacted to. Automatically forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel. Bots can't use paid reactions. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#setmessagereaction
: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 target message. If the message belongs to a media group, the reaction is set to the first non-deleted message in the group instead.
- :param reaction: A JSON-serialized list of reaction types to set on the message. Currently, as non-premium users, bots can set up to one reaction per message. A custom emoji reaction can be used if it is either already present on the message or explicitly allowed by chat administrators.
+ :param reaction: A JSON-serialized list of reaction types to set on the message. Currently, as non-premium users, bots can set up to one reaction per message. A custom emoji reaction can be used if it is either already present on the message or explicitly allowed by chat administrators. Paid reactions can't be used by bots.
:param is_big: Pass :code:`True` to set the reaction with a big animation
:param request_timeout: Request timeout
:return: Returns :code:`True` on success.
@@ -4650,6 +4655,7 @@ class Bot:
chat_id: Union[int, str],
star_count: int,
media: List[Union[InputPaidMediaPhoto, InputPaidMediaVideo]],
+ business_connection_id: Optional[str] = None,
caption: Optional[str] = None,
parse_mode: Optional[str] = None,
caption_entities: Optional[List[MessageEntity]] = None,
@@ -4663,13 +4669,14 @@ class Bot:
request_timeout: Optional[int] = None,
) -> Message:
"""
- Use this method to send paid media to channel chats. On success, the sent :class:`aiogram.types.message.Message` is returned.
+ Use this method to send paid media. On success, the sent :class:`aiogram.types.message.Message` is returned.
Source: https://core.telegram.org/bots/api#sendpaidmedia
- :param chat_id: Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)
+ :param 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 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 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*
@@ -4686,6 +4693,7 @@ class Bot:
chat_id=chat_id,
star_count=star_count,
media=media,
+ business_connection_id=business_connection_id,
caption=caption,
parse_mode=parse_mode,
caption_entities=caption_entities,
@@ -4696,3 +4704,58 @@ class Bot:
reply_markup=reply_markup,
)
return await self(call, request_timeout=request_timeout)
+
+ async def create_chat_subscription_invite_link(
+ self,
+ chat_id: Union[int, str],
+ subscription_period: Union[datetime.datetime, datetime.timedelta, int],
+ subscription_price: int,
+ name: Optional[str] = None,
+ request_timeout: Optional[int] = None,
+ ) -> ChatInviteLink:
+ """
+ Use this method to create a `subscription invite link `_ for a channel chat. The bot must have the *can_invite_users* administrator rights. The link can be edited using the method :class:`aiogram.methods.edit_chat_subscription_invite_link.EditChatSubscriptionInviteLink` or revoked using the method :class:`aiogram.methods.revoke_chat_invite_link.RevokeChatInviteLink`. Returns the new invite link as a :class:`aiogram.types.chat_invite_link.ChatInviteLink` object.
+
+ Source: https://core.telegram.org/bots/api#createchatsubscriptioninvitelink
+
+ :param chat_id: Unique identifier for the target channel chat or username of the target channel (in the format :code:`@channelusername`)
+ :param subscription_period: The number of seconds the subscription will be active for before the next payment. Currently, it must always be 2592000 (30 days).
+ :param subscription_price: The amount of Telegram Stars a user must pay initially and after each subsequent subscription period to be a member of the chat; 1-2500
+ :param name: Invite link name; 0-32 characters
+ :param request_timeout: Request timeout
+ :return: Returns the new invite link as a :class:`aiogram.types.chat_invite_link.ChatInviteLink` object.
+ """
+
+ call = CreateChatSubscriptionInviteLink(
+ chat_id=chat_id,
+ subscription_period=subscription_period,
+ subscription_price=subscription_price,
+ name=name,
+ )
+ return await self(call, request_timeout=request_timeout)
+
+ async def edit_chat_subscription_invite_link(
+ self,
+ chat_id: Union[int, str],
+ invite_link: str,
+ name: Optional[str] = None,
+ request_timeout: Optional[int] = None,
+ ) -> ChatInviteLink:
+ """
+ Use this method to edit a subscription invite link created by the bot. The bot must have the *can_invite_users* administrator rights. Returns the edited invite link as a :class:`aiogram.types.chat_invite_link.ChatInviteLink` object.
+
+ Source: https://core.telegram.org/bots/api#editchatsubscriptioninvitelink
+
+ :param chat_id: Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)
+ :param invite_link: The invite link to edit
+ :param name: Invite link name; 0-32 characters
+ :param request_timeout: Request timeout
+ :return: Returns the edited invite link as a :class:`aiogram.types.chat_invite_link.ChatInviteLink` object.
+ """
+
+ call = EditChatSubscriptionInviteLink(
+ chat_id=chat_id,
+ invite_link=invite_link,
+ name=name,
+ )
+ return await self(call, request_timeout=request_timeout)
diff --git a/aiogram/methods/__init__.py b/aiogram/methods/__init__.py
index dca24d62..66214ac6 100644
--- a/aiogram/methods/__init__.py
+++ b/aiogram/methods/__init__.py
@@ -14,6 +14,7 @@ from .close_general_forum_topic import CloseGeneralForumTopic
from .copy_message import CopyMessage
from .copy_messages import CopyMessages
from .create_chat_invite_link import CreateChatInviteLink
+from .create_chat_subscription_invite_link import CreateChatSubscriptionInviteLink
from .create_forum_topic import CreateForumTopic
from .create_invoice_link import CreateInvoiceLink
from .create_new_sticker_set import CreateNewStickerSet
@@ -28,6 +29,7 @@ from .delete_sticker_from_set import DeleteStickerFromSet
from .delete_sticker_set import DeleteStickerSet
from .delete_webhook import DeleteWebhook
from .edit_chat_invite_link import EditChatInviteLink
+from .edit_chat_subscription_invite_link import EditChatSubscriptionInviteLink
from .edit_forum_topic import EditForumTopic
from .edit_general_forum_topic import EditGeneralForumTopic
from .edit_message_caption import EditMessageCaption
@@ -140,6 +142,7 @@ __all__ = (
"CopyMessage",
"CopyMessages",
"CreateChatInviteLink",
+ "CreateChatSubscriptionInviteLink",
"CreateForumTopic",
"CreateInvoiceLink",
"CreateNewStickerSet",
@@ -154,6 +157,7 @@ __all__ = (
"DeleteStickerSet",
"DeleteWebhook",
"EditChatInviteLink",
+ "EditChatSubscriptionInviteLink",
"EditForumTopic",
"EditGeneralForumTopic",
"EditMessageCaption",
diff --git a/aiogram/methods/create_chat_subscription_invite_link.py b/aiogram/methods/create_chat_subscription_invite_link.py
new file mode 100644
index 00000000..1301eb2f
--- /dev/null
+++ b/aiogram/methods/create_chat_subscription_invite_link.py
@@ -0,0 +1,52 @@
+from __future__ import annotations
+
+import datetime
+from typing import TYPE_CHECKING, Any, Optional, Union
+
+from ..types import ChatInviteLink
+from .base import TelegramMethod
+
+
+class CreateChatSubscriptionInviteLink(TelegramMethod[ChatInviteLink]):
+ """
+ Use this method to create a `subscription invite link `_ for a channel chat. The bot must have the *can_invite_users* administrator rights. The link can be edited using the method :class:`aiogram.methods.edit_chat_subscription_invite_link.EditChatSubscriptionInviteLink` or revoked using the method :class:`aiogram.methods.revoke_chat_invite_link.RevokeChatInviteLink`. Returns the new invite link as a :class:`aiogram.types.chat_invite_link.ChatInviteLink` object.
+
+ Source: https://core.telegram.org/bots/api#createchatsubscriptioninvitelink
+ """
+
+ __returning__ = ChatInviteLink
+ __api_method__ = "createChatSubscriptionInviteLink"
+
+ chat_id: Union[int, str]
+ """Unique identifier for the target channel chat or username of the target channel (in the format :code:`@channelusername`)"""
+ subscription_period: Union[datetime.datetime, datetime.timedelta, int]
+ """The number of seconds the subscription will be active for before the next payment. Currently, it must always be 2592000 (30 days)."""
+ subscription_price: int
+ """The amount of Telegram Stars a user must pay initially and after each subsequent subscription period to be a member of the chat; 1-2500"""
+ name: Optional[str] = None
+ """Invite link name; 0-32 characters"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ chat_id: Union[int, str],
+ subscription_period: Union[datetime.datetime, datetime.timedelta, int],
+ subscription_price: int,
+ name: Optional[str] = None,
+ **__pydantic_kwargs: Any,
+ ) -> None:
+ # DO NOT EDIT MANUALLY!!!
+ # This method was auto-generated via `butcher`
+ # Is needed only for type checking and IDE support without any additional plugins
+
+ super().__init__(
+ chat_id=chat_id,
+ subscription_period=subscription_period,
+ subscription_price=subscription_price,
+ name=name,
+ **__pydantic_kwargs,
+ )
diff --git a/aiogram/methods/edit_chat_subscription_invite_link.py b/aiogram/methods/edit_chat_subscription_invite_link.py
new file mode 100644
index 00000000..ffb37d80
--- /dev/null
+++ b/aiogram/methods/edit_chat_subscription_invite_link.py
@@ -0,0 +1,44 @@
+from __future__ import annotations
+
+from typing import TYPE_CHECKING, Any, Optional, Union
+
+from ..types import ChatInviteLink
+from .base import TelegramMethod
+
+
+class EditChatSubscriptionInviteLink(TelegramMethod[ChatInviteLink]):
+ """
+ Use this method to edit a subscription invite link created by the bot. The bot must have the *can_invite_users* administrator rights. Returns the edited invite link as a :class:`aiogram.types.chat_invite_link.ChatInviteLink` object.
+
+ Source: https://core.telegram.org/bots/api#editchatsubscriptioninvitelink
+ """
+
+ __returning__ = ChatInviteLink
+ __api_method__ = "editChatSubscriptionInviteLink"
+
+ chat_id: Union[int, str]
+ """Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
+ invite_link: str
+ """The invite link to edit"""
+ name: Optional[str] = None
+ """Invite link name; 0-32 characters"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ chat_id: Union[int, str],
+ invite_link: str,
+ name: Optional[str] = None,
+ **__pydantic_kwargs: Any,
+ ) -> None:
+ # DO NOT EDIT MANUALLY!!!
+ # This method was auto-generated via `butcher`
+ # Is needed only for type checking and IDE support without any additional plugins
+
+ super().__init__(
+ chat_id=chat_id, invite_link=invite_link, name=name, **__pydantic_kwargs
+ )
diff --git a/aiogram/methods/edit_forum_topic.py b/aiogram/methods/edit_forum_topic.py
index f0afb354..233e9cb9 100644
--- a/aiogram/methods/edit_forum_topic.py
+++ b/aiogram/methods/edit_forum_topic.py
@@ -7,7 +7,7 @@ from .base import TelegramMethod
class EditForumTopic(TelegramMethod[bool]):
"""
- Use this method to edit name and icon of a topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have *can_manage_topics* administrator rights, unless it is the creator of the topic. Returns :code:`True` on success.
+ Use this method to edit name and icon of a topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the *can_manage_topics* administrator rights, unless it is the creator of the topic. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#editforumtopic
"""
diff --git a/aiogram/methods/edit_general_forum_topic.py b/aiogram/methods/edit_general_forum_topic.py
index fe5acadf..f0be56e4 100644
--- a/aiogram/methods/edit_general_forum_topic.py
+++ b/aiogram/methods/edit_general_forum_topic.py
@@ -7,7 +7,7 @@ from .base import TelegramMethod
class EditGeneralForumTopic(TelegramMethod[bool]):
"""
- Use this method to edit the name of the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have *can_manage_topics* administrator rights. Returns :code:`True` on success.
+ Use this method to edit the name of the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the *can_manage_topics* administrator rights. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#editgeneralforumtopic
"""
diff --git a/aiogram/methods/send_paid_media.py b/aiogram/methods/send_paid_media.py
index 03b37a6e..dd847f5a 100644
--- a/aiogram/methods/send_paid_media.py
+++ b/aiogram/methods/send_paid_media.py
@@ -18,7 +18,7 @@ from .base import TelegramMethod
class SendPaidMedia(TelegramMethod[Message]):
"""
- Use this method to send paid media to channel chats. On success, the sent :class:`aiogram.types.message.Message` is returned.
+ Use this method to send paid media. On success, the sent :class:`aiogram.types.message.Message` is returned.
Source: https://core.telegram.org/bots/api#sendpaidmedia
"""
@@ -27,11 +27,13 @@ class SendPaidMedia(TelegramMethod[Message]):
__api_method__ = "sendPaidMedia"
chat_id: Union[int, str]
- """Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
+ """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"""
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"""
caption: Optional[str] = None
"""Media caption, 0-1024 characters after entities parsing"""
parse_mode: Optional[str] = None
@@ -61,6 +63,7 @@ class SendPaidMedia(TelegramMethod[Message]):
chat_id: Union[int, str],
star_count: int,
media: List[Union[InputPaidMediaPhoto, InputPaidMediaVideo]],
+ business_connection_id: Optional[str] = None,
caption: Optional[str] = None,
parse_mode: Optional[str] = None,
caption_entities: Optional[List[MessageEntity]] = None,
@@ -81,6 +84,7 @@ class SendPaidMedia(TelegramMethod[Message]):
chat_id=chat_id,
star_count=star_count,
media=media,
+ business_connection_id=business_connection_id,
caption=caption,
parse_mode=parse_mode,
caption_entities=caption_entities,
diff --git a/aiogram/methods/set_message_reaction.py b/aiogram/methods/set_message_reaction.py
index 3ac7cbb0..d1c061c2 100644
--- a/aiogram/methods/set_message_reaction.py
+++ b/aiogram/methods/set_message_reaction.py
@@ -1,12 +1,12 @@
from typing import TYPE_CHECKING, Any, List, Optional, Union
-from ..types import ReactionTypeCustomEmoji, ReactionTypeEmoji
+from ..types import ReactionTypeCustomEmoji, ReactionTypeEmoji, ReactionTypePaid
from .base import TelegramMethod
class SetMessageReaction(TelegramMethod[bool]):
"""
- Use this method to change the chosen reactions on a message. Service messages can't be reacted to. Automatically forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel. Returns :code:`True` on success.
+ Use this method to change the chosen reactions on a message. Service messages can't be reacted to. Automatically forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel. Bots can't use paid reactions. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#setmessagereaction
"""
@@ -18,8 +18,10 @@ class SetMessageReaction(TelegramMethod[bool]):
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
message_id: int
"""Identifier of the target message. If the message belongs to a media group, the reaction is set to the first non-deleted message in the group instead."""
- reaction: Optional[List[Union[ReactionTypeEmoji, ReactionTypeCustomEmoji]]] = None
- """A JSON-serialized list of reaction types to set on the message. Currently, as non-premium users, bots can set up to one reaction per message. A custom emoji reaction can be used if it is either already present on the message or explicitly allowed by chat administrators."""
+ reaction: Optional[
+ List[Union[ReactionTypeEmoji, ReactionTypeCustomEmoji, ReactionTypePaid]]
+ ] = None
+ """A JSON-serialized list of reaction types to set on the message. Currently, as non-premium users, bots can set up to one reaction per message. A custom emoji reaction can be used if it is either already present on the message or explicitly allowed by chat administrators. Paid reactions can't be used by bots."""
is_big: Optional[bool] = None
"""Pass :code:`True` to set the reaction with a big animation"""
@@ -32,7 +34,9 @@ class SetMessageReaction(TelegramMethod[bool]):
*,
chat_id: Union[int, str],
message_id: int,
- reaction: Optional[List[Union[ReactionTypeEmoji, ReactionTypeCustomEmoji]]] = None,
+ reaction: Optional[
+ List[Union[ReactionTypeEmoji, ReactionTypeCustomEmoji, ReactionTypePaid]]
+ ] = None,
is_big: Optional[bool] = None,
**__pydantic_kwargs: Any,
) -> None:
diff --git a/aiogram/types/__init__.py b/aiogram/types/__init__.py
index 60f40eb0..97442b35 100644
--- a/aiogram/types/__init__.py
+++ b/aiogram/types/__init__.py
@@ -187,6 +187,7 @@ from .reaction_count import ReactionCount
from .reaction_type import ReactionType
from .reaction_type_custom_emoji import ReactionTypeCustomEmoji
from .reaction_type_emoji import ReactionTypeEmoji
+from .reaction_type_paid import ReactionTypePaid
from .refunded_payment import RefundedPayment
from .reply_keyboard_markup import ReplyKeyboardMarkup
from .reply_keyboard_remove import ReplyKeyboardRemove
@@ -419,6 +420,7 @@ __all__ = (
"ReactionType",
"ReactionTypeCustomEmoji",
"ReactionTypeEmoji",
+ "ReactionTypePaid",
"RefundedPayment",
"ReplyKeyboardMarkup",
"ReplyKeyboardRemove",
diff --git a/aiogram/types/chat.py b/aiogram/types/chat.py
index 278b656c..c4feba4b 100644
--- a/aiogram/types/chat.py
+++ b/aiogram/types/chat.py
@@ -50,6 +50,7 @@ if TYPE_CHECKING:
from .message import Message
from .reaction_type_custom_emoji import ReactionTypeCustomEmoji
from .reaction_type_emoji import ReactionTypeEmoji
+ from .reaction_type_paid import ReactionTypePaid
class Chat(TelegramObject):
@@ -83,9 +84,9 @@ class Chat(TelegramObject):
.. deprecated:: API:7.3
https://core.telegram.org/bots/api-changelog#may-6-2024"""
- available_reactions: Optional[List[Union[ReactionTypeEmoji, ReactionTypeCustomEmoji]]] = Field(
- None, json_schema_extra={"deprecated": True}
- )
+ available_reactions: Optional[
+ List[Union[ReactionTypeEmoji, ReactionTypeCustomEmoji, ReactionTypePaid]]
+ ] = Field(None, json_schema_extra={"deprecated": True})
"""*Optional*. List of available reactions allowed in the chat. If omitted, then all `emoji reactions `_ are allowed. Returned only in :class:`aiogram.methods.get_chat.GetChat`.
.. deprecated:: API:7.3
@@ -284,7 +285,7 @@ class Chat(TelegramObject):
accent_color_id: Optional[int] = None,
active_usernames: Optional[List[str]] = None,
available_reactions: Optional[
- List[Union[ReactionTypeEmoji, ReactionTypeCustomEmoji]]
+ List[Union[ReactionTypeEmoji, ReactionTypeCustomEmoji, ReactionTypePaid]]
] = None,
background_custom_emoji_id: Optional[str] = None,
bio: Optional[str] = None,
diff --git a/aiogram/types/chat_full_info.py b/aiogram/types/chat_full_info.py
index 78126929..c6399391 100644
--- a/aiogram/types/chat_full_info.py
+++ b/aiogram/types/chat_full_info.py
@@ -16,6 +16,7 @@ if TYPE_CHECKING:
from .message import Message
from .reaction_type_custom_emoji import ReactionTypeCustomEmoji
from .reaction_type_emoji import ReactionTypeEmoji
+ from .reaction_type_paid import ReactionTypePaid
class ChatFullInfo(Chat):
@@ -57,7 +58,9 @@ class ChatFullInfo(Chat):
"""*Optional*. For private chats with business accounts, the opening hours of the business"""
personal_chat: Optional[Chat] = None
"""*Optional*. For private chats, the personal channel of the user"""
- available_reactions: Optional[List[Union[ReactionTypeEmoji, ReactionTypeCustomEmoji]]] = None
+ available_reactions: Optional[
+ List[Union[ReactionTypeEmoji, ReactionTypeCustomEmoji, ReactionTypePaid]]
+ ] = None
"""*Optional*. List of available reactions allowed in the chat. If omitted, then all `emoji reactions `_ are allowed."""
background_custom_emoji_id: Optional[str] = None
"""*Optional*. Custom emoji identifier of the emoji chosen by the chat for the reply header and link preview background"""
@@ -138,7 +141,7 @@ class ChatFullInfo(Chat):
business_opening_hours: Optional[BusinessOpeningHours] = None,
personal_chat: Optional[Chat] = None,
available_reactions: Optional[
- List[Union[ReactionTypeEmoji, ReactionTypeCustomEmoji]]
+ List[Union[ReactionTypeEmoji, ReactionTypeCustomEmoji, ReactionTypePaid]]
] = None,
background_custom_emoji_id: Optional[str] = None,
profile_accent_color_id: Optional[int] = None,
diff --git a/aiogram/types/chat_member_member.py b/aiogram/types/chat_member_member.py
index 663b190b..12ef33e4 100644
--- a/aiogram/types/chat_member_member.py
+++ b/aiogram/types/chat_member_member.py
@@ -1,9 +1,10 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Any, Literal
+from typing import TYPE_CHECKING, Any, Literal, Optional
from ..enums import ChatMemberStatus
from .chat_member import ChatMember
+from .custom import DateTime
if TYPE_CHECKING:
from .user import User
@@ -20,6 +21,8 @@ class ChatMemberMember(ChatMember):
"""The member's status in the chat, always 'member'"""
user: User
"""Information about the user"""
+ until_date: Optional[DateTime] = None
+ """*Optional*. Date when the user's subscription will expire; Unix time"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
@@ -30,10 +33,11 @@ class ChatMemberMember(ChatMember):
*,
status: Literal[ChatMemberStatus.MEMBER] = ChatMemberStatus.MEMBER,
user: User,
+ until_date: Optional[DateTime] = 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__(status=status, user=user, **__pydantic_kwargs)
+ super().__init__(status=status, user=user, until_date=until_date, **__pydantic_kwargs)
diff --git a/aiogram/types/message.py b/aiogram/types/message.py
index 3d380e50..57defef3 100644
--- a/aiogram/types/message.py
+++ b/aiogram/types/message.py
@@ -100,6 +100,7 @@ if TYPE_CHECKING:
from .proximity_alert_triggered import ProximityAlertTriggered
from .reaction_type_custom_emoji import ReactionTypeCustomEmoji
from .reaction_type_emoji import ReactionTypeEmoji
+ from .reaction_type_paid import ReactionTypePaid
from .refunded_payment import RefundedPayment
from .reply_keyboard_markup import ReplyKeyboardMarkup
from .reply_keyboard_remove import ReplyKeyboardRemove
@@ -138,9 +139,9 @@ class Message(MaybeInaccessibleMessage):
message_thread_id: Optional[int] = None
"""*Optional*. Unique identifier of a message thread to which the message belongs; for supergroups only"""
from_user: Optional[User] = Field(None, alias="from")
- """*Optional*. Sender of the message; empty for messages sent to channels. For backward compatibility, the field contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat."""
+ """*Optional*. Sender of the message; may be empty for messages sent to channels. For backward compatibility, if the message was sent on behalf of a chat, the field contains a fake sender user in non-channel chats"""
sender_chat: Optional[Chat] = None
- """*Optional*. Sender of the message, sent on behalf of a chat. For example, the channel itself for channel posts, the supergroup itself for messages from anonymous group administrators, the linked channel for messages automatically forwarded to the discussion group. For backward compatibility, the field *from* contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat."""
+ """*Optional*. Sender of the message when sent on behalf of a chat. For example, the supergroup itself for messages sent by its anonymous administrators or a linked channel for messages automatically forwarded to the channel's discussion group. For backward compatibility, if the message was sent on behalf of a chat, the field *from* contains a fake sender user in non-channel chats."""
sender_boost_count: Optional[int] = None
"""*Optional*. If the sender of the message boosted the chat, the number of boosts added by the user"""
sender_business_bot: Optional[User] = None
@@ -4058,7 +4059,9 @@ class Message(MaybeInaccessibleMessage):
def react(
self,
- reaction: Optional[List[Union[ReactionTypeEmoji, ReactionTypeCustomEmoji]]] = None,
+ reaction: Optional[
+ List[Union[ReactionTypeEmoji, ReactionTypeCustomEmoji, ReactionTypePaid]]
+ ] = None,
is_big: Optional[bool] = None,
**kwargs: Any,
) -> SetMessageReaction:
@@ -4069,11 +4072,11 @@ class Message(MaybeInaccessibleMessage):
- :code:`chat_id`
- :code:`message_id`
- Use this method to change the chosen reactions on a message. Service messages can't be reacted to. Automatically forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel. Returns :code:`True` on success.
+ Use this method to change the chosen reactions on a message. Service messages can't be reacted to. Automatically forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel. Bots can't use paid reactions. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#setmessagereaction
- :param reaction: A JSON-serialized list of reaction types to set on the message. Currently, as non-premium users, bots can set up to one reaction per message. A custom emoji reaction can be used if it is either already present on the message or explicitly allowed by chat administrators.
+ :param reaction: A JSON-serialized list of reaction types to set on the message. Currently, as non-premium users, bots can set up to one reaction per message. A custom emoji reaction can be used if it is either already present on the message or explicitly allowed by chat administrators. Paid reactions can't be used by bots.
:param is_big: Pass :code:`True` to set the reaction with a big animation
:return: instance of method :class:`aiogram.methods.set_message_reaction.SetMessageReaction`
"""
@@ -4118,7 +4121,7 @@ class Message(MaybeInaccessibleMessage):
- :code:`message_thread_id`
- :code:`business_connection_id`
- Use this method to send paid media to channel chats. On success, the sent :class:`aiogram.types.message.Message` is returned.
+ Use this method to send paid media. On success, the sent :class:`aiogram.types.message.Message` is returned.
Source: https://core.telegram.org/bots/api#sendpaidmedia
@@ -4184,7 +4187,7 @@ class Message(MaybeInaccessibleMessage):
- :code:`business_connection_id`
- :code:`reply_parameters`
- Use this method to send paid media to channel chats. On success, the sent :class:`aiogram.types.message.Message` is returned.
+ Use this method to send paid media. On success, the sent :class:`aiogram.types.message.Message` is returned.
Source: https://core.telegram.org/bots/api#sendpaidmedia
diff --git a/aiogram/types/message_reaction_updated.py b/aiogram/types/message_reaction_updated.py
index 714029e9..7831c774 100644
--- a/aiogram/types/message_reaction_updated.py
+++ b/aiogram/types/message_reaction_updated.py
@@ -9,6 +9,7 @@ if TYPE_CHECKING:
from .custom import DateTime
from .reaction_type_custom_emoji import ReactionTypeCustomEmoji
from .reaction_type_emoji import ReactionTypeEmoji
+ from .reaction_type_paid import ReactionTypePaid
from .user import User
@@ -25,9 +26,9 @@ class MessageReactionUpdated(TelegramObject):
"""Unique identifier of the message inside the chat"""
date: DateTime
"""Date of the change in Unix time"""
- old_reaction: List[Union[ReactionTypeEmoji, ReactionTypeCustomEmoji]]
+ old_reaction: List[Union[ReactionTypeEmoji, ReactionTypeCustomEmoji, ReactionTypePaid]]
"""Previous list of reaction types that were set by the user"""
- new_reaction: List[Union[ReactionTypeEmoji, ReactionTypeCustomEmoji]]
+ new_reaction: List[Union[ReactionTypeEmoji, ReactionTypeCustomEmoji, ReactionTypePaid]]
"""New list of reaction types that have been set by the user"""
user: Optional[User] = None
"""*Optional*. The user that changed the reaction, if the user isn't anonymous"""
@@ -44,8 +45,12 @@ class MessageReactionUpdated(TelegramObject):
chat: Chat,
message_id: int,
date: DateTime,
- old_reaction: List[Union[ReactionTypeEmoji, ReactionTypeCustomEmoji]],
- new_reaction: List[Union[ReactionTypeEmoji, ReactionTypeCustomEmoji]],
+ old_reaction: List[
+ Union[ReactionTypeEmoji, ReactionTypeCustomEmoji, ReactionTypePaid]
+ ],
+ new_reaction: List[
+ Union[ReactionTypeEmoji, ReactionTypeCustomEmoji, ReactionTypePaid]
+ ],
user: Optional[User] = None,
actor_chat: Optional[Chat] = None,
**__pydantic_kwargs: Any,
diff --git a/aiogram/types/reaction_count.py b/aiogram/types/reaction_count.py
index 6ec4794e..e4ee167b 100644
--- a/aiogram/types/reaction_count.py
+++ b/aiogram/types/reaction_count.py
@@ -7,6 +7,7 @@ from .base import TelegramObject
if TYPE_CHECKING:
from .reaction_type_custom_emoji import ReactionTypeCustomEmoji
from .reaction_type_emoji import ReactionTypeEmoji
+ from .reaction_type_paid import ReactionTypePaid
class ReactionCount(TelegramObject):
@@ -16,7 +17,7 @@ class ReactionCount(TelegramObject):
Source: https://core.telegram.org/bots/api#reactioncount
"""
- type: Union[ReactionTypeEmoji, ReactionTypeCustomEmoji]
+ type: Union[ReactionTypeEmoji, ReactionTypeCustomEmoji, ReactionTypePaid]
"""Type of the reaction"""
total_count: int
"""Number of times the reaction was added"""
@@ -28,7 +29,7 @@ class ReactionCount(TelegramObject):
def __init__(
__pydantic__self__,
*,
- type: Union[ReactionTypeEmoji, ReactionTypeCustomEmoji],
+ type: Union[ReactionTypeEmoji, ReactionTypeCustomEmoji, ReactionTypePaid],
total_count: int,
**__pydantic_kwargs: Any,
) -> None:
diff --git a/aiogram/types/reaction_type.py b/aiogram/types/reaction_type.py
index c7a87728..335d35d8 100644
--- a/aiogram/types/reaction_type.py
+++ b/aiogram/types/reaction_type.py
@@ -7,6 +7,7 @@ class ReactionType(TelegramObject):
- :class:`aiogram.types.reaction_type_emoji.ReactionTypeEmoji`
- :class:`aiogram.types.reaction_type_custom_emoji.ReactionTypeCustomEmoji`
+ - :class:`aiogram.types.reaction_type_paid.ReactionTypePaid`
Source: https://core.telegram.org/bots/api#reactiontype
"""
diff --git a/aiogram/types/reaction_type_paid.py b/aiogram/types/reaction_type_paid.py
new file mode 100644
index 00000000..8e95a830
--- /dev/null
+++ b/aiogram/types/reaction_type_paid.py
@@ -0,0 +1,28 @@
+from typing import TYPE_CHECKING, Any, Literal
+
+from ..enums import ReactionTypeType
+from .reaction_type import ReactionType
+
+
+class ReactionTypePaid(ReactionType):
+ """
+ The reaction is paid.
+
+ Source: https://core.telegram.org/bots/api#reactiontypepaid
+ """
+
+ type: Literal["paid"] = "paid"
+ """Type of the reaction, always 'paid'"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__, *, type: Literal["paid"] = "paid", **__pydantic_kwargs: Any
+ ) -> None:
+ # DO NOT EDIT MANUALLY!!!
+ # This method was auto-generated via `butcher`
+ # Is needed only for type checking and IDE support without any additional plugins
+
+ super().__init__(type=type, **__pydantic_kwargs)
diff --git a/aiogram/types/transaction_partner_user.py b/aiogram/types/transaction_partner_user.py
index 4489dc11..260c9a12 100644
--- a/aiogram/types/transaction_partner_user.py
+++ b/aiogram/types/transaction_partner_user.py
@@ -1,11 +1,14 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Any, Literal, Optional
+from typing import TYPE_CHECKING, Any, List, Literal, Optional, Union
from ..enums import TransactionPartnerType
from .transaction_partner import TransactionPartner
if TYPE_CHECKING:
+ from .paid_media_photo import PaidMediaPhoto
+ from .paid_media_preview import PaidMediaPreview
+ from .paid_media_video import PaidMediaVideo
from .user import User
@@ -22,6 +25,8 @@ class TransactionPartnerUser(TransactionPartner):
"""Information about the user"""
invoice_payload: Optional[str] = None
"""*Optional*. Bot-specified invoice payload"""
+ paid_media: Optional[List[Union[PaidMediaPreview, PaidMediaPhoto, PaidMediaVideo]]] = None
+ """*Optional*. Information about the paid media bought by the user"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
@@ -33,6 +38,9 @@ class TransactionPartnerUser(TransactionPartner):
type: Literal[TransactionPartnerType.USER] = TransactionPartnerType.USER,
user: User,
invoice_payload: Optional[str] = None,
+ paid_media: Optional[
+ List[Union[PaidMediaPreview, PaidMediaPhoto, PaidMediaVideo]]
+ ] = None,
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!
@@ -40,5 +48,9 @@ class TransactionPartnerUser(TransactionPartner):
# Is needed only for type checking and IDE support without any additional plugins
super().__init__(
- type=type, user=user, invoice_payload=invoice_payload, **__pydantic_kwargs
+ type=type,
+ user=user,
+ invoice_payload=invoice_payload,
+ paid_media=paid_media,
+ **__pydantic_kwargs,
)
diff --git a/docs/api/methods/create_chat_subscription_invite_link.rst b/docs/api/methods/create_chat_subscription_invite_link.rst
new file mode 100644
index 00000000..9da0261a
--- /dev/null
+++ b/docs/api/methods/create_chat_subscription_invite_link.rst
@@ -0,0 +1,45 @@
+################################
+createChatSubscriptionInviteLink
+################################
+
+Returns: :obj:`ChatInviteLink`
+
+.. automodule:: aiogram.methods.create_chat_subscription_invite_link
+ :members:
+ :member-order: bysource
+ :undoc-members: True
+ :exclude-members: model_config,model_fields
+
+
+Usage
+=====
+
+As bot method
+-------------
+
+.. code-block::
+
+ result: ChatInviteLink = await bot.create_chat_subscription_invite_link(...)
+
+
+Method as object
+----------------
+
+Imports:
+
+- :code:`from aiogram.methods.create_chat_subscription_invite_link import CreateChatSubscriptionInviteLink`
+- alias: :code:`from aiogram.methods import CreateChatSubscriptionInviteLink`
+
+With specific bot
+~~~~~~~~~~~~~~~~~
+
+.. code-block:: python
+
+ result: ChatInviteLink = await bot(CreateChatSubscriptionInviteLink(...))
+
+As reply into Webhook in handler
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. code-block:: python
+
+ return CreateChatSubscriptionInviteLink(...)
diff --git a/docs/api/methods/edit_chat_subscription_invite_link.rst b/docs/api/methods/edit_chat_subscription_invite_link.rst
new file mode 100644
index 00000000..51f9af85
--- /dev/null
+++ b/docs/api/methods/edit_chat_subscription_invite_link.rst
@@ -0,0 +1,45 @@
+##############################
+editChatSubscriptionInviteLink
+##############################
+
+Returns: :obj:`ChatInviteLink`
+
+.. automodule:: aiogram.methods.edit_chat_subscription_invite_link
+ :members:
+ :member-order: bysource
+ :undoc-members: True
+ :exclude-members: model_config,model_fields
+
+
+Usage
+=====
+
+As bot method
+-------------
+
+.. code-block::
+
+ result: ChatInviteLink = await bot.edit_chat_subscription_invite_link(...)
+
+
+Method as object
+----------------
+
+Imports:
+
+- :code:`from aiogram.methods.edit_chat_subscription_invite_link import EditChatSubscriptionInviteLink`
+- alias: :code:`from aiogram.methods import EditChatSubscriptionInviteLink`
+
+With specific bot
+~~~~~~~~~~~~~~~~~
+
+.. code-block:: python
+
+ result: ChatInviteLink = await bot(EditChatSubscriptionInviteLink(...))
+
+As reply into Webhook in handler
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. code-block:: python
+
+ return EditChatSubscriptionInviteLink(...)
diff --git a/docs/api/methods/index.rst b/docs/api/methods/index.rst
index f9de2188..6278f342 100644
--- a/docs/api/methods/index.rst
+++ b/docs/api/methods/index.rst
@@ -44,6 +44,7 @@ Available methods
copy_message
copy_messages
create_chat_invite_link
+ create_chat_subscription_invite_link
create_forum_topic
decline_chat_join_request
delete_chat_photo
@@ -51,6 +52,7 @@ Available methods
delete_forum_topic
delete_my_commands
edit_chat_invite_link
+ edit_chat_subscription_invite_link
edit_forum_topic
edit_general_forum_topic
export_chat_invite_link
diff --git a/docs/api/types/index.rst b/docs/api/types/index.rst
index 1bebbf14..96204ad7 100644
--- a/docs/api/types/index.rst
+++ b/docs/api/types/index.rst
@@ -137,6 +137,7 @@ Available types
reaction_type
reaction_type_custom_emoji
reaction_type_emoji
+ reaction_type_paid
reply_keyboard_markup
reply_keyboard_remove
reply_parameters
diff --git a/docs/api/types/reaction_type_paid.rst b/docs/api/types/reaction_type_paid.rst
new file mode 100644
index 00000000..58a7d058
--- /dev/null
+++ b/docs/api/types/reaction_type_paid.rst
@@ -0,0 +1,10 @@
+################
+ReactionTypePaid
+################
+
+
+.. automodule:: aiogram.types.reaction_type_paid
+ :members:
+ :member-order: bysource
+ :undoc-members: True
+ :exclude-members: model_config,model_fields
diff --git a/scripts/bump_versions.py b/scripts/bump_versions.py
index 84f1f788..2cd37642 100644
--- a/scripts/bump_versions.py
+++ b/scripts/bump_versions.py
@@ -1,3 +1,4 @@
+import json
import re
from pathlib import Path
@@ -35,8 +36,11 @@ def get_package_version() -> str:
def get_telegram_api_version() -> str:
+ path = Path.cwd() / ".butcher" / "schema" / "schema.json"
+ schema = json.loads(path.read_text())
+ version = schema["api"]["version"]
path = Path.cwd() / ".apiversion"
- version = path.read_text().strip()
+ path.write_text(version + "\n")
return version
diff --git a/tests/test_api/test_methods/test_create_chat_subscruption_invite_link.py b/tests/test_api/test_methods/test_create_chat_subscruption_invite_link.py
new file mode 100644
index 00000000..fa40f67b
--- /dev/null
+++ b/tests/test_api/test_methods/test_create_chat_subscruption_invite_link.py
@@ -0,0 +1,32 @@
+from datetime import timedelta
+
+from aiogram.methods import (
+ CreateChatInviteLink,
+ CreateChatSubscriptionInviteLink,
+ Request,
+)
+from aiogram.types import ChatInviteLink, User
+from tests.mocked_bot import MockedBot
+
+
+class TestCreateChatSubscriptionInviteLink:
+ async def test_bot_method(self, bot: MockedBot):
+ prepare_result = bot.add_result_for(
+ CreateChatSubscriptionInviteLink,
+ ok=True,
+ result=ChatInviteLink(
+ invite_link="https://t.me/username",
+ creator=User(id=42, is_bot=False, first_name="User"),
+ is_primary=False,
+ is_revoked=False,
+ creates_join_request=False,
+ ),
+ )
+
+ response: ChatInviteLink = await bot.create_chat_subscription_invite_link(
+ chat_id=-42,
+ subscription_period=timedelta(days=30),
+ subscription_price=42,
+ )
+ request = bot.get_request()
+ assert response == prepare_result.result
diff --git a/tests/test_api/test_methods/test_edit_chat_subscruption_invite_link.py b/tests/test_api/test_methods/test_edit_chat_subscruption_invite_link.py
new file mode 100644
index 00000000..90be9c23
--- /dev/null
+++ b/tests/test_api/test_methods/test_edit_chat_subscruption_invite_link.py
@@ -0,0 +1,33 @@
+from datetime import timedelta
+
+from aiogram.methods import (
+ CreateChatInviteLink,
+ CreateChatSubscriptionInviteLink,
+ EditChatSubscriptionInviteLink,
+ Request,
+)
+from aiogram.types import ChatInviteLink, User
+from tests.mocked_bot import MockedBot
+
+
+class TestEditChatSubscriptionInviteLink:
+ async def test_bot_method(self, bot: MockedBot):
+ prepare_result = bot.add_result_for(
+ EditChatSubscriptionInviteLink,
+ ok=True,
+ result=ChatInviteLink(
+ invite_link="https://t.me/username",
+ creator=User(id=42, is_bot=False, first_name="User"),
+ is_primary=False,
+ is_revoked=False,
+ creates_join_request=False,
+ ),
+ )
+
+ response: ChatInviteLink = await bot.edit_chat_subscription_invite_link(
+ chat_id=-42,
+ invite_link="https://t.me/username/test",
+ name="test",
+ )
+ request = bot.get_request()
+ assert response == prepare_result.result
diff --git a/tests/test_dispatcher/test_middlewares/test_user_context.py b/tests/test_dispatcher/test_middlewares/test_user_context.py
index 3fc87eac..124bee61 100644
--- a/tests/test_dispatcher/test_middlewares/test_user_context.py
+++ b/tests/test_dispatcher/test_middlewares/test_user_context.py
@@ -1,5 +1,5 @@
-from unittest.mock import patch
from datetime import datetime
+from unittest.mock import patch
import pytest
@@ -9,13 +9,13 @@ from aiogram.dispatcher.middlewares.user_context import (
)
from aiogram.types import (
Chat,
- Update,
- User,
- ChatBoostUpdated,
ChatBoost,
- ChatBoostSourcePremium,
ChatBoostSourceGiftCode,
ChatBoostSourceGiveaway,
+ ChatBoostSourcePremium,
+ ChatBoostUpdated,
+ Update,
+ User,
)