From 141a550ab2da0d27d9b94a98da196e9d801f1908 Mon Sep 17 00:00:00 2001 From: kewldan <40865857+kewldan@users.noreply.github.com> Date: Sat, 23 Nov 2024 18:54:49 +0300 Subject: [PATCH 01/10] misc(deps): Bump pydantic version to <2.11 (#1607) * Bump pydantic max version to <2.11 * CHANGES file * Update CHANGES/1607.misc.rst --------- Co-authored-by: Alex Root Junior --- CHANGES/1607.misc.rst | 1 + pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 CHANGES/1607.misc.rst diff --git a/CHANGES/1607.misc.rst b/CHANGES/1607.misc.rst new file mode 100644 index 00000000..f9095214 --- /dev/null +++ b/CHANGES/1607.misc.rst @@ -0,0 +1 @@ +Increased max :code:`pydantic` version support from “<2.10” to “<2.11” diff --git a/pyproject.toml b/pyproject.toml index d1d59a40..0d916aa9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -43,7 +43,7 @@ classifiers = [ dependencies = [ "magic-filter>=1.0.12,<1.1", "aiohttp>=3.9.0,<3.11", - "pydantic>=2.4.1,<2.10", + "pydantic>=2.4.1,<2.11", "aiofiles>=23.2.1,<24.2", "certifi>=2023.7.22", "typing-extensions>=4.7.0,<=5.0", From 6520b9fba2376418daa034bc7411262a5c85ce5e Mon Sep 17 00:00:00 2001 From: Suren Khorenyan Date: Mon, 25 Nov 2024 23:08:05 +0300 Subject: [PATCH 02/10] [misc] fix tg-emoji closing tag: use constant (#1608) * fix tg-emoji closing tag: use constant * add changelog for tg-emoji closing tag fix * Update CHANGES/1608.misc.rst --------- Co-authored-by: Alex Root Junior --- CHANGES/1608.misc.rst | 1 + aiogram/utils/text_decorations.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 CHANGES/1608.misc.rst diff --git a/CHANGES/1608.misc.rst b/CHANGES/1608.misc.rst new file mode 100644 index 00000000..2641bb8c --- /dev/null +++ b/CHANGES/1608.misc.rst @@ -0,0 +1 @@ +Fixed closing tag for :code:`tg-emoji` in the :class:`aiogram.utils.text_decoration.HtmlDecoration`: use the same constant as for tag opening diff --git a/aiogram/utils/text_decorations.py b/aiogram/utils/text_decorations.py index 440fffa6..35f343d2 100644 --- a/aiogram/utils/text_decorations.py +++ b/aiogram/utils/text_decorations.py @@ -218,7 +218,7 @@ class HtmlDecoration(TextDecoration): return html.escape(value, quote=False) def custom_emoji(self, value: str, custom_emoji_id: str) -> str: - return f'<{self.EMOJI_TAG} emoji-id="{custom_emoji_id}">{value}' + return f'<{self.EMOJI_TAG} emoji-id="{custom_emoji_id}">{value}' def blockquote(self, value: str) -> str: return f"<{self.BLOCKQUOTE_TAG}>{value}" From 782796c2174d178bb13d0cdfcab896235e44be90 Mon Sep 17 00:00:00 2001 From: Alex Root Junior Date: Sat, 14 Dec 2024 19:30:12 +0200 Subject: [PATCH 03/10] Added full support of Bot API 8.1 (#1617) * Added full support of Bot API 8.1 * Remove artifacts from types and methods (model_* methods) --- .apiversion | 2 +- .butcher/enums/TransactionPartnerType.yml | 1 + .../methods/createInvoiceLink/entity.json | 12 +- .butcher/schema/schema.json | 130 ++++++++++++++++-- .butcher/types/AffiliateInfo/entity.json | 57 ++++++++ .butcher/types/StarTransaction/entity.json | 14 +- .butcher/types/TransactionPartner/entity.json | 6 +- .../entity.json | 41 ++++++ .../types/TransactionPartnerUser/entity.json | 10 +- CHANGES/1617.feature.rst | 5 + README.rst | 2 +- aiogram/__meta__.py | 2 +- aiogram/client/bot.py | 4 +- aiogram/enums/transaction_partner_type.py | 1 + aiogram/methods/create_invoice_link.py | 4 +- aiogram/types/__init__.py | 4 + aiogram/types/affiliate_info.py | 55 ++++++++ aiogram/types/star_transaction.py | 13 +- aiogram/types/transaction_partner.py | 1 + .../transaction_partner_affiliate_program.py | 51 +++++++ aiogram/types/transaction_partner_user.py | 10 +- docs/api/types/affiliate_info.rst | 10 ++ docs/api/types/index.rst | 28 ++-- .../transaction_partner_affiliate_program.rst | 10 ++ docs/conf.py | 11 ++ 25 files changed, 433 insertions(+), 51 deletions(-) create mode 100644 .butcher/types/AffiliateInfo/entity.json create mode 100644 .butcher/types/TransactionPartnerAffiliateProgram/entity.json create mode 100644 CHANGES/1617.feature.rst create mode 100644 aiogram/types/affiliate_info.py create mode 100644 aiogram/types/transaction_partner_affiliate_program.py create mode 100644 docs/api/types/affiliate_info.rst create mode 100644 docs/api/types/transaction_partner_affiliate_program.rst diff --git a/.apiversion b/.apiversion index cc40bca6..b8eb0263 100644 --- a/.apiversion +++ b/.apiversion @@ -1 +1 @@ -8.0 +8.1 diff --git a/.butcher/enums/TransactionPartnerType.yml b/.butcher/enums/TransactionPartnerType.yml index bb4445f9..a633d28a 100644 --- a/.butcher/enums/TransactionPartnerType.yml +++ b/.butcher/enums/TransactionPartnerType.yml @@ -12,3 +12,4 @@ multi_parse: - TransactionPartnerUser - TransactionPartnerTelegramAds - TransactionPartnerTelegramApi + - TransactionPartnerAffiliateProgram diff --git a/.butcher/methods/createInvoiceLink/entity.json b/.butcher/methods/createInvoiceLink/entity.json index f1761868..6d4a7202 100644 --- a/.butcher/methods/createInvoiceLink/entity.json +++ b/.butcher/methods/createInvoiceLink/entity.json @@ -14,9 +14,9 @@ { "type": "String", "required": false, - "description": "Unique identifier of the business connection on behalf of which the link will be created", - "html_description": "Unique identifier of the business connection on behalf of which the link will be created", - "rst_description": "Unique identifier of the business connection on behalf of which the link will be created\n", + "description": "Unique identifier of the business connection on behalf of which the link will be created. For payments in Telegram Stars only.", + "html_description": "Unique identifier of the business connection on behalf of which the link will be created. For payments in Telegram Stars only.", + "rst_description": "Unique identifier of the business connection on behalf of which the link will be created. For payments in `Telegram Stars `_ only.\n", "name": "business_connection_id" }, { @@ -70,9 +70,9 @@ { "type": "Integer", "required": false, - "description": "The number of seconds the subscription will be active for before the next payment. The currency must be set to 'XTR' (Telegram Stars) if the parameter is used. Currently, it must always be 2592000 (30 days) if specified.", - "html_description": "The number of seconds the subscription will be active for before the next payment. The currency must be set to “XTR” (Telegram Stars) if the parameter is used. Currently, it must always be 2592000 (30 days) if specified.", - "rst_description": "The number of seconds the subscription will be active for before the next payment. The currency must be set to 'XTR' (Telegram Stars) if the parameter is used. Currently, it must always be 2592000 (30 days) if specified.\n", + "description": "The number of seconds the subscription will be active for before the next payment. The currency must be set to 'XTR' (Telegram Stars) if the parameter is used. Currently, it must always be 2592000 (30 days) if specified. Any number of subscriptions can be active for a given bot at the same time, including multiple concurrent subscriptions from the same user. Subscription price must no exceed 2500 Telegram Stars.", + "html_description": "The number of seconds the subscription will be active for before the next payment. The currency must be set to “XTR” (Telegram Stars) if the parameter is used. Currently, it must always be 2592000 (30 days) if specified. Any number of subscriptions can be active for a given bot at the same time, including multiple concurrent subscriptions from the same user. Subscription price must no exceed 2500 Telegram Stars.", + "rst_description": "The number of seconds the subscription will be active for before the next payment. The currency must be set to 'XTR' (Telegram Stars) if the parameter is used. Currently, it must always be 2592000 (30 days) if specified. Any number of subscriptions can be active for a given bot at the same time, including multiple concurrent subscriptions from the same user. Subscription price must no exceed 2500 Telegram Stars.\n", "name": "subscription_period" }, { diff --git a/.butcher/schema/schema.json b/.butcher/schema/schema.json index 941ca6a4..c3157eb4 100644 --- a/.butcher/schema/schema.json +++ b/.butcher/schema/schema.json @@ -1,7 +1,7 @@ { "api": { - "version": "8.0", - "release_date": "2024-11-17" + "version": "8.1", + "release_date": "2024-12-04" }, "items": [ { @@ -16344,9 +16344,9 @@ { "type": "String", "required": false, - "description": "Unique identifier of the business connection on behalf of which the link will be created", - "html_description": "Unique identifier of the business connection on behalf of which the link will be created", - "rst_description": "Unique identifier of the business connection on behalf of which the link will be created\n", + "description": "Unique identifier of the business connection on behalf of which the link will be created. For payments in Telegram Stars only.", + "html_description": "Unique identifier of the business connection on behalf of which the link will be created. For payments in Telegram Stars only.", + "rst_description": "Unique identifier of the business connection on behalf of which the link will be created. For payments in `Telegram Stars `_ only.\n", "name": "business_connection_id" }, { @@ -16400,9 +16400,9 @@ { "type": "Integer", "required": false, - "description": "The number of seconds the subscription will be active for before the next payment. The currency must be set to 'XTR' (Telegram Stars) if the parameter is used. Currently, it must always be 2592000 (30 days) if specified.", - "html_description": "The number of seconds the subscription will be active for before the next payment. The currency must be set to “XTR” (Telegram Stars) if the parameter is used. Currently, it must always be 2592000 (30 days) if specified.", - "rst_description": "The number of seconds the subscription will be active for before the next payment. The currency must be set to 'XTR' (Telegram Stars) if the parameter is used. Currently, it must always be 2592000 (30 days) if specified.\n", + "description": "The number of seconds the subscription will be active for before the next payment. The currency must be set to 'XTR' (Telegram Stars) if the parameter is used. Currently, it must always be 2592000 (30 days) if specified. Any number of subscriptions can be active for a given bot at the same time, including multiple concurrent subscriptions from the same user. Subscription price must no exceed 2500 Telegram Stars.", + "html_description": "The number of seconds the subscription will be active for before the next payment. The currency must be set to “XTR” (Telegram Stars) if the parameter is used. Currently, it must always be 2592000 (30 days) if specified. Any number of subscriptions can be active for a given bot at the same time, including multiple concurrent subscriptions from the same user. Subscription price must no exceed 2500 Telegram Stars.", + "rst_description": "The number of seconds the subscription will be active for before the next payment. The currency must be set to 'XTR' (Telegram Stars) if the parameter is used. Currently, it must always be 2592000 (30 days) if specified. Any number of subscriptions can be active for a given bot at the same time, including multiple concurrent subscriptions from the same user. Subscription price must no exceed 2500 Telegram Stars.\n", "name": "subscription_period" }, { @@ -17245,12 +17245,62 @@ ], "category": "types" }, + { + "anchor": "affiliateinfo", + "name": "AffiliateInfo", + "description": "Contains information about the affiliate that received a commission via this transaction.", + "html_description": "

Contains information about the affiliate that received a commission via this transaction.

", + "rst_description": "Contains information about the affiliate that received a commission via this transaction.", + "annotations": [ + { + "type": "User", + "description": "The bot or the user that received an affiliate commission if it was received by a bot or a user", + "html_description": "Optional. The bot or the user that received an affiliate commission if it was received by a bot or a user", + "rst_description": "*Optional*. The bot or the user that received an affiliate commission if it was received by a bot or a user\n", + "name": "affiliate_user", + "required": false + }, + { + "type": "Chat", + "description": "The chat that received an affiliate commission if it was received by a chat", + "html_description": "Optional. The chat that received an affiliate commission if it was received by a chat", + "rst_description": "*Optional*. The chat that received an affiliate commission if it was received by a chat\n", + "name": "affiliate_chat", + "required": false + }, + { + "type": "Integer", + "description": "The number of Telegram Stars received by the affiliate for each 1000 Telegram Stars received by the bot from referred users", + "html_description": "The number of Telegram Stars received by the affiliate for each 1000 Telegram Stars received by the bot from referred users", + "rst_description": "The number of Telegram Stars received by the affiliate for each 1000 Telegram Stars received by the bot from referred users\n", + "name": "commission_per_mille", + "required": true + }, + { + "type": "Integer", + "description": "Integer amount of Telegram Stars received by the affiliate from the transaction, rounded to 0; can be negative for refunds", + "html_description": "Integer amount of Telegram Stars received by the affiliate from the transaction, rounded to 0; can be negative for refunds", + "rst_description": "Integer amount of Telegram Stars received by the affiliate from the transaction, rounded to 0; can be negative for refunds\n", + "name": "amount", + "required": true + }, + { + "type": "Integer", + "description": "The number of 1/1000000000 shares of Telegram Stars received by the affiliate; from -999999999 to 999999999; can be negative for refunds", + "html_description": "Optional. The number of 1/1000000000 shares of Telegram Stars received by the affiliate; from -999999999 to 999999999; can be negative for refunds", + "rst_description": "*Optional*. The number of 1/1000000000 shares of Telegram Stars received by the affiliate; from -999999999 to 999999999; can be negative for refunds\n", + "name": "nanostar_amount", + "required": false + } + ], + "category": "types" + }, { "anchor": "transactionpartner", "name": "TransactionPartner", - "description": "This object describes the source of a transaction, or its recipient for outgoing transactions. Currently, it can be one of\n - TransactionPartnerUser\n - TransactionPartnerFragment\n - TransactionPartnerTelegramAds\n - TransactionPartnerTelegramApi\n - TransactionPartnerOther", - "html_description": "

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

", - "rst_description": "This object describes the source of a transaction, or its recipient for outgoing transactions. Currently, it can be one of\n\n - :class:`aiogram.types.transaction_partner_user.TransactionPartnerUser`\n - :class:`aiogram.types.transaction_partner_fragment.TransactionPartnerFragment`\n - :class:`aiogram.types.transaction_partner_telegram_ads.TransactionPartnerTelegramAds`\n - :class:`aiogram.types.transaction_partner_telegram_api.TransactionPartnerTelegramApi`\n - :class:`aiogram.types.transaction_partner_other.TransactionPartnerOther`", + "description": "This object describes the source of a transaction, or its recipient for outgoing transactions. Currently, it can be one of\n - TransactionPartnerUser\n - TransactionPartnerAffiliateProgram\n - TransactionPartnerFragment\n - TransactionPartnerTelegramAds\n - TransactionPartnerTelegramApi\n - TransactionPartnerOther", + "html_description": "

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

", + "rst_description": "This object describes the source of a transaction, or its recipient for outgoing transactions. Currently, it can be one of\n\n - :class:`aiogram.types.transaction_partner_user.TransactionPartnerUser`\n - :class:`aiogram.types.transaction_partner_affiliate_program.TransactionPartnerAffiliateProgram`\n - :class:`aiogram.types.transaction_partner_fragment.TransactionPartnerFragment`\n - :class:`aiogram.types.transaction_partner_telegram_ads.TransactionPartnerTelegramAds`\n - :class:`aiogram.types.transaction_partner_telegram_api.TransactionPartnerTelegramApi`\n - :class:`aiogram.types.transaction_partner_other.TransactionPartnerOther`", "annotations": [], "category": "types" }, @@ -17277,6 +17327,14 @@ "name": "user", "required": true }, + { + "type": "AffiliateInfo", + "description": "Information about the affiliate that received a commission via this transaction", + "html_description": "Optional. Information about the affiliate that received a commission via this transaction", + "rst_description": "*Optional*. Information about the affiliate that received a commission via this transaction\n", + "name": "affiliate", + "required": false + }, { "type": "String", "description": "Bot-specified invoice payload", @@ -17310,7 +17368,7 @@ "required": false }, { - "type": "String", + "type": "Gift", "description": "The gift sent to the user by the bot", "html_description": "Optional. The gift sent to the user by the bot", "rst_description": "*Optional*. The gift sent to the user by the bot\n", @@ -17320,6 +17378,40 @@ ], "category": "types" }, + { + "anchor": "transactionpartneraffiliateprogram", + "name": "TransactionPartnerAffiliateProgram", + "description": "Describes the affiliate program that issued the affiliate commission received via this transaction.", + "html_description": "

Describes the affiliate program that issued the affiliate commission received via this transaction.

", + "rst_description": "Describes the affiliate program that issued the affiliate commission received via this transaction.", + "annotations": [ + { + "type": "String", + "description": "Type of the transaction partner, always 'affiliate_program'", + "html_description": "Type of the transaction partner, always “affiliate_program”", + "rst_description": "Type of the transaction partner, always 'affiliate_program'\n", + "name": "type", + "required": true + }, + { + "type": "User", + "description": "Information about the bot that sponsored the affiliate program", + "html_description": "Optional. Information about the bot that sponsored the affiliate program", + "rst_description": "*Optional*. Information about the bot that sponsored the affiliate program\n", + "name": "sponsor_user", + "required": false + }, + { + "type": "Integer", + "description": "The number of Telegram Stars received by the bot for each 1000 Telegram Stars received by the affiliate program sponsor from referred users", + "html_description": "The number of Telegram Stars received by the bot for each 1000 Telegram Stars received by the affiliate program sponsor from referred users", + "rst_description": "The number of Telegram Stars received by the bot for each 1000 Telegram Stars received by the affiliate program sponsor from referred users\n", + "name": "commission_per_mille", + "required": true + } + ], + "category": "types" + }, { "anchor": "transactionpartnerfragment", "name": "TransactionPartnerFragment", @@ -17425,12 +17517,20 @@ }, { "type": "Integer", - "description": "Number of Telegram Stars transferred by the transaction", - "html_description": "Number of Telegram Stars transferred by the transaction", - "rst_description": "Number of Telegram Stars transferred by the transaction\n", + "description": "Integer amount of Telegram Stars transferred by the transaction", + "html_description": "Integer amount of Telegram Stars transferred by the transaction", + "rst_description": "Integer amount of Telegram Stars transferred by the transaction\n", "name": "amount", "required": true }, + { + "type": "Integer", + "description": "The number of 1/1000000000 shares of Telegram Stars transferred by the transaction; from 0 to 999999999", + "html_description": "Optional. The number of 1/1000000000 shares of Telegram Stars transferred by the transaction; from 0 to 999999999", + "rst_description": "*Optional*. The number of 1/1000000000 shares of Telegram Stars transferred by the transaction; from 0 to 999999999\n", + "name": "nanostar_amount", + "required": false + }, { "type": "Integer", "description": "Date the transaction was created in Unix time", diff --git a/.butcher/types/AffiliateInfo/entity.json b/.butcher/types/AffiliateInfo/entity.json new file mode 100644 index 00000000..f73a4f24 --- /dev/null +++ b/.butcher/types/AffiliateInfo/entity.json @@ -0,0 +1,57 @@ +{ + "meta": {}, + "group": { + "title": "Payments", + "anchor": "payments" + }, + "object": { + "anchor": "affiliateinfo", + "name": "AffiliateInfo", + "description": "Contains information about the affiliate that received a commission via this transaction.", + "html_description": "

Contains information about the affiliate that received a commission via this transaction.

", + "rst_description": "Contains information about the affiliate that received a commission via this transaction.", + "annotations": [ + { + "type": "User", + "description": "The bot or the user that received an affiliate commission if it was received by a bot or a user", + "html_description": "Optional. The bot or the user that received an affiliate commission if it was received by a bot or a user", + "rst_description": "*Optional*. The bot or the user that received an affiliate commission if it was received by a bot or a user\n", + "name": "affiliate_user", + "required": false + }, + { + "type": "Chat", + "description": "The chat that received an affiliate commission if it was received by a chat", + "html_description": "Optional. The chat that received an affiliate commission if it was received by a chat", + "rst_description": "*Optional*. The chat that received an affiliate commission if it was received by a chat\n", + "name": "affiliate_chat", + "required": false + }, + { + "type": "Integer", + "description": "The number of Telegram Stars received by the affiliate for each 1000 Telegram Stars received by the bot from referred users", + "html_description": "The number of Telegram Stars received by the affiliate for each 1000 Telegram Stars received by the bot from referred users", + "rst_description": "The number of Telegram Stars received by the affiliate for each 1000 Telegram Stars received by the bot from referred users\n", + "name": "commission_per_mille", + "required": true + }, + { + "type": "Integer", + "description": "Integer amount of Telegram Stars received by the affiliate from the transaction, rounded to 0; can be negative for refunds", + "html_description": "Integer amount of Telegram Stars received by the affiliate from the transaction, rounded to 0; can be negative for refunds", + "rst_description": "Integer amount of Telegram Stars received by the affiliate from the transaction, rounded to 0; can be negative for refunds\n", + "name": "amount", + "required": true + }, + { + "type": "Integer", + "description": "The number of 1/1000000000 shares of Telegram Stars received by the affiliate; from -999999999 to 999999999; can be negative for refunds", + "html_description": "Optional. The number of 1/1000000000 shares of Telegram Stars received by the affiliate; from -999999999 to 999999999; can be negative for refunds", + "rst_description": "*Optional*. The number of 1/1000000000 shares of Telegram Stars received by the affiliate; from -999999999 to 999999999; can be negative for refunds\n", + "name": "nanostar_amount", + "required": false + } + ], + "category": "types" + } +} diff --git a/.butcher/types/StarTransaction/entity.json b/.butcher/types/StarTransaction/entity.json index 775b96ca..4186788a 100644 --- a/.butcher/types/StarTransaction/entity.json +++ b/.butcher/types/StarTransaction/entity.json @@ -21,12 +21,20 @@ }, { "type": "Integer", - "description": "Number of Telegram Stars transferred by the transaction", - "html_description": "Number of Telegram Stars transferred by the transaction", - "rst_description": "Number of Telegram Stars transferred by the transaction\n", + "description": "Integer amount of Telegram Stars transferred by the transaction", + "html_description": "Integer amount of Telegram Stars transferred by the transaction", + "rst_description": "Integer amount of Telegram Stars transferred by the transaction\n", "name": "amount", "required": true }, + { + "type": "Integer", + "description": "The number of 1/1000000000 shares of Telegram Stars transferred by the transaction; from 0 to 999999999", + "html_description": "Optional. The number of 1/1000000000 shares of Telegram Stars transferred by the transaction; from 0 to 999999999", + "rst_description": "*Optional*. The number of 1/1000000000 shares of Telegram Stars transferred by the transaction; from 0 to 999999999\n", + "name": "nanostar_amount", + "required": false + }, { "type": "Integer", "description": "Date the transaction was created in Unix time", diff --git a/.butcher/types/TransactionPartner/entity.json b/.butcher/types/TransactionPartner/entity.json index d8e38c67..8c01706b 100644 --- a/.butcher/types/TransactionPartner/entity.json +++ b/.butcher/types/TransactionPartner/entity.json @@ -7,9 +7,9 @@ "object": { "anchor": "transactionpartner", "name": "TransactionPartner", - "description": "This object describes the source of a transaction, or its recipient for outgoing transactions. Currently, it can be one of\n - TransactionPartnerUser\n - TransactionPartnerFragment\n - TransactionPartnerTelegramAds\n - TransactionPartnerTelegramApi\n - TransactionPartnerOther", - "html_description": "

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

", - "rst_description": "This object describes the source of a transaction, or its recipient for outgoing transactions. Currently, it can be one of\n\n - :class:`aiogram.types.transaction_partner_user.TransactionPartnerUser`\n - :class:`aiogram.types.transaction_partner_fragment.TransactionPartnerFragment`\n - :class:`aiogram.types.transaction_partner_telegram_ads.TransactionPartnerTelegramAds`\n - :class:`aiogram.types.transaction_partner_telegram_api.TransactionPartnerTelegramApi`\n - :class:`aiogram.types.transaction_partner_other.TransactionPartnerOther`", + "description": "This object describes the source of a transaction, or its recipient for outgoing transactions. Currently, it can be one of\n - TransactionPartnerUser\n - TransactionPartnerAffiliateProgram\n - TransactionPartnerFragment\n - TransactionPartnerTelegramAds\n - TransactionPartnerTelegramApi\n - TransactionPartnerOther", + "html_description": "

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

", + "rst_description": "This object describes the source of a transaction, or its recipient for outgoing transactions. Currently, it can be one of\n\n - :class:`aiogram.types.transaction_partner_user.TransactionPartnerUser`\n - :class:`aiogram.types.transaction_partner_affiliate_program.TransactionPartnerAffiliateProgram`\n - :class:`aiogram.types.transaction_partner_fragment.TransactionPartnerFragment`\n - :class:`aiogram.types.transaction_partner_telegram_ads.TransactionPartnerTelegramAds`\n - :class:`aiogram.types.transaction_partner_telegram_api.TransactionPartnerTelegramApi`\n - :class:`aiogram.types.transaction_partner_other.TransactionPartnerOther`", "annotations": [], "category": "types" } diff --git a/.butcher/types/TransactionPartnerAffiliateProgram/entity.json b/.butcher/types/TransactionPartnerAffiliateProgram/entity.json new file mode 100644 index 00000000..a637836c --- /dev/null +++ b/.butcher/types/TransactionPartnerAffiliateProgram/entity.json @@ -0,0 +1,41 @@ +{ + "meta": {}, + "group": { + "title": "Payments", + "anchor": "payments" + }, + "object": { + "anchor": "transactionpartneraffiliateprogram", + "name": "TransactionPartnerAffiliateProgram", + "description": "Describes the affiliate program that issued the affiliate commission received via this transaction.", + "html_description": "

Describes the affiliate program that issued the affiliate commission received via this transaction.

", + "rst_description": "Describes the affiliate program that issued the affiliate commission received via this transaction.", + "annotations": [ + { + "type": "String", + "description": "Type of the transaction partner, always 'affiliate_program'", + "html_description": "Type of the transaction partner, always “affiliate_program”", + "rst_description": "Type of the transaction partner, always 'affiliate_program'\n", + "name": "type", + "required": true + }, + { + "type": "User", + "description": "Information about the bot that sponsored the affiliate program", + "html_description": "Optional. Information about the bot that sponsored the affiliate program", + "rst_description": "*Optional*. Information about the bot that sponsored the affiliate program\n", + "name": "sponsor_user", + "required": false + }, + { + "type": "Integer", + "description": "The number of Telegram Stars received by the bot for each 1000 Telegram Stars received by the affiliate program sponsor from referred users", + "html_description": "The number of Telegram Stars received by the bot for each 1000 Telegram Stars received by the affiliate program sponsor from referred users", + "rst_description": "The number of Telegram Stars received by the bot for each 1000 Telegram Stars received by the affiliate program sponsor from referred users\n", + "name": "commission_per_mille", + "required": true + } + ], + "category": "types" + } +} diff --git a/.butcher/types/TransactionPartnerUser/entity.json b/.butcher/types/TransactionPartnerUser/entity.json index f8064da9..b830a190 100644 --- a/.butcher/types/TransactionPartnerUser/entity.json +++ b/.butcher/types/TransactionPartnerUser/entity.json @@ -27,6 +27,14 @@ "name": "user", "required": true }, + { + "type": "AffiliateInfo", + "description": "Information about the affiliate that received a commission via this transaction", + "html_description": "Optional. Information about the affiliate that received a commission via this transaction", + "rst_description": "*Optional*. Information about the affiliate that received a commission via this transaction\n", + "name": "affiliate", + "required": false + }, { "type": "String", "description": "Bot-specified invoice payload", @@ -60,7 +68,7 @@ "required": false }, { - "type": "String", + "type": "Gift", "description": "The gift sent to the user by the bot", "html_description": "Optional. The gift sent to the user by the bot", "rst_description": "*Optional*. The gift sent to the user by the bot\n", diff --git a/CHANGES/1617.feature.rst b/CHANGES/1617.feature.rst new file mode 100644 index 00000000..a72a8b32 --- /dev/null +++ b/CHANGES/1617.feature.rst @@ -0,0 +1,5 @@ +Added full support of `Bot API 8.1`_: + +- Added the field :code:`nanostar_amount` to the class :class:`aiogram.types.star_transaction.StarTransaction`. +- Added the class :class:`aiogram.types.transaction_partner_affiliate_program.TransactionPartnerAffiliateProgram` for transactions pertaining to incoming affiliate commissions. +- Added the class :class:`aiogram.types.affiliate_info.AffiliateInfo` and the field :code:`affiliate` to the class :class:`aiogram.types.transaction_partner_user.TransactionPartnerUser`, allowing bots to identify the relevant affiliate in transactions with an affiliate commission. diff --git a/README.rst b/README.rst index acc48f8b..f17a7a5b 100644 --- a/README.rst +++ b/README.rst @@ -52,7 +52,7 @@ Features - Asynchronous (`asyncio docs `_, :pep:`492`) - Has type hints (:pep:`484`) and can be used with `mypy `_ - Supports `PyPy `_ -- Supports `Telegram Bot API 8.0 `_ and gets fast updates to the latest versions of the Bot API +- Supports `Telegram Bot API 8.1 `_ and gets fast updates to the latest versions of the Bot API - Telegram Bot API integration code was `autogenerated `_ and can be easily re-generated when API gets updated - Updates router (Blueprints) - Has Finite State Machine diff --git a/aiogram/__meta__.py b/aiogram/__meta__.py index befb7cb6..c0c3a8a7 100644 --- a/aiogram/__meta__.py +++ b/aiogram/__meta__.py @@ -1,2 +1,2 @@ __version__ = "3.15.0" -__api_version__ = "8.0" +__api_version__ = "8.1" diff --git a/aiogram/client/bot.py b/aiogram/client/bot.py index b538485f..592173e4 100644 --- a/aiogram/client/bot.py +++ b/aiogram/client/bot.py @@ -1014,9 +1014,9 @@ class Bot: :param payload: Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use it for your internal processes. :param currency: Three-letter ISO 4217 currency code, see `more on currencies `_. Pass 'XTR' for payments in `Telegram Stars `_. :param prices: Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain exactly one item for payments in `Telegram Stars `_. - :param business_connection_id: Unique identifier of the business connection on behalf of which the link will be created + :param business_connection_id: Unique identifier of the business connection on behalf of which the link will be created. For payments in `Telegram Stars `_ only. :param provider_token: Payment provider token, obtained via `@BotFather `_. Pass an empty string for payments in `Telegram Stars `_. - :param subscription_period: The number of seconds the subscription will be active for before the next payment. The currency must be set to 'XTR' (Telegram Stars) if the parameter is used. Currently, it must always be 2592000 (30 days) if specified. + :param subscription_period: The number of seconds the subscription will be active for before the next payment. The currency must be set to 'XTR' (Telegram Stars) if the parameter is used. Currently, it must always be 2592000 (30 days) if specified. Any number of subscriptions can be active for a given bot at the same time, including multiple concurrent subscriptions from the same user. Subscription price must no exceed 2500 Telegram Stars. :param max_tip_amount: The maximum accepted amount for tips in the *smallest units* of the currency (integer, **not** float/double). For example, for a maximum tip of :code:`US$ 1.45` pass :code:`max_tip_amount = 145`. See the *exp* parameter in `currencies.json `_, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0. Not supported for payments in `Telegram Stars `_. :param suggested_tip_amounts: A JSON-serialized array of suggested amounts of tips in the *smallest units* of the currency (integer, **not** float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed *max_tip_amount*. :param provider_data: JSON-serialized data about the invoice, which will be shared with the payment provider. A detailed description of required fields should be provided by the payment provider. diff --git a/aiogram/enums/transaction_partner_type.py b/aiogram/enums/transaction_partner_type.py index 79e7900e..ec84318a 100644 --- a/aiogram/enums/transaction_partner_type.py +++ b/aiogram/enums/transaction_partner_type.py @@ -13,3 +13,4 @@ class TransactionPartnerType(str, Enum): USER = "user" TELEGRAM_ADS = "telegram_ads" TELEGRAM_API = "telegram_api" + AFFILIATE_PROGRAM = "affiliate_program" diff --git a/aiogram/methods/create_invoice_link.py b/aiogram/methods/create_invoice_link.py index 0c17aac2..40321bde 100644 --- a/aiogram/methods/create_invoice_link.py +++ b/aiogram/methods/create_invoice_link.py @@ -27,11 +27,11 @@ class CreateInvoiceLink(TelegramMethod[str]): prices: list[LabeledPrice] """Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain exactly one item for payments in `Telegram Stars `_.""" business_connection_id: Optional[str] = None - """Unique identifier of the business connection on behalf of which the link will be created""" + """Unique identifier of the business connection on behalf of which the link will be created. For payments in `Telegram Stars `_ only.""" provider_token: Optional[str] = None """Payment provider token, obtained via `@BotFather `_. Pass an empty string for payments in `Telegram Stars `_.""" subscription_period: Optional[int] = None - """The number of seconds the subscription will be active for before the next payment. The currency must be set to 'XTR' (Telegram Stars) if the parameter is used. Currently, it must always be 2592000 (30 days) if specified.""" + """The number of seconds the subscription will be active for before the next payment. The currency must be set to 'XTR' (Telegram Stars) if the parameter is used. Currently, it must always be 2592000 (30 days) if specified. Any number of subscriptions can be active for a given bot at the same time, including multiple concurrent subscriptions from the same user. Subscription price must no exceed 2500 Telegram Stars.""" max_tip_amount: Optional[int] = None """The maximum accepted amount for tips in the *smallest units* of the currency (integer, **not** float/double). For example, for a maximum tip of :code:`US$ 1.45` pass :code:`max_tip_amount = 145`. See the *exp* parameter in `currencies.json `_, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0. Not supported for payments in `Telegram Stars `_.""" suggested_tip_amounts: Optional[list[int]] = None diff --git a/aiogram/types/__init__.py b/aiogram/types/__init__.py index 18632627..8f695d23 100644 --- a/aiogram/types/__init__.py +++ b/aiogram/types/__init__.py @@ -1,5 +1,6 @@ from typing import List, Literal, Optional, Union +from .affiliate_info import AffiliateInfo from .animation import Animation from .audio import Audio from .background_fill import BackgroundFill @@ -216,6 +217,7 @@ from .successful_payment import SuccessfulPayment from .switch_inline_query_chosen_chat import SwitchInlineQueryChosenChat from .text_quote import TextQuote from .transaction_partner import TransactionPartner +from .transaction_partner_affiliate_program import TransactionPartnerAffiliateProgram from .transaction_partner_fragment import TransactionPartnerFragment from .transaction_partner_other import TransactionPartnerOther from .transaction_partner_telegram_ads import TransactionPartnerTelegramAds @@ -241,6 +243,7 @@ from .webhook_info import WebhookInfo from .write_access_allowed import WriteAccessAllowed __all__ = ( + "AffiliateInfo", "Animation", "Audio", "BackgroundFill", @@ -456,6 +459,7 @@ __all__ = ( "TelegramObject", "TextQuote", "TransactionPartner", + "TransactionPartnerAffiliateProgram", "TransactionPartnerFragment", "TransactionPartnerOther", "TransactionPartnerTelegramAds", diff --git a/aiogram/types/affiliate_info.py b/aiogram/types/affiliate_info.py new file mode 100644 index 00000000..ac231abc --- /dev/null +++ b/aiogram/types/affiliate_info.py @@ -0,0 +1,55 @@ +from __future__ import annotations + +from typing import TYPE_CHECKING, Any, Optional + +from .base import TelegramObject + +if TYPE_CHECKING: + from .chat import Chat + from .user import User + + +class AffiliateInfo(TelegramObject): + """ + Contains information about the affiliate that received a commission via this transaction. + + Source: https://core.telegram.org/bots/api#affiliateinfo + """ + + commission_per_mille: int + """The number of Telegram Stars received by the affiliate for each 1000 Telegram Stars received by the bot from referred users""" + amount: int + """Integer amount of Telegram Stars received by the affiliate from the transaction, rounded to 0; can be negative for refunds""" + affiliate_user: Optional[User] = None + """*Optional*. The bot or the user that received an affiliate commission if it was received by a bot or a user""" + affiliate_chat: Optional[Chat] = None + """*Optional*. The chat that received an affiliate commission if it was received by a chat""" + nanostar_amount: Optional[int] = None + """*Optional*. The number of 1/1000000000 shares of Telegram Stars received by the affiliate; from -999999999 to 999999999; can be negative for refunds""" + + if TYPE_CHECKING: + # DO NOT EDIT MANUALLY!!! + # This section was auto-generated via `butcher` + + def __init__( + __pydantic__self__, + *, + commission_per_mille: int, + amount: int, + affiliate_user: Optional[User] = None, + affiliate_chat: Optional[Chat] = None, + nanostar_amount: Optional[int] = None, + **__pydantic_kwargs: Any, + ) -> None: + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + # Is needed only for type checking and IDE support without any additional plugins + + super().__init__( + commission_per_mille=commission_per_mille, + amount=amount, + affiliate_user=affiliate_user, + affiliate_chat=affiliate_chat, + nanostar_amount=nanostar_amount, + **__pydantic_kwargs, + ) diff --git a/aiogram/types/star_transaction.py b/aiogram/types/star_transaction.py index ab1bf836..1ef2856f 100644 --- a/aiogram/types/star_transaction.py +++ b/aiogram/types/star_transaction.py @@ -6,6 +6,9 @@ from .base import TelegramObject from .custom import DateTime if TYPE_CHECKING: + from .transaction_partner_affiliate_program import ( + TransactionPartnerAffiliateProgram, + ) from .transaction_partner_fragment import TransactionPartnerFragment from .transaction_partner_other import TransactionPartnerOther from .transaction_partner_telegram_ads import TransactionPartnerTelegramAds @@ -23,12 +26,15 @@ class StarTransaction(TelegramObject): id: str """Unique identifier of the transaction. Coincides with the identifier of the original transaction for refund transactions. Coincides with *SuccessfulPayment.telegram_payment_charge_id* for successful incoming payments from users.""" amount: int - """Number of Telegram Stars transferred by the transaction""" + """Integer amount of Telegram Stars transferred by the transaction""" date: DateTime """Date the transaction was created in Unix time""" + nanostar_amount: Optional[int] = None + """*Optional*. The number of 1/1000000000 shares of Telegram Stars transferred by the transaction; from 0 to 999999999""" source: Optional[ Union[ TransactionPartnerUser, + TransactionPartnerAffiliateProgram, TransactionPartnerFragment, TransactionPartnerTelegramAds, TransactionPartnerTelegramApi, @@ -39,6 +45,7 @@ class StarTransaction(TelegramObject): receiver: Optional[ Union[ TransactionPartnerUser, + TransactionPartnerAffiliateProgram, TransactionPartnerFragment, TransactionPartnerTelegramAds, TransactionPartnerTelegramApi, @@ -57,9 +64,11 @@ class StarTransaction(TelegramObject): id: str, amount: int, date: DateTime, + nanostar_amount: Optional[int] = None, source: Optional[ Union[ TransactionPartnerUser, + TransactionPartnerAffiliateProgram, TransactionPartnerFragment, TransactionPartnerTelegramAds, TransactionPartnerTelegramApi, @@ -69,6 +78,7 @@ class StarTransaction(TelegramObject): receiver: Optional[ Union[ TransactionPartnerUser, + TransactionPartnerAffiliateProgram, TransactionPartnerFragment, TransactionPartnerTelegramAds, TransactionPartnerTelegramApi, @@ -85,6 +95,7 @@ class StarTransaction(TelegramObject): id=id, amount=amount, date=date, + nanostar_amount=nanostar_amount, source=source, receiver=receiver, **__pydantic_kwargs, diff --git a/aiogram/types/transaction_partner.py b/aiogram/types/transaction_partner.py index 392d1cfe..fa2ca902 100644 --- a/aiogram/types/transaction_partner.py +++ b/aiogram/types/transaction_partner.py @@ -6,6 +6,7 @@ class TransactionPartner(TelegramObject): This object describes the source of a transaction, or its recipient for outgoing transactions. Currently, it can be one of - :class:`aiogram.types.transaction_partner_user.TransactionPartnerUser` + - :class:`aiogram.types.transaction_partner_affiliate_program.TransactionPartnerAffiliateProgram` - :class:`aiogram.types.transaction_partner_fragment.TransactionPartnerFragment` - :class:`aiogram.types.transaction_partner_telegram_ads.TransactionPartnerTelegramAds` - :class:`aiogram.types.transaction_partner_telegram_api.TransactionPartnerTelegramApi` diff --git a/aiogram/types/transaction_partner_affiliate_program.py b/aiogram/types/transaction_partner_affiliate_program.py new file mode 100644 index 00000000..d78ecef1 --- /dev/null +++ b/aiogram/types/transaction_partner_affiliate_program.py @@ -0,0 +1,51 @@ +from __future__ import annotations + +from typing import TYPE_CHECKING, Any, Literal, Optional + +from ..enums import TransactionPartnerType +from .transaction_partner import TransactionPartner + +if TYPE_CHECKING: + from .user import User + + +class TransactionPartnerAffiliateProgram(TransactionPartner): + """ + Describes the affiliate program that issued the affiliate commission received via this transaction. + + Source: https://core.telegram.org/bots/api#transactionpartneraffiliateprogram + """ + + type: Literal[TransactionPartnerType.AFFILIATE_PROGRAM] = ( + TransactionPartnerType.AFFILIATE_PROGRAM + ) + """Type of the transaction partner, always 'affiliate_program'""" + commission_per_mille: int + """The number of Telegram Stars received by the bot for each 1000 Telegram Stars received by the affiliate program sponsor from referred users""" + sponsor_user: Optional[User] = None + """*Optional*. Information about the bot that sponsored the affiliate program""" + + if TYPE_CHECKING: + # DO NOT EDIT MANUALLY!!! + # This section was auto-generated via `butcher` + + def __init__( + __pydantic__self__, + *, + type: Literal[ + TransactionPartnerType.AFFILIATE_PROGRAM + ] = TransactionPartnerType.AFFILIATE_PROGRAM, + commission_per_mille: int, + sponsor_user: Optional[User] = None, + **__pydantic_kwargs: Any, + ) -> None: + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + # Is needed only for type checking and IDE support without any additional plugins + + super().__init__( + type=type, + commission_per_mille=commission_per_mille, + sponsor_user=sponsor_user, + **__pydantic_kwargs, + ) diff --git a/aiogram/types/transaction_partner_user.py b/aiogram/types/transaction_partner_user.py index fbb47864..16ccc652 100644 --- a/aiogram/types/transaction_partner_user.py +++ b/aiogram/types/transaction_partner_user.py @@ -6,6 +6,8 @@ from ..enums import TransactionPartnerType from .transaction_partner import TransactionPartner if TYPE_CHECKING: + from .affiliate_info import AffiliateInfo + from .gift import Gift from .paid_media_photo import PaidMediaPhoto from .paid_media_preview import PaidMediaPreview from .paid_media_video import PaidMediaVideo @@ -23,6 +25,8 @@ class TransactionPartnerUser(TransactionPartner): """Type of the transaction partner, always 'user'""" user: User """Information about the user""" + affiliate: Optional[AffiliateInfo] = None + """*Optional*. Information about the affiliate that received a commission via this transaction""" invoice_payload: Optional[str] = None """*Optional*. Bot-specified invoice payload""" subscription_period: Optional[int] = None @@ -31,7 +35,7 @@ class TransactionPartnerUser(TransactionPartner): """*Optional*. Information about the paid media bought by the user""" paid_media_payload: Optional[str] = None """*Optional*. Bot-specified paid media payload""" - gift: Optional[str] = None + gift: Optional[Gift] = None """*Optional*. The gift sent to the user by the bot""" if TYPE_CHECKING: @@ -43,13 +47,14 @@ class TransactionPartnerUser(TransactionPartner): *, type: Literal[TransactionPartnerType.USER] = TransactionPartnerType.USER, user: User, + affiliate: Optional[AffiliateInfo] = None, invoice_payload: Optional[str] = None, subscription_period: Optional[int] = None, paid_media: Optional[ list[Union[PaidMediaPreview, PaidMediaPhoto, PaidMediaVideo]] ] = None, paid_media_payload: Optional[str] = None, - gift: Optional[str] = None, + gift: Optional[Gift] = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! @@ -59,6 +64,7 @@ class TransactionPartnerUser(TransactionPartner): super().__init__( type=type, user=user, + affiliate=affiliate, invoice_payload=invoice_payload, subscription_period=subscription_period, paid_media=paid_media, diff --git a/docs/api/types/affiliate_info.rst b/docs/api/types/affiliate_info.rst new file mode 100644 index 00000000..0fe145e9 --- /dev/null +++ b/docs/api/types/affiliate_info.rst @@ -0,0 +1,10 @@ +############# +AffiliateInfo +############# + + +.. automodule:: aiogram.types.affiliate_info + :members: + :member-order: bysource + :undoc-members: True + :exclude-members: model_config,model_fields diff --git a/docs/api/types/index.rst b/docs/api/types/index.rst index 0f8b97ad..446e0459 100644 --- a/docs/api/types/index.rst +++ b/docs/api/types/index.rst @@ -203,25 +203,13 @@ Inline mode prepared_inline_message sent_web_app_message -Stickers -======== - -.. toctree:: - :maxdepth: 1 - - gift - gifts - input_sticker - mask_position - sticker - sticker_set - Payments ======== .. toctree:: :maxdepth: 1 + affiliate_info invoice labeled_price order_info @@ -239,12 +227,26 @@ Payments star_transactions successful_payment transaction_partner + transaction_partner_affiliate_program transaction_partner_fragment transaction_partner_other transaction_partner_telegram_ads transaction_partner_telegram_api transaction_partner_user +Stickers +======== + +.. toctree:: + :maxdepth: 1 + + gift + gifts + input_sticker + mask_position + sticker + sticker_set + Telegram Passport ================= diff --git a/docs/api/types/transaction_partner_affiliate_program.rst b/docs/api/types/transaction_partner_affiliate_program.rst new file mode 100644 index 00000000..f20b2e62 --- /dev/null +++ b/docs/api/types/transaction_partner_affiliate_program.rst @@ -0,0 +1,10 @@ +################################## +TransactionPartnerAffiliateProgram +################################## + + +.. automodule:: aiogram.types.transaction_partner_affiliate_program + :members: + :member-order: bysource + :undoc-members: True + :exclude-members: model_config,model_fields diff --git a/docs/conf.py b/docs/conf.py index 071f05f2..3fa07d02 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -69,3 +69,14 @@ texinfo_documents = [ towncrier_draft_autoversion_mode = "draft" towncrier_draft_include_empty = False towncrier_draft_working_directory = Path(__file__).parent.parent + + +def skip_model_prefixed_members(app, what, name, obj, skip, options): + # Skip any member whose name starts with "model_" + if name.startswith("model_"): + return True + return skip + + +def setup(app): + app.connect("autodoc-skip-member", skip_model_prefixed_members) From 494e07a75aac613f354dbccf8fe6653a3fce5fc9 Mon Sep 17 00:00:00 2001 From: Dmitriy <111004114+dolgalevd@users.noreply.github.com> Date: Sat, 14 Dec 2024 20:32:21 +0300 Subject: [PATCH 04/10] Increased aiohttp version (#1615) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Increased aiohttp version * Added changes file * Update CHANGES/1615.misc.rst --------- Co-authored-by: Долгалев Дмитрий Игоревич Co-authored-by: Alex Root Junior --- CHANGES/1615.misc.rst | 1 + pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 CHANGES/1615.misc.rst diff --git a/CHANGES/1615.misc.rst b/CHANGES/1615.misc.rst new file mode 100644 index 00000000..34845b60 --- /dev/null +++ b/CHANGES/1615.misc.rst @@ -0,0 +1 @@ +Increased max :code:`aiohttp` version support from “<3.11” to “<3.12” diff --git a/pyproject.toml b/pyproject.toml index 0d916aa9..1e2f2572 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,7 +42,7 @@ classifiers = [ ] dependencies = [ "magic-filter>=1.0.12,<1.1", - "aiohttp>=3.9.0,<3.11", + "aiohttp>=3.9.0,<3.12", "pydantic>=2.4.1,<2.11", "aiofiles>=23.2.1,<24.2", "certifi>=2023.7.22", From f2e305e92a4f583b8f5d87b67d73237990417536 Mon Sep 17 00:00:00 2001 From: qvvonk Date: Sun, 15 Dec 2024 17:00:21 +0300 Subject: [PATCH 05/10] Added __call__ method to TelegramMethod class. (#1616) * Added __call__ method to TelegramMethod class. * Added rst. * Moved rst. * Deleted __call__, changed exception text. * Changed pull request desc text --- CHANGES/1616.bugfix.rst | 1 + aiogram/methods/base.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 CHANGES/1616.bugfix.rst diff --git a/CHANGES/1616.bugfix.rst b/CHANGES/1616.bugfix.rst new file mode 100644 index 00000000..3798d5da --- /dev/null +++ b/CHANGES/1616.bugfix.rst @@ -0,0 +1 @@ +Corrected the exception text of `aiogram.methods.base.TelegramMethod.__await__` method. diff --git a/aiogram/methods/base.py b/aiogram/methods/base.py index b2d35bec..3279199a 100644 --- a/aiogram/methods/base.py +++ b/aiogram/methods/base.py @@ -90,6 +90,6 @@ class TelegramMethod(BotContextController, BaseModel, Generic[TelegramType], ABC "This method is not mounted to a any bot instance, please call it explicilty " "with bot instance `await bot(method)`\n" "or mount method to a bot instance `method.as_(bot)` " - "and then call it `await method()`" + "and then call it `await method`" ) return self.emit(bot).__await__() From 1d5405ab43fc27958f348a86a839c4b65cdc7211 Mon Sep 17 00:00:00 2001 From: JRoot Junior Date: Sat, 21 Dec 2024 23:50:49 +0200 Subject: [PATCH 06/10] Bump version --- CHANGES.rst | 32 ++++++++++++++++++++++++++++++++ CHANGES/1607.misc.rst | 1 - CHANGES/1608.misc.rst | 1 - CHANGES/1615.misc.rst | 1 - CHANGES/1616.bugfix.rst | 1 - CHANGES/1617.feature.rst | 5 ----- aiogram/__meta__.py | 2 +- 7 files changed, 33 insertions(+), 10 deletions(-) delete mode 100644 CHANGES/1607.misc.rst delete mode 100644 CHANGES/1608.misc.rst delete mode 100644 CHANGES/1615.misc.rst delete mode 100644 CHANGES/1616.bugfix.rst delete mode 100644 CHANGES/1617.feature.rst diff --git a/CHANGES.rst b/CHANGES.rst index 045fb873..d17cb321 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -16,6 +16,38 @@ Changelog .. towncrier release notes start +3.13.1 (2024-12-21) +==================== + +Features +-------- + +- Added full support of `Bot API 8.1`_: + + - Added the field :code:`nanostar_amount` to the class :class:`aiogram.types.star_transaction.StarTransaction`. + - Added the class :class:`aiogram.types.transaction_partner_affiliate_program.TransactionPartnerAffiliateProgram` for transactions pertaining to incoming affiliate commissions. + - Added the class :class:`aiogram.types.affiliate_info.AffiliateInfo` and the field :code:`affiliate` to the class :class:`aiogram.types.transaction_partner_user.TransactionPartnerUser`, allowing bots to identify the relevant affiliate in transactions with an affiliate commission. + `#1617 `_ + + +Bugfixes +-------- + +- Corrected the exception text of `aiogram.methods.base.TelegramMethod.__await__` method. + `#1616 `_ + + +Misc +---- + +- Increased max :code:`pydantic` version support from “<2.10” to “<2.11” + `#1607 `_ +- Fixed closing tag for :code:`tg-emoji` in the :class:`aiogram.utils.text_decoration.HtmlDecoration`: use the same constant as for tag opening + `#1608 `_ +- Increased max :code:`aiohttp` version support from “<3.11” to “<3.12” + `#1615 `_ + + 3.15.0 (2024-11-17) ==================== diff --git a/CHANGES/1607.misc.rst b/CHANGES/1607.misc.rst deleted file mode 100644 index f9095214..00000000 --- a/CHANGES/1607.misc.rst +++ /dev/null @@ -1 +0,0 @@ -Increased max :code:`pydantic` version support from “<2.10” to “<2.11” diff --git a/CHANGES/1608.misc.rst b/CHANGES/1608.misc.rst deleted file mode 100644 index 2641bb8c..00000000 --- a/CHANGES/1608.misc.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed closing tag for :code:`tg-emoji` in the :class:`aiogram.utils.text_decoration.HtmlDecoration`: use the same constant as for tag opening diff --git a/CHANGES/1615.misc.rst b/CHANGES/1615.misc.rst deleted file mode 100644 index 34845b60..00000000 --- a/CHANGES/1615.misc.rst +++ /dev/null @@ -1 +0,0 @@ -Increased max :code:`aiohttp` version support from “<3.11” to “<3.12” diff --git a/CHANGES/1616.bugfix.rst b/CHANGES/1616.bugfix.rst deleted file mode 100644 index 3798d5da..00000000 --- a/CHANGES/1616.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Corrected the exception text of `aiogram.methods.base.TelegramMethod.__await__` method. diff --git a/CHANGES/1617.feature.rst b/CHANGES/1617.feature.rst deleted file mode 100644 index a72a8b32..00000000 --- a/CHANGES/1617.feature.rst +++ /dev/null @@ -1,5 +0,0 @@ -Added full support of `Bot API 8.1`_: - -- Added the field :code:`nanostar_amount` to the class :class:`aiogram.types.star_transaction.StarTransaction`. -- Added the class :class:`aiogram.types.transaction_partner_affiliate_program.TransactionPartnerAffiliateProgram` for transactions pertaining to incoming affiliate commissions. -- Added the class :class:`aiogram.types.affiliate_info.AffiliateInfo` and the field :code:`affiliate` to the class :class:`aiogram.types.transaction_partner_user.TransactionPartnerUser`, allowing bots to identify the relevant affiliate in transactions with an affiliate commission. diff --git a/aiogram/__meta__.py b/aiogram/__meta__.py index c0c3a8a7..ec78d40f 100644 --- a/aiogram/__meta__.py +++ b/aiogram/__meta__.py @@ -1,2 +1,2 @@ -__version__ = "3.15.0" +__version__ = "3.16.0" __api_version__ = "8.1" From 38e119052ef14214b597e076b5d4987f896fc3e5 Mon Sep 17 00:00:00 2001 From: JRoot Junior Date: Sun, 22 Dec 2024 17:00:04 +0200 Subject: [PATCH 07/10] Fixed incorrect version --- CHANGES.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index d17cb321..10d9fe8e 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -16,7 +16,7 @@ Changelog .. towncrier release notes start -3.13.1 (2024-12-21) +3.16.0 (2024-12-21) ==================== Features From 81550997f7318566737b88185a7b287f63c779bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D0=BE=D0=B4=D0=B0?= <93333363+Soda-Na@users.noreply.github.com> Date: Mon, 30 Dec 2024 02:49:40 +0300 Subject: [PATCH 08/10] Fix link formatting for Bot API 8.1 support in CHANGES.rst (#1619) --- CHANGES.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 10d9fe8e..d4c32310 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -22,7 +22,7 @@ Changelog Features -------- -- Added full support of `Bot API 8.1`_: +- Added full support of `Bot API 8.1 `_: - Added the field :code:`nanostar_amount` to the class :class:`aiogram.types.star_transaction.StarTransaction`. - Added the class :class:`aiogram.types.transaction_partner_affiliate_program.TransactionPartnerAffiliateProgram` for transactions pertaining to incoming affiliate commissions. From afccd8a38fdd2c8155a1786ba2777e69bca641dc Mon Sep 17 00:00:00 2001 From: Alex Root Junior Date: Thu, 2 Jan 2025 02:38:18 +0200 Subject: [PATCH 09/10] Added full support of Bot API 8.2 (#1623) * Added full support of Bot API 8.2 * Added changelog * Try to add port * Add port to the `test_reset_connector` --- .butcher/methods/getUpdates/entity.json | 6 +- .../removeChatVerification/entity.json | 25 +++ .../removeUserVerification/entity.json | 25 +++ .butcher/methods/sendGift/entity.json | 8 + .../setStickerSetThumbnail/entity.json | 12 +- .butcher/methods/setWebhook/entity.json | 6 +- .butcher/methods/verifyChat/entity.json | 33 ++++ .butcher/methods/verifyUser/entity.json | 33 ++++ .butcher/schema/schema.json | 164 ++++++++++++++---- .../types/BackgroundTypePattern/entity.json | 6 +- .butcher/types/Gift/entity.json | 8 + .../InlineQueryResultArticle/entity.json | 20 ++- .../types/InlineQueryResultGif/entity.json | 6 +- .../InlineQueryResultMpeg4Gif/entity.json | 6 +- .butcher/types/InputSticker/entity.json | 6 +- CHANGES/1623.feature.rst | 6 + aiogram/client/bot.py | 99 ++++++++++- aiogram/methods/__init__.py | 8 + aiogram/methods/remove_chat_verification.py | 32 ++++ aiogram/methods/remove_user_verification.py | 30 ++++ aiogram/methods/send_gift.py | 4 + aiogram/methods/set_sticker_set_thumbnail.py | 4 +- aiogram/methods/set_webhook.py | 2 +- aiogram/methods/verify_chat.py | 40 +++++ aiogram/methods/verify_user.py | 40 +++++ aiogram/types/background_type_pattern.py | 2 +- aiogram/types/gift.py | 4 + aiogram/types/inline_query_result_article.py | 13 +- aiogram/types/inline_query_result_gif.py | 2 +- .../types/inline_query_result_mpeg4_gif.py | 2 +- aiogram/types/input_sticker.py | 2 +- docs/api/methods/index.rst | 4 + docs/api/methods/remove_chat_verification.rst | 45 +++++ docs/api/methods/remove_user_verification.rst | 45 +++++ docs/api/methods/verify_chat.rst | 45 +++++ docs/api/methods/verify_user.rst | 45 +++++ .../test_session/test_aiohttp_session.py | 10 +- .../test_remove_chat_verification.py | 12 ++ .../test_remove_user_verification.py | 12 ++ .../test_api/test_methods/test_verify_chat.py | 12 ++ .../test_api/test_methods/test_verify_user.py | 12 ++ 41 files changed, 811 insertions(+), 85 deletions(-) create mode 100644 .butcher/methods/removeChatVerification/entity.json create mode 100644 .butcher/methods/removeUserVerification/entity.json create mode 100644 .butcher/methods/verifyChat/entity.json create mode 100644 .butcher/methods/verifyUser/entity.json create mode 100644 CHANGES/1623.feature.rst create mode 100644 aiogram/methods/remove_chat_verification.py create mode 100644 aiogram/methods/remove_user_verification.py create mode 100644 aiogram/methods/verify_chat.py create mode 100644 aiogram/methods/verify_user.py create mode 100644 docs/api/methods/remove_chat_verification.rst create mode 100644 docs/api/methods/remove_user_verification.rst create mode 100644 docs/api/methods/verify_chat.rst create mode 100644 docs/api/methods/verify_user.rst create mode 100644 tests/test_api/test_methods/test_remove_chat_verification.py create mode 100644 tests/test_api/test_methods/test_remove_user_verification.py create mode 100644 tests/test_api/test_methods/test_verify_chat.py create mode 100644 tests/test_api/test_methods/test_verify_user.py diff --git a/.butcher/methods/getUpdates/entity.json b/.butcher/methods/getUpdates/entity.json index 0c2f1299..dc9cbad1 100644 --- a/.butcher/methods/getUpdates/entity.json +++ b/.butcher/methods/getUpdates/entity.json @@ -38,9 +38,9 @@ { "type": "Array of String", "required": false, - "description": "A JSON-serialized list of the update types you want your bot to receive. For example, specify [\"message\", \"edited_channel_post\", \"callback_query\"] to only receive updates of these types. See Update for a complete list of available update types. Specify an empty list to receive all update types except chat_member, message_reaction, and message_reaction_count (default). If not specified, the previous setting will be used.\n\nPlease note that this parameter doesn't affect updates created before the call to the getUpdates, so unwanted updates may be received for a short period of time.", - "html_description": "A JSON-serialized list of the update types you want your bot to receive. For example, specify [\"message\", \"edited_channel_post\", \"callback_query\"] to only receive updates of these types. See Update for a complete list of available update types. Specify an empty list to receive all update types except chat_member, message_reaction, and message_reaction_count (default). If not specified, the previous setting will be used.
\n
\nPlease note that this parameter doesn't affect updates created before the call to the getUpdates, so unwanted updates may be received for a short period of time.", - "rst_description": "A JSON-serialized list of the update types you want your bot to receive. For example, specify :code:`[\"message\", \"edited_channel_post\", \"callback_query\"]` to only receive updates of these types. See :class:`aiogram.types.update.Update` for a complete list of available update types. Specify an empty list to receive all update types except *chat_member*, *message_reaction*, and *message_reaction_count* (default). If not specified, the previous setting will be used.\n\n\n\nPlease note that this parameter doesn't affect updates created before the call to the getUpdates, so unwanted updates may be received for a short period of time.\n", + "description": "A JSON-serialized list of the update types you want your bot to receive. For example, specify [\"message\", \"edited_channel_post\", \"callback_query\"] to only receive updates of these types. See Update for a complete list of available update types. Specify an empty list to receive all update types except chat_member, message_reaction, and message_reaction_count (default). If not specified, the previous setting will be used.\n\nPlease note that this parameter doesn't affect updates created before the call to getUpdates, so unwanted updates may be received for a short period of time.", + "html_description": "A JSON-serialized list of the update types you want your bot to receive. For example, specify [\"message\", \"edited_channel_post\", \"callback_query\"] to only receive updates of these types. See Update for a complete list of available update types. Specify an empty list to receive all update types except chat_member, message_reaction, and message_reaction_count (default). If not specified, the previous setting will be used.
\n
\nPlease note that this parameter doesn't affect updates created before the call to getUpdates, so unwanted updates may be received for a short period of time.", + "rst_description": "A JSON-serialized list of the update types you want your bot to receive. For example, specify :code:`[\"message\", \"edited_channel_post\", \"callback_query\"]` to only receive updates of these types. See :class:`aiogram.types.update.Update` for a complete list of available update types. Specify an empty list to receive all update types except *chat_member*, *message_reaction*, and *message_reaction_count* (default). If not specified, the previous setting will be used.\n\n\n\nPlease note that this parameter doesn't affect updates created before the call to getUpdates, so unwanted updates may be received for a short period of time.\n", "name": "allowed_updates" } ], diff --git a/.butcher/methods/removeChatVerification/entity.json b/.butcher/methods/removeChatVerification/entity.json new file mode 100644 index 00000000..4828b2ca --- /dev/null +++ b/.butcher/methods/removeChatVerification/entity.json @@ -0,0 +1,25 @@ +{ + "meta": {}, + "group": { + "title": "Stickers", + "anchor": "stickers" + }, + "object": { + "anchor": "removechatverification", + "name": "removeChatVerification", + "description": "Removes verification from a chat that is currently verified on behalf of the organization represented by the bot. Returns True on success.", + "html_description": "

Removes verification from a chat that is currently verified on behalf of the organization represented by the bot. Returns True on success.

", + "rst_description": "Removes verification from a chat that is currently verified on behalf of the organization represented by the bot. Returns :code:`True` on success.", + "annotations": [ + { + "type": "Integer or String", + "required": true, + "description": "Unique identifier for the target chat or username of the target channel (in the format @channelusername)", + "html_description": "Unique identifier for the target chat or username of the target channel (in the format @channelusername)", + "rst_description": "Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)\n", + "name": "chat_id" + } + ], + "category": "methods" + } +} diff --git a/.butcher/methods/removeUserVerification/entity.json b/.butcher/methods/removeUserVerification/entity.json new file mode 100644 index 00000000..87de37d8 --- /dev/null +++ b/.butcher/methods/removeUserVerification/entity.json @@ -0,0 +1,25 @@ +{ + "meta": {}, + "group": { + "title": "Stickers", + "anchor": "stickers" + }, + "object": { + "anchor": "removeuserverification", + "name": "removeUserVerification", + "description": "Removes verification from a user who is currently verified on behalf of the organization represented by the bot. Returns True on success.", + "html_description": "

Removes verification from a user who is currently verified on behalf of the organization represented by the bot. Returns True on success.

", + "rst_description": "Removes verification from a user who is currently verified on behalf of the organization represented by the bot. Returns :code:`True` on success.", + "annotations": [ + { + "type": "Integer", + "required": true, + "description": "Unique identifier of the target user", + "html_description": "Unique identifier of the target user", + "rst_description": "Unique identifier of the target user\n", + "name": "user_id" + } + ], + "category": "methods" + } +} diff --git a/.butcher/methods/sendGift/entity.json b/.butcher/methods/sendGift/entity.json index f180440f..56797cb4 100644 --- a/.butcher/methods/sendGift/entity.json +++ b/.butcher/methods/sendGift/entity.json @@ -27,6 +27,14 @@ "rst_description": "Identifier of the gift\n", "name": "gift_id" }, + { + "type": "Boolean", + "required": false, + "description": "Pass True to pay for the gift upgrade from the bot's balance, thereby making the upgrade free for the receiver", + "html_description": "Pass True to pay for the gift upgrade from the bot's balance, thereby making the upgrade free for the receiver", + "rst_description": "Pass :code:`True` to pay for the gift upgrade from the bot's balance, thereby making the upgrade free for the receiver\n", + "name": "pay_for_upgrade" + }, { "type": "String", "required": false, diff --git a/.butcher/methods/setStickerSetThumbnail/entity.json b/.butcher/methods/setStickerSetThumbnail/entity.json index b334490d..4d2e6add 100644 --- a/.butcher/methods/setStickerSetThumbnail/entity.json +++ b/.butcher/methods/setStickerSetThumbnail/entity.json @@ -30,17 +30,17 @@ { "type": "InputFile or String", "required": false, - "description": "A .WEBP or .PNG image with the thumbnail, must be up to 128 kilobytes in size and have a width and height of exactly 100px, or a .TGS animation with a thumbnail up to 32 kilobytes in size (see https://core.telegram.org/stickers#animation-requirements for animated sticker technical requirements), or a WEBM video with the thumbnail up to 32 kilobytes in size; see https://core.telegram.org/stickers#video-requirements for video sticker technical requirements. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More information on Sending Files. Animated and video sticker set thumbnails can't be uploaded via HTTP URL. If omitted, then the thumbnail is dropped and the first sticker is used as the thumbnail.", - "html_description": "A .WEBP or .PNG image with the thumbnail, must be up to 128 kilobytes in size and have a width and height of exactly 100px, or a .TGS animation with a thumbnail up to 32 kilobytes in size (see https://core.telegram.org/stickers#animation-requirements for animated sticker technical requirements), or a WEBM video with the thumbnail up to 32 kilobytes in size; see https://core.telegram.org/stickers#video-requirements for video sticker technical requirements. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More information on Sending Files ». Animated and video sticker set thumbnails can't be uploaded via HTTP URL. If omitted, then the thumbnail is dropped and the first sticker is used as the thumbnail.", - "rst_description": "A **.WEBP** or **.PNG** image with the thumbnail, must be up to 128 kilobytes in size and have a width and height of exactly 100px, or a **.TGS** animation with a thumbnail up to 32 kilobytes in size (see `https://core.telegram.org/stickers#animation-requirements `_`https://core.telegram.org/stickers#animation-requirements `_ for animated sticker technical requirements), or a **WEBM** video with the thumbnail up to 32 kilobytes in size; see `https://core.telegram.org/stickers#video-requirements `_`https://core.telegram.org/stickers#video-requirements `_ for video sticker technical requirements. Pass a *file_id* as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. :ref:`More information on Sending Files » `. Animated and video sticker set thumbnails can't be uploaded via HTTP URL. If omitted, then the thumbnail is dropped and the first sticker is used as the thumbnail.\n", + "description": "A .WEBP or .PNG image with the thumbnail, must be up to 128 kilobytes in size and have a width and height of exactly 100px, or a .TGS animation with a thumbnail up to 32 kilobytes in size (see https://core.telegram.org/stickers#animation-requirements for animated sticker technical requirements), or a .WEBM video with the thumbnail up to 32 kilobytes in size; see https://core.telegram.org/stickers#video-requirements for video sticker technical requirements. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More information on Sending Files. Animated and video sticker set thumbnails can't be uploaded via HTTP URL. If omitted, then the thumbnail is dropped and the first sticker is used as the thumbnail.", + "html_description": "A .WEBP or .PNG image with the thumbnail, must be up to 128 kilobytes in size and have a width and height of exactly 100px, or a .TGS animation with a thumbnail up to 32 kilobytes in size (see https://core.telegram.org/stickers#animation-requirements for animated sticker technical requirements), or a .WEBM video with the thumbnail up to 32 kilobytes in size; see https://core.telegram.org/stickers#video-requirements for video sticker technical requirements. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More information on Sending Files ». Animated and video sticker set thumbnails can't be uploaded via HTTP URL. If omitted, then the thumbnail is dropped and the first sticker is used as the thumbnail.", + "rst_description": "A **.WEBP** or **.PNG** image with the thumbnail, must be up to 128 kilobytes in size and have a width and height of exactly 100px, or a **.TGS** animation with a thumbnail up to 32 kilobytes in size (see `https://core.telegram.org/stickers#animation-requirements `_`https://core.telegram.org/stickers#animation-requirements `_ for animated sticker technical requirements), or a **.WEBM** video with the thumbnail up to 32 kilobytes in size; see `https://core.telegram.org/stickers#video-requirements `_`https://core.telegram.org/stickers#video-requirements `_ for video sticker technical requirements. Pass a *file_id* as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. :ref:`More information on Sending Files » `. Animated and video sticker set thumbnails can't be uploaded via HTTP URL. If omitted, then the thumbnail is dropped and the first sticker is used as the thumbnail.\n", "name": "thumbnail" }, { "type": "String", "required": true, - "description": "Format of the thumbnail, must be one of 'static' for a .WEBP or .PNG image, 'animated' for a .TGS animation, or 'video' for a WEBM video", - "html_description": "Format of the thumbnail, must be one of “static” for a .WEBP or .PNG image, “animated” for a .TGS animation, or “video” for a WEBM video", - "rst_description": "Format of the thumbnail, must be one of 'static' for a **.WEBP** or **.PNG** image, 'animated' for a **.TGS** animation, or 'video' for a **WEBM** video\n", + "description": "Format of the thumbnail, must be one of 'static' for a .WEBP or .PNG image, 'animated' for a .TGS animation, or 'video' for a .WEBM video", + "html_description": "Format of the thumbnail, must be one of “static” for a .WEBP or .PNG image, “animated” for a .TGS animation, or “video” for a .WEBM video", + "rst_description": "Format of the thumbnail, must be one of 'static' for a **.WEBP** or **.PNG** image, 'animated' for a **.TGS** animation, or 'video' for a **.WEBM** video\n", "name": "format" } ], diff --git a/.butcher/methods/setWebhook/entity.json b/.butcher/methods/setWebhook/entity.json index 7233fec6..0532b3de 100644 --- a/.butcher/methods/setWebhook/entity.json +++ b/.butcher/methods/setWebhook/entity.json @@ -7,9 +7,9 @@ "object": { "anchor": "setwebhook", "name": "setWebhook", - "description": "Use this method to specify a URL and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified URL, containing a JSON-serialized Update. In case of an unsuccessful request, we will give up after a reasonable amount of attempts. Returns True on success.\nIf you'd like to make sure that the webhook was set by you, you can specify secret data in the parameter secret_token. If specified, the request will contain a header 'X-Telegram-Bot-Api-Secret-Token' with the secret token as content.\nNotes\n1. You will not be able to receive updates using getUpdates for as long as an outgoing webhook is set up.\n2. To use a self-signed certificate, you need to upload your public key certificate using certificate parameter. Please upload as InputFile, sending a String will not work.\n3. Ports currently supported for webhooks: 443, 80, 88, 8443.\nIf you're having any trouble setting up webhooks, please check out this amazing guide to webhooks.", - "html_description": "

Use this method to specify a URL and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified URL, containing a JSON-serialized Update. In case of an unsuccessful request, we will give up after a reasonable amount of attempts. Returns True on success.

If you'd like to make sure that the webhook was set by you, you can specify secret data in the parameter secret_token. If specified, the request will contain a header “X-Telegram-Bot-Api-Secret-Token” with the secret token as content.

\n

Notes
\n1. You will not be able to receive updates using getUpdates for as long as an outgoing webhook is set up.
\n2. To use a self-signed certificate, you need to upload your public key certificate using certificate parameter. Please upload as InputFile, sending a String will not work.
\n3. Ports currently supported for webhooks: 443, 80, 88, 8443.

\n

If you're having any trouble setting up webhooks, please check out this amazing guide to webhooks.

\n
", - "rst_description": "Use this method to specify a URL and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified URL, containing a JSON-serialized :class:`aiogram.types.update.Update`. In case of an unsuccessful request, we will give up after a reasonable amount of attempts. Returns :code:`True` on success.\nIf you'd like to make sure that the webhook was set by you, you can specify secret data in the parameter *secret_token*. If specified, the request will contain a header 'X-Telegram-Bot-Api-Secret-Token' with the secret token as content.\n\n **Notes**\n \n **1.** You will not be able to receive updates using :class:`aiogram.methods.get_updates.GetUpdates` for as long as an outgoing webhook is set up.\n \n **2.** To use a self-signed certificate, you need to upload your `public key certificate `_ using *certificate* parameter. Please upload as InputFile, sending a String will not work.\n \n **3.** Ports currently supported *for webhooks*: **443, 80, 88, 8443**.\n If you're having any trouble setting up webhooks, please check out this `amazing guide to webhooks `_.", + "description": "Use this method to specify a URL and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified URL, containing a JSON-serialized Update. In case of an unsuccessful request (a request with response HTTP status code different from 2XY), we will repeat the request and give up after a reasonable amount of attempts. Returns True on success.\nIf you'd like to make sure that the webhook was set by you, you can specify secret data in the parameter secret_token. If specified, the request will contain a header 'X-Telegram-Bot-Api-Secret-Token' with the secret token as content.\nNotes\n1. You will not be able to receive updates using getUpdates for as long as an outgoing webhook is set up.\n2. To use a self-signed certificate, you need to upload your public key certificate using certificate parameter. Please upload as InputFile, sending a String will not work.\n3. Ports currently supported for webhooks: 443, 80, 88, 8443.\nIf you're having any trouble setting up webhooks, please check out this amazing guide to webhooks.", + "html_description": "

Use this method to specify a URL and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified URL, containing a JSON-serialized Update. In case of an unsuccessful request (a request with response HTTP status code different from 2XY), we will repeat the request and give up after a reasonable amount of attempts. Returns True on success.

If you'd like to make sure that the webhook was set by you, you can specify secret data in the parameter secret_token. If specified, the request will contain a header “X-Telegram-Bot-Api-Secret-Token” with the secret token as content.

\n

Notes
\n1. You will not be able to receive updates using getUpdates for as long as an outgoing webhook is set up.
\n2. To use a self-signed certificate, you need to upload your public key certificate using certificate parameter. Please upload as InputFile, sending a String will not work.
\n3. Ports currently supported for webhooks: 443, 80, 88, 8443.

\n

If you're having any trouble setting up webhooks, please check out this amazing guide to webhooks.

\n
", + "rst_description": "Use this method to specify a URL and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified URL, containing a JSON-serialized :class:`aiogram.types.update.Update`. In case of an unsuccessful request (a request with response `HTTP status code `_ different from :code:`2XY`), we will repeat the request and give up after a reasonable amount of attempts. Returns :code:`True` on success.\nIf you'd like to make sure that the webhook was set by you, you can specify secret data in the parameter *secret_token*. If specified, the request will contain a header 'X-Telegram-Bot-Api-Secret-Token' with the secret token as content.\n\n **Notes**\n \n **1.** You will not be able to receive updates using :class:`aiogram.methods.get_updates.GetUpdates` for as long as an outgoing webhook is set up.\n \n **2.** To use a self-signed certificate, you need to upload your `public key certificate `_ using *certificate* parameter. Please upload as InputFile, sending a String will not work.\n \n **3.** Ports currently supported *for webhooks*: **443, 80, 88, 8443**.\n If you're having any trouble setting up webhooks, please check out this `amazing guide to webhooks `_.", "annotations": [ { "type": "String", diff --git a/.butcher/methods/verifyChat/entity.json b/.butcher/methods/verifyChat/entity.json new file mode 100644 index 00000000..ee9bef83 --- /dev/null +++ b/.butcher/methods/verifyChat/entity.json @@ -0,0 +1,33 @@ +{ + "meta": {}, + "group": { + "title": "Stickers", + "anchor": "stickers" + }, + "object": { + "anchor": "verifychat", + "name": "verifyChat", + "description": "Verifies a chat on behalf of the organization which is represented by the bot. Returns True on success.", + "html_description": "

Verifies a chat on behalf of the organization which is represented by the bot. Returns True on success.

", + "rst_description": "Verifies a chat on behalf of the organization which is represented by the bot. Returns :code:`True` on success.", + "annotations": [ + { + "type": "Integer or String", + "required": true, + "description": "Unique identifier for the target chat or username of the target channel (in the format @channelusername)", + "html_description": "Unique identifier for the target chat or username of the target channel (in the format @channelusername)", + "rst_description": "Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)\n", + "name": "chat_id" + }, + { + "type": "String", + "required": false, + "description": "Custom description for the verification; 0-70 characters. Must be empty if the organization isn't allowed to provide a custom verification description.", + "html_description": "Custom description for the verification; 0-70 characters. Must be empty if the organization isn't allowed to provide a custom verification description.", + "rst_description": "Custom description for the verification; 0-70 characters. Must be empty if the organization isn't allowed to provide a custom verification description.\n", + "name": "custom_description" + } + ], + "category": "methods" + } +} diff --git a/.butcher/methods/verifyUser/entity.json b/.butcher/methods/verifyUser/entity.json new file mode 100644 index 00000000..b95ec764 --- /dev/null +++ b/.butcher/methods/verifyUser/entity.json @@ -0,0 +1,33 @@ +{ + "meta": {}, + "group": { + "title": "Stickers", + "anchor": "stickers" + }, + "object": { + "anchor": "verifyuser", + "name": "verifyUser", + "description": "Verifies a user on behalf of the organization which is represented by the bot. Returns True on success.", + "html_description": "

Verifies a user on behalf of the organization which is represented by the bot. Returns True on success.

", + "rst_description": "Verifies a user on behalf of the organization which is represented by the bot. Returns :code:`True` on success.", + "annotations": [ + { + "type": "Integer", + "required": true, + "description": "Unique identifier of the target user", + "html_description": "Unique identifier of the target user", + "rst_description": "Unique identifier of the target user\n", + "name": "user_id" + }, + { + "type": "String", + "required": false, + "description": "Custom description for the verification; 0-70 characters. Must be empty if the organization isn't allowed to provide a custom verification description.", + "html_description": "Custom description for the verification; 0-70 characters. Must be empty if the organization isn't allowed to provide a custom verification description.", + "rst_description": "Custom description for the verification; 0-70 characters. Must be empty if the organization isn't allowed to provide a custom verification description.\n", + "name": "custom_description" + } + ], + "category": "methods" + } +} diff --git a/.butcher/schema/schema.json b/.butcher/schema/schema.json index c3157eb4..4c915617 100644 --- a/.butcher/schema/schema.json +++ b/.butcher/schema/schema.json @@ -1,7 +1,7 @@ { "api": { - "version": "8.1", - "release_date": "2024-12-04" + "version": "8.2", + "release_date": "2025-01-01" }, "items": [ { @@ -244,9 +244,9 @@ { "type": "Array of String", "required": false, - "description": "A JSON-serialized list of the update types you want your bot to receive. For example, specify [\"message\", \"edited_channel_post\", \"callback_query\"] to only receive updates of these types. See Update for a complete list of available update types. Specify an empty list to receive all update types except chat_member, message_reaction, and message_reaction_count (default). If not specified, the previous setting will be used.\n\nPlease note that this parameter doesn't affect updates created before the call to the getUpdates, so unwanted updates may be received for a short period of time.", - "html_description": "A JSON-serialized list of the update types you want your bot to receive. For example, specify [\"message\", \"edited_channel_post\", \"callback_query\"] to only receive updates of these types. See Update for a complete list of available update types. Specify an empty list to receive all update types except chat_member, message_reaction, and message_reaction_count (default). If not specified, the previous setting will be used.
\n
\nPlease note that this parameter doesn't affect updates created before the call to the getUpdates, so unwanted updates may be received for a short period of time.", - "rst_description": "A JSON-serialized list of the update types you want your bot to receive. For example, specify :code:`[\"message\", \"edited_channel_post\", \"callback_query\"]` to only receive updates of these types. See :class:`aiogram.types.update.Update` for a complete list of available update types. Specify an empty list to receive all update types except *chat_member*, *message_reaction*, and *message_reaction_count* (default). If not specified, the previous setting will be used.\n\n\n\nPlease note that this parameter doesn't affect updates created before the call to the getUpdates, so unwanted updates may be received for a short period of time.\n", + "description": "A JSON-serialized list of the update types you want your bot to receive. For example, specify [\"message\", \"edited_channel_post\", \"callback_query\"] to only receive updates of these types. See Update for a complete list of available update types. Specify an empty list to receive all update types except chat_member, message_reaction, and message_reaction_count (default). If not specified, the previous setting will be used.\n\nPlease note that this parameter doesn't affect updates created before the call to getUpdates, so unwanted updates may be received for a short period of time.", + "html_description": "A JSON-serialized list of the update types you want your bot to receive. For example, specify [\"message\", \"edited_channel_post\", \"callback_query\"] to only receive updates of these types. See Update for a complete list of available update types. Specify an empty list to receive all update types except chat_member, message_reaction, and message_reaction_count (default). If not specified, the previous setting will be used.
\n
\nPlease note that this parameter doesn't affect updates created before the call to getUpdates, so unwanted updates may be received for a short period of time.", + "rst_description": "A JSON-serialized list of the update types you want your bot to receive. For example, specify :code:`[\"message\", \"edited_channel_post\", \"callback_query\"]` to only receive updates of these types. See :class:`aiogram.types.update.Update` for a complete list of available update types. Specify an empty list to receive all update types except *chat_member*, *message_reaction*, and *message_reaction_count* (default). If not specified, the previous setting will be used.\n\n\n\nPlease note that this parameter doesn't affect updates created before the call to getUpdates, so unwanted updates may be received for a short period of time.\n", "name": "allowed_updates" } ], @@ -255,9 +255,9 @@ { "anchor": "setwebhook", "name": "setWebhook", - "description": "Use this method to specify a URL and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified URL, containing a JSON-serialized Update. In case of an unsuccessful request, we will give up after a reasonable amount of attempts. Returns True on success.\nIf you'd like to make sure that the webhook was set by you, you can specify secret data in the parameter secret_token. If specified, the request will contain a header 'X-Telegram-Bot-Api-Secret-Token' with the secret token as content.\nNotes\n1. You will not be able to receive updates using getUpdates for as long as an outgoing webhook is set up.\n2. To use a self-signed certificate, you need to upload your public key certificate using certificate parameter. Please upload as InputFile, sending a String will not work.\n3. Ports currently supported for webhooks: 443, 80, 88, 8443.\nIf you're having any trouble setting up webhooks, please check out this amazing guide to webhooks.", - "html_description": "

Use this method to specify a URL and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified URL, containing a JSON-serialized Update. In case of an unsuccessful request, we will give up after a reasonable amount of attempts. Returns True on success.

If you'd like to make sure that the webhook was set by you, you can specify secret data in the parameter secret_token. If specified, the request will contain a header “X-Telegram-Bot-Api-Secret-Token” with the secret token as content.

\n

Notes
\n1. You will not be able to receive updates using getUpdates for as long as an outgoing webhook is set up.
\n2. To use a self-signed certificate, you need to upload your public key certificate using certificate parameter. Please upload as InputFile, sending a String will not work.
\n3. Ports currently supported for webhooks: 443, 80, 88, 8443.

\n

If you're having any trouble setting up webhooks, please check out this amazing guide to webhooks.

\n
", - "rst_description": "Use this method to specify a URL and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified URL, containing a JSON-serialized :class:`aiogram.types.update.Update`. In case of an unsuccessful request, we will give up after a reasonable amount of attempts. Returns :code:`True` on success.\nIf you'd like to make sure that the webhook was set by you, you can specify secret data in the parameter *secret_token*. If specified, the request will contain a header 'X-Telegram-Bot-Api-Secret-Token' with the secret token as content.\n\n **Notes**\n \n **1.** You will not be able to receive updates using :class:`aiogram.methods.get_updates.GetUpdates` for as long as an outgoing webhook is set up.\n \n **2.** To use a self-signed certificate, you need to upload your `public key certificate `_ using *certificate* parameter. Please upload as InputFile, sending a String will not work.\n \n **3.** Ports currently supported *for webhooks*: **443, 80, 88, 8443**.\n If you're having any trouble setting up webhooks, please check out this `amazing guide to webhooks `_.", + "description": "Use this method to specify a URL and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified URL, containing a JSON-serialized Update. In case of an unsuccessful request (a request with response HTTP status code different from 2XY), we will repeat the request and give up after a reasonable amount of attempts. Returns True on success.\nIf you'd like to make sure that the webhook was set by you, you can specify secret data in the parameter secret_token. If specified, the request will contain a header 'X-Telegram-Bot-Api-Secret-Token' with the secret token as content.\nNotes\n1. You will not be able to receive updates using getUpdates for as long as an outgoing webhook is set up.\n2. To use a self-signed certificate, you need to upload your public key certificate using certificate parameter. Please upload as InputFile, sending a String will not work.\n3. Ports currently supported for webhooks: 443, 80, 88, 8443.\nIf you're having any trouble setting up webhooks, please check out this amazing guide to webhooks.", + "html_description": "

Use this method to specify a URL and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified URL, containing a JSON-serialized Update. In case of an unsuccessful request (a request with response HTTP status code different from 2XY), we will repeat the request and give up after a reasonable amount of attempts. Returns True on success.

If you'd like to make sure that the webhook was set by you, you can specify secret data in the parameter secret_token. If specified, the request will contain a header “X-Telegram-Bot-Api-Secret-Token” with the secret token as content.

\n

Notes
\n1. You will not be able to receive updates using getUpdates for as long as an outgoing webhook is set up.
\n2. To use a self-signed certificate, you need to upload your public key certificate using certificate parameter. Please upload as InputFile, sending a String will not work.
\n3. Ports currently supported for webhooks: 443, 80, 88, 8443.

\n

If you're having any trouble setting up webhooks, please check out this amazing guide to webhooks.

\n
", + "rst_description": "Use this method to specify a URL and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified URL, containing a JSON-serialized :class:`aiogram.types.update.Update`. In case of an unsuccessful request (a request with response `HTTP status code `_ different from :code:`2XY`), we will repeat the request and give up after a reasonable amount of attempts. Returns :code:`True` on success.\nIf you'd like to make sure that the webhook was set by you, you can specify secret data in the parameter *secret_token*. If specified, the request will contain a header 'X-Telegram-Bot-Api-Secret-Token' with the secret token as content.\n\n **Notes**\n \n **1.** You will not be able to receive updates using :class:`aiogram.methods.get_updates.GetUpdates` for as long as an outgoing webhook is set up.\n \n **2.** To use a self-signed certificate, you need to upload your `public key certificate `_ using *certificate* parameter. Please upload as InputFile, sending a String will not work.\n \n **3.** Ports currently supported *for webhooks*: **443, 80, 88, 8443**.\n If you're having any trouble setting up webhooks, please check out this `amazing guide to webhooks `_.", "annotations": [ { "type": "String", @@ -3616,9 +3616,9 @@ { "anchor": "backgroundtypepattern", "name": "BackgroundTypePattern", - "description": "The background is a PNG or TGV (gzipped subset of SVG with MIME type 'application/x-tgwallpattern') pattern to be combined with the background fill chosen by the user.", - "html_description": "

The background is a PNG or TGV (gzipped subset of SVG with MIME type “application/x-tgwallpattern”) pattern to be combined with the background fill chosen by the user.

", - "rst_description": "The background is a PNG or TGV (gzipped subset of SVG with MIME type 'application/x-tgwallpattern') pattern to be combined with the background fill chosen by the user.", + "description": "The background is a .PNG or .TGV (gzipped subset of SVG with MIME type 'application/x-tgwallpattern') pattern to be combined with the background fill chosen by the user.", + "html_description": "

The background is a .PNG or .TGV (gzipped subset of SVG with MIME type “application/x-tgwallpattern”) pattern to be combined with the background fill chosen by the user.

", + "rst_description": "The background is a .PNG or .TGV (gzipped subset of SVG with MIME type 'application/x-tgwallpattern') pattern to be combined with the background fill chosen by the user.", "annotations": [ { "type": "String", @@ -12658,9 +12658,9 @@ }, { "type": "String", - "description": "Format of the added sticker, must be one of 'static' for a .WEBP or .PNG image, 'animated' for a .TGS animation, 'video' for a WEBM video", - "html_description": "Format of the added sticker, must be one of “static” for a .WEBP or .PNG image, “animated” for a .TGS animation, “video” for a WEBM video", - "rst_description": "Format of the added sticker, must be one of 'static' for a **.WEBP** or **.PNG** image, 'animated' for a **.TGS** animation, 'video' for a **WEBM** video\n", + "description": "Format of the added sticker, must be one of 'static' for a .WEBP or .PNG image, 'animated' for a .TGS animation, 'video' for a .WEBM video", + "html_description": "Format of the added sticker, must be one of “static” for a .WEBP or .PNG image, “animated” for a .TGS animation, “video” for a .WEBM video", + "rst_description": "Format of the added sticker, must be one of 'static' for a **.WEBP** or **.PNG** image, 'animated' for a **.TGS** animation, 'video' for a **.WEBM** video\n", "name": "format", "required": true }, @@ -13167,17 +13167,17 @@ { "type": "InputFile or String", "required": false, - "description": "A .WEBP or .PNG image with the thumbnail, must be up to 128 kilobytes in size and have a width and height of exactly 100px, or a .TGS animation with a thumbnail up to 32 kilobytes in size (see https://core.telegram.org/stickers#animation-requirements for animated sticker technical requirements), or a WEBM video with the thumbnail up to 32 kilobytes in size; see https://core.telegram.org/stickers#video-requirements for video sticker technical requirements. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More information on Sending Files. Animated and video sticker set thumbnails can't be uploaded via HTTP URL. If omitted, then the thumbnail is dropped and the first sticker is used as the thumbnail.", - "html_description": "A .WEBP or .PNG image with the thumbnail, must be up to 128 kilobytes in size and have a width and height of exactly 100px, or a .TGS animation with a thumbnail up to 32 kilobytes in size (see https://core.telegram.org/stickers#animation-requirements for animated sticker technical requirements), or a WEBM video with the thumbnail up to 32 kilobytes in size; see https://core.telegram.org/stickers#video-requirements for video sticker technical requirements. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More information on Sending Files ». Animated and video sticker set thumbnails can't be uploaded via HTTP URL. If omitted, then the thumbnail is dropped and the first sticker is used as the thumbnail.", - "rst_description": "A **.WEBP** or **.PNG** image with the thumbnail, must be up to 128 kilobytes in size and have a width and height of exactly 100px, or a **.TGS** animation with a thumbnail up to 32 kilobytes in size (see `https://core.telegram.org/stickers#animation-requirements `_`https://core.telegram.org/stickers#animation-requirements `_ for animated sticker technical requirements), or a **WEBM** video with the thumbnail up to 32 kilobytes in size; see `https://core.telegram.org/stickers#video-requirements `_`https://core.telegram.org/stickers#video-requirements `_ for video sticker technical requirements. Pass a *file_id* as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. :ref:`More information on Sending Files » `. Animated and video sticker set thumbnails can't be uploaded via HTTP URL. If omitted, then the thumbnail is dropped and the first sticker is used as the thumbnail.\n", + "description": "A .WEBP or .PNG image with the thumbnail, must be up to 128 kilobytes in size and have a width and height of exactly 100px, or a .TGS animation with a thumbnail up to 32 kilobytes in size (see https://core.telegram.org/stickers#animation-requirements for animated sticker technical requirements), or a .WEBM video with the thumbnail up to 32 kilobytes in size; see https://core.telegram.org/stickers#video-requirements for video sticker technical requirements. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More information on Sending Files. Animated and video sticker set thumbnails can't be uploaded via HTTP URL. If omitted, then the thumbnail is dropped and the first sticker is used as the thumbnail.", + "html_description": "A .WEBP or .PNG image with the thumbnail, must be up to 128 kilobytes in size and have a width and height of exactly 100px, or a .TGS animation with a thumbnail up to 32 kilobytes in size (see https://core.telegram.org/stickers#animation-requirements for animated sticker technical requirements), or a .WEBM video with the thumbnail up to 32 kilobytes in size; see https://core.telegram.org/stickers#video-requirements for video sticker technical requirements. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More information on Sending Files ». Animated and video sticker set thumbnails can't be uploaded via HTTP URL. If omitted, then the thumbnail is dropped and the first sticker is used as the thumbnail.", + "rst_description": "A **.WEBP** or **.PNG** image with the thumbnail, must be up to 128 kilobytes in size and have a width and height of exactly 100px, or a **.TGS** animation with a thumbnail up to 32 kilobytes in size (see `https://core.telegram.org/stickers#animation-requirements `_`https://core.telegram.org/stickers#animation-requirements `_ for animated sticker technical requirements), or a **.WEBM** video with the thumbnail up to 32 kilobytes in size; see `https://core.telegram.org/stickers#video-requirements `_`https://core.telegram.org/stickers#video-requirements `_ for video sticker technical requirements. Pass a *file_id* as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. :ref:`More information on Sending Files » `. Animated and video sticker set thumbnails can't be uploaded via HTTP URL. If omitted, then the thumbnail is dropped and the first sticker is used as the thumbnail.\n", "name": "thumbnail" }, { "type": "String", "required": true, - "description": "Format of the thumbnail, must be one of 'static' for a .WEBP or .PNG image, 'animated' for a .TGS animation, or 'video' for a WEBM video", - "html_description": "Format of the thumbnail, must be one of “static” for a .WEBP or .PNG image, “animated” for a .TGS animation, or “video” for a WEBM video", - "rst_description": "Format of the thumbnail, must be one of 'static' for a **.WEBP** or **.PNG** image, 'animated' for a **.TGS** animation, or 'video' for a **WEBM** video\n", + "description": "Format of the thumbnail, must be one of 'static' for a .WEBP or .PNG image, 'animated' for a .TGS animation, or 'video' for a .WEBM video", + "html_description": "Format of the thumbnail, must be one of “static” for a .WEBP or .PNG image, “animated” for a .TGS animation, or “video” for a .WEBM video", + "rst_description": "Format of the thumbnail, must be one of 'static' for a **.WEBP** or **.PNG** image, 'animated' for a **.TGS** animation, or 'video' for a **.WEBM** video\n", "name": "format" } ], @@ -13258,6 +13258,14 @@ "name": "star_count", "required": true }, + { + "type": "Integer", + "description": "The number of Telegram Stars that must be paid to upgrade the gift to a unique one", + "html_description": "Optional. The number of Telegram Stars that must be paid to upgrade the gift to a unique one", + "rst_description": "*Optional*. The number of Telegram Stars that must be paid to upgrade the gift to a unique one\n", + "name": "upgrade_star_count", + "required": false + }, { "type": "Integer", "description": "The total number of the gifts of this type that can be sent; for limited gifts only", @@ -13327,6 +13335,14 @@ "rst_description": "Identifier of the gift\n", "name": "gift_id" }, + { + "type": "Boolean", + "required": false, + "description": "Pass True to pay for the gift upgrade from the bot's balance, thereby making the upgrade free for the receiver", + "html_description": "Pass True to pay for the gift upgrade from the bot's balance, thereby making the upgrade free for the receiver", + "rst_description": "Pass :code:`True` to pay for the gift upgrade from the bot's balance, thereby making the upgrade free for the receiver\n", + "name": "pay_for_upgrade" + }, { "type": "String", "required": false, @@ -13353,6 +13369,94 @@ } ], "category": "methods" + }, + { + "anchor": "verifyuser", + "name": "verifyUser", + "description": "Verifies a user on behalf of the organization which is represented by the bot. Returns True on success.", + "html_description": "

Verifies a user on behalf of the organization which is represented by the bot. Returns True on success.

", + "rst_description": "Verifies a user on behalf of the organization which is represented by the bot. Returns :code:`True` on success.", + "annotations": [ + { + "type": "Integer", + "required": true, + "description": "Unique identifier of the target user", + "html_description": "Unique identifier of the target user", + "rst_description": "Unique identifier of the target user\n", + "name": "user_id" + }, + { + "type": "String", + "required": false, + "description": "Custom description for the verification; 0-70 characters. Must be empty if the organization isn't allowed to provide a custom verification description.", + "html_description": "Custom description for the verification; 0-70 characters. Must be empty if the organization isn't allowed to provide a custom verification description.", + "rst_description": "Custom description for the verification; 0-70 characters. Must be empty if the organization isn't allowed to provide a custom verification description.\n", + "name": "custom_description" + } + ], + "category": "methods" + }, + { + "anchor": "verifychat", + "name": "verifyChat", + "description": "Verifies a chat on behalf of the organization which is represented by the bot. Returns True on success.", + "html_description": "

Verifies a chat on behalf of the organization which is represented by the bot. Returns True on success.

", + "rst_description": "Verifies a chat on behalf of the organization which is represented by the bot. Returns :code:`True` on success.", + "annotations": [ + { + "type": "Integer or String", + "required": true, + "description": "Unique identifier for the target chat or username of the target channel (in the format @channelusername)", + "html_description": "Unique identifier for the target chat or username of the target channel (in the format @channelusername)", + "rst_description": "Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)\n", + "name": "chat_id" + }, + { + "type": "String", + "required": false, + "description": "Custom description for the verification; 0-70 characters. Must be empty if the organization isn't allowed to provide a custom verification description.", + "html_description": "Custom description for the verification; 0-70 characters. Must be empty if the organization isn't allowed to provide a custom verification description.", + "rst_description": "Custom description for the verification; 0-70 characters. Must be empty if the organization isn't allowed to provide a custom verification description.\n", + "name": "custom_description" + } + ], + "category": "methods" + }, + { + "anchor": "removeuserverification", + "name": "removeUserVerification", + "description": "Removes verification from a user who is currently verified on behalf of the organization represented by the bot. Returns True on success.", + "html_description": "

Removes verification from a user who is currently verified on behalf of the organization represented by the bot. Returns True on success.

", + "rst_description": "Removes verification from a user who is currently verified on behalf of the organization represented by the bot. Returns :code:`True` on success.", + "annotations": [ + { + "type": "Integer", + "required": true, + "description": "Unique identifier of the target user", + "html_description": "Unique identifier of the target user", + "rst_description": "Unique identifier of the target user\n", + "name": "user_id" + } + ], + "category": "methods" + }, + { + "anchor": "removechatverification", + "name": "removeChatVerification", + "description": "Removes verification from a chat that is currently verified on behalf of the organization represented by the bot. Returns True on success.", + "html_description": "

Removes verification from a chat that is currently verified on behalf of the organization represented by the bot. Returns True on success.

", + "rst_description": "Removes verification from a chat that is currently verified on behalf of the organization represented by the bot. Returns :code:`True` on success.", + "annotations": [ + { + "type": "Integer or String", + "required": true, + "description": "Unique identifier for the target chat or username of the target channel (in the format @channelusername)", + "html_description": "Unique identifier for the target chat or username of the target channel (in the format @channelusername)", + "rst_description": "Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)\n", + "name": "chat_id" + } + ], + "category": "methods" } ], "description": "The following methods and objects allow your bot to handle stickers and sticker sets." @@ -13575,14 +13679,6 @@ "name": "url", "required": false }, - { - "type": "Boolean", - "description": "Pass True if you don't want the URL to be shown in the message", - "html_description": "Optional. Pass True if you don't want the URL to be shown in the message", - "rst_description": "*Optional*. Pass :code:`True` if you don't want the URL to be shown in the message\n", - "name": "hide_url", - "required": false - }, { "type": "String", "description": "Short description of the result", @@ -13765,9 +13861,9 @@ }, { "type": "String", - "description": "A valid URL for the GIF file. File size must not exceed 1MB", - "html_description": "A valid URL for the GIF file. File size must not exceed 1MB", - "rst_description": "A valid URL for the GIF file. File size must not exceed 1MB\n", + "description": "A valid URL for the GIF file", + "html_description": "A valid URL for the GIF file", + "rst_description": "A valid URL for the GIF file\n", "name": "gif_url", "required": true }, @@ -13895,9 +13991,9 @@ }, { "type": "String", - "description": "A valid URL for the MPEG4 file. File size must not exceed 1MB", - "html_description": "A valid URL for the MPEG4 file. File size must not exceed 1MB", - "rst_description": "A valid URL for the MPEG4 file. File size must not exceed 1MB\n", + "description": "A valid URL for the MPEG4 file", + "html_description": "A valid URL for the MPEG4 file", + "rst_description": "A valid URL for the MPEG4 file\n", "name": "mpeg4_url", "required": true }, diff --git a/.butcher/types/BackgroundTypePattern/entity.json b/.butcher/types/BackgroundTypePattern/entity.json index 1f286b9f..336bed87 100644 --- a/.butcher/types/BackgroundTypePattern/entity.json +++ b/.butcher/types/BackgroundTypePattern/entity.json @@ -7,9 +7,9 @@ "object": { "anchor": "backgroundtypepattern", "name": "BackgroundTypePattern", - "description": "The background is a PNG or TGV (gzipped subset of SVG with MIME type 'application/x-tgwallpattern') pattern to be combined with the background fill chosen by the user.", - "html_description": "

The background is a PNG or TGV (gzipped subset of SVG with MIME type “application/x-tgwallpattern”) pattern to be combined with the background fill chosen by the user.

", - "rst_description": "The background is a PNG or TGV (gzipped subset of SVG with MIME type 'application/x-tgwallpattern') pattern to be combined with the background fill chosen by the user.", + "description": "The background is a .PNG or .TGV (gzipped subset of SVG with MIME type 'application/x-tgwallpattern') pattern to be combined with the background fill chosen by the user.", + "html_description": "

The background is a .PNG or .TGV (gzipped subset of SVG with MIME type “application/x-tgwallpattern”) pattern to be combined with the background fill chosen by the user.

", + "rst_description": "The background is a .PNG or .TGV (gzipped subset of SVG with MIME type 'application/x-tgwallpattern') pattern to be combined with the background fill chosen by the user.", "annotations": [ { "type": "String", diff --git a/.butcher/types/Gift/entity.json b/.butcher/types/Gift/entity.json index ce7728d6..46454a3e 100644 --- a/.butcher/types/Gift/entity.json +++ b/.butcher/types/Gift/entity.json @@ -35,6 +35,14 @@ "name": "star_count", "required": true }, + { + "type": "Integer", + "description": "The number of Telegram Stars that must be paid to upgrade the gift to a unique one", + "html_description": "Optional. The number of Telegram Stars that must be paid to upgrade the gift to a unique one", + "rst_description": "*Optional*. The number of Telegram Stars that must be paid to upgrade the gift to a unique one\n", + "name": "upgrade_star_count", + "required": false + }, { "type": "Integer", "description": "The total number of the gifts of this type that can be sent; for limited gifts only", diff --git a/.butcher/types/InlineQueryResultArticle/entity.json b/.butcher/types/InlineQueryResultArticle/entity.json index eba5d318..c9622b2a 100644 --- a/.butcher/types/InlineQueryResultArticle/entity.json +++ b/.butcher/types/InlineQueryResultArticle/entity.json @@ -59,14 +59,6 @@ "name": "url", "required": false }, - { - "type": "Boolean", - "description": "Pass True if you don't want the URL to be shown in the message", - "html_description": "Optional. Pass True if you don't want the URL to be shown in the message", - "rst_description": "*Optional*. Pass :code:`True` if you don't want the URL to be shown in the message\n", - "name": "hide_url", - "required": false - }, { "type": "String", "description": "Short description of the result", @@ -98,6 +90,18 @@ "rst_description": "*Optional*. Thumbnail height\n", "name": "thumbnail_height", "required": false + }, + { + "type": "Boolean", + "description": "Pass True if you don't want the URL to be shown in the message", + "html_description": "Optional. Pass True if you don't want the URL to be shown in the message", + "rst_description": "*Optional*. Pass :code:`True` if you don't want the URL to be shown in the message\n", + "name": "hide_url", + "required": false, + "deprecated": { + "version": "8.2", + "release_date": "2025-01-01" + } } ], "category": "types" diff --git a/.butcher/types/InlineQueryResultGif/entity.json b/.butcher/types/InlineQueryResultGif/entity.json index 7c104615..ee825305 100644 --- a/.butcher/types/InlineQueryResultGif/entity.json +++ b/.butcher/types/InlineQueryResultGif/entity.json @@ -29,9 +29,9 @@ }, { "type": "String", - "description": "A valid URL for the GIF file. File size must not exceed 1MB", - "html_description": "A valid URL for the GIF file. File size must not exceed 1MB", - "rst_description": "A valid URL for the GIF file. File size must not exceed 1MB\n", + "description": "A valid URL for the GIF file", + "html_description": "A valid URL for the GIF file", + "rst_description": "A valid URL for the GIF file\n", "name": "gif_url", "required": true }, diff --git a/.butcher/types/InlineQueryResultMpeg4Gif/entity.json b/.butcher/types/InlineQueryResultMpeg4Gif/entity.json index fa4c3e81..fc309461 100644 --- a/.butcher/types/InlineQueryResultMpeg4Gif/entity.json +++ b/.butcher/types/InlineQueryResultMpeg4Gif/entity.json @@ -29,9 +29,9 @@ }, { "type": "String", - "description": "A valid URL for the MPEG4 file. File size must not exceed 1MB", - "html_description": "A valid URL for the MPEG4 file. File size must not exceed 1MB", - "rst_description": "A valid URL for the MPEG4 file. File size must not exceed 1MB\n", + "description": "A valid URL for the MPEG4 file", + "html_description": "A valid URL for the MPEG4 file", + "rst_description": "A valid URL for the MPEG4 file\n", "name": "mpeg4_url", "required": true }, diff --git a/.butcher/types/InputSticker/entity.json b/.butcher/types/InputSticker/entity.json index 2df660ae..0ec7ae40 100644 --- a/.butcher/types/InputSticker/entity.json +++ b/.butcher/types/InputSticker/entity.json @@ -21,9 +21,9 @@ }, { "type": "String", - "description": "Format of the added sticker, must be one of 'static' for a .WEBP or .PNG image, 'animated' for a .TGS animation, 'video' for a WEBM video", - "html_description": "Format of the added sticker, must be one of “static” for a .WEBP or .PNG image, “animated” for a .TGS animation, “video” for a WEBM video", - "rst_description": "Format of the added sticker, must be one of 'static' for a **.WEBP** or **.PNG** image, 'animated' for a **.TGS** animation, 'video' for a **WEBM** video\n", + "description": "Format of the added sticker, must be one of 'static' for a .WEBP or .PNG image, 'animated' for a .TGS animation, 'video' for a .WEBM video", + "html_description": "Format of the added sticker, must be one of “static” for a .WEBP or .PNG image, “animated” for a .TGS animation, “video” for a .WEBM video", + "rst_description": "Format of the added sticker, must be one of 'static' for a **.WEBP** or **.PNG** image, 'animated' for a **.TGS** animation, 'video' for a **.WEBM** video\n", "name": "format", "required": true }, diff --git a/CHANGES/1623.feature.rst b/CHANGES/1623.feature.rst new file mode 100644 index 00000000..3bf57d62 --- /dev/null +++ b/CHANGES/1623.feature.rst @@ -0,0 +1,6 @@ +Added full support of the `Bot API 8.2 `_ + +- Added the methods :class:`aiogram.methods.verify_user.VerifyUser`, :class:`aiogram.methods.verify_chat.VerifyChat`, :class:`aiogram.methods.remove_user_verification.RemoveUserVerification` and :class:`aiogram.methods.remove_chat_verification.RemoveChatVerification`, allowing bots to manage verifications on behalf of an organization. +- Added the field :code:`upgrade_star_count` to the class :class:`aiogram.types.gift.Gift`. +- Added the parameter :code:`pay_for_upgrade` to the method :class:`aiogram.methods.send_gift.SendGift`. +- Removed the field :code:`hide_url` from the class :class:`aiogram.types.inline_query_result_article.InlineQueryResultArticle`. Pass an empty string as :code:`url` instead. diff --git a/aiogram/client/bot.py b/aiogram/client/bot.py index 592173e4..a09dda28 100644 --- a/aiogram/client/bot.py +++ b/aiogram/client/bot.py @@ -93,6 +93,8 @@ from ..methods import ( PinChatMessage, PromoteChatMember, RefundStarPayment, + RemoveChatVerification, + RemoveUserVerification, ReopenForumTopic, ReopenGeneralForumTopic, ReplaceStickerInSet, @@ -154,6 +156,8 @@ from ..methods import ( UnpinAllGeneralForumTopicMessages, UnpinChatMessage, UploadStickerFile, + VerifyChat, + VerifyUser, ) from ..types import ( BotCommand, @@ -3816,7 +3820,7 @@ class Bot: request_timeout: Optional[int] = None, ) -> bool: """ - Use this method to specify a URL and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified URL, containing a JSON-serialized :class:`aiogram.types.update.Update`. In case of an unsuccessful request, we will give up after a reasonable amount of attempts. Returns :code:`True` on success. + Use this method to specify a URL and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified URL, containing a JSON-serialized :class:`aiogram.types.update.Update`. In case of an unsuccessful request (a request with response `HTTP status code `_ different from :code:`2XY`), we will repeat the request and give up after a reasonable amount of attempts. Returns :code:`True` on success. If you'd like to make sure that the webhook was set by you, you can specify secret data in the parameter *secret_token*. If specified, the request will contain a header 'X-Telegram-Bot-Api-Secret-Token' with the secret token as content. **Notes** @@ -4373,8 +4377,8 @@ class Bot: :param name: Sticker set name :param user_id: User identifier of the sticker set owner - :param format: Format of the thumbnail, must be one of 'static' for a **.WEBP** or **.PNG** image, 'animated' for a **.TGS** animation, or 'video' for a **WEBM** video - :param thumbnail: A **.WEBP** or **.PNG** image with the thumbnail, must be up to 128 kilobytes in size and have a width and height of exactly 100px, or a **.TGS** animation with a thumbnail up to 32 kilobytes in size (see `https://core.telegram.org/stickers#animation-requirements `_`https://core.telegram.org/stickers#animation-requirements `_ for animated sticker technical requirements), or a **WEBM** video with the thumbnail up to 32 kilobytes in size; see `https://core.telegram.org/stickers#video-requirements `_`https://core.telegram.org/stickers#video-requirements `_ for video sticker technical requirements. Pass a *file_id* as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. :ref:`More information on Sending Files » `. Animated and video sticker set thumbnails can't be uploaded via HTTP URL. If omitted, then the thumbnail is dropped and the first sticker is used as the thumbnail. + :param format: Format of the thumbnail, must be one of 'static' for a **.WEBP** or **.PNG** image, 'animated' for a **.TGS** animation, or 'video' for a **.WEBM** video + :param thumbnail: A **.WEBP** or **.PNG** image with the thumbnail, must be up to 128 kilobytes in size and have a width and height of exactly 100px, or a **.TGS** animation with a thumbnail up to 32 kilobytes in size (see `https://core.telegram.org/stickers#animation-requirements `_`https://core.telegram.org/stickers#animation-requirements `_ for animated sticker technical requirements), or a **.WEBM** video with the thumbnail up to 32 kilobytes in size; see `https://core.telegram.org/stickers#video-requirements `_`https://core.telegram.org/stickers#video-requirements `_ for video sticker technical requirements. Pass a *file_id* as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. :ref:`More information on Sending Files » `. Animated and video sticker set thumbnails can't be uploaded via HTTP URL. If omitted, then the thumbnail is dropped and the first sticker is used as the thumbnail. :param request_timeout: Request timeout :return: Returns :code:`True` on success. """ @@ -4936,6 +4940,7 @@ class Bot: self, user_id: int, gift_id: str, + pay_for_upgrade: Optional[bool] = None, text: Optional[str] = None, text_parse_mode: Optional[str] = None, text_entities: Optional[list[MessageEntity]] = None, @@ -4948,6 +4953,7 @@ class Bot: :param user_id: Unique identifier of the target user that will receive the gift :param gift_id: Identifier of the gift + :param pay_for_upgrade: Pass :code:`True` to pay for the gift upgrade from the bot's balance, thereby making the upgrade free for the receiver :param text: Text that will be shown along with the gift; 0-255 characters :param text_parse_mode: Mode for parsing entities in the text. See `formatting options `_ for more details. Entities other than 'bold', 'italic', 'underline', 'strikethrough', 'spoiler', and 'custom_emoji' are ignored. :param text_entities: A JSON-serialized list of special entities that appear in the gift text. It can be specified instead of *text_parse_mode*. Entities other than 'bold', 'italic', 'underline', 'strikethrough', 'spoiler', and 'custom_emoji' are ignored. @@ -4958,6 +4964,7 @@ class Bot: call = SendGift( user_id=user_id, gift_id=gift_id, + pay_for_upgrade=pay_for_upgrade, text=text, text_parse_mode=text_parse_mode, text_entities=text_entities, @@ -4991,3 +4998,89 @@ class Bot: emoji_status_expiration_date=emoji_status_expiration_date, ) return await self(call, request_timeout=request_timeout) + + async def remove_chat_verification( + self, + chat_id: Union[int, str], + request_timeout: Optional[int] = None, + ) -> bool: + """ + Removes verification from a chat that is currently verified on behalf of the organization represented by the bot. Returns :code:`True` on success. + + Source: https://core.telegram.org/bots/api#removechatverification + + :param chat_id: Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`) + :param request_timeout: Request timeout + :return: Returns :code:`True` on success. + """ + + call = RemoveChatVerification( + chat_id=chat_id, + ) + return await self(call, request_timeout=request_timeout) + + async def remove_user_verification( + self, + user_id: int, + request_timeout: Optional[int] = None, + ) -> bool: + """ + Removes verification from a user who is currently verified on behalf of the organization represented by the bot. Returns :code:`True` on success. + + Source: https://core.telegram.org/bots/api#removeuserverification + + :param user_id: Unique identifier of the target user + :param request_timeout: Request timeout + :return: Returns :code:`True` on success. + """ + + call = RemoveUserVerification( + user_id=user_id, + ) + return await self(call, request_timeout=request_timeout) + + async def verify_chat( + self, + chat_id: Union[int, str], + custom_description: Optional[str] = None, + request_timeout: Optional[int] = None, + ) -> bool: + """ + Verifies a chat on behalf of the organization which is represented by the bot. Returns :code:`True` on success. + + Source: https://core.telegram.org/bots/api#verifychat + + :param chat_id: Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`) + :param custom_description: Custom description for the verification; 0-70 characters. Must be empty if the organization isn't allowed to provide a custom verification description. + :param request_timeout: Request timeout + :return: Returns :code:`True` on success. + """ + + call = VerifyChat( + chat_id=chat_id, + custom_description=custom_description, + ) + return await self(call, request_timeout=request_timeout) + + async def verify_user( + self, + user_id: int, + custom_description: Optional[str] = None, + request_timeout: Optional[int] = None, + ) -> bool: + """ + Verifies a user on behalf of the organization which is represented by the bot. Returns :code:`True` on success. + + Source: https://core.telegram.org/bots/api#verifyuser + + :param user_id: Unique identifier of the target user + :param custom_description: Custom description for the verification; 0-70 characters. Must be empty if the organization isn't allowed to provide a custom verification description. + :param request_timeout: Request timeout + :return: Returns :code:`True` on success. + """ + + call = VerifyUser( + user_id=user_id, + custom_description=custom_description, + ) + return await self(call, request_timeout=request_timeout) diff --git a/aiogram/methods/__init__.py b/aiogram/methods/__init__.py index 893f4f73..c40461fe 100644 --- a/aiogram/methods/__init__.py +++ b/aiogram/methods/__init__.py @@ -70,6 +70,8 @@ from .log_out import LogOut from .pin_chat_message import PinChatMessage from .promote_chat_member import PromoteChatMember from .refund_star_payment import RefundStarPayment +from .remove_chat_verification import RemoveChatVerification +from .remove_user_verification import RemoveUserVerification from .reopen_forum_topic import ReopenForumTopic from .reopen_general_forum_topic import ReopenGeneralForumTopic from .replace_sticker_in_set import ReplaceStickerInSet @@ -130,6 +132,8 @@ from .unpin_all_forum_topic_messages import UnpinAllForumTopicMessages from .unpin_all_general_forum_topic_messages import UnpinAllGeneralForumTopicMessages from .unpin_chat_message import UnpinChatMessage from .upload_sticker_file import UploadStickerFile +from .verify_chat import VerifyChat +from .verify_user import VerifyUser __all__ = ( "AddStickerToSet", @@ -203,6 +207,8 @@ __all__ = ( "PinChatMessage", "PromoteChatMember", "RefundStarPayment", + "RemoveChatVerification", + "RemoveUserVerification", "ReopenForumTopic", "ReopenGeneralForumTopic", "ReplaceStickerInSet", @@ -266,4 +272,6 @@ __all__ = ( "UnpinAllGeneralForumTopicMessages", "UnpinChatMessage", "UploadStickerFile", + "VerifyChat", + "VerifyUser", ) diff --git a/aiogram/methods/remove_chat_verification.py b/aiogram/methods/remove_chat_verification.py new file mode 100644 index 00000000..ff242c48 --- /dev/null +++ b/aiogram/methods/remove_chat_verification.py @@ -0,0 +1,32 @@ +from __future__ import annotations + +from typing import TYPE_CHECKING, Any, Union + +from .base import TelegramMethod + + +class RemoveChatVerification(TelegramMethod[bool]): + """ + Removes verification from a chat that is currently verified on behalf of the organization represented by the bot. Returns :code:`True` on success. + + Source: https://core.telegram.org/bots/api#removechatverification + """ + + __returning__ = bool + __api_method__ = "removeChatVerification" + + chat_id: Union[int, str] + """Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)""" + + if TYPE_CHECKING: + # DO NOT EDIT MANUALLY!!! + # This section was auto-generated via `butcher` + + def __init__( + __pydantic__self__, *, chat_id: Union[int, str], **__pydantic_kwargs: Any + ) -> None: + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + # Is needed only for type checking and IDE support without any additional plugins + + super().__init__(chat_id=chat_id, **__pydantic_kwargs) diff --git a/aiogram/methods/remove_user_verification.py b/aiogram/methods/remove_user_verification.py new file mode 100644 index 00000000..0cd4b4c8 --- /dev/null +++ b/aiogram/methods/remove_user_verification.py @@ -0,0 +1,30 @@ +from __future__ import annotations + +from typing import TYPE_CHECKING, Any + +from .base import TelegramMethod + + +class RemoveUserVerification(TelegramMethod[bool]): + """ + Removes verification from a user who is currently verified on behalf of the organization represented by the bot. Returns :code:`True` on success. + + Source: https://core.telegram.org/bots/api#removeuserverification + """ + + __returning__ = bool + __api_method__ = "removeUserVerification" + + user_id: int + """Unique identifier of the target user""" + + if TYPE_CHECKING: + # DO NOT EDIT MANUALLY!!! + # This section was auto-generated via `butcher` + + def __init__(__pydantic__self__, *, user_id: int, **__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__(user_id=user_id, **__pydantic_kwargs) diff --git a/aiogram/methods/send_gift.py b/aiogram/methods/send_gift.py index a07e9f45..73b6ab60 100644 --- a/aiogram/methods/send_gift.py +++ b/aiogram/methods/send_gift.py @@ -20,6 +20,8 @@ class SendGift(TelegramMethod[bool]): """Unique identifier of the target user that will receive the gift""" gift_id: str """Identifier of the gift""" + pay_for_upgrade: Optional[bool] = None + """Pass :code:`True` to pay for the gift upgrade from the bot's balance, thereby making the upgrade free for the receiver""" text: Optional[str] = None """Text that will be shown along with the gift; 0-255 characters""" text_parse_mode: Optional[str] = None @@ -36,6 +38,7 @@ class SendGift(TelegramMethod[bool]): *, user_id: int, gift_id: str, + pay_for_upgrade: Optional[bool] = None, text: Optional[str] = None, text_parse_mode: Optional[str] = None, text_entities: Optional[list[MessageEntity]] = None, @@ -48,6 +51,7 @@ class SendGift(TelegramMethod[bool]): super().__init__( user_id=user_id, gift_id=gift_id, + pay_for_upgrade=pay_for_upgrade, text=text, text_parse_mode=text_parse_mode, text_entities=text_entities, diff --git a/aiogram/methods/set_sticker_set_thumbnail.py b/aiogram/methods/set_sticker_set_thumbnail.py index ef83f701..64140ee4 100644 --- a/aiogram/methods/set_sticker_set_thumbnail.py +++ b/aiogram/methods/set_sticker_set_thumbnail.py @@ -21,9 +21,9 @@ class SetStickerSetThumbnail(TelegramMethod[bool]): user_id: int """User identifier of the sticker set owner""" format: str - """Format of the thumbnail, must be one of 'static' for a **.WEBP** or **.PNG** image, 'animated' for a **.TGS** animation, or 'video' for a **WEBM** video""" + """Format of the thumbnail, must be one of 'static' for a **.WEBP** or **.PNG** image, 'animated' for a **.TGS** animation, or 'video' for a **.WEBM** video""" thumbnail: Optional[Union[InputFile, str]] = None - """A **.WEBP** or **.PNG** image with the thumbnail, must be up to 128 kilobytes in size and have a width and height of exactly 100px, or a **.TGS** animation with a thumbnail up to 32 kilobytes in size (see `https://core.telegram.org/stickers#animation-requirements `_`https://core.telegram.org/stickers#animation-requirements `_ for animated sticker technical requirements), or a **WEBM** video with the thumbnail up to 32 kilobytes in size; see `https://core.telegram.org/stickers#video-requirements `_`https://core.telegram.org/stickers#video-requirements `_ for video sticker technical requirements. Pass a *file_id* as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. :ref:`More information on Sending Files » `. Animated and video sticker set thumbnails can't be uploaded via HTTP URL. If omitted, then the thumbnail is dropped and the first sticker is used as the thumbnail.""" + """A **.WEBP** or **.PNG** image with the thumbnail, must be up to 128 kilobytes in size and have a width and height of exactly 100px, or a **.TGS** animation with a thumbnail up to 32 kilobytes in size (see `https://core.telegram.org/stickers#animation-requirements `_`https://core.telegram.org/stickers#animation-requirements `_ for animated sticker technical requirements), or a **.WEBM** video with the thumbnail up to 32 kilobytes in size; see `https://core.telegram.org/stickers#video-requirements `_`https://core.telegram.org/stickers#video-requirements `_ for video sticker technical requirements. Pass a *file_id* as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. :ref:`More information on Sending Files » `. Animated and video sticker set thumbnails can't be uploaded via HTTP URL. If omitted, then the thumbnail is dropped and the first sticker is used as the thumbnail.""" if TYPE_CHECKING: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/set_webhook.py b/aiogram/methods/set_webhook.py index 01c74f9c..e7076839 100644 --- a/aiogram/methods/set_webhook.py +++ b/aiogram/methods/set_webhook.py @@ -8,7 +8,7 @@ from .base import TelegramMethod class SetWebhook(TelegramMethod[bool]): """ - Use this method to specify a URL and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified URL, containing a JSON-serialized :class:`aiogram.types.update.Update`. In case of an unsuccessful request, we will give up after a reasonable amount of attempts. Returns :code:`True` on success. + Use this method to specify a URL and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified URL, containing a JSON-serialized :class:`aiogram.types.update.Update`. In case of an unsuccessful request (a request with response `HTTP status code `_ different from :code:`2XY`), we will repeat the request and give up after a reasonable amount of attempts. Returns :code:`True` on success. If you'd like to make sure that the webhook was set by you, you can specify secret data in the parameter *secret_token*. If specified, the request will contain a header 'X-Telegram-Bot-Api-Secret-Token' with the secret token as content. **Notes** diff --git a/aiogram/methods/verify_chat.py b/aiogram/methods/verify_chat.py new file mode 100644 index 00000000..9f1c36e4 --- /dev/null +++ b/aiogram/methods/verify_chat.py @@ -0,0 +1,40 @@ +from __future__ import annotations + +from typing import TYPE_CHECKING, Any, Optional, Union + +from .base import TelegramMethod + + +class VerifyChat(TelegramMethod[bool]): + """ + Verifies a chat on behalf of the organization which is represented by the bot. Returns :code:`True` on success. + + Source: https://core.telegram.org/bots/api#verifychat + """ + + __returning__ = bool + __api_method__ = "verifyChat" + + chat_id: Union[int, str] + """Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)""" + custom_description: Optional[str] = None + """Custom description for the verification; 0-70 characters. Must be empty if the organization isn't allowed to provide a custom verification description.""" + + if TYPE_CHECKING: + # DO NOT EDIT MANUALLY!!! + # This section was auto-generated via `butcher` + + def __init__( + __pydantic__self__, + *, + chat_id: Union[int, str], + custom_description: 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, custom_description=custom_description, **__pydantic_kwargs + ) diff --git a/aiogram/methods/verify_user.py b/aiogram/methods/verify_user.py new file mode 100644 index 00000000..3518dfaf --- /dev/null +++ b/aiogram/methods/verify_user.py @@ -0,0 +1,40 @@ +from __future__ import annotations + +from typing import TYPE_CHECKING, Any, Optional + +from .base import TelegramMethod + + +class VerifyUser(TelegramMethod[bool]): + """ + Verifies a user on behalf of the organization which is represented by the bot. Returns :code:`True` on success. + + Source: https://core.telegram.org/bots/api#verifyuser + """ + + __returning__ = bool + __api_method__ = "verifyUser" + + user_id: int + """Unique identifier of the target user""" + custom_description: Optional[str] = None + """Custom description for the verification; 0-70 characters. Must be empty if the organization isn't allowed to provide a custom verification description.""" + + if TYPE_CHECKING: + # DO NOT EDIT MANUALLY!!! + # This section was auto-generated via `butcher` + + def __init__( + __pydantic__self__, + *, + user_id: int, + custom_description: 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__( + user_id=user_id, custom_description=custom_description, **__pydantic_kwargs + ) diff --git a/aiogram/types/background_type_pattern.py b/aiogram/types/background_type_pattern.py index 29c383c2..0c3ba3a3 100644 --- a/aiogram/types/background_type_pattern.py +++ b/aiogram/types/background_type_pattern.py @@ -13,7 +13,7 @@ if TYPE_CHECKING: class BackgroundTypePattern(BackgroundType): """ - The background is a PNG or TGV (gzipped subset of SVG with MIME type 'application/x-tgwallpattern') pattern to be combined with the background fill chosen by the user. + The background is a .PNG or .TGV (gzipped subset of SVG with MIME type 'application/x-tgwallpattern') pattern to be combined with the background fill chosen by the user. Source: https://core.telegram.org/bots/api#backgroundtypepattern """ diff --git a/aiogram/types/gift.py b/aiogram/types/gift.py index e25eb3ec..77be63ad 100644 --- a/aiogram/types/gift.py +++ b/aiogram/types/gift.py @@ -21,6 +21,8 @@ class Gift(TelegramObject): """The sticker that represents the gift""" star_count: int """The number of Telegram Stars that must be paid to send the sticker""" + upgrade_star_count: Optional[int] = None + """*Optional*. The number of Telegram Stars that must be paid to upgrade the gift to a unique one""" total_count: Optional[int] = None """*Optional*. The total number of the gifts of this type that can be sent; for limited gifts only""" remaining_count: Optional[int] = None @@ -36,6 +38,7 @@ class Gift(TelegramObject): id: str, sticker: Sticker, star_count: int, + upgrade_star_count: Optional[int] = None, total_count: Optional[int] = None, remaining_count: Optional[int] = None, **__pydantic_kwargs: Any, @@ -48,6 +51,7 @@ class Gift(TelegramObject): id=id, sticker=sticker, star_count=star_count, + upgrade_star_count=upgrade_star_count, total_count=total_count, remaining_count=remaining_count, **__pydantic_kwargs, diff --git a/aiogram/types/inline_query_result_article.py b/aiogram/types/inline_query_result_article.py index c9987382..afd8ffdc 100644 --- a/aiogram/types/inline_query_result_article.py +++ b/aiogram/types/inline_query_result_article.py @@ -2,6 +2,8 @@ from __future__ import annotations from typing import TYPE_CHECKING, Any, Literal, Optional, Union +from pydantic import Field + from ..enums import InlineQueryResultType from .inline_query_result import InlineQueryResult @@ -39,8 +41,6 @@ class InlineQueryResultArticle(InlineQueryResult): """*Optional*. `Inline keyboard `_ attached to the message""" url: Optional[str] = None """*Optional*. URL of the result""" - hide_url: Optional[bool] = None - """*Optional*. Pass :code:`True` if you don't want the URL to be shown in the message""" description: Optional[str] = None """*Optional*. Short description of the result""" thumbnail_url: Optional[str] = None @@ -49,6 +49,11 @@ class InlineQueryResultArticle(InlineQueryResult): """*Optional*. Thumbnail width""" thumbnail_height: Optional[int] = None """*Optional*. Thumbnail height""" + hide_url: Optional[bool] = Field(None, json_schema_extra={"deprecated": True}) + """*Optional*. Pass :code:`True` if you don't want the URL to be shown in the message + +.. deprecated:: API:8.2 + https://core.telegram.org/bots/api-changelog#january-1-2025""" if TYPE_CHECKING: # DO NOT EDIT MANUALLY!!! @@ -69,11 +74,11 @@ class InlineQueryResultArticle(InlineQueryResult): ], reply_markup: Optional[InlineKeyboardMarkup] = None, url: Optional[str] = None, - hide_url: Optional[bool] = None, description: Optional[str] = None, thumbnail_url: Optional[str] = None, thumbnail_width: Optional[int] = None, thumbnail_height: Optional[int] = None, + hide_url: Optional[bool] = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! @@ -87,10 +92,10 @@ class InlineQueryResultArticle(InlineQueryResult): input_message_content=input_message_content, reply_markup=reply_markup, url=url, - hide_url=hide_url, description=description, thumbnail_url=thumbnail_url, thumbnail_width=thumbnail_width, thumbnail_height=thumbnail_height, + hide_url=hide_url, **__pydantic_kwargs, ) diff --git a/aiogram/types/inline_query_result_gif.py b/aiogram/types/inline_query_result_gif.py index 2f56c652..cedc588c 100644 --- a/aiogram/types/inline_query_result_gif.py +++ b/aiogram/types/inline_query_result_gif.py @@ -28,7 +28,7 @@ class InlineQueryResultGif(InlineQueryResult): id: str """Unique identifier for this result, 1-64 bytes""" gif_url: str - """A valid URL for the GIF file. File size must not exceed 1MB""" + """A valid URL for the GIF file""" thumbnail_url: str """URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result""" gif_width: Optional[int] = None diff --git a/aiogram/types/inline_query_result_mpeg4_gif.py b/aiogram/types/inline_query_result_mpeg4_gif.py index e1a39ae8..9fd1e716 100644 --- a/aiogram/types/inline_query_result_mpeg4_gif.py +++ b/aiogram/types/inline_query_result_mpeg4_gif.py @@ -28,7 +28,7 @@ class InlineQueryResultMpeg4Gif(InlineQueryResult): id: str """Unique identifier for this result, 1-64 bytes""" mpeg4_url: str - """A valid URL for the MPEG4 file. File size must not exceed 1MB""" + """A valid URL for the MPEG4 file""" thumbnail_url: str """URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result""" mpeg4_width: Optional[int] = None diff --git a/aiogram/types/input_sticker.py b/aiogram/types/input_sticker.py index 76fcc4b1..2971d712 100644 --- a/aiogram/types/input_sticker.py +++ b/aiogram/types/input_sticker.py @@ -19,7 +19,7 @@ class InputSticker(TelegramObject): sticker: Union[InputFile, str] """The added sticker. Pass a *file_id* as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, upload a new one using multipart/form-data, or pass 'attach://' to upload a new one using multipart/form-data under name. Animated and video stickers can't be uploaded via HTTP URL. :ref:`More information on Sending Files » `""" format: str - """Format of the added sticker, must be one of 'static' for a **.WEBP** or **.PNG** image, 'animated' for a **.TGS** animation, 'video' for a **WEBM** video""" + """Format of the added sticker, must be one of 'static' for a **.WEBP** or **.PNG** image, 'animated' for a **.TGS** animation, 'video' for a **.WEBM** video""" emoji_list: list[str] """List of 1-20 emoji associated with the sticker""" mask_position: Optional[MaskPosition] = None diff --git a/docs/api/methods/index.rst b/docs/api/methods/index.rst index 8030927b..b6aadc07 100644 --- a/docs/api/methods/index.rst +++ b/docs/api/methods/index.rst @@ -18,6 +18,8 @@ Stickers get_available_gifts get_custom_emoji_stickers get_sticker_set + remove_chat_verification + remove_user_verification replace_sticker_in_set send_gift send_sticker @@ -29,6 +31,8 @@ Stickers set_sticker_set_thumbnail set_sticker_set_title upload_sticker_file + verify_chat + verify_user Available methods ================= diff --git a/docs/api/methods/remove_chat_verification.rst b/docs/api/methods/remove_chat_verification.rst new file mode 100644 index 00000000..068ea302 --- /dev/null +++ b/docs/api/methods/remove_chat_verification.rst @@ -0,0 +1,45 @@ +###################### +removeChatVerification +###################### + +Returns: :obj:`bool` + +.. automodule:: aiogram.methods.remove_chat_verification + :members: + :member-order: bysource + :undoc-members: True + :exclude-members: model_config,model_fields + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: bool = await bot.remove_chat_verification(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods.remove_chat_verification import RemoveChatVerification` +- alias: :code:`from aiogram.methods import RemoveChatVerification` + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + result: bool = await bot(RemoveChatVerification(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + return RemoveChatVerification(...) diff --git a/docs/api/methods/remove_user_verification.rst b/docs/api/methods/remove_user_verification.rst new file mode 100644 index 00000000..a122abab --- /dev/null +++ b/docs/api/methods/remove_user_verification.rst @@ -0,0 +1,45 @@ +###################### +removeUserVerification +###################### + +Returns: :obj:`bool` + +.. automodule:: aiogram.methods.remove_user_verification + :members: + :member-order: bysource + :undoc-members: True + :exclude-members: model_config,model_fields + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: bool = await bot.remove_user_verification(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods.remove_user_verification import RemoveUserVerification` +- alias: :code:`from aiogram.methods import RemoveUserVerification` + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + result: bool = await bot(RemoveUserVerification(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + return RemoveUserVerification(...) diff --git a/docs/api/methods/verify_chat.rst b/docs/api/methods/verify_chat.rst new file mode 100644 index 00000000..e60a130a --- /dev/null +++ b/docs/api/methods/verify_chat.rst @@ -0,0 +1,45 @@ +########## +verifyChat +########## + +Returns: :obj:`bool` + +.. automodule:: aiogram.methods.verify_chat + :members: + :member-order: bysource + :undoc-members: True + :exclude-members: model_config,model_fields + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: bool = await bot.verify_chat(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods.verify_chat import VerifyChat` +- alias: :code:`from aiogram.methods import VerifyChat` + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + result: bool = await bot(VerifyChat(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + return VerifyChat(...) diff --git a/docs/api/methods/verify_user.rst b/docs/api/methods/verify_user.rst new file mode 100644 index 00000000..12aa6e3e --- /dev/null +++ b/docs/api/methods/verify_user.rst @@ -0,0 +1,45 @@ +########## +verifyUser +########## + +Returns: :obj:`bool` + +.. automodule:: aiogram.methods.verify_user + :members: + :member-order: bysource + :undoc-members: True + :exclude-members: model_config,model_fields + + +Usage +===== + +As bot method +------------- + +.. code-block:: + + result: bool = await bot.verify_user(...) + + +Method as object +---------------- + +Imports: + +- :code:`from aiogram.methods.verify_user import VerifyUser` +- alias: :code:`from aiogram.methods import VerifyUser` + +With specific bot +~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + result: bool = await bot(VerifyUser(...)) + +As reply into Webhook in handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + return VerifyUser(...) diff --git a/tests/test_api/test_client/test_session/test_aiohttp_session.py b/tests/test_api/test_client/test_session/test_aiohttp_session.py index d382a7cf..bc0239df 100644 --- a/tests/test_api/test_client/test_session/test_aiohttp_session.py +++ b/tests/test_api/test_client/test_session/test_aiohttp_session.py @@ -41,7 +41,7 @@ class TestAiohttpSession: async def test_create_proxy_session(self): auth = aiohttp.BasicAuth("login", "password", "encoding") - async with AiohttpSession(proxy=("socks5://proxy.url/", auth)) as session: + async with AiohttpSession(proxy=("socks5://proxy.url:1080/", auth)) as session: assert session._connector_type == aiohttp_socks.ProxyConnector assert isinstance(session._connector_init, dict) @@ -51,7 +51,7 @@ class TestAiohttpSession: assert isinstance(aiohttp_session.connector, aiohttp_socks.ProxyConnector) async def test_create_proxy_session_proxy_url(self): - async with AiohttpSession(proxy="socks4://proxy.url/") as session: + async with AiohttpSession(proxy="socks4://proxy.url:1080/") as session: assert isinstance(session.proxy, str) assert isinstance(session._connector_init, dict) @@ -62,8 +62,8 @@ class TestAiohttpSession: async def test_create_proxy_session_chained_proxies(self): proxy_chain = [ - "socks4://proxy.url/", - "socks5://proxy.url/", + "socks4://proxy.url:1080/", + "socks5://proxy.url:1080/", "http://user:password@127.0.0.1:3128", ] async with AiohttpSession(proxy=proxy_chain) as session: @@ -90,7 +90,7 @@ class TestAiohttpSession: assert session._should_reset_connector is False assert session.proxy is None - session.proxy = "socks5://auth:auth@proxy.url/" + session.proxy = "socks5://auth:auth@proxy.url:1080/" assert session._should_reset_connector await session.create_session() assert session._should_reset_connector is False diff --git a/tests/test_api/test_methods/test_remove_chat_verification.py b/tests/test_api/test_methods/test_remove_chat_verification.py new file mode 100644 index 00000000..29186300 --- /dev/null +++ b/tests/test_api/test_methods/test_remove_chat_verification.py @@ -0,0 +1,12 @@ +from aiogram.methods import RemoveChatVerification, VerifyChat +from aiogram.types import Poll +from tests.mocked_bot import MockedBot + + +class TestRemoveChatVerification: + async def test_bot_method(self, bot: MockedBot): + prepare_result = bot.add_result_for(RemoveChatVerification, ok=True, result=True) + + response: bool = await bot.remove_chat_verification(chat_id=42) + request = bot.get_request() + assert response == prepare_result.result diff --git a/tests/test_api/test_methods/test_remove_user_verification.py b/tests/test_api/test_methods/test_remove_user_verification.py new file mode 100644 index 00000000..4d405c82 --- /dev/null +++ b/tests/test_api/test_methods/test_remove_user_verification.py @@ -0,0 +1,12 @@ +from aiogram.methods import RemoveUserVerification, VerifyChat +from aiogram.types import Poll +from tests.mocked_bot import MockedBot + + +class TestRemoveUserVerification: + async def test_bot_method(self, bot: MockedBot): + prepare_result = bot.add_result_for(RemoveUserVerification, ok=True, result=True) + + response: bool = await bot.remove_user_verification(user_id=42) + request = bot.get_request() + assert response == prepare_result.result diff --git a/tests/test_api/test_methods/test_verify_chat.py b/tests/test_api/test_methods/test_verify_chat.py new file mode 100644 index 00000000..1473b976 --- /dev/null +++ b/tests/test_api/test_methods/test_verify_chat.py @@ -0,0 +1,12 @@ +from aiogram.methods import VerifyChat +from aiogram.types import Poll +from tests.mocked_bot import MockedBot + + +class TestVerifyChat: + async def test_bot_method(self, bot: MockedBot): + prepare_result = bot.add_result_for(VerifyChat, ok=True, result=True) + + response: bool = await bot.verify_chat(chat_id=42) + request = bot.get_request() + assert response == prepare_result.result diff --git a/tests/test_api/test_methods/test_verify_user.py b/tests/test_api/test_methods/test_verify_user.py new file mode 100644 index 00000000..9bb502ca --- /dev/null +++ b/tests/test_api/test_methods/test_verify_user.py @@ -0,0 +1,12 @@ +from aiogram.methods import VerifyChat, VerifyUser +from aiogram.types import Poll +from tests.mocked_bot import MockedBot + + +class TestVerifyUser: + async def test_bot_method(self, bot: MockedBot): + prepare_result = bot.add_result_for(VerifyUser, ok=True, result=True) + + response: bool = await bot.verify_user(user_id=42) + request = bot.get_request() + assert response == prepare_result.result From b37694964775a1cffe4b0cec652b598e0e0fd9fe Mon Sep 17 00:00:00 2001 From: JRoot Junior Date: Thu, 2 Jan 2025 02:44:02 +0200 Subject: [PATCH 10/10] Bump version --- .apiversion | 2 +- CHANGES.rst | 15 +++++++++++++++ CHANGES/1623.feature.rst | 6 ------ README.rst | 2 +- aiogram/__meta__.py | 4 ++-- 5 files changed, 19 insertions(+), 10 deletions(-) delete mode 100644 CHANGES/1623.feature.rst diff --git a/.apiversion b/.apiversion index b8eb0263..2983cad0 100644 --- a/.apiversion +++ b/.apiversion @@ -1 +1 @@ -8.1 +8.2 diff --git a/CHANGES.rst b/CHANGES.rst index d4c32310..3afc290d 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -16,6 +16,21 @@ Changelog .. towncrier release notes start +3.17.0 (2025-01-02) +==================== + +Features +-------- + +- Added full support of the `Bot API 8.2 `_ + + - Added the methods :class:`aiogram.methods.verify_user.VerifyUser`, :class:`aiogram.methods.verify_chat.VerifyChat`, :class:`aiogram.methods.remove_user_verification.RemoveUserVerification` and :class:`aiogram.methods.remove_chat_verification.RemoveChatVerification`, allowing bots to manage verifications on behalf of an organization. + - Added the field :code:`upgrade_star_count` to the class :class:`aiogram.types.gift.Gift`. + - Added the parameter :code:`pay_for_upgrade` to the method :class:`aiogram.methods.send_gift.SendGift`. + - Removed the field :code:`hide_url` from the class :class:`aiogram.types.inline_query_result_article.InlineQueryResultArticle`. Pass an empty string as :code:`url` instead. + `#1623 `_ + + 3.16.0 (2024-12-21) ==================== diff --git a/CHANGES/1623.feature.rst b/CHANGES/1623.feature.rst deleted file mode 100644 index 3bf57d62..00000000 --- a/CHANGES/1623.feature.rst +++ /dev/null @@ -1,6 +0,0 @@ -Added full support of the `Bot API 8.2 `_ - -- Added the methods :class:`aiogram.methods.verify_user.VerifyUser`, :class:`aiogram.methods.verify_chat.VerifyChat`, :class:`aiogram.methods.remove_user_verification.RemoveUserVerification` and :class:`aiogram.methods.remove_chat_verification.RemoveChatVerification`, allowing bots to manage verifications on behalf of an organization. -- Added the field :code:`upgrade_star_count` to the class :class:`aiogram.types.gift.Gift`. -- Added the parameter :code:`pay_for_upgrade` to the method :class:`aiogram.methods.send_gift.SendGift`. -- Removed the field :code:`hide_url` from the class :class:`aiogram.types.inline_query_result_article.InlineQueryResultArticle`. Pass an empty string as :code:`url` instead. diff --git a/README.rst b/README.rst index f17a7a5b..af938312 100644 --- a/README.rst +++ b/README.rst @@ -52,7 +52,7 @@ Features - Asynchronous (`asyncio docs `_, :pep:`492`) - Has type hints (:pep:`484`) and can be used with `mypy `_ - Supports `PyPy `_ -- Supports `Telegram Bot API 8.1 `_ and gets fast updates to the latest versions of the Bot API +- Supports `Telegram Bot API 8.2 `_ and gets fast updates to the latest versions of the Bot API - Telegram Bot API integration code was `autogenerated `_ and can be easily re-generated when API gets updated - Updates router (Blueprints) - Has Finite State Machine diff --git a/aiogram/__meta__.py b/aiogram/__meta__.py index ec78d40f..b04fd4ce 100644 --- a/aiogram/__meta__.py +++ b/aiogram/__meta__.py @@ -1,2 +1,2 @@ -__version__ = "3.16.0" -__api_version__ = "8.1" +__version__ = "3.17.0" +__api_version__ = "8.2"