Added full support of Bot API 7.9 (#1560)

* Added full support of Bot API 7.9

* Added changelog

* Try to fix towncrier

* Fixed towncrier check
This commit is contained in:
Alex Root Junior 2024-08-16 00:44:40 +03:00 committed by GitHub
parent 1c323ecc97
commit c3a08664d3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
48 changed files with 817 additions and 114 deletions

View file

@ -1 +1 @@
7.8 7.9

View file

@ -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": "<p>Use this method to create a <a href=\"https://telegram.org/blog/superchannels-star-reactions-subscriptions#star-subscriptions\">subscription invite link</a> for a channel chat. The bot must have the <em>can_invite_users</em> administrator rights. The link can be edited using the method <a href=\"#editchatsubscriptioninvitelink\">editChatSubscriptionInviteLink</a> or revoked using the method <a href=\"#revokechatinvitelink\">revokeChatInviteLink</a>. Returns the new invite link as a <a href=\"#chatinvitelink\">ChatInviteLink</a> object.</p>",
"rst_description": "Use this method to create a `subscription invite link <https://telegram.org/blog/superchannels-star-reactions-subscriptions#star-subscriptions>`_ 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": "<td>Unique identifier for the target channel chat or username of the target channel (in the format <code>@channelusername</code>)</td>",
"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": "<td>Invite link name; 0-32 characters</td>",
"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": "<td>The number of seconds the subscription will be active for before the next payment. Currently, it must always be 2592000 (30 days).</td>",
"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": "<td>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</td>",
"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"
}
}

View file

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

View file

@ -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": "<p>Use this method to edit a subscription invite link created by the bot. The bot must have the <em>can_invite_users</em> administrator rights. Returns the edited invite link as a <a href=\"#chatinvitelink\">ChatInviteLink</a> object.</p>",
"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": "<td>Unique identifier for the target chat or username of the target channel (in the format <code>@channelusername</code>)</td>",
"rst_description": "Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)\n",
"name": "chat_id"
},
{
"type": "String",
"required": true,
"description": "The invite link to edit",
"html_description": "<td>The invite link to edit</td>",
"rst_description": "The invite link to edit\n",
"name": "invite_link"
},
{
"type": "String",
"required": false,
"description": "Invite link name; 0-32 characters",
"html_description": "<td>Invite link name; 0-32 characters</td>",
"rst_description": "Invite link name; 0-32 characters\n",
"name": "name"
}
],
"category": "methods"
}
}

View file

@ -7,9 +7,9 @@
"object": { "object": {
"anchor": "editforumtopic", "anchor": "editforumtopic",
"name": "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.", "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": "<p>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 <em>can_manage_topics</em> administrator rights, unless it is the creator of the topic. Returns <em>True</em> on success.</p>", "html_description": "<p>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 <em>can_manage_topics</em> administrator rights, unless it is the creator of the topic. Returns <em>True</em> on success.</p>",
"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.", "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": [ "annotations": [
{ {
"type": "Integer or String", "type": "Integer or String",

View file

@ -7,9 +7,9 @@
"object": { "object": {
"anchor": "editgeneralforumtopic", "anchor": "editgeneralforumtopic",
"name": "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.", "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": "<p>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 <em>can_manage_topics</em> administrator rights. Returns <em>True</em> on success.</p>", "html_description": "<p>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 <em>can_manage_topics</em> administrator rights. Returns <em>True</em> on success.</p>",
"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.", "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": [ "annotations": [
{ {
"type": "Integer or String", "type": "Integer or String",

View file

@ -7,16 +7,24 @@
"object": { "object": {
"anchor": "sendpaidmedia", "anchor": "sendpaidmedia",
"name": "sendPaidMedia", "name": "sendPaidMedia",
"description": "Use this method to send paid media to channel chats. On success, the sent Message is returned.", "description": "Use this method to send paid media. On success, the sent Message is returned.",
"html_description": "<p>Use this method to send paid media to channel chats. On success, the sent <a href=\"#message\">Message</a> is returned.</p>", "html_description": "<p>Use this method to send paid media. On success, the sent <a href=\"#message\">Message</a> is returned.</p>",
"rst_description": "Use this method to send paid media to channel chats. On success, the sent :class:`aiogram.types.message.Message` is returned.", "rst_description": "Use this method to send paid media. On success, the sent :class:`aiogram.types.message.Message` is returned.",
"annotations": [ "annotations": [
{
"type": "String",
"required": false,
"description": "Unique identifier of the business connection on behalf of which the message will be sent",
"html_description": "<td>Unique identifier of the business connection on behalf of which the message will be sent</td>",
"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", "type": "Integer or String",
"required": true, "required": true,
"description": "Unique identifier for the target chat or username of the target channel (in the format @channelusername)", "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": "<td>Unique identifier for the target chat or username of the target channel (in the format <code>@channelusername</code>)</td>", "html_description": "<td>Unique identifier for the target chat or username of the target channel (in the format <code>@channelusername</code>). 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.</td>",
"rst_description": "Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)\n", "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" "name": "chat_id"
}, },
{ {

View file

@ -7,9 +7,9 @@
"object": { "object": {
"anchor": "setmessagereaction", "anchor": "setmessagereaction",
"name": "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.", "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": "<p>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 <em>True</em> on success.</p>", "html_description": "<p>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 <em>True</em> on success.</p>",
"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.", "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": [ "annotations": [
{ {
"type": "Integer or String", "type": "Integer or String",
@ -30,9 +30,9 @@
{ {
"type": "Array of ReactionType", "type": "Array of ReactionType",
"required": false, "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.", "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": "<td>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.</td>", "html_description": "<td>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.</td>",
"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", "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" "name": "reaction"
}, },
{ {

View file

@ -1,7 +1,7 @@
{ {
"api": { "api": {
"version": "7.8", "version": "7.9",
"release_date": "2024-07-31" "release_date": "2024-08-14"
}, },
"items": [ "items": [
{ {
@ -993,17 +993,17 @@
}, },
{ {
"type": "User", "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.", "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": "<td><em>Optional</em>. 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.</td>", "html_description": "<td><em>Optional</em>. 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</td>",
"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", "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", "name": "from",
"required": false "required": false
}, },
{ {
"type": "Chat", "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.", "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": "<td><em>Optional</em>. 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 <em>from</em> contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat.</td>", "html_description": "<td><em>Optional</em>. 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 <em>from</em> contains a fake sender user in non-channel chats.</td>",
"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", "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", "name": "sender_chat",
"required": false "required": false
}, },
@ -5572,6 +5572,14 @@
"rst_description": "Information about the user\n", "rst_description": "Information about the user\n",
"name": "user", "name": "user",
"required": true "required": true
},
{
"type": "Integer",
"description": "Date when the user's subscription will expire; Unix time",
"html_description": "<td><em>Optional</em>. Date when the user's subscription will expire; Unix time</td>",
"rst_description": "*Optional*. Date when the user's subscription will expire; Unix time\n",
"name": "until_date",
"required": false
} }
], ],
"category": "types" "category": "types"
@ -6145,9 +6153,9 @@
{ {
"anchor": "reactiontype", "anchor": "reactiontype",
"name": "ReactionType", "name": "ReactionType",
"description": "This object describes the type of a reaction. Currently, it can be one of\n - ReactionTypeEmoji\n - ReactionTypeCustomEmoji", "description": "This object describes the type of a reaction. Currently, it can be one of\n - ReactionTypeEmoji\n - ReactionTypeCustomEmoji\n - ReactionTypePaid",
"html_description": "<p>This object describes the type of a reaction. Currently, it can be one of</p><ul>\n<li><a href=\"#reactiontypeemoji\">ReactionTypeEmoji</a></li>\n<li><a href=\"#reactiontypecustomemoji\">ReactionTypeCustomEmoji</a></li>\n</ul>", "html_description": "<p>This object describes the type of a reaction. Currently, it can be one of</p><ul>\n<li><a href=\"#reactiontypeemoji\">ReactionTypeEmoji</a></li>\n<li><a href=\"#reactiontypecustomemoji\">ReactionTypeCustomEmoji</a></li>\n<li><a href=\"#reactiontypepaid\">ReactionTypePaid</a></li>\n</ul>",
"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`", "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": [], "annotations": [],
"category": "types" "category": "types"
}, },
@ -6203,6 +6211,24 @@
], ],
"category": "types" "category": "types"
}, },
{
"anchor": "reactiontypepaid",
"name": "ReactionTypePaid",
"description": "The reaction is paid.",
"html_description": "<p>The reaction is paid.</p>",
"rst_description": "The reaction is paid.",
"annotations": [
{
"type": "String",
"description": "Type of the reaction, always 'paid'",
"html_description": "<td>Type of the reaction, always &#8220;paid&#8221;</td>",
"rst_description": "Type of the reaction, always 'paid'\n",
"name": "type",
"required": true
}
],
"category": "types"
},
{ {
"anchor": "reactioncount", "anchor": "reactioncount",
"name": "ReactionCount", "name": "ReactionCount",
@ -8940,16 +8966,24 @@
{ {
"anchor": "sendpaidmedia", "anchor": "sendpaidmedia",
"name": "sendPaidMedia", "name": "sendPaidMedia",
"description": "Use this method to send paid media to channel chats. On success, the sent Message is returned.", "description": "Use this method to send paid media. On success, the sent Message is returned.",
"html_description": "<p>Use this method to send paid media to channel chats. On success, the sent <a href=\"#message\">Message</a> is returned.</p>", "html_description": "<p>Use this method to send paid media. On success, the sent <a href=\"#message\">Message</a> is returned.</p>",
"rst_description": "Use this method to send paid media to channel chats. On success, the sent :class:`aiogram.types.message.Message` is returned.", "rst_description": "Use this method to send paid media. On success, the sent :class:`aiogram.types.message.Message` is returned.",
"annotations": [ "annotations": [
{
"type": "String",
"required": false,
"description": "Unique identifier of the business connection on behalf of which the message will be sent",
"html_description": "<td>Unique identifier of the business connection on behalf of which the message will be sent</td>",
"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", "type": "Integer or String",
"required": true, "required": true,
"description": "Unique identifier for the target chat or username of the target channel (in the format @channelusername)", "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": "<td>Unique identifier for the target chat or username of the target channel (in the format <code>@channelusername</code>)</td>", "html_description": "<td>Unique identifier for the target chat or username of the target channel (in the format <code>@channelusername</code>). 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.</td>",
"rst_description": "Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)\n", "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" "name": "chat_id"
}, },
{ {
@ -9788,9 +9822,9 @@
{ {
"anchor": "setmessagereaction", "anchor": "setmessagereaction",
"name": "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.", "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": "<p>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 <em>True</em> on success.</p>", "html_description": "<p>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 <em>True</em> on success.</p>",
"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.", "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": [ "annotations": [
{ {
"type": "Integer or String", "type": "Integer or String",
@ -9811,9 +9845,9 @@
{ {
"type": "Array of ReactionType", "type": "Array of ReactionType",
"required": false, "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.", "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": "<td>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.</td>", "html_description": "<td>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.</td>",
"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", "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" "name": "reaction"
}, },
{ {
@ -10397,6 +10431,82 @@
], ],
"category": "methods" "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": "<p>Use this method to create a <a href=\"https://telegram.org/blog/superchannels-star-reactions-subscriptions#star-subscriptions\">subscription invite link</a> for a channel chat. The bot must have the <em>can_invite_users</em> administrator rights. The link can be edited using the method <a href=\"#editchatsubscriptioninvitelink\">editChatSubscriptionInviteLink</a> or revoked using the method <a href=\"#revokechatinvitelink\">revokeChatInviteLink</a>. Returns the new invite link as a <a href=\"#chatinvitelink\">ChatInviteLink</a> object.</p>",
"rst_description": "Use this method to create a `subscription invite link <https://telegram.org/blog/superchannels-star-reactions-subscriptions#star-subscriptions>`_ 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": "<td>Unique identifier for the target channel chat or username of the target channel (in the format <code>@channelusername</code>)</td>",
"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": "<td>Invite link name; 0-32 characters</td>",
"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": "<td>The number of seconds the subscription will be active for before the next payment. Currently, it must always be 2592000 (30 days).</td>",
"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": "<td>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</td>",
"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": "<p>Use this method to edit a subscription invite link created by the bot. The bot must have the <em>can_invite_users</em> administrator rights. Returns the edited invite link as a <a href=\"#chatinvitelink\">ChatInviteLink</a> object.</p>",
"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": "<td>Unique identifier for the target chat or username of the target channel (in the format <code>@channelusername</code>)</td>",
"rst_description": "Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)\n",
"name": "chat_id"
},
{
"type": "String",
"required": true,
"description": "The invite link to edit",
"html_description": "<td>The invite link to edit</td>",
"rst_description": "The invite link to edit\n",
"name": "invite_link"
},
{
"type": "String",
"required": false,
"description": "Invite link name; 0-32 characters",
"html_description": "<td>Invite link name; 0-32 characters</td>",
"rst_description": "Invite link name; 0-32 characters\n",
"name": "name"
}
],
"category": "methods"
},
{ {
"anchor": "revokechatinvitelink", "anchor": "revokechatinvitelink",
"name": "revokeChatInviteLink", "name": "revokeChatInviteLink",
@ -10861,9 +10971,9 @@
{ {
"anchor": "editforumtopic", "anchor": "editforumtopic",
"name": "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.", "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": "<p>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 <em>can_manage_topics</em> administrator rights, unless it is the creator of the topic. Returns <em>True</em> on success.</p>", "html_description": "<p>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 <em>can_manage_topics</em> administrator rights, unless it is the creator of the topic. Returns <em>True</em> on success.</p>",
"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.", "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": [ "annotations": [
{ {
"type": "Integer or String", "type": "Integer or String",
@ -11007,9 +11117,9 @@
{ {
"anchor": "editgeneralforumtopic", "anchor": "editgeneralforumtopic",
"name": "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.", "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": "<p>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 <em>can_manage_topics</em> administrator rights. Returns <em>True</em> on success.</p>", "html_description": "<p>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 <em>can_manage_topics</em> administrator rights. Returns <em>True</em> on success.</p>",
"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.", "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": [ "annotations": [
{ {
"type": "Integer or String", "type": "Integer or String",
@ -16586,6 +16696,14 @@
"rst_description": "*Optional*. Bot-specified invoice payload\n", "rst_description": "*Optional*. Bot-specified invoice payload\n",
"name": "invoice_payload", "name": "invoice_payload",
"required": false "required": false
},
{
"type": "Array of PaidMedia",
"description": "Information about the paid media bought by the user",
"html_description": "<td><em>Optional</em>. Information about the paid media bought by the user</td>",
"rst_description": "*Optional*. Information about the paid media bought by the user\n",
"name": "paid_media",
"required": false
} }
], ],
"category": "types" "category": "types"

View file

@ -26,6 +26,14 @@
"rst_description": "Information about the user\n", "rst_description": "Information about the user\n",
"name": "user", "name": "user",
"required": true "required": true
},
{
"type": "Integer",
"description": "Date when the user's subscription will expire; Unix time",
"html_description": "<td><em>Optional</em>. Date when the user's subscription will expire; Unix time</td>",
"rst_description": "*Optional*. Date when the user's subscription will expire; Unix time\n",
"name": "until_date",
"required": false
} }
], ],
"category": "types" "category": "types"

View file

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

View file

@ -29,17 +29,17 @@
}, },
{ {
"type": "User", "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.", "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": "<td><em>Optional</em>. 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.</td>", "html_description": "<td><em>Optional</em>. 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</td>",
"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", "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", "name": "from",
"required": false "required": false
}, },
{ {
"type": "Chat", "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.", "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": "<td><em>Optional</em>. 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 <em>from</em> contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat.</td>", "html_description": "<td><em>Optional</em>. 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 <em>from</em> contains a fake sender user in non-channel chats.</td>",
"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", "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", "name": "sender_chat",
"required": false "required": false
}, },

View file

@ -7,9 +7,9 @@
"object": { "object": {
"anchor": "reactiontype", "anchor": "reactiontype",
"name": "ReactionType", "name": "ReactionType",
"description": "This object describes the type of a reaction. Currently, it can be one of\n - ReactionTypeEmoji\n - ReactionTypeCustomEmoji", "description": "This object describes the type of a reaction. Currently, it can be one of\n - ReactionTypeEmoji\n - ReactionTypeCustomEmoji\n - ReactionTypePaid",
"html_description": "<p>This object describes the type of a reaction. Currently, it can be one of</p><ul>\n<li><a href=\"#reactiontypeemoji\">ReactionTypeEmoji</a></li>\n<li><a href=\"#reactiontypecustomemoji\">ReactionTypeCustomEmoji</a></li>\n</ul>", "html_description": "<p>This object describes the type of a reaction. Currently, it can be one of</p><ul>\n<li><a href=\"#reactiontypeemoji\">ReactionTypeEmoji</a></li>\n<li><a href=\"#reactiontypecustomemoji\">ReactionTypeCustomEmoji</a></li>\n<li><a href=\"#reactiontypepaid\">ReactionTypePaid</a></li>\n</ul>",
"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`", "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": [], "annotations": [],
"category": "types" "category": "types"
} }

View file

@ -0,0 +1,25 @@
{
"meta": {},
"group": {
"title": "Available types",
"anchor": "available-types"
},
"object": {
"anchor": "reactiontypepaid",
"name": "ReactionTypePaid",
"description": "The reaction is paid.",
"html_description": "<p>The reaction is paid.</p>",
"rst_description": "The reaction is paid.",
"annotations": [
{
"type": "String",
"description": "Type of the reaction, always 'paid'",
"html_description": "<td>Type of the reaction, always &#8220;paid&#8221;</td>",
"rst_description": "Type of the reaction, always 'paid'\n",
"name": "type",
"required": true
}
],
"category": "types"
}
}

View file

@ -34,6 +34,14 @@
"rst_description": "*Optional*. Bot-specified invoice payload\n", "rst_description": "*Optional*. Bot-specified invoice payload\n",
"name": "invoice_payload", "name": "invoice_payload",
"required": false "required": false
},
{
"type": "Array of PaidMedia",
"description": "Information about the paid media bought by the user",
"html_description": "<td><em>Optional</em>. Information about the paid media bought by the user</td>",
"rst_description": "*Optional*. Information about the paid media bought by the user\n",
"name": "paid_media",
"required": false
} }
], ],
"category": "types" "category": "types"

View file

@ -22,10 +22,10 @@ jobs:
- name: Set up Python 3.10 - name: Set up Python 3.10
uses: actions/setup-python@v5 uses: actions/setup-python@v5
with: with:
python-version: "3.10" python-version: "3.12"
- name: Install towncrier - name: Install towncrier
run: pip install towncrier run: pip install -U towncrier
- name: Check changelog - name: Check changelog
env: env:
@ -36,7 +36,7 @@ jobs:
- name: Find bot comment - name: Find bot comment
if: "always()" if: "always()"
uses: peter-evans/find-comment@v2 uses: peter-evans/find-comment@v3
id: fc id: fc
with: with:
issue-number: ${{ github.event.pull_request.number }} issue-number: ${{ github.event.pull_request.number }}
@ -45,7 +45,7 @@ jobs:
- name: Ask for changelog - name: Ask for changelog
if: "failure()" if: "failure()"
uses: peter-evans/create-or-update-comment@v2 uses: peter-evans/create-or-update-comment@v4
with: with:
edit-mode: replace edit-mode: replace
comment-id: ${{ steps.fc.outputs.comment-id }} comment-id: ${{ steps.fc.outputs.comment-id }}
@ -65,7 +65,7 @@ jobs:
- name: Changelog found - name: Changelog found
if: "success()" if: "success()"
uses: peter-evans/create-or-update-comment@v2 uses: peter-evans/create-or-update-comment@v4
with: with:
edit-mode: replace edit-mode: replace
comment-id: ${{ steps.fc.outputs.comment-id }} comment-id: ${{ steps.fc.outputs.comment-id }}
@ -80,7 +80,7 @@ jobs:
if: "contains(github.event.pull_request.labels.*.name, 'skip news')" if: "contains(github.event.pull_request.labels.*.name, 'skip news')"
steps: steps:
- name: Find bot comment - name: Find bot comment
uses: peter-evans/find-comment@v2 uses: peter-evans/find-comment@v3
id: fc id: fc
with: with:
issue-number: ${{ github.event.pull_request.number }} issue-number: ${{ github.event.pull_request.number }}
@ -88,7 +88,7 @@ jobs:
body-includes: Changelog body-includes: Changelog
- name: Comment when docs is not needed - name: Comment when docs is not needed
uses: peter-evans/create-or-update-comment@v2 uses: peter-evans/create-or-update-comment@v4
with: with:
edit-mode: replace edit-mode: replace
comment-id: ${{ steps.fc.outputs.comment-id }} comment-id: ${{ steps.fc.outputs.comment-id }}

19
CHANGES/1560.feature.rst Normal file
View file

@ -0,0 +1,19 @@
Added full support of `Bot API 7.8 <https://core.telegram.org/bots/api-changelog#august-14-2024>`_
- Added the ability to send paid media to any chat.
- Added the parameter :code:`business_connection_id` to the method
:class:`aiogram.methods.send_paid_media.SendPaidMedia`,
allowing bots to send paid media on behalf of a business account.
- Added the field :code:`paid_media` to the class
:class:`aiogram.types.transaction_partner_user.TransactionPartnerUser`
for transactions involving paid media.
- Added the method
:class:`aiogram.methods.create_chat_subscription_invite_link.CreateChatSubscriptionInviteLink`,
allowing bots to create subscription invite links.
- Added the method
:class:`aiogram.methods.edit_chat_subscription_invite_link.EditChatSubscriptionInviteLink`,
allowing bots to edit the name of subscription invite links.
- Added the field :code:`until_date` to the class
:class:`aiogram.types.chat_member_member.ChatMemberMember` for members with an active subscription.
- Added support for paid reactions and the class
:class:`aiogram.types.reaction_type_paid.ReactionTypePaid`.

View file

@ -102,9 +102,14 @@ build: clean
.PHONY: bump .PHONY: bump
bump: bump:
hatch version $(args) hatch version $(args)
cat .butcher/schema/schema.json | jq '.api.version' -r > .apiversion
python scripts/bump_versions.py python scripts/bump_versions.py
update-api:
butcher parse
butcher refresh
butcher apply all
@$(MAKE) bump
.PHONY: towncrier-build .PHONY: towncrier-build
towncrier-build: towncrier-build:
hatch run docs:towncrier build --yes hatch run docs:towncrier build --yes

View file

@ -52,7 +52,7 @@ Features
- Asynchronous (`asyncio docs <https://docs.python.org/3/library/asyncio.html>`_, :pep:`492`) - Asynchronous (`asyncio docs <https://docs.python.org/3/library/asyncio.html>`_, :pep:`492`)
- Has type hints (:pep:`484`) and can be used with `mypy <http://mypy-lang.org/>`_ - Has type hints (:pep:`484`) and can be used with `mypy <http://mypy-lang.org/>`_
- Supports `PyPy <https://www.pypy.org/>`_ - Supports `PyPy <https://www.pypy.org/>`_
- Supports `Telegram Bot API 7.8 <https://core.telegram.org/bots/api>`_ and gets fast updates to the latest versions of the Bot API - Supports `Telegram Bot API 7.9 <https://core.telegram.org/bots/api>`_ and gets fast updates to the latest versions of the Bot API
- Telegram Bot API integration code was `autogenerated <https://github.com/aiogram/tg-codegen>`_ and can be easily re-generated when API gets updated - Telegram Bot API integration code was `autogenerated <https://github.com/aiogram/tg-codegen>`_ and can be easily re-generated when API gets updated
- Updates router (Blueprints) - Updates router (Blueprints)
- Has Finite State Machine - Has Finite State Machine

View file

@ -1,2 +1,2 @@
__version__ = "3.11.0" __version__ = "3.11.0"
__api_version__ = "7.8" __api_version__ = "7.9"

View file

@ -38,6 +38,7 @@ from ..methods import (
CopyMessage, CopyMessage,
CopyMessages, CopyMessages,
CreateChatInviteLink, CreateChatInviteLink,
CreateChatSubscriptionInviteLink,
CreateForumTopic, CreateForumTopic,
CreateInvoiceLink, CreateInvoiceLink,
CreateNewStickerSet, CreateNewStickerSet,
@ -52,6 +53,7 @@ from ..methods import (
DeleteStickerSet, DeleteStickerSet,
DeleteWebhook, DeleteWebhook,
EditChatInviteLink, EditChatInviteLink,
EditChatSubscriptionInviteLink,
EditForumTopic, EditForumTopic,
EditGeneralForumTopic, EditGeneralForumTopic,
EditMessageCaption, EditMessageCaption,
@ -230,6 +232,7 @@ from ..types import (
Poll, Poll,
ReactionTypeCustomEmoji, ReactionTypeCustomEmoji,
ReactionTypeEmoji, ReactionTypeEmoji,
ReactionTypePaid,
ReplyKeyboardMarkup, ReplyKeyboardMarkup,
ReplyKeyboardRemove, ReplyKeyboardRemove,
ReplyParameters, ReplyParameters,
@ -1325,7 +1328,7 @@ class Bot:
request_timeout: Optional[int] = None, request_timeout: Optional[int] = None,
) -> bool: ) -> 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 Source: https://core.telegram.org/bots/api#editforumtopic
@ -4013,7 +4016,7 @@ class Bot:
request_timeout: Optional[int] = None, request_timeout: Optional[int] = None,
) -> bool: ) -> 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 Source: https://core.telegram.org/bots/api#editgeneralforumtopic
@ -4525,18 +4528,20 @@ class Bot:
self, self,
chat_id: Union[int, str], chat_id: Union[int, str],
message_id: int, message_id: int,
reaction: Optional[List[Union[ReactionTypeEmoji, ReactionTypeCustomEmoji]]] = None, reaction: Optional[
List[Union[ReactionTypeEmoji, ReactionTypeCustomEmoji, ReactionTypePaid]]
] = None,
is_big: Optional[bool] = None, is_big: Optional[bool] = None,
request_timeout: Optional[int] = None, request_timeout: Optional[int] = None,
) -> bool: ) -> 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 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 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 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 is_big: Pass :code:`True` to set the reaction with a big animation
:param request_timeout: Request timeout :param request_timeout: Request timeout
:return: Returns :code:`True` on success. :return: Returns :code:`True` on success.
@ -4650,6 +4655,7 @@ class Bot:
chat_id: Union[int, str], chat_id: Union[int, str],
star_count: int, star_count: int,
media: List[Union[InputPaidMediaPhoto, InputPaidMediaVideo]], media: List[Union[InputPaidMediaPhoto, InputPaidMediaVideo]],
business_connection_id: Optional[str] = None,
caption: Optional[str] = None, caption: Optional[str] = None,
parse_mode: Optional[str] = None, parse_mode: Optional[str] = None,
caption_entities: Optional[List[MessageEntity]] = None, caption_entities: Optional[List[MessageEntity]] = None,
@ -4663,13 +4669,14 @@ class Bot:
request_timeout: Optional[int] = None, request_timeout: Optional[int] = None,
) -> Message: ) -> 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 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 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 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 caption: Media caption, 0-1024 characters after entities parsing
:param parse_mode: Mode for parsing entities in the media caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details. :param parse_mode: Mode for parsing entities in the media caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details.
:param caption_entities: A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode* :param 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, chat_id=chat_id,
star_count=star_count, star_count=star_count,
media=media, media=media,
business_connection_id=business_connection_id,
caption=caption, caption=caption,
parse_mode=parse_mode, parse_mode=parse_mode,
caption_entities=caption_entities, caption_entities=caption_entities,
@ -4696,3 +4704,58 @@ class Bot:
reply_markup=reply_markup, reply_markup=reply_markup,
) )
return await self(call, request_timeout=request_timeout) 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 <https://telegram.org/blog/superchannels-star-reactions-subscriptions#star-subscriptions>`_ 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)

View file

@ -14,6 +14,7 @@ from .close_general_forum_topic import CloseGeneralForumTopic
from .copy_message import CopyMessage from .copy_message import CopyMessage
from .copy_messages import CopyMessages from .copy_messages import CopyMessages
from .create_chat_invite_link import CreateChatInviteLink from .create_chat_invite_link import CreateChatInviteLink
from .create_chat_subscription_invite_link import CreateChatSubscriptionInviteLink
from .create_forum_topic import CreateForumTopic from .create_forum_topic import CreateForumTopic
from .create_invoice_link import CreateInvoiceLink from .create_invoice_link import CreateInvoiceLink
from .create_new_sticker_set import CreateNewStickerSet 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_sticker_set import DeleteStickerSet
from .delete_webhook import DeleteWebhook from .delete_webhook import DeleteWebhook
from .edit_chat_invite_link import EditChatInviteLink from .edit_chat_invite_link import EditChatInviteLink
from .edit_chat_subscription_invite_link import EditChatSubscriptionInviteLink
from .edit_forum_topic import EditForumTopic from .edit_forum_topic import EditForumTopic
from .edit_general_forum_topic import EditGeneralForumTopic from .edit_general_forum_topic import EditGeneralForumTopic
from .edit_message_caption import EditMessageCaption from .edit_message_caption import EditMessageCaption
@ -140,6 +142,7 @@ __all__ = (
"CopyMessage", "CopyMessage",
"CopyMessages", "CopyMessages",
"CreateChatInviteLink", "CreateChatInviteLink",
"CreateChatSubscriptionInviteLink",
"CreateForumTopic", "CreateForumTopic",
"CreateInvoiceLink", "CreateInvoiceLink",
"CreateNewStickerSet", "CreateNewStickerSet",
@ -154,6 +157,7 @@ __all__ = (
"DeleteStickerSet", "DeleteStickerSet",
"DeleteWebhook", "DeleteWebhook",
"EditChatInviteLink", "EditChatInviteLink",
"EditChatSubscriptionInviteLink",
"EditForumTopic", "EditForumTopic",
"EditGeneralForumTopic", "EditGeneralForumTopic",
"EditMessageCaption", "EditMessageCaption",

View file

@ -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 <https://telegram.org/blog/superchannels-star-reactions-subscriptions#star-subscriptions>`_ 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,
)

View file

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

View file

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

View file

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

View file

@ -18,7 +18,7 @@ from .base import TelegramMethod
class SendPaidMedia(TelegramMethod[Message]): 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 Source: https://core.telegram.org/bots/api#sendpaidmedia
""" """
@ -27,11 +27,13 @@ class SendPaidMedia(TelegramMethod[Message]):
__api_method__ = "sendPaidMedia" __api_method__ = "sendPaidMedia"
chat_id: Union[int, str] 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 star_count: int
"""The number of Telegram Stars that must be paid to buy access to the media""" """The number of Telegram Stars that must be paid to buy access to the media"""
media: List[Union[InputPaidMediaPhoto, InputPaidMediaVideo]] media: List[Union[InputPaidMediaPhoto, InputPaidMediaVideo]]
"""A JSON-serialized array describing the media to be sent; up to 10 items""" """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 caption: Optional[str] = None
"""Media caption, 0-1024 characters after entities parsing""" """Media caption, 0-1024 characters after entities parsing"""
parse_mode: Optional[str] = None parse_mode: Optional[str] = None
@ -61,6 +63,7 @@ class SendPaidMedia(TelegramMethod[Message]):
chat_id: Union[int, str], chat_id: Union[int, str],
star_count: int, star_count: int,
media: List[Union[InputPaidMediaPhoto, InputPaidMediaVideo]], media: List[Union[InputPaidMediaPhoto, InputPaidMediaVideo]],
business_connection_id: Optional[str] = None,
caption: Optional[str] = None, caption: Optional[str] = None,
parse_mode: Optional[str] = None, parse_mode: Optional[str] = None,
caption_entities: Optional[List[MessageEntity]] = None, caption_entities: Optional[List[MessageEntity]] = None,
@ -81,6 +84,7 @@ class SendPaidMedia(TelegramMethod[Message]):
chat_id=chat_id, chat_id=chat_id,
star_count=star_count, star_count=star_count,
media=media, media=media,
business_connection_id=business_connection_id,
caption=caption, caption=caption,
parse_mode=parse_mode, parse_mode=parse_mode,
caption_entities=caption_entities, caption_entities=caption_entities,

View file

@ -1,12 +1,12 @@
from typing import TYPE_CHECKING, Any, List, Optional, Union from typing import TYPE_CHECKING, Any, List, Optional, Union
from ..types import ReactionTypeCustomEmoji, ReactionTypeEmoji from ..types import ReactionTypeCustomEmoji, ReactionTypeEmoji, ReactionTypePaid
from .base import TelegramMethod from .base import TelegramMethod
class SetMessageReaction(TelegramMethod[bool]): 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 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`)""" """Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
message_id: int message_id: int
"""Identifier of the target message. If the message belongs to a media group, the reaction is set to the first non-deleted message in the group instead.""" """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 reaction: Optional[
"""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.""" 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 is_big: Optional[bool] = None
"""Pass :code:`True` to set the reaction with a big animation""" """Pass :code:`True` to set the reaction with a big animation"""
@ -32,7 +34,9 @@ class SetMessageReaction(TelegramMethod[bool]):
*, *,
chat_id: Union[int, str], chat_id: Union[int, str],
message_id: int, message_id: int,
reaction: Optional[List[Union[ReactionTypeEmoji, ReactionTypeCustomEmoji]]] = None, reaction: Optional[
List[Union[ReactionTypeEmoji, ReactionTypeCustomEmoji, ReactionTypePaid]]
] = None,
is_big: Optional[bool] = None, is_big: Optional[bool] = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:

View file

@ -187,6 +187,7 @@ from .reaction_count import ReactionCount
from .reaction_type import ReactionType from .reaction_type import ReactionType
from .reaction_type_custom_emoji import ReactionTypeCustomEmoji from .reaction_type_custom_emoji import ReactionTypeCustomEmoji
from .reaction_type_emoji import ReactionTypeEmoji from .reaction_type_emoji import ReactionTypeEmoji
from .reaction_type_paid import ReactionTypePaid
from .refunded_payment import RefundedPayment from .refunded_payment import RefundedPayment
from .reply_keyboard_markup import ReplyKeyboardMarkup from .reply_keyboard_markup import ReplyKeyboardMarkup
from .reply_keyboard_remove import ReplyKeyboardRemove from .reply_keyboard_remove import ReplyKeyboardRemove
@ -419,6 +420,7 @@ __all__ = (
"ReactionType", "ReactionType",
"ReactionTypeCustomEmoji", "ReactionTypeCustomEmoji",
"ReactionTypeEmoji", "ReactionTypeEmoji",
"ReactionTypePaid",
"RefundedPayment", "RefundedPayment",
"ReplyKeyboardMarkup", "ReplyKeyboardMarkup",
"ReplyKeyboardRemove", "ReplyKeyboardRemove",

View file

@ -50,6 +50,7 @@ if TYPE_CHECKING:
from .message import Message from .message import Message
from .reaction_type_custom_emoji import ReactionTypeCustomEmoji from .reaction_type_custom_emoji import ReactionTypeCustomEmoji
from .reaction_type_emoji import ReactionTypeEmoji from .reaction_type_emoji import ReactionTypeEmoji
from .reaction_type_paid import ReactionTypePaid
class Chat(TelegramObject): class Chat(TelegramObject):
@ -83,9 +84,9 @@ class Chat(TelegramObject):
.. deprecated:: API:7.3 .. deprecated:: API:7.3
https://core.telegram.org/bots/api-changelog#may-6-2024""" https://core.telegram.org/bots/api-changelog#may-6-2024"""
available_reactions: Optional[List[Union[ReactionTypeEmoji, ReactionTypeCustomEmoji]]] = Field( available_reactions: Optional[
None, json_schema_extra={"deprecated": True} 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 <https://core.telegram.org/bots/api#reactiontypeemoji>`_ are allowed. Returned only in :class:`aiogram.methods.get_chat.GetChat`. """*Optional*. List of available reactions allowed in the chat. If omitted, then all `emoji reactions <https://core.telegram.org/bots/api#reactiontypeemoji>`_ are allowed. Returned only in :class:`aiogram.methods.get_chat.GetChat`.
.. deprecated:: API:7.3 .. deprecated:: API:7.3
@ -284,7 +285,7 @@ class Chat(TelegramObject):
accent_color_id: Optional[int] = None, accent_color_id: Optional[int] = None,
active_usernames: Optional[List[str]] = None, active_usernames: Optional[List[str]] = None,
available_reactions: Optional[ available_reactions: Optional[
List[Union[ReactionTypeEmoji, ReactionTypeCustomEmoji]] List[Union[ReactionTypeEmoji, ReactionTypeCustomEmoji, ReactionTypePaid]]
] = None, ] = None,
background_custom_emoji_id: Optional[str] = None, background_custom_emoji_id: Optional[str] = None,
bio: Optional[str] = None, bio: Optional[str] = None,

View file

@ -16,6 +16,7 @@ if TYPE_CHECKING:
from .message import Message from .message import Message
from .reaction_type_custom_emoji import ReactionTypeCustomEmoji from .reaction_type_custom_emoji import ReactionTypeCustomEmoji
from .reaction_type_emoji import ReactionTypeEmoji from .reaction_type_emoji import ReactionTypeEmoji
from .reaction_type_paid import ReactionTypePaid
class ChatFullInfo(Chat): class ChatFullInfo(Chat):
@ -57,7 +58,9 @@ class ChatFullInfo(Chat):
"""*Optional*. For private chats with business accounts, the opening hours of the business""" """*Optional*. For private chats with business accounts, the opening hours of the business"""
personal_chat: Optional[Chat] = None personal_chat: Optional[Chat] = None
"""*Optional*. For private chats, the personal channel of the user""" """*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 <https://core.telegram.org/bots/api#reactiontypeemoji>`_ are allowed.""" """*Optional*. List of available reactions allowed in the chat. If omitted, then all `emoji reactions <https://core.telegram.org/bots/api#reactiontypeemoji>`_ are allowed."""
background_custom_emoji_id: Optional[str] = None 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""" """*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, business_opening_hours: Optional[BusinessOpeningHours] = None,
personal_chat: Optional[Chat] = None, personal_chat: Optional[Chat] = None,
available_reactions: Optional[ available_reactions: Optional[
List[Union[ReactionTypeEmoji, ReactionTypeCustomEmoji]] List[Union[ReactionTypeEmoji, ReactionTypeCustomEmoji, ReactionTypePaid]]
] = None, ] = None,
background_custom_emoji_id: Optional[str] = None, background_custom_emoji_id: Optional[str] = None,
profile_accent_color_id: Optional[int] = None, profile_accent_color_id: Optional[int] = None,

View file

@ -1,9 +1,10 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Literal from typing import TYPE_CHECKING, Any, Literal, Optional
from ..enums import ChatMemberStatus from ..enums import ChatMemberStatus
from .chat_member import ChatMember from .chat_member import ChatMember
from .custom import DateTime
if TYPE_CHECKING: if TYPE_CHECKING:
from .user import User from .user import User
@ -20,6 +21,8 @@ class ChatMemberMember(ChatMember):
"""The member's status in the chat, always 'member'""" """The member's status in the chat, always 'member'"""
user: User user: User
"""Information about the user""" """Information about the user"""
until_date: Optional[DateTime] = None
"""*Optional*. Date when the user's subscription will expire; Unix time"""
if TYPE_CHECKING: if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!
@ -30,10 +33,11 @@ class ChatMemberMember(ChatMember):
*, *,
status: Literal[ChatMemberStatus.MEMBER] = ChatMemberStatus.MEMBER, status: Literal[ChatMemberStatus.MEMBER] = ChatMemberStatus.MEMBER,
user: User, user: User,
until_date: Optional[DateTime] = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher` # This method was auto-generated via `butcher`
# Is needed only for type checking and IDE support without any additional plugins # Is needed only for type checking and IDE support without any additional plugins
super().__init__(status=status, user=user, **__pydantic_kwargs) super().__init__(status=status, user=user, until_date=until_date, **__pydantic_kwargs)

View file

@ -100,6 +100,7 @@ if TYPE_CHECKING:
from .proximity_alert_triggered import ProximityAlertTriggered from .proximity_alert_triggered import ProximityAlertTriggered
from .reaction_type_custom_emoji import ReactionTypeCustomEmoji from .reaction_type_custom_emoji import ReactionTypeCustomEmoji
from .reaction_type_emoji import ReactionTypeEmoji from .reaction_type_emoji import ReactionTypeEmoji
from .reaction_type_paid import ReactionTypePaid
from .refunded_payment import RefundedPayment from .refunded_payment import RefundedPayment
from .reply_keyboard_markup import ReplyKeyboardMarkup from .reply_keyboard_markup import ReplyKeyboardMarkup
from .reply_keyboard_remove import ReplyKeyboardRemove from .reply_keyboard_remove import ReplyKeyboardRemove
@ -138,9 +139,9 @@ class Message(MaybeInaccessibleMessage):
message_thread_id: Optional[int] = None message_thread_id: Optional[int] = None
"""*Optional*. Unique identifier of a message thread to which the message belongs; for supergroups only""" """*Optional*. Unique identifier of a message thread to which the message belongs; for supergroups only"""
from_user: Optional[User] = Field(None, alias="from") 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 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 sender_boost_count: Optional[int] = None
"""*Optional*. If the sender of the message boosted the chat, the number of boosts added by the user""" """*Optional*. If the sender of the message boosted the chat, the number of boosts added by the user"""
sender_business_bot: Optional[User] = None sender_business_bot: Optional[User] = None
@ -4058,7 +4059,9 @@ class Message(MaybeInaccessibleMessage):
def react( def react(
self, self,
reaction: Optional[List[Union[ReactionTypeEmoji, ReactionTypeCustomEmoji]]] = None, reaction: Optional[
List[Union[ReactionTypeEmoji, ReactionTypeCustomEmoji, ReactionTypePaid]]
] = None,
is_big: Optional[bool] = None, is_big: Optional[bool] = None,
**kwargs: Any, **kwargs: Any,
) -> SetMessageReaction: ) -> SetMessageReaction:
@ -4069,11 +4072,11 @@ class Message(MaybeInaccessibleMessage):
- :code:`chat_id` - :code:`chat_id`
- :code:`message_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 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 :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` :return: instance of method :class:`aiogram.methods.set_message_reaction.SetMessageReaction`
""" """
@ -4118,7 +4121,7 @@ class Message(MaybeInaccessibleMessage):
- :code:`message_thread_id` - :code:`message_thread_id`
- :code:`business_connection_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 Source: https://core.telegram.org/bots/api#sendpaidmedia
@ -4184,7 +4187,7 @@ class Message(MaybeInaccessibleMessage):
- :code:`business_connection_id` - :code:`business_connection_id`
- :code:`reply_parameters` - :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 Source: https://core.telegram.org/bots/api#sendpaidmedia

View file

@ -9,6 +9,7 @@ if TYPE_CHECKING:
from .custom import DateTime from .custom import DateTime
from .reaction_type_custom_emoji import ReactionTypeCustomEmoji from .reaction_type_custom_emoji import ReactionTypeCustomEmoji
from .reaction_type_emoji import ReactionTypeEmoji from .reaction_type_emoji import ReactionTypeEmoji
from .reaction_type_paid import ReactionTypePaid
from .user import User from .user import User
@ -25,9 +26,9 @@ class MessageReactionUpdated(TelegramObject):
"""Unique identifier of the message inside the chat""" """Unique identifier of the message inside the chat"""
date: DateTime date: DateTime
"""Date of the change in Unix time""" """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""" """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""" """New list of reaction types that have been set by the user"""
user: Optional[User] = None user: Optional[User] = None
"""*Optional*. The user that changed the reaction, if the user isn't anonymous""" """*Optional*. The user that changed the reaction, if the user isn't anonymous"""
@ -44,8 +45,12 @@ class MessageReactionUpdated(TelegramObject):
chat: Chat, chat: Chat,
message_id: int, message_id: int,
date: DateTime, date: DateTime,
old_reaction: List[Union[ReactionTypeEmoji, ReactionTypeCustomEmoji]], old_reaction: List[
new_reaction: List[Union[ReactionTypeEmoji, ReactionTypeCustomEmoji]], Union[ReactionTypeEmoji, ReactionTypeCustomEmoji, ReactionTypePaid]
],
new_reaction: List[
Union[ReactionTypeEmoji, ReactionTypeCustomEmoji, ReactionTypePaid]
],
user: Optional[User] = None, user: Optional[User] = None,
actor_chat: Optional[Chat] = None, actor_chat: Optional[Chat] = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,

View file

@ -7,6 +7,7 @@ from .base import TelegramObject
if TYPE_CHECKING: if TYPE_CHECKING:
from .reaction_type_custom_emoji import ReactionTypeCustomEmoji from .reaction_type_custom_emoji import ReactionTypeCustomEmoji
from .reaction_type_emoji import ReactionTypeEmoji from .reaction_type_emoji import ReactionTypeEmoji
from .reaction_type_paid import ReactionTypePaid
class ReactionCount(TelegramObject): class ReactionCount(TelegramObject):
@ -16,7 +17,7 @@ class ReactionCount(TelegramObject):
Source: https://core.telegram.org/bots/api#reactioncount Source: https://core.telegram.org/bots/api#reactioncount
""" """
type: Union[ReactionTypeEmoji, ReactionTypeCustomEmoji] type: Union[ReactionTypeEmoji, ReactionTypeCustomEmoji, ReactionTypePaid]
"""Type of the reaction""" """Type of the reaction"""
total_count: int total_count: int
"""Number of times the reaction was added""" """Number of times the reaction was added"""
@ -28,7 +29,7 @@ class ReactionCount(TelegramObject):
def __init__( def __init__(
__pydantic__self__, __pydantic__self__,
*, *,
type: Union[ReactionTypeEmoji, ReactionTypeCustomEmoji], type: Union[ReactionTypeEmoji, ReactionTypeCustomEmoji, ReactionTypePaid],
total_count: int, total_count: int,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:

View file

@ -7,6 +7,7 @@ class ReactionType(TelegramObject):
- :class:`aiogram.types.reaction_type_emoji.ReactionTypeEmoji` - :class:`aiogram.types.reaction_type_emoji.ReactionTypeEmoji`
- :class:`aiogram.types.reaction_type_custom_emoji.ReactionTypeCustomEmoji` - :class:`aiogram.types.reaction_type_custom_emoji.ReactionTypeCustomEmoji`
- :class:`aiogram.types.reaction_type_paid.ReactionTypePaid`
Source: https://core.telegram.org/bots/api#reactiontype Source: https://core.telegram.org/bots/api#reactiontype
""" """

View file

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

View file

@ -1,11 +1,14 @@
from __future__ import annotations 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 ..enums import TransactionPartnerType
from .transaction_partner import TransactionPartner from .transaction_partner import TransactionPartner
if TYPE_CHECKING: 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 from .user import User
@ -22,6 +25,8 @@ class TransactionPartnerUser(TransactionPartner):
"""Information about the user""" """Information about the user"""
invoice_payload: Optional[str] = None invoice_payload: Optional[str] = None
"""*Optional*. Bot-specified invoice payload""" """*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: if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!
@ -33,6 +38,9 @@ class TransactionPartnerUser(TransactionPartner):
type: Literal[TransactionPartnerType.USER] = TransactionPartnerType.USER, type: Literal[TransactionPartnerType.USER] = TransactionPartnerType.USER,
user: User, user: User,
invoice_payload: Optional[str] = None, invoice_payload: Optional[str] = None,
paid_media: Optional[
List[Union[PaidMediaPreview, PaidMediaPhoto, PaidMediaVideo]]
] = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!
@ -40,5 +48,9 @@ class TransactionPartnerUser(TransactionPartner):
# Is needed only for type checking and IDE support without any additional plugins # Is needed only for type checking and IDE support without any additional plugins
super().__init__( super().__init__(
type=type, user=user, invoice_payload=invoice_payload, **__pydantic_kwargs type=type,
user=user,
invoice_payload=invoice_payload,
paid_media=paid_media,
**__pydantic_kwargs,
) )

View file

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

View file

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

View file

@ -44,6 +44,7 @@ Available methods
copy_message copy_message
copy_messages copy_messages
create_chat_invite_link create_chat_invite_link
create_chat_subscription_invite_link
create_forum_topic create_forum_topic
decline_chat_join_request decline_chat_join_request
delete_chat_photo delete_chat_photo
@ -51,6 +52,7 @@ Available methods
delete_forum_topic delete_forum_topic
delete_my_commands delete_my_commands
edit_chat_invite_link edit_chat_invite_link
edit_chat_subscription_invite_link
edit_forum_topic edit_forum_topic
edit_general_forum_topic edit_general_forum_topic
export_chat_invite_link export_chat_invite_link

View file

@ -137,6 +137,7 @@ Available types
reaction_type reaction_type
reaction_type_custom_emoji reaction_type_custom_emoji
reaction_type_emoji reaction_type_emoji
reaction_type_paid
reply_keyboard_markup reply_keyboard_markup
reply_keyboard_remove reply_keyboard_remove
reply_parameters reply_parameters

View file

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

View file

@ -93,12 +93,12 @@ docs = [
"sphinx-copybutton~=0.5.2", "sphinx-copybutton~=0.5.2",
"furo~=2023.9.10", "furo~=2023.9.10",
"Sphinx-Substitution-Extensions~=2022.2.16", "Sphinx-Substitution-Extensions~=2022.2.16",
"towncrier~=23.6.0", "towncrier~=24.7.1",
"pygments~=2.16.1", "pygments~=2.16.1",
"pymdown-extensions~=10.3", "pymdown-extensions~=10.3",
"markdown-include~=0.8.1", "markdown-include~=0.8.1",
"Pygments~=2.16.1", "Pygments~=2.16.1",
"sphinxcontrib-towncrier~=0.3.2a0", "sphinxcontrib-towncrier~=0.4.0a0",
] ]
dev = [ dev = [
"black~=24.4.2", "black~=24.4.2",
@ -331,6 +331,9 @@ filename = "CHANGES.rst"
directory = "CHANGES/" directory = "CHANGES/"
template = "CHANGES/.template.rst.jinja2" template = "CHANGES/.template.rst.jinja2"
issue_format = "`#{issue} <https://github.com/aiogram/aiogram/issues/{issue}>`_" issue_format = "`#{issue} <https://github.com/aiogram/aiogram/issues/{issue}>`_"
ignore = [
".template.rst.jinja2",
]
[[tool.towncrier.section]] [[tool.towncrier.section]]
path = "" path = ""

View file

@ -1,3 +1,4 @@
import json
import re import re
from pathlib import Path from pathlib import Path
@ -35,8 +36,11 @@ def get_package_version() -> str:
def get_telegram_api_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" path = Path.cwd() / ".apiversion"
version = path.read_text().strip() path.write_text(version + "\n")
return version return version

View file

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

View file

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

View file

@ -1,5 +1,5 @@
from unittest.mock import patch
from datetime import datetime from datetime import datetime
from unittest.mock import patch
import pytest import pytest
@ -9,13 +9,13 @@ from aiogram.dispatcher.middlewares.user_context import (
) )
from aiogram.types import ( from aiogram.types import (
Chat, Chat,
Update,
User,
ChatBoostUpdated,
ChatBoost, ChatBoost,
ChatBoostSourcePremium,
ChatBoostSourceGiftCode, ChatBoostSourceGiftCode,
ChatBoostSourceGiveaway, ChatBoostSourceGiveaway,
ChatBoostSourcePremium,
ChatBoostUpdated,
Update,
User,
) )