`_ *switch_pm…* actions - in this case the user will be automatically returned to the chat they switched from, skipping the chat selection screen.\n",
+ "description": "If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. May be empty, in which case just the bot's username will be inserted.",
+ "html_description": "| Optional. If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. May be empty, in which case just the bot's username will be inserted. | ",
+ "rst_description": "*Optional*. If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. May be empty, in which case just the bot's username will be inserted.\n",
"name": "switch_inline_query",
"required": false
},
@@ -3302,9 +3351,9 @@
},
{
"type": "Boolean",
- "description": "True, if the administrator can access the chat event log, chat statistics, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege",
- "html_description": "True, if the administrator can access the chat event log, chat statistics, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege | ",
- "rst_description": ":code:`True`, if the administrator can access the chat event log, chat statistics, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege\n",
+ "description": "True, if the administrator can access the chat event log, boost list in channels, see channel members, report spam messages, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege",
+ "html_description": "True, if the administrator can access the chat event log, boost list in channels, see channel members, report spam messages, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege | ",
+ "rst_description": ":code:`True`, if the administrator can access the chat event log, boost list in channels, see channel members, report spam messages, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege\n",
"name": "can_manage_chat",
"required": true
},
@@ -3326,9 +3375,9 @@
},
{
"type": "Boolean",
- "description": "True, if the administrator can restrict, ban or unban chat members",
- "html_description": "True, if the administrator can restrict, ban or unban chat members | ",
- "rst_description": ":code:`True`, if the administrator can restrict, ban or unban chat members\n",
+ "description": "True, if the administrator can restrict, ban or unban chat members, or access supergroup statistics",
+ "html_description": "True, if the administrator can restrict, ban or unban chat members, or access supergroup statistics | ",
+ "rst_description": ":code:`True`, if the administrator can restrict, ban or unban chat members, or access supergroup statistics\n",
"name": "can_restrict_members",
"required": true
},
@@ -3358,9 +3407,9 @@
},
{
"type": "Boolean",
- "description": "True, if the administrator can post in the channel; channels only",
- "html_description": "Optional. True, if the administrator can post in the channel; channels only | ",
- "rst_description": "*Optional*. :code:`True`, if the administrator can post in the channel; channels only\n",
+ "description": "True, if the administrator can post messages in the channel, or access channel statistics; channels only",
+ "html_description": "Optional. True, if the administrator can post messages in the channel, or access channel statistics; channels only | ",
+ "rst_description": "*Optional*. :code:`True`, if the administrator can post messages in the channel, or access channel statistics; channels only\n",
"name": "can_post_messages",
"required": false
},
@@ -3380,6 +3429,30 @@
"name": "can_pin_messages",
"required": false
},
+ {
+ "type": "Boolean",
+ "description": "True, if the administrator can post stories in the channel; channels only",
+ "html_description": "Optional. True, if the administrator can post stories in the channel; channels only | ",
+ "rst_description": "*Optional*. :code:`True`, if the administrator can post stories in the channel; channels only\n",
+ "name": "can_post_stories",
+ "required": false
+ },
+ {
+ "type": "Boolean",
+ "description": "True, if the administrator can edit stories posted by other users; channels only",
+ "html_description": "Optional. True, if the administrator can edit stories posted by other users; channels only | ",
+ "rst_description": "*Optional*. :code:`True`, if the administrator can edit stories posted by other users; channels only\n",
+ "name": "can_edit_stories",
+ "required": false
+ },
+ {
+ "type": "Boolean",
+ "description": "True, if the administrator can delete stories posted by other users; channels only",
+ "html_description": "Optional. True, if the administrator can delete stories posted by other users; channels only | ",
+ "rst_description": "*Optional*. :code:`True`, if the administrator can delete stories posted by other users; channels only\n",
+ "name": "can_delete_stories",
+ "required": false
+ },
{
"type": "Boolean",
"description": "True, if the user is allowed to create, rename, close, and reopen forum topics; supergroups only",
@@ -3483,9 +3556,9 @@
},
{
"type": "Boolean",
- "description": "True, if the administrator can access the chat event log, chat statistics, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege",
- "html_description": "True, if the administrator can access the chat event log, chat statistics, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege | ",
- "rst_description": ":code:`True`, if the administrator can access the chat event log, chat statistics, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege\n",
+ "description": "True, if the administrator can access the chat event log, boost list in channels, see channel members, report spam messages, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege",
+ "html_description": "True, if the administrator can access the chat event log, boost list in channels, see channel members, report spam messages, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege | ",
+ "rst_description": ":code:`True`, if the administrator can access the chat event log, boost list in channels, see channel members, report spam messages, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege\n",
"name": "can_manage_chat",
"required": true
},
@@ -3507,9 +3580,9 @@
},
{
"type": "Boolean",
- "description": "True, if the administrator can restrict, ban or unban chat members",
- "html_description": "True, if the administrator can restrict, ban or unban chat members | ",
- "rst_description": ":code:`True`, if the administrator can restrict, ban or unban chat members\n",
+ "description": "True, if the administrator can restrict, ban or unban chat members, or access supergroup statistics",
+ "html_description": "True, if the administrator can restrict, ban or unban chat members, or access supergroup statistics | ",
+ "rst_description": ":code:`True`, if the administrator can restrict, ban or unban chat members, or access supergroup statistics\n",
"name": "can_restrict_members",
"required": true
},
@@ -3539,9 +3612,9 @@
},
{
"type": "Boolean",
- "description": "True, if the administrator can post in the channel; channels only",
- "html_description": "Optional. True, if the administrator can post in the channel; channels only | ",
- "rst_description": "*Optional*. :code:`True`, if the administrator can post in the channel; channels only\n",
+ "description": "True, if the administrator can post messages in the channel, or access channel statistics; channels only",
+ "html_description": "Optional. True, if the administrator can post messages in the channel, or access channel statistics; channels only | ",
+ "rst_description": "*Optional*. :code:`True`, if the administrator can post messages in the channel, or access channel statistics; channels only\n",
"name": "can_post_messages",
"required": false
},
@@ -3561,6 +3634,30 @@
"name": "can_pin_messages",
"required": false
},
+ {
+ "type": "Boolean",
+ "description": "True, if the administrator can post stories in the channel; channels only",
+ "html_description": "Optional. True, if the administrator can post stories in the channel; channels only | ",
+ "rst_description": "*Optional*. :code:`True`, if the administrator can post stories in the channel; channels only\n",
+ "name": "can_post_stories",
+ "required": false
+ },
+ {
+ "type": "Boolean",
+ "description": "True, if the administrator can edit stories posted by other users; channels only",
+ "html_description": "Optional. True, if the administrator can edit stories posted by other users; channels only | ",
+ "rst_description": "*Optional*. :code:`True`, if the administrator can edit stories posted by other users; channels only\n",
+ "name": "can_edit_stories",
+ "required": false
+ },
+ {
+ "type": "Boolean",
+ "description": "True, if the administrator can delete stories posted by other users; channels only",
+ "html_description": "Optional. True, if the administrator can delete stories posted by other users; channels only | ",
+ "rst_description": "*Optional*. :code:`True`, if the administrator can delete stories posted by other users; channels only\n",
+ "name": "can_delete_stories",
+ "required": false
+ },
{
"type": "Boolean",
"description": "True, if the user is allowed to create, rename, close, and reopen forum topics; supergroups only",
@@ -3751,9 +3848,9 @@
},
{
"type": "Integer",
- "description": "Date when restrictions will be lifted for this user; unix time. If 0, then the user is restricted forever",
- "html_description": "Date when restrictions will be lifted for this user; unix time. If 0, then the user is restricted forever | ",
- "rst_description": "Date when restrictions will be lifted for this user; unix time. If 0, then the user is restricted forever\n",
+ "description": "Date when restrictions will be lifted for this user; Unix time. If 0, then the user is restricted forever",
+ "html_description": "Date when restrictions will be lifted for this user; Unix time. If 0, then the user is restricted forever | ",
+ "rst_description": "Date when restrictions will be lifted for this user; Unix time. If 0, then the user is restricted forever\n",
"name": "until_date",
"required": true
}
@@ -3811,9 +3908,9 @@
},
{
"type": "Integer",
- "description": "Date when restrictions will be lifted for this user; unix time. If 0, then the user is banned forever",
- "html_description": "Date when restrictions will be lifted for this user; unix time. If 0, then the user is banned forever | ",
- "rst_description": "Date when restrictions will be lifted for this user; unix time. If 0, then the user is banned forever\n",
+ "description": "Date when restrictions will be lifted for this user; Unix time. If 0, then the user is banned forever",
+ "html_description": "Date when restrictions will be lifted for this user; Unix time. If 0, then the user is banned forever | ",
+ "rst_description": "Date when restrictions will be lifted for this user; Unix time. If 0, then the user is banned forever\n",
"name": "until_date",
"required": true
}
@@ -3911,9 +4008,9 @@
},
{
"type": "Integer",
- "description": "Identifier of a private chat with the user who sent the join request. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier. The bot can use this identifier for 24 hours to send messages until the join request is processed, assuming no other administrator contacted the user.",
- "html_description": "Identifier of a private chat with the user who sent the join request. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier. The bot can use this identifier for 24 hours to send messages until the join request is processed, assuming no other administrator contacted the user. | ",
- "rst_description": "Identifier of a private chat with the user who sent the join request. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier. The bot can use this identifier for 24 hours to send messages until the join request is processed, assuming no other administrator contacted the user.\n",
+ "description": "Identifier of a private chat with the user who sent the join request. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier. The bot can use this identifier for 5 minutes to send messages until the join request is processed, assuming no other administrator contacted the user.",
+ "html_description": "Identifier of a private chat with the user who sent the join request. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier. The bot can use this identifier for 5 minutes to send messages until the join request is processed, assuming no other administrator contacted the user. | ",
+ "rst_description": "Identifier of a private chat with the user who sent the join request. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier. The bot can use this identifier for 5 minutes to send messages until the join request is processed, assuming no other administrator contacted the user.\n",
"name": "user_chat_id",
"required": true
},
@@ -6788,9 +6885,9 @@
{
"type": "Integer",
"required": false,
- "description": "Date when the user will be unbanned, unix time. If user is banned for more than 366 days or less than 30 seconds from the current time they are considered to be banned forever. Applied for supergroups and channels only.",
- "html_description": "Date when the user will be unbanned, unix time. If user is banned for more than 366 days or less than 30 seconds from the current time they are considered to be banned forever. Applied for supergroups and channels only. | ",
- "rst_description": "Date when the user will be unbanned, unix time. If user is banned for more than 366 days or less than 30 seconds from the current time they are considered to be banned forever. Applied for supergroups and channels only.\n",
+ "description": "Date when the user will be unbanned; Unix time. If user is banned for more than 366 days or less than 30 seconds from the current time they are considered to be banned forever. Applied for supergroups and channels only.",
+ "html_description": "Date when the user will be unbanned; Unix time. If user is banned for more than 366 days or less than 30 seconds from the current time they are considered to be banned forever. Applied for supergroups and channels only. | ",
+ "rst_description": "Date when the user will be unbanned; Unix time. If user is banned for more than 366 days or less than 30 seconds from the current time they are considered to be banned forever. Applied for supergroups and channels only.\n",
"name": "until_date"
},
{
@@ -6880,9 +6977,9 @@
{
"type": "Integer",
"required": false,
- "description": "Date when restrictions will be lifted for the user, unix time. If user is restricted for more than 366 days or less than 30 seconds from the current time, they are considered to be restricted forever",
- "html_description": "Date when restrictions will be lifted for the user, unix time. If user is restricted for more than 366 days or less than 30 seconds from the current time, they are considered to be restricted forever | ",
- "rst_description": "Date when restrictions will be lifted for the user, unix time. If user is restricted for more than 366 days or less than 30 seconds from the current time, they are considered to be restricted forever\n",
+ "description": "Date when restrictions will be lifted for the user; Unix time. If user is restricted for more than 366 days or less than 30 seconds from the current time, they are considered to be restricted forever",
+ "html_description": "Date when restrictions will be lifted for the user; Unix time. If user is restricted for more than 366 days or less than 30 seconds from the current time, they are considered to be restricted forever | ",
+ "rst_description": "Date when restrictions will be lifted for the user; Unix time. If user is restricted for more than 366 days or less than 30 seconds from the current time, they are considered to be restricted forever\n",
"name": "until_date"
}
],
@@ -6922,27 +7019,11 @@
{
"type": "Boolean",
"required": false,
- "description": "Pass True if the administrator can access the chat event log, chat statistics, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege",
- "html_description": "Pass True if the administrator can access the chat event log, chat statistics, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege | ",
- "rst_description": "Pass :code:`True` if the administrator can access the chat event log, chat statistics, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege\n",
+ "description": "Pass True if the administrator can access the chat event log, boost list in channels, see channel members, report spam messages, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege",
+ "html_description": "Pass True if the administrator can access the chat event log, boost list in channels, see channel members, report spam messages, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege | ",
+ "rst_description": "Pass :code:`True` if the administrator can access the chat event log, boost list in channels, see channel members, report spam messages, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege\n",
"name": "can_manage_chat"
},
- {
- "type": "Boolean",
- "required": false,
- "description": "Pass True if the administrator can create channel posts, channels only",
- "html_description": "Pass True if the administrator can create channel posts, channels only | ",
- "rst_description": "Pass :code:`True` if the administrator can create channel posts, channels only\n",
- "name": "can_post_messages"
- },
- {
- "type": "Boolean",
- "required": false,
- "description": "Pass True if the administrator can edit messages of other users and can pin messages, channels only",
- "html_description": "Pass True if the administrator can edit messages of other users and can pin messages, channels only | ",
- "rst_description": "Pass :code:`True` if the administrator can edit messages of other users and can pin messages, channels only\n",
- "name": "can_edit_messages"
- },
{
"type": "Boolean",
"required": false,
@@ -6962,9 +7043,9 @@
{
"type": "Boolean",
"required": false,
- "description": "Pass True if the administrator can restrict, ban or unban chat members",
- "html_description": "Pass True if the administrator can restrict, ban or unban chat members | ",
- "rst_description": "Pass :code:`True` if the administrator can restrict, ban or unban chat members\n",
+ "description": "Pass True if the administrator can restrict, ban or unban chat members, or access supergroup statistics",
+ "html_description": "Pass True if the administrator can restrict, ban or unban chat members, or access supergroup statistics | ",
+ "rst_description": "Pass :code:`True` if the administrator can restrict, ban or unban chat members, or access supergroup statistics\n",
"name": "can_restrict_members"
},
{
@@ -6991,6 +7072,22 @@
"rst_description": "Pass :code:`True` if the administrator can invite new users to the chat\n",
"name": "can_invite_users"
},
+ {
+ "type": "Boolean",
+ "required": false,
+ "description": "Pass True if the administrator can post messages in the channel, or access channel statistics; channels only",
+ "html_description": "Pass True if the administrator can post messages in the channel, or access channel statistics; channels only | ",
+ "rst_description": "Pass :code:`True` if the administrator can post messages in the channel, or access channel statistics; channels only\n",
+ "name": "can_post_messages"
+ },
+ {
+ "type": "Boolean",
+ "required": false,
+ "description": "Pass True if the administrator can edit messages of other users and can pin messages; channels only",
+ "html_description": "Pass True if the administrator can edit messages of other users and can pin messages; channels only | ",
+ "rst_description": "Pass :code:`True` if the administrator can edit messages of other users and can pin messages; channels only\n",
+ "name": "can_edit_messages"
+ },
{
"type": "Boolean",
"required": false,
@@ -6999,6 +7096,30 @@
"rst_description": "Pass :code:`True` if the administrator can pin messages, supergroups only\n",
"name": "can_pin_messages"
},
+ {
+ "type": "Boolean",
+ "required": false,
+ "description": "Pass True if the administrator can post stories in the channel; channels only",
+ "html_description": "Pass True if the administrator can post stories in the channel; channels only | ",
+ "rst_description": "Pass :code:`True` if the administrator can post stories in the channel; channels only\n",
+ "name": "can_post_stories"
+ },
+ {
+ "type": "Boolean",
+ "required": false,
+ "description": "Pass True if the administrator can edit stories posted by other users; channels only",
+ "html_description": "Pass True if the administrator can edit stories posted by other users; channels only | ",
+ "rst_description": "Pass :code:`True` if the administrator can edit stories posted by other users; channels only\n",
+ "name": "can_edit_stories"
+ },
+ {
+ "type": "Boolean",
+ "required": false,
+ "description": "Pass True if the administrator can delete stories posted by other users; channels only",
+ "html_description": "Pass True if the administrator can delete stories posted by other users; channels only | ",
+ "rst_description": "Pass :code:`True` if the administrator can delete stories posted by other users; channels only\n",
+ "name": "can_delete_stories"
+ },
{
"type": "Boolean",
"required": false,
@@ -7945,6 +8066,24 @@
],
"category": "methods"
},
+ {
+ "anchor": "unpinallgeneralforumtopicmessages",
+ "name": "unpinAllGeneralForumTopicMessages",
+ "description": "Use this method to clear the list of pinned messages in a General forum topic. The bot must be an administrator in the chat for this to work and must have the can_pin_messages administrator right in the supergroup. Returns True on success.",
+ "html_description": "Use this method to clear the list of pinned messages in a General forum topic. The bot must be an administrator in the chat for this to work and must have the can_pin_messages administrator right in the supergroup. Returns True on success.
",
+ "rst_description": "Use this method to clear the list of pinned messages in a General forum topic. The bot must be an administrator in the chat for this to work and must have the *can_pin_messages* administrator right in the supergroup. Returns :code:`True` on success.",
+ "annotations": [
+ {
+ "type": "Integer or String",
+ "required": true,
+ "description": "Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)",
+ "html_description": "Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) | ",
+ "rst_description": "Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)\n",
+ "name": "chat_id"
+ }
+ ],
+ "category": "methods"
+ },
{
"anchor": "answercallbackquery",
"name": "answerCallbackQuery",
@@ -9629,9 +9768,9 @@
},
{
"type": "WebAppInfo",
- "description": "Description of the Web App that will be launched when the user presses the button. The Web App will be able to switch back to the inline mode using the method web_app_switch_inline_query inside the Web App.",
- "html_description": "Optional. Description of the Web App that will be launched when the user presses the button. The Web App will be able to switch back to the inline mode using the method web_app_switch_inline_query inside the Web App. | ",
- "rst_description": "*Optional*. Description of the `Web App `_ that will be launched when the user presses the button. The Web App will be able to switch back to the inline mode using the method *web_app_switch_inline_query* inside the Web App.\n",
+ "description": "Description of the Web App that will be launched when the user presses the button. The Web App will be able to switch back to the inline mode using the method switchInlineQuery inside the Web App.",
+ "html_description": "Optional. Description of the Web App that will be launched when the user presses the button. The Web App will be able to switch back to the inline mode using the method switchInlineQuery inside the Web App. | ",
+ "rst_description": "*Optional*. Description of the `Web App `_ that will be launched when the user presses the button. The Web App will be able to switch back to the inline mode using the method `switchInlineQuery `_ inside the Web App.\n",
"name": "web_app",
"required": false
},
diff --git a/.butcher/templates/enums/index.rst.jinja2 b/.butcher/templates/enums/index.rst.jinja2
index 9cbf463a..23af1de3 100644
--- a/.butcher/templates/enums/index.rst.jinja2
+++ b/.butcher/templates/enums/index.rst.jinja2
@@ -1,3 +1,5 @@
+.. _enums:
+
#####
Enums
#####
diff --git a/.butcher/templates/methods/entity.rst.jinja2 b/.butcher/templates/methods/entity.rst.jinja2
index d2843b17..59fa61e2 100755
--- a/.butcher/templates/methods/entity.rst.jinja2
+++ b/.butcher/templates/methods/entity.rst.jinja2
@@ -8,6 +8,7 @@ Returns: :obj:`{{ object.returning.parsed_type|type }}`
:members:
:member-order: bysource
:undoc-members: True
+ :exclude-members: model_config,model_fields
Usage
diff --git a/.butcher/templates/types/entity.rst.jinja2 b/.butcher/templates/types/entity.rst.jinja2
index 6b9907c3..2fd2b06e 100644
--- a/.butcher/templates/types/entity.rst.jinja2
+++ b/.butcher/templates/types/entity.rst.jinja2
@@ -7,3 +7,4 @@
:members:
:member-order: bysource
:undoc-members: True
+ :exclude-members: model_config,model_fields
diff --git a/.butcher/types/BotCommandScope/subtypes.yml b/.butcher/types/BotCommandScope/subtypes.yml
new file mode 100644
index 00000000..6756ad51
--- /dev/null
+++ b/.butcher/types/BotCommandScope/subtypes.yml
@@ -0,0 +1 @@
+discriminator: "type"
diff --git a/.butcher/types/BotCommandScopeAllChatAdministrators/replace.yml b/.butcher/types/BotCommandScopeAllChatAdministrators/replace.yml
deleted file mode 100644
index ddb65490..00000000
--- a/.butcher/types/BotCommandScopeAllChatAdministrators/replace.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-bases:
- - BotCommandScope
diff --git a/.butcher/types/BotCommandScopeAllGroupChats/replace.yml b/.butcher/types/BotCommandScopeAllGroupChats/replace.yml
deleted file mode 100644
index ddb65490..00000000
--- a/.butcher/types/BotCommandScopeAllGroupChats/replace.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-bases:
- - BotCommandScope
diff --git a/.butcher/types/BotCommandScopeAllPrivateChats/replace.yml b/.butcher/types/BotCommandScopeAllPrivateChats/replace.yml
deleted file mode 100644
index ddb65490..00000000
--- a/.butcher/types/BotCommandScopeAllPrivateChats/replace.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-bases:
- - BotCommandScope
diff --git a/.butcher/types/BotCommandScopeChat/replace.yml b/.butcher/types/BotCommandScopeChat/replace.yml
deleted file mode 100644
index ddb65490..00000000
--- a/.butcher/types/BotCommandScopeChat/replace.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-bases:
- - BotCommandScope
diff --git a/.butcher/types/BotCommandScopeChatAdministrators/replace.yml b/.butcher/types/BotCommandScopeChatAdministrators/replace.yml
deleted file mode 100644
index ddb65490..00000000
--- a/.butcher/types/BotCommandScopeChatAdministrators/replace.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-bases:
- - BotCommandScope
diff --git a/.butcher/types/BotCommandScopeChatMember/replace.yml b/.butcher/types/BotCommandScopeChatMember/replace.yml
deleted file mode 100644
index ddb65490..00000000
--- a/.butcher/types/BotCommandScopeChatMember/replace.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-bases:
- - BotCommandScope
diff --git a/.butcher/types/BotCommandScopeDefault/replace.yml b/.butcher/types/BotCommandScopeDefault/replace.yml
deleted file mode 100644
index ddb65490..00000000
--- a/.butcher/types/BotCommandScopeDefault/replace.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-bases:
- - BotCommandScope
diff --git a/.butcher/types/Chat/aliases.yml b/.butcher/types/Chat/aliases.yml
index 4538f7e1..89b5843c 100644
--- a/.butcher/types/Chat/aliases.yml
+++ b/.butcher/types/Chat/aliases.yml
@@ -106,3 +106,7 @@ delete_photo:
set_photo:
method: setChatPhoto
fill: *self
+
+unpin_all_general_forum_topic_messages:
+ method: unpinAllGeneralForumTopicMessages
+ fill: *self
diff --git a/.butcher/types/Chat/entity.json b/.butcher/types/Chat/entity.json
index 7aa42c18..0a65849d 100644
--- a/.butcher/types/Chat/entity.json
+++ b/.butcher/types/Chat/entity.json
@@ -91,6 +91,14 @@
"name": "emoji_status_custom_emoji_id",
"required": false
},
+ {
+ "type": "Integer",
+ "description": "Expiration date of the emoji status of the other party in a private chat in Unix time, if any. Returned only in getChat.",
+ "html_description": "Optional. Expiration date of the emoji status of the other party in a private chat in Unix time, if any. Returned only in getChat. | ",
+ "rst_description": "*Optional*. Expiration date of the emoji status of the other party in a private chat in Unix time, if any. Returned only in :class:`aiogram.methods.get_chat.GetChat`.\n",
+ "name": "emoji_status_expiration_date",
+ "required": false
+ },
{
"type": "String",
"description": "Bio of the other party in a private chat. Returned only in getChat.",
diff --git a/.butcher/types/Chat/replace.yml b/.butcher/types/Chat/replace.yml
new file mode 100644
index 00000000..60fe7d44
--- /dev/null
+++ b/.butcher/types/Chat/replace.yml
@@ -0,0 +1,5 @@
+annotations:
+ emoji_status_expiration_date:
+ parsed_type:
+ type: std
+ name: DateTime
diff --git a/.butcher/types/ChatAdministratorRights/entity.json b/.butcher/types/ChatAdministratorRights/entity.json
index 6d5951e8..e493b3e2 100644
--- a/.butcher/types/ChatAdministratorRights/entity.json
+++ b/.butcher/types/ChatAdministratorRights/entity.json
@@ -21,9 +21,9 @@
},
{
"type": "Boolean",
- "description": "True, if the administrator can access the chat event log, chat statistics, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege",
- "html_description": "True, if the administrator can access the chat event log, chat statistics, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege | ",
- "rst_description": ":code:`True`, if the administrator can access the chat event log, chat statistics, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege\n",
+ "description": "True, if the administrator can access the chat event log, boost list in channels, see channel members, report spam messages, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege",
+ "html_description": "True, if the administrator can access the chat event log, boost list in channels, see channel members, report spam messages, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege | ",
+ "rst_description": ":code:`True`, if the administrator can access the chat event log, boost list in channels, see channel members, report spam messages, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege\n",
"name": "can_manage_chat",
"required": true
},
@@ -45,9 +45,9 @@
},
{
"type": "Boolean",
- "description": "True, if the administrator can restrict, ban or unban chat members",
- "html_description": "True, if the administrator can restrict, ban or unban chat members | ",
- "rst_description": ":code:`True`, if the administrator can restrict, ban or unban chat members\n",
+ "description": "True, if the administrator can restrict, ban or unban chat members, or access supergroup statistics",
+ "html_description": "True, if the administrator can restrict, ban or unban chat members, or access supergroup statistics | ",
+ "rst_description": ":code:`True`, if the administrator can restrict, ban or unban chat members, or access supergroup statistics\n",
"name": "can_restrict_members",
"required": true
},
@@ -77,9 +77,9 @@
},
{
"type": "Boolean",
- "description": "True, if the administrator can post in the channel; channels only",
- "html_description": "Optional. True, if the administrator can post in the channel; channels only | ",
- "rst_description": "*Optional*. :code:`True`, if the administrator can post in the channel; channels only\n",
+ "description": "True, if the administrator can post messages in the channel, or access channel statistics; channels only",
+ "html_description": "Optional. True, if the administrator can post messages in the channel, or access channel statistics; channels only | ",
+ "rst_description": "*Optional*. :code:`True`, if the administrator can post messages in the channel, or access channel statistics; channels only\n",
"name": "can_post_messages",
"required": false
},
@@ -99,6 +99,30 @@
"name": "can_pin_messages",
"required": false
},
+ {
+ "type": "Boolean",
+ "description": "True, if the administrator can post stories in the channel; channels only",
+ "html_description": "Optional. True, if the administrator can post stories in the channel; channels only | ",
+ "rst_description": "*Optional*. :code:`True`, if the administrator can post stories in the channel; channels only\n",
+ "name": "can_post_stories",
+ "required": false
+ },
+ {
+ "type": "Boolean",
+ "description": "True, if the administrator can edit stories posted by other users; channels only",
+ "html_description": "Optional. True, if the administrator can edit stories posted by other users; channels only | ",
+ "rst_description": "*Optional*. :code:`True`, if the administrator can edit stories posted by other users; channels only\n",
+ "name": "can_edit_stories",
+ "required": false
+ },
+ {
+ "type": "Boolean",
+ "description": "True, if the administrator can delete stories posted by other users; channels only",
+ "html_description": "Optional. True, if the administrator can delete stories posted by other users; channels only | ",
+ "rst_description": "*Optional*. :code:`True`, if the administrator can delete stories posted by other users; channels only\n",
+ "name": "can_delete_stories",
+ "required": false
+ },
{
"type": "Boolean",
"description": "True, if the user is allowed to create, rename, close, and reopen forum topics; supergroups only",
diff --git a/.butcher/types/ChatInviteLink/replace.yml b/.butcher/types/ChatInviteLink/replace.yml
index 2577c954..21d6557f 100644
--- a/.butcher/types/ChatInviteLink/replace.yml
+++ b/.butcher/types/ChatInviteLink/replace.yml
@@ -2,4 +2,4 @@ annotations:
expire_date:
parsed_type:
type: std
- name: datetime.datetime
+ name: DateTime
diff --git a/.butcher/types/ChatJoinRequest/aliases.yml b/.butcher/types/ChatJoinRequest/aliases.yml
index aa88cebd..630c65ef 100644
--- a/.butcher/types/ChatJoinRequest/aliases.yml
+++ b/.butcher/types/ChatJoinRequest/aliases.yml
@@ -3,6 +3,145 @@ approve:
fill: &request-target
chat_id: self.chat.id
user_id: self.from_user.id
+
decline:
method: declineChatJoinRequest
fill: *request-target
+
+answer:
+ method: sendMessage
+ fill: &fill-answer-chat
+ chat_id: self.chat.id
+
+answer_pm:
+ method: sendMessage
+ fill: &fill-answer-user
+ chat_id: self.user_chat_id
+
+answer_animation:
+ method: sendAnimation
+ fill: *fill-answer-chat
+
+answer_animation_pm:
+ method: sendAnimation
+ fill: *fill-answer-user
+
+answer_audio:
+ method: sendAudio
+ fill: *fill-answer-chat
+
+answer_audio_pm:
+ method: sendAudio
+ fill: *fill-answer-user
+
+answer_contact:
+ method: sendContact
+ fill: *fill-answer-chat
+
+answer_contact_pm:
+ method: sendContact
+ fill: *fill-answer-user
+
+answer_document:
+ method: sendDocument
+ fill: *fill-answer-chat
+
+answer_document_pm:
+ method: sendDocument
+ fill: *fill-answer-user
+
+answer_game:
+ method: sendGame
+ fill: *fill-answer-chat
+
+answer_game_pm:
+ method: sendGame
+ fill: *fill-answer-user
+
+answer_invoice:
+ method: sendInvoice
+ fill: *fill-answer-chat
+
+answer_invoice_pm:
+ method: sendInvoice
+ fill: *fill-answer-user
+
+answer_location:
+ method: sendLocation
+ fill: *fill-answer-chat
+
+answer_location_pm:
+ method: sendLocation
+ fill: *fill-answer-user
+
+answer_media_group:
+ method: sendMediaGroup
+ fill: *fill-answer-chat
+
+answer_media_group_pm:
+ method: sendMediaGroup
+ fill: *fill-answer-user
+
+answer_photo:
+ method: sendPhoto
+ fill: *fill-answer-chat
+
+answer_photo_pm:
+ method: sendPhoto
+ fill: *fill-answer-user
+
+answer_poll:
+ method: sendPoll
+ fill: *fill-answer-chat
+
+answer_poll_pm:
+ method: sendPoll
+ fill: *fill-answer-user
+
+answer_dice:
+ method: sendDice
+ fill: *fill-answer-chat
+
+answer_dice_pm:
+ method: sendDice
+ fill: *fill-answer-user
+
+answer_sticker:
+ method: sendSticker
+ fill: *fill-answer-chat
+
+answer_sticker_pm:
+ method: sendSticker
+ fill: *fill-answer-user
+
+answer_venue:
+ method: sendVenue
+ fill: *fill-answer-chat
+
+answer_venue_pm:
+ method: sendVenue
+ fill: *fill-answer-user
+
+answer_video:
+ method: sendVideo
+ fill: *fill-answer-chat
+
+answer_video_pm:
+ method: sendVideo
+ fill: *fill-answer-user
+
+answer_video_note:
+ method: sendVideoNote
+ fill: *fill-answer-chat
+
+answer_video_note_pm:
+ method: sendVideoNote
+ fill: *fill-answer-user
+
+answer_voice:
+ method: sendVoice
+ fill: *fill-answer-chat
+
+answer_voice_pm:
+ method: sendVoice
+ fill: *fill-answer-user
diff --git a/.butcher/types/ChatJoinRequest/entity.json b/.butcher/types/ChatJoinRequest/entity.json
index 99fa2d7d..25cfe9e3 100644
--- a/.butcher/types/ChatJoinRequest/entity.json
+++ b/.butcher/types/ChatJoinRequest/entity.json
@@ -29,9 +29,9 @@
},
{
"type": "Integer",
- "description": "Identifier of a private chat with the user who sent the join request. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier. The bot can use this identifier for 24 hours to send messages until the join request is processed, assuming no other administrator contacted the user.",
- "html_description": "Identifier of a private chat with the user who sent the join request. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier. The bot can use this identifier for 24 hours to send messages until the join request is processed, assuming no other administrator contacted the user. | ",
- "rst_description": "Identifier of a private chat with the user who sent the join request. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier. The bot can use this identifier for 24 hours to send messages until the join request is processed, assuming no other administrator contacted the user.\n",
+ "description": "Identifier of a private chat with the user who sent the join request. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier. The bot can use this identifier for 5 minutes to send messages until the join request is processed, assuming no other administrator contacted the user.",
+ "html_description": "Identifier of a private chat with the user who sent the join request. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier. The bot can use this identifier for 5 minutes to send messages until the join request is processed, assuming no other administrator contacted the user. | ",
+ "rst_description": "Identifier of a private chat with the user who sent the join request. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier. The bot can use this identifier for 5 minutes to send messages until the join request is processed, assuming no other administrator contacted the user.\n",
"name": "user_chat_id",
"required": true
},
diff --git a/.butcher/types/ChatJoinRequest/replace.yml b/.butcher/types/ChatJoinRequest/replace.yml
index 9a3a2842..80c48d76 100644
--- a/.butcher/types/ChatJoinRequest/replace.yml
+++ b/.butcher/types/ChatJoinRequest/replace.yml
@@ -2,4 +2,4 @@ annotations:
date:
parsed_type:
type: std
- name: datetime.datetime
+ name: DateTime
diff --git a/.butcher/types/ChatMember/extend.yml b/.butcher/types/ChatMember/extend.yml
deleted file mode 100644
index 01ef4960..00000000
--- a/.butcher/types/ChatMember/extend.yml
+++ /dev/null
@@ -1,27 +0,0 @@
-define:
- - type: "String"
- description: "The member's status in the chat"
- html_description: "The member's status in the chat | "
- rst_description: "The member's status in the chat"
- name: "status"
- required: true
-
-clone:
- - ChatMemberOwner:
- exclude:
- - status
- - ChatMemberAdministrator:
- exclude:
- - status
- - ChatMemberMember:
- exclude:
- - status
- - ChatMemberRestricted:
- exclude:
- - status
- - ChatMemberLeft:
- exclude:
- - status
- - ChatMemberBanned:
- exclude:
- - status
diff --git a/.butcher/types/ChatMember/replace.yml b/.butcher/types/ChatMember/replace.yml
index 0af85473..e264e991 100644
--- a/.butcher/types/ChatMember/replace.yml
+++ b/.butcher/types/ChatMember/replace.yml
@@ -2,4 +2,4 @@ annotations:
until_date:
parsed_type:
type: std
- name: datetime.datetime
+ name: DateTime
diff --git a/.butcher/types/ChatMember/subtypes.yml b/.butcher/types/ChatMember/subtypes.yml
new file mode 100644
index 00000000..95832398
--- /dev/null
+++ b/.butcher/types/ChatMember/subtypes.yml
@@ -0,0 +1 @@
+discriminator: "status"
diff --git a/.butcher/types/ChatMemberAdministrator/entity.json b/.butcher/types/ChatMemberAdministrator/entity.json
index 577d9daf..4679a1e0 100644
--- a/.butcher/types/ChatMemberAdministrator/entity.json
+++ b/.butcher/types/ChatMemberAdministrator/entity.json
@@ -45,9 +45,9 @@
},
{
"type": "Boolean",
- "description": "True, if the administrator can access the chat event log, chat statistics, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege",
- "html_description": "True, if the administrator can access the chat event log, chat statistics, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege | ",
- "rst_description": ":code:`True`, if the administrator can access the chat event log, chat statistics, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege\n",
+ "description": "True, if the administrator can access the chat event log, boost list in channels, see channel members, report spam messages, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege",
+ "html_description": "True, if the administrator can access the chat event log, boost list in channels, see channel members, report spam messages, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege | ",
+ "rst_description": ":code:`True`, if the administrator can access the chat event log, boost list in channels, see channel members, report spam messages, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege\n",
"name": "can_manage_chat",
"required": true
},
@@ -69,9 +69,9 @@
},
{
"type": "Boolean",
- "description": "True, if the administrator can restrict, ban or unban chat members",
- "html_description": "True, if the administrator can restrict, ban or unban chat members | ",
- "rst_description": ":code:`True`, if the administrator can restrict, ban or unban chat members\n",
+ "description": "True, if the administrator can restrict, ban or unban chat members, or access supergroup statistics",
+ "html_description": "True, if the administrator can restrict, ban or unban chat members, or access supergroup statistics | ",
+ "rst_description": ":code:`True`, if the administrator can restrict, ban or unban chat members, or access supergroup statistics\n",
"name": "can_restrict_members",
"required": true
},
@@ -101,9 +101,9 @@
},
{
"type": "Boolean",
- "description": "True, if the administrator can post in the channel; channels only",
- "html_description": "Optional. True, if the administrator can post in the channel; channels only | ",
- "rst_description": "*Optional*. :code:`True`, if the administrator can post in the channel; channels only\n",
+ "description": "True, if the administrator can post messages in the channel, or access channel statistics; channels only",
+ "html_description": "Optional. True, if the administrator can post messages in the channel, or access channel statistics; channels only | ",
+ "rst_description": "*Optional*. :code:`True`, if the administrator can post messages in the channel, or access channel statistics; channels only\n",
"name": "can_post_messages",
"required": false
},
@@ -123,6 +123,30 @@
"name": "can_pin_messages",
"required": false
},
+ {
+ "type": "Boolean",
+ "description": "True, if the administrator can post stories in the channel; channels only",
+ "html_description": "Optional. True, if the administrator can post stories in the channel; channels only | ",
+ "rst_description": "*Optional*. :code:`True`, if the administrator can post stories in the channel; channels only\n",
+ "name": "can_post_stories",
+ "required": false
+ },
+ {
+ "type": "Boolean",
+ "description": "True, if the administrator can edit stories posted by other users; channels only",
+ "html_description": "Optional. True, if the administrator can edit stories posted by other users; channels only | ",
+ "rst_description": "*Optional*. :code:`True`, if the administrator can edit stories posted by other users; channels only\n",
+ "name": "can_edit_stories",
+ "required": false
+ },
+ {
+ "type": "Boolean",
+ "description": "True, if the administrator can delete stories posted by other users; channels only",
+ "html_description": "Optional. True, if the administrator can delete stories posted by other users; channels only | ",
+ "rst_description": "*Optional*. :code:`True`, if the administrator can delete stories posted by other users; channels only\n",
+ "name": "can_delete_stories",
+ "required": false
+ },
{
"type": "Boolean",
"description": "True, if the user is allowed to create, rename, close, and reopen forum topics; supergroups only",
diff --git a/.butcher/types/ChatMemberAdministrator/replace.yml b/.butcher/types/ChatMemberAdministrator/replace.yml
deleted file mode 100644
index 619942cd..00000000
--- a/.butcher/types/ChatMemberAdministrator/replace.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-bases:
- - ChatMember
diff --git a/.butcher/types/ChatMemberBanned/entity.json b/.butcher/types/ChatMemberBanned/entity.json
index 49d42e20..4da411ec 100644
--- a/.butcher/types/ChatMemberBanned/entity.json
+++ b/.butcher/types/ChatMemberBanned/entity.json
@@ -29,9 +29,9 @@
},
{
"type": "Integer",
- "description": "Date when restrictions will be lifted for this user; unix time. If 0, then the user is banned forever",
- "html_description": "Date when restrictions will be lifted for this user; unix time. If 0, then the user is banned forever | ",
- "rst_description": "Date when restrictions will be lifted for this user; unix time. If 0, then the user is banned forever\n",
+ "description": "Date when restrictions will be lifted for this user; Unix time. If 0, then the user is banned forever",
+ "html_description": "Date when restrictions will be lifted for this user; Unix time. If 0, then the user is banned forever | ",
+ "rst_description": "Date when restrictions will be lifted for this user; Unix time. If 0, then the user is banned forever\n",
"name": "until_date",
"required": true
}
diff --git a/.butcher/types/ChatMemberBanned/replace.yml b/.butcher/types/ChatMemberBanned/replace.yml
index 6a3882af..e264e991 100644
--- a/.butcher/types/ChatMemberBanned/replace.yml
+++ b/.butcher/types/ChatMemberBanned/replace.yml
@@ -1,7 +1,5 @@
-bases:
- - ChatMember
annotations:
until_date:
parsed_type:
type: std
- name: datetime.datetime
+ name: DateTime
diff --git a/.butcher/types/ChatMemberLeft/replace.yml b/.butcher/types/ChatMemberLeft/replace.yml
deleted file mode 100644
index 619942cd..00000000
--- a/.butcher/types/ChatMemberLeft/replace.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-bases:
- - ChatMember
diff --git a/.butcher/types/ChatMemberMember/replace.yml b/.butcher/types/ChatMemberMember/replace.yml
deleted file mode 100644
index 619942cd..00000000
--- a/.butcher/types/ChatMemberMember/replace.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-bases:
- - ChatMember
diff --git a/.butcher/types/ChatMemberOwner/replace.yml b/.butcher/types/ChatMemberOwner/replace.yml
deleted file mode 100644
index 619942cd..00000000
--- a/.butcher/types/ChatMemberOwner/replace.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-bases:
- - ChatMember
diff --git a/.butcher/types/ChatMemberRestricted/entity.json b/.butcher/types/ChatMemberRestricted/entity.json
index 958ad57a..1c46132d 100644
--- a/.butcher/types/ChatMemberRestricted/entity.json
+++ b/.butcher/types/ChatMemberRestricted/entity.json
@@ -149,9 +149,9 @@
},
{
"type": "Integer",
- "description": "Date when restrictions will be lifted for this user; unix time. If 0, then the user is restricted forever",
- "html_description": "Date when restrictions will be lifted for this user; unix time. If 0, then the user is restricted forever | ",
- "rst_description": "Date when restrictions will be lifted for this user; unix time. If 0, then the user is restricted forever\n",
+ "description": "Date when restrictions will be lifted for this user; Unix time. If 0, then the user is restricted forever",
+ "html_description": "Date when restrictions will be lifted for this user; Unix time. If 0, then the user is restricted forever | ",
+ "rst_description": "Date when restrictions will be lifted for this user; Unix time. If 0, then the user is restricted forever\n",
"name": "until_date",
"required": true
}
diff --git a/.butcher/types/ChatMemberRestricted/replace.yml b/.butcher/types/ChatMemberRestricted/replace.yml
index 6a3882af..e264e991 100644
--- a/.butcher/types/ChatMemberRestricted/replace.yml
+++ b/.butcher/types/ChatMemberRestricted/replace.yml
@@ -1,7 +1,5 @@
-bases:
- - ChatMember
annotations:
until_date:
parsed_type:
type: std
- name: datetime.datetime
+ name: DateTime
diff --git a/.butcher/types/ChatMemberUpdated/aliases.yml b/.butcher/types/ChatMemberUpdated/aliases.yml
new file mode 100644
index 00000000..ee220974
--- /dev/null
+++ b/.butcher/types/ChatMemberUpdated/aliases.yml
@@ -0,0 +1,68 @@
+answer:
+ method: sendMessage
+ fill: &fill-answer
+ chat_id: self.chat.id
+
+answer_animation:
+ method: sendAnimation
+ fill: *fill-answer
+
+answer_audio:
+ method: sendAudio
+ fill: *fill-answer
+
+answer_contact:
+ method: sendContact
+ fill: *fill-answer
+
+answer_document:
+ method: sendDocument
+ fill: *fill-answer
+
+answer_game:
+ method: sendGame
+ fill: *fill-answer
+
+answer_invoice:
+ method: sendInvoice
+ fill: *fill-answer
+
+answer_location:
+ method: sendLocation
+ fill: *fill-answer
+
+answer_media_group:
+ method: sendMediaGroup
+ fill: *fill-answer
+
+answer_photo:
+ method: sendPhoto
+ fill: *fill-answer
+
+answer_poll:
+ method: sendPoll
+ fill: *fill-answer
+
+answer_dice:
+ method: sendDice
+ fill: *fill-answer
+
+answer_sticker:
+ method: sendSticker
+ fill: *fill-answer
+
+answer_venue:
+ method: sendVenue
+ fill: *fill-answer
+
+answer_video:
+ method: sendVideo
+ fill: *fill-answer
+
+answer_video_note:
+ method: sendVideoNote
+ fill: *fill-answer
+
+answer_voice:
+ method: sendVoice
+ fill: *fill-answer
diff --git a/.butcher/types/ChatMemberUpdated/replace.yml b/.butcher/types/ChatMemberUpdated/replace.yml
index 66c1b64c..80c48d76 100644
--- a/.butcher/types/ChatMemberUpdated/replace.yml
+++ b/.butcher/types/ChatMemberUpdated/replace.yml
@@ -2,33 +2,4 @@ annotations:
date:
parsed_type:
type: std
- name: datetime.datetime
- old_chat_member: &chat-member-type
- parsed_type:
- type: union
- items:
- - type: entity
- references:
- category: types
- name: ChatMemberOwner
- - type: entity
- references:
- category: types
- name: ChatMemberAdministrator
- - type: entity
- references:
- category: types
- name: ChatMemberMember
- - type: entity
- references:
- category: types
- name: ChatMemberRestricted
- - type: entity
- references:
- category: types
- name: ChatMemberLeft
- - type: entity
- references:
- category: types
- name: ChatMemberBanned
- new_chat_member: *chat-member-type
+ name: DateTime
diff --git a/.butcher/types/InlineKeyboardButton/entity.json b/.butcher/types/InlineKeyboardButton/entity.json
index c7919e99..9c1baae5 100644
--- a/.butcher/types/InlineKeyboardButton/entity.json
+++ b/.butcher/types/InlineKeyboardButton/entity.json
@@ -53,9 +53,9 @@
},
{
"type": "String",
- "description": "If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. May be empty, in which case just the bot's username will be inserted.\n\nNote: This offers an easy way for users to start using your bot in inline mode when they are currently in a private chat with it. Especially useful when combined with switch_pm… actions - in this case the user will be automatically returned to the chat they switched from, skipping the chat selection screen.",
- "html_description": "Optional. If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. May be empty, in which case just the bot's username will be inserted. \n \nNote: This offers an easy way for users to start using your bot in inline mode when they are currently in a private chat with it. Especially useful when combined with switch_pm… actions - in this case the user will be automatically returned to the chat they switched from, skipping the chat selection screen. | ",
- "rst_description": "*Optional*. If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. May be empty, in which case just the bot's username will be inserted.\n\n\n\n**Note:** This offers an easy way for users to start using your bot in `inline mode `_ when they are currently in a private chat with it. Especially useful when combined with `https://core.telegram.org/bots/api#answerinlinequery `_ *switch_pm…* actions - in this case the user will be automatically returned to the chat they switched from, skipping the chat selection screen.\n",
+ "description": "If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. May be empty, in which case just the bot's username will be inserted.",
+ "html_description": "Optional. If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. May be empty, in which case just the bot's username will be inserted. | ",
+ "rst_description": "*Optional*. If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. May be empty, in which case just the bot's username will be inserted.\n",
"name": "switch_inline_query",
"required": false
},
diff --git a/.butcher/types/InlineQueryResult/subtypes.yml b/.butcher/types/InlineQueryResult/subtypes.yml
new file mode 100644
index 00000000..6756ad51
--- /dev/null
+++ b/.butcher/types/InlineQueryResult/subtypes.yml
@@ -0,0 +1 @@
+discriminator: "type"
diff --git a/.butcher/types/InlineQueryResultArticle/replace.yml b/.butcher/types/InlineQueryResultArticle/replace.yml
deleted file mode 100644
index cbe6bc26..00000000
--- a/.butcher/types/InlineQueryResultArticle/replace.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-bases:
- - InlineQueryResult
diff --git a/.butcher/types/InlineQueryResultAudio/replace.yml b/.butcher/types/InlineQueryResultAudio/replace.yml
index cd89306d..e87fb9b3 100644
--- a/.butcher/types/InlineQueryResultAudio/replace.yml
+++ b/.butcher/types/InlineQueryResultAudio/replace.yml
@@ -1,6 +1,3 @@
-bases:
- - InlineQueryResult
-
annotations:
parse_mode:
value: UNSET_PARSE_MODE
diff --git a/.butcher/types/InlineQueryResultCachedAudio/replace.yml b/.butcher/types/InlineQueryResultCachedAudio/replace.yml
index cd89306d..e87fb9b3 100644
--- a/.butcher/types/InlineQueryResultCachedAudio/replace.yml
+++ b/.butcher/types/InlineQueryResultCachedAudio/replace.yml
@@ -1,6 +1,3 @@
-bases:
- - InlineQueryResult
-
annotations:
parse_mode:
value: UNSET_PARSE_MODE
diff --git a/.butcher/types/InlineQueryResultCachedDocument/replace.yml b/.butcher/types/InlineQueryResultCachedDocument/replace.yml
index cd89306d..e87fb9b3 100644
--- a/.butcher/types/InlineQueryResultCachedDocument/replace.yml
+++ b/.butcher/types/InlineQueryResultCachedDocument/replace.yml
@@ -1,6 +1,3 @@
-bases:
- - InlineQueryResult
-
annotations:
parse_mode:
value: UNSET_PARSE_MODE
diff --git a/.butcher/types/InlineQueryResultCachedGif/replace.yml b/.butcher/types/InlineQueryResultCachedGif/replace.yml
index cd89306d..e87fb9b3 100644
--- a/.butcher/types/InlineQueryResultCachedGif/replace.yml
+++ b/.butcher/types/InlineQueryResultCachedGif/replace.yml
@@ -1,6 +1,3 @@
-bases:
- - InlineQueryResult
-
annotations:
parse_mode:
value: UNSET_PARSE_MODE
diff --git a/.butcher/types/InlineQueryResultCachedMpeg4Gif/replace.yml b/.butcher/types/InlineQueryResultCachedMpeg4Gif/replace.yml
index cd89306d..e87fb9b3 100644
--- a/.butcher/types/InlineQueryResultCachedMpeg4Gif/replace.yml
+++ b/.butcher/types/InlineQueryResultCachedMpeg4Gif/replace.yml
@@ -1,6 +1,3 @@
-bases:
- - InlineQueryResult
-
annotations:
parse_mode:
value: UNSET_PARSE_MODE
diff --git a/.butcher/types/InlineQueryResultCachedPhoto/replace.yml b/.butcher/types/InlineQueryResultCachedPhoto/replace.yml
index cd89306d..e87fb9b3 100644
--- a/.butcher/types/InlineQueryResultCachedPhoto/replace.yml
+++ b/.butcher/types/InlineQueryResultCachedPhoto/replace.yml
@@ -1,6 +1,3 @@
-bases:
- - InlineQueryResult
-
annotations:
parse_mode:
value: UNSET_PARSE_MODE
diff --git a/.butcher/types/InlineQueryResultCachedSticker/replace.yml b/.butcher/types/InlineQueryResultCachedSticker/replace.yml
deleted file mode 100644
index cbe6bc26..00000000
--- a/.butcher/types/InlineQueryResultCachedSticker/replace.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-bases:
- - InlineQueryResult
diff --git a/.butcher/types/InlineQueryResultCachedVideo/replace.yml b/.butcher/types/InlineQueryResultCachedVideo/replace.yml
index cd89306d..e87fb9b3 100644
--- a/.butcher/types/InlineQueryResultCachedVideo/replace.yml
+++ b/.butcher/types/InlineQueryResultCachedVideo/replace.yml
@@ -1,6 +1,3 @@
-bases:
- - InlineQueryResult
-
annotations:
parse_mode:
value: UNSET_PARSE_MODE
diff --git a/.butcher/types/InlineQueryResultCachedVoice/replace.yml b/.butcher/types/InlineQueryResultCachedVoice/replace.yml
index cd89306d..e87fb9b3 100644
--- a/.butcher/types/InlineQueryResultCachedVoice/replace.yml
+++ b/.butcher/types/InlineQueryResultCachedVoice/replace.yml
@@ -1,6 +1,3 @@
-bases:
- - InlineQueryResult
-
annotations:
parse_mode:
value: UNSET_PARSE_MODE
diff --git a/.butcher/types/InlineQueryResultContact/replace.yml b/.butcher/types/InlineQueryResultContact/replace.yml
deleted file mode 100644
index cbe6bc26..00000000
--- a/.butcher/types/InlineQueryResultContact/replace.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-bases:
- - InlineQueryResult
diff --git a/.butcher/types/InlineQueryResultDocument/replace.yml b/.butcher/types/InlineQueryResultDocument/replace.yml
index cd89306d..e87fb9b3 100644
--- a/.butcher/types/InlineQueryResultDocument/replace.yml
+++ b/.butcher/types/InlineQueryResultDocument/replace.yml
@@ -1,6 +1,3 @@
-bases:
- - InlineQueryResult
-
annotations:
parse_mode:
value: UNSET_PARSE_MODE
diff --git a/.butcher/types/InlineQueryResultGame/replace.yml b/.butcher/types/InlineQueryResultGame/replace.yml
deleted file mode 100644
index cbe6bc26..00000000
--- a/.butcher/types/InlineQueryResultGame/replace.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-bases:
- - InlineQueryResult
diff --git a/.butcher/types/InlineQueryResultGif/replace.yml b/.butcher/types/InlineQueryResultGif/replace.yml
index cd89306d..e87fb9b3 100644
--- a/.butcher/types/InlineQueryResultGif/replace.yml
+++ b/.butcher/types/InlineQueryResultGif/replace.yml
@@ -1,6 +1,3 @@
-bases:
- - InlineQueryResult
-
annotations:
parse_mode:
value: UNSET_PARSE_MODE
diff --git a/.butcher/types/InlineQueryResultLocation/replace.yml b/.butcher/types/InlineQueryResultLocation/replace.yml
deleted file mode 100644
index cbe6bc26..00000000
--- a/.butcher/types/InlineQueryResultLocation/replace.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-bases:
- - InlineQueryResult
diff --git a/.butcher/types/InlineQueryResultMpeg4Gif/replace.yml b/.butcher/types/InlineQueryResultMpeg4Gif/replace.yml
index cd89306d..e87fb9b3 100644
--- a/.butcher/types/InlineQueryResultMpeg4Gif/replace.yml
+++ b/.butcher/types/InlineQueryResultMpeg4Gif/replace.yml
@@ -1,6 +1,3 @@
-bases:
- - InlineQueryResult
-
annotations:
parse_mode:
value: UNSET_PARSE_MODE
diff --git a/.butcher/types/InlineQueryResultPhoto/replace.yml b/.butcher/types/InlineQueryResultPhoto/replace.yml
index cd89306d..e87fb9b3 100644
--- a/.butcher/types/InlineQueryResultPhoto/replace.yml
+++ b/.butcher/types/InlineQueryResultPhoto/replace.yml
@@ -1,6 +1,3 @@
-bases:
- - InlineQueryResult
-
annotations:
parse_mode:
value: UNSET_PARSE_MODE
diff --git a/.butcher/types/InlineQueryResultVenue/replace.yml b/.butcher/types/InlineQueryResultVenue/replace.yml
deleted file mode 100644
index cbe6bc26..00000000
--- a/.butcher/types/InlineQueryResultVenue/replace.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-bases:
- - InlineQueryResult
diff --git a/.butcher/types/InlineQueryResultVideo/replace.yml b/.butcher/types/InlineQueryResultVideo/replace.yml
index cd89306d..e87fb9b3 100644
--- a/.butcher/types/InlineQueryResultVideo/replace.yml
+++ b/.butcher/types/InlineQueryResultVideo/replace.yml
@@ -1,6 +1,3 @@
-bases:
- - InlineQueryResult
-
annotations:
parse_mode:
value: UNSET_PARSE_MODE
diff --git a/.butcher/types/InlineQueryResultVoice/replace.yml b/.butcher/types/InlineQueryResultVoice/replace.yml
index 6c32c60f..e87fb9b3 100644
--- a/.butcher/types/InlineQueryResultVoice/replace.yml
+++ b/.butcher/types/InlineQueryResultVoice/replace.yml
@@ -1,5 +1,3 @@
-bases:
- - InlineQueryResult
annotations:
parse_mode:
value: UNSET_PARSE_MODE
diff --git a/.butcher/types/InlineQueryResultsButton/entity.json b/.butcher/types/InlineQueryResultsButton/entity.json
index 169b1c2c..a66c2f3b 100644
--- a/.butcher/types/InlineQueryResultsButton/entity.json
+++ b/.butcher/types/InlineQueryResultsButton/entity.json
@@ -21,9 +21,9 @@
},
{
"type": "WebAppInfo",
- "description": "Description of the Web App that will be launched when the user presses the button. The Web App will be able to switch back to the inline mode using the method web_app_switch_inline_query inside the Web App.",
- "html_description": "Optional. Description of the Web App that will be launched when the user presses the button. The Web App will be able to switch back to the inline mode using the method web_app_switch_inline_query inside the Web App. | ",
- "rst_description": "*Optional*. Description of the `Web App `_ that will be launched when the user presses the button. The Web App will be able to switch back to the inline mode using the method *web_app_switch_inline_query* inside the Web App.\n",
+ "description": "Description of the Web App that will be launched when the user presses the button. The Web App will be able to switch back to the inline mode using the method switchInlineQuery inside the Web App.",
+ "html_description": "Optional. Description of the Web App that will be launched when the user presses the button. The Web App will be able to switch back to the inline mode using the method switchInlineQuery inside the Web App. | ",
+ "rst_description": "*Optional*. Description of the `Web App `_ that will be launched when the user presses the button. The Web App will be able to switch back to the inline mode using the method `switchInlineQuery `_ inside the Web App.\n",
"name": "web_app",
"required": false
},
diff --git a/.butcher/types/InputContactMessageContent/replace.yml b/.butcher/types/InputContactMessageContent/replace.yml
deleted file mode 100644
index 29166299..00000000
--- a/.butcher/types/InputContactMessageContent/replace.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-bases:
- - InputMessageContent
diff --git a/.butcher/types/InputInvoiceMessageContent/replace.yml b/.butcher/types/InputInvoiceMessageContent/replace.yml
deleted file mode 100644
index 29166299..00000000
--- a/.butcher/types/InputInvoiceMessageContent/replace.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-bases:
- - InputMessageContent
diff --git a/.butcher/types/InputLocationMessageContent/replace.yml b/.butcher/types/InputLocationMessageContent/replace.yml
deleted file mode 100644
index 29166299..00000000
--- a/.butcher/types/InputLocationMessageContent/replace.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-bases:
- - InputMessageContent
diff --git a/.butcher/types/InputMedia/subtypes.yml b/.butcher/types/InputMedia/subtypes.yml
new file mode 100644
index 00000000..6756ad51
--- /dev/null
+++ b/.butcher/types/InputMedia/subtypes.yml
@@ -0,0 +1 @@
+discriminator: "type"
diff --git a/.butcher/types/InputMediaAnimation/replace.yml b/.butcher/types/InputMediaAnimation/replace.yml
index a2756429..be3f441b 100644
--- a/.butcher/types/InputMediaAnimation/replace.yml
+++ b/.butcher/types/InputMediaAnimation/replace.yml
@@ -1,5 +1,3 @@
-bases:
- - InputMedia
annotations:
media:
parsed_type:
diff --git a/.butcher/types/InputMediaAudio/replace.yml b/.butcher/types/InputMediaAudio/replace.yml
index a2756429..be3f441b 100644
--- a/.butcher/types/InputMediaAudio/replace.yml
+++ b/.butcher/types/InputMediaAudio/replace.yml
@@ -1,5 +1,3 @@
-bases:
- - InputMedia
annotations:
media:
parsed_type:
diff --git a/.butcher/types/InputMediaDocument/replace.yml b/.butcher/types/InputMediaDocument/replace.yml
index a2756429..be3f441b 100644
--- a/.butcher/types/InputMediaDocument/replace.yml
+++ b/.butcher/types/InputMediaDocument/replace.yml
@@ -1,5 +1,3 @@
-bases:
- - InputMedia
annotations:
media:
parsed_type:
diff --git a/.butcher/types/InputMediaPhoto/replace.yml b/.butcher/types/InputMediaPhoto/replace.yml
index a2756429..be3f441b 100644
--- a/.butcher/types/InputMediaPhoto/replace.yml
+++ b/.butcher/types/InputMediaPhoto/replace.yml
@@ -1,5 +1,3 @@
-bases:
- - InputMedia
annotations:
media:
parsed_type:
diff --git a/.butcher/types/InputMediaVideo/replace.yml b/.butcher/types/InputMediaVideo/replace.yml
index a2756429..be3f441b 100644
--- a/.butcher/types/InputMediaVideo/replace.yml
+++ b/.butcher/types/InputMediaVideo/replace.yml
@@ -1,5 +1,3 @@
-bases:
- - InputMedia
annotations:
media:
parsed_type:
diff --git a/.butcher/types/InputMessageContent/subtypes.yml b/.butcher/types/InputMessageContent/subtypes.yml
new file mode 100644
index 00000000..ffcd4415
--- /dev/null
+++ b/.butcher/types/InputMessageContent/subtypes.yml
@@ -0,0 +1 @@
+{ }
diff --git a/.butcher/types/InputTextMessageContent/replace.yml b/.butcher/types/InputTextMessageContent/replace.yml
index 63741e83..ebc1d7e9 100644
--- a/.butcher/types/InputTextMessageContent/replace.yml
+++ b/.butcher/types/InputTextMessageContent/replace.yml
@@ -1,6 +1,3 @@
-bases:
- - InputMessageContent
-
annotations:
parse_mode:
value: UNSET_PARSE_MODE
diff --git a/.butcher/types/InputVenueMessageContent/replace.yml b/.butcher/types/InputVenueMessageContent/replace.yml
deleted file mode 100644
index 29166299..00000000
--- a/.butcher/types/InputVenueMessageContent/replace.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-bases:
- - InputMessageContent
diff --git a/.butcher/types/MenuButton/subtypes.yml b/.butcher/types/MenuButton/subtypes.yml
new file mode 100644
index 00000000..6756ad51
--- /dev/null
+++ b/.butcher/types/MenuButton/subtypes.yml
@@ -0,0 +1 @@
+discriminator: "type"
diff --git a/.butcher/types/MenuButtonCommands/replace.yml b/.butcher/types/MenuButtonCommands/replace.yml
deleted file mode 100644
index cc566462..00000000
--- a/.butcher/types/MenuButtonCommands/replace.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-bases:
- - MenuButton
diff --git a/.butcher/types/MenuButtonDefault/replace.yml b/.butcher/types/MenuButtonDefault/replace.yml
deleted file mode 100644
index cc566462..00000000
--- a/.butcher/types/MenuButtonDefault/replace.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-bases:
- - MenuButton
diff --git a/.butcher/types/MenuButtonWebApp/replace.yml b/.butcher/types/MenuButtonWebApp/replace.yml
deleted file mode 100644
index cc566462..00000000
--- a/.butcher/types/MenuButtonWebApp/replace.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-bases:
- - MenuButton
diff --git a/.butcher/types/Message/aliases.yml b/.butcher/types/Message/aliases.yml
index 4d731875..341919cc 100644
--- a/.butcher/types/Message/aliases.yml
+++ b/.butcher/types/Message/aliases.yml
@@ -1,189 +1,242 @@
answer:
method: sendMessage
+ code: &assert-chat |
+ assert self.chat is not None, "This method can be used only if chat is present in the message."
fill: &fill-answer
chat_id: self.chat.id
message_thread_id: self.message_thread_id if self.is_topic_message else None
reply:
method: sendMessage
+ code: *assert-chat
fill: &fill-reply
<<: *fill-answer
reply_to_message_id: self.message_id
answer_animation:
method: sendAnimation
+ code: *assert-chat
fill: *fill-answer
reply_animation:
method: sendAnimation
+ code: *assert-chat
fill: *fill-reply
answer_audio:
method: sendAudio
+ code: *assert-chat
fill: *fill-answer
reply_audio:
method: sendAudio
+ code: *assert-chat
fill: *fill-reply
answer_contact:
method: sendContact
+ code: *assert-chat
fill: *fill-answer
reply_contact:
method: sendContact
+ code: *assert-chat
fill: *fill-reply
answer_document:
method: sendDocument
+ code: *assert-chat
fill: *fill-answer
reply_document:
method: sendDocument
+ code: *assert-chat
fill: *fill-reply
answer_game:
method: sendGame
+ code: *assert-chat
fill: *fill-answer
reply_game:
method: sendGame
+ code: *assert-chat
fill: *fill-reply
answer_invoice:
method: sendInvoice
+ code: *assert-chat
fill: *fill-answer
reply_invoice:
method: sendInvoice
+ code: *assert-chat
fill: *fill-reply
answer_location:
method: sendLocation
+ code: *assert-chat
fill: *fill-answer
reply_location:
method: sendLocation
+ code: *assert-chat
fill: *fill-reply
answer_media_group:
method: sendMediaGroup
+ code: *assert-chat
fill: *fill-answer
reply_media_group:
method: sendMediaGroup
+ code: *assert-chat
fill: *fill-reply
answer_photo:
method: sendPhoto
+ code: *assert-chat
fill: *fill-answer
reply_photo:
method: sendPhoto
+ code: *assert-chat
fill: *fill-reply
answer_poll:
method: sendPoll
+ code: *assert-chat
fill: *fill-answer
reply_poll:
method: sendPoll
+ code: *assert-chat
fill: *fill-reply
answer_dice:
method: sendDice
+ code: *assert-chat
fill: *fill-answer
reply_dice:
method: sendDice
+ code: *assert-chat
fill: *fill-reply
answer_sticker:
method: sendSticker
+ code: *assert-chat
fill: *fill-answer
reply_sticker:
method: sendSticker
+ code: *assert-chat
fill: *fill-reply
answer_venue:
method: sendVenue
+ code: *assert-chat
fill: *fill-answer
reply_venue:
method: sendVenue
+ code: *assert-chat
fill: *fill-reply
answer_video:
method: sendVideo
+ code: *assert-chat
fill: *fill-answer
reply_video:
method: sendVideo
+ code: *assert-chat
fill: *fill-reply
answer_video_note:
method: sendVideoNote
+ code: *assert-chat
fill: *fill-answer
reply_video_note:
method: sendVideoNote
+ code: *assert-chat
fill: *fill-reply
answer_voice:
method: sendVoice
+ code: *assert-chat
fill: *fill-answer
reply_voice:
method: sendVoice
+ code: *assert-chat
fill: *fill-reply
copy_to:
method: copyMessage
+ code: *assert-chat
+ fill:
+ from_chat_id: self.chat.id
+ message_id: self.message_id
+
+forward:
+ method: forwardMessage
+ code: *assert-chat
fill:
from_chat_id: self.chat.id
message_id: self.message_id
edit_text:
method: editMessageText
+ code: *assert-chat
fill: &message-target
chat_id: self.chat.id
message_id: self.message_id
-forward:
- method: forwardMessage
- fill:
- from_chat_id: self.chat.id
- message_id: self.message_id
-
edit_media:
method: editMessageMedia
fill: *message-target
+ code: *assert-chat
edit_reply_markup:
method: editMessageReplyMarkup
+ code: *assert-chat
fill: *message-target
+delete_reply_markup:
+ method: editMessageReplyMarkup
+ code: *assert-chat
+ fill:
+ <<: *message-target
+ reply_markup: None
+
edit_live_location:
method: editMessageLiveLocation
+ code: *assert-chat
fill: *message-target
stop_live_location:
method: stopMessageLiveLocation
+ code: *assert-chat
fill: *message-target
edit_caption:
method: editMessageCaption
+ code: *assert-chat
fill: *message-target
delete:
method: deleteMessage
+ code: *assert-chat
fill: *message-target
pin:
method: pinChatMessage
+ code: *assert-chat
fill: *message-target
unpin:
method: unpinChatMessage
+ code: *assert-chat
fill: *message-target
diff --git a/.butcher/types/Message/entity.json b/.butcher/types/Message/entity.json
index cd5e27cb..993d37eb 100644
--- a/.butcher/types/Message/entity.json
+++ b/.butcher/types/Message/entity.json
@@ -227,6 +227,14 @@
"name": "sticker",
"required": false
},
+ {
+ "type": "Story",
+ "description": "Message is a forwarded story",
+ "html_description": "Optional. Message is a forwarded story | ",
+ "rst_description": "*Optional*. Message is a forwarded story\n",
+ "name": "story",
+ "required": false
+ },
{
"type": "Video",
"description": "Message is a video, information about the video",
@@ -461,9 +469,9 @@
},
{
"type": "WriteAccessAllowed",
- "description": "Service message: the user allowed the bot added to the attachment menu to write messages",
- "html_description": "Optional. Service message: the user allowed the bot added to the attachment menu to write messages | ",
- "rst_description": "*Optional*. Service message: the user allowed the bot added to the attachment menu to write messages\n",
+ "description": "Service message: the user allowed the bot to write messages after adding it to the attachment or side menu, launching a Web App from a link, or accepting an explicit request from a Web App sent by the method requestWriteAccess",
+ "html_description": "Optional. Service message: the user allowed the bot to write messages after adding it to the attachment or side menu, launching a Web App from a link, or accepting an explicit request from a Web App sent by the method requestWriteAccess | ",
+ "rst_description": "*Optional*. Service message: the user allowed the bot to write messages after adding it to the attachment or side menu, launching a Web App from a link, or accepting an explicit request from a Web App sent by the method `requestWriteAccess `_\n",
"name": "write_access_allowed",
"required": false
},
diff --git a/.butcher/types/Message/replace.yml b/.butcher/types/Message/replace.yml
index 9a3a2842..5fa030bf 100644
--- a/.butcher/types/Message/replace.yml
+++ b/.butcher/types/Message/replace.yml
@@ -2,4 +2,8 @@ annotations:
date:
parsed_type:
type: std
- name: datetime.datetime
+ name: DateTime
+ forward_date:
+ parsed_type:
+ type: std
+ name: DateTime
diff --git a/.butcher/types/PassportElementError/subtypes.yml b/.butcher/types/PassportElementError/subtypes.yml
new file mode 100644
index 00000000..fd3f58ea
--- /dev/null
+++ b/.butcher/types/PassportElementError/subtypes.yml
@@ -0,0 +1 @@
+discriminator: "source"
diff --git a/.butcher/types/PassportElementErrorDataField/replace.yml b/.butcher/types/PassportElementErrorDataField/replace.yml
deleted file mode 100644
index 105b390f..00000000
--- a/.butcher/types/PassportElementErrorDataField/replace.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-bases:
- - PassportElementError
diff --git a/.butcher/types/PassportElementErrorFile/replace.yml b/.butcher/types/PassportElementErrorFile/replace.yml
deleted file mode 100644
index 105b390f..00000000
--- a/.butcher/types/PassportElementErrorFile/replace.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-bases:
- - PassportElementError
diff --git a/.butcher/types/PassportElementErrorFiles/replace.yml b/.butcher/types/PassportElementErrorFiles/replace.yml
deleted file mode 100644
index 105b390f..00000000
--- a/.butcher/types/PassportElementErrorFiles/replace.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-bases:
- - PassportElementError
diff --git a/.butcher/types/PassportElementErrorFrontSide/replace.yml b/.butcher/types/PassportElementErrorFrontSide/replace.yml
deleted file mode 100644
index 105b390f..00000000
--- a/.butcher/types/PassportElementErrorFrontSide/replace.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-bases:
- - PassportElementError
diff --git a/.butcher/types/PassportElementErrorReverseSide/replace.yml b/.butcher/types/PassportElementErrorReverseSide/replace.yml
deleted file mode 100644
index 105b390f..00000000
--- a/.butcher/types/PassportElementErrorReverseSide/replace.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-bases:
- - PassportElementError
diff --git a/.butcher/types/PassportElementErrorSelfie/replace.yml b/.butcher/types/PassportElementErrorSelfie/replace.yml
deleted file mode 100644
index 105b390f..00000000
--- a/.butcher/types/PassportElementErrorSelfie/replace.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-bases:
- - PassportElementError
diff --git a/.butcher/types/PassportElementErrorTranslationFile/replace.yml b/.butcher/types/PassportElementErrorTranslationFile/replace.yml
deleted file mode 100644
index 105b390f..00000000
--- a/.butcher/types/PassportElementErrorTranslationFile/replace.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-bases:
- - PassportElementError
diff --git a/.butcher/types/PassportElementErrorTranslationFiles/replace.yml b/.butcher/types/PassportElementErrorTranslationFiles/replace.yml
deleted file mode 100644
index 105b390f..00000000
--- a/.butcher/types/PassportElementErrorTranslationFiles/replace.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-bases:
- - PassportElementError
diff --git a/.butcher/types/PassportElementErrorUnspecified/replace.yml b/.butcher/types/PassportElementErrorUnspecified/replace.yml
deleted file mode 100644
index 105b390f..00000000
--- a/.butcher/types/PassportElementErrorUnspecified/replace.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-bases:
- - PassportElementError
diff --git a/.butcher/types/Poll/replace.yml b/.butcher/types/Poll/replace.yml
index 6cf9fbff..fc4371b5 100644
--- a/.butcher/types/Poll/replace.yml
+++ b/.butcher/types/Poll/replace.yml
@@ -2,4 +2,4 @@ annotations:
close_date:
parsed_type:
type: std
- name: datetime.datetime
+ name: DateTime
diff --git a/.butcher/types/PollAnswer/entity.json b/.butcher/types/PollAnswer/entity.json
index 9081b30c..3b14d6dc 100644
--- a/.butcher/types/PollAnswer/entity.json
+++ b/.butcher/types/PollAnswer/entity.json
@@ -19,19 +19,27 @@
"name": "poll_id",
"required": true
},
+ {
+ "type": "Chat",
+ "description": "The chat that changed the answer to the poll, if the voter is anonymous",
+ "html_description": "Optional. The chat that changed the answer to the poll, if the voter is anonymous | ",
+ "rst_description": "*Optional*. The chat that changed the answer to the poll, if the voter is anonymous\n",
+ "name": "voter_chat",
+ "required": false
+ },
{
"type": "User",
- "description": "The user, who changed the answer to the poll",
- "html_description": "The user, who changed the answer to the poll | ",
- "rst_description": "The user, who changed the answer to the poll\n",
+ "description": "The user that changed the answer to the poll, if the voter isn't anonymous",
+ "html_description": "Optional. The user that changed the answer to the poll, if the voter isn't anonymous | ",
+ "rst_description": "*Optional*. The user that changed the answer to the poll, if the voter isn't anonymous\n",
"name": "user",
- "required": true
+ "required": false
},
{
"type": "Array of Integer",
- "description": "0-based identifiers of answer options, chosen by the user. May be empty if the user retracted their vote.",
- "html_description": "0-based identifiers of answer options, chosen by the user. May be empty if the user retracted their vote. | ",
- "rst_description": "0-based identifiers of answer options, chosen by the user. May be empty if the user retracted their vote.\n",
+ "description": "0-based identifiers of chosen answer options. May be empty if the vote was retracted.",
+ "html_description": "0-based identifiers of chosen answer options. May be empty if the vote was retracted. | ",
+ "rst_description": "0-based identifiers of chosen answer options. May be empty if the vote was retracted.\n",
"name": "option_ids",
"required": true
}
diff --git a/.butcher/types/PreCheckoutQuery/aliases.yml b/.butcher/types/PreCheckoutQuery/aliases.yml
new file mode 100644
index 00000000..780f3bd1
--- /dev/null
+++ b/.butcher/types/PreCheckoutQuery/aliases.yml
@@ -0,0 +1,4 @@
+answer:
+ method: answerPreCheckoutQuery
+ fill:
+ pre_checkout_query_id: self.id
diff --git a/.butcher/types/ShippingQuery/aliases.yml b/.butcher/types/ShippingQuery/aliases.yml
new file mode 100644
index 00000000..7fb73655
--- /dev/null
+++ b/.butcher/types/ShippingQuery/aliases.yml
@@ -0,0 +1,4 @@
+answer:
+ method: answerShippingQuery
+ fill:
+ shipping_query_id: self.id
diff --git a/.butcher/types/Story/entity.json b/.butcher/types/Story/entity.json
new file mode 100644
index 00000000..77ab9bea
--- /dev/null
+++ b/.butcher/types/Story/entity.json
@@ -0,0 +1,16 @@
+{
+ "meta": {},
+ "group": {
+ "title": "Available types",
+ "anchor": "available-types"
+ },
+ "object": {
+ "anchor": "story",
+ "name": "Story",
+ "description": "This object represents a message about a forwarded story in the chat. Currently holds no information.",
+ "html_description": "This object represents a message about a forwarded story in the chat. Currently holds no information.
",
+ "rst_description": "This object represents a message about a forwarded story in the chat. Currently holds no information.",
+ "annotations": [],
+ "category": "types"
+ }
+}
diff --git a/.butcher/types/Update/entity.json b/.butcher/types/Update/entity.json
index 1ee46f08..9ccf33e5 100644
--- a/.butcher/types/Update/entity.json
+++ b/.butcher/types/Update/entity.json
@@ -117,9 +117,9 @@
},
{
"type": "ChatMemberUpdated",
- "description": "A chat member's status was updated in a chat. The bot must be an administrator in the chat and must explicitly specify 'chat_member' in the list of allowed_updates to receive these updates.",
- "html_description": "Optional. A chat member's status was updated in a chat. The bot must be an administrator in the chat and must explicitly specify “chat_member” in the list of allowed_updates to receive these updates. | ",
- "rst_description": "*Optional*. A chat member's status was updated in a chat. The bot must be an administrator in the chat and must explicitly specify 'chat_member' in the list of *allowed_updates* to receive these updates.\n",
+ "description": "A chat member's status was updated in a chat. The bot must be an administrator in the chat and must explicitly specify \"chat_member\" in the list of allowed_updates to receive these updates.",
+ "html_description": "Optional. A chat member's status was updated in a chat. The bot must be an administrator in the chat and must explicitly specify \"chat_member\" in the list of allowed_updates to receive these updates. | ",
+ "rst_description": "*Optional*. A chat member's status was updated in a chat. The bot must be an administrator in the chat and must explicitly specify :code:`\"chat_member\"` in the list of *allowed_updates* to receive these updates.\n",
"name": "chat_member",
"required": false
},
diff --git a/.butcher/types/VideoChatScheduled/replace.yml b/.butcher/types/VideoChatScheduled/replace.yml
index 48d98bf6..8aa22091 100644
--- a/.butcher/types/VideoChatScheduled/replace.yml
+++ b/.butcher/types/VideoChatScheduled/replace.yml
@@ -2,4 +2,4 @@ annotations:
start_date:
parsed_type:
type: std
- name: datetime.datetime
+ name: DateTime
diff --git a/.butcher/types/WebAppInfo/entity.json b/.butcher/types/WebAppInfo/entity.json
index a0ec3c45..aaeed289 100644
--- a/.butcher/types/WebAppInfo/entity.json
+++ b/.butcher/types/WebAppInfo/entity.json
@@ -14,8 +14,8 @@
{
"type": "String",
"description": "An HTTPS URL of a Web App to be opened with additional data as specified in Initializing Web Apps",
- "html_description": "An HTTPS URL of a Web App to be opened with additional data as specified in Initializing Web Apps | ",
- "rst_description": "An HTTPS URL of a Web App to be opened with additional data as specified in `Initializing Web Apps `_\n",
+ "html_description": "An HTTPS URL of a Web App to be opened with additional data as specified in Initializing Web Apps | ",
+ "rst_description": "An HTTPS URL of a Web App to be opened with additional data as specified in `Initializing Web Apps `_\n",
"name": "url",
"required": true
}
diff --git a/.butcher/types/WebhookInfo/replace.yml b/.butcher/types/WebhookInfo/replace.yml
index 4b1a71f0..5a784309 100644
--- a/.butcher/types/WebhookInfo/replace.yml
+++ b/.butcher/types/WebhookInfo/replace.yml
@@ -2,5 +2,5 @@ annotations:
last_error_date: &date
parsed_type:
type: std
- name: datetime.datetime
+ name: DateTime
last_synchronization_error_date: *date
diff --git a/.butcher/types/WriteAccessAllowed/entity.json b/.butcher/types/WriteAccessAllowed/entity.json
index 62d83fdd..d054736a 100644
--- a/.butcher/types/WriteAccessAllowed/entity.json
+++ b/.butcher/types/WriteAccessAllowed/entity.json
@@ -7,17 +7,33 @@
"object": {
"anchor": "writeaccessallowed",
"name": "WriteAccessAllowed",
- "description": "This object represents a service message about a user allowing a bot to write messages after adding the bot to the attachment menu or launching a Web App from a link.",
- "html_description": "This object represents a service message about a user allowing a bot to write messages after adding the bot to the attachment menu or launching a Web App from a link.
",
- "rst_description": "This object represents a service message about a user allowing a bot to write messages after adding the bot to the attachment menu or launching a Web App from a link.",
+ "description": "This object represents a service message about a user allowing a bot to write messages after adding it to the attachment menu, launching a Web App from a link, or accepting an explicit request from a Web App sent by the method requestWriteAccess.",
+ "html_description": "This object represents a service message about a user allowing a bot to write messages after adding it to the attachment menu, launching a Web App from a link, or accepting an explicit request from a Web App sent by the method requestWriteAccess.
",
+ "rst_description": "This object represents a service message about a user allowing a bot to write messages after adding it to the attachment menu, launching a Web App from a link, or accepting an explicit request from a Web App sent by the method `requestWriteAccess `_.",
"annotations": [
+ {
+ "type": "Boolean",
+ "description": "True, if the access was granted after the user accepted an explicit request from a Web App sent by the method requestWriteAccess",
+ "html_description": "Optional. True, if the access was granted after the user accepted an explicit request from a Web App sent by the method requestWriteAccess | ",
+ "rst_description": "*Optional*. True, if the access was granted after the user accepted an explicit request from a Web App sent by the method `requestWriteAccess `_\n",
+ "name": "from_request",
+ "required": false
+ },
{
"type": "String",
- "description": "Name of the Web App which was launched from a link",
- "html_description": "Optional. Name of the Web App which was launched from a link | ",
- "rst_description": "*Optional*. Name of the Web App which was launched from a link\n",
+ "description": "Name of the Web App, if the access was granted when the Web App was launched from a link",
+ "html_description": "Optional. Name of the Web App, if the access was granted when the Web App was launched from a link | ",
+ "rst_description": "*Optional*. Name of the Web App, if the access was granted when the Web App was launched from a link\n",
"name": "web_app_name",
"required": false
+ },
+ {
+ "type": "Boolean",
+ "description": "True, if the access was granted when the bot was added to the attachment or side menu",
+ "html_description": "Optional. True, if the access was granted when the bot was added to the attachment or side menu | ",
+ "rst_description": "*Optional*. True, if the access was granted when the bot was added to the attachment or side menu\n",
+ "name": "from_attachment_menu",
+ "required": false
}
],
"category": "types"
diff --git a/.github/ISSUE_TEMPLATE/bug.yaml b/.github/ISSUE_TEMPLATE/bug.yaml
new file mode 100644
index 00000000..89ec316c
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/bug.yaml
@@ -0,0 +1,100 @@
+name: Bug report
+description: Report issues affecting the framework or the documentation.
+labels:
+ - bug
+body:
+ - type: checkboxes
+ attributes:
+ label: Checklist
+ options:
+ - label: I am sure the error is coming from aiogram code
+ required: true
+ - label: I have searched in the issue tracker for similar bug reports, including closed ones
+ required: true
+
+ - type: markdown
+ attributes:
+ value: |
+ ## Context
+
+ Please provide as much information as possible. This will help us to reproduce the issue and fix it.
+
+ - type: input
+ attributes:
+ label: Operating system
+ placeholder: e.g. Ubuntu 20.04.2 LTS
+ validations:
+ required: true
+
+ - type: input
+ attributes:
+ label: Python version
+ description: (`python --version` inside your virtualenv)
+ placeholder: e.g. 3.10.1
+ validations:
+ required: true
+
+ - type: input
+ attributes:
+ label: aiogram version
+ description: (`pip show aiogram` inside your virtualenv)
+ placeholder: e.g. 2.21 or 3.0b3
+ validations:
+ required: true
+
+ - type: textarea
+ attributes:
+ label: Expected behavior
+ description: Please describe the behavior you are expecting.
+ placeholder: E.g. the bot should send a message with the text "Hello, world!".
+ validations:
+ required: true
+
+ - type: textarea
+ attributes:
+ label: Current behavior
+ description: Please describe the behavior you are currently experiencing.
+ placeholder: E.g. the bot doesn't send any message.
+ validations:
+ required: true
+
+ - type: textarea
+ attributes:
+ label: Steps to reproduce
+ description: Please describe the steps you took to reproduce the behavior.
+ placeholder: |
+ 1. step 1
+ 2. step 2
+ 3. ...
+ 4. you get it...
+ validations:
+ required: true
+
+ - type: textarea
+ attributes:
+ label: Code example
+ description: Provide a [minimal, reproducible](https://stackoverflow.com/help/minimal-reproducible-example) and properly formatted example (if applicable).
+ placeholder: |
+ from aiogram import Bot, Dispatcher
+ ...
+ render: python3
+
+ - type: textarea
+ attributes:
+ label: Logs
+ description: Provide the complete traceback (if applicable) or other kind of logs.
+ placeholder: |
+ Traceback (most recent call last):
+ File "main.py", line 1, in
+ ...
+ SomeException: ...
+ render: sh
+
+ - type: textarea
+ attributes:
+ label: Additional information
+ description: Please provide any additional information that may help us to reproduce the issue.
+ placeholder: |
+ E.g. this behavior is reproducible only in group chats.
+
+ You can also attach additional screenshots, logs, or other files.
diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
deleted file mode 100644
index 6adfd76b..00000000
--- a/.github/ISSUE_TEMPLATE/bug_report.md
+++ /dev/null
@@ -1,45 +0,0 @@
----
-name: Bug report
-about: Create a report to help us improve
-
----
-
----
-name: Bug report
-about: Create a report to help us improve
-
----
-
-## Context
-
-Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.
-
-* Operating System:
-* Python Version:
-* aiogram version:
-* aiohttp version:
-* uvloop version (if installed):
-
-## Expected Behavior
-
-Please describe the behavior you are expecting
-
-## Current Behavior
-
-What is the current behavior?
-
-## Failure Information (for bugs)
-
-Please help provide information about the failure if this is a bug. If it is not a bug, please remove the rest of this template.
-
-### Steps to Reproduce
-
-Please provide detailed steps for reproducing the issue.
-
-1. step 1
-2. step 2
-3. you get it...
-
-### Failure Logs
-
-Please include any relevant log snippets or files here.
diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml
new file mode 100644
index 00000000..aee2a9d6
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/config.yml
@@ -0,0 +1,11 @@
+blank_issues_enabled: true
+contact_links:
+ - name: Discuss anything related to the framework
+ url: https://github.com/aiogram/aiogram/discussions
+ about: Ask a question about aiogram or share your code snippets and ideas.
+ - name: Join our Telegram channel
+ url: https://t.me/aiogram_live
+ about: Get the latest updates about the framework.
+ - name: Join our Telegram chat
+ url: https://t.me/aiogram
+ about: Get help, ask questions, and discuss the framework in real-time.
diff --git a/.github/ISSUE_TEMPLATE/feature.yaml b/.github/ISSUE_TEMPLATE/feature.yaml
new file mode 100644
index 00000000..257417f1
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/feature.yaml
@@ -0,0 +1,56 @@
+name: Feature request
+description: Report features you would like to see or improve in the framework.
+labels:
+ - enhancement
+body:
+ - type: dropdown
+ attributes:
+ label: aiogram version
+ description: (`pip show aiogram` inside your virtualenv)
+ options:
+ - 3.x
+ - 2.x
+ - both
+ - n/a
+ validations:
+ required: true
+
+ - type: textarea
+ attributes:
+ label: Problem
+ description: Is your feature request related to a specific problem? If not, please describe the general idea of your request.
+ placeholder: e.g. I want to send a photo to a user by url.
+ validations:
+ required: true
+
+ - type: textarea
+ attributes:
+ label: Possible solution
+ description: Describe the solution you would like to see in the framework.
+ placeholder: e.g. Add a method to send a photo to a user by url.
+ validations:
+ required: true
+
+ - type: textarea
+ attributes:
+ label: Alternatives
+ description: What other solutions do you have in mind?
+ placeholder: e.g. I'm sending a text message with photo url.
+
+ - type: textarea
+ attributes:
+ label: Code example
+ description: A small code example that demonstrates the behavior you would like to see.
+ placeholder: |
+ await bot.send_photo(user_id, photo_url)
+ ...
+ render: python3
+
+ - type: textarea
+ attributes:
+ label: Additional information
+ description: Any additional information you would like to provide.
+ placeholder: |
+ E.g. this method should also cache images to speed up further sending.
+
+ You can also attach additional pictures or other files.
diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md
deleted file mode 100644
index 066b2d92..00000000
--- a/.github/ISSUE_TEMPLATE/feature_request.md
+++ /dev/null
@@ -1,17 +0,0 @@
----
-name: Feature request
-about: Suggest an idea for this project
-
----
-
-**Is your feature request related to a problem? Please describe.**
-A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
-
-**Describe the solution you'd like**
-A clear and concise description of what you want to happen.
-
-**Describe alternatives you've considered**
-A clear and concise description of any alternative solutions or features you've considered.
-
-**Additional context**
-Add any other context or screenshots about the feature request here.
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
index ade26bd1..9a4d9351 100644
--- a/.github/PULL_REQUEST_TEMPLATE.md
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -30,6 +30,5 @@ Please describe the tests that you ran to verify your changes. Provide instructi
- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have made corresponding changes to the documentation
-- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
diff --git a/.github/workflows/pull_request_changelog.yml b/.github/workflows/pull_request_changelog.yml
index f803153e..9115e29a 100644
--- a/.github/workflows/pull_request_changelog.yml
+++ b/.github/workflows/pull_request_changelog.yml
@@ -55,9 +55,13 @@ jobs:
You need to add a brief description of the changes to the `CHANGES` directory.
- For example, you can run `towncrier create .` to create a file in the change directory and then write a description on that file.
+ Changes file should be named like `..rst`,
+ example `1234.bugfix.rst` where `1234` is the PR or issue number and `bugfix` is the category.
- Read more at [Towncrier docs](https://towncrier.readthedocs.io/en/latest/quickstart.html#creating-news-fragments)
+ The content of the file should be a brief description of the changes in
+ the PR in the format of a description of what has been done.
+
+ Possible categories are: `feature`, `bugfix`, `doc`, `removal` and `misc`.
- name: Changelog found
if: "success()"
diff --git a/.github/workflows/pypi-release.yml b/.github/workflows/pypi-release.yml
index 1cfe82b1..6991e206 100644
--- a/.github/workflows/pypi-release.yml
+++ b/.github/workflows/pypi-release.yml
@@ -12,14 +12,21 @@ jobs:
steps:
- uses: actions/checkout@master
- - name: Set up Python 3.10
+ - name: Set up Python 3.11
uses: actions/setup-python@v4
with:
- python-version: "3.10"
+ python-version: "3.11"
- name: Install build dependencies
run: python -m pip install --upgrade build
+ - name: Resolve version
+ id: package-version
+ run: echo "value=$(echo ${{ github.ref }} | sed -e 's/refs\/tags\/v//')" >> $GITHUB_OUTPUT
+
+ # - name: Bump version
+ # run: hatch version ${{ steps.package-version.outputs.value }}
+
- name: Build source distribution
run: python -m build .
@@ -40,8 +47,12 @@ jobs:
publish:
name: Publish
needs: build
- if: "success() && startsWith(github.ref, 'refs/tags/')"
runs-on: ubuntu-latest
+ environment:
+ name: pypi
+ url: https://pypi.org/project/aiogram/${{ steps.package-version.outputs.value }}/
+ permissions:
+ id-token: write
steps:
- name: Download artifacts
uses: actions/download-artifact@v1
@@ -49,17 +60,5 @@ jobs:
name: dist
path: dist
- # - name: Publish a Python distribution to Test PyPI
- # uses: pypa/gh-action-pypi-publish@master
- ## if: github.event.action != 'published'
- # with:
- # user: __token__
- # password: ${{ secrets.PYPI_TEST_TOKEN }}
- # repository_url: https://test.pypi.org/legacy/
-
- name: Publish a Python distribution to PyPI
- uses: pypa/gh-action-pypi-publish@master
- # if: github.event.action == 'published'
- with:
- user: __token__
- password: ${{ secrets.PYPI_TOKEN }}
+ uses: pypa/gh-action-pypi-publish@release/v1
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index e5e85147..d238a558 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -74,7 +74,7 @@ jobs:
- name: Lint code
if: "env.IS_PYPY == 'false'"
run: |
- ruff --format=github aiogram examples
+ ruff --output-format=github aiogram examples
mypy aiogram
black --check --diff aiogram tests
diff --git a/.readthedocs.yml b/.readthedocs.yml
index 41b7a452..b61b3f17 100644
--- a/.readthedocs.yml
+++ b/.readthedocs.yml
@@ -1,13 +1,12 @@
version: 2
-python:
- version: "3.8"
- install:
- - method: pip
- path: .
- extra_requirements:
- - docs
- - redis
+build:
+ os: ubuntu-22.04
+ tools:
+ python: "3.11"
+ jobs:
+ post_install:
+ - pip install .[docs,redis]
sphinx:
configuration: docs/conf.py
diff --git a/CHANGES.rst b/CHANGES.rst
index afbb2d4a..359b8f26 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -16,6 +16,335 @@ Changelog
.. towncrier release notes start
+3.1.1 (2023-09-25)
+===================
+
+Bugfixes
+--------
+
+- Fixed `pydantic` version <2.4, since 2.4 has breaking changes.
+ `#1322 `_
+
+
+3.1.0 (2023-09-22)
+===================
+
+Features
+--------
+
+- Added support for custom encoders/decoders for payload (and also for deep-linking).
+ `#1262 `_
+- Added :class:`aiogram.utils.input_media.MediaGroupBuilder` for media group construction.
+ `#1293 `_
+- Added full support of `Bot API 6.9 `_
+ `#1319 `_
+
+
+Bugfixes
+--------
+
+- Added actual param hints for `InlineKeyboardBuilder` and `ReplyKeyboardBuilder`.
+ `#1303 `_
+- Fixed priority of events isolation, now user state will be loaded only after lock is acquired
+ `#1317 `_
+
+
+3.0.0 (2023-09-01)
+===================
+
+Bugfixes
+--------
+
+- Replaced :code:`datetime.datetime` with `DateTime` type wrapper across types to make dumped JSONs object
+ more compatible with data that is sent by Telegram.
+ `#1277 `_
+- Fixed magic :code:`.as_(...)` operation for values that can be interpreted as `False` (e.g. `0`).
+ `#1281 `_
+- Italic markdown from utils now uses correct decorators
+ `#1282 `_
+- Fixed method :code:`Message.send_copy` for stickers.
+ `#1284 `_
+- Fixed :code:`Message.send_copy` method, which was not working properly with stories, so not you can copy stories too (forwards messages).
+ `#1286 `_
+- Fixed error overlapping when validation error is caused by remove_unset root validator in base types and methods.
+ `#1290 `_
+
+
+3.0.0rc2 (2023-08-18)
+======================
+
+Bugfixes
+--------
+
+- Fixed missing message content types (:code:`ContentType.USER_SHARED`, :code:`ContentType.CHAT_SHARED`)
+ `#1252 `_
+- Fixed nested hashtag, cashtag and email message entities not being parsed correctly when these entities are inside another entity.
+ `#1259 `_
+- Moved global filters check placement into router to add chance to pass context from global filters
+ into handlers in the same way as it possible in other places
+ `#1266 `_
+
+
+Improved Documentation
+----------------------
+
+- Added error handling example `examples/error_handling.py`
+ `#1099 `_
+- Added a few words about skipping pending updates
+ `#1251 `_
+- Added a section on Dependency Injection technology
+ `#1253 `_
+- This update includes the addition of a multi-file bot example to the repository.
+ `#1254 `_
+- Refactored examples code to use aiogram enumerations and enhanced chat messages with markdown
+ beautification's for a more user-friendly display.
+ `#1256 `_
+- Supplemented "Finite State Machine" section in Migration FAQ
+ `#1264 `_
+- Removed extra param in docstring of TelegramEventObserver's filter method
+ and fixed typo in I18n documentation.
+ `#1268 `_
+
+
+Misc
+----
+
+- Enhanced the warning message in dispatcher to include a JSON dump of the update when update type is not known.
+ `#1269 `_
+- Added support for `Bot API 6.8 `_
+ `#1275 `_
+
+
+3.0.0rc1 (2023-08-06)
+======================
+
+Features
+--------
+
+- Added Currency enum.
+ You can use it like this:
+
+ .. code-block:: python
+
+ from aiogram.enums import Currency
+
+ await bot.send_invoice(
+ ...,
+ currency=Currency.USD,
+ ...
+ )
+ `#1194 `_
+- Updated keyboard builders with new methods for integrating buttons and keyboard creation more seamlessly.
+ Added functionality to create buttons from existing markup and attach another builder.
+ This improvement aims to make the keyboard building process more user-friendly and flexible.
+ `#1236 `_
+- Added support for message_thread_id in ChatActionSender
+ `#1249 `_
+
+
+Bugfixes
+--------
+
+- Fixed polling startup when "bot" key is passed manually into dispatcher workflow data
+ `#1242 `_
+- Added codegen configuration for lost shortcuts:
+
+ - ShippingQuery.answer
+ - PreCheckoutQuery.answer
+ - Message.delete_reply_markup
+ `#1244 `_
+
+
+Improved Documentation
+----------------------
+
+- Added documentation for webhook and polling modes.
+ `#1241 `_
+
+
+Misc
+----
+
+- Reworked InputFile reading, removed :code:`__aiter__` method, added `bot: Bot` argument to
+ the :code:`.read(...)` method, so, from now URLInputFile can be used without specifying
+ bot instance.
+ `#1238 `_
+- Code-generated :code:`__init__` typehints in types and methods to make IDE happy without additional pydantic plugin
+ `#1245 `_
+
+
+3.0.0b9 (2023-07-30)
+=====================
+
+Features
+--------
+
+- Added new shortcuts for :class:`aiogram.types.chat_member_updated.ChatMemberUpdated`
+ to send message to chat that member joined/left.
+ `#1234 `_
+- Added new shortcuts for :class:`aiogram.types.chat_join_request.ChatJoinRequest`
+ to make easier access to sending messages to users who wants to join to chat.
+ `#1235 `_
+
+
+Bugfixes
+--------
+
+- Fixed bot assignment in the :code:`Message.send_copy` shortcut
+ `#1232 `_
+- Added model validation to remove UNSET before field validation.
+ This change was necessary to correctly handle parse_mode where 'UNSET' is used as a sentinel value.
+ Without the removal of 'UNSET', it would create issues when passed to model initialization from Bot.method_name.
+ 'UNSET' was also added to typing.
+ `#1233 `_
+- Updated pydantic to 2.1 with few bugfixes
+
+
+Improved Documentation
+----------------------
+
+- Improved docs, added basic migration guide (will be expanded later)
+ `#1143 `_
+
+
+Deprecations and Removals
+-------------------------
+
+- Removed the use of the context instance (Bot.get_current) from all placements that were used previously.
+ This is to avoid the use of the context instance in the wrong place.
+ `#1230 `_
+
+
+3.0.0b8 (2023-07-17)
+=====================
+
+Features
+--------
+
+- Added possibility to use custom events in routers (If router does not support custom event it does not break and passes it to included routers).
+ `#1147 `_
+- Added support for FSM in Forum topics.
+
+ The strategy can be changed in dispatcher:
+
+ .. code-block:: python
+
+ from aiogram.fsm.strategy import FSMStrategy
+ ...
+ dispatcher = Dispatcher(
+ fsm_strategy=FSMStrategy.USER_IN_TOPIC,
+ storage=..., # Any persistent storage
+ )
+
+ .. note::
+
+ If you have implemented you own storages you should extend record key generation
+ with new one attribute - :code:`thread_id`
+ `#1161 `_
+- Improved CallbackData serialization.
+
+ - Minimized UUID (hex without dashes)
+ - Replaced bool values with int (true=1, false=0)
+ `#1163 `_
+- Added a tool to make text formatting flexible and easy.
+ More details on the :ref:`corresponding documentation page `
+ `#1172 `_
+- Added :code:`X-Telegram-Bot-Api-Secret-Token` header check
+ `#1173 `_
+- Made :code:`allowed_updates` list to revolve automatically in start_polling method if not set explicitly.
+ `#1178 `_
+- Added possibility to pass custom headers to :class:`URLInputFile` object
+ `#1191 `_
+
+
+Bugfixes
+--------
+
+- Change type of result in InlineQueryResult enum for :code:`InlineQueryResultCachedMpeg4Gif`
+ and :code:`InlineQueryResultMpeg4Gif` to more correct according to documentation.
+
+ Change regexp for entities parsing to more correct (:code:`InlineQueryResultType.yml`).
+ `#1146 `_
+- Fixed signature of startup/shutdown events to include the :code:`**dispatcher.workflow_data` as the handler arguments.
+ `#1155 `_
+- Added missing :code:`FORUM_TOPIC_EDITED` value to content_type property
+ `#1160 `_
+- Fixed compatibility with Python 3.8-3.9 (from previous release)
+ `#1162 `_
+- Fixed the markdown spoiler parser.
+ `#1176 `_
+- Fixed workflow data propagation
+ `#1196 `_
+- Fixed the serialization error associated with nested subtypes
+ like InputMedia, ChatMember, etc.
+
+ The previously generated code resulted in an invalid schema under pydantic v2,
+ which has stricter type parsing.
+ Hence, subtypes without the specification of all subtype unions were generating
+ an empty object. This has been rectified now.
+ `#1213 `_
+
+
+Improved Documentation
+----------------------
+
+- Changed small grammar typos for :code:`upload_file`
+ `#1133 `_
+
+
+Deprecations and Removals
+-------------------------
+
+- Removed text filter in due to is planned to remove this filter few versions ago.
+
+ Use :code:`F.text` instead
+ `#1170 `_
+
+
+Misc
+----
+
+- Added full support of `Bot API 6.6 `_
+
+ .. danger::
+
+ Note that this issue has breaking changes described in in the Bot API changelog,
+ this changes is not breaking in the API but breaking inside aiogram because
+ Beta stage is not finished.
+ `#1139 `_
+- Added full support of `Bot API 6.7 `_
+
+ .. warning::
+
+ Note that arguments *switch_pm_parameter* and *switch_pm_text* was deprecated
+ and should be changed to *button* argument as described in API docs.
+ `#1168 `_
+- Updated `Pydantic to V2 `_
+
+ .. warning::
+
+ Be careful, not all libraries is already updated to using V2
+ `#1202 `_
+- Added global defaults :code:`disable_web_page_preview` and :code:`protect_content` in addition to :code:`parse_mode` to the Bot instance,
+ reworked internal request builder mechanism.
+ `#1142 `_
+- Removed bot parameters from storages
+ `#1144 `_
+
+- Replaced ContextVar's with a new feature called `Validation Context `_
+ in Pydantic to improve the clarity, usability, and versatility of handling the Bot instance within method shortcuts.
+
+ .. danger::
+
+ **Breaking**: The 'bot' argument now is required in `URLInputFile`
+ `#1210 `_
+- Updated magic-filter with new features
+
+ - Added hint for :code:`len(F)` error
+ - Added not in operation
+ `#1221 `_
+
+
3.0.0b7 (2023-02-18)
=====================
diff --git a/CHANGES/1133.doc.rst b/CHANGES/1133.doc.rst
deleted file mode 100644
index a5ab681d..00000000
--- a/CHANGES/1133.doc.rst
+++ /dev/null
@@ -1 +0,0 @@
-Changed small grammar typos for `upload_file`
diff --git a/CHANGES/1139.misc.rst b/CHANGES/1139.misc.rst
deleted file mode 100644
index 432607e0..00000000
--- a/CHANGES/1139.misc.rst
+++ /dev/null
@@ -1,7 +0,0 @@
-Added full support of `Bot API 6.6 `_
-
-.. danger::
-
- Note that this issue has breaking changes described in in the Bot API changelog,
- this changes is not breaking in the API but breaking inside aiogram because
- Beta stage is not finished.
diff --git a/CHANGES/1142.misc.rst b/CHANGES/1142.misc.rst
deleted file mode 100644
index c17fb588..00000000
--- a/CHANGES/1142.misc.rst
+++ /dev/null
@@ -1,2 +0,0 @@
-Added global defaults `disable_web_page_preview` and `protect_content` in addition to `parse_mode` to the Bot instance,
-reworked internal request builder mechanism.
diff --git a/CHANGES/1144.misc.rst b/CHANGES/1144.misc.rst
deleted file mode 100644
index 8b3109f0..00000000
--- a/CHANGES/1144.misc.rst
+++ /dev/null
@@ -1 +0,0 @@
-Removed bot parameters from storages
diff --git a/CHANGES/1146.bugfix.rst b/CHANGES/1146.bugfix.rst
deleted file mode 100644
index fbe88e4c..00000000
--- a/CHANGES/1146.bugfix.rst
+++ /dev/null
@@ -1,4 +0,0 @@
-Change type of result in InlineQueryResult enum for `InlineQueryResultCachedMpeg4Gif`
-and `InlineQueryResultMpeg4Gif` to more correct according to documentation.
-
-Change regexp for entities parsing to more correct (`InlineQueryResultType.yml`).
diff --git a/CHANGES/1147.feature b/CHANGES/1147.feature
deleted file mode 100644
index fa34e703..00000000
--- a/CHANGES/1147.feature
+++ /dev/null
@@ -1 +0,0 @@
-If router does not support custom event it does not break and passes it to included routers
\ No newline at end of file
diff --git a/CHANGES/1155.bugfix.rst b/CHANGES/1155.bugfix.rst
deleted file mode 100644
index 753ffc96..00000000
--- a/CHANGES/1155.bugfix.rst
+++ /dev/null
@@ -1 +0,0 @@
-Fixed signature of startup/shutdown events to include the **dispatcher.workflow_data as the handler arguments.
diff --git a/CHANGES/1160.bugfix b/CHANGES/1160.bugfix
deleted file mode 100644
index 68e82835..00000000
--- a/CHANGES/1160.bugfix
+++ /dev/null
@@ -1 +0,0 @@
-Added missing FORUM_TOPIC_EDITED value to content_type property
diff --git a/CHANGES/1161.feature.rst b/CHANGES/1161.feature.rst
deleted file mode 100644
index 819c697c..00000000
--- a/CHANGES/1161.feature.rst
+++ /dev/null
@@ -1,17 +0,0 @@
-Added support for FSM in Forum topics.
-
-The strategy can be changed in dispatcher:
-
-.. code-block:: python
-
- from aiogram.fsm.strategy import FSMStrategy
- ...
- dispatcher = Dispatcher(
- fsm_strategy=FSMStrategy.USER_IN_THREAD,
- storage=..., # Any persistent storage
- )
-
-.. note::
-
- If you have implemented you own storages you should extend record key generation
- with new one attribute - `thread_id`
diff --git a/CHANGES/1162.bugfix.rst b/CHANGES/1162.bugfix.rst
deleted file mode 100644
index 16d5be16..00000000
--- a/CHANGES/1162.bugfix.rst
+++ /dev/null
@@ -1 +0,0 @@
-Fixed compatibility with Python 3.8-3.9
diff --git a/CHANGES/1163.feature.rst b/CHANGES/1163.feature.rst
deleted file mode 100644
index 06e97c3d..00000000
--- a/CHANGES/1163.feature.rst
+++ /dev/null
@@ -1,4 +0,0 @@
-Improved CallbackData serialization.
-
-- Minimized UUID (hex without dashes)
-- Replaced bool values with int (true=1, false=0)
diff --git a/CHANGES/1168.misc.rst b/CHANGES/1168.misc.rst
deleted file mode 100644
index 0bce876f..00000000
--- a/CHANGES/1168.misc.rst
+++ /dev/null
@@ -1,6 +0,0 @@
-Added full support of `Bot API 6.7 `_
-
-.. warning::
-
- Note that arguments *switch_pm_parameter* and *switch_pm_text* was deprecated
- and should be changed to *button* argument as described in API docs.
diff --git a/CHANGES/1170.removal.rst b/CHANGES/1170.removal.rst
deleted file mode 100644
index c2a06444..00000000
--- a/CHANGES/1170.removal.rst
+++ /dev/null
@@ -1,3 +0,0 @@
-Removed text filter in due to is planned to remove this filter few versions ago.
-
-Use :code:`F.text` instead
diff --git a/CHANGES/1176.bugfix.rst b/CHANGES/1176.bugfix.rst
deleted file mode 100644
index 57f67202..00000000
--- a/CHANGES/1176.bugfix.rst
+++ /dev/null
@@ -1 +0,0 @@
-Fixed the markdown spoiler parser.
diff --git a/CHANGES/1302.doc b/CHANGES/1302.doc
new file mode 100644
index 00000000..80cc5492
--- /dev/null
+++ b/CHANGES/1302.doc
@@ -0,0 +1 @@
+Corrected grammatical errors, improved sentence structures, translation for migration 2.x-3.x
\ No newline at end of file
diff --git a/CHANGES/1320.misc.rst b/CHANGES/1320.misc.rst
new file mode 100644
index 00000000..f7e079ce
--- /dev/null
+++ b/CHANGES/1320.misc.rst
@@ -0,0 +1 @@
+Fixed ResourceWarning in the tests, reworked :code:`RedisEventsIsolation` fixture to use Redis connection from :code:`RedisStorage`
diff --git a/CHANGES/1327.misc.rst b/CHANGES/1327.misc.rst
new file mode 100644
index 00000000..fd02654c
--- /dev/null
+++ b/CHANGES/1327.misc.rst
@@ -0,0 +1,6 @@
+Updated dependencies, bumped minimum required version:
+
+- :code:`magic-filter` - fixed `.resolve` operation
+- :code:`pydantic` - fixed compatibility (broken in 2.4)
+- :code:`aiodns` - added new dependency to the :code:`fast` extras (:code:`pip install aiogram[fast]`)
+- *others...*
diff --git a/CHANGES/1331.misc b/CHANGES/1331.misc
new file mode 100644
index 00000000..375f975c
--- /dev/null
+++ b/CHANGES/1331.misc
@@ -0,0 +1 @@
+Prevent update handling task pointers from being garbage collected, backport from 2.x
\ No newline at end of file
diff --git a/CHANGES/1332.bugfix.rst b/CHANGES/1332.bugfix.rst
new file mode 100644
index 00000000..004cfd1d
--- /dev/null
+++ b/CHANGES/1332.bugfix.rst
@@ -0,0 +1 @@
+ Fixed ``parse_mode`` in ``send_copy`` helper. Disable by default.
diff --git a/CHANGES/1340.doc.rst b/CHANGES/1340.doc.rst
new file mode 100644
index 00000000..83bd6723
--- /dev/null
+++ b/CHANGES/1340.doc.rst
@@ -0,0 +1 @@
+Minor typo correction, specifically in module naming + some grammar.
diff --git a/CHANGES/1343.feature.rst b/CHANGES/1343.feature.rst
new file mode 100644
index 00000000..6ae25cd3
--- /dev/null
+++ b/CHANGES/1343.feature.rst
@@ -0,0 +1 @@
+The new FSM strategy CHAT_TOPIC, which sets the state for the entire topic in the chat, also works in private messages and regular groups without topics.
diff --git a/CHANGES/1347.misc.rst b/CHANGES/1347.misc.rst
new file mode 100644
index 00000000..2da2e568
--- /dev/null
+++ b/CHANGES/1347.misc.rst
@@ -0,0 +1 @@
+Updated :code:`typing-extensions` package version range in dependencies to fix compatibility with :code:`FastAPI`
diff --git a/CHANGES/1351.doc.rst b/CHANGES/1351.doc.rst
new file mode 100644
index 00000000..5108d25e
--- /dev/null
+++ b/CHANGES/1351.doc.rst
@@ -0,0 +1,2 @@
+Added `CITATION.cff` file for automatic academic citation generation.
+Now you can copy citation from the GitHub page and paste it into your paper.
diff --git a/CHANGES/1353.doc.rst b/CHANGES/1353.doc.rst
new file mode 100644
index 00000000..15f6d28e
--- /dev/null
+++ b/CHANGES/1353.doc.rst
@@ -0,0 +1 @@
+Minor typo correction in middleware docs.
diff --git a/CHANGES/1357.misc.rst b/CHANGES/1357.misc.rst
new file mode 100644
index 00000000..96822c1f
--- /dev/null
+++ b/CHANGES/1357.misc.rst
@@ -0,0 +1 @@
+Speeded up CallableMixin processing by caching references to nested objects and simplifying kwargs assembly.
diff --git a/CHANGES/1360.bugfix.rst b/CHANGES/1360.bugfix.rst
new file mode 100644
index 00000000..e02d0ea4
--- /dev/null
+++ b/CHANGES/1360.bugfix.rst
@@ -0,0 +1 @@
+Added current handler to filters, so that flags can be retrieved from it.
diff --git a/CHANGES/1361.misc b/CHANGES/1361.misc
new file mode 100644
index 00000000..6e6413d8
--- /dev/null
+++ b/CHANGES/1361.misc
@@ -0,0 +1 @@
+Added pydantic v2.5 support.
diff --git a/CITATION.cff b/CITATION.cff
new file mode 100644
index 00000000..6eb723ae
--- /dev/null
+++ b/CITATION.cff
@@ -0,0 +1,23 @@
+# This CITATION.cff file was generated with cffinit.
+# Visit https://bit.ly/cffinit to generate yours today!
+
+cff-version: 1.2.0
+title: aiogram
+message: >-
+ If you use this software, please cite it using the
+ metadata from this file.
+type: software
+authors:
+ - given-names: Oleksandr
+ family-names: Onufriichuk
+ email: im@aiogram.dev
+repository-code: 'https://github.com/aiogram/aiogram'
+url: 'https://aiogram.dev'
+abstract: >-
+ aiogram is a modern and fully asynchronous framework for
+ Telegram Bot API written in Python using asyncio
+keywords:
+ - aiogram
+ - telegram
+ - bot
+license: MIT
diff --git a/LICENSE b/LICENSE
index f9721b14..caa060cc 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2017-2022 Alex Root Junior
+Copyright (c) 2017 - present Alex Root Junior
Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
diff --git a/Makefile b/Makefile
index 66dd4eba..0464bd45 100644
--- a/Makefile
+++ b/Makefile
@@ -67,19 +67,18 @@ test-coverage-view:
# Docs
# =================================================================================================
-locales := en uk_UA
+locales := uk_UA
locale_targets := $(addprefix docs-serve-, $(locales))
locales_pot := _build/gettext
docs_dir := docs
docs-gettext:
- cd $(docs_dir) && make gettext
- cd $(docs_dir) && sphinx-intl update -p $(locales_pot) $(addprefix -l , $(locales))
+ hatch run docs:bash -c 'cd $(docs_dir) && make gettext'
+ hatch run docs:bash -c 'cd $(docs_dir) && sphinx-intl update -p $(locales_pot) $(addprefix -l , $(locales))'
.PHONY: docs-gettext
docs-serve:
- #rm -rf docs/_build
- sphinx-autobuild --watch aiogram/ --watch CHANGELOG.rst --watch README.rst docs/ docs/_build/ $(OPTS)
+ hatch run docs:sphinx-autobuild --watch aiogram/ --watch CHANGELOG.rst --watch README.rst docs/ docs/_build/ $(OPTS)
.PHONY: docs-serve
$(locale_targets): docs-serve-%:
@@ -120,3 +119,16 @@ release:
git add .
git commit -m "Release $(shell poetry version -s)"
git tag v$(shell hatch version -s)
+
+
+butcher_version := 0.1.23
+
+butcher-install:
+ pip install -U git+ssh://git@github.com/aiogram/butcher.git@v$(butcher_version)
+.PHONY: butcher-install
+
+butcher:
+ butcher parse
+ butcher refresh
+ butcher apply all
+.PHONY: butcher
diff --git a/README.rst b/README.rst
index 3c2297a8..1a2f360a 100644
--- a/README.rst
+++ b/README.rst
@@ -1,9 +1,6 @@
-####################
-aiogram |beta badge|
-####################
-
-.. danger::
- This version is still in development!
+#######
+aiogram
+#######
.. image:: https://img.shields.io/pypi/l/aiogram.svg?style=flat-square
:target: https://opensource.org/licenses/MIT
@@ -49,25 +46,17 @@ Documentation:
- 🇺🇦 `Ukrainian `_
-.. danger::
-
- **Breaking News:**
-
- *aiogram* 3.0 has breaking changes.
-
- It breaks backward compatibility by introducing new breaking changes!
-
Features
========
- Asynchronous (`asyncio docs `_, :pep:`492`)
- Has type hints (:pep:`484`) and can be used with `mypy `_
- Supports `PyPy `_
-- Supports `Telegram Bot API 6.6 `_ and gets fast updates to the latest versions of the Bot API
+- Supports `Telegram Bot API 6.9 `_ and gets fast updates to the latest versions of the Bot API
- Telegram Bot API integration code was `autogenerated `_ and can be easily re-generated when API gets updated
- Updates router (Blueprints)
- Has Finite State Machine
-- Uses powerful `magic filters `
+- Uses powerful `magic filters `_
- Middlewares (incoming updates and API calls)
- Provides `Replies into Webhook `_
- Integrated I18n/L10n support with GNU Gettext (or Fluent)
@@ -89,7 +78,3 @@ Features
- 🇮🇷 `@aiogram_fa `_
- 🇮🇹 `@aiogram_it `_
- 🇧🇷 `@aiogram_br `_
-
-
-.. |beta badge| image:: https://img.shields.io/badge/-beta-orange
- :alt: Beta badge
diff --git a/aiogram/__init__.py b/aiogram/__init__.py
index 4ed355fc..31d1b16b 100644
--- a/aiogram/__init__.py
+++ b/aiogram/__init__.py
@@ -3,6 +3,7 @@ from contextlib import suppress
from aiogram.dispatcher.flags import FlagGenerator
from . import enums, methods, types
+from .__meta__ import __api_version__, __version__
from .client import session
from .client.bot import Bot
from .dispatcher.dispatcher import Dispatcher
@@ -15,7 +16,7 @@ from .utils.text_decorations import markdown_decoration as md
with suppress(ImportError):
import uvloop as _uvloop
- _uvloop.install()
+ _uvloop.install() # type: ignore[attr-defined,unused-ignore]
F = MagicFilter()
flags = FlagGenerator()
@@ -36,6 +37,3 @@ __all__ = (
"md",
"flags",
)
-
-__version__ = "3.0.0b8"
-__api_version__ = "6.6"
diff --git a/aiogram/__meta__.py b/aiogram/__meta__.py
new file mode 100644
index 00000000..d20e16db
--- /dev/null
+++ b/aiogram/__meta__.py
@@ -0,0 +1,2 @@
+__version__ = "3.2.0"
+__api_version__ = "6.9"
diff --git a/aiogram/client/bot.py b/aiogram/client/bot.py
index a5258eaa..bcaeff35 100644
--- a/aiogram/client/bot.py
+++ b/aiogram/client/bot.py
@@ -134,13 +134,20 @@ from ..methods import (
UnhideGeneralForumTopic,
UnpinAllChatMessages,
UnpinAllForumTopicMessages,
+ UnpinAllGeneralForumTopicMessages,
UnpinChatMessage,
UploadStickerFile,
)
from ..types import (
UNSET_PARSE_MODE,
BotCommand,
- BotCommandScope,
+ BotCommandScopeAllChatAdministrators,
+ BotCommandScopeAllGroupChats,
+ BotCommandScopeAllPrivateChats,
+ BotCommandScopeChat,
+ BotCommandScopeChatAdministrators,
+ BotCommandScopeChatMember,
+ BotCommandScopeDefault,
BotDescription,
BotName,
BotShortDescription,
@@ -160,10 +167,29 @@ from ..types import (
ForumTopic,
GameHighScore,
InlineKeyboardMarkup,
- InlineQueryResult,
+ InlineQueryResultArticle,
+ InlineQueryResultAudio,
+ InlineQueryResultCachedAudio,
+ InlineQueryResultCachedDocument,
+ InlineQueryResultCachedGif,
+ InlineQueryResultCachedMpeg4Gif,
+ InlineQueryResultCachedPhoto,
+ InlineQueryResultCachedSticker,
+ InlineQueryResultCachedVideo,
+ InlineQueryResultCachedVoice,
+ InlineQueryResultContact,
+ InlineQueryResultDocument,
+ InlineQueryResultGame,
+ InlineQueryResultGif,
+ InlineQueryResultLocation,
+ InlineQueryResultMpeg4Gif,
+ InlineQueryResultPhoto,
InlineQueryResultsButton,
+ InlineQueryResultVenue,
+ InlineQueryResultVideo,
+ InlineQueryResultVoice,
InputFile,
- InputMedia,
+ InputMediaAnimation,
InputMediaAudio,
InputMediaDocument,
InputMediaPhoto,
@@ -177,7 +203,15 @@ from ..types import (
Message,
MessageEntity,
MessageId,
- PassportElementError,
+ PassportElementErrorDataField,
+ PassportElementErrorFile,
+ PassportElementErrorFiles,
+ PassportElementErrorFrontSide,
+ PassportElementErrorReverseSide,
+ PassportElementErrorSelfie,
+ PassportElementErrorTranslationFile,
+ PassportElementErrorTranslationFiles,
+ PassportElementErrorUnspecified,
Poll,
ReplyKeyboardMarkup,
ReplyKeyboardRemove,
@@ -197,7 +231,7 @@ from .session.base import BaseSession
T = TypeVar("T")
-class Bot(ContextInstanceMixin["Bot"]):
+class Bot:
def __init__(
self,
token: str,
@@ -251,16 +285,14 @@ class Bot(ContextInstanceMixin["Bot"]):
"""
Generate bot context
- :param auto_close:
+ :param auto_close: close session on exit
:return:
"""
- token = self.set_current(self)
try:
yield self
finally:
if auto_close:
await self.session.close()
- self.reset_current(token)
async def me(self) -> User:
"""
@@ -481,7 +513,30 @@ class Bot(ContextInstanceMixin["Bot"]):
async def answer_inline_query(
self,
inline_query_id: str,
- results: List[InlineQueryResult],
+ results: List[
+ Union[
+ InlineQueryResultCachedAudio,
+ InlineQueryResultCachedDocument,
+ InlineQueryResultCachedGif,
+ InlineQueryResultCachedMpeg4Gif,
+ InlineQueryResultCachedPhoto,
+ InlineQueryResultCachedSticker,
+ InlineQueryResultCachedVideo,
+ InlineQueryResultCachedVoice,
+ InlineQueryResultArticle,
+ InlineQueryResultAudio,
+ InlineQueryResultContact,
+ InlineQueryResultGame,
+ InlineQueryResultDocument,
+ InlineQueryResultGif,
+ InlineQueryResultLocation,
+ InlineQueryResultMpeg4Gif,
+ InlineQueryResultPhoto,
+ InlineQueryResultVenue,
+ InlineQueryResultVideo,
+ InlineQueryResultVoice,
+ ]
+ ],
cache_time: Optional[int] = None,
is_personal: Optional[bool] = None,
next_offset: Optional[str] = None,
@@ -579,7 +634,28 @@ class Bot(ContextInstanceMixin["Bot"]):
async def answer_web_app_query(
self,
web_app_query_id: str,
- result: InlineQueryResult,
+ result: Union[
+ InlineQueryResultCachedAudio,
+ InlineQueryResultCachedDocument,
+ InlineQueryResultCachedGif,
+ InlineQueryResultCachedMpeg4Gif,
+ InlineQueryResultCachedPhoto,
+ InlineQueryResultCachedSticker,
+ InlineQueryResultCachedVideo,
+ InlineQueryResultCachedVoice,
+ InlineQueryResultArticle,
+ InlineQueryResultAudio,
+ InlineQueryResultContact,
+ InlineQueryResultGame,
+ InlineQueryResultDocument,
+ InlineQueryResultGif,
+ InlineQueryResultLocation,
+ InlineQueryResultMpeg4Gif,
+ InlineQueryResultPhoto,
+ InlineQueryResultVenue,
+ InlineQueryResultVideo,
+ InlineQueryResultVoice,
+ ],
request_timeout: Optional[int] = None,
) -> SentWebAppMessage:
"""
@@ -637,7 +713,7 @@ class Bot(ContextInstanceMixin["Bot"]):
:param chat_id: Unique identifier for the target group or username of the target supergroup or channel (in the format :code:`@channelusername`)
:param user_id: Unique identifier of the target user
- :param until_date: Date when the user will be unbanned, unix time. If user is banned for more than 366 days or less than 30 seconds from the current time they are considered to be banned forever. Applied for supergroups and channels only.
+ :param until_date: Date when the user will be unbanned; Unix time. If user is banned for more than 366 days or less than 30 seconds from the current time they are considered to be banned forever. Applied for supergroups and channels only.
:param revoke_messages: Pass :code:`True` to delete all messages from the chat for the user that is being removed. If :code:`False`, the user will be able to see messages in the group that were sent before the user was removed. Always :code:`True` for supergroups and channels.
:param request_timeout: Request timeout
:return: Returns :code:`True` on success.
@@ -1073,7 +1149,17 @@ class Bot(ContextInstanceMixin["Bot"]):
async def delete_my_commands(
self,
- scope: Optional[BotCommandScope] = None,
+ scope: Optional[
+ Union[
+ BotCommandScopeDefault,
+ BotCommandScopeAllPrivateChats,
+ BotCommandScopeAllGroupChats,
+ BotCommandScopeAllChatAdministrators,
+ BotCommandScopeChat,
+ BotCommandScopeChatAdministrators,
+ BotCommandScopeChatMember,
+ ]
+ ] = None,
language_code: Optional[str] = None,
request_timeout: Optional[int] = None,
) -> bool:
@@ -1282,7 +1368,13 @@ class Bot(ContextInstanceMixin["Bot"]):
async def edit_message_media(
self,
- media: InputMedia,
+ media: Union[
+ InputMediaAnimation,
+ InputMediaDocument,
+ InputMediaAudio,
+ InputMediaPhoto,
+ InputMediaVideo,
+ ],
chat_id: Optional[Union[int, str]] = None,
message_id: Optional[int] = None,
inline_message_id: Optional[str] = None,
@@ -1664,7 +1756,17 @@ class Bot(ContextInstanceMixin["Bot"]):
async def get_my_commands(
self,
- scope: Optional[BotCommandScope] = None,
+ scope: Optional[
+ Union[
+ BotCommandScopeDefault,
+ BotCommandScopeAllPrivateChats,
+ BotCommandScopeAllGroupChats,
+ BotCommandScopeAllChatAdministrators,
+ BotCommandScopeChat,
+ BotCommandScopeChatAdministrators,
+ BotCommandScopeChatMember,
+ ]
+ ] = None,
language_code: Optional[str] = None,
request_timeout: Optional[int] = None,
) -> List[BotCommand]:
@@ -1747,7 +1849,7 @@ class Bot(ContextInstanceMixin["Bot"]):
:param offset: Identifier of the first update to be returned. Must be greater by one than the highest among the identifiers of previously received updates. By default, updates starting with the earliest unconfirmed update are returned. An update is considered confirmed as soon as :class:`aiogram.methods.get_updates.GetUpdates` is called with an *offset* higher than its *update_id*. The negative offset can be specified to retrieve updates starting from *-offset* update from the end of the updates queue. All previous updates will be forgotten.
:param limit: Limits the number of updates to be retrieved. Values between 1-100 are accepted. Defaults to 100.
:param timeout: Timeout in seconds for long polling. Defaults to 0, i.e. usual short polling. Should be positive, short polling should be used for testing purposes only.
- :param allowed_updates: 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 :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* (default). If not specified, the previous setting will be used.
+ :param allowed_updates: 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* (default). If not specified, the previous setting will be used.
:param request_timeout: Request timeout
:return: Returns an Array of :class:`aiogram.types.update.Update` objects.
"""
@@ -1870,15 +1972,18 @@ class Bot(ContextInstanceMixin["Bot"]):
user_id: int,
is_anonymous: Optional[bool] = None,
can_manage_chat: Optional[bool] = None,
- can_post_messages: Optional[bool] = None,
- can_edit_messages: Optional[bool] = None,
can_delete_messages: Optional[bool] = None,
can_manage_video_chats: Optional[bool] = None,
can_restrict_members: Optional[bool] = None,
can_promote_members: Optional[bool] = None,
can_change_info: Optional[bool] = None,
can_invite_users: Optional[bool] = None,
+ can_post_messages: Optional[bool] = None,
+ can_edit_messages: Optional[bool] = None,
can_pin_messages: Optional[bool] = None,
+ can_post_stories: Optional[bool] = None,
+ can_edit_stories: Optional[bool] = None,
+ can_delete_stories: Optional[bool] = None,
can_manage_topics: Optional[bool] = None,
request_timeout: Optional[int] = None,
) -> bool:
@@ -1890,16 +1995,19 @@ class Bot(ContextInstanceMixin["Bot"]):
:param chat_id: Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)
:param user_id: Unique identifier of the target user
:param is_anonymous: Pass :code:`True` if the administrator's presence in the chat is hidden
- :param can_manage_chat: Pass :code:`True` if the administrator can access the chat event log, chat statistics, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege
- :param can_post_messages: Pass :code:`True` if the administrator can create channel posts, channels only
- :param can_edit_messages: Pass :code:`True` if the administrator can edit messages of other users and can pin messages, channels only
+ :param can_manage_chat: Pass :code:`True` if the administrator can access the chat event log, boost list in channels, see channel members, report spam messages, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege
:param can_delete_messages: Pass :code:`True` if the administrator can delete messages of other users
:param can_manage_video_chats: Pass :code:`True` if the administrator can manage video chats
- :param can_restrict_members: Pass :code:`True` if the administrator can restrict, ban or unban chat members
+ :param can_restrict_members: Pass :code:`True` if the administrator can restrict, ban or unban chat members, or access supergroup statistics
:param can_promote_members: Pass :code:`True` if the administrator can add new administrators with a subset of their own privileges or demote administrators that they have promoted, directly or indirectly (promoted by administrators that were appointed by him)
:param can_change_info: Pass :code:`True` if the administrator can change chat title, photo and other settings
:param can_invite_users: Pass :code:`True` if the administrator can invite new users to the chat
+ :param can_post_messages: Pass :code:`True` if the administrator can post messages in the channel, or access channel statistics; channels only
+ :param can_edit_messages: Pass :code:`True` if the administrator can edit messages of other users and can pin messages; channels only
:param can_pin_messages: Pass :code:`True` if the administrator can pin messages, supergroups only
+ :param can_post_stories: Pass :code:`True` if the administrator can post stories in the channel; channels only
+ :param can_edit_stories: Pass :code:`True` if the administrator can edit stories posted by other users; channels only
+ :param can_delete_stories: Pass :code:`True` if the administrator can delete stories posted by other users; channels only
:param can_manage_topics: Pass :code:`True` if the user is allowed to create, rename, close, and reopen forum topics, supergroups only
:param request_timeout: Request timeout
:return: Returns :code:`True` on success.
@@ -1910,15 +2018,18 @@ class Bot(ContextInstanceMixin["Bot"]):
user_id=user_id,
is_anonymous=is_anonymous,
can_manage_chat=can_manage_chat,
- can_post_messages=can_post_messages,
- can_edit_messages=can_edit_messages,
can_delete_messages=can_delete_messages,
can_manage_video_chats=can_manage_video_chats,
can_restrict_members=can_restrict_members,
can_promote_members=can_promote_members,
can_change_info=can_change_info,
can_invite_users=can_invite_users,
+ can_post_messages=can_post_messages,
+ can_edit_messages=can_edit_messages,
can_pin_messages=can_pin_messages,
+ can_post_stories=can_post_stories,
+ can_edit_stories=can_edit_stories,
+ can_delete_stories=can_delete_stories,
can_manage_topics=can_manage_topics,
)
return await self(call, request_timeout=request_timeout)
@@ -1964,7 +2075,7 @@ class Bot(ContextInstanceMixin["Bot"]):
:param user_id: Unique identifier of the target user
:param permissions: A JSON-serialized object for new user permissions
:param use_independent_chat_permissions: Pass :code:`True` if chat permissions are set independently. Otherwise, the *can_send_other_messages* and *can_add_web_page_previews* permissions will imply the *can_send_messages*, *can_send_audios*, *can_send_documents*, *can_send_photos*, *can_send_videos*, *can_send_video_notes*, and *can_send_voice_notes* permissions; the *can_send_polls* permission will imply the *can_send_messages* permission.
- :param until_date: Date when restrictions will be lifted for the user, unix time. If user is restricted for more than 366 days or less than 30 seconds from the current time, they are considered to be restricted forever
+ :param until_date: Date when restrictions will be lifted for the user; Unix time. If user is restricted for more than 366 days or less than 30 seconds from the current time, they are considered to be restricted forever
:param request_timeout: Request timeout
:return: Returns :code:`True` on success.
"""
@@ -3077,7 +3188,7 @@ class Bot(ContextInstanceMixin["Bot"]):
self,
chat_id: Optional[int] = None,
menu_button: Optional[
- Union[MenuButtonDefault, MenuButtonWebApp, MenuButtonCommands]
+ Union[MenuButtonCommands, MenuButtonWebApp, MenuButtonDefault]
] = None,
request_timeout: Optional[int] = None,
) -> bool:
@@ -3234,7 +3345,17 @@ class Bot(ContextInstanceMixin["Bot"]):
async def set_my_commands(
self,
commands: List[BotCommand],
- scope: Optional[BotCommandScope] = None,
+ scope: Optional[
+ Union[
+ BotCommandScopeDefault,
+ BotCommandScopeAllPrivateChats,
+ BotCommandScopeAllGroupChats,
+ BotCommandScopeAllChatAdministrators,
+ BotCommandScopeChat,
+ BotCommandScopeChatAdministrators,
+ BotCommandScopeChatMember,
+ ]
+ ] = None,
language_code: Optional[str] = None,
request_timeout: Optional[int] = None,
) -> bool:
@@ -3283,7 +3404,19 @@ class Bot(ContextInstanceMixin["Bot"]):
async def set_passport_data_errors(
self,
user_id: int,
- errors: List[PassportElementError],
+ errors: List[
+ Union[
+ PassportElementErrorDataField,
+ PassportElementErrorFrontSide,
+ PassportElementErrorReverseSide,
+ PassportElementErrorSelfie,
+ PassportElementErrorFile,
+ PassportElementErrorFiles,
+ PassportElementErrorTranslationFile,
+ PassportElementErrorTranslationFiles,
+ PassportElementErrorUnspecified,
+ ]
+ ],
request_timeout: Optional[int] = None,
) -> bool:
"""
@@ -3357,7 +3490,7 @@ class Bot(ContextInstanceMixin["Bot"]):
:param certificate: Upload your public key certificate so that the root certificate in use can be checked. See our `self-signed guide `_ for details.
:param ip_address: The fixed IP address which will be used to send webhook requests instead of the IP address resolved through DNS
:param max_connections: The maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery, 1-100. Defaults to *40*. Use lower values to limit the load on your bot's server, and higher values to increase your bot's throughput.
- :param allowed_updates: 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 :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* (default). If not specified, the previous setting will be used.
+ :param allowed_updates: 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* (default). If not specified, the previous setting will be used.
:param drop_pending_updates: Pass :code:`True` to drop all pending updates
:param secret_token: A secret token to be sent in a header 'X-Telegram-Bot-Api-Secret-Token' in every webhook request, 1-256 characters. Only characters :code:`A-Z`, :code:`a-z`, :code:`0-9`, :code:`_` and :code:`-` are allowed. The header is useful to ensure that the request comes from a webhook set by you.
:param request_timeout: Request timeout
@@ -3963,3 +4096,23 @@ class Bot(ContextInstanceMixin["Bot"]):
language_code=language_code,
)
return await self(call, request_timeout=request_timeout)
+
+ async def unpin_all_general_forum_topic_messages(
+ self,
+ chat_id: Union[int, str],
+ request_timeout: Optional[int] = None,
+ ) -> bool:
+ """
+ Use this method to clear the list of pinned messages in a General forum topic. The bot must be an administrator in the chat for this to work and must have the *can_pin_messages* administrator right in the supergroup. Returns :code:`True` on success.
+
+ Source: https://core.telegram.org/bots/api#unpinallgeneralforumtopicmessages
+
+ :param chat_id: Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)
+ :param request_timeout: Request timeout
+ :return: Returns :code:`True` on success.
+ """
+
+ call = UnpinAllGeneralForumTopicMessages(
+ chat_id=chat_id,
+ )
+ return await self(call, request_timeout=request_timeout)
diff --git a/aiogram/client/context_controller.py b/aiogram/client/context_controller.py
new file mode 100644
index 00000000..97795a73
--- /dev/null
+++ b/aiogram/client/context_controller.py
@@ -0,0 +1,33 @@
+from typing import TYPE_CHECKING, Any, Optional
+
+from pydantic import BaseModel, PrivateAttr
+from typing_extensions import Self
+
+if TYPE_CHECKING:
+ from aiogram.client.bot import Bot
+
+
+class BotContextController(BaseModel):
+ _bot: Optional["Bot"] = PrivateAttr()
+
+ def model_post_init(self, __context: Any) -> None:
+ self._bot = __context.get("bot") if __context else None
+
+ def as_(self, bot: Optional["Bot"]) -> Self:
+ """
+ Bind object to a bot instance.
+
+ :param bot: Bot instance
+ :return: self
+ """
+ self._bot = bot
+ return self
+
+ @property
+ def bot(self) -> Optional["Bot"]:
+ """
+ Get bot instance.
+
+ :return: Bot instance
+ """
+ return self._bot
diff --git a/aiogram/client/session/aiohttp.py b/aiogram/client/session/aiohttp.py
index 279f61f9..b92e32d2 100644
--- a/aiogram/client/session/aiohttp.py
+++ b/aiogram/client/session/aiohttp.py
@@ -6,6 +6,7 @@ from typing import (
TYPE_CHECKING,
Any,
AsyncGenerator,
+ AsyncIterator,
Dict,
Iterable,
List,
@@ -18,7 +19,10 @@ from typing import (
import certifi
from aiohttp import BasicAuth, ClientError, ClientSession, FormData, TCPConnector
+from aiohttp.hdrs import USER_AGENT
+from aiohttp.http import SERVER_SOFTWARE
+from aiogram.__meta__ import __version__
from aiogram.methods import TelegramMethod
from ...exceptions import TelegramNetworkError
@@ -121,7 +125,12 @@ class AiohttpSession(BaseSession):
await self.close()
if self._session is None or self._session.closed:
- self._session = ClientSession(connector=self._connector_type(**self._connector_init))
+ self._session = ClientSession(
+ connector=self._connector_type(**self._connector_init),
+ headers={
+ USER_AGENT: f"{SERVER_SOFTWARE} aiogram/{__version__}",
+ },
+ )
self._should_reset_connector = False
return self._session
@@ -130,16 +139,24 @@ class AiohttpSession(BaseSession):
if self._session is not None and not self._session.closed:
await self._session.close()
+ # Wait 250 ms for the underlying SSL connections to close
+ # https://docs.aiohttp.org/en/stable/client_advanced.html#graceful-shutdown
+ await asyncio.sleep(0.25)
+
def build_form_data(self, bot: Bot, method: TelegramMethod[TelegramType]) -> FormData:
form = FormData(quote_fields=False)
files: Dict[str, InputFile] = {}
- for key, value in method.dict().items():
+ for key, value in method.model_dump(warnings=False).items():
value = self.prepare_value(value, bot=bot, files=files)
if not value:
continue
form.add_field(key, value)
for key, value in files.items():
- form.add_field(key, value, filename=value.filename or key)
+ form.add_field(
+ key,
+ value.read(bot),
+ filename=value.filename or key,
+ )
return form
async def make_request(
@@ -159,15 +176,27 @@ class AiohttpSession(BaseSession):
raise TelegramNetworkError(method=method, message="Request timeout error")
except ClientError as e:
raise TelegramNetworkError(method=method, message=f"{type(e).__name__}: {e}")
- response = self.check_response(method=method, status_code=resp.status, content=raw_result)
+ response = self.check_response(
+ bot=bot, method=method, status_code=resp.status, content=raw_result
+ )
return cast(TelegramType, response.result)
async def stream_content(
- self, url: str, timeout: int, chunk_size: int, raise_for_status: bool
+ self,
+ url: str,
+ headers: Optional[Dict[str, Any]] = None,
+ timeout: int = 30,
+ chunk_size: int = 65536,
+ raise_for_status: bool = True,
) -> AsyncGenerator[bytes, None]:
+ if headers is None:
+ headers = {}
+
session = await self.create_session()
- async with session.get(url, timeout=timeout, raise_for_status=raise_for_status) as resp:
+ async with session.get(
+ url, timeout=timeout, headers=headers, raise_for_status=raise_for_status
+ ) as resp:
async for chunk in resp.content.iter_chunked(chunk_size):
yield chunk
diff --git a/aiogram/client/session/base.py b/aiogram/client/session/base.py
index a66eb7cc..650b44bc 100644
--- a/aiogram/client/session/base.py
+++ b/aiogram/client/session/base.py
@@ -53,6 +53,12 @@ DEFAULT_TIMEOUT: Final[float] = 60.0
class BaseSession(abc.ABC):
+ """
+ This is base class for all HTTP sessions in aiogram.
+
+ If you want to create your own session, you must inherit from this class.
+ """
+
def __init__(
self,
api: TelegramAPIServer = PRODUCTION,
@@ -75,7 +81,7 @@ class BaseSession(abc.ABC):
self.middleware = RequestMiddlewareManager()
def check_response(
- self, method: TelegramMethod[TelegramType], status_code: int, content: str
+ self, bot: Bot, method: TelegramMethod[TelegramType], status_code: int, content: str
) -> Response[TelegramType]:
"""
Check response status
@@ -89,7 +95,8 @@ class BaseSession(abc.ABC):
raise ClientDecodeError("Failed to decode object", e, content)
try:
- response = method.build_response(json_data)
+ response_type = Response[method.__returning__] # type: ignore
+ response = response_type.model_validate(json_data, context={"bot": bot})
except ValidationError as e:
raise ClientDecodeError("Failed to deserialize object", e, json_data)
@@ -158,7 +165,12 @@ class BaseSession(abc.ABC):
@abc.abstractmethod
async def stream_content(
- self, url: str, timeout: int, chunk_size: int, raise_for_status: bool
+ self,
+ url: str,
+ headers: Optional[Dict[str, Any]] = None,
+ timeout: int = 30,
+ chunk_size: int = 65536,
+ raise_for_status: bool = True,
) -> AsyncGenerator[bytes, None]: # pragma: no cover
"""
Stream reader
diff --git a/aiogram/client/session/middlewares/base.py b/aiogram/client/session/middlewares/base.py
index 90dcd09f..c5f3e7cf 100644
--- a/aiogram/client/session/middlewares/base.py
+++ b/aiogram/client/session/middlewares/base.py
@@ -1,7 +1,7 @@
from __future__ import annotations
from abc import ABC, abstractmethod
-from typing import TYPE_CHECKING, Awaitable, Callable, Union
+from typing import TYPE_CHECKING, Protocol
from aiogram.methods import Response, TelegramMethod
from aiogram.methods.base import TelegramType
@@ -9,16 +9,24 @@ from aiogram.methods.base import TelegramType
if TYPE_CHECKING:
from ...bot import Bot
-NextRequestMiddlewareType = Callable[
- ["Bot", TelegramMethod[TelegramType]], Awaitable[Response[TelegramType]]
-]
-RequestMiddlewareType = Union[
- "BaseRequestMiddleware",
- Callable[
- [NextRequestMiddlewareType[TelegramType], "Bot", TelegramMethod[TelegramType]],
- Awaitable[Response[TelegramType]],
- ],
-]
+
+class NextRequestMiddlewareType(Protocol[TelegramType]): # pragma: no cover
+ async def __call__(
+ self,
+ bot: "Bot",
+ method: TelegramMethod[TelegramType],
+ ) -> Response[TelegramType]:
+ pass
+
+
+class RequestMiddlewareType(Protocol): # pragma: no cover
+ async def __call__(
+ self,
+ make_request: NextRequestMiddlewareType[TelegramType],
+ bot: "Bot",
+ method: TelegramMethod[TelegramType],
+ ) -> Response[TelegramType]:
+ pass
class BaseRequestMiddleware(ABC):
diff --git a/aiogram/client/session/middlewares/manager.py b/aiogram/client/session/middlewares/manager.py
index 0e76801e..78015309 100644
--- a/aiogram/client/session/middlewares/manager.py
+++ b/aiogram/client/session/middlewares/manager.py
@@ -1,68 +1,48 @@
from __future__ import annotations
from functools import partial
-from typing import (
- TYPE_CHECKING,
- Any,
- Awaitable,
- Callable,
- List,
- Optional,
- Sequence,
- Union,
- overload,
-)
+from typing import Any, Callable, List, Optional, Sequence, Union, cast, overload
from aiogram.client.session.middlewares.base import (
NextRequestMiddlewareType,
RequestMiddlewareType,
)
-from aiogram.methods import Response
-from aiogram.methods.base import TelegramMethod, TelegramType
-from aiogram.types import TelegramObject
-
-if TYPE_CHECKING:
- from aiogram import Bot
+from aiogram.methods.base import TelegramType
-class RequestMiddlewareManager(Sequence[RequestMiddlewareType[TelegramObject]]):
+class RequestMiddlewareManager(Sequence[RequestMiddlewareType]):
def __init__(self) -> None:
- self._middlewares: List[RequestMiddlewareType[TelegramObject]] = []
+ self._middlewares: List[RequestMiddlewareType] = []
def register(
self,
- middleware: RequestMiddlewareType[TelegramObject],
- ) -> RequestMiddlewareType[TelegramObject]:
+ middleware: RequestMiddlewareType,
+ ) -> RequestMiddlewareType:
self._middlewares.append(middleware)
return middleware
- def unregister(self, middleware: RequestMiddlewareType[TelegramObject]) -> None:
+ def unregister(self, middleware: RequestMiddlewareType) -> None:
self._middlewares.remove(middleware)
def __call__(
self,
- middleware: Optional[RequestMiddlewareType[TelegramObject]] = None,
- ) -> Union[
- Callable[[RequestMiddlewareType[TelegramObject]], RequestMiddlewareType[TelegramObject]],
- RequestMiddlewareType[TelegramObject],
- ]:
+ middleware: Optional[RequestMiddlewareType] = None,
+ ) -> Union[Callable[[RequestMiddlewareType], RequestMiddlewareType], RequestMiddlewareType,]:
if middleware is None:
return self.register
return self.register(middleware)
@overload
- def __getitem__(self, item: int) -> RequestMiddlewareType[TelegramObject]:
+ def __getitem__(self, item: int) -> RequestMiddlewareType:
pass
@overload
- def __getitem__(self, item: slice) -> Sequence[RequestMiddlewareType[TelegramObject]]:
+ def __getitem__(self, item: slice) -> Sequence[RequestMiddlewareType]:
pass
def __getitem__(
self, item: Union[int, slice]
- ) -> Union[
- RequestMiddlewareType[TelegramObject], Sequence[RequestMiddlewareType[TelegramObject]]
- ]:
+ ) -> Union[RequestMiddlewareType, Sequence[RequestMiddlewareType]]:
return self._middlewares[item]
def __len__(self) -> int:
@@ -70,10 +50,10 @@ class RequestMiddlewareManager(Sequence[RequestMiddlewareType[TelegramObject]]):
def wrap_middlewares(
self,
- callback: Callable[[Bot, TelegramMethod[TelegramType]], Awaitable[Response[TelegramType]]],
+ callback: NextRequestMiddlewareType[TelegramType],
**kwargs: Any,
) -> NextRequestMiddlewareType[TelegramType]:
middleware = partial(callback, **kwargs)
for m in reversed(self._middlewares):
- middleware = partial(m, middleware) # type: ignore
- return middleware
+ middleware = partial(m, middleware)
+ return cast(NextRequestMiddlewareType[TelegramType], middleware)
diff --git a/aiogram/dispatcher/dispatcher.py b/aiogram/dispatcher/dispatcher.py
index 9c61a447..e3eb654a 100644
--- a/aiogram/dispatcher/dispatcher.py
+++ b/aiogram/dispatcher/dispatcher.py
@@ -6,7 +6,7 @@ import signal
import warnings
from asyncio import CancelledError, Event, Future, Lock
from contextlib import suppress
-from typing import Any, AsyncGenerator, Dict, List, Optional, Union
+from typing import Any, AsyncGenerator, Dict, List, Optional, Set, Union
from .. import loggers
from ..client.bot import Bot
@@ -18,6 +18,7 @@ from ..fsm.strategy import FSMStrategy
from ..methods import GetUpdates, TelegramMethod
from ..methods.base import TelegramType
from ..types import Update, User
+from ..types.base import UNSET, UNSET_TYPE
from ..types.update import UpdateTypeLookupError
from ..utils.backoff import Backoff, BackoffConfig
from .event.bases import UNHANDLED, SkipHandler
@@ -94,6 +95,7 @@ class Dispatcher(Router):
self._running_lock = Lock()
self._stop_signal: Optional[Event] = None
self._stopped_signal: Optional[Event] = None
+ self._handle_update_tasks: Set[asyncio.Task[Any]] = set()
def __getitem__(self, item: str) -> Any:
return self.workflow_data[item]
@@ -142,7 +144,16 @@ class Dispatcher(Router):
handled = False
start_time = loop.time()
- token = Bot.set_current(bot)
+ if update.bot != bot:
+ # Re-mounting update to the current bot instance for making possible to
+ # use it in shortcuts.
+ # Here is update is re-created because we need to propagate context to
+ # all nested objects and attributes of the Update, but it
+ # is impossible without roundtrip to JSON :(
+ # The preferred way is that pass already mounted Bot instance to this update
+ # before call feed_update method
+ update = Update.model_validate(update.model_dump(), context={"bot": bot})
+
try:
response = await self.update.wrap_outer_middleware(
self.update.trigger,
@@ -165,7 +176,6 @@ class Dispatcher(Router):
duration,
bot.id,
)
- Bot.reset_current(token)
async def feed_raw_update(self, bot: Bot, update: Dict[str, Any], **kwargs: Any) -> Any:
"""
@@ -175,7 +185,7 @@ class Dispatcher(Router):
:param update:
:param kwargs:
"""
- parsed_update = Update(**update)
+ parsed_update = Update.model_validate(update, context={"bot": bot})
return await self.feed_update(bot=bot, update=parsed_update, **kwargs)
@classmethod
@@ -255,7 +265,8 @@ class Dispatcher(Router):
warnings.warn(
"Detected unknown update type.\n"
"Seems like Telegram Bot API was updated and you have "
- "installed not latest version of aiogram framework",
+ "installed not latest version of aiogram framework"
+ f"\nUpdate: {update.model_dump_json(exclude_unset=True)}",
RuntimeWarning,
)
raise SkipHandler() from e
@@ -339,7 +350,9 @@ class Dispatcher(Router):
):
handle_update = self._process_update(bot=bot, update=update, **kwargs)
if handle_as_tasks:
- asyncio.create_task(handle_update)
+ handle_update_task = asyncio.create_task(handle_update)
+ self._handle_update_tasks.add(handle_update_task)
+ handle_update_task.add_done_callback(self._handle_update_tasks.discard)
else:
await handle_update
finally:
@@ -367,7 +380,7 @@ class Dispatcher(Router):
self, bot: Bot, update: Union[Update, Dict[str, Any]], _timeout: float = 55, **kwargs: Any
) -> Optional[TelegramMethod[TelegramType]]:
if not isinstance(update, Update): # Allow to use raw updates
- update = Update(**update)
+ update = Update.model_validate(update, context={"bot": bot})
ctx = contextvars.copy_context()
loop = asyncio.get_running_loop()
@@ -450,7 +463,7 @@ class Dispatcher(Router):
polling_timeout: int = 10,
handle_as_tasks: bool = True,
backoff_config: BackoffConfig = DEFAULT_BACKOFF_CONFIG,
- allowed_updates: Optional[List[str]] = None,
+ allowed_updates: Optional[Union[List[str], UNSET_TYPE]] = UNSET,
handle_signals: bool = True,
close_bot_session: bool = True,
**kwargs: Any,
@@ -458,11 +471,12 @@ class Dispatcher(Router):
"""
Polling runner
- :param bots: Bot instances (one or mre)
+ :param bots: Bot instances (one or more)
:param polling_timeout: Long-polling wait time
:param handle_as_tasks: Run task for each event and no wait result
:param backoff_config: backoff-retry config
:param allowed_updates: List of the update types you want your bot to receive
+ By default, all used update types are enabled (resolved from handlers)
:param handle_signals: handle signals (SIGINT/SIGTERM)
:param close_bot_session: close bot sessions on shutdown
:param kwargs: contextual data
@@ -482,6 +496,9 @@ class Dispatcher(Router):
if self._stopped_signal is None:
self._stopped_signal = Event()
+ if allowed_updates is UNSET:
+ allowed_updates = self.resolve_used_update_types()
+
self._stop_signal.clear()
self._stopped_signal.clear()
@@ -500,11 +517,13 @@ class Dispatcher(Router):
workflow_data = {
"dispatcher": self,
"bots": bots,
- "bot": bots[-1],
- **kwargs,
**self.workflow_data,
+ **kwargs,
}
- await self.emit_startup(**workflow_data)
+ if "bot" in workflow_data:
+ workflow_data.pop("bot")
+
+ await self.emit_startup(bot=bots[-1], **workflow_data)
loggers.dispatcher.info("Start polling")
try:
tasks: List[asyncio.Task[Any]] = [
@@ -515,7 +534,7 @@ class Dispatcher(Router):
polling_timeout=polling_timeout,
backoff_config=backoff_config,
allowed_updates=allowed_updates,
- **kwargs,
+ **workflow_data,
)
)
for bot in bots
@@ -534,7 +553,7 @@ class Dispatcher(Router):
finally:
loggers.dispatcher.info("Polling stopped")
try:
- await self.emit_shutdown(**workflow_data)
+ await self.emit_shutdown(bot=bots[-1], **workflow_data)
finally:
if close_bot_session:
await asyncio.gather(*(bot.session.close() for bot in bots))
@@ -546,7 +565,7 @@ class Dispatcher(Router):
polling_timeout: int = 10,
handle_as_tasks: bool = True,
backoff_config: BackoffConfig = DEFAULT_BACKOFF_CONFIG,
- allowed_updates: Optional[List[str]] = None,
+ allowed_updates: Optional[Union[List[str], UNSET_TYPE]] = UNSET,
handle_signals: bool = True,
close_bot_session: bool = True,
**kwargs: Any,
diff --git a/aiogram/dispatcher/event/handler.py b/aiogram/dispatcher/event/handler.py
index 2b71eed5..1045e667 100644
--- a/aiogram/dispatcher/event/handler.py
+++ b/aiogram/dispatcher/event/handler.py
@@ -4,7 +4,7 @@ import inspect
import warnings
from dataclasses import dataclass, field
from functools import partial
-from typing import Any, Callable, Dict, List, Optional, Tuple
+from typing import Any, Callable, Dict, List, Optional, Tuple, Set
from magic_filter.magic import MagicFilter as OriginalMagicFilter
@@ -21,20 +21,21 @@ CallbackType = Callable[..., Any]
class CallableMixin:
callback: CallbackType
awaitable: bool = field(init=False)
- spec: inspect.FullArgSpec = field(init=False)
+ params: Set[str] = field(init=False)
+ varkw: bool = field(init=False)
def __post_init__(self) -> None:
callback = inspect.unwrap(self.callback)
self.awaitable = inspect.isawaitable(callback) or inspect.iscoroutinefunction(callback)
- self.spec = inspect.getfullargspec(callback)
+ spec = inspect.getfullargspec(callback)
+ self.params = {*spec.args, *spec.kwonlyargs}
+ self.varkw = spec.varkw is not None
def _prepare_kwargs(self, kwargs: Dict[str, Any]) -> Dict[str, Any]:
- if self.spec.varkw:
+ if self.varkw:
return kwargs
- return {
- k: v for k, v in kwargs.items() if k in self.spec.args or k in self.spec.kwonlyargs
- }
+ return {k: kwargs[k] for k in self.params if k in kwargs}
async def call(self, *args: Any, **kwargs: Any) -> Any:
wrapped = partial(self.callback, *args, **self._prepare_kwargs(kwargs))
diff --git a/aiogram/dispatcher/event/telegram.py b/aiogram/dispatcher/event/telegram.py
index a468816c..afa8938e 100644
--- a/aiogram/dispatcher/event/telegram.py
+++ b/aiogram/dispatcher/event/telegram.py
@@ -40,7 +40,6 @@ class TelegramEventObserver:
Register filter for all handlers of this event observer
:param filters: positional filters
- :param bound_filters: keyword filters
"""
if self._handler.filters is None:
self._handler.filters = []
@@ -101,21 +100,19 @@ class TelegramEventObserver:
)
return wrapped_outer(event, data)
+ def check_root_filters(self, event: TelegramObject, **kwargs: Any) -> Any:
+ return self._handler.check(event, **kwargs)
+
async def trigger(self, event: TelegramObject, **kwargs: Any) -> Any:
"""
Propagate event to handlers and stops propagation on first match.
- Handler will be called when all its filters is pass.
+ Handler will be called when all its filters are pass.
"""
- # Check globally defined filters before any other handler will be checked
- result, data = await self._handler.check(event, **kwargs)
- if not result:
- return REJECTED
- kwargs.update(data)
-
for handler in self.handlers:
+ kwargs["handler"] = handler
result, data = await handler.check(event, **kwargs)
if result:
- kwargs.update(data, handler=handler)
+ kwargs.update(data)
try:
wrapped_inner = self.outer_middleware.wrap_middlewares(
self._resolve_middlewares(),
diff --git a/aiogram/dispatcher/middlewares/user_context.py b/aiogram/dispatcher/middlewares/user_context.py
index 9ede4334..12bb4864 100644
--- a/aiogram/dispatcher/middlewares/user_context.py
+++ b/aiogram/dispatcher/middlewares/user_context.py
@@ -1,5 +1,4 @@
-from contextlib import contextmanager
-from typing import Any, Awaitable, Callable, Dict, Iterator, Optional, Tuple
+from typing import Any, Awaitable, Callable, Dict, Optional, Tuple
from aiogram.dispatcher.middlewares.base import BaseMiddleware
from aiogram.types import Chat, TelegramObject, Update, User
diff --git a/aiogram/dispatcher/router.py b/aiogram/dispatcher/router.py
index 85c41ae8..4dd4284f 100644
--- a/aiogram/dispatcher/router.py
+++ b/aiogram/dispatcher/router.py
@@ -53,7 +53,7 @@ class Router:
self.chat_member = TelegramEventObserver(router=self, event_name="chat_member")
self.chat_join_request = TelegramEventObserver(router=self, event_name="chat_join_request")
- self.errors = TelegramEventObserver(router=self, event_name="error")
+ self.errors = self.error = TelegramEventObserver(router=self, event_name="error")
self.startup = EventObserver()
self.shutdown = EventObserver()
@@ -125,8 +125,17 @@ class Router:
) -> Any:
response = UNHANDLED
if observer:
+ # Check globally defined filters before any other handler will be checked.
+ # This check is placed here instead of `trigger` method to add possibility
+ # to pass context to handlers from global filters.
+ result, data = await observer.check_root_filters(event, **kwargs)
+ if not result:
+ return UNHANDLED
+ kwargs.update(data)
+
response = await observer.trigger(event, **kwargs)
- if response is REJECTED:
+ if response is REJECTED: # pragma: no cover
+ # Possible only if some handler returns REJECTED
return UNHANDLED
if response is not UNHANDLED:
return response
@@ -184,6 +193,12 @@ class Router:
router.sub_routers.append(self)
def include_routers(self, *routers: Router) -> None:
+ """
+ Attach multiple routers.
+
+ :param routers:
+ :return:
+ """
if not routers:
raise ValueError("At least one router must be provided")
for router in routers:
diff --git a/aiogram/enums/__init__.py b/aiogram/enums/__init__.py
index 73422378..a999001c 100644
--- a/aiogram/enums/__init__.py
+++ b/aiogram/enums/__init__.py
@@ -3,13 +3,16 @@ from .chat_action import ChatAction
from .chat_member_status import ChatMemberStatus
from .chat_type import ChatType
from .content_type import ContentType
+from .currency import Currency
from .dice_emoji import DiceEmoji
+from .encrypted_passport_element import EncryptedPassportElement
from .inline_query_result_type import InlineQueryResultType
from .input_media_type import InputMediaType
from .mask_position_point import MaskPositionPoint
from .menu_button_type import MenuButtonType
from .message_entity_type import MessageEntityType
from .parse_mode import ParseMode
+from .passport_element_error_type import PassportElementErrorType
from .poll_type import PollType
from .sticker_format import StickerFormat
from .sticker_type import StickerType
@@ -22,13 +25,16 @@ __all__ = (
"ChatMemberStatus",
"ChatType",
"ContentType",
+ "Currency",
"DiceEmoji",
+ "EncryptedPassportElement",
"InlineQueryResultType",
"InputMediaType",
"MaskPositionPoint",
"MenuButtonType",
"MessageEntityType",
"ParseMode",
+ "PassportElementErrorType",
"PollType",
"StickerFormat",
"StickerType",
diff --git a/aiogram/enums/content_type.py b/aiogram/enums/content_type.py
index 52a9bfed..d34d878e 100644
--- a/aiogram/enums/content_type.py
+++ b/aiogram/enums/content_type.py
@@ -14,6 +14,7 @@ class ContentType(str, Enum):
DOCUMENT = "document"
PHOTO = "photo"
STICKER = "sticker"
+ STORY = "story"
VIDEO = "video"
VIDEO_NOTE = "video_note"
VOICE = "voice"
diff --git a/aiogram/enums/currency.py b/aiogram/enums/currency.py
new file mode 100644
index 00000000..563651b7
--- /dev/null
+++ b/aiogram/enums/currency.py
@@ -0,0 +1,96 @@
+from enum import Enum
+
+
+class Currency(str, Enum):
+ """
+ Currencies supported by Telegram Bot API
+
+ Source: https://core.telegram.org/bots/payments#supported-currencies
+ """
+
+ AED = "AED"
+ AFN = "AFN"
+ ALL = "ALL"
+ AMD = "AMD"
+ ARS = "ARS"
+ AUD = "AUD"
+ AZN = "AZN"
+ BAM = "BAM"
+ BDT = "BDT"
+ BGN = "BGN"
+ BND = "BND"
+ BOB = "BOB"
+ BRL = "BRL"
+ BYN = "BYN"
+ CAD = "CAD"
+ CHF = "CHF"
+ CLP = "CLP"
+ CNY = "CNY"
+ COP = "COP"
+ CRC = "CRC"
+ CZK = "CZK"
+ DKK = "DKK"
+ DOP = "DOP"
+ DZD = "DZD"
+ EGP = "EGP"
+ ETB = "ETB"
+ EUR = "EUR"
+ GBP = "GBP"
+ GEL = "GEL"
+ GTQ = "GTQ"
+ HKD = "HKD"
+ HNL = "HNL"
+ HRK = "HRK"
+ HUF = "HUF"
+ IDR = "IDR"
+ ILS = "ILS"
+ INR = "INR"
+ ISK = "ISK"
+ JMD = "JMD"
+ JPY = "JPY"
+ KES = "KES"
+ KGS = "KGS"
+ KRW = "KRW"
+ KZT = "KZT"
+ LBP = "LBP"
+ LKR = "LKR"
+ MAD = "MAD"
+ MDL = "MDL"
+ MNT = "MNT"
+ MUR = "MUR"
+ MVR = "MVR"
+ MXN = "MXN"
+ MYR = "MYR"
+ MZN = "MZN"
+ NGN = "NGN"
+ NIO = "NIO"
+ NOK = "NOK"
+ NPR = "NPR"
+ NZD = "NZD"
+ PAB = "PAB"
+ PEN = "PEN"
+ PHP = "PHP"
+ PKR = "PKR"
+ PLN = "PLN"
+ PYG = "PYG"
+ QAR = "QAR"
+ RON = "RON"
+ RSD = "RSD"
+ RUB = "RUB"
+ SAR = "SAR"
+ SEK = "SEK"
+ SGD = "SGD"
+ THB = "THB"
+ TJS = "TJS"
+ TRY = "TRY"
+ TTD = "TTD"
+ TWD = "TWD"
+ TZS = "TZS"
+ UAH = "UAH"
+ UGX = "UGX"
+ USD = "USD"
+ UYU = "UYU"
+ UZS = "UZS"
+ VND = "VND"
+ YER = "YER"
+ ZAR = "ZAR"
diff --git a/aiogram/enums/encrypted_passport_element.py b/aiogram/enums/encrypted_passport_element.py
new file mode 100644
index 00000000..ebb4b2e6
--- /dev/null
+++ b/aiogram/enums/encrypted_passport_element.py
@@ -0,0 +1,23 @@
+from enum import Enum
+
+
+class EncryptedPassportElement(str, Enum):
+ """
+ This object represents type of encrypted passport element.
+
+ Source: https://core.telegram.org/bots/api#encryptedpassportelement
+ """
+
+ PERSONAL_DETAILS = "personal_details"
+ PASSPORT = "passport"
+ DRIVER_LICENSE = "driver_license"
+ IDENTITY_CARD = "identity_card"
+ INTERNAL_PASSPORT = "internal_passport"
+ ADDRESS = "address"
+ UTILITY_BILL = "utility_bill"
+ BANK_STATEMENT = "bank_statement"
+ RENTAL_AGREEMENT = "rental_agreement"
+ PASSPORT_REGISTRATION = "passport_registration"
+ TEMPORARY_REGISTRATION = "temporary_registration"
+ PHONE_NUMBER = "phone_number"
+ EMAIL = "email"
diff --git a/aiogram/enums/passport_element_error_type.py b/aiogram/enums/passport_element_error_type.py
new file mode 100644
index 00000000..cdcb4806
--- /dev/null
+++ b/aiogram/enums/passport_element_error_type.py
@@ -0,0 +1,19 @@
+from enum import Enum
+
+
+class PassportElementErrorType(str, Enum):
+ """
+ This object represents a passport element error type.
+
+ Source: https://core.telegram.org/bots/api#passportelementerror
+ """
+
+ DATA = "data"
+ FRONT_SIDE = "front_side"
+ REVERSE_SIDE = "reverse_side"
+ SELFIE = "selfie"
+ FILE = "file"
+ FILES = "files"
+ TRANSLATION_FILE = "translation_file"
+ TRANSLATION_FILES = "translation_files"
+ UNSPECIFIED = "unspecified"
diff --git a/aiogram/exceptions.py b/aiogram/exceptions.py
index 1c1e59fb..2632fcdc 100644
--- a/aiogram/exceptions.py
+++ b/aiogram/exceptions.py
@@ -6,10 +6,16 @@ from aiogram.utils.link import docs_url
class AiogramError(Exception):
- pass
+ """
+ Base exception for all aiogram errors.
+ """
class DetailedAiogramError(AiogramError):
+ """
+ Base exception for all aiogram errors with detailed message.
+ """
+
url: Optional[str] = None
def __init__(self, message: str) -> None:
@@ -26,14 +32,26 @@ class DetailedAiogramError(AiogramError):
class CallbackAnswerException(AiogramError):
- pass
+ """
+ Exception for callback answer.
+ """
class UnsupportedKeywordArgument(DetailedAiogramError):
+ """
+ Exception raised when a keyword argument is passed as filter.
+ """
+
url = docs_url("migration_2_to_3.html", fragment_="filtering-events")
class TelegramAPIError(DetailedAiogramError):
+ """
+ Base exception for all Telegram API errors.
+ """
+
+ label: str = "Telegram server says"
+
def __init__(
self,
method: TelegramMethod[TelegramType],
@@ -44,14 +62,22 @@ class TelegramAPIError(DetailedAiogramError):
def __str__(self) -> str:
original_message = super().__str__()
- return f"Telegram server says {original_message}"
+ return f"{self.label} - {original_message}"
class TelegramNetworkError(TelegramAPIError):
- pass
+ """
+ Base exception for all Telegram network errors.
+ """
+
+ label = "HTTP Client says"
class TelegramRetryAfter(TelegramAPIError):
+ """
+ Exception raised when flood control exceeds.
+ """
+
url = "https://core.telegram.org/bots/faq#my-bot-is-hitting-limits-how-do-i-avoid-this"
def __init__(
@@ -71,6 +97,10 @@ class TelegramRetryAfter(TelegramAPIError):
class TelegramMigrateToChat(TelegramAPIError):
+ """
+ Exception raised when chat has been migrated to a supergroup.
+ """
+
url = "https://core.telegram.org/bots/api#responseparameters"
def __init__(
@@ -88,38 +118,66 @@ class TelegramMigrateToChat(TelegramAPIError):
class TelegramBadRequest(TelegramAPIError):
- pass
+ """
+ Exception raised when request is malformed.
+ """
class TelegramNotFound(TelegramAPIError):
- pass
+ """
+ Exception raised when chat, message, user, etc. not found.
+ """
class TelegramConflictError(TelegramAPIError):
- pass
+ """
+ Exception raised when bot token is already used by another application in polling mode.
+ """
class TelegramUnauthorizedError(TelegramAPIError):
- pass
+ """
+ Exception raised when bot token is invalid.
+ """
class TelegramForbiddenError(TelegramAPIError):
- pass
+ """
+ Exception raised when bot is kicked from chat or etc.
+ """
class TelegramServerError(TelegramAPIError):
- pass
+ """
+ Exception raised when Telegram server returns 5xx error.
+ """
class RestartingTelegram(TelegramServerError):
- pass
+ """
+ Exception raised when Telegram server is restarting.
+
+ It seems like this error is not used by Telegram anymore,
+ but it's still here for backward compatibility.
+
+ Currently, you should expect that Telegram can raise RetryAfter (with timeout 5 seconds)
+ error instead of this one.
+ """
class TelegramEntityTooLarge(TelegramNetworkError):
+ """
+ Exception raised when you are trying to send a file that is too large.
+ """
+
url = "https://core.telegram.org/bots/api#sending-files"
class ClientDecodeError(AiogramError):
+ """
+ Exception raised when client can't decode response. (Malformed response, etc.)
+ """
+
def __init__(self, message: str, original: Exception, data: Any) -> None:
self.message = message
self.original = original
diff --git a/aiogram/filters/callback_data.py b/aiogram/filters/callback_data.py
index 05d7783d..7a09dedb 100644
--- a/aiogram/filters/callback_data.py
+++ b/aiogram/filters/callback_data.py
@@ -85,7 +85,7 @@ class CallbackData(BaseModel):
:return: valid callback data for Telegram Bot API
"""
result = [self.__prefix__]
- for key, value in self.dict().items():
+ for key, value in self.model_dump(mode="json").items():
encoded = self._encode_value(key, value)
if self.__separator__ in encoded:
raise ValueError(
@@ -110,7 +110,7 @@ class CallbackData(BaseModel):
:return: instance of CallbackData
"""
prefix, *parts = value.split(cls.__separator__)
- names = cls.__fields__.keys()
+ names = cls.model_fields.keys()
if len(parts) != len(names):
raise TypeError(
f"Callback data {cls.__name__!r} takes {len(names)} arguments "
@@ -120,8 +120,8 @@ class CallbackData(BaseModel):
raise ValueError(f"Bad prefix ({prefix!r} != {cls.__prefix__!r})")
payload = {}
for k, v in zip(names, parts): # type: str, Optional[str]
- if field := cls.__fields__.get(k):
- if v == "" and not field.required:
+ if field := cls.model_fields.get(k):
+ if v == "" and not field.is_required():
v = None
payload[k] = v
return cls(**payload)
diff --git a/aiogram/filters/chat_member_updated.py b/aiogram/filters/chat_member_updated.py
index 7671ba4e..23cf0e9c 100644
--- a/aiogram/filters/chat_member_updated.py
+++ b/aiogram/filters/chat_member_updated.py
@@ -74,9 +74,12 @@ class _MemberStatusMarker:
return hash((self.name, self.is_member))
def check(self, *, member: ChatMember) -> bool:
- if self.is_member is not None and member.is_member != self.is_member:
+ # Not all member types have `is_member` attribute
+ is_member = getattr(member, "is_member", None)
+ status = getattr(member, "status", None)
+ if self.is_member is not None and is_member != self.is_member:
return False
- return self.name == member.status
+ return self.name == status
class _MemberStatusGroupMarker:
diff --git a/aiogram/filters/command.py b/aiogram/filters/command.py
index 85ff4de6..6e654531 100644
--- a/aiogram/filters/command.py
+++ b/aiogram/filters/command.py
@@ -191,7 +191,7 @@ class Command(Filter):
return command # noqa: RET504
def do_magic(self, command: CommandObject) -> Any:
- if not self.magic:
+ if self.magic is None:
return command
result = self.magic.resolve(command)
if not result:
diff --git a/aiogram/filters/state.py b/aiogram/filters/state.py
index 5ad65ae5..82a141c9 100644
--- a/aiogram/filters/state.py
+++ b/aiogram/filters/state.py
@@ -27,7 +27,7 @@ class StateFilter(Filter):
)
async def __call__(
- self, obj: Union[TelegramObject], raw_state: Optional[str] = None
+ self, obj: TelegramObject, raw_state: Optional[str] = None
) -> Union[bool, Dict[str, Any]]:
allowed_states = cast(Sequence[StateType], self.states)
for allowed_state in allowed_states:
diff --git a/aiogram/fsm/middleware.py b/aiogram/fsm/middleware.py
index 6de91a83..d1f1d973 100644
--- a/aiogram/fsm/middleware.py
+++ b/aiogram/fsm/middleware.py
@@ -34,8 +34,10 @@ class FSMContextMiddleware(BaseMiddleware):
context = self.resolve_event_context(bot, data)
data["fsm_storage"] = self.storage
if context:
- data.update({"state": context, "raw_state": await context.get_state()})
+ # Bugfix: https://github.com/aiogram/aiogram/issues/1317
+ # State should be loaded after lock is acquired
async with self.events_isolation.lock(key=context.key):
+ data.update({"state": context, "raw_state": await context.get_state()})
return await handler(event, data)
return await handler(event, data)
diff --git a/aiogram/fsm/storage/redis.py b/aiogram/fsm/storage/redis.py
index 6a55d881..33e44be4 100644
--- a/aiogram/fsm/storage/redis.py
+++ b/aiogram/fsm/storage/redis.py
@@ -138,7 +138,7 @@ class RedisStorage(BaseStorage):
return RedisEventIsolation(redis=self.redis, key_builder=self.key_builder, **kwargs)
async def close(self) -> None:
- await self.redis.close()
+ await self.redis.aclose(close_connection_pool=True)
async def set_state(
self,
diff --git a/aiogram/fsm/strategy.py b/aiogram/fsm/strategy.py
index 227924cb..f68aa045 100644
--- a/aiogram/fsm/strategy.py
+++ b/aiogram/fsm/strategy.py
@@ -6,7 +6,8 @@ class FSMStrategy(Enum):
USER_IN_CHAT = auto()
CHAT = auto()
GLOBAL_USER = auto()
- USER_IN_THREAD = auto()
+ USER_IN_TOPIC = auto()
+ CHAT_TOPIC = auto()
def apply_strategy(
@@ -19,6 +20,9 @@ def apply_strategy(
return chat_id, chat_id, None
if strategy == FSMStrategy.GLOBAL_USER:
return user_id, user_id, None
- if strategy == FSMStrategy.USER_IN_THREAD:
+ if strategy == FSMStrategy.USER_IN_TOPIC:
return chat_id, user_id, thread_id
+ if strategy == FSMStrategy.CHAT_TOPIC:
+ return chat_id, chat_id, thread_id
+
return chat_id, user_id, None
diff --git a/aiogram/handlers/base.py b/aiogram/handlers/base.py
index 076016fa..0eb1b420 100644
--- a/aiogram/handlers/base.py
+++ b/aiogram/handlers/base.py
@@ -32,7 +32,7 @@ class BaseHandler(BaseHandlerMixin[T], ABC):
if "bot" in self.data:
return cast(Bot, self.data["bot"])
- return Bot.get_current(no_error=False)
+ raise RuntimeError("Bot instance not found in the context")
@property
def update(self) -> Update:
diff --git a/aiogram/methods/__init__.py b/aiogram/methods/__init__.py
index fd887d7e..32909f4a 100644
--- a/aiogram/methods/__init__.py
+++ b/aiogram/methods/__init__.py
@@ -110,6 +110,7 @@ from .unban_chat_sender_chat import UnbanChatSenderChat
from .unhide_general_forum_topic import UnhideGeneralForumTopic
from .unpin_all_chat_messages import UnpinAllChatMessages
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
@@ -228,6 +229,7 @@ __all__ = (
"UnhideGeneralForumTopic",
"UnpinAllChatMessages",
"UnpinAllForumTopicMessages",
+ "UnpinAllGeneralForumTopicMessages",
"UnpinChatMessage",
"UploadStickerFile",
)
diff --git a/aiogram/methods/add_sticker_to_set.py b/aiogram/methods/add_sticker_to_set.py
index 49759b84..b9ec036e 100644
--- a/aiogram/methods/add_sticker_to_set.py
+++ b/aiogram/methods/add_sticker_to_set.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING
+from typing import TYPE_CHECKING, Any
from ..types import InputSticker
from .base import TelegramMethod
@@ -22,3 +22,21 @@ class AddStickerToSet(TelegramMethod[bool]):
"""Sticker set name"""
sticker: InputSticker
"""A JSON-serialized object with information about the added sticker. If exactly the same sticker had already been added to the set, then the set isn't changed."""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ user_id: int,
+ name: str,
+ sticker: InputSticker,
+ **__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, name=name, sticker=sticker, **__pydantic_kwargs)
diff --git a/aiogram/methods/answer_callback_query.py b/aiogram/methods/answer_callback_query.py
index 4b3e16fd..15ed1bf5 100644
--- a/aiogram/methods/answer_callback_query.py
+++ b/aiogram/methods/answer_callback_query.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Optional
+from typing import TYPE_CHECKING, Any, Optional
from .base import TelegramMethod
@@ -27,3 +27,30 @@ class AnswerCallbackQuery(TelegramMethod[bool]):
"""URL that will be opened by the user's client. If you have created a :class:`aiogram.types.game.Game` and accepted the conditions via `@BotFather `_, specify the URL that opens your game - note that this will only work if the query comes from a `https://core.telegram.org/bots/api#inlinekeyboardbutton `_ *callback_game* button."""
cache_time: Optional[int] = None
"""The maximum amount of time in seconds that the result of the callback query may be cached client-side. Telegram apps will support caching starting in version 3.14. Defaults to 0."""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ callback_query_id: str,
+ text: Optional[str] = None,
+ show_alert: Optional[bool] = None,
+ url: Optional[str] = None,
+ cache_time: 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__(
+ callback_query_id=callback_query_id,
+ text=text,
+ show_alert=show_alert,
+ url=url,
+ cache_time=cache_time,
+ **__pydantic_kwargs,
+ )
diff --git a/aiogram/methods/answer_inline_query.py b/aiogram/methods/answer_inline_query.py
index 7b6b6d88..acfb80ab 100644
--- a/aiogram/methods/answer_inline_query.py
+++ b/aiogram/methods/answer_inline_query.py
@@ -1,10 +1,32 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, List, Optional
+from typing import TYPE_CHECKING, Any, List, Optional, Union
from pydantic import Field
-from ..types import InlineQueryResult, InlineQueryResultsButton
+from ..types import (
+ InlineQueryResultArticle,
+ InlineQueryResultAudio,
+ InlineQueryResultCachedAudio,
+ InlineQueryResultCachedDocument,
+ InlineQueryResultCachedGif,
+ InlineQueryResultCachedMpeg4Gif,
+ InlineQueryResultCachedPhoto,
+ InlineQueryResultCachedSticker,
+ InlineQueryResultCachedVideo,
+ InlineQueryResultCachedVoice,
+ InlineQueryResultContact,
+ InlineQueryResultDocument,
+ InlineQueryResultGame,
+ InlineQueryResultGif,
+ InlineQueryResultLocation,
+ InlineQueryResultMpeg4Gif,
+ InlineQueryResultPhoto,
+ InlineQueryResultsButton,
+ InlineQueryResultVenue,
+ InlineQueryResultVideo,
+ InlineQueryResultVoice,
+)
from .base import TelegramMethod
@@ -22,7 +44,30 @@ class AnswerInlineQuery(TelegramMethod[bool]):
inline_query_id: str
"""Unique identifier for the answered query"""
- results: List[InlineQueryResult]
+ results: List[
+ Union[
+ InlineQueryResultCachedAudio,
+ InlineQueryResultCachedDocument,
+ InlineQueryResultCachedGif,
+ InlineQueryResultCachedMpeg4Gif,
+ InlineQueryResultCachedPhoto,
+ InlineQueryResultCachedSticker,
+ InlineQueryResultCachedVideo,
+ InlineQueryResultCachedVoice,
+ InlineQueryResultArticle,
+ InlineQueryResultAudio,
+ InlineQueryResultContact,
+ InlineQueryResultGame,
+ InlineQueryResultDocument,
+ InlineQueryResultGif,
+ InlineQueryResultLocation,
+ InlineQueryResultMpeg4Gif,
+ InlineQueryResultPhoto,
+ InlineQueryResultVenue,
+ InlineQueryResultVideo,
+ InlineQueryResultVoice,
+ ]
+ ]
"""A JSON-serialized array of results for the inline query"""
cache_time: Optional[int] = None
"""The maximum amount of time in seconds that the result of the inline query may be cached on the server. Defaults to 300."""
@@ -32,13 +77,69 @@ class AnswerInlineQuery(TelegramMethod[bool]):
"""Pass the offset that a client should send in the next query with the same text to receive more results. Pass an empty string if there are no more results or if you don't support pagination. Offset length can't exceed 64 bytes."""
button: Optional[InlineQueryResultsButton] = None
"""A JSON-serialized object describing a button to be shown above inline query results"""
- switch_pm_parameter: Optional[str] = Field(None, deprecated=True)
+ switch_pm_parameter: Optional[str] = Field(None, json_schema_extra={"deprecated": True})
"""`Deep-linking `_ parameter for the /start message sent to the bot when user presses the switch button. 1-64 characters, only :code:`A-Z`, :code:`a-z`, :code:`0-9`, :code:`_` and :code:`-` are allowed.
.. deprecated:: API:6.7
https://core.telegram.org/bots/api-changelog#april-21-2023"""
- switch_pm_text: Optional[str] = Field(None, deprecated=True)
+ switch_pm_text: Optional[str] = Field(None, json_schema_extra={"deprecated": True})
"""If passed, clients will display a button with specified text that switches the user to a private chat with the bot and sends the bot a start message with the parameter *switch_pm_parameter*
.. deprecated:: API:6.7
https://core.telegram.org/bots/api-changelog#april-21-2023"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ inline_query_id: str,
+ results: List[
+ Union[
+ InlineQueryResultCachedAudio,
+ InlineQueryResultCachedDocument,
+ InlineQueryResultCachedGif,
+ InlineQueryResultCachedMpeg4Gif,
+ InlineQueryResultCachedPhoto,
+ InlineQueryResultCachedSticker,
+ InlineQueryResultCachedVideo,
+ InlineQueryResultCachedVoice,
+ InlineQueryResultArticle,
+ InlineQueryResultAudio,
+ InlineQueryResultContact,
+ InlineQueryResultGame,
+ InlineQueryResultDocument,
+ InlineQueryResultGif,
+ InlineQueryResultLocation,
+ InlineQueryResultMpeg4Gif,
+ InlineQueryResultPhoto,
+ InlineQueryResultVenue,
+ InlineQueryResultVideo,
+ InlineQueryResultVoice,
+ ]
+ ],
+ cache_time: Optional[int] = None,
+ is_personal: Optional[bool] = None,
+ next_offset: Optional[str] = None,
+ button: Optional[InlineQueryResultsButton] = None,
+ switch_pm_parameter: Optional[str] = None,
+ switch_pm_text: 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__(
+ inline_query_id=inline_query_id,
+ results=results,
+ cache_time=cache_time,
+ is_personal=is_personal,
+ next_offset=next_offset,
+ button=button,
+ switch_pm_parameter=switch_pm_parameter,
+ switch_pm_text=switch_pm_text,
+ **__pydantic_kwargs,
+ )
diff --git a/aiogram/methods/answer_pre_checkout_query.py b/aiogram/methods/answer_pre_checkout_query.py
index a87929fb..479d76c9 100644
--- a/aiogram/methods/answer_pre_checkout_query.py
+++ b/aiogram/methods/answer_pre_checkout_query.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Optional
+from typing import TYPE_CHECKING, Any, Optional
from .base import TelegramMethod
@@ -21,3 +21,26 @@ class AnswerPreCheckoutQuery(TelegramMethod[bool]):
"""Specify :code:`True` if everything is alright (goods are available, etc.) and the bot is ready to proceed with the order. Use :code:`False` if there are any problems."""
error_message: Optional[str] = None
"""Required if *ok* is :code:`False`. Error message in human readable form that explains the reason for failure to proceed with the checkout (e.g. "Sorry, somebody just bought the last of our amazing black T-shirts while you were busy filling out your payment details. Please choose a different color or garment!"). Telegram will display this message to the user."""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ pre_checkout_query_id: str,
+ ok: bool,
+ error_message: 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__(
+ pre_checkout_query_id=pre_checkout_query_id,
+ ok=ok,
+ error_message=error_message,
+ **__pydantic_kwargs,
+ )
diff --git a/aiogram/methods/answer_shipping_query.py b/aiogram/methods/answer_shipping_query.py
index 4e62d0cb..ad0e9dc0 100644
--- a/aiogram/methods/answer_shipping_query.py
+++ b/aiogram/methods/answer_shipping_query.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, List, Optional
+from typing import TYPE_CHECKING, Any, List, Optional
from ..types import ShippingOption
from .base import TelegramMethod
@@ -24,3 +24,28 @@ class AnswerShippingQuery(TelegramMethod[bool]):
"""Required if *ok* is :code:`True`. A JSON-serialized array of available shipping options."""
error_message: Optional[str] = None
"""Required if *ok* is :code:`False`. Error message in human readable form that explains why it is impossible to complete the order (e.g. "Sorry, delivery to your desired address is unavailable'). Telegram will display this message to the user."""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ shipping_query_id: str,
+ ok: bool,
+ shipping_options: Optional[List[ShippingOption]] = None,
+ error_message: 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__(
+ shipping_query_id=shipping_query_id,
+ ok=ok,
+ shipping_options=shipping_options,
+ error_message=error_message,
+ **__pydantic_kwargs,
+ )
diff --git a/aiogram/methods/answer_web_app_query.py b/aiogram/methods/answer_web_app_query.py
index d45e249d..4dc87ebd 100644
--- a/aiogram/methods/answer_web_app_query.py
+++ b/aiogram/methods/answer_web_app_query.py
@@ -1,8 +1,30 @@
from __future__ import annotations
-from typing import TYPE_CHECKING
+from typing import TYPE_CHECKING, Any, Union
-from ..types import InlineQueryResult, SentWebAppMessage
+from ..types import (
+ InlineQueryResultArticle,
+ InlineQueryResultAudio,
+ InlineQueryResultCachedAudio,
+ InlineQueryResultCachedDocument,
+ InlineQueryResultCachedGif,
+ InlineQueryResultCachedMpeg4Gif,
+ InlineQueryResultCachedPhoto,
+ InlineQueryResultCachedSticker,
+ InlineQueryResultCachedVideo,
+ InlineQueryResultCachedVoice,
+ InlineQueryResultContact,
+ InlineQueryResultDocument,
+ InlineQueryResultGame,
+ InlineQueryResultGif,
+ InlineQueryResultLocation,
+ InlineQueryResultMpeg4Gif,
+ InlineQueryResultPhoto,
+ InlineQueryResultVenue,
+ InlineQueryResultVideo,
+ InlineQueryResultVoice,
+ SentWebAppMessage,
+)
from .base import TelegramMethod
@@ -18,5 +40,64 @@ class AnswerWebAppQuery(TelegramMethod[SentWebAppMessage]):
web_app_query_id: str
"""Unique identifier for the query to be answered"""
- result: InlineQueryResult
+ result: Union[
+ InlineQueryResultCachedAudio,
+ InlineQueryResultCachedDocument,
+ InlineQueryResultCachedGif,
+ InlineQueryResultCachedMpeg4Gif,
+ InlineQueryResultCachedPhoto,
+ InlineQueryResultCachedSticker,
+ InlineQueryResultCachedVideo,
+ InlineQueryResultCachedVoice,
+ InlineQueryResultArticle,
+ InlineQueryResultAudio,
+ InlineQueryResultContact,
+ InlineQueryResultGame,
+ InlineQueryResultDocument,
+ InlineQueryResultGif,
+ InlineQueryResultLocation,
+ InlineQueryResultMpeg4Gif,
+ InlineQueryResultPhoto,
+ InlineQueryResultVenue,
+ InlineQueryResultVideo,
+ InlineQueryResultVoice,
+ ]
"""A JSON-serialized object describing the message to be sent"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ web_app_query_id: str,
+ result: Union[
+ InlineQueryResultCachedAudio,
+ InlineQueryResultCachedDocument,
+ InlineQueryResultCachedGif,
+ InlineQueryResultCachedMpeg4Gif,
+ InlineQueryResultCachedPhoto,
+ InlineQueryResultCachedSticker,
+ InlineQueryResultCachedVideo,
+ InlineQueryResultCachedVoice,
+ InlineQueryResultArticle,
+ InlineQueryResultAudio,
+ InlineQueryResultContact,
+ InlineQueryResultGame,
+ InlineQueryResultDocument,
+ InlineQueryResultGif,
+ InlineQueryResultLocation,
+ InlineQueryResultMpeg4Gif,
+ InlineQueryResultPhoto,
+ InlineQueryResultVenue,
+ InlineQueryResultVideo,
+ InlineQueryResultVoice,
+ ],
+ **__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__(web_app_query_id=web_app_query_id, result=result, **__pydantic_kwargs)
diff --git a/aiogram/methods/approve_chat_join_request.py b/aiogram/methods/approve_chat_join_request.py
index 83e34599..2f4995b4 100644
--- a/aiogram/methods/approve_chat_join_request.py
+++ b/aiogram/methods/approve_chat_join_request.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Union
+from typing import TYPE_CHECKING, Any, Union
from .base import TelegramMethod
@@ -19,3 +19,16 @@ class ApproveChatJoinRequest(TelegramMethod[bool]):
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
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__, *, chat_id: Union[int, str], 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__(chat_id=chat_id, user_id=user_id, **__pydantic_kwargs)
diff --git a/aiogram/methods/ban_chat_member.py b/aiogram/methods/ban_chat_member.py
index ecc468ee..947fccae 100644
--- a/aiogram/methods/ban_chat_member.py
+++ b/aiogram/methods/ban_chat_member.py
@@ -1,7 +1,7 @@
from __future__ import annotations
import datetime
-from typing import TYPE_CHECKING, Optional, Union
+from typing import TYPE_CHECKING, Any, Optional, Union
from .base import TelegramMethod
@@ -21,6 +21,31 @@ class BanChatMember(TelegramMethod[bool]):
user_id: int
"""Unique identifier of the target user"""
until_date: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None
- """Date when the user will be unbanned, unix time. If user is banned for more than 366 days or less than 30 seconds from the current time they are considered to be banned forever. Applied for supergroups and channels only."""
+ """Date when the user will be unbanned; Unix time. If user is banned for more than 366 days or less than 30 seconds from the current time they are considered to be banned forever. Applied for supergroups and channels only."""
revoke_messages: Optional[bool] = None
"""Pass :code:`True` to delete all messages from the chat for the user that is being removed. If :code:`False`, the user will be able to see messages in the group that were sent before the user was removed. Always :code:`True` for supergroups and channels."""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ chat_id: Union[int, str],
+ user_id: int,
+ until_date: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None,
+ revoke_messages: Optional[bool] = 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,
+ user_id=user_id,
+ until_date=until_date,
+ revoke_messages=revoke_messages,
+ **__pydantic_kwargs,
+ )
diff --git a/aiogram/methods/ban_chat_sender_chat.py b/aiogram/methods/ban_chat_sender_chat.py
index e63f2ecc..cbe61943 100644
--- a/aiogram/methods/ban_chat_sender_chat.py
+++ b/aiogram/methods/ban_chat_sender_chat.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Union
+from typing import TYPE_CHECKING, Any, Union
from .base import TelegramMethod
@@ -19,3 +19,20 @@ class BanChatSenderChat(TelegramMethod[bool]):
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
sender_chat_id: int
"""Unique identifier of the target sender chat"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ chat_id: Union[int, str],
+ sender_chat_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__(chat_id=chat_id, sender_chat_id=sender_chat_id, **__pydantic_kwargs)
diff --git a/aiogram/methods/base.py b/aiogram/methods/base.py
index 33045bf0..b2d35bec 100644
--- a/aiogram/methods/base.py
+++ b/aiogram/methods/base.py
@@ -1,10 +1,21 @@
from __future__ import annotations
from abc import ABC, abstractmethod
-from typing import TYPE_CHECKING, Any, Dict, Generator, Generic, Optional, TypeVar
+from typing import (
+ TYPE_CHECKING,
+ Any,
+ ClassVar,
+ Dict,
+ Generator,
+ Generic,
+ Optional,
+ TypeVar,
+)
-from pydantic import BaseConfig, BaseModel, Extra, root_validator
-from pydantic.generics import GenericModel
+from pydantic import BaseModel, ConfigDict
+from pydantic.functional_validators import model_validator
+
+from aiogram.client.context_controller import BotContextController
from ..types import InputFile, ResponseParameters
from ..types.base import UNSET_TYPE
@@ -16,16 +27,15 @@ TelegramType = TypeVar("TelegramType", bound=Any)
class Request(BaseModel):
+ model_config = ConfigDict(arbitrary_types_allowed=True)
+
method: str
data: Dict[str, Optional[Any]]
files: Optional[Dict[str, InputFile]]
- class Config(BaseConfig):
- arbitrary_types_allowed = True
-
-class Response(GenericModel, Generic[TelegramType]):
+class Response(BaseModel, Generic[TelegramType]):
ok: bool
result: Optional[TelegramType] = None
description: Optional[str] = None
@@ -33,16 +43,15 @@ class Response(GenericModel, Generic[TelegramType]):
parameters: Optional[ResponseParameters] = None
-class TelegramMethod(ABC, BaseModel, Generic[TelegramType]):
- class Config(BaseConfig):
- # use_enum_values = True
- extra = Extra.allow
- allow_population_by_field_name = True
- arbitrary_types_allowed = True
- orm_mode = True
- smart_union = True # https://github.com/aiogram/aiogram/issues/901
+class TelegramMethod(BotContextController, BaseModel, Generic[TelegramType], ABC):
+ model_config = ConfigDict(
+ extra="allow",
+ populate_by_name=True,
+ arbitrary_types_allowed=True,
+ )
- @root_validator(pre=True)
+ @model_validator(mode="before")
+ @classmethod
def remove_unset(cls, values: Dict[str, Any]) -> Dict[str, Any]:
"""
Remove UNSET before fields validation.
@@ -52,35 +61,35 @@ class TelegramMethod(ABC, BaseModel, Generic[TelegramType]):
but UNSET might be passing to a model initialization from `Bot.method_name`,
so we must take care of it and remove it before fields validation.
"""
+ if not isinstance(values, dict):
+ return values
return {k: v for k, v in values.items() if not isinstance(v, UNSET_TYPE)}
- @property
- @abstractmethod
- def __returning__(self) -> type: # pragma: no cover
- pass
+ if TYPE_CHECKING:
+ __returning__: ClassVar[type]
+ __api_method__: ClassVar[str]
+ else:
- @property
- @abstractmethod
- def __api_method__(self) -> str:
- pass
+ @property
+ @abstractmethod
+ def __returning__(self) -> type:
+ pass
- def dict(self, **kwargs: Any) -> Any:
- # override dict of pydantic.BaseModel to overcome exporting request_timeout field
- exclude = kwargs.pop("exclude", set())
-
- return super().dict(exclude=exclude, **kwargs)
-
- def build_response(self, data: Dict[str, Any]) -> Response[TelegramType]:
- # noinspection PyTypeChecker
- return Response[self.__returning__](**data) # type: ignore
+ @property
+ @abstractmethod
+ def __api_method__(self) -> str:
+ pass
async def emit(self, bot: Bot) -> TelegramType:
return await bot(self)
- as_ = emit
-
def __await__(self) -> Generator[Any, None, TelegramType]:
- from aiogram.client.bot import Bot
-
- bot = Bot.get_current(no_error=False)
+ bot = self._bot
+ if not bot:
+ raise RuntimeError(
+ "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()`"
+ )
return self.emit(bot).__await__()
diff --git a/aiogram/methods/close.py b/aiogram/methods/close.py
index c8e9008d..7c33eca3 100644
--- a/aiogram/methods/close.py
+++ b/aiogram/methods/close.py
@@ -1,7 +1,5 @@
from __future__ import annotations
-from typing import TYPE_CHECKING
-
from .base import TelegramMethod
diff --git a/aiogram/methods/close_forum_topic.py b/aiogram/methods/close_forum_topic.py
index 7ab5a479..110fbce7 100644
--- a/aiogram/methods/close_forum_topic.py
+++ b/aiogram/methods/close_forum_topic.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Union
+from typing import TYPE_CHECKING, Any, Union
from .base import TelegramMethod
@@ -19,3 +19,22 @@ class CloseForumTopic(TelegramMethod[bool]):
"""Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)"""
message_thread_id: int
"""Unique identifier for the target message thread of the forum topic"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ chat_id: Union[int, str],
+ message_thread_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__(
+ chat_id=chat_id, message_thread_id=message_thread_id, **__pydantic_kwargs
+ )
diff --git a/aiogram/methods/close_general_forum_topic.py b/aiogram/methods/close_general_forum_topic.py
index bc44bde5..3f1a6336 100644
--- a/aiogram/methods/close_general_forum_topic.py
+++ b/aiogram/methods/close_general_forum_topic.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Union
+from typing import TYPE_CHECKING, Any, Union
from .base import TelegramMethod
@@ -17,3 +17,16 @@ class CloseGeneralForumTopic(TelegramMethod[bool]):
chat_id: Union[int, str]
"""Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)"""
+
+ 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/copy_message.py b/aiogram/methods/copy_message.py
index 5e34bb7d..b707580e 100644
--- a/aiogram/methods/copy_message.py
+++ b/aiogram/methods/copy_message.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, List, Optional, Union
+from typing import TYPE_CHECKING, Any, List, Optional, Union
from ..types import (
UNSET_PARSE_MODE,
@@ -51,3 +51,46 @@ class CopyMessage(TelegramMethod[MessageId]):
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove reply keyboard or to force a reply from the user."""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ chat_id: Union[int, str],
+ from_chat_id: Union[int, str],
+ message_id: int,
+ message_thread_id: Optional[int] = None,
+ caption: Optional[str] = None,
+ parse_mode: Optional[str] = UNSET_PARSE_MODE,
+ caption_entities: Optional[List[MessageEntity]] = None,
+ disable_notification: Optional[bool] = None,
+ protect_content: Optional[bool] = UNSET_PROTECT_CONTENT,
+ reply_to_message_id: Optional[int] = None,
+ allow_sending_without_reply: Optional[bool] = None,
+ reply_markup: Optional[
+ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
+ ] = 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,
+ from_chat_id=from_chat_id,
+ message_id=message_id,
+ message_thread_id=message_thread_id,
+ caption=caption,
+ parse_mode=parse_mode,
+ caption_entities=caption_entities,
+ disable_notification=disable_notification,
+ protect_content=protect_content,
+ reply_to_message_id=reply_to_message_id,
+ allow_sending_without_reply=allow_sending_without_reply,
+ reply_markup=reply_markup,
+ **__pydantic_kwargs,
+ )
diff --git a/aiogram/methods/create_chat_invite_link.py b/aiogram/methods/create_chat_invite_link.py
index 539115bb..ff0b3864 100644
--- a/aiogram/methods/create_chat_invite_link.py
+++ b/aiogram/methods/create_chat_invite_link.py
@@ -1,7 +1,7 @@
from __future__ import annotations
import datetime
-from typing import TYPE_CHECKING, Optional, Union
+from typing import TYPE_CHECKING, Any, Optional, Union
from ..types import ChatInviteLink
from .base import TelegramMethod
@@ -27,3 +27,30 @@ class CreateChatInviteLink(TelegramMethod[ChatInviteLink]):
"""The maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999"""
creates_join_request: Optional[bool] = None
""":code:`True`, if users joining the chat via the link need to be approved by chat administrators. If :code:`True`, *member_limit* can't be specified"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ chat_id: Union[int, str],
+ name: Optional[str] = None,
+ expire_date: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None,
+ member_limit: Optional[int] = None,
+ creates_join_request: Optional[bool] = 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,
+ name=name,
+ expire_date=expire_date,
+ member_limit=member_limit,
+ creates_join_request=creates_join_request,
+ **__pydantic_kwargs,
+ )
diff --git a/aiogram/methods/create_forum_topic.py b/aiogram/methods/create_forum_topic.py
index f4b3f4da..8b0f6925 100644
--- a/aiogram/methods/create_forum_topic.py
+++ b/aiogram/methods/create_forum_topic.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Optional, Union
+from typing import TYPE_CHECKING, Any, Optional, Union
from ..types import ForumTopic
from .base import TelegramMethod
@@ -24,3 +24,28 @@ class CreateForumTopic(TelegramMethod[ForumTopic]):
"""Color of the topic icon in RGB format. Currently, must be one of 7322096 (0x6FB9F0), 16766590 (0xFFD67E), 13338331 (0xCB86DB), 9367192 (0x8EEE98), 16749490 (0xFF93B2), or 16478047 (0xFB6F5F)"""
icon_custom_emoji_id: Optional[str] = None
"""Unique identifier of the custom emoji shown as the topic icon. Use :class:`aiogram.methods.get_forum_topic_icon_stickers.GetForumTopicIconStickers` to get all allowed custom emoji identifiers."""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ chat_id: Union[int, str],
+ name: str,
+ icon_color: Optional[int] = None,
+ icon_custom_emoji_id: 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,
+ name=name,
+ icon_color=icon_color,
+ icon_custom_emoji_id=icon_custom_emoji_id,
+ **__pydantic_kwargs,
+ )
diff --git a/aiogram/methods/create_invoice_link.py b/aiogram/methods/create_invoice_link.py
index de6497c1..361ea31a 100644
--- a/aiogram/methods/create_invoice_link.py
+++ b/aiogram/methods/create_invoice_link.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, List, Optional
+from typing import TYPE_CHECKING, Any, List, Optional
from ..types import LabeledPrice
from .base import TelegramMethod
@@ -56,3 +56,60 @@ class CreateInvoiceLink(TelegramMethod[str]):
"""Pass :code:`True` if the user's email address should be sent to the provider"""
is_flexible: Optional[bool] = None
"""Pass :code:`True` if the final price depends on the shipping method"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ title: str,
+ description: str,
+ payload: str,
+ provider_token: str,
+ currency: str,
+ prices: List[LabeledPrice],
+ max_tip_amount: Optional[int] = None,
+ suggested_tip_amounts: Optional[List[int]] = None,
+ provider_data: Optional[str] = None,
+ photo_url: Optional[str] = None,
+ photo_size: Optional[int] = None,
+ photo_width: Optional[int] = None,
+ photo_height: Optional[int] = None,
+ need_name: Optional[bool] = None,
+ need_phone_number: Optional[bool] = None,
+ need_email: Optional[bool] = None,
+ need_shipping_address: Optional[bool] = None,
+ send_phone_number_to_provider: Optional[bool] = None,
+ send_email_to_provider: Optional[bool] = None,
+ is_flexible: Optional[bool] = 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__(
+ title=title,
+ description=description,
+ payload=payload,
+ provider_token=provider_token,
+ currency=currency,
+ prices=prices,
+ max_tip_amount=max_tip_amount,
+ suggested_tip_amounts=suggested_tip_amounts,
+ provider_data=provider_data,
+ photo_url=photo_url,
+ photo_size=photo_size,
+ photo_width=photo_width,
+ photo_height=photo_height,
+ need_name=need_name,
+ need_phone_number=need_phone_number,
+ need_email=need_email,
+ need_shipping_address=need_shipping_address,
+ send_phone_number_to_provider=send_phone_number_to_provider,
+ send_email_to_provider=send_email_to_provider,
+ is_flexible=is_flexible,
+ **__pydantic_kwargs,
+ )
diff --git a/aiogram/methods/create_new_sticker_set.py b/aiogram/methods/create_new_sticker_set.py
index 6406df81..92388bd5 100644
--- a/aiogram/methods/create_new_sticker_set.py
+++ b/aiogram/methods/create_new_sticker_set.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, List, Optional
+from typing import TYPE_CHECKING, Any, List, Optional
from ..types import InputSticker
from .base import TelegramMethod
@@ -30,3 +30,34 @@ class CreateNewStickerSet(TelegramMethod[bool]):
"""Type of stickers in the set, pass 'regular', 'mask', or 'custom_emoji'. By default, a regular sticker set is created."""
needs_repainting: Optional[bool] = None
"""Pass :code:`True` if stickers in the sticker set must be repainted to the color of text when used in messages, the accent color if used as emoji status, white on chat photos, or another appropriate color based on context; for custom emoji sticker sets only"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ user_id: int,
+ name: str,
+ title: str,
+ stickers: List[InputSticker],
+ sticker_format: str,
+ sticker_type: Optional[str] = None,
+ needs_repainting: Optional[bool] = 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,
+ name=name,
+ title=title,
+ stickers=stickers,
+ sticker_format=sticker_format,
+ sticker_type=sticker_type,
+ needs_repainting=needs_repainting,
+ **__pydantic_kwargs,
+ )
diff --git a/aiogram/methods/decline_chat_join_request.py b/aiogram/methods/decline_chat_join_request.py
index 7861b7bb..b0fa2c3c 100644
--- a/aiogram/methods/decline_chat_join_request.py
+++ b/aiogram/methods/decline_chat_join_request.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Union
+from typing import TYPE_CHECKING, Any, Union
from .base import TelegramMethod
@@ -19,3 +19,16 @@ class DeclineChatJoinRequest(TelegramMethod[bool]):
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
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__, *, chat_id: Union[int, str], 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__(chat_id=chat_id, user_id=user_id, **__pydantic_kwargs)
diff --git a/aiogram/methods/delete_chat_photo.py b/aiogram/methods/delete_chat_photo.py
index 11a3836e..503ace2c 100644
--- a/aiogram/methods/delete_chat_photo.py
+++ b/aiogram/methods/delete_chat_photo.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Union
+from typing import TYPE_CHECKING, Any, Union
from .base import TelegramMethod
@@ -17,3 +17,16 @@ class DeleteChatPhoto(TelegramMethod[bool]):
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/delete_chat_sticker_set.py b/aiogram/methods/delete_chat_sticker_set.py
index 681293df..50d705f0 100644
--- a/aiogram/methods/delete_chat_sticker_set.py
+++ b/aiogram/methods/delete_chat_sticker_set.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Union
+from typing import TYPE_CHECKING, Any, Union
from .base import TelegramMethod
@@ -17,3 +17,16 @@ class DeleteChatStickerSet(TelegramMethod[bool]):
chat_id: Union[int, str]
"""Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)"""
+
+ 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/delete_forum_topic.py b/aiogram/methods/delete_forum_topic.py
index 4733c67d..7d238562 100644
--- a/aiogram/methods/delete_forum_topic.py
+++ b/aiogram/methods/delete_forum_topic.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Union
+from typing import TYPE_CHECKING, Any, Union
from .base import TelegramMethod
@@ -19,3 +19,22 @@ class DeleteForumTopic(TelegramMethod[bool]):
"""Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)"""
message_thread_id: int
"""Unique identifier for the target message thread of the forum topic"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ chat_id: Union[int, str],
+ message_thread_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__(
+ chat_id=chat_id, message_thread_id=message_thread_id, **__pydantic_kwargs
+ )
diff --git a/aiogram/methods/delete_message.py b/aiogram/methods/delete_message.py
index 468411d5..59aee049 100644
--- a/aiogram/methods/delete_message.py
+++ b/aiogram/methods/delete_message.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Union
+from typing import TYPE_CHECKING, Any, Union
from .base import TelegramMethod
@@ -37,3 +37,20 @@ class DeleteMessage(TelegramMethod[bool]):
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
message_id: int
"""Identifier of the message to delete"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ chat_id: Union[int, str],
+ message_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__(chat_id=chat_id, message_id=message_id, **__pydantic_kwargs)
diff --git a/aiogram/methods/delete_my_commands.py b/aiogram/methods/delete_my_commands.py
index d73814db..e35ef67c 100644
--- a/aiogram/methods/delete_my_commands.py
+++ b/aiogram/methods/delete_my_commands.py
@@ -1,8 +1,16 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Optional
+from typing import TYPE_CHECKING, Any, Optional, Union
-from ..types import BotCommandScope
+from ..types import (
+ BotCommandScopeAllChatAdministrators,
+ BotCommandScopeAllGroupChats,
+ BotCommandScopeAllPrivateChats,
+ BotCommandScopeChat,
+ BotCommandScopeChatAdministrators,
+ BotCommandScopeChatMember,
+ BotCommandScopeDefault,
+)
from .base import TelegramMethod
@@ -16,7 +24,44 @@ class DeleteMyCommands(TelegramMethod[bool]):
__returning__ = bool
__api_method__ = "deleteMyCommands"
- scope: Optional[BotCommandScope] = None
+ scope: Optional[
+ Union[
+ BotCommandScopeDefault,
+ BotCommandScopeAllPrivateChats,
+ BotCommandScopeAllGroupChats,
+ BotCommandScopeAllChatAdministrators,
+ BotCommandScopeChat,
+ BotCommandScopeChatAdministrators,
+ BotCommandScopeChatMember,
+ ]
+ ] = None
"""A JSON-serialized object, describing scope of users for which the commands are relevant. Defaults to :class:`aiogram.types.bot_command_scope_default.BotCommandScopeDefault`."""
language_code: Optional[str] = None
"""A two-letter ISO 639-1 language code. If empty, commands will be applied to all users from the given scope, for whose language there are no dedicated commands"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ scope: Optional[
+ Union[
+ BotCommandScopeDefault,
+ BotCommandScopeAllPrivateChats,
+ BotCommandScopeAllGroupChats,
+ BotCommandScopeAllChatAdministrators,
+ BotCommandScopeChat,
+ BotCommandScopeChatAdministrators,
+ BotCommandScopeChatMember,
+ ]
+ ] = None,
+ language_code: 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__(scope=scope, language_code=language_code, **__pydantic_kwargs)
diff --git a/aiogram/methods/delete_sticker_from_set.py b/aiogram/methods/delete_sticker_from_set.py
index 96219c15..6aae72b7 100644
--- a/aiogram/methods/delete_sticker_from_set.py
+++ b/aiogram/methods/delete_sticker_from_set.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING
+from typing import TYPE_CHECKING, Any
from .base import TelegramMethod
@@ -17,3 +17,14 @@ class DeleteStickerFromSet(TelegramMethod[bool]):
sticker: str
"""File identifier of the sticker"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(__pydantic__self__, *, sticker: 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__(sticker=sticker, **__pydantic_kwargs)
diff --git a/aiogram/methods/delete_sticker_set.py b/aiogram/methods/delete_sticker_set.py
index d5a0f67e..519c5db1 100644
--- a/aiogram/methods/delete_sticker_set.py
+++ b/aiogram/methods/delete_sticker_set.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING
+from typing import TYPE_CHECKING, Any
from .base import TelegramMethod
@@ -17,3 +17,14 @@ class DeleteStickerSet(TelegramMethod[bool]):
name: str
"""Sticker set name"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(__pydantic__self__, *, name: 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__(name=name, **__pydantic_kwargs)
diff --git a/aiogram/methods/delete_webhook.py b/aiogram/methods/delete_webhook.py
index b9d6cd7b..05c39f4e 100644
--- a/aiogram/methods/delete_webhook.py
+++ b/aiogram/methods/delete_webhook.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Optional
+from typing import TYPE_CHECKING, Any, Optional
from .base import TelegramMethod
@@ -17,3 +17,19 @@ class DeleteWebhook(TelegramMethod[bool]):
drop_pending_updates: Optional[bool] = None
"""Pass :code:`True` to drop all pending updates"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ drop_pending_updates: Optional[bool] = 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__(drop_pending_updates=drop_pending_updates, **__pydantic_kwargs)
diff --git a/aiogram/methods/edit_chat_invite_link.py b/aiogram/methods/edit_chat_invite_link.py
index 26f4ccc3..8ec86cab 100644
--- a/aiogram/methods/edit_chat_invite_link.py
+++ b/aiogram/methods/edit_chat_invite_link.py
@@ -1,7 +1,7 @@
from __future__ import annotations
import datetime
-from typing import TYPE_CHECKING, Optional, Union
+from typing import TYPE_CHECKING, Any, Optional, Union
from ..types import ChatInviteLink
from .base import TelegramMethod
@@ -29,3 +29,32 @@ class EditChatInviteLink(TelegramMethod[ChatInviteLink]):
"""The maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999"""
creates_join_request: Optional[bool] = None
""":code:`True`, if users joining the chat via the link need to be approved by chat administrators. If :code:`True`, *member_limit* can't be specified"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ chat_id: Union[int, str],
+ invite_link: str,
+ name: Optional[str] = None,
+ expire_date: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None,
+ member_limit: Optional[int] = None,
+ creates_join_request: Optional[bool] = None,
+ **__pydantic_kwargs: Any,
+ ) -> None:
+ # DO NOT EDIT MANUALLY!!!
+ # This method was auto-generated via `butcher`
+ # Is needed only for type checking and IDE support without any additional plugins
+
+ super().__init__(
+ chat_id=chat_id,
+ invite_link=invite_link,
+ name=name,
+ expire_date=expire_date,
+ member_limit=member_limit,
+ creates_join_request=creates_join_request,
+ **__pydantic_kwargs,
+ )
diff --git a/aiogram/methods/edit_forum_topic.py b/aiogram/methods/edit_forum_topic.py
index f87d0cea..f0afb354 100644
--- a/aiogram/methods/edit_forum_topic.py
+++ b/aiogram/methods/edit_forum_topic.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Optional, Union
+from typing import TYPE_CHECKING, Any, Optional, Union
from .base import TelegramMethod
@@ -23,3 +23,28 @@ class EditForumTopic(TelegramMethod[bool]):
"""New topic name, 0-128 characters. If not specified or empty, the current name of the topic will be kept"""
icon_custom_emoji_id: Optional[str] = None
"""New unique identifier of the custom emoji shown as the topic icon. Use :class:`aiogram.methods.get_forum_topic_icon_stickers.GetForumTopicIconStickers` to get all allowed custom emoji identifiers. Pass an empty string to remove the icon. If not specified, the current icon will be kept"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ chat_id: Union[int, str],
+ message_thread_id: int,
+ name: Optional[str] = None,
+ icon_custom_emoji_id: 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,
+ message_thread_id=message_thread_id,
+ name=name,
+ icon_custom_emoji_id=icon_custom_emoji_id,
+ **__pydantic_kwargs,
+ )
diff --git a/aiogram/methods/edit_general_forum_topic.py b/aiogram/methods/edit_general_forum_topic.py
index f35c2048..fe5acadf 100644
--- a/aiogram/methods/edit_general_forum_topic.py
+++ b/aiogram/methods/edit_general_forum_topic.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Union
+from typing import TYPE_CHECKING, Any, Union
from .base import TelegramMethod
@@ -19,3 +19,16 @@ class EditGeneralForumTopic(TelegramMethod[bool]):
"""Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)"""
name: str
"""New topic name, 1-128 characters"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__, *, chat_id: Union[int, str], name: 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, name=name, **__pydantic_kwargs)
diff --git a/aiogram/methods/edit_message_caption.py b/aiogram/methods/edit_message_caption.py
index 66cdeac9..4c15e6d8 100644
--- a/aiogram/methods/edit_message_caption.py
+++ b/aiogram/methods/edit_message_caption.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, List, Optional, Union
+from typing import TYPE_CHECKING, Any, List, Optional, Union
from ..types import UNSET_PARSE_MODE, InlineKeyboardMarkup, Message, MessageEntity
from .base import TelegramMethod
@@ -30,3 +30,34 @@ class EditMessageCaption(TelegramMethod[Union[Message, bool]]):
"""A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*"""
reply_markup: Optional[InlineKeyboardMarkup] = None
"""A JSON-serialized object for an `inline keyboard `_."""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ chat_id: Optional[Union[int, str]] = None,
+ message_id: Optional[int] = None,
+ inline_message_id: Optional[str] = None,
+ caption: Optional[str] = None,
+ parse_mode: Optional[str] = UNSET_PARSE_MODE,
+ caption_entities: Optional[List[MessageEntity]] = None,
+ reply_markup: Optional[InlineKeyboardMarkup] = 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,
+ message_id=message_id,
+ inline_message_id=inline_message_id,
+ caption=caption,
+ parse_mode=parse_mode,
+ caption_entities=caption_entities,
+ reply_markup=reply_markup,
+ **__pydantic_kwargs,
+ )
diff --git a/aiogram/methods/edit_message_live_location.py b/aiogram/methods/edit_message_live_location.py
index e35c3225..44406203 100644
--- a/aiogram/methods/edit_message_live_location.py
+++ b/aiogram/methods/edit_message_live_location.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Optional, Union
+from typing import TYPE_CHECKING, Any, Optional, Union
from ..types import InlineKeyboardMarkup, Message
from .base import TelegramMethod
@@ -34,3 +34,38 @@ class EditMessageLiveLocation(TelegramMethod[Union[Message, bool]]):
"""The maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified."""
reply_markup: Optional[InlineKeyboardMarkup] = None
"""A JSON-serialized object for a new `inline keyboard `_."""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ latitude: float,
+ longitude: float,
+ chat_id: Optional[Union[int, str]] = None,
+ message_id: Optional[int] = None,
+ inline_message_id: Optional[str] = None,
+ horizontal_accuracy: Optional[float] = None,
+ heading: Optional[int] = None,
+ proximity_alert_radius: Optional[int] = None,
+ reply_markup: Optional[InlineKeyboardMarkup] = 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__(
+ latitude=latitude,
+ longitude=longitude,
+ chat_id=chat_id,
+ message_id=message_id,
+ inline_message_id=inline_message_id,
+ horizontal_accuracy=horizontal_accuracy,
+ heading=heading,
+ proximity_alert_radius=proximity_alert_radius,
+ reply_markup=reply_markup,
+ **__pydantic_kwargs,
+ )
diff --git a/aiogram/methods/edit_message_media.py b/aiogram/methods/edit_message_media.py
index f986a841..a354de03 100644
--- a/aiogram/methods/edit_message_media.py
+++ b/aiogram/methods/edit_message_media.py
@@ -1,8 +1,16 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Optional, Union
+from typing import TYPE_CHECKING, Any, Optional, Union
-from ..types import InlineKeyboardMarkup, InputMedia, Message
+from ..types import (
+ InlineKeyboardMarkup,
+ InputMediaAnimation,
+ InputMediaAudio,
+ InputMediaDocument,
+ InputMediaPhoto,
+ InputMediaVideo,
+ Message,
+)
from .base import TelegramMethod
@@ -16,7 +24,9 @@ class EditMessageMedia(TelegramMethod[Union[Message, bool]]):
__returning__ = Union[Message, bool]
__api_method__ = "editMessageMedia"
- media: InputMedia
+ media: Union[
+ InputMediaAnimation, InputMediaDocument, InputMediaAudio, InputMediaPhoto, InputMediaVideo
+ ]
"""A JSON-serialized object for a new media content of the message"""
chat_id: Optional[Union[int, str]] = None
"""Required if *inline_message_id* is not specified. Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
@@ -26,3 +36,36 @@ class EditMessageMedia(TelegramMethod[Union[Message, bool]]):
"""Required if *chat_id* and *message_id* are not specified. Identifier of the inline message"""
reply_markup: Optional[InlineKeyboardMarkup] = None
"""A JSON-serialized object for a new `inline keyboard `_."""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ media: Union[
+ InputMediaAnimation,
+ InputMediaDocument,
+ InputMediaAudio,
+ InputMediaPhoto,
+ InputMediaVideo,
+ ],
+ chat_id: Optional[Union[int, str]] = None,
+ message_id: Optional[int] = None,
+ inline_message_id: Optional[str] = None,
+ reply_markup: Optional[InlineKeyboardMarkup] = 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__(
+ media=media,
+ chat_id=chat_id,
+ message_id=message_id,
+ inline_message_id=inline_message_id,
+ reply_markup=reply_markup,
+ **__pydantic_kwargs,
+ )
diff --git a/aiogram/methods/edit_message_reply_markup.py b/aiogram/methods/edit_message_reply_markup.py
index a828c9d8..bc957a14 100644
--- a/aiogram/methods/edit_message_reply_markup.py
+++ b/aiogram/methods/edit_message_reply_markup.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Optional, Union
+from typing import TYPE_CHECKING, Any, Optional, Union
from ..types import InlineKeyboardMarkup, Message
from .base import TelegramMethod
@@ -24,3 +24,28 @@ class EditMessageReplyMarkup(TelegramMethod[Union[Message, bool]]):
"""Required if *chat_id* and *message_id* are not specified. Identifier of the inline message"""
reply_markup: Optional[InlineKeyboardMarkup] = None
"""A JSON-serialized object for an `inline keyboard `_."""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ chat_id: Optional[Union[int, str]] = None,
+ message_id: Optional[int] = None,
+ inline_message_id: Optional[str] = None,
+ reply_markup: Optional[InlineKeyboardMarkup] = 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,
+ message_id=message_id,
+ inline_message_id=inline_message_id,
+ reply_markup=reply_markup,
+ **__pydantic_kwargs,
+ )
diff --git a/aiogram/methods/edit_message_text.py b/aiogram/methods/edit_message_text.py
index 79887c97..c795e0f2 100644
--- a/aiogram/methods/edit_message_text.py
+++ b/aiogram/methods/edit_message_text.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, List, Optional, Union
+from typing import TYPE_CHECKING, Any, List, Optional, Union
from ..types import UNSET_PARSE_MODE, InlineKeyboardMarkup, Message, MessageEntity
from ..types.base import UNSET_DISABLE_WEB_PAGE_PREVIEW
@@ -33,3 +33,36 @@ class EditMessageText(TelegramMethod[Union[Message, bool]]):
"""Disables link previews for links in this message"""
reply_markup: Optional[InlineKeyboardMarkup] = None
"""A JSON-serialized object for an `inline keyboard `_."""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ text: str,
+ chat_id: Optional[Union[int, str]] = None,
+ message_id: Optional[int] = None,
+ inline_message_id: Optional[str] = None,
+ parse_mode: Optional[str] = UNSET_PARSE_MODE,
+ entities: Optional[List[MessageEntity]] = None,
+ disable_web_page_preview: Optional[bool] = UNSET_DISABLE_WEB_PAGE_PREVIEW,
+ reply_markup: Optional[InlineKeyboardMarkup] = 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__(
+ text=text,
+ chat_id=chat_id,
+ message_id=message_id,
+ inline_message_id=inline_message_id,
+ parse_mode=parse_mode,
+ entities=entities,
+ disable_web_page_preview=disable_web_page_preview,
+ reply_markup=reply_markup,
+ **__pydantic_kwargs,
+ )
diff --git a/aiogram/methods/export_chat_invite_link.py b/aiogram/methods/export_chat_invite_link.py
index ba4436ed..271e35d1 100644
--- a/aiogram/methods/export_chat_invite_link.py
+++ b/aiogram/methods/export_chat_invite_link.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Union
+from typing import TYPE_CHECKING, Any, Union
from .base import TelegramMethod
@@ -19,3 +19,16 @@ class ExportChatInviteLink(TelegramMethod[str]):
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/forward_message.py b/aiogram/methods/forward_message.py
index 45c084a0..a0eeb79f 100644
--- a/aiogram/methods/forward_message.py
+++ b/aiogram/methods/forward_message.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Optional, Union
+from typing import TYPE_CHECKING, Any, Optional, Union
from ..types import Message
from ..types.base import UNSET_PROTECT_CONTENT
@@ -29,3 +29,32 @@ class ForwardMessage(TelegramMethod[Message]):
"""Sends the message `silently `_. Users will receive a notification with no sound."""
protect_content: Optional[bool] = UNSET_PROTECT_CONTENT
"""Protects the contents of the forwarded message from forwarding and saving"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ chat_id: Union[int, str],
+ from_chat_id: Union[int, str],
+ message_id: int,
+ message_thread_id: Optional[int] = None,
+ disable_notification: Optional[bool] = None,
+ protect_content: Optional[bool] = UNSET_PROTECT_CONTENT,
+ **__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,
+ from_chat_id=from_chat_id,
+ message_id=message_id,
+ message_thread_id=message_thread_id,
+ disable_notification=disable_notification,
+ protect_content=protect_content,
+ **__pydantic_kwargs,
+ )
diff --git a/aiogram/methods/get_chat.py b/aiogram/methods/get_chat.py
index a565529a..d835aa55 100644
--- a/aiogram/methods/get_chat.py
+++ b/aiogram/methods/get_chat.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Union
+from typing import TYPE_CHECKING, Any, Union
from ..types import Chat
from .base import TelegramMethod
@@ -18,3 +18,16 @@ class GetChat(TelegramMethod[Chat]):
chat_id: Union[int, str]
"""Unique identifier for the target chat or username of the target supergroup or 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/get_chat_administrators.py b/aiogram/methods/get_chat_administrators.py
index 3e0cac3c..99e403e2 100644
--- a/aiogram/methods/get_chat_administrators.py
+++ b/aiogram/methods/get_chat_administrators.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, List, Union
+from typing import TYPE_CHECKING, Any, List, Union
from ..types import (
ChatMemberAdministrator,
@@ -47,3 +47,16 @@ class GetChatAdministrators(
chat_id: Union[int, str]
"""Unique identifier for the target chat or username of the target supergroup or 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/get_chat_member.py b/aiogram/methods/get_chat_member.py
index ab308024..495f6287 100644
--- a/aiogram/methods/get_chat_member.py
+++ b/aiogram/methods/get_chat_member.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Union
+from typing import TYPE_CHECKING, Any, Union
from ..types import (
ChatMemberAdministrator,
@@ -45,3 +45,16 @@ class GetChatMember(
"""Unique identifier for the target chat or username of the target supergroup or channel (in the format :code:`@channelusername`)"""
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__, *, chat_id: Union[int, str], 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__(chat_id=chat_id, user_id=user_id, **__pydantic_kwargs)
diff --git a/aiogram/methods/get_chat_member_count.py b/aiogram/methods/get_chat_member_count.py
index c1b08e5b..fc33c23f 100644
--- a/aiogram/methods/get_chat_member_count.py
+++ b/aiogram/methods/get_chat_member_count.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Union
+from typing import TYPE_CHECKING, Any, Union
from .base import TelegramMethod
@@ -17,3 +17,16 @@ class GetChatMemberCount(TelegramMethod[int]):
chat_id: Union[int, str]
"""Unique identifier for the target chat or username of the target supergroup or 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/get_chat_menu_button.py b/aiogram/methods/get_chat_menu_button.py
index 6679d5df..ee1248d0 100644
--- a/aiogram/methods/get_chat_menu_button.py
+++ b/aiogram/methods/get_chat_menu_button.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Optional, Union
+from typing import TYPE_CHECKING, Any, Optional, Union
from ..types import MenuButtonCommands, MenuButtonDefault, MenuButtonWebApp
from .base import TelegramMethod
@@ -20,3 +20,16 @@ class GetChatMenuButton(
chat_id: Optional[int] = None
"""Unique identifier for the target private chat. If not specified, default bot's menu button will be returned"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__, *, chat_id: 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__(chat_id=chat_id, **__pydantic_kwargs)
diff --git a/aiogram/methods/get_custom_emoji_stickers.py b/aiogram/methods/get_custom_emoji_stickers.py
index 3522b539..5aeff72f 100644
--- a/aiogram/methods/get_custom_emoji_stickers.py
+++ b/aiogram/methods/get_custom_emoji_stickers.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, List
+from typing import TYPE_CHECKING, Any, List
from ..types import Sticker
from .base import TelegramMethod
@@ -18,3 +18,16 @@ class GetCustomEmojiStickers(TelegramMethod[List[Sticker]]):
custom_emoji_ids: List[str]
"""List of custom emoji identifiers. At most 200 custom emoji identifiers can be specified."""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__, *, custom_emoji_ids: List[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__(custom_emoji_ids=custom_emoji_ids, **__pydantic_kwargs)
diff --git a/aiogram/methods/get_file.py b/aiogram/methods/get_file.py
index b84ff940..c96ff311 100644
--- a/aiogram/methods/get_file.py
+++ b/aiogram/methods/get_file.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING
+from typing import TYPE_CHECKING, Any
from ..types import File
from .base import TelegramMethod
@@ -19,3 +19,14 @@ class GetFile(TelegramMethod[File]):
file_id: str
"""File identifier to get information about"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(__pydantic__self__, *, file_id: 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__(file_id=file_id, **__pydantic_kwargs)
diff --git a/aiogram/methods/get_forum_topic_icon_stickers.py b/aiogram/methods/get_forum_topic_icon_stickers.py
index 31965661..5c233215 100644
--- a/aiogram/methods/get_forum_topic_icon_stickers.py
+++ b/aiogram/methods/get_forum_topic_icon_stickers.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, List
+from typing import List
from ..types import Sticker
from .base import TelegramMethod
diff --git a/aiogram/methods/get_game_high_scores.py b/aiogram/methods/get_game_high_scores.py
index aff1c56a..cac9d61a 100644
--- a/aiogram/methods/get_game_high_scores.py
+++ b/aiogram/methods/get_game_high_scores.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, List, Optional
+from typing import TYPE_CHECKING, Any, List, Optional
from ..types import GameHighScore
from .base import TelegramMethod
@@ -26,3 +26,28 @@ class GetGameHighScores(TelegramMethod[List[GameHighScore]]):
"""Required if *inline_message_id* is not specified. Identifier of the sent message"""
inline_message_id: Optional[str] = None
"""Required if *chat_id* and *message_id* are not specified. Identifier of the inline message"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ user_id: int,
+ chat_id: Optional[int] = None,
+ message_id: Optional[int] = None,
+ inline_message_id: 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,
+ chat_id=chat_id,
+ message_id=message_id,
+ inline_message_id=inline_message_id,
+ **__pydantic_kwargs,
+ )
diff --git a/aiogram/methods/get_me.py b/aiogram/methods/get_me.py
index 1a7f1fe1..c2cc52f9 100644
--- a/aiogram/methods/get_me.py
+++ b/aiogram/methods/get_me.py
@@ -1,7 +1,5 @@
from __future__ import annotations
-from typing import TYPE_CHECKING
-
from ..types import User
from .base import TelegramMethod
diff --git a/aiogram/methods/get_my_commands.py b/aiogram/methods/get_my_commands.py
index d1e5c9c3..b3386b66 100644
--- a/aiogram/methods/get_my_commands.py
+++ b/aiogram/methods/get_my_commands.py
@@ -1,8 +1,17 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, List, Optional
+from typing import TYPE_CHECKING, Any, List, Optional, Union
-from ..types import BotCommand, BotCommandScope
+from ..types import (
+ BotCommand,
+ BotCommandScopeAllChatAdministrators,
+ BotCommandScopeAllGroupChats,
+ BotCommandScopeAllPrivateChats,
+ BotCommandScopeChat,
+ BotCommandScopeChatAdministrators,
+ BotCommandScopeChatMember,
+ BotCommandScopeDefault,
+)
from .base import TelegramMethod
@@ -16,7 +25,44 @@ class GetMyCommands(TelegramMethod[List[BotCommand]]):
__returning__ = List[BotCommand]
__api_method__ = "getMyCommands"
- scope: Optional[BotCommandScope] = None
+ scope: Optional[
+ Union[
+ BotCommandScopeDefault,
+ BotCommandScopeAllPrivateChats,
+ BotCommandScopeAllGroupChats,
+ BotCommandScopeAllChatAdministrators,
+ BotCommandScopeChat,
+ BotCommandScopeChatAdministrators,
+ BotCommandScopeChatMember,
+ ]
+ ] = None
"""A JSON-serialized object, describing scope of users. Defaults to :class:`aiogram.types.bot_command_scope_default.BotCommandScopeDefault`."""
language_code: Optional[str] = None
"""A two-letter ISO 639-1 language code or an empty string"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ scope: Optional[
+ Union[
+ BotCommandScopeDefault,
+ BotCommandScopeAllPrivateChats,
+ BotCommandScopeAllGroupChats,
+ BotCommandScopeAllChatAdministrators,
+ BotCommandScopeChat,
+ BotCommandScopeChatAdministrators,
+ BotCommandScopeChatMember,
+ ]
+ ] = None,
+ language_code: 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__(scope=scope, language_code=language_code, **__pydantic_kwargs)
diff --git a/aiogram/methods/get_my_default_administrator_rights.py b/aiogram/methods/get_my_default_administrator_rights.py
index d20e7a15..4f9ad9a6 100644
--- a/aiogram/methods/get_my_default_administrator_rights.py
+++ b/aiogram/methods/get_my_default_administrator_rights.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Optional
+from typing import TYPE_CHECKING, Any, Optional
from ..types import ChatAdministratorRights
from .base import TelegramMethod
@@ -18,3 +18,16 @@ class GetMyDefaultAdministratorRights(TelegramMethod[ChatAdministratorRights]):
for_channels: Optional[bool] = None
"""Pass :code:`True` to get default administrator rights of the bot in channels. Otherwise, default administrator rights of the bot for groups and supergroups will be returned."""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__, *, for_channels: Optional[bool] = 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__(for_channels=for_channels, **__pydantic_kwargs)
diff --git a/aiogram/methods/get_my_description.py b/aiogram/methods/get_my_description.py
index 3b0534ff..f967faf6 100644
--- a/aiogram/methods/get_my_description.py
+++ b/aiogram/methods/get_my_description.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Optional
+from typing import TYPE_CHECKING, Any, Optional
from ..types import BotDescription
from .base import TelegramMethod
@@ -18,3 +18,16 @@ class GetMyDescription(TelegramMethod[BotDescription]):
language_code: Optional[str] = None
"""A two-letter ISO 639-1 language code or an empty string"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__, *, language_code: 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__(language_code=language_code, **__pydantic_kwargs)
diff --git a/aiogram/methods/get_my_name.py b/aiogram/methods/get_my_name.py
index 202b21ff..909ac3f6 100644
--- a/aiogram/methods/get_my_name.py
+++ b/aiogram/methods/get_my_name.py
@@ -1,4 +1,4 @@
-from typing import Optional
+from typing import TYPE_CHECKING, Any, Optional
from ..types import BotName
from .base import TelegramMethod
@@ -16,3 +16,16 @@ class GetMyName(TelegramMethod[BotName]):
language_code: Optional[str] = None
"""A two-letter ISO 639-1 language code or an empty string"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__, *, language_code: 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__(language_code=language_code, **__pydantic_kwargs)
diff --git a/aiogram/methods/get_my_short_description.py b/aiogram/methods/get_my_short_description.py
index 81731142..a9a56669 100644
--- a/aiogram/methods/get_my_short_description.py
+++ b/aiogram/methods/get_my_short_description.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Optional
+from typing import TYPE_CHECKING, Any, Optional
from ..types import BotShortDescription
from .base import TelegramMethod
@@ -18,3 +18,16 @@ class GetMyShortDescription(TelegramMethod[BotShortDescription]):
language_code: Optional[str] = None
"""A two-letter ISO 639-1 language code or an empty string"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__, *, language_code: 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__(language_code=language_code, **__pydantic_kwargs)
diff --git a/aiogram/methods/get_sticker_set.py b/aiogram/methods/get_sticker_set.py
index 87041172..2700e172 100644
--- a/aiogram/methods/get_sticker_set.py
+++ b/aiogram/methods/get_sticker_set.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING
+from typing import TYPE_CHECKING, Any
from ..types import StickerSet
from .base import TelegramMethod
@@ -18,3 +18,14 @@ class GetStickerSet(TelegramMethod[StickerSet]):
name: str
"""Name of the sticker set"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(__pydantic__self__, *, name: 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__(name=name, **__pydantic_kwargs)
diff --git a/aiogram/methods/get_updates.py b/aiogram/methods/get_updates.py
index b22c9755..dd9f855e 100644
--- a/aiogram/methods/get_updates.py
+++ b/aiogram/methods/get_updates.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, List, Optional
+from typing import TYPE_CHECKING, Any, List, Optional
from ..types import Update
from .base import TelegramMethod
@@ -29,4 +29,29 @@ class GetUpdates(TelegramMethod[List[Update]]):
timeout: Optional[int] = None
"""Timeout in seconds for long polling. Defaults to 0, i.e. usual short polling. Should be positive, short polling should be used for testing purposes only."""
allowed_updates: Optional[List[str]] = None
- """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 :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* (default). If not specified, the previous setting will be used."""
+ """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* (default). If not specified, the previous setting will be used."""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ offset: Optional[int] = None,
+ limit: Optional[int] = None,
+ timeout: Optional[int] = None,
+ allowed_updates: Optional[List[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__(
+ offset=offset,
+ limit=limit,
+ timeout=timeout,
+ allowed_updates=allowed_updates,
+ **__pydantic_kwargs,
+ )
diff --git a/aiogram/methods/get_user_profile_photos.py b/aiogram/methods/get_user_profile_photos.py
index 47abc196..488885e1 100644
--- a/aiogram/methods/get_user_profile_photos.py
+++ b/aiogram/methods/get_user_profile_photos.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Optional
+from typing import TYPE_CHECKING, Any, Optional
from ..types import UserProfilePhotos
from .base import TelegramMethod
@@ -22,3 +22,21 @@ class GetUserProfilePhotos(TelegramMethod[UserProfilePhotos]):
"""Sequential number of the first photo to be returned. By default, all photos are returned."""
limit: Optional[int] = None
"""Limits the number of photos to be retrieved. Values between 1-100 are accepted. Defaults to 100."""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ user_id: int,
+ offset: Optional[int] = None,
+ limit: Optional[int] = None,
+ **__pydantic_kwargs: Any,
+ ) -> None:
+ # DO NOT EDIT MANUALLY!!!
+ # This method was auto-generated via `butcher`
+ # Is needed only for type checking and IDE support without any additional plugins
+
+ super().__init__(user_id=user_id, offset=offset, limit=limit, **__pydantic_kwargs)
diff --git a/aiogram/methods/get_webhook_info.py b/aiogram/methods/get_webhook_info.py
index 5e4e194c..c9f0e46f 100644
--- a/aiogram/methods/get_webhook_info.py
+++ b/aiogram/methods/get_webhook_info.py
@@ -1,7 +1,5 @@
from __future__ import annotations
-from typing import TYPE_CHECKING
-
from ..types import WebhookInfo
from .base import TelegramMethod
diff --git a/aiogram/methods/hide_general_forum_topic.py b/aiogram/methods/hide_general_forum_topic.py
index 2587cf9e..a3b6ee3f 100644
--- a/aiogram/methods/hide_general_forum_topic.py
+++ b/aiogram/methods/hide_general_forum_topic.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Union
+from typing import TYPE_CHECKING, Any, Union
from .base import TelegramMethod
@@ -17,3 +17,16 @@ class HideGeneralForumTopic(TelegramMethod[bool]):
chat_id: Union[int, str]
"""Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)"""
+
+ 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/leave_chat.py b/aiogram/methods/leave_chat.py
index 5b2e15cf..f9d43128 100644
--- a/aiogram/methods/leave_chat.py
+++ b/aiogram/methods/leave_chat.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Union
+from typing import TYPE_CHECKING, Any, Union
from .base import TelegramMethod
@@ -17,3 +17,16 @@ class LeaveChat(TelegramMethod[bool]):
chat_id: Union[int, str]
"""Unique identifier for the target chat or username of the target supergroup or 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/log_out.py b/aiogram/methods/log_out.py
index 3f3ea3de..2a626535 100644
--- a/aiogram/methods/log_out.py
+++ b/aiogram/methods/log_out.py
@@ -1,7 +1,5 @@
from __future__ import annotations
-from typing import TYPE_CHECKING
-
from .base import TelegramMethod
diff --git a/aiogram/methods/pin_chat_message.py b/aiogram/methods/pin_chat_message.py
index d1641eea..fe99cc25 100644
--- a/aiogram/methods/pin_chat_message.py
+++ b/aiogram/methods/pin_chat_message.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Optional, Union
+from typing import TYPE_CHECKING, Any, Optional, Union
from .base import TelegramMethod
@@ -21,3 +21,26 @@ class PinChatMessage(TelegramMethod[bool]):
"""Identifier of a message to pin"""
disable_notification: Optional[bool] = None
"""Pass :code:`True` if it is not necessary to send a notification to all chat members about the new pinned message. Notifications are always disabled in channels and private chats."""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ chat_id: Union[int, str],
+ message_id: int,
+ disable_notification: Optional[bool] = 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,
+ message_id=message_id,
+ disable_notification=disable_notification,
+ **__pydantic_kwargs,
+ )
diff --git a/aiogram/methods/promote_chat_member.py b/aiogram/methods/promote_chat_member.py
index d8f6096f..8be42d30 100644
--- a/aiogram/methods/promote_chat_member.py
+++ b/aiogram/methods/promote_chat_member.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Optional, Union
+from typing import TYPE_CHECKING, Any, Optional, Union
from .base import TelegramMethod
@@ -22,24 +22,81 @@ class PromoteChatMember(TelegramMethod[bool]):
is_anonymous: Optional[bool] = None
"""Pass :code:`True` if the administrator's presence in the chat is hidden"""
can_manage_chat: Optional[bool] = None
- """Pass :code:`True` if the administrator can access the chat event log, chat statistics, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege"""
- can_post_messages: Optional[bool] = None
- """Pass :code:`True` if the administrator can create channel posts, channels only"""
- can_edit_messages: Optional[bool] = None
- """Pass :code:`True` if the administrator can edit messages of other users and can pin messages, channels only"""
+ """Pass :code:`True` if the administrator can access the chat event log, boost list in channels, see channel members, report spam messages, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege"""
can_delete_messages: Optional[bool] = None
"""Pass :code:`True` if the administrator can delete messages of other users"""
can_manage_video_chats: Optional[bool] = None
"""Pass :code:`True` if the administrator can manage video chats"""
can_restrict_members: Optional[bool] = None
- """Pass :code:`True` if the administrator can restrict, ban or unban chat members"""
+ """Pass :code:`True` if the administrator can restrict, ban or unban chat members, or access supergroup statistics"""
can_promote_members: Optional[bool] = None
"""Pass :code:`True` if the administrator can add new administrators with a subset of their own privileges or demote administrators that they have promoted, directly or indirectly (promoted by administrators that were appointed by him)"""
can_change_info: Optional[bool] = None
"""Pass :code:`True` if the administrator can change chat title, photo and other settings"""
can_invite_users: Optional[bool] = None
"""Pass :code:`True` if the administrator can invite new users to the chat"""
+ can_post_messages: Optional[bool] = None
+ """Pass :code:`True` if the administrator can post messages in the channel, or access channel statistics; channels only"""
+ can_edit_messages: Optional[bool] = None
+ """Pass :code:`True` if the administrator can edit messages of other users and can pin messages; channels only"""
can_pin_messages: Optional[bool] = None
"""Pass :code:`True` if the administrator can pin messages, supergroups only"""
+ can_post_stories: Optional[bool] = None
+ """Pass :code:`True` if the administrator can post stories in the channel; channels only"""
+ can_edit_stories: Optional[bool] = None
+ """Pass :code:`True` if the administrator can edit stories posted by other users; channels only"""
+ can_delete_stories: Optional[bool] = None
+ """Pass :code:`True` if the administrator can delete stories posted by other users; channels only"""
can_manage_topics: Optional[bool] = None
"""Pass :code:`True` if the user is allowed to create, rename, close, and reopen forum topics, supergroups only"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ chat_id: Union[int, str],
+ user_id: int,
+ is_anonymous: Optional[bool] = None,
+ can_manage_chat: Optional[bool] = None,
+ can_delete_messages: Optional[bool] = None,
+ can_manage_video_chats: Optional[bool] = None,
+ can_restrict_members: Optional[bool] = None,
+ can_promote_members: Optional[bool] = None,
+ can_change_info: Optional[bool] = None,
+ can_invite_users: Optional[bool] = None,
+ can_post_messages: Optional[bool] = None,
+ can_edit_messages: Optional[bool] = None,
+ can_pin_messages: Optional[bool] = None,
+ can_post_stories: Optional[bool] = None,
+ can_edit_stories: Optional[bool] = None,
+ can_delete_stories: Optional[bool] = None,
+ can_manage_topics: Optional[bool] = 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,
+ user_id=user_id,
+ is_anonymous=is_anonymous,
+ can_manage_chat=can_manage_chat,
+ can_delete_messages=can_delete_messages,
+ can_manage_video_chats=can_manage_video_chats,
+ can_restrict_members=can_restrict_members,
+ can_promote_members=can_promote_members,
+ can_change_info=can_change_info,
+ can_invite_users=can_invite_users,
+ can_post_messages=can_post_messages,
+ can_edit_messages=can_edit_messages,
+ can_pin_messages=can_pin_messages,
+ can_post_stories=can_post_stories,
+ can_edit_stories=can_edit_stories,
+ can_delete_stories=can_delete_stories,
+ can_manage_topics=can_manage_topics,
+ **__pydantic_kwargs,
+ )
diff --git a/aiogram/methods/reopen_forum_topic.py b/aiogram/methods/reopen_forum_topic.py
index efe1c31d..45eb18d0 100644
--- a/aiogram/methods/reopen_forum_topic.py
+++ b/aiogram/methods/reopen_forum_topic.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Union
+from typing import TYPE_CHECKING, Any, Union
from .base import TelegramMethod
@@ -19,3 +19,22 @@ class ReopenForumTopic(TelegramMethod[bool]):
"""Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)"""
message_thread_id: int
"""Unique identifier for the target message thread of the forum topic"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ chat_id: Union[int, str],
+ message_thread_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__(
+ chat_id=chat_id, message_thread_id=message_thread_id, **__pydantic_kwargs
+ )
diff --git a/aiogram/methods/reopen_general_forum_topic.py b/aiogram/methods/reopen_general_forum_topic.py
index 381278a9..a6dc04e0 100644
--- a/aiogram/methods/reopen_general_forum_topic.py
+++ b/aiogram/methods/reopen_general_forum_topic.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Union
+from typing import TYPE_CHECKING, Any, Union
from .base import TelegramMethod
@@ -17,3 +17,16 @@ class ReopenGeneralForumTopic(TelegramMethod[bool]):
chat_id: Union[int, str]
"""Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)"""
+
+ 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/restrict_chat_member.py b/aiogram/methods/restrict_chat_member.py
index efea2f97..5dfbd01d 100644
--- a/aiogram/methods/restrict_chat_member.py
+++ b/aiogram/methods/restrict_chat_member.py
@@ -1,7 +1,7 @@
from __future__ import annotations
import datetime
-from typing import TYPE_CHECKING, Optional, Union
+from typing import TYPE_CHECKING, Any, Optional, Union
from ..types import ChatPermissions
from .base import TelegramMethod
@@ -26,4 +26,31 @@ class RestrictChatMember(TelegramMethod[bool]):
use_independent_chat_permissions: Optional[bool] = None
"""Pass :code:`True` if chat permissions are set independently. Otherwise, the *can_send_other_messages* and *can_add_web_page_previews* permissions will imply the *can_send_messages*, *can_send_audios*, *can_send_documents*, *can_send_photos*, *can_send_videos*, *can_send_video_notes*, and *can_send_voice_notes* permissions; the *can_send_polls* permission will imply the *can_send_messages* permission."""
until_date: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None
- """Date when restrictions will be lifted for the user, unix time. If user is restricted for more than 366 days or less than 30 seconds from the current time, they are considered to be restricted forever"""
+ """Date when restrictions will be lifted for the user; Unix time. If user is restricted for more than 366 days or less than 30 seconds from the current time, they are considered to be restricted forever"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ chat_id: Union[int, str],
+ user_id: int,
+ permissions: ChatPermissions,
+ use_independent_chat_permissions: Optional[bool] = None,
+ until_date: Optional[Union[datetime.datetime, datetime.timedelta, 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__(
+ chat_id=chat_id,
+ user_id=user_id,
+ permissions=permissions,
+ use_independent_chat_permissions=use_independent_chat_permissions,
+ until_date=until_date,
+ **__pydantic_kwargs,
+ )
diff --git a/aiogram/methods/revoke_chat_invite_link.py b/aiogram/methods/revoke_chat_invite_link.py
index ad31e77d..414feb30 100644
--- a/aiogram/methods/revoke_chat_invite_link.py
+++ b/aiogram/methods/revoke_chat_invite_link.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Union
+from typing import TYPE_CHECKING, Any, Union
from ..types import ChatInviteLink
from .base import TelegramMethod
@@ -20,3 +20,20 @@ class RevokeChatInviteLink(TelegramMethod[ChatInviteLink]):
"""Unique identifier of the target chat or username of the target channel (in the format :code:`@channelusername`)"""
invite_link: str
"""The invite link to revoke"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ chat_id: Union[int, str],
+ invite_link: str,
+ **__pydantic_kwargs: Any,
+ ) -> None:
+ # DO NOT EDIT MANUALLY!!!
+ # This method was auto-generated via `butcher`
+ # Is needed only for type checking and IDE support without any additional plugins
+
+ super().__init__(chat_id=chat_id, invite_link=invite_link, **__pydantic_kwargs)
diff --git a/aiogram/methods/send_animation.py b/aiogram/methods/send_animation.py
index 14029d25..e803b0b1 100644
--- a/aiogram/methods/send_animation.py
+++ b/aiogram/methods/send_animation.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, List, Optional, Union
+from typing import TYPE_CHECKING, Any, List, Optional, Union
from ..types import (
UNSET_PARSE_MODE,
@@ -60,3 +60,54 @@ class SendAnimation(TelegramMethod[Message]):
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove reply keyboard or to force a reply from the user."""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ chat_id: Union[int, str],
+ animation: Union[InputFile, str],
+ message_thread_id: Optional[int] = None,
+ duration: Optional[int] = None,
+ width: Optional[int] = None,
+ height: Optional[int] = None,
+ thumbnail: Optional[Union[InputFile, str]] = None,
+ caption: Optional[str] = None,
+ parse_mode: Optional[str] = UNSET_PARSE_MODE,
+ caption_entities: Optional[List[MessageEntity]] = None,
+ has_spoiler: Optional[bool] = None,
+ disable_notification: Optional[bool] = None,
+ protect_content: Optional[bool] = UNSET_PROTECT_CONTENT,
+ reply_to_message_id: Optional[int] = None,
+ allow_sending_without_reply: Optional[bool] = None,
+ reply_markup: Optional[
+ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
+ ] = 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,
+ animation=animation,
+ message_thread_id=message_thread_id,
+ duration=duration,
+ width=width,
+ height=height,
+ thumbnail=thumbnail,
+ caption=caption,
+ parse_mode=parse_mode,
+ caption_entities=caption_entities,
+ has_spoiler=has_spoiler,
+ disable_notification=disable_notification,
+ protect_content=protect_content,
+ reply_to_message_id=reply_to_message_id,
+ allow_sending_without_reply=allow_sending_without_reply,
+ reply_markup=reply_markup,
+ **__pydantic_kwargs,
+ )
diff --git a/aiogram/methods/send_audio.py b/aiogram/methods/send_audio.py
index e0f4b900..fd6404cb 100644
--- a/aiogram/methods/send_audio.py
+++ b/aiogram/methods/send_audio.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, List, Optional, Union
+from typing import TYPE_CHECKING, Any, List, Optional, Union
from ..types import (
UNSET_PARSE_MODE,
@@ -59,3 +59,52 @@ class SendAudio(TelegramMethod[Message]):
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove reply keyboard or to force a reply from the user."""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ chat_id: Union[int, str],
+ audio: Union[InputFile, str],
+ message_thread_id: Optional[int] = None,
+ caption: Optional[str] = None,
+ parse_mode: Optional[str] = UNSET_PARSE_MODE,
+ caption_entities: Optional[List[MessageEntity]] = None,
+ duration: Optional[int] = None,
+ performer: Optional[str] = None,
+ title: Optional[str] = None,
+ thumbnail: Optional[Union[InputFile, str]] = None,
+ disable_notification: Optional[bool] = None,
+ protect_content: Optional[bool] = UNSET_PROTECT_CONTENT,
+ reply_to_message_id: Optional[int] = None,
+ allow_sending_without_reply: Optional[bool] = None,
+ reply_markup: Optional[
+ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
+ ] = 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,
+ audio=audio,
+ message_thread_id=message_thread_id,
+ caption=caption,
+ parse_mode=parse_mode,
+ caption_entities=caption_entities,
+ duration=duration,
+ performer=performer,
+ title=title,
+ thumbnail=thumbnail,
+ disable_notification=disable_notification,
+ protect_content=protect_content,
+ reply_to_message_id=reply_to_message_id,
+ allow_sending_without_reply=allow_sending_without_reply,
+ reply_markup=reply_markup,
+ **__pydantic_kwargs,
+ )
diff --git a/aiogram/methods/send_chat_action.py b/aiogram/methods/send_chat_action.py
index d21dc68c..8b936ab7 100644
--- a/aiogram/methods/send_chat_action.py
+++ b/aiogram/methods/send_chat_action.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Optional, Union
+from typing import TYPE_CHECKING, Any, Optional, Union
from .base import TelegramMethod
@@ -25,3 +25,26 @@ class SendChatAction(TelegramMethod[bool]):
"""Type of action to broadcast. Choose one, depending on what the user is about to receive: *typing* for `text messages `_, *upload_photo* for `photos `_, *record_video* or *upload_video* for `videos `_, *record_voice* or *upload_voice* for `voice notes `_, *upload_document* for `general files `_, *choose_sticker* for `stickers `_, *find_location* for `location data `_, *record_video_note* or *upload_video_note* for `video notes `_."""
message_thread_id: Optional[int] = None
"""Unique identifier for the target message thread; supergroups only"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ chat_id: Union[int, str],
+ action: str,
+ message_thread_id: 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__(
+ chat_id=chat_id,
+ action=action,
+ message_thread_id=message_thread_id,
+ **__pydantic_kwargs,
+ )
diff --git a/aiogram/methods/send_contact.py b/aiogram/methods/send_contact.py
index 35473338..0053b1ea 100644
--- a/aiogram/methods/send_contact.py
+++ b/aiogram/methods/send_contact.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Optional, Union
+from typing import TYPE_CHECKING, Any, Optional, Union
from ..types import (
ForceReply,
@@ -47,3 +47,44 @@ class SendContact(TelegramMethod[Message]):
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove reply keyboard or to force a reply from the user."""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ chat_id: Union[int, str],
+ phone_number: str,
+ first_name: str,
+ message_thread_id: Optional[int] = None,
+ last_name: Optional[str] = None,
+ vcard: Optional[str] = None,
+ disable_notification: Optional[bool] = None,
+ protect_content: Optional[bool] = UNSET_PROTECT_CONTENT,
+ reply_to_message_id: Optional[int] = None,
+ allow_sending_without_reply: Optional[bool] = None,
+ reply_markup: Optional[
+ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
+ ] = 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,
+ phone_number=phone_number,
+ first_name=first_name,
+ message_thread_id=message_thread_id,
+ last_name=last_name,
+ vcard=vcard,
+ disable_notification=disable_notification,
+ protect_content=protect_content,
+ reply_to_message_id=reply_to_message_id,
+ allow_sending_without_reply=allow_sending_without_reply,
+ reply_markup=reply_markup,
+ **__pydantic_kwargs,
+ )
diff --git a/aiogram/methods/send_dice.py b/aiogram/methods/send_dice.py
index 9fa2ce70..a06442d5 100644
--- a/aiogram/methods/send_dice.py
+++ b/aiogram/methods/send_dice.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Optional, Union
+from typing import TYPE_CHECKING, Any, Optional, Union
from ..types import (
ForceReply,
@@ -41,3 +41,38 @@ class SendDice(TelegramMethod[Message]):
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove reply keyboard or to force a reply from the user."""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ chat_id: Union[int, str],
+ message_thread_id: Optional[int] = None,
+ emoji: Optional[str] = None,
+ disable_notification: Optional[bool] = None,
+ protect_content: Optional[bool] = UNSET_PROTECT_CONTENT,
+ reply_to_message_id: Optional[int] = None,
+ allow_sending_without_reply: Optional[bool] = None,
+ reply_markup: Optional[
+ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
+ ] = 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,
+ message_thread_id=message_thread_id,
+ emoji=emoji,
+ disable_notification=disable_notification,
+ protect_content=protect_content,
+ reply_to_message_id=reply_to_message_id,
+ allow_sending_without_reply=allow_sending_without_reply,
+ reply_markup=reply_markup,
+ **__pydantic_kwargs,
+ )
diff --git a/aiogram/methods/send_document.py b/aiogram/methods/send_document.py
index 5c83beb3..d7ac0e20 100644
--- a/aiogram/methods/send_document.py
+++ b/aiogram/methods/send_document.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, List, Optional, Union
+from typing import TYPE_CHECKING, Any, List, Optional, Union
from ..types import (
UNSET_PARSE_MODE,
@@ -54,3 +54,48 @@ class SendDocument(TelegramMethod[Message]):
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove reply keyboard or to force a reply from the user."""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ chat_id: Union[int, str],
+ document: Union[InputFile, str],
+ message_thread_id: Optional[int] = None,
+ thumbnail: Optional[Union[InputFile, str]] = None,
+ caption: Optional[str] = None,
+ parse_mode: Optional[str] = UNSET_PARSE_MODE,
+ caption_entities: Optional[List[MessageEntity]] = None,
+ disable_content_type_detection: Optional[bool] = None,
+ disable_notification: Optional[bool] = None,
+ protect_content: Optional[bool] = UNSET_PROTECT_CONTENT,
+ reply_to_message_id: Optional[int] = None,
+ allow_sending_without_reply: Optional[bool] = None,
+ reply_markup: Optional[
+ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
+ ] = 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,
+ document=document,
+ message_thread_id=message_thread_id,
+ thumbnail=thumbnail,
+ caption=caption,
+ parse_mode=parse_mode,
+ caption_entities=caption_entities,
+ disable_content_type_detection=disable_content_type_detection,
+ disable_notification=disable_notification,
+ protect_content=protect_content,
+ reply_to_message_id=reply_to_message_id,
+ allow_sending_without_reply=allow_sending_without_reply,
+ reply_markup=reply_markup,
+ **__pydantic_kwargs,
+ )
diff --git a/aiogram/methods/send_game.py b/aiogram/methods/send_game.py
index ab55a459..e7d0e667 100644
--- a/aiogram/methods/send_game.py
+++ b/aiogram/methods/send_game.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Optional
+from typing import TYPE_CHECKING, Any, Optional
from ..types import InlineKeyboardMarkup, Message
from ..types.base import UNSET_PROTECT_CONTENT
@@ -33,3 +33,36 @@ class SendGame(TelegramMethod[Message]):
"""Pass :code:`True` if the message should be sent even if the specified replied-to message is not found"""
reply_markup: Optional[InlineKeyboardMarkup] = None
"""A JSON-serialized object for an `inline keyboard `_. If empty, one 'Play game_title' button will be shown. If not empty, the first button must launch the game."""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ chat_id: int,
+ game_short_name: str,
+ message_thread_id: Optional[int] = None,
+ disable_notification: Optional[bool] = None,
+ protect_content: Optional[bool] = UNSET_PROTECT_CONTENT,
+ reply_to_message_id: Optional[int] = None,
+ allow_sending_without_reply: Optional[bool] = None,
+ reply_markup: Optional[InlineKeyboardMarkup] = 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,
+ game_short_name=game_short_name,
+ message_thread_id=message_thread_id,
+ disable_notification=disable_notification,
+ protect_content=protect_content,
+ reply_to_message_id=reply_to_message_id,
+ allow_sending_without_reply=allow_sending_without_reply,
+ reply_markup=reply_markup,
+ **__pydantic_kwargs,
+ )
diff --git a/aiogram/methods/send_invoice.py b/aiogram/methods/send_invoice.py
index d08002a9..71bed6df 100644
--- a/aiogram/methods/send_invoice.py
+++ b/aiogram/methods/send_invoice.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, List, Optional, Union
+from typing import TYPE_CHECKING, Any, List, Optional, Union
from ..types import InlineKeyboardMarkup, LabeledPrice, Message
from ..types.base import UNSET_PROTECT_CONTENT
@@ -73,3 +73,76 @@ class SendInvoice(TelegramMethod[Message]):
"""Pass :code:`True` if the message should be sent even if the specified replied-to message is not found"""
reply_markup: Optional[InlineKeyboardMarkup] = None
"""A JSON-serialized object for an `inline keyboard `_. If empty, one 'Pay :code:`total price`' button will be shown. If not empty, the first button must be a Pay button."""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ chat_id: Union[int, str],
+ title: str,
+ description: str,
+ payload: str,
+ provider_token: str,
+ currency: str,
+ prices: List[LabeledPrice],
+ message_thread_id: Optional[int] = None,
+ max_tip_amount: Optional[int] = None,
+ suggested_tip_amounts: Optional[List[int]] = None,
+ start_parameter: Optional[str] = None,
+ provider_data: Optional[str] = None,
+ photo_url: Optional[str] = None,
+ photo_size: Optional[int] = None,
+ photo_width: Optional[int] = None,
+ photo_height: Optional[int] = None,
+ need_name: Optional[bool] = None,
+ need_phone_number: Optional[bool] = None,
+ need_email: Optional[bool] = None,
+ need_shipping_address: Optional[bool] = None,
+ send_phone_number_to_provider: Optional[bool] = None,
+ send_email_to_provider: Optional[bool] = None,
+ is_flexible: Optional[bool] = None,
+ disable_notification: Optional[bool] = None,
+ protect_content: Optional[bool] = UNSET_PROTECT_CONTENT,
+ reply_to_message_id: Optional[int] = None,
+ allow_sending_without_reply: Optional[bool] = None,
+ reply_markup: Optional[InlineKeyboardMarkup] = 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,
+ title=title,
+ description=description,
+ payload=payload,
+ provider_token=provider_token,
+ currency=currency,
+ prices=prices,
+ message_thread_id=message_thread_id,
+ max_tip_amount=max_tip_amount,
+ suggested_tip_amounts=suggested_tip_amounts,
+ start_parameter=start_parameter,
+ provider_data=provider_data,
+ photo_url=photo_url,
+ photo_size=photo_size,
+ photo_width=photo_width,
+ photo_height=photo_height,
+ need_name=need_name,
+ need_phone_number=need_phone_number,
+ need_email=need_email,
+ need_shipping_address=need_shipping_address,
+ send_phone_number_to_provider=send_phone_number_to_provider,
+ send_email_to_provider=send_email_to_provider,
+ is_flexible=is_flexible,
+ disable_notification=disable_notification,
+ protect_content=protect_content,
+ reply_to_message_id=reply_to_message_id,
+ allow_sending_without_reply=allow_sending_without_reply,
+ reply_markup=reply_markup,
+ **__pydantic_kwargs,
+ )
diff --git a/aiogram/methods/send_location.py b/aiogram/methods/send_location.py
index 845b4741..4eac028c 100644
--- a/aiogram/methods/send_location.py
+++ b/aiogram/methods/send_location.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Optional, Union
+from typing import TYPE_CHECKING, Any, Optional, Union
from ..types import (
ForceReply,
@@ -51,3 +51,48 @@ class SendLocation(TelegramMethod[Message]):
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove reply keyboard or to force a reply from the user."""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ chat_id: Union[int, str],
+ latitude: float,
+ longitude: float,
+ message_thread_id: Optional[int] = None,
+ horizontal_accuracy: Optional[float] = None,
+ live_period: Optional[int] = None,
+ heading: Optional[int] = None,
+ proximity_alert_radius: Optional[int] = None,
+ disable_notification: Optional[bool] = None,
+ protect_content: Optional[bool] = UNSET_PROTECT_CONTENT,
+ reply_to_message_id: Optional[int] = None,
+ allow_sending_without_reply: Optional[bool] = None,
+ reply_markup: Optional[
+ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
+ ] = 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,
+ latitude=latitude,
+ longitude=longitude,
+ message_thread_id=message_thread_id,
+ horizontal_accuracy=horizontal_accuracy,
+ live_period=live_period,
+ heading=heading,
+ proximity_alert_radius=proximity_alert_radius,
+ disable_notification=disable_notification,
+ protect_content=protect_content,
+ reply_to_message_id=reply_to_message_id,
+ allow_sending_without_reply=allow_sending_without_reply,
+ reply_markup=reply_markup,
+ **__pydantic_kwargs,
+ )
diff --git a/aiogram/methods/send_media_group.py b/aiogram/methods/send_media_group.py
index fd8dbb25..3fa31852 100644
--- a/aiogram/methods/send_media_group.py
+++ b/aiogram/methods/send_media_group.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, List, Optional, Union
+from typing import TYPE_CHECKING, Any, List, Optional, Union
from ..types import (
InputMediaAudio,
@@ -37,3 +37,36 @@ class SendMediaGroup(TelegramMethod[List[Message]]):
"""If the messages are a reply, ID of the original message"""
allow_sending_without_reply: Optional[bool] = None
"""Pass :code:`True` if the message should be sent even if the specified replied-to message is not found"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ chat_id: Union[int, str],
+ media: List[
+ Union[InputMediaAudio, InputMediaDocument, InputMediaPhoto, InputMediaVideo]
+ ],
+ message_thread_id: Optional[int] = None,
+ disable_notification: Optional[bool] = None,
+ protect_content: Optional[bool] = UNSET_PROTECT_CONTENT,
+ reply_to_message_id: Optional[int] = None,
+ allow_sending_without_reply: Optional[bool] = 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,
+ media=media,
+ message_thread_id=message_thread_id,
+ disable_notification=disable_notification,
+ protect_content=protect_content,
+ reply_to_message_id=reply_to_message_id,
+ allow_sending_without_reply=allow_sending_without_reply,
+ **__pydantic_kwargs,
+ )
diff --git a/aiogram/methods/send_message.py b/aiogram/methods/send_message.py
index 9b7dae7b..8e33687c 100644
--- a/aiogram/methods/send_message.py
+++ b/aiogram/methods/send_message.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, List, Optional, Union
+from typing import TYPE_CHECKING, Any, List, Optional, Union
from ..types import (
UNSET_PARSE_MODE,
@@ -49,3 +49,44 @@ class SendMessage(TelegramMethod[Message]):
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove reply keyboard or to force a reply from the user."""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ chat_id: Union[int, str],
+ text: str,
+ message_thread_id: Optional[int] = None,
+ parse_mode: Optional[str] = UNSET_PARSE_MODE,
+ entities: Optional[List[MessageEntity]] = None,
+ disable_web_page_preview: Optional[bool] = UNSET_DISABLE_WEB_PAGE_PREVIEW,
+ disable_notification: Optional[bool] = None,
+ protect_content: Optional[bool] = UNSET_PROTECT_CONTENT,
+ reply_to_message_id: Optional[int] = None,
+ allow_sending_without_reply: Optional[bool] = None,
+ reply_markup: Optional[
+ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
+ ] = 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,
+ text=text,
+ message_thread_id=message_thread_id,
+ parse_mode=parse_mode,
+ entities=entities,
+ disable_web_page_preview=disable_web_page_preview,
+ disable_notification=disable_notification,
+ protect_content=protect_content,
+ reply_to_message_id=reply_to_message_id,
+ allow_sending_without_reply=allow_sending_without_reply,
+ reply_markup=reply_markup,
+ **__pydantic_kwargs,
+ )
diff --git a/aiogram/methods/send_photo.py b/aiogram/methods/send_photo.py
index 236d8710..521b2b70 100644
--- a/aiogram/methods/send_photo.py
+++ b/aiogram/methods/send_photo.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, List, Optional, Union
+from typing import TYPE_CHECKING, Any, List, Optional, Union
from ..types import (
UNSET_PARSE_MODE,
@@ -52,3 +52,46 @@ class SendPhoto(TelegramMethod[Message]):
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove reply keyboard or to force a reply from the user."""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ chat_id: Union[int, str],
+ photo: Union[InputFile, str],
+ message_thread_id: Optional[int] = None,
+ caption: Optional[str] = None,
+ parse_mode: Optional[str] = UNSET_PARSE_MODE,
+ caption_entities: Optional[List[MessageEntity]] = None,
+ has_spoiler: Optional[bool] = None,
+ disable_notification: Optional[bool] = None,
+ protect_content: Optional[bool] = UNSET_PROTECT_CONTENT,
+ reply_to_message_id: Optional[int] = None,
+ allow_sending_without_reply: Optional[bool] = None,
+ reply_markup: Optional[
+ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
+ ] = 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,
+ photo=photo,
+ message_thread_id=message_thread_id,
+ caption=caption,
+ parse_mode=parse_mode,
+ caption_entities=caption_entities,
+ has_spoiler=has_spoiler,
+ disable_notification=disable_notification,
+ protect_content=protect_content,
+ reply_to_message_id=reply_to_message_id,
+ allow_sending_without_reply=allow_sending_without_reply,
+ reply_markup=reply_markup,
+ **__pydantic_kwargs,
+ )
diff --git a/aiogram/methods/send_poll.py b/aiogram/methods/send_poll.py
index fca3dc58..f67ca805 100644
--- a/aiogram/methods/send_poll.py
+++ b/aiogram/methods/send_poll.py
@@ -1,7 +1,7 @@
from __future__ import annotations
import datetime
-from typing import TYPE_CHECKING, List, Optional, Union
+from typing import TYPE_CHECKING, Any, List, Optional, Union
from ..types import (
UNSET_PARSE_MODE,
@@ -66,3 +66,60 @@ class SendPoll(TelegramMethod[Message]):
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove reply keyboard or to force a reply from the user."""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ chat_id: Union[int, str],
+ question: str,
+ options: List[str],
+ message_thread_id: Optional[int] = None,
+ is_anonymous: Optional[bool] = None,
+ type: Optional[str] = None,
+ allows_multiple_answers: Optional[bool] = None,
+ correct_option_id: Optional[int] = None,
+ explanation: Optional[str] = None,
+ explanation_parse_mode: Optional[str] = UNSET_PARSE_MODE,
+ explanation_entities: Optional[List[MessageEntity]] = None,
+ open_period: Optional[int] = None,
+ close_date: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None,
+ is_closed: Optional[bool] = None,
+ disable_notification: Optional[bool] = None,
+ protect_content: Optional[bool] = UNSET_PROTECT_CONTENT,
+ reply_to_message_id: Optional[int] = None,
+ allow_sending_without_reply: Optional[bool] = None,
+ reply_markup: Optional[
+ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
+ ] = 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,
+ question=question,
+ options=options,
+ message_thread_id=message_thread_id,
+ is_anonymous=is_anonymous,
+ type=type,
+ allows_multiple_answers=allows_multiple_answers,
+ correct_option_id=correct_option_id,
+ explanation=explanation,
+ explanation_parse_mode=explanation_parse_mode,
+ explanation_entities=explanation_entities,
+ open_period=open_period,
+ close_date=close_date,
+ is_closed=is_closed,
+ disable_notification=disable_notification,
+ protect_content=protect_content,
+ reply_to_message_id=reply_to_message_id,
+ allow_sending_without_reply=allow_sending_without_reply,
+ reply_markup=reply_markup,
+ **__pydantic_kwargs,
+ )
diff --git a/aiogram/methods/send_sticker.py b/aiogram/methods/send_sticker.py
index 8429b105..6e270024 100644
--- a/aiogram/methods/send_sticker.py
+++ b/aiogram/methods/send_sticker.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Optional, Union
+from typing import TYPE_CHECKING, Any, Optional, Union
from ..types import (
ForceReply,
@@ -44,3 +44,40 @@ class SendSticker(TelegramMethod[Message]):
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove reply keyboard or to force a reply from the user."""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ chat_id: Union[int, str],
+ sticker: Union[InputFile, str],
+ message_thread_id: Optional[int] = None,
+ emoji: Optional[str] = None,
+ disable_notification: Optional[bool] = None,
+ protect_content: Optional[bool] = UNSET_PROTECT_CONTENT,
+ reply_to_message_id: Optional[int] = None,
+ allow_sending_without_reply: Optional[bool] = None,
+ reply_markup: Optional[
+ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
+ ] = 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,
+ sticker=sticker,
+ message_thread_id=message_thread_id,
+ emoji=emoji,
+ disable_notification=disable_notification,
+ protect_content=protect_content,
+ reply_to_message_id=reply_to_message_id,
+ allow_sending_without_reply=allow_sending_without_reply,
+ reply_markup=reply_markup,
+ **__pydantic_kwargs,
+ )
diff --git a/aiogram/methods/send_venue.py b/aiogram/methods/send_venue.py
index d0859770..85137d42 100644
--- a/aiogram/methods/send_venue.py
+++ b/aiogram/methods/send_venue.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Optional, Union
+from typing import TYPE_CHECKING, Any, Optional, Union
from ..types import (
ForceReply,
@@ -55,3 +55,52 @@ class SendVenue(TelegramMethod[Message]):
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove reply keyboard or to force a reply from the user."""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ chat_id: Union[int, str],
+ latitude: float,
+ longitude: float,
+ title: str,
+ address: str,
+ message_thread_id: Optional[int] = None,
+ foursquare_id: Optional[str] = None,
+ foursquare_type: Optional[str] = None,
+ google_place_id: Optional[str] = None,
+ google_place_type: Optional[str] = None,
+ disable_notification: Optional[bool] = None,
+ protect_content: Optional[bool] = UNSET_PROTECT_CONTENT,
+ reply_to_message_id: Optional[int] = None,
+ allow_sending_without_reply: Optional[bool] = None,
+ reply_markup: Optional[
+ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
+ ] = 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,
+ latitude=latitude,
+ longitude=longitude,
+ title=title,
+ address=address,
+ message_thread_id=message_thread_id,
+ foursquare_id=foursquare_id,
+ foursquare_type=foursquare_type,
+ google_place_id=google_place_id,
+ google_place_type=google_place_type,
+ disable_notification=disable_notification,
+ protect_content=protect_content,
+ reply_to_message_id=reply_to_message_id,
+ allow_sending_without_reply=allow_sending_without_reply,
+ reply_markup=reply_markup,
+ **__pydantic_kwargs,
+ )
diff --git a/aiogram/methods/send_video.py b/aiogram/methods/send_video.py
index a894e335..c61a8c92 100644
--- a/aiogram/methods/send_video.py
+++ b/aiogram/methods/send_video.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, List, Optional, Union
+from typing import TYPE_CHECKING, Any, List, Optional, Union
from ..types import (
UNSET_PARSE_MODE,
@@ -62,3 +62,56 @@ class SendVideo(TelegramMethod[Message]):
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove reply keyboard or to force a reply from the user."""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ chat_id: Union[int, str],
+ video: Union[InputFile, str],
+ message_thread_id: Optional[int] = None,
+ duration: Optional[int] = None,
+ width: Optional[int] = None,
+ height: Optional[int] = None,
+ thumbnail: Optional[Union[InputFile, str]] = None,
+ caption: Optional[str] = None,
+ parse_mode: Optional[str] = UNSET_PARSE_MODE,
+ caption_entities: Optional[List[MessageEntity]] = None,
+ has_spoiler: Optional[bool] = None,
+ supports_streaming: Optional[bool] = None,
+ disable_notification: Optional[bool] = None,
+ protect_content: Optional[bool] = UNSET_PROTECT_CONTENT,
+ reply_to_message_id: Optional[int] = None,
+ allow_sending_without_reply: Optional[bool] = None,
+ reply_markup: Optional[
+ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
+ ] = 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,
+ video=video,
+ message_thread_id=message_thread_id,
+ duration=duration,
+ width=width,
+ height=height,
+ thumbnail=thumbnail,
+ caption=caption,
+ parse_mode=parse_mode,
+ caption_entities=caption_entities,
+ has_spoiler=has_spoiler,
+ supports_streaming=supports_streaming,
+ disable_notification=disable_notification,
+ protect_content=protect_content,
+ reply_to_message_id=reply_to_message_id,
+ allow_sending_without_reply=allow_sending_without_reply,
+ reply_markup=reply_markup,
+ **__pydantic_kwargs,
+ )
diff --git a/aiogram/methods/send_video_note.py b/aiogram/methods/send_video_note.py
index 761c91a2..235134dd 100644
--- a/aiogram/methods/send_video_note.py
+++ b/aiogram/methods/send_video_note.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Optional, Union
+from typing import TYPE_CHECKING, Any, Optional, Union
from ..types import (
ForceReply,
@@ -48,3 +48,44 @@ class SendVideoNote(TelegramMethod[Message]):
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove reply keyboard or to force a reply from the user."""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ chat_id: Union[int, str],
+ video_note: Union[InputFile, str],
+ message_thread_id: Optional[int] = None,
+ duration: Optional[int] = None,
+ length: Optional[int] = None,
+ thumbnail: Optional[Union[InputFile, str]] = None,
+ disable_notification: Optional[bool] = None,
+ protect_content: Optional[bool] = UNSET_PROTECT_CONTENT,
+ reply_to_message_id: Optional[int] = None,
+ allow_sending_without_reply: Optional[bool] = None,
+ reply_markup: Optional[
+ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
+ ] = 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,
+ video_note=video_note,
+ message_thread_id=message_thread_id,
+ duration=duration,
+ length=length,
+ thumbnail=thumbnail,
+ disable_notification=disable_notification,
+ protect_content=protect_content,
+ reply_to_message_id=reply_to_message_id,
+ allow_sending_without_reply=allow_sending_without_reply,
+ reply_markup=reply_markup,
+ **__pydantic_kwargs,
+ )
diff --git a/aiogram/methods/send_voice.py b/aiogram/methods/send_voice.py
index ae692ad6..24fd86e2 100644
--- a/aiogram/methods/send_voice.py
+++ b/aiogram/methods/send_voice.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, List, Optional, Union
+from typing import TYPE_CHECKING, Any, List, Optional, Union
from ..types import (
UNSET_PARSE_MODE,
@@ -52,3 +52,46 @@ class SendVoice(TelegramMethod[Message]):
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove reply keyboard or to force a reply from the user."""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ chat_id: Union[int, str],
+ voice: Union[InputFile, str],
+ message_thread_id: Optional[int] = None,
+ caption: Optional[str] = None,
+ parse_mode: Optional[str] = UNSET_PARSE_MODE,
+ caption_entities: Optional[List[MessageEntity]] = None,
+ duration: Optional[int] = None,
+ disable_notification: Optional[bool] = None,
+ protect_content: Optional[bool] = UNSET_PROTECT_CONTENT,
+ reply_to_message_id: Optional[int] = None,
+ allow_sending_without_reply: Optional[bool] = None,
+ reply_markup: Optional[
+ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
+ ] = 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,
+ voice=voice,
+ message_thread_id=message_thread_id,
+ caption=caption,
+ parse_mode=parse_mode,
+ caption_entities=caption_entities,
+ duration=duration,
+ disable_notification=disable_notification,
+ protect_content=protect_content,
+ reply_to_message_id=reply_to_message_id,
+ allow_sending_without_reply=allow_sending_without_reply,
+ reply_markup=reply_markup,
+ **__pydantic_kwargs,
+ )
diff --git a/aiogram/methods/set_chat_administrator_custom_title.py b/aiogram/methods/set_chat_administrator_custom_title.py
index edf79d8c..a7953c12 100644
--- a/aiogram/methods/set_chat_administrator_custom_title.py
+++ b/aiogram/methods/set_chat_administrator_custom_title.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Union
+from typing import TYPE_CHECKING, Any, Union
from .base import TelegramMethod
@@ -21,3 +21,23 @@ class SetChatAdministratorCustomTitle(TelegramMethod[bool]):
"""Unique identifier of the target user"""
custom_title: str
"""New custom title for the administrator; 0-16 characters, emoji are not allowed"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ chat_id: Union[int, str],
+ user_id: int,
+ custom_title: 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, user_id=user_id, custom_title=custom_title, **__pydantic_kwargs
+ )
diff --git a/aiogram/methods/set_chat_description.py b/aiogram/methods/set_chat_description.py
index 05b51a69..0f8a4a4b 100644
--- a/aiogram/methods/set_chat_description.py
+++ b/aiogram/methods/set_chat_description.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Optional, Union
+from typing import TYPE_CHECKING, Any, Optional, Union
from .base import TelegramMethod
@@ -19,3 +19,20 @@ class SetChatDescription(TelegramMethod[bool]):
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
description: Optional[str] = None
"""New chat description, 0-255 characters"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ chat_id: Union[int, str],
+ 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, description=description, **__pydantic_kwargs)
diff --git a/aiogram/methods/set_chat_menu_button.py b/aiogram/methods/set_chat_menu_button.py
index 6eeb3a10..97515d5a 100644
--- a/aiogram/methods/set_chat_menu_button.py
+++ b/aiogram/methods/set_chat_menu_button.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Optional, Union
+from typing import TYPE_CHECKING, Any, Optional, Union
from ..types import MenuButtonCommands, MenuButtonDefault, MenuButtonWebApp
from .base import TelegramMethod
@@ -18,5 +18,24 @@ class SetChatMenuButton(TelegramMethod[bool]):
chat_id: Optional[int] = None
"""Unique identifier for the target private chat. If not specified, default bot's menu button will be changed"""
- menu_button: Optional[Union[MenuButtonDefault, MenuButtonWebApp, MenuButtonCommands]] = None
+ menu_button: Optional[Union[MenuButtonCommands, MenuButtonWebApp, MenuButtonDefault]] = None
"""A JSON-serialized object for the bot's new menu button. Defaults to :class:`aiogram.types.menu_button_default.MenuButtonDefault`"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ chat_id: Optional[int] = None,
+ menu_button: Optional[
+ Union[MenuButtonCommands, MenuButtonWebApp, MenuButtonDefault]
+ ] = 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, menu_button=menu_button, **__pydantic_kwargs)
diff --git a/aiogram/methods/set_chat_permissions.py b/aiogram/methods/set_chat_permissions.py
index af13ddb7..232af08c 100644
--- a/aiogram/methods/set_chat_permissions.py
+++ b/aiogram/methods/set_chat_permissions.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Optional, Union
+from typing import TYPE_CHECKING, Any, Optional, Union
from ..types import ChatPermissions
from .base import TelegramMethod
@@ -22,3 +22,26 @@ class SetChatPermissions(TelegramMethod[bool]):
"""A JSON-serialized object for new default chat permissions"""
use_independent_chat_permissions: Optional[bool] = None
"""Pass :code:`True` if chat permissions are set independently. Otherwise, the *can_send_other_messages* and *can_add_web_page_previews* permissions will imply the *can_send_messages*, *can_send_audios*, *can_send_documents*, *can_send_photos*, *can_send_videos*, *can_send_video_notes*, and *can_send_voice_notes* permissions; the *can_send_polls* permission will imply the *can_send_messages* permission."""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ chat_id: Union[int, str],
+ permissions: ChatPermissions,
+ use_independent_chat_permissions: Optional[bool] = 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,
+ permissions=permissions,
+ use_independent_chat_permissions=use_independent_chat_permissions,
+ **__pydantic_kwargs,
+ )
diff --git a/aiogram/methods/set_chat_photo.py b/aiogram/methods/set_chat_photo.py
index ba7b8de3..105f8f87 100644
--- a/aiogram/methods/set_chat_photo.py
+++ b/aiogram/methods/set_chat_photo.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Union
+from typing import TYPE_CHECKING, Any, Union
from ..types import InputFile
from .base import TelegramMethod
@@ -20,3 +20,20 @@ class SetChatPhoto(TelegramMethod[bool]):
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
photo: InputFile
"""New chat photo, uploaded using multipart/form-data"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ chat_id: Union[int, str],
+ photo: InputFile,
+ **__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, photo=photo, **__pydantic_kwargs)
diff --git a/aiogram/methods/set_chat_sticker_set.py b/aiogram/methods/set_chat_sticker_set.py
index a7f3d216..62ed5d18 100644
--- a/aiogram/methods/set_chat_sticker_set.py
+++ b/aiogram/methods/set_chat_sticker_set.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Union
+from typing import TYPE_CHECKING, Any, Union
from .base import TelegramMethod
@@ -19,3 +19,22 @@ class SetChatStickerSet(TelegramMethod[bool]):
"""Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)"""
sticker_set_name: str
"""Name of the sticker set to be set as the group sticker set"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ chat_id: Union[int, str],
+ sticker_set_name: 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, sticker_set_name=sticker_set_name, **__pydantic_kwargs
+ )
diff --git a/aiogram/methods/set_chat_title.py b/aiogram/methods/set_chat_title.py
index 07507d0f..04b52e09 100644
--- a/aiogram/methods/set_chat_title.py
+++ b/aiogram/methods/set_chat_title.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Union
+from typing import TYPE_CHECKING, Any, Union
from .base import TelegramMethod
@@ -19,3 +19,16 @@ class SetChatTitle(TelegramMethod[bool]):
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
title: str
"""New chat title, 1-128 characters"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__, *, chat_id: Union[int, str], title: 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, title=title, **__pydantic_kwargs)
diff --git a/aiogram/methods/set_custom_emoji_sticker_set_thumbnail.py b/aiogram/methods/set_custom_emoji_sticker_set_thumbnail.py
index 10a4a267..47e9c033 100644
--- a/aiogram/methods/set_custom_emoji_sticker_set_thumbnail.py
+++ b/aiogram/methods/set_custom_emoji_sticker_set_thumbnail.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Optional
+from typing import TYPE_CHECKING, Any, Optional
from .base import TelegramMethod
@@ -19,3 +19,20 @@ class SetCustomEmojiStickerSetThumbnail(TelegramMethod[bool]):
"""Sticker set name"""
custom_emoji_id: Optional[str] = None
"""Custom emoji identifier of a sticker from the sticker set; pass an empty string to drop the thumbnail and use the first sticker as the thumbnail."""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ name: str,
+ custom_emoji_id: 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__(name=name, custom_emoji_id=custom_emoji_id, **__pydantic_kwargs)
diff --git a/aiogram/methods/set_game_score.py b/aiogram/methods/set_game_score.py
index 170988ec..38e5374f 100644
--- a/aiogram/methods/set_game_score.py
+++ b/aiogram/methods/set_game_score.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Optional, Union
+from typing import TYPE_CHECKING, Any, Optional, Union
from ..types import Message
from .base import TelegramMethod
@@ -30,3 +30,34 @@ class SetGameScore(TelegramMethod[Union[Message, bool]]):
"""Required if *inline_message_id* is not specified. Identifier of the sent message"""
inline_message_id: Optional[str] = None
"""Required if *chat_id* and *message_id* are not specified. Identifier of the inline message"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ user_id: int,
+ score: int,
+ force: Optional[bool] = None,
+ disable_edit_message: Optional[bool] = None,
+ chat_id: Optional[int] = None,
+ message_id: Optional[int] = None,
+ inline_message_id: 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,
+ score=score,
+ force=force,
+ disable_edit_message=disable_edit_message,
+ chat_id=chat_id,
+ message_id=message_id,
+ inline_message_id=inline_message_id,
+ **__pydantic_kwargs,
+ )
diff --git a/aiogram/methods/set_my_commands.py b/aiogram/methods/set_my_commands.py
index a62e7a84..2e52771f 100644
--- a/aiogram/methods/set_my_commands.py
+++ b/aiogram/methods/set_my_commands.py
@@ -1,8 +1,17 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, List, Optional
+from typing import TYPE_CHECKING, Any, List, Optional, Union
-from ..types import BotCommand, BotCommandScope
+from ..types import (
+ BotCommand,
+ BotCommandScopeAllChatAdministrators,
+ BotCommandScopeAllGroupChats,
+ BotCommandScopeAllPrivateChats,
+ BotCommandScopeChat,
+ BotCommandScopeChatAdministrators,
+ BotCommandScopeChatMember,
+ BotCommandScopeDefault,
+)
from .base import TelegramMethod
@@ -18,7 +27,47 @@ class SetMyCommands(TelegramMethod[bool]):
commands: List[BotCommand]
"""A JSON-serialized list of bot commands to be set as the list of the bot's commands. At most 100 commands can be specified."""
- scope: Optional[BotCommandScope] = None
+ scope: Optional[
+ Union[
+ BotCommandScopeDefault,
+ BotCommandScopeAllPrivateChats,
+ BotCommandScopeAllGroupChats,
+ BotCommandScopeAllChatAdministrators,
+ BotCommandScopeChat,
+ BotCommandScopeChatAdministrators,
+ BotCommandScopeChatMember,
+ ]
+ ] = None
"""A JSON-serialized object, describing scope of users for which the commands are relevant. Defaults to :class:`aiogram.types.bot_command_scope_default.BotCommandScopeDefault`."""
language_code: Optional[str] = None
"""A two-letter ISO 639-1 language code. If empty, commands will be applied to all users from the given scope, for whose language there are no dedicated commands"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ commands: List[BotCommand],
+ scope: Optional[
+ Union[
+ BotCommandScopeDefault,
+ BotCommandScopeAllPrivateChats,
+ BotCommandScopeAllGroupChats,
+ BotCommandScopeAllChatAdministrators,
+ BotCommandScopeChat,
+ BotCommandScopeChatAdministrators,
+ BotCommandScopeChatMember,
+ ]
+ ] = None,
+ language_code: 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__(
+ commands=commands, scope=scope, language_code=language_code, **__pydantic_kwargs
+ )
diff --git a/aiogram/methods/set_my_default_administrator_rights.py b/aiogram/methods/set_my_default_administrator_rights.py
index 0b1468bc..02aa7ada 100644
--- a/aiogram/methods/set_my_default_administrator_rights.py
+++ b/aiogram/methods/set_my_default_administrator_rights.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Optional
+from typing import TYPE_CHECKING, Any, Optional
from ..types import ChatAdministratorRights
from .base import TelegramMethod
@@ -20,3 +20,20 @@ class SetMyDefaultAdministratorRights(TelegramMethod[bool]):
"""A JSON-serialized object describing new default administrator rights. If not specified, the default administrator rights will be cleared."""
for_channels: Optional[bool] = None
"""Pass :code:`True` to change the default administrator rights of the bot in channels. Otherwise, the default administrator rights of the bot for groups and supergroups will be changed."""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ rights: Optional[ChatAdministratorRights] = None,
+ for_channels: Optional[bool] = 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__(rights=rights, for_channels=for_channels, **__pydantic_kwargs)
diff --git a/aiogram/methods/set_my_description.py b/aiogram/methods/set_my_description.py
index 2af2ed44..ee192c88 100644
--- a/aiogram/methods/set_my_description.py
+++ b/aiogram/methods/set_my_description.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Optional
+from typing import TYPE_CHECKING, Any, Optional
from .base import TelegramMethod
@@ -19,3 +19,22 @@ class SetMyDescription(TelegramMethod[bool]):
"""New bot description; 0-512 characters. Pass an empty string to remove the dedicated description for the given language."""
language_code: Optional[str] = None
"""A two-letter ISO 639-1 language code. If empty, the description will be applied to all users for whose language there is no dedicated description."""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ description: Optional[str] = None,
+ language_code: 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__(
+ description=description, language_code=language_code, **__pydantic_kwargs
+ )
diff --git a/aiogram/methods/set_my_name.py b/aiogram/methods/set_my_name.py
index 9b392281..3633fdc8 100644
--- a/aiogram/methods/set_my_name.py
+++ b/aiogram/methods/set_my_name.py
@@ -1,4 +1,4 @@
-from typing import Optional
+from typing import TYPE_CHECKING, Any, Optional
from .base import TelegramMethod
@@ -17,3 +17,20 @@ class SetMyName(TelegramMethod[bool]):
"""New bot name; 0-64 characters. Pass an empty string to remove the dedicated name for the given language."""
language_code: Optional[str] = None
"""A two-letter ISO 639-1 language code. If empty, the name will be shown to all users for whose language there is no dedicated name."""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ name: Optional[str] = None,
+ language_code: 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__(name=name, language_code=language_code, **__pydantic_kwargs)
diff --git a/aiogram/methods/set_my_short_description.py b/aiogram/methods/set_my_short_description.py
index 19e5b254..22fa5817 100644
--- a/aiogram/methods/set_my_short_description.py
+++ b/aiogram/methods/set_my_short_description.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Optional
+from typing import TYPE_CHECKING, Any, Optional
from .base import TelegramMethod
@@ -19,3 +19,24 @@ class SetMyShortDescription(TelegramMethod[bool]):
"""New short description for the bot; 0-120 characters. Pass an empty string to remove the dedicated short description for the given language."""
language_code: Optional[str] = None
"""A two-letter ISO 639-1 language code. If empty, the short description will be applied to all users for whose language there is no dedicated short description."""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ short_description: Optional[str] = None,
+ language_code: 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__(
+ short_description=short_description,
+ language_code=language_code,
+ **__pydantic_kwargs,
+ )
diff --git a/aiogram/methods/set_passport_data_errors.py b/aiogram/methods/set_passport_data_errors.py
index ae127d2b..0ad7e8bb 100644
--- a/aiogram/methods/set_passport_data_errors.py
+++ b/aiogram/methods/set_passport_data_errors.py
@@ -1,8 +1,18 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, List
+from typing import TYPE_CHECKING, Any, List, Union
-from ..types import PassportElementError
+from ..types import (
+ PassportElementErrorDataField,
+ PassportElementErrorFile,
+ PassportElementErrorFiles,
+ PassportElementErrorFrontSide,
+ PassportElementErrorReverseSide,
+ PassportElementErrorSelfie,
+ PassportElementErrorTranslationFile,
+ PassportElementErrorTranslationFiles,
+ PassportElementErrorUnspecified,
+)
from .base import TelegramMethod
@@ -19,5 +29,46 @@ class SetPassportDataErrors(TelegramMethod[bool]):
user_id: int
"""User identifier"""
- errors: List[PassportElementError]
+ errors: List[
+ Union[
+ PassportElementErrorDataField,
+ PassportElementErrorFrontSide,
+ PassportElementErrorReverseSide,
+ PassportElementErrorSelfie,
+ PassportElementErrorFile,
+ PassportElementErrorFiles,
+ PassportElementErrorTranslationFile,
+ PassportElementErrorTranslationFiles,
+ PassportElementErrorUnspecified,
+ ]
+ ]
"""A JSON-serialized array describing the errors"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ user_id: int,
+ errors: List[
+ Union[
+ PassportElementErrorDataField,
+ PassportElementErrorFrontSide,
+ PassportElementErrorReverseSide,
+ PassportElementErrorSelfie,
+ PassportElementErrorFile,
+ PassportElementErrorFiles,
+ PassportElementErrorTranslationFile,
+ PassportElementErrorTranslationFiles,
+ PassportElementErrorUnspecified,
+ ]
+ ],
+ **__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, errors=errors, **__pydantic_kwargs)
diff --git a/aiogram/methods/set_sticker_emoji_list.py b/aiogram/methods/set_sticker_emoji_list.py
index f23033c7..ac268c1e 100644
--- a/aiogram/methods/set_sticker_emoji_list.py
+++ b/aiogram/methods/set_sticker_emoji_list.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, List
+from typing import TYPE_CHECKING, Any, List
from .base import TelegramMethod
@@ -19,3 +19,16 @@ class SetStickerEmojiList(TelegramMethod[bool]):
"""File identifier of the sticker"""
emoji_list: List[str]
"""A JSON-serialized list of 1-20 emoji associated with the sticker"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__, *, sticker: str, emoji_list: List[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__(sticker=sticker, emoji_list=emoji_list, **__pydantic_kwargs)
diff --git a/aiogram/methods/set_sticker_keywords.py b/aiogram/methods/set_sticker_keywords.py
index 0ebef118..49e68f85 100644
--- a/aiogram/methods/set_sticker_keywords.py
+++ b/aiogram/methods/set_sticker_keywords.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, List, Optional
+from typing import TYPE_CHECKING, Any, List, Optional
from .base import TelegramMethod
@@ -19,3 +19,20 @@ class SetStickerKeywords(TelegramMethod[bool]):
"""File identifier of the sticker"""
keywords: Optional[List[str]] = None
"""A JSON-serialized list of 0-20 search keywords for the sticker with total length of up to 64 characters"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ sticker: str,
+ keywords: Optional[List[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__(sticker=sticker, keywords=keywords, **__pydantic_kwargs)
diff --git a/aiogram/methods/set_sticker_mask_position.py b/aiogram/methods/set_sticker_mask_position.py
index f3147f2d..617e48b5 100644
--- a/aiogram/methods/set_sticker_mask_position.py
+++ b/aiogram/methods/set_sticker_mask_position.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Optional
+from typing import TYPE_CHECKING, Any, Optional
from ..types import MaskPosition
from .base import TelegramMethod
@@ -20,3 +20,20 @@ class SetStickerMaskPosition(TelegramMethod[bool]):
"""File identifier of the sticker"""
mask_position: Optional[MaskPosition] = None
"""A JSON-serialized object with the position where the mask should be placed on faces. Omit the parameter to remove the mask position."""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ sticker: str,
+ mask_position: Optional[MaskPosition] = 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__(sticker=sticker, mask_position=mask_position, **__pydantic_kwargs)
diff --git a/aiogram/methods/set_sticker_position_in_set.py b/aiogram/methods/set_sticker_position_in_set.py
index ed5792ae..8d30eab1 100644
--- a/aiogram/methods/set_sticker_position_in_set.py
+++ b/aiogram/methods/set_sticker_position_in_set.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING
+from typing import TYPE_CHECKING, Any
from .base import TelegramMethod
@@ -19,3 +19,16 @@ class SetStickerPositionInSet(TelegramMethod[bool]):
"""File identifier of the sticker"""
position: int
"""New sticker position in the set, zero-based"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__, *, sticker: str, position: 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__(sticker=sticker, position=position, **__pydantic_kwargs)
diff --git a/aiogram/methods/set_sticker_set_thumbnail.py b/aiogram/methods/set_sticker_set_thumbnail.py
index 7da1c397..6536d298 100644
--- a/aiogram/methods/set_sticker_set_thumbnail.py
+++ b/aiogram/methods/set_sticker_set_thumbnail.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Optional, Union
+from typing import TYPE_CHECKING, Any, Optional, Union
from ..types import InputFile
from .base import TelegramMethod
@@ -22,3 +22,21 @@ class SetStickerSetThumbnail(TelegramMethod[bool]):
"""User identifier of the sticker set owner"""
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#animated-sticker-requirements `_`https://core.telegram.org/stickers#animated-sticker-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-sticker-requirements `_`https://core.telegram.org/stickers#video-sticker-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!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ name: str,
+ user_id: int,
+ thumbnail: Optional[Union[InputFile, 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__(name=name, user_id=user_id, thumbnail=thumbnail, **__pydantic_kwargs)
diff --git a/aiogram/methods/set_sticker_set_title.py b/aiogram/methods/set_sticker_set_title.py
index 978432ff..ec25473a 100644
--- a/aiogram/methods/set_sticker_set_title.py
+++ b/aiogram/methods/set_sticker_set_title.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING
+from typing import TYPE_CHECKING, Any
from .base import TelegramMethod
@@ -19,3 +19,16 @@ class SetStickerSetTitle(TelegramMethod[bool]):
"""Sticker set name"""
title: str
"""Sticker set title, 1-64 characters"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__, *, name: str, title: 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__(name=name, title=title, **__pydantic_kwargs)
diff --git a/aiogram/methods/set_webhook.py b/aiogram/methods/set_webhook.py
index 6e63a75a..da8ec9d4 100644
--- a/aiogram/methods/set_webhook.py
+++ b/aiogram/methods/set_webhook.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, List, Optional
+from typing import TYPE_CHECKING, Any, List, Optional
from ..types import InputFile
from .base import TelegramMethod
@@ -35,8 +35,39 @@ class SetWebhook(TelegramMethod[bool]):
max_connections: Optional[int] = None
"""The maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery, 1-100. Defaults to *40*. Use lower values to limit the load on your bot's server, and higher values to increase your bot's throughput."""
allowed_updates: Optional[List[str]] = None
- """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 :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* (default). If not specified, the previous setting will be used."""
+ """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* (default). If not specified, the previous setting will be used."""
drop_pending_updates: Optional[bool] = None
"""Pass :code:`True` to drop all pending updates"""
secret_token: Optional[str] = None
"""A secret token to be sent in a header 'X-Telegram-Bot-Api-Secret-Token' in every webhook request, 1-256 characters. Only characters :code:`A-Z`, :code:`a-z`, :code:`0-9`, :code:`_` and :code:`-` are allowed. The header is useful to ensure that the request comes from a webhook set by you."""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ url: str,
+ certificate: Optional[InputFile] = None,
+ ip_address: Optional[str] = None,
+ max_connections: Optional[int] = None,
+ allowed_updates: Optional[List[str]] = None,
+ drop_pending_updates: Optional[bool] = None,
+ secret_token: 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__(
+ url=url,
+ certificate=certificate,
+ ip_address=ip_address,
+ max_connections=max_connections,
+ allowed_updates=allowed_updates,
+ drop_pending_updates=drop_pending_updates,
+ secret_token=secret_token,
+ **__pydantic_kwargs,
+ )
diff --git a/aiogram/methods/stop_message_live_location.py b/aiogram/methods/stop_message_live_location.py
index 8a16f586..a6680955 100644
--- a/aiogram/methods/stop_message_live_location.py
+++ b/aiogram/methods/stop_message_live_location.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Optional, Union
+from typing import TYPE_CHECKING, Any, Optional, Union
from ..types import InlineKeyboardMarkup, Message
from .base import TelegramMethod
@@ -24,3 +24,28 @@ class StopMessageLiveLocation(TelegramMethod[Union[Message, bool]]):
"""Required if *chat_id* and *message_id* are not specified. Identifier of the inline message"""
reply_markup: Optional[InlineKeyboardMarkup] = None
"""A JSON-serialized object for a new `inline keyboard `_."""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ chat_id: Optional[Union[int, str]] = None,
+ message_id: Optional[int] = None,
+ inline_message_id: Optional[str] = None,
+ reply_markup: Optional[InlineKeyboardMarkup] = 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,
+ message_id=message_id,
+ inline_message_id=inline_message_id,
+ reply_markup=reply_markup,
+ **__pydantic_kwargs,
+ )
diff --git a/aiogram/methods/stop_poll.py b/aiogram/methods/stop_poll.py
index 19ef26ac..81c46b1a 100644
--- a/aiogram/methods/stop_poll.py
+++ b/aiogram/methods/stop_poll.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Optional, Union
+from typing import TYPE_CHECKING, Any, Optional, Union
from ..types import InlineKeyboardMarkup, Poll
from .base import TelegramMethod
@@ -22,3 +22,26 @@ class StopPoll(TelegramMethod[Poll]):
"""Identifier of the original message with the poll"""
reply_markup: Optional[InlineKeyboardMarkup] = None
"""A JSON-serialized object for a new message `inline keyboard `_."""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ chat_id: Union[int, str],
+ message_id: int,
+ reply_markup: Optional[InlineKeyboardMarkup] = 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,
+ message_id=message_id,
+ reply_markup=reply_markup,
+ **__pydantic_kwargs,
+ )
diff --git a/aiogram/methods/unban_chat_member.py b/aiogram/methods/unban_chat_member.py
index 768eea22..1094db52 100644
--- a/aiogram/methods/unban_chat_member.py
+++ b/aiogram/methods/unban_chat_member.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Optional, Union
+from typing import TYPE_CHECKING, Any, Optional, Union
from .base import TelegramMethod
@@ -21,3 +21,26 @@ class UnbanChatMember(TelegramMethod[bool]):
"""Unique identifier of the target user"""
only_if_banned: Optional[bool] = None
"""Do nothing if the user is not banned"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ chat_id: Union[int, str],
+ user_id: int,
+ only_if_banned: Optional[bool] = 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,
+ user_id=user_id,
+ only_if_banned=only_if_banned,
+ **__pydantic_kwargs,
+ )
diff --git a/aiogram/methods/unban_chat_sender_chat.py b/aiogram/methods/unban_chat_sender_chat.py
index fbd3f1d3..b9816984 100644
--- a/aiogram/methods/unban_chat_sender_chat.py
+++ b/aiogram/methods/unban_chat_sender_chat.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Union
+from typing import TYPE_CHECKING, Any, Union
from .base import TelegramMethod
@@ -19,3 +19,20 @@ class UnbanChatSenderChat(TelegramMethod[bool]):
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
sender_chat_id: int
"""Unique identifier of the target sender chat"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ chat_id: Union[int, str],
+ sender_chat_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__(chat_id=chat_id, sender_chat_id=sender_chat_id, **__pydantic_kwargs)
diff --git a/aiogram/methods/unhide_general_forum_topic.py b/aiogram/methods/unhide_general_forum_topic.py
index 82524758..a9149bc8 100644
--- a/aiogram/methods/unhide_general_forum_topic.py
+++ b/aiogram/methods/unhide_general_forum_topic.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Union
+from typing import TYPE_CHECKING, Any, Union
from .base import TelegramMethod
@@ -17,3 +17,16 @@ class UnhideGeneralForumTopic(TelegramMethod[bool]):
chat_id: Union[int, str]
"""Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)"""
+
+ 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/unpin_all_chat_messages.py b/aiogram/methods/unpin_all_chat_messages.py
index f8566e33..aca090f3 100644
--- a/aiogram/methods/unpin_all_chat_messages.py
+++ b/aiogram/methods/unpin_all_chat_messages.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Union
+from typing import TYPE_CHECKING, Any, Union
from .base import TelegramMethod
@@ -17,3 +17,16 @@ class UnpinAllChatMessages(TelegramMethod[bool]):
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/unpin_all_forum_topic_messages.py b/aiogram/methods/unpin_all_forum_topic_messages.py
index 6b735e98..f1350ecc 100644
--- a/aiogram/methods/unpin_all_forum_topic_messages.py
+++ b/aiogram/methods/unpin_all_forum_topic_messages.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Union
+from typing import TYPE_CHECKING, Any, Union
from .base import TelegramMethod
@@ -19,3 +19,22 @@ class UnpinAllForumTopicMessages(TelegramMethod[bool]):
"""Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)"""
message_thread_id: int
"""Unique identifier for the target message thread of the forum topic"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ chat_id: Union[int, str],
+ message_thread_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__(
+ chat_id=chat_id, message_thread_id=message_thread_id, **__pydantic_kwargs
+ )
diff --git a/aiogram/methods/unpin_all_general_forum_topic_messages.py b/aiogram/methods/unpin_all_general_forum_topic_messages.py
new file mode 100644
index 00000000..be76c198
--- /dev/null
+++ b/aiogram/methods/unpin_all_general_forum_topic_messages.py
@@ -0,0 +1,30 @@
+from typing import TYPE_CHECKING, Any, Union
+
+from aiogram.methods import TelegramMethod
+
+
+class UnpinAllGeneralForumTopicMessages(TelegramMethod[bool]):
+ """
+ Use this method to clear the list of pinned messages in a General forum topic. The bot must be an administrator in the chat for this to work and must have the *can_pin_messages* administrator right in the supergroup. Returns :code:`True` on success.
+
+ Source: https://core.telegram.org/bots/api#unpinallgeneralforumtopicmessages
+ """
+
+ __returning__ = bool
+ __api_method__ = "unpinAllGeneralForumTopicMessages"
+
+ chat_id: Union[int, str]
+ """Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)"""
+
+ 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/unpin_chat_message.py b/aiogram/methods/unpin_chat_message.py
index 0d5d2b0a..90547140 100644
--- a/aiogram/methods/unpin_chat_message.py
+++ b/aiogram/methods/unpin_chat_message.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Optional, Union
+from typing import TYPE_CHECKING, Any, Optional, Union
from .base import TelegramMethod
@@ -19,3 +19,20 @@ class UnpinChatMessage(TelegramMethod[bool]):
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
message_id: Optional[int] = None
"""Identifier of a message to unpin. If not specified, the most recent pinned message (by sending date) will be unpinned."""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ chat_id: Union[int, str],
+ message_id: 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__(chat_id=chat_id, message_id=message_id, **__pydantic_kwargs)
diff --git a/aiogram/methods/upload_sticker_file.py b/aiogram/methods/upload_sticker_file.py
index 2194e35f..077a9822 100644
--- a/aiogram/methods/upload_sticker_file.py
+++ b/aiogram/methods/upload_sticker_file.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING
+from typing import TYPE_CHECKING, Any
from ..types import File, InputFile
from .base import TelegramMethod
@@ -22,3 +22,26 @@ class UploadStickerFile(TelegramMethod[File]):
"""A file with the sticker in .WEBP, .PNG, .TGS, or .WEBM format. See `https://core.telegram.org/stickers `_`https://core.telegram.org/stickers `_ for technical requirements. :ref:`More information on Sending Files » `"""
sticker_format: str
"""Format of the sticker, must be one of 'static', 'animated', 'video'"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ user_id: int,
+ sticker: InputFile,
+ sticker_format: 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__(
+ user_id=user_id,
+ sticker=sticker,
+ sticker_format=sticker_format,
+ **__pydantic_kwargs,
+ )
diff --git a/aiogram/types/__init__.py b/aiogram/types/__init__.py
index 4808f7fe..8f4b6f34 100644
--- a/aiogram/types/__init__.py
+++ b/aiogram/types/__init__.py
@@ -1,4 +1,4 @@
-from typing import Optional
+from typing import List, Literal, Optional, Union
from .animation import Animation
from .audio import Audio
@@ -37,6 +37,7 @@ from .chat_photo import ChatPhoto
from .chat_shared import ChatShared
from .chosen_inline_result import ChosenInlineResult
from .contact import Contact
+from .custom import DateTime
from .dice import Dice
from .document import Document
from .downloadable import Downloadable
@@ -140,6 +141,7 @@ from .shipping_option import ShippingOption
from .shipping_query import ShippingQuery
from .sticker import Sticker
from .sticker_set import StickerSet
+from .story import Story
from .successful_payment import SuccessfulPayment
from .switch_inline_query_chosen_chat import SwitchInlineQueryChosenChat
from .update import Update
@@ -196,6 +198,7 @@ __all__ = (
"ChosenInlineResult",
"Contact",
"ContentType",
+ "DateTime",
"Dice",
"Document",
"Downloadable",
@@ -298,6 +301,7 @@ __all__ = (
"ShippingQuery",
"Sticker",
"StickerSet",
+ "Story",
"SuccessfulPayment",
"SwitchInlineQueryChosenChat",
"TelegramObject",
@@ -324,11 +328,16 @@ __all__ = (
# Load typing forward refs for every TelegramObject
for _entity_name in __all__:
_entity = globals()[_entity_name]
- if not hasattr(_entity, "update_forward_refs"):
+ if not hasattr(_entity, "model_rebuild"):
continue
- _entity.update_forward_refs(
- **{k: v for k, v in globals().items() if k in __all__},
- **{"Optional": Optional},
+ _entity.model_rebuild(
+ _types_namespace={
+ "List": List,
+ "Optional": Optional,
+ "Union": Union,
+ "Literal": Literal,
+ **{k: v for k, v in globals().items() if k in __all__},
+ }
)
del _entity
diff --git a/aiogram/types/animation.py b/aiogram/types/animation.py
index 15354156..856a5b37 100644
--- a/aiogram/types/animation.py
+++ b/aiogram/types/animation.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Optional
+from typing import TYPE_CHECKING, Any, Optional
from .base import TelegramObject
@@ -33,3 +33,38 @@ class Animation(TelegramObject):
"""*Optional*. MIME type of the file as defined by sender"""
file_size: Optional[int] = None
"""*Optional*. File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value."""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ file_id: str,
+ file_unique_id: str,
+ width: int,
+ height: int,
+ duration: int,
+ thumbnail: Optional[PhotoSize] = None,
+ file_name: Optional[str] = None,
+ mime_type: Optional[str] = None,
+ file_size: 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__(
+ file_id=file_id,
+ file_unique_id=file_unique_id,
+ width=width,
+ height=height,
+ duration=duration,
+ thumbnail=thumbnail,
+ file_name=file_name,
+ mime_type=mime_type,
+ file_size=file_size,
+ **__pydantic_kwargs,
+ )
diff --git a/aiogram/types/audio.py b/aiogram/types/audio.py
index 0a147c36..f42e3bf2 100644
--- a/aiogram/types/audio.py
+++ b/aiogram/types/audio.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Optional
+from typing import TYPE_CHECKING, Any, Optional
from .base import TelegramObject
@@ -33,3 +33,38 @@ class Audio(TelegramObject):
"""*Optional*. File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value."""
thumbnail: Optional[PhotoSize] = None
"""*Optional*. Thumbnail of the album cover to which the music file belongs"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ file_id: str,
+ file_unique_id: str,
+ duration: int,
+ performer: Optional[str] = None,
+ title: Optional[str] = None,
+ file_name: Optional[str] = None,
+ mime_type: Optional[str] = None,
+ file_size: Optional[int] = None,
+ thumbnail: Optional[PhotoSize] = 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__(
+ file_id=file_id,
+ file_unique_id=file_unique_id,
+ duration=duration,
+ performer=performer,
+ title=title,
+ file_name=file_name,
+ mime_type=mime_type,
+ file_size=file_size,
+ thumbnail=thumbnail,
+ **__pydantic_kwargs,
+ )
diff --git a/aiogram/types/base.py b/aiogram/types/base.py
index 707e328c..dae52156 100644
--- a/aiogram/types/base.py
+++ b/aiogram/types/base.py
@@ -1,30 +1,47 @@
-import datetime
-from typing import Any
+from typing import Any, Dict
from unittest.mock import sentinel
-from pydantic import BaseModel, Extra
+from pydantic import BaseModel, ConfigDict, model_validator
-from aiogram.utils.mixins import ContextInstanceMixin
+from aiogram.client.context_controller import BotContextController
-class TelegramObject(ContextInstanceMixin["TelegramObject"], BaseModel):
- class Config:
- use_enum_values = True
- orm_mode = True
- extra = Extra.allow
- validate_assignment = True
- allow_mutation = False
- allow_population_by_field_name = True
- json_encoders = {datetime.datetime: lambda dt: int(dt.timestamp())}
+class TelegramObject(BotContextController, BaseModel):
+ model_config = ConfigDict(
+ use_enum_values=True,
+ extra="allow",
+ validate_assignment=True,
+ frozen=True,
+ populate_by_name=True,
+ arbitrary_types_allowed=True,
+ defer_build=True,
+ )
+
+ @model_validator(mode="before")
+ @classmethod
+ def remove_unset(cls, values: Dict[str, Any]) -> Dict[str, Any]:
+ """
+ Remove UNSET before fields validation.
+
+ We use UNSET as a sentinel value for `parse_mode` and replace it to real value later.
+ It isn't a problem when it's just default value for a model field,
+ but UNSET might be passed to a model initialization from `Bot.method_name`,
+ so we must take care of it and remove it before fields validation.
+ """
+ if not isinstance(values, dict):
+ return values
+ return {k: v for k, v in values.items() if not isinstance(v, UNSET_TYPE)}
class MutableTelegramObject(TelegramObject):
- class Config:
- allow_mutation = True
+ model_config = ConfigDict(
+ frozen=False,
+ )
-# special sentinel object which used in situation when None might be a useful value
+# special sentinel object which used in a situation when None might be a useful value
+UNSET: Any = sentinel.UNSET
UNSET_PARSE_MODE: Any = sentinel.UNSET_PARSE_MODE
-UNSET_DISABLE_WEB_PAGE_PREVIEW = sentinel.UNSET_DISABLE_WEB_PAGE_PREVIEW
-UNSET_PROTECT_CONTENT = sentinel.UNSET_PROTECT_CONTENT
-UNSET_TYPE = type(sentinel.DEFAULT)
+UNSET_DISABLE_WEB_PAGE_PREVIEW: Any = sentinel.UNSET_DISABLE_WEB_PAGE_PREVIEW
+UNSET_PROTECT_CONTENT: Any = sentinel.UNSET_PROTECT_CONTENT
+UNSET_TYPE: Any = type(UNSET)
diff --git a/aiogram/types/bot_command.py b/aiogram/types/bot_command.py
index 1bf65eba..e4e91759 100644
--- a/aiogram/types/bot_command.py
+++ b/aiogram/types/bot_command.py
@@ -1,5 +1,7 @@
from __future__ import annotations
+from typing import TYPE_CHECKING, Any
+
from .base import MutableTelegramObject
@@ -14,3 +16,16 @@ class BotCommand(MutableTelegramObject):
"""Text of the command; 1-32 characters. Can contain only lowercase English letters, digits and underscores."""
description: str
"""Description of the command; 1-256 characters."""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__, *, command: str, description: 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__(command=command, description=description, **__pydantic_kwargs)
diff --git a/aiogram/types/bot_command_scope_all_chat_administrators.py b/aiogram/types/bot_command_scope_all_chat_administrators.py
index e9f6a969..061945f7 100644
--- a/aiogram/types/bot_command_scope_all_chat_administrators.py
+++ b/aiogram/types/bot_command_scope_all_chat_administrators.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from pydantic import Field
+from typing import TYPE_CHECKING, Any, Literal
from ..enums import BotCommandScopeType
from .bot_command_scope import BotCommandScope
@@ -13,5 +13,25 @@ class BotCommandScopeAllChatAdministrators(BotCommandScope):
Source: https://core.telegram.org/bots/api#botcommandscopeallchatadministrators
"""
- type: str = Field(BotCommandScopeType.ALL_CHAT_ADMINISTRATORS, const=True)
+ type: Literal[
+ BotCommandScopeType.ALL_CHAT_ADMINISTRATORS
+ ] = BotCommandScopeType.ALL_CHAT_ADMINISTRATORS
"""Scope type, must be *all_chat_administrators*"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ type: Literal[
+ BotCommandScopeType.ALL_CHAT_ADMINISTRATORS
+ ] = BotCommandScopeType.ALL_CHAT_ADMINISTRATORS,
+ **__pydantic_kwargs: Any,
+ ) -> None:
+ # DO NOT EDIT MANUALLY!!!
+ # This method was auto-generated via `butcher`
+ # Is needed only for type checking and IDE support without any additional plugins
+
+ super().__init__(type=type, **__pydantic_kwargs)
diff --git a/aiogram/types/bot_command_scope_all_group_chats.py b/aiogram/types/bot_command_scope_all_group_chats.py
index f9675ad6..a17a51da 100644
--- a/aiogram/types/bot_command_scope_all_group_chats.py
+++ b/aiogram/types/bot_command_scope_all_group_chats.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from pydantic import Field
+from typing import TYPE_CHECKING, Any, Literal
from ..enums import BotCommandScopeType
from .bot_command_scope import BotCommandScope
@@ -13,5 +13,23 @@ class BotCommandScopeAllGroupChats(BotCommandScope):
Source: https://core.telegram.org/bots/api#botcommandscopeallgroupchats
"""
- type: str = Field(BotCommandScopeType.ALL_GROUP_CHATS, const=True)
+ type: Literal[BotCommandScopeType.ALL_GROUP_CHATS] = BotCommandScopeType.ALL_GROUP_CHATS
"""Scope type, must be *all_group_chats*"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ type: Literal[
+ BotCommandScopeType.ALL_GROUP_CHATS
+ ] = BotCommandScopeType.ALL_GROUP_CHATS,
+ **__pydantic_kwargs: Any,
+ ) -> None:
+ # DO NOT EDIT MANUALLY!!!
+ # This method was auto-generated via `butcher`
+ # Is needed only for type checking and IDE support without any additional plugins
+
+ super().__init__(type=type, **__pydantic_kwargs)
diff --git a/aiogram/types/bot_command_scope_all_private_chats.py b/aiogram/types/bot_command_scope_all_private_chats.py
index f13e2866..54d406ff 100644
--- a/aiogram/types/bot_command_scope_all_private_chats.py
+++ b/aiogram/types/bot_command_scope_all_private_chats.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from pydantic import Field
+from typing import TYPE_CHECKING, Any, Literal
from ..enums import BotCommandScopeType
from .bot_command_scope import BotCommandScope
@@ -13,5 +13,23 @@ class BotCommandScopeAllPrivateChats(BotCommandScope):
Source: https://core.telegram.org/bots/api#botcommandscopeallprivatechats
"""
- type: str = Field(BotCommandScopeType.ALL_PRIVATE_CHATS, const=True)
+ type: Literal[BotCommandScopeType.ALL_PRIVATE_CHATS] = BotCommandScopeType.ALL_PRIVATE_CHATS
"""Scope type, must be *all_private_chats*"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ type: Literal[
+ BotCommandScopeType.ALL_PRIVATE_CHATS
+ ] = BotCommandScopeType.ALL_PRIVATE_CHATS,
+ **__pydantic_kwargs: Any,
+ ) -> None:
+ # DO NOT EDIT MANUALLY!!!
+ # This method was auto-generated via `butcher`
+ # Is needed only for type checking and IDE support without any additional plugins
+
+ super().__init__(type=type, **__pydantic_kwargs)
diff --git a/aiogram/types/bot_command_scope_chat.py b/aiogram/types/bot_command_scope_chat.py
index d96bc6f4..f36c4a1d 100644
--- a/aiogram/types/bot_command_scope_chat.py
+++ b/aiogram/types/bot_command_scope_chat.py
@@ -1,8 +1,6 @@
from __future__ import annotations
-from typing import Union
-
-from pydantic import Field
+from typing import TYPE_CHECKING, Any, Literal, Union
from ..enums import BotCommandScopeType
from .bot_command_scope import BotCommandScope
@@ -15,7 +13,24 @@ class BotCommandScopeChat(BotCommandScope):
Source: https://core.telegram.org/bots/api#botcommandscopechat
"""
- type: str = Field(BotCommandScopeType.CHAT, const=True)
+ type: Literal[BotCommandScopeType.CHAT] = BotCommandScopeType.CHAT
"""Scope type, must be *chat*"""
chat_id: Union[int, str]
"""Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ type: Literal[BotCommandScopeType.CHAT] = BotCommandScopeType.CHAT,
+ 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__(type=type, chat_id=chat_id, **__pydantic_kwargs)
diff --git a/aiogram/types/bot_command_scope_chat_administrators.py b/aiogram/types/bot_command_scope_chat_administrators.py
index 824dc5a1..8757e98c 100644
--- a/aiogram/types/bot_command_scope_chat_administrators.py
+++ b/aiogram/types/bot_command_scope_chat_administrators.py
@@ -1,8 +1,6 @@
from __future__ import annotations
-from typing import Union
-
-from pydantic import Field
+from typing import TYPE_CHECKING, Any, Literal, Union
from ..enums import BotCommandScopeType
from .bot_command_scope import BotCommandScope
@@ -15,7 +13,28 @@ class BotCommandScopeChatAdministrators(BotCommandScope):
Source: https://core.telegram.org/bots/api#botcommandscopechatadministrators
"""
- type: str = Field(BotCommandScopeType.CHAT_ADMINISTRATORS, const=True)
+ type: Literal[
+ BotCommandScopeType.CHAT_ADMINISTRATORS
+ ] = BotCommandScopeType.CHAT_ADMINISTRATORS
"""Scope type, must be *chat_administrators*"""
chat_id: Union[int, str]
"""Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ type: Literal[
+ BotCommandScopeType.CHAT_ADMINISTRATORS
+ ] = BotCommandScopeType.CHAT_ADMINISTRATORS,
+ 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__(type=type, chat_id=chat_id, **__pydantic_kwargs)
diff --git a/aiogram/types/bot_command_scope_chat_member.py b/aiogram/types/bot_command_scope_chat_member.py
index e9fb0dda..4d20b1f3 100644
--- a/aiogram/types/bot_command_scope_chat_member.py
+++ b/aiogram/types/bot_command_scope_chat_member.py
@@ -1,8 +1,6 @@
from __future__ import annotations
-from typing import Union
-
-from pydantic import Field
+from typing import TYPE_CHECKING, Any, Literal, Union
from ..enums import BotCommandScopeType
from .bot_command_scope import BotCommandScope
@@ -15,9 +13,27 @@ class BotCommandScopeChatMember(BotCommandScope):
Source: https://core.telegram.org/bots/api#botcommandscopechatmember
"""
- type: str = Field(BotCommandScopeType.CHAT_MEMBER, const=True)
+ type: Literal[BotCommandScopeType.CHAT_MEMBER] = BotCommandScopeType.CHAT_MEMBER
"""Scope type, must be *chat_member*"""
chat_id: Union[int, str]
"""Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)"""
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__,
+ *,
+ type: Literal[BotCommandScopeType.CHAT_MEMBER] = BotCommandScopeType.CHAT_MEMBER,
+ chat_id: Union[int, str],
+ 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__(type=type, chat_id=chat_id, user_id=user_id, **__pydantic_kwargs)
diff --git a/aiogram/types/bot_command_scope_default.py b/aiogram/types/bot_command_scope_default.py
index 79825631..33b7a0ca 100644
--- a/aiogram/types/bot_command_scope_default.py
+++ b/aiogram/types/bot_command_scope_default.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from pydantic import Field
+from typing import TYPE_CHECKING, Any, Literal
from ..enums import BotCommandScopeType
from .bot_command_scope import BotCommandScope
@@ -13,5 +13,21 @@ class BotCommandScopeDefault(BotCommandScope):
Source: https://core.telegram.org/bots/api#botcommandscopedefault
"""
- type: str = Field(BotCommandScopeType.DEFAULT, const=True)
+ type: Literal[BotCommandScopeType.DEFAULT] = BotCommandScopeType.DEFAULT
"""Scope type, must be *default*"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ type: Literal[BotCommandScopeType.DEFAULT] = BotCommandScopeType.DEFAULT,
+ **__pydantic_kwargs: Any,
+ ) -> None:
+ # DO NOT EDIT MANUALLY!!!
+ # This method was auto-generated via `butcher`
+ # Is needed only for type checking and IDE support without any additional plugins
+
+ super().__init__(type=type, **__pydantic_kwargs)
diff --git a/aiogram/types/bot_description.py b/aiogram/types/bot_description.py
index a69d492f..5d8646dd 100644
--- a/aiogram/types/bot_description.py
+++ b/aiogram/types/bot_description.py
@@ -1,3 +1,5 @@
+from typing import TYPE_CHECKING, Any
+
from aiogram.types import TelegramObject
@@ -10,3 +12,14 @@ class BotDescription(TelegramObject):
description: str
"""The bot's description"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(__pydantic__self__, *, description: 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__(description=description, **__pydantic_kwargs)
diff --git a/aiogram/types/bot_name.py b/aiogram/types/bot_name.py
index 103f1fde..f2dc0745 100644
--- a/aiogram/types/bot_name.py
+++ b/aiogram/types/bot_name.py
@@ -1,3 +1,5 @@
+from typing import TYPE_CHECKING, Any
+
from .base import TelegramObject
@@ -10,3 +12,14 @@ class BotName(TelegramObject):
name: str
"""The bot's name"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(__pydantic__self__, *, name: 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__(name=name, **__pydantic_kwargs)
diff --git a/aiogram/types/bot_short_description.py b/aiogram/types/bot_short_description.py
index 46d5c1c3..86b11cf4 100644
--- a/aiogram/types/bot_short_description.py
+++ b/aiogram/types/bot_short_description.py
@@ -1,3 +1,5 @@
+from typing import TYPE_CHECKING, Any
+
from aiogram.types import TelegramObject
@@ -10,3 +12,16 @@ class BotShortDescription(TelegramObject):
short_description: str
"""The bot's short description"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__, *, short_description: 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__(short_description=short_description, **__pydantic_kwargs)
diff --git a/aiogram/types/callback_query.py b/aiogram/types/callback_query.py
index 5812bb13..f6e95b1c 100644
--- a/aiogram/types/callback_query.py
+++ b/aiogram/types/callback_query.py
@@ -36,6 +36,37 @@ class CallbackQuery(TelegramObject):
game_short_name: Optional[str] = None
"""*Optional*. Short name of a `Game `_ to be returned, serves as the unique identifier for the game"""
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ id: str,
+ from_user: User,
+ chat_instance: str,
+ message: Optional[Message] = None,
+ inline_message_id: Optional[str] = None,
+ data: Optional[str] = None,
+ game_short_name: Optional[str] = None,
+ **__pydantic_kwargs: Any,
+ ) -> None:
+ # DO NOT EDIT MANUALLY!!!
+ # This method was auto-generated via `butcher`
+ # Is needed only for type checking and IDE support without any additional plugins
+
+ super().__init__(
+ id=id,
+ from_user=from_user,
+ chat_instance=chat_instance,
+ message=message,
+ inline_message_id=inline_message_id,
+ data=data,
+ game_short_name=game_short_name,
+ **__pydantic_kwargs,
+ )
+
def answer(
self,
text: Optional[str] = None,
@@ -74,4 +105,4 @@ class CallbackQuery(TelegramObject):
url=url,
cache_time=cache_time,
**kwargs,
- )
+ ).as_(self._bot)
diff --git a/aiogram/types/chat.py b/aiogram/types/chat.py
index 4bb6d688..d2ef2487 100644
--- a/aiogram/types/chat.py
+++ b/aiogram/types/chat.py
@@ -4,6 +4,7 @@ import datetime
from typing import TYPE_CHECKING, Any, List, Optional, Union
from .base import TelegramObject
+from .custom import DateTime
if TYPE_CHECKING:
from ..methods import (
@@ -33,6 +34,7 @@ if TYPE_CHECKING:
UnbanChatMember,
UnbanChatSenderChat,
UnpinAllChatMessages,
+ UnpinAllGeneralForumTopicMessages,
UnpinChatMessage,
)
from .chat_location import ChatLocation
@@ -69,6 +71,8 @@ class Chat(TelegramObject):
"""*Optional*. If non-empty, the list of all `active chat usernames `_; for private chats, supergroups and channels. Returned only in :class:`aiogram.methods.get_chat.GetChat`."""
emoji_status_custom_emoji_id: Optional[str] = None
"""*Optional*. Custom emoji identifier of emoji status of the other party in a private chat. Returned only in :class:`aiogram.methods.get_chat.GetChat`."""
+ emoji_status_expiration_date: Optional[DateTime] = None
+ """*Optional*. Expiration date of the emoji status of the other party in a private chat in Unix time, if any. Returned only in :class:`aiogram.methods.get_chat.GetChat`."""
bio: Optional[str] = None
"""*Optional*. Bio of the other party in a private chat. Returned only in :class:`aiogram.methods.get_chat.GetChat`."""
has_private_forwards: Optional[bool] = None
@@ -106,6 +110,81 @@ class Chat(TelegramObject):
location: Optional[ChatLocation] = None
"""*Optional*. For supergroups, the location to which the supergroup is connected. Returned only in :class:`aiogram.methods.get_chat.GetChat`."""
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ id: int,
+ type: str,
+ title: Optional[str] = None,
+ username: Optional[str] = None,
+ first_name: Optional[str] = None,
+ last_name: Optional[str] = None,
+ is_forum: Optional[bool] = None,
+ photo: Optional[ChatPhoto] = None,
+ active_usernames: Optional[List[str]] = None,
+ emoji_status_custom_emoji_id: Optional[str] = None,
+ emoji_status_expiration_date: Optional[DateTime] = None,
+ bio: Optional[str] = None,
+ has_private_forwards: Optional[bool] = None,
+ has_restricted_voice_and_video_messages: Optional[bool] = None,
+ join_to_send_messages: Optional[bool] = None,
+ join_by_request: Optional[bool] = None,
+ description: Optional[str] = None,
+ invite_link: Optional[str] = None,
+ pinned_message: Optional[Message] = None,
+ permissions: Optional[ChatPermissions] = None,
+ slow_mode_delay: Optional[int] = None,
+ message_auto_delete_time: Optional[int] = None,
+ has_aggressive_anti_spam_enabled: Optional[bool] = None,
+ has_hidden_members: Optional[bool] = None,
+ has_protected_content: Optional[bool] = None,
+ sticker_set_name: Optional[str] = None,
+ can_set_sticker_set: Optional[bool] = None,
+ linked_chat_id: Optional[int] = None,
+ location: Optional[ChatLocation] = None,
+ **__pydantic_kwargs: Any,
+ ) -> None:
+ # DO NOT EDIT MANUALLY!!!
+ # This method was auto-generated via `butcher`
+ # Is needed only for type checking and IDE support without any additional plugins
+
+ super().__init__(
+ id=id,
+ type=type,
+ title=title,
+ username=username,
+ first_name=first_name,
+ last_name=last_name,
+ is_forum=is_forum,
+ photo=photo,
+ active_usernames=active_usernames,
+ emoji_status_custom_emoji_id=emoji_status_custom_emoji_id,
+ emoji_status_expiration_date=emoji_status_expiration_date,
+ bio=bio,
+ has_private_forwards=has_private_forwards,
+ has_restricted_voice_and_video_messages=has_restricted_voice_and_video_messages,
+ join_to_send_messages=join_to_send_messages,
+ join_by_request=join_by_request,
+ description=description,
+ invite_link=invite_link,
+ pinned_message=pinned_message,
+ permissions=permissions,
+ slow_mode_delay=slow_mode_delay,
+ message_auto_delete_time=message_auto_delete_time,
+ has_aggressive_anti_spam_enabled=has_aggressive_anti_spam_enabled,
+ has_hidden_members=has_hidden_members,
+ has_protected_content=has_protected_content,
+ sticker_set_name=sticker_set_name,
+ can_set_sticker_set=can_set_sticker_set,
+ linked_chat_id=linked_chat_id,
+ location=location,
+ **__pydantic_kwargs,
+ )
+
@property
def shifted_id(self) -> int:
"""
@@ -164,7 +243,7 @@ class Chat(TelegramObject):
chat_id=self.id,
sender_chat_id=sender_chat_id,
**kwargs,
- )
+ ).as_(self._bot)
def unban_sender_chat(
self,
@@ -193,7 +272,7 @@ class Chat(TelegramObject):
chat_id=self.id,
sender_chat_id=sender_chat_id,
**kwargs,
- )
+ ).as_(self._bot)
def get_administrators(
self,
@@ -219,7 +298,7 @@ class Chat(TelegramObject):
return GetChatAdministrators(
chat_id=self.id,
**kwargs,
- )
+ ).as_(self._bot)
def delete_message(
self,
@@ -266,7 +345,7 @@ class Chat(TelegramObject):
chat_id=self.id,
message_id=message_id,
**kwargs,
- )
+ ).as_(self._bot)
def revoke_invite_link(
self,
@@ -295,7 +374,7 @@ class Chat(TelegramObject):
chat_id=self.id,
invite_link=invite_link,
**kwargs,
- )
+ ).as_(self._bot)
def edit_invite_link(
self,
@@ -336,7 +415,7 @@ class Chat(TelegramObject):
member_limit=member_limit,
creates_join_request=creates_join_request,
**kwargs,
- )
+ ).as_(self._bot)
def create_invite_link(
self,
@@ -374,7 +453,7 @@ class Chat(TelegramObject):
member_limit=member_limit,
creates_join_request=creates_join_request,
**kwargs,
- )
+ ).as_(self._bot)
def export_invite_link(
self,
@@ -402,7 +481,7 @@ class Chat(TelegramObject):
return ExportChatInviteLink(
chat_id=self.id,
**kwargs,
- )
+ ).as_(self._bot)
def do(
self,
@@ -438,7 +517,7 @@ class Chat(TelegramObject):
action=action,
message_thread_id=message_thread_id,
**kwargs,
- )
+ ).as_(self._bot)
def delete_sticker_set(
self,
@@ -464,7 +543,7 @@ class Chat(TelegramObject):
return DeleteChatStickerSet(
chat_id=self.id,
**kwargs,
- )
+ ).as_(self._bot)
def set_sticker_set(
self,
@@ -493,7 +572,7 @@ class Chat(TelegramObject):
chat_id=self.id,
sticker_set_name=sticker_set_name,
**kwargs,
- )
+ ).as_(self._bot)
def get_member(
self,
@@ -522,7 +601,7 @@ class Chat(TelegramObject):
chat_id=self.id,
user_id=user_id,
**kwargs,
- )
+ ).as_(self._bot)
def get_member_count(
self,
@@ -548,7 +627,7 @@ class Chat(TelegramObject):
return GetChatMemberCount(
chat_id=self.id,
**kwargs,
- )
+ ).as_(self._bot)
def leave(
self,
@@ -574,7 +653,7 @@ class Chat(TelegramObject):
return LeaveChat(
chat_id=self.id,
**kwargs,
- )
+ ).as_(self._bot)
def unpin_all_messages(
self,
@@ -600,7 +679,7 @@ class Chat(TelegramObject):
return UnpinAllChatMessages(
chat_id=self.id,
**kwargs,
- )
+ ).as_(self._bot)
def unpin_message(
self,
@@ -629,7 +708,7 @@ class Chat(TelegramObject):
chat_id=self.id,
message_id=message_id,
**kwargs,
- )
+ ).as_(self._bot)
def pin_message(
self,
@@ -661,7 +740,7 @@ class Chat(TelegramObject):
message_id=message_id,
disable_notification=disable_notification,
**kwargs,
- )
+ ).as_(self._bot)
def set_administrator_custom_title(
self,
@@ -693,7 +772,7 @@ class Chat(TelegramObject):
user_id=user_id,
custom_title=custom_title,
**kwargs,
- )
+ ).as_(self._bot)
def set_permissions(
self,
@@ -725,22 +804,25 @@ class Chat(TelegramObject):
permissions=permissions,
use_independent_chat_permissions=use_independent_chat_permissions,
**kwargs,
- )
+ ).as_(self._bot)
def promote(
self,
user_id: int,
is_anonymous: Optional[bool] = None,
can_manage_chat: Optional[bool] = None,
- can_post_messages: Optional[bool] = None,
- can_edit_messages: Optional[bool] = None,
can_delete_messages: Optional[bool] = None,
can_manage_video_chats: Optional[bool] = None,
can_restrict_members: Optional[bool] = None,
can_promote_members: Optional[bool] = None,
can_change_info: Optional[bool] = None,
can_invite_users: Optional[bool] = None,
+ can_post_messages: Optional[bool] = None,
+ can_edit_messages: Optional[bool] = None,
can_pin_messages: Optional[bool] = None,
+ can_post_stories: Optional[bool] = None,
+ can_edit_stories: Optional[bool] = None,
+ can_delete_stories: Optional[bool] = None,
can_manage_topics: Optional[bool] = None,
**kwargs: Any,
) -> PromoteChatMember:
@@ -756,16 +838,19 @@ class Chat(TelegramObject):
:param user_id: Unique identifier of the target user
:param is_anonymous: Pass :code:`True` if the administrator's presence in the chat is hidden
- :param can_manage_chat: Pass :code:`True` if the administrator can access the chat event log, chat statistics, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege
- :param can_post_messages: Pass :code:`True` if the administrator can create channel posts, channels only
- :param can_edit_messages: Pass :code:`True` if the administrator can edit messages of other users and can pin messages, channels only
+ :param can_manage_chat: Pass :code:`True` if the administrator can access the chat event log, boost list in channels, see channel members, report spam messages, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege
:param can_delete_messages: Pass :code:`True` if the administrator can delete messages of other users
:param can_manage_video_chats: Pass :code:`True` if the administrator can manage video chats
- :param can_restrict_members: Pass :code:`True` if the administrator can restrict, ban or unban chat members
+ :param can_restrict_members: Pass :code:`True` if the administrator can restrict, ban or unban chat members, or access supergroup statistics
:param can_promote_members: Pass :code:`True` if the administrator can add new administrators with a subset of their own privileges or demote administrators that they have promoted, directly or indirectly (promoted by administrators that were appointed by him)
:param can_change_info: Pass :code:`True` if the administrator can change chat title, photo and other settings
:param can_invite_users: Pass :code:`True` if the administrator can invite new users to the chat
+ :param can_post_messages: Pass :code:`True` if the administrator can post messages in the channel, or access channel statistics; channels only
+ :param can_edit_messages: Pass :code:`True` if the administrator can edit messages of other users and can pin messages; channels only
:param can_pin_messages: Pass :code:`True` if the administrator can pin messages, supergroups only
+ :param can_post_stories: Pass :code:`True` if the administrator can post stories in the channel; channels only
+ :param can_edit_stories: Pass :code:`True` if the administrator can edit stories posted by other users; channels only
+ :param can_delete_stories: Pass :code:`True` if the administrator can delete stories posted by other users; channels only
:param can_manage_topics: Pass :code:`True` if the user is allowed to create, rename, close, and reopen forum topics, supergroups only
:return: instance of method :class:`aiogram.methods.promote_chat_member.PromoteChatMember`
"""
@@ -779,18 +864,21 @@ class Chat(TelegramObject):
user_id=user_id,
is_anonymous=is_anonymous,
can_manage_chat=can_manage_chat,
- can_post_messages=can_post_messages,
- can_edit_messages=can_edit_messages,
can_delete_messages=can_delete_messages,
can_manage_video_chats=can_manage_video_chats,
can_restrict_members=can_restrict_members,
can_promote_members=can_promote_members,
can_change_info=can_change_info,
can_invite_users=can_invite_users,
+ can_post_messages=can_post_messages,
+ can_edit_messages=can_edit_messages,
can_pin_messages=can_pin_messages,
+ can_post_stories=can_post_stories,
+ can_edit_stories=can_edit_stories,
+ can_delete_stories=can_delete_stories,
can_manage_topics=can_manage_topics,
**kwargs,
- )
+ ).as_(self._bot)
def restrict(
self,
@@ -813,7 +901,7 @@ class Chat(TelegramObject):
:param user_id: Unique identifier of the target user
:param permissions: A JSON-serialized object for new user permissions
:param use_independent_chat_permissions: Pass :code:`True` if chat permissions are set independently. Otherwise, the *can_send_other_messages* and *can_add_web_page_previews* permissions will imply the *can_send_messages*, *can_send_audios*, *can_send_documents*, *can_send_photos*, *can_send_videos*, *can_send_video_notes*, and *can_send_voice_notes* permissions; the *can_send_polls* permission will imply the *can_send_messages* permission.
- :param until_date: Date when restrictions will be lifted for the user, unix time. If user is restricted for more than 366 days or less than 30 seconds from the current time, they are considered to be restricted forever
+ :param until_date: Date when restrictions will be lifted for the user; Unix time. If user is restricted for more than 366 days or less than 30 seconds from the current time, they are considered to be restricted forever
:return: instance of method :class:`aiogram.methods.restrict_chat_member.RestrictChatMember`
"""
# DO NOT EDIT MANUALLY!!!
@@ -828,7 +916,7 @@ class Chat(TelegramObject):
use_independent_chat_permissions=use_independent_chat_permissions,
until_date=until_date,
**kwargs,
- )
+ ).as_(self._bot)
def unban(
self,
@@ -860,7 +948,7 @@ class Chat(TelegramObject):
user_id=user_id,
only_if_banned=only_if_banned,
**kwargs,
- )
+ ).as_(self._bot)
def ban(
self,
@@ -880,7 +968,7 @@ class Chat(TelegramObject):
Source: https://core.telegram.org/bots/api#banchatmember
:param user_id: Unique identifier of the target user
- :param until_date: Date when the user will be unbanned, unix time. If user is banned for more than 366 days or less than 30 seconds from the current time they are considered to be banned forever. Applied for supergroups and channels only.
+ :param until_date: Date when the user will be unbanned; Unix time. If user is banned for more than 366 days or less than 30 seconds from the current time they are considered to be banned forever. Applied for supergroups and channels only.
:param revoke_messages: Pass :code:`True` to delete all messages from the chat for the user that is being removed. If :code:`False`, the user will be able to see messages in the group that were sent before the user was removed. Always :code:`True` for supergroups and channels.
:return: instance of method :class:`aiogram.methods.ban_chat_member.BanChatMember`
"""
@@ -895,7 +983,7 @@ class Chat(TelegramObject):
until_date=until_date,
revoke_messages=revoke_messages,
**kwargs,
- )
+ ).as_(self._bot)
def set_description(
self,
@@ -924,7 +1012,7 @@ class Chat(TelegramObject):
chat_id=self.id,
description=description,
**kwargs,
- )
+ ).as_(self._bot)
def set_title(
self,
@@ -953,7 +1041,7 @@ class Chat(TelegramObject):
chat_id=self.id,
title=title,
**kwargs,
- )
+ ).as_(self._bot)
def delete_photo(
self,
@@ -979,7 +1067,7 @@ class Chat(TelegramObject):
return DeleteChatPhoto(
chat_id=self.id,
**kwargs,
- )
+ ).as_(self._bot)
def set_photo(
self,
@@ -1008,4 +1096,30 @@ class Chat(TelegramObject):
chat_id=self.id,
photo=photo,
**kwargs,
- )
+ ).as_(self._bot)
+
+ def unpin_all_general_forum_topic_messages(
+ self,
+ **kwargs: Any,
+ ) -> UnpinAllGeneralForumTopicMessages:
+ """
+ Shortcut for method :class:`aiogram.methods.unpin_all_general_forum_topic_messages.UnpinAllGeneralForumTopicMessages`
+ will automatically fill method attributes:
+
+ - :code:`chat_id`
+
+ Use this method to clear the list of pinned messages in a General forum topic. The bot must be an administrator in the chat for this to work and must have the *can_pin_messages* administrator right in the supergroup. Returns :code:`True` on success.
+
+ Source: https://core.telegram.org/bots/api#unpinallgeneralforumtopicmessages
+
+ :return: instance of method :class:`aiogram.methods.unpin_all_general_forum_topic_messages.UnpinAllGeneralForumTopicMessages`
+ """
+ # DO NOT EDIT MANUALLY!!!
+ # This method was auto-generated via `butcher`
+
+ from aiogram.methods import UnpinAllGeneralForumTopicMessages
+
+ return UnpinAllGeneralForumTopicMessages(
+ chat_id=self.id,
+ **kwargs,
+ ).as_(self._bot)
diff --git a/aiogram/types/chat_administrator_rights.py b/aiogram/types/chat_administrator_rights.py
index 23519ced..cccda5b2 100644
--- a/aiogram/types/chat_administrator_rights.py
+++ b/aiogram/types/chat_administrator_rights.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Optional
+from typing import TYPE_CHECKING, Any, Optional
from .base import TelegramObject
@@ -18,13 +18,13 @@ class ChatAdministratorRights(TelegramObject):
is_anonymous: bool
""":code:`True`, if the user's presence in the chat is hidden"""
can_manage_chat: bool
- """:code:`True`, if the administrator can access the chat event log, chat statistics, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege"""
+ """:code:`True`, if the administrator can access the chat event log, boost list in channels, see channel members, report spam messages, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege"""
can_delete_messages: bool
""":code:`True`, if the administrator can delete messages of other users"""
can_manage_video_chats: bool
""":code:`True`, if the administrator can manage video chats"""
can_restrict_members: bool
- """:code:`True`, if the administrator can restrict, ban or unban chat members"""
+ """:code:`True`, if the administrator can restrict, ban or unban chat members, or access supergroup statistics"""
can_promote_members: bool
""":code:`True`, if the administrator can add new administrators with a subset of their own privileges or demote administrators that they have promoted, directly or indirectly (promoted by administrators that were appointed by the user)"""
can_change_info: bool
@@ -32,10 +32,63 @@ class ChatAdministratorRights(TelegramObject):
can_invite_users: bool
""":code:`True`, if the user is allowed to invite new users to the chat"""
can_post_messages: Optional[bool] = None
- """*Optional*. :code:`True`, if the administrator can post in the channel; channels only"""
+ """*Optional*. :code:`True`, if the administrator can post messages in the channel, or access channel statistics; channels only"""
can_edit_messages: Optional[bool] = None
"""*Optional*. :code:`True`, if the administrator can edit messages of other users and can pin messages; channels only"""
can_pin_messages: Optional[bool] = None
"""*Optional*. :code:`True`, if the user is allowed to pin messages; groups and supergroups only"""
+ can_post_stories: Optional[bool] = None
+ """*Optional*. :code:`True`, if the administrator can post stories in the channel; channels only"""
+ can_edit_stories: Optional[bool] = None
+ """*Optional*. :code:`True`, if the administrator can edit stories posted by other users; channels only"""
+ can_delete_stories: Optional[bool] = None
+ """*Optional*. :code:`True`, if the administrator can delete stories posted by other users; channels only"""
can_manage_topics: Optional[bool] = None
"""*Optional*. :code:`True`, if the user is allowed to create, rename, close, and reopen forum topics; supergroups only"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ is_anonymous: bool,
+ can_manage_chat: bool,
+ can_delete_messages: bool,
+ can_manage_video_chats: bool,
+ can_restrict_members: bool,
+ can_promote_members: bool,
+ can_change_info: bool,
+ can_invite_users: bool,
+ can_post_messages: Optional[bool] = None,
+ can_edit_messages: Optional[bool] = None,
+ can_pin_messages: Optional[bool] = None,
+ can_post_stories: Optional[bool] = None,
+ can_edit_stories: Optional[bool] = None,
+ can_delete_stories: Optional[bool] = None,
+ can_manage_topics: Optional[bool] = 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__(
+ is_anonymous=is_anonymous,
+ can_manage_chat=can_manage_chat,
+ can_delete_messages=can_delete_messages,
+ can_manage_video_chats=can_manage_video_chats,
+ can_restrict_members=can_restrict_members,
+ can_promote_members=can_promote_members,
+ can_change_info=can_change_info,
+ can_invite_users=can_invite_users,
+ can_post_messages=can_post_messages,
+ can_edit_messages=can_edit_messages,
+ can_pin_messages=can_pin_messages,
+ can_post_stories=can_post_stories,
+ can_edit_stories=can_edit_stories,
+ can_delete_stories=can_delete_stories,
+ can_manage_topics=can_manage_topics,
+ **__pydantic_kwargs,
+ )
diff --git a/aiogram/types/chat_invite_link.py b/aiogram/types/chat_invite_link.py
index 7476f9dc..7817c23d 100644
--- a/aiogram/types/chat_invite_link.py
+++ b/aiogram/types/chat_invite_link.py
@@ -1,9 +1,9 @@
from __future__ import annotations
-import datetime
-from typing import TYPE_CHECKING, Optional
+from typing import TYPE_CHECKING, Any, Optional
from .base import TelegramObject
+from .custom import DateTime
if TYPE_CHECKING:
from .user import User
@@ -28,9 +28,44 @@ class ChatInviteLink(TelegramObject):
""":code:`True`, if the link is revoked"""
name: Optional[str] = None
"""*Optional*. Invite link name"""
- expire_date: Optional[datetime.datetime] = None
+ expire_date: Optional[DateTime] = None
"""*Optional*. Point in time (Unix timestamp) when the link will expire or has been expired"""
member_limit: Optional[int] = None
"""*Optional*. The maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999"""
pending_join_request_count: Optional[int] = None
"""*Optional*. Number of pending join requests created using this link"""
+
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ invite_link: str,
+ creator: User,
+ creates_join_request: bool,
+ is_primary: bool,
+ is_revoked: bool,
+ name: Optional[str] = None,
+ expire_date: Optional[DateTime] = None,
+ member_limit: Optional[int] = None,
+ pending_join_request_count: Optional[int] = None,
+ **__pydantic_kwargs: Any,
+ ) -> None:
+ # DO NOT EDIT MANUALLY!!!
+ # This method was auto-generated via `butcher`
+ # Is needed only for type checking and IDE support without any additional plugins
+
+ super().__init__(
+ invite_link=invite_link,
+ creator=creator,
+ creates_join_request=creates_join_request,
+ is_primary=is_primary,
+ is_revoked=is_revoked,
+ name=name,
+ expire_date=expire_date,
+ member_limit=member_limit,
+ pending_join_request_count=pending_join_request_count,
+ **__pydantic_kwargs,
+ )
diff --git a/aiogram/types/chat_join_request.py b/aiogram/types/chat_join_request.py
index ca4f8bb7..b8ba33d2 100644
--- a/aiogram/types/chat_join_request.py
+++ b/aiogram/types/chat_join_request.py
@@ -1,18 +1,53 @@
from __future__ import annotations
import datetime
-from typing import TYPE_CHECKING, Any, Optional
+from typing import TYPE_CHECKING, Any, List, Optional, Union
from pydantic import Field
-from .base import TelegramObject
-
-if TYPE_CHECKING:
- from ..methods import ApproveChatJoinRequest, DeclineChatJoinRequest
+from .base import (
+ UNSET_DISABLE_WEB_PAGE_PREVIEW,
+ UNSET_PARSE_MODE,
+ UNSET_PROTECT_CONTENT,
+ TelegramObject,
+)
+from .custom import DateTime
if TYPE_CHECKING:
+ from ..methods import (
+ ApproveChatJoinRequest,
+ DeclineChatJoinRequest,
+ SendAnimation,
+ SendAudio,
+ SendContact,
+ SendDice,
+ SendDocument,
+ SendGame,
+ SendInvoice,
+ SendLocation,
+ SendMediaGroup,
+ SendMessage,
+ SendPhoto,
+ SendPoll,
+ SendSticker,
+ SendVenue,
+ SendVideo,
+ SendVideoNote,
+ SendVoice,
+ )
from .chat import Chat
from .chat_invite_link import ChatInviteLink
+ from .force_reply import ForceReply
+ from .inline_keyboard_markup import InlineKeyboardMarkup
+ from .input_file import InputFile
+ from .input_media_audio import InputMediaAudio
+ from .input_media_document import InputMediaDocument
+ from .input_media_photo import InputMediaPhoto
+ from .input_media_video import InputMediaVideo
+ from .labeled_price import LabeledPrice
+ from .message_entity import MessageEntity
+ from .reply_keyboard_markup import ReplyKeyboardMarkup
+ from .reply_keyboard_remove import ReplyKeyboardRemove
from .user import User
@@ -28,14 +63,43 @@ class ChatJoinRequest(TelegramObject):
from_user: User = Field(..., alias="from")
"""User that sent the join request"""
user_chat_id: int
- """Identifier of a private chat with the user who sent the join request. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier. The bot can use this identifier for 24 hours to send messages until the join request is processed, assuming no other administrator contacted the user."""
- date: datetime.datetime
+ """Identifier of a private chat with the user who sent the join request. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier. The bot can use this identifier for 5 minutes to send messages until the join request is processed, assuming no other administrator contacted the user."""
+ date: DateTime
"""Date the request was sent in Unix time"""
bio: Optional[str] = None
"""*Optional*. Bio of the user."""
invite_link: Optional[ChatInviteLink] = None
"""*Optional*. Chat invite link that was used by the user to send the join request"""
+ if TYPE_CHECKING:
+ # DO NOT EDIT MANUALLY!!!
+ # This section was auto-generated via `butcher`
+
+ def __init__(
+ __pydantic__self__,
+ *,
+ chat: Chat,
+ from_user: User,
+ user_chat_id: int,
+ date: DateTime,
+ bio: Optional[str] = None,
+ invite_link: Optional[ChatInviteLink] = 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=chat,
+ from_user=from_user,
+ user_chat_id=user_chat_id,
+ date=date,
+ bio=bio,
+ invite_link=invite_link,
+ **__pydantic_kwargs,
+ )
+
def approve(
self,
**kwargs: Any,
@@ -62,7 +126,7 @@ class ChatJoinRequest(TelegramObject):
chat_id=self.chat.id,
user_id=self.from_user.id,
**kwargs,
- )
+ ).as_(self._bot)
def decline(
self,
@@ -90,4 +154,2194 @@ class ChatJoinRequest(TelegramObject):
chat_id=self.chat.id,
user_id=self.from_user.id,
**kwargs,
- )
+ ).as_(self._bot)
+
+ def answer(
+ self,
+ text: str,
+ message_thread_id: Optional[int] = None,
+ parse_mode: Optional[str] = UNSET_PARSE_MODE,
+ entities: Optional[List[MessageEntity]] = None,
+ disable_web_page_preview: Optional[bool] = UNSET_DISABLE_WEB_PAGE_PREVIEW,
+ disable_notification: Optional[bool] = None,
+ protect_content: Optional[bool] = UNSET_PROTECT_CONTENT,
+ reply_to_message_id: Optional[int] = None,
+ allow_sending_without_reply: Optional[bool] = None,
+ reply_markup: Optional[
+ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
+ ] = None,
+ **kwargs: Any,
+ ) -> SendMessage:
+ """
+ Shortcut for method :class:`aiogram.methods.send_message.SendMessage`
+ will automatically fill method attributes:
+
+ - :code:`chat_id`
+
+ Use this method to send text messages. On success, the sent :class:`aiogram.types.message.Message` is returned.
+
+ Source: https://core.telegram.org/bots/api#sendmessage
+
+ :param text: Text of the message to be sent, 1-4096 characters after entities parsing
+ :param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
+ :param parse_mode: Mode for parsing entities in the message text. See `formatting options `_ for more details.
+ :param entities: A JSON-serialized list of special entities that appear in message text, which can be specified instead of *parse_mode*
+ :param disable_web_page_preview: Disables link previews for links in this message
+ :param disable_notification: Sends the message `silently `_. Users will receive a notification with no sound.
+ :param protect_content: Protects the contents of the sent message from forwarding and saving
+ :param reply_to_message_id: If the message is a reply, ID of the original message
+ :param allow_sending_without_reply: Pass :code:`True` if the message should be sent even if the specified replied-to message is not found
+ :param reply_markup: Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove reply keyboard or to force a reply from the user.
+ :return: instance of method :class:`aiogram.methods.send_message.SendMessage`
+ """
+ # DO NOT EDIT MANUALLY!!!
+ # This method was auto-generated via `butcher`
+
+ from aiogram.methods import SendMessage
+
+ return SendMessage(
+ chat_id=self.chat.id,
+ text=text,
+ message_thread_id=message_thread_id,
+ parse_mode=parse_mode,
+ entities=entities,
+ disable_web_page_preview=disable_web_page_preview,
+ disable_notification=disable_notification,
+ protect_content=protect_content,
+ reply_to_message_id=reply_to_message_id,
+ allow_sending_without_reply=allow_sending_without_reply,
+ reply_markup=reply_markup,
+ **kwargs,
+ ).as_(self._bot)
+
+ def answer_pm(
+ self,
+ text: str,
+ message_thread_id: Optional[int] = None,
+ parse_mode: Optional[str] = UNSET_PARSE_MODE,
+ entities: Optional[List[MessageEntity]] = None,
+ disable_web_page_preview: Optional[bool] = UNSET_DISABLE_WEB_PAGE_PREVIEW,
+ disable_notification: Optional[bool] = None,
+ protect_content: Optional[bool] = UNSET_PROTECT_CONTENT,
+ reply_to_message_id: Optional[int] = None,
+ allow_sending_without_reply: Optional[bool] = None,
+ reply_markup: Optional[
+ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
+ ] = None,
+ **kwargs: Any,
+ ) -> SendMessage:
+ """
+ Shortcut for method :class:`aiogram.methods.send_message.SendMessage`
+ will automatically fill method attributes:
+
+ - :code:`chat_id`
+
+ Use this method to send text messages. On success, the sent :class:`aiogram.types.message.Message` is returned.
+
+ Source: https://core.telegram.org/bots/api#sendmessage
+
+ :param text: Text of the message to be sent, 1-4096 characters after entities parsing
+ :param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
+ :param parse_mode: Mode for parsing entities in the message text. See `formatting options `_ for more details.
+ :param entities: A JSON-serialized list of special entities that appear in message text, which can be specified instead of *parse_mode*
+ :param disable_web_page_preview: Disables link previews for links in this message
+ :param disable_notification: Sends the message `silently `_. Users will receive a notification with no sound.
+ :param protect_content: Protects the contents of the sent message from forwarding and saving
+ :param reply_to_message_id: If the message is a reply, ID of the original message
+ :param allow_sending_without_reply: Pass :code:`True` if the message should be sent even if the specified replied-to message is not found
+ :param reply_markup: Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove reply keyboard or to force a reply from the user.
+ :return: instance of method :class:`aiogram.methods.send_message.SendMessage`
+ """
+ # DO NOT EDIT MANUALLY!!!
+ # This method was auto-generated via `butcher`
+
+ from aiogram.methods import SendMessage
+
+ return SendMessage(
+ chat_id=self.user_chat_id,
+ text=text,
+ message_thread_id=message_thread_id,
+ parse_mode=parse_mode,
+ entities=entities,
+ disable_web_page_preview=disable_web_page_preview,
+ disable_notification=disable_notification,
+ protect_content=protect_content,
+ reply_to_message_id=reply_to_message_id,
+ allow_sending_without_reply=allow_sending_without_reply,
+ reply_markup=reply_markup,
+ **kwargs,
+ ).as_(self._bot)
+
+ def answer_animation(
+ self,
+ animation: Union[InputFile, str],
+ message_thread_id: Optional[int] = None,
+ duration: Optional[int] = None,
+ width: Optional[int] = None,
+ height: Optional[int] = None,
+ thumbnail: Optional[Union[InputFile, str]] = None,
+ caption: Optional[str] = None,
+ parse_mode: Optional[str] = UNSET_PARSE_MODE,
+ caption_entities: Optional[List[MessageEntity]] = None,
+ has_spoiler: Optional[bool] = None,
+ disable_notification: Optional[bool] = None,
+ protect_content: Optional[bool] = UNSET_PROTECT_CONTENT,
+ reply_to_message_id: Optional[int] = None,
+ allow_sending_without_reply: Optional[bool] = None,
+ reply_markup: Optional[
+ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
+ ] = None,
+ **kwargs: Any,
+ ) -> SendAnimation:
+ """
+ Shortcut for method :class:`aiogram.methods.send_animation.SendAnimation`
+ will automatically fill method attributes:
+
+ - :code:`chat_id`
+
+ Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). On success, the sent :class:`aiogram.types.message.Message` is returned. Bots can currently send animation files of up to 50 MB in size, this limit may be changed in the future.
+
+ Source: https://core.telegram.org/bots/api#sendanimation
+
+ :param animation: Animation to send. Pass a file_id as String to send an animation that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an animation from the Internet, or upload a new animation using multipart/form-data. :ref:`More information on Sending Files » `
+ :param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
+ :param duration: Duration of sent animation in seconds
+ :param width: Animation width
+ :param height: Animation height
+ :param thumbnail: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://' if the thumbnail was uploaded using multipart/form-data under . :ref:`More information on Sending Files » `
+ :param caption: Animation caption (may also be used when resending animation by *file_id*), 0-1024 characters after entities parsing
+ :param parse_mode: Mode for parsing entities in the animation caption. See `formatting options `_ for more details.
+ :param caption_entities: A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*
+ :param has_spoiler: Pass :code:`True` if the animation needs to be covered with a spoiler animation
+ :param disable_notification: Sends the message `silently `_. Users will receive a notification with no sound.
+ :param protect_content: Protects the contents of the sent message from forwarding and saving
+ :param reply_to_message_id: If the message is a reply, ID of the original message
+ :param allow_sending_without_reply: Pass :code:`True` if the message should be sent even if the specified replied-to message is not found
+ :param reply_markup: Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove reply keyboard or to force a reply from the user.
+ :return: instance of method :class:`aiogram.methods.send_animation.SendAnimation`
+ """
+ # DO NOT EDIT MANUALLY!!!
+ # This method was auto-generated via `butcher`
+
+ from aiogram.methods import SendAnimation
+
+ return SendAnimation(
+ chat_id=self.chat.id,
+ animation=animation,
+ message_thread_id=message_thread_id,
+ duration=duration,
+ width=width,
+ height=height,
+ thumbnail=thumbnail,
+ caption=caption,
+ parse_mode=parse_mode,
+ caption_entities=caption_entities,
+ has_spoiler=has_spoiler,
+ disable_notification=disable_notification,
+ protect_content=protect_content,
+ reply_to_message_id=reply_to_message_id,
+ allow_sending_without_reply=allow_sending_without_reply,
+ reply_markup=reply_markup,
+ **kwargs,
+ ).as_(self._bot)
+
+ def answer_animation_pm(
+ self,
+ animation: Union[InputFile, str],
+ message_thread_id: Optional[int] = None,
+ duration: Optional[int] = None,
+ width: Optional[int] = None,
+ height: Optional[int] = None,
+ thumbnail: Optional[Union[InputFile, str]] = None,
+ caption: Optional[str] = None,
+ parse_mode: Optional[str] = UNSET_PARSE_MODE,
+ caption_entities: Optional[List[MessageEntity]] = None,
+ has_spoiler: Optional[bool] = None,
+ disable_notification: Optional[bool] = None,
+ protect_content: Optional[bool] = UNSET_PROTECT_CONTENT,
+ reply_to_message_id: Optional[int] = None,
+ allow_sending_without_reply: Optional[bool] = None,
+ reply_markup: Optional[
+ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
+ ] = None,
+ **kwargs: Any,
+ ) -> SendAnimation:
+ """
+ Shortcut for method :class:`aiogram.methods.send_animation.SendAnimation`
+ will automatically fill method attributes:
+
+ - :code:`chat_id`
+
+ Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). On success, the sent :class:`aiogram.types.message.Message` is returned. Bots can currently send animation files of up to 50 MB in size, this limit may be changed in the future.
+
+ Source: https://core.telegram.org/bots/api#sendanimation
+
+ :param animation: Animation to send. Pass a file_id as String to send an animation that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an animation from the Internet, or upload a new animation using multipart/form-data. :ref:`More information on Sending Files » `
+ :param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
+ :param duration: Duration of sent animation in seconds
+ :param width: Animation width
+ :param height: Animation height
+ :param thumbnail: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://' if the thumbnail was uploaded using multipart/form-data under . :ref:`More information on Sending Files » `
+ :param caption: Animation caption (may also be used when resending animation by *file_id*), 0-1024 characters after entities parsing
+ :param parse_mode: Mode for parsing entities in the animation caption. See `formatting options `_ for more details.
+ :param caption_entities: A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*
+ :param has_spoiler: Pass :code:`True` if the animation needs to be covered with a spoiler animation
+ :param disable_notification: Sends the message `silently `_. Users will receive a notification with no sound.
+ :param protect_content: Protects the contents of the sent message from forwarding and saving
+ :param reply_to_message_id: If the message is a reply, ID of the original message
+ :param allow_sending_without_reply: Pass :code:`True` if the message should be sent even if the specified replied-to message is not found
+ :param reply_markup: Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove reply keyboard or to force a reply from the user.
+ :return: instance of method :class:`aiogram.methods.send_animation.SendAnimation`
+ """
+ # DO NOT EDIT MANUALLY!!!
+ # This method was auto-generated via `butcher`
+
+ from aiogram.methods import SendAnimation
+
+ return SendAnimation(
+ chat_id=self.user_chat_id,
+ animation=animation,
+ message_thread_id=message_thread_id,
+ duration=duration,
+ width=width,
+ height=height,
+ thumbnail=thumbnail,
+ caption=caption,
+ parse_mode=parse_mode,
+ caption_entities=caption_entities,
+ has_spoiler=has_spoiler,
+ disable_notification=disable_notification,
+ protect_content=protect_content,
+ reply_to_message_id=reply_to_message_id,
+ allow_sending_without_reply=allow_sending_without_reply,
+ reply_markup=reply_markup,
+ **kwargs,
+ ).as_(self._bot)
+
+ def answer_audio(
+ self,
+ audio: Union[InputFile, str],
+ message_thread_id: Optional[int] = None,
+ caption: Optional[str] = None,
+ parse_mode: Optional[str] = UNSET_PARSE_MODE,
+ caption_entities: Optional[List[MessageEntity]] = None,
+ duration: Optional[int] = None,
+ performer: Optional[str] = None,
+ title: Optional[str] = None,
+ thumbnail: Optional[Union[InputFile, str]] = None,
+ disable_notification: Optional[bool] = None,
+ protect_content: Optional[bool] = UNSET_PROTECT_CONTENT,
+ reply_to_message_id: Optional[int] = None,
+ allow_sending_without_reply: Optional[bool] = None,
+ reply_markup: Optional[
+ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
+ ] = None,
+ **kwargs: Any,
+ ) -> SendAudio:
+ """
+ Shortcut for method :class:`aiogram.methods.send_audio.SendAudio`
+ will automatically fill method attributes:
+
+ - :code:`chat_id`
+
+ Use this method to send audio files, if you want Telegram clients to display them in the music player. Your audio must be in the .MP3 or .M4A format. On success, the sent :class:`aiogram.types.message.Message` is returned. Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future.
+ For sending voice messages, use the :class:`aiogram.methods.send_voice.SendVoice` method instead.
+
+ Source: https://core.telegram.org/bots/api#sendaudio
+
+ :param audio: Audio file to send. Pass a file_id as String to send an audio file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an audio file from the Internet, or upload a new one using multipart/form-data. :ref:`More information on Sending Files » `
+ :param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
+ :param caption: Audio caption, 0-1024 characters after entities parsing
+ :param parse_mode: Mode for parsing entities in the audio caption. See `formatting options `_ for more details.
+ :param caption_entities: A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*
+ :param duration: Duration of the audio in seconds
+ :param performer: Performer
+ :param title: Track name
+ :param thumbnail: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://' if the thumbnail was uploaded using multipart/form-data under . :ref:`More information on Sending Files » `
+ :param disable_notification: Sends the message `silently `_. Users will receive a notification with no sound.
+ :param protect_content: Protects the contents of the sent message from forwarding and saving
+ :param reply_to_message_id: If the message is a reply, ID of the original message
+ :param allow_sending_without_reply: Pass :code:`True` if the message should be sent even if the specified replied-to message is not found
+ :param reply_markup: Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove reply keyboard or to force a reply from the user.
+ :return: instance of method :class:`aiogram.methods.send_audio.SendAudio`
+ """
+ # DO NOT EDIT MANUALLY!!!
+ # This method was auto-generated via `butcher`
+
+ from aiogram.methods import SendAudio
+
+ return SendAudio(
+ chat_id=self.chat.id,
+ audio=audio,
+ message_thread_id=message_thread_id,
+ caption=caption,
+ parse_mode=parse_mode,
+ caption_entities=caption_entities,
+ duration=duration,
+ performer=performer,
+ title=title,
+ thumbnail=thumbnail,
+ disable_notification=disable_notification,
+ protect_content=protect_content,
+ reply_to_message_id=reply_to_message_id,
+ allow_sending_without_reply=allow_sending_without_reply,
+ reply_markup=reply_markup,
+ **kwargs,
+ ).as_(self._bot)
+
+ def answer_audio_pm(
+ self,
+ audio: Union[InputFile, str],
+ message_thread_id: Optional[int] = None,
+ caption: Optional[str] = None,
+ parse_mode: Optional[str] = UNSET_PARSE_MODE,
+ caption_entities: Optional[List[MessageEntity]] = None,
+ duration: Optional[int] = None,
+ performer: Optional[str] = None,
+ title: Optional[str] = None,
+ thumbnail: Optional[Union[InputFile, str]] = None,
+ disable_notification: Optional[bool] = None,
+ protect_content: Optional[bool] = UNSET_PROTECT_CONTENT,
+ reply_to_message_id: Optional[int] = None,
+ allow_sending_without_reply: Optional[bool] = None,
+ reply_markup: Optional[
+ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
+ ] = None,
+ **kwargs: Any,
+ ) -> SendAudio:
+ """
+ Shortcut for method :class:`aiogram.methods.send_audio.SendAudio`
+ will automatically fill method attributes:
+
+ - :code:`chat_id`
+
+ Use this method to send audio files, if you want Telegram clients to display them in the music player. Your audio must be in the .MP3 or .M4A format. On success, the sent :class:`aiogram.types.message.Message` is returned. Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future.
+ For sending voice messages, use the :class:`aiogram.methods.send_voice.SendVoice` method instead.
+
+ Source: https://core.telegram.org/bots/api#sendaudio
+
+ :param audio: Audio file to send. Pass a file_id as String to send an audio file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an audio file from the Internet, or upload a new one using multipart/form-data. :ref:`More information on Sending Files » `
+ :param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
+ :param caption: Audio caption, 0-1024 characters after entities parsing
+ :param parse_mode: Mode for parsing entities in the audio caption. See `formatting options `_ for more details.
+ :param caption_entities: A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*
+ :param duration: Duration of the audio in seconds
+ :param performer: Performer
+ :param title: Track name
+ :param thumbnail: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://' if the thumbnail was uploaded using multipart/form-data under . :ref:`More information on Sending Files » `
+ :param disable_notification: Sends the message `silently `_. Users will receive a notification with no sound.
+ :param protect_content: Protects the contents of the sent message from forwarding and saving
+ :param reply_to_message_id: If the message is a reply, ID of the original message
+ :param allow_sending_without_reply: Pass :code:`True` if the message should be sent even if the specified replied-to message is not found
+ :param reply_markup: Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove reply keyboard or to force a reply from the user.
+ :return: instance of method :class:`aiogram.methods.send_audio.SendAudio`
+ """
+ # DO NOT EDIT MANUALLY!!!
+ # This method was auto-generated via `butcher`
+
+ from aiogram.methods import SendAudio
+
+ return SendAudio(
+ chat_id=self.user_chat_id,
+ audio=audio,
+ message_thread_id=message_thread_id,
+ caption=caption,
+ parse_mode=parse_mode,
+ caption_entities=caption_entities,
+ duration=duration,
+ performer=performer,
+ title=title,
+ thumbnail=thumbnail,
+ disable_notification=disable_notification,
+ protect_content=protect_content,
+ reply_to_message_id=reply_to_message_id,
+ allow_sending_without_reply=allow_sending_without_reply,
+ reply_markup=reply_markup,
+ **kwargs,
+ ).as_(self._bot)
+
+ def answer_contact(
+ self,
+ phone_number: str,
+ first_name: str,
+ message_thread_id: Optional[int] = None,
+ last_name: Optional[str] = None,
+ vcard: Optional[str] = None,
+ disable_notification: Optional[bool] = None,
+ protect_content: Optional[bool] = UNSET_PROTECT_CONTENT,
+ reply_to_message_id: Optional[int] = None,
+ allow_sending_without_reply: Optional[bool] = None,
+ reply_markup: Optional[
+ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
+ ] = None,
+ **kwargs: Any,
+ ) -> SendContact:
+ """
+ Shortcut for method :class:`aiogram.methods.send_contact.SendContact`
+ will automatically fill method attributes:
+
+ - :code:`chat_id`
+
+ Use this method to send phone contacts. On success, the sent :class:`aiogram.types.message.Message` is returned.
+
+ Source: https://core.telegram.org/bots/api#sendcontact
+
+ :param phone_number: Contact's phone number
+ :param first_name: Contact's first name
+ :param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
+ :param last_name: Contact's last name
+ :param vcard: Additional data about the contact in the form of a `vCard `_, 0-2048 bytes
+ :param disable_notification: Sends the message `silently `_. Users will receive a notification with no sound.
+ :param protect_content: Protects the contents of the sent message from forwarding and saving
+ :param reply_to_message_id: If the message is a reply, ID of the original message
+ :param allow_sending_without_reply: Pass :code:`True` if the message should be sent even if the specified replied-to message is not found
+ :param reply_markup: Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove reply keyboard or to force a reply from the user.
+ :return: instance of method :class:`aiogram.methods.send_contact.SendContact`
+ """
+ # DO NOT EDIT MANUALLY!!!
+ # This method was auto-generated via `butcher`
+
+ from aiogram.methods import SendContact
+
+ return SendContact(
+ chat_id=self.chat.id,
+ phone_number=phone_number,
+ first_name=first_name,
+ message_thread_id=message_thread_id,
+ last_name=last_name,
+ vcard=vcard,
+ disable_notification=disable_notification,
+ protect_content=protect_content,
+ reply_to_message_id=reply_to_message_id,
+ allow_sending_without_reply=allow_sending_without_reply,
+ reply_markup=reply_markup,
+ **kwargs,
+ ).as_(self._bot)
+
+ def answer_contact_pm(
+ self,
+ phone_number: str,
+ first_name: str,
+ message_thread_id: Optional[int] = None,
+ last_name: Optional[str] = None,
+ vcard: Optional[str] = None,
+ disable_notification: Optional[bool] = None,
+ protect_content: Optional[bool] = UNSET_PROTECT_CONTENT,
+ reply_to_message_id: Optional[int] = None,
+ allow_sending_without_reply: Optional[bool] = None,
+ reply_markup: Optional[
+ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
+ ] = None,
+ **kwargs: Any,
+ ) -> SendContact:
+ """
+ Shortcut for method :class:`aiogram.methods.send_contact.SendContact`
+ will automatically fill method attributes:
+
+ - :code:`chat_id`
+
+ Use this method to send phone contacts. On success, the sent :class:`aiogram.types.message.Message` is returned.
+
+ Source: https://core.telegram.org/bots/api#sendcontact
+
+ :param phone_number: Contact's phone number
+ :param first_name: Contact's first name
+ :param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
+ :param last_name: Contact's last name
+ :param vcard: Additional data about the contact in the form of a `vCard `_, 0-2048 bytes
+ :param disable_notification: Sends the message `silently `_. Users will receive a notification with no sound.
+ :param protect_content: Protects the contents of the sent message from forwarding and saving
+ :param reply_to_message_id: If the message is a reply, ID of the original message
+ :param allow_sending_without_reply: Pass :code:`True` if the message should be sent even if the specified replied-to message is not found
+ :param reply_markup: Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove reply keyboard or to force a reply from the user.
+ :return: instance of method :class:`aiogram.methods.send_contact.SendContact`
+ """
+ # DO NOT EDIT MANUALLY!!!
+ # This method was auto-generated via `butcher`
+
+ from aiogram.methods import SendContact
+
+ return SendContact(
+ chat_id=self.user_chat_id,
+ phone_number=phone_number,
+ first_name=first_name,
+ message_thread_id=message_thread_id,
+ last_name=last_name,
+ vcard=vcard,
+ disable_notification=disable_notification,
+ protect_content=protect_content,
+ reply_to_message_id=reply_to_message_id,
+ allow_sending_without_reply=allow_sending_without_reply,
+ reply_markup=reply_markup,
+ **kwargs,
+ ).as_(self._bot)
+
+ def answer_document(
+ self,
+ document: Union[InputFile, str],
+ message_thread_id: Optional[int] = None,
+ thumbnail: Optional[Union[InputFile, str]] = None,
+ caption: Optional[str] = None,
+ parse_mode: Optional[str] = UNSET_PARSE_MODE,
+ caption_entities: Optional[List[MessageEntity]] = None,
+ disable_content_type_detection: Optional[bool] = None,
+ disable_notification: Optional[bool] = None,
+ protect_content: Optional[bool] = UNSET_PROTECT_CONTENT,
+ reply_to_message_id: Optional[int] = None,
+ allow_sending_without_reply: Optional[bool] = None,
+ reply_markup: Optional[
+ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
+ ] = None,
+ **kwargs: Any,
+ ) -> SendDocument:
+ """
+ Shortcut for method :class:`aiogram.methods.send_document.SendDocument`
+ will automatically fill method attributes:
+
+ - :code:`chat_id`
+
+ Use this method to send general files. On success, the sent :class:`aiogram.types.message.Message` is returned. Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future.
+
+ Source: https://core.telegram.org/bots/api#senddocument
+
+ :param document: File to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), 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 » `
+ :param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
+ :param thumbnail: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://' if the thumbnail was uploaded using multipart/form-data under . :ref:`More information on Sending Files » `
+ :param caption: Document caption (may also be used when resending documents by *file_id*), 0-1024 characters after entities parsing
+ :param parse_mode: Mode for parsing entities in the document caption. See `formatting options `_ for more details.
+ :param caption_entities: A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*
+ :param disable_content_type_detection: Disables automatic server-side content type detection for files uploaded using multipart/form-data
+ :param disable_notification: Sends the message `silently `_. Users will receive a notification with no sound.
+ :param protect_content: Protects the contents of the sent message from forwarding and saving
+ :param reply_to_message_id: If the message is a reply, ID of the original message
+ :param allow_sending_without_reply: Pass :code:`True` if the message should be sent even if the specified replied-to message is not found
+ :param reply_markup: Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove reply keyboard or to force a reply from the user.
+ :return: instance of method :class:`aiogram.methods.send_document.SendDocument`
+ """
+ # DO NOT EDIT MANUALLY!!!
+ # This method was auto-generated via `butcher`
+
+ from aiogram.methods import SendDocument
+
+ return SendDocument(
+ chat_id=self.chat.id,
+ document=document,
+ message_thread_id=message_thread_id,
+ thumbnail=thumbnail,
+ caption=caption,
+ parse_mode=parse_mode,
+ caption_entities=caption_entities,
+ disable_content_type_detection=disable_content_type_detection,
+ disable_notification=disable_notification,
+ protect_content=protect_content,
+ reply_to_message_id=reply_to_message_id,
+ allow_sending_without_reply=allow_sending_without_reply,
+ reply_markup=reply_markup,
+ **kwargs,
+ ).as_(self._bot)
+
+ def answer_document_pm(
+ self,
+ document: Union[InputFile, str],
+ message_thread_id: Optional[int] = None,
+ thumbnail: Optional[Union[InputFile, str]] = None,
+ caption: Optional[str] = None,
+ parse_mode: Optional[str] = UNSET_PARSE_MODE,
+ caption_entities: Optional[List[MessageEntity]] = None,
+ disable_content_type_detection: Optional[bool] = None,
+ disable_notification: Optional[bool] = None,
+ protect_content: Optional[bool] = UNSET_PROTECT_CONTENT,
+ reply_to_message_id: Optional[int] = None,
+ allow_sending_without_reply: Optional[bool] = None,
+ reply_markup: Optional[
+ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
+ ] = None,
+ **kwargs: Any,
+ ) -> SendDocument:
+ """
+ Shortcut for method :class:`aiogram.methods.send_document.SendDocument`
+ will automatically fill method attributes:
+
+ - :code:`chat_id`
+
+ Use this method to send general files. On success, the sent :class:`aiogram.types.message.Message` is returned. Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future.
+
+ Source: https://core.telegram.org/bots/api#senddocument
+
+ :param document: File to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), 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 » `
+ :param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
+ :param thumbnail: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://' if the thumbnail was uploaded using multipart/form-data under . :ref:`More information on Sending Files » `
+ :param caption: Document caption (may also be used when resending documents by *file_id*), 0-1024 characters after entities parsing
+ :param parse_mode: Mode for parsing entities in the document caption. See `formatting options `_ for more details.
+ :param caption_entities: A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*
+ :param disable_content_type_detection: Disables automatic server-side content type detection for files uploaded using multipart/form-data
+ :param disable_notification: Sends the message `silently `_. Users will receive a notification with no sound.
+ :param protect_content: Protects the contents of the sent message from forwarding and saving
+ :param reply_to_message_id: If the message is a reply, ID of the original message
+ :param allow_sending_without_reply: Pass :code:`True` if the message should be sent even if the specified replied-to message is not found
+ :param reply_markup: Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove reply keyboard or to force a reply from the user.
+ :return: instance of method :class:`aiogram.methods.send_document.SendDocument`
+ """
+ # DO NOT EDIT MANUALLY!!!
+ # This method was auto-generated via `butcher`
+
+ from aiogram.methods import SendDocument
+
+ return SendDocument(
+ chat_id=self.user_chat_id,
+ document=document,
+ message_thread_id=message_thread_id,
+ thumbnail=thumbnail,
+ caption=caption,
+ parse_mode=parse_mode,
+ caption_entities=caption_entities,
+ disable_content_type_detection=disable_content_type_detection,
+ disable_notification=disable_notification,
+ protect_content=protect_content,
+ reply_to_message_id=reply_to_message_id,
+ allow_sending_without_reply=allow_sending_without_reply,
+ reply_markup=reply_markup,
+ **kwargs,
+ ).as_(self._bot)
+
+ def answer_game(
+ self,
+ game_short_name: str,
+ message_thread_id: Optional[int] = None,
+ disable_notification: Optional[bool] = None,
+ protect_content: Optional[bool] = UNSET_PROTECT_CONTENT,
+ reply_to_message_id: Optional[int] = None,
+ allow_sending_without_reply: Optional[bool] = None,
+ reply_markup: Optional[InlineKeyboardMarkup] = None,
+ **kwargs: Any,
+ ) -> SendGame:
+ """
+ Shortcut for method :class:`aiogram.methods.send_game.SendGame`
+ will automatically fill method attributes:
+
+ - :code:`chat_id`
+
+ Use this method to send a game. On success, the sent :class:`aiogram.types.message.Message` is returned.
+
+ Source: https://core.telegram.org/bots/api#sendgame
+
+ :param game_short_name: Short name of the game, serves as the unique identifier for the game. Set up your games via `@BotFather `_.
+ :param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
+ :param disable_notification: Sends the message `silently `_. Users will receive a notification with no sound.
+ :param protect_content: Protects the contents of the sent message from forwarding and saving
+ :param reply_to_message_id: If the message is a reply, ID of the original message
+ :param allow_sending_without_reply: Pass :code:`True` if the message should be sent even if the specified replied-to message is not found
+ :param reply_markup: A JSON-serialized object for an `inline keyboard `_. If empty, one 'Play game_title' button will be shown. If not empty, the first button must launch the game.
+ :return: instance of method :class:`aiogram.methods.send_game.SendGame`
+ """
+ # DO NOT EDIT MANUALLY!!!
+ # This method was auto-generated via `butcher`
+
+ from aiogram.methods import SendGame
+
+ return SendGame(
+ chat_id=self.chat.id,
+ game_short_name=game_short_name,
+ message_thread_id=message_thread_id,
+ disable_notification=disable_notification,
+ protect_content=protect_content,
+ reply_to_message_id=reply_to_message_id,
+ allow_sending_without_reply=allow_sending_without_reply,
+ reply_markup=reply_markup,
+ **kwargs,
+ ).as_(self._bot)
+
+ def answer_game_pm(
+ self,
+ game_short_name: str,
+ message_thread_id: Optional[int] = None,
+ disable_notification: Optional[bool] = None,
+ protect_content: Optional[bool] = UNSET_PROTECT_CONTENT,
+ reply_to_message_id: Optional[int] = None,
+ allow_sending_without_reply: Optional[bool] = None,
+ reply_markup: Optional[InlineKeyboardMarkup] = None,
+ **kwargs: Any,
+ ) -> SendGame:
+ """
+ Shortcut for method :class:`aiogram.methods.send_game.SendGame`
+ will automatically fill method attributes:
+
+ - :code:`chat_id`
+
+ Use this method to send a game. On success, the sent :class:`aiogram.types.message.Message` is returned.
+
+ Source: https://core.telegram.org/bots/api#sendgame
+
+ :param game_short_name: Short name of the game, serves as the unique identifier for the game. Set up your games via `@BotFather `_.
+ :param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
+ :param disable_notification: Sends the message `silently `_. Users will receive a notification with no sound.
+ :param protect_content: Protects the contents of the sent message from forwarding and saving
+ :param reply_to_message_id: If the message is a reply, ID of the original message
+ :param allow_sending_without_reply: Pass :code:`True` if the message should be sent even if the specified replied-to message is not found
+ :param reply_markup: A JSON-serialized object for an `inline keyboard `_. If empty, one 'Play game_title' button will be shown. If not empty, the first button must launch the game.
+ :return: instance of method :class:`aiogram.methods.send_game.SendGame`
+ """
+ # DO NOT EDIT MANUALLY!!!
+ # This method was auto-generated via `butcher`
+
+ from aiogram.methods import SendGame
+
+ return SendGame(
+ chat_id=self.user_chat_id,
+ game_short_name=game_short_name,
+ message_thread_id=message_thread_id,
+ disable_notification=disable_notification,
+ protect_content=protect_content,
+ reply_to_message_id=reply_to_message_id,
+ allow_sending_without_reply=allow_sending_without_reply,
+ reply_markup=reply_markup,
+ **kwargs,
+ ).as_(self._bot)
+
+ def answer_invoice(
+ self,
+ title: str,
+ description: str,
+ payload: str,
+ provider_token: str,
+ currency: str,
+ prices: List[LabeledPrice],
+ message_thread_id: Optional[int] = None,
+ max_tip_amount: Optional[int] = None,
+ suggested_tip_amounts: Optional[List[int]] = None,
+ start_parameter: Optional[str] = None,
+ provider_data: Optional[str] = None,
+ photo_url: Optional[str] = None,
+ photo_size: Optional[int] = None,
+ photo_width: Optional[int] = None,
+ photo_height: Optional[int] = None,
+ need_name: Optional[bool] = None,
+ need_phone_number: Optional[bool] = None,
+ need_email: Optional[bool] = None,
+ need_shipping_address: Optional[bool] = None,
+ send_phone_number_to_provider: Optional[bool] = None,
+ send_email_to_provider: Optional[bool] = None,
+ is_flexible: Optional[bool] = None,
+ disable_notification: Optional[bool] = None,
+ protect_content: Optional[bool] = UNSET_PROTECT_CONTENT,
+ reply_to_message_id: Optional[int] = None,
+ allow_sending_without_reply: Optional[bool] = None,
+ reply_markup: Optional[InlineKeyboardMarkup] = None,
+ **kwargs: Any,
+ ) -> SendInvoice:
+ """
+ Shortcut for method :class:`aiogram.methods.send_invoice.SendInvoice`
+ will automatically fill method attributes:
+
+ - :code:`chat_id`
+
+ Use this method to send invoices. On success, the sent :class:`aiogram.types.message.Message` is returned.
+
+ Source: https://core.telegram.org/bots/api#sendinvoice
+
+ :param title: Product name, 1-32 characters
+ :param description: Product description, 1-255 characters
+ :param payload: Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes.
+ :param provider_token: Payment provider token, obtained via `@BotFather `_
+ :param currency: Three-letter ISO 4217 currency code, see `more on currencies `_
+ :param prices: Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.)
+ :param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
+ :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
+ :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 start_parameter: Unique deep-linking parameter. If left empty, **forwarded copies** of the sent message will have a *Pay* button, allowing multiple users to pay directly from the forwarded message, using the same invoice. If non-empty, forwarded copies of the sent message will have a *URL* button with a deep link to the bot (instead of a *Pay* button), with the value used as the start parameter
+ :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.
+ :param photo_url: URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service. People like it better when they see what they are paying for.
+ :param photo_size: Photo size in bytes
+ :param photo_width: Photo width
+ :param photo_height: Photo height
+ :param need_name: Pass :code:`True` if you require the user's full name to complete the order
+ :param need_phone_number: Pass :code:`True` if you require the user's phone number to complete the order
+ :param need_email: Pass :code:`True` if you require the user's email address to complete the order
+ :param need_shipping_address: Pass :code:`True` if you require the user's shipping address to complete the order
+ :param send_phone_number_to_provider: Pass :code:`True` if the user's phone number should be sent to provider
+ :param send_email_to_provider: Pass :code:`True` if the user's email address should be sent to provider
+ :param is_flexible: Pass :code:`True` if the final price depends on the shipping method
+ :param disable_notification: Sends the message `silently `_. Users will receive a notification with no sound.
+ :param protect_content: Protects the contents of the sent message from forwarding and saving
+ :param reply_to_message_id: If the message is a reply, ID of the original message
+ :param allow_sending_without_reply: Pass :code:`True` if the message should be sent even if the specified replied-to message is not found
+ :param reply_markup: A JSON-serialized object for an `inline keyboard `_. If empty, one 'Pay :code:`total price`' button will be shown. If not empty, the first button must be a Pay button.
+ :return: instance of method :class:`aiogram.methods.send_invoice.SendInvoice`
+ """
+ # DO NOT EDIT MANUALLY!!!
+ # This method was auto-generated via `butcher`
+
+ from aiogram.methods import SendInvoice
+
+ return SendInvoice(
+ chat_id=self.chat.id,
+ title=title,
+ description=description,
+ payload=payload,
+ provider_token=provider_token,
+ currency=currency,
+ prices=prices,
+ message_thread_id=message_thread_id,
+ max_tip_amount=max_tip_amount,
+ suggested_tip_amounts=suggested_tip_amounts,
+ start_parameter=start_parameter,
+ provider_data=provider_data,
+ photo_url=photo_url,
+ photo_size=photo_size,
+ photo_width=photo_width,
+ photo_height=photo_height,
+ need_name=need_name,
+ need_phone_number=need_phone_number,
+ need_email=need_email,
+ need_shipping_address=need_shipping_address,
+ send_phone_number_to_provider=send_phone_number_to_provider,
+ send_email_to_provider=send_email_to_provider,
+ is_flexible=is_flexible,
+ disable_notification=disable_notification,
+ protect_content=protect_content,
+ reply_to_message_id=reply_to_message_id,
+ allow_sending_without_reply=allow_sending_without_reply,
+ reply_markup=reply_markup,
+ **kwargs,
+ ).as_(self._bot)
+
+ def answer_invoice_pm(
+ self,
+ title: str,
+ description: str,
+ payload: str,
+ provider_token: str,
+ currency: str,
+ prices: List[LabeledPrice],
+ message_thread_id: Optional[int] = None,
+ max_tip_amount: Optional[int] = None,
+ suggested_tip_amounts: Optional[List[int]] = None,
+ start_parameter: Optional[str] = None,
+ provider_data: Optional[str] = None,
+ photo_url: Optional[str] = None,
+ photo_size: Optional[int] = None,
+ photo_width: Optional[int] = None,
+ photo_height: Optional[int] = None,
+ need_name: Optional[bool] = None,
+ need_phone_number: Optional[bool] = None,
+ need_email: Optional[bool] = None,
+ need_shipping_address: Optional[bool] = None,
+ send_phone_number_to_provider: Optional[bool] = None,
+ send_email_to_provider: Optional[bool] = None,
+ is_flexible: Optional[bool] = None,
+ disable_notification: Optional[bool] = None,
+ protect_content: Optional[bool] = UNSET_PROTECT_CONTENT,
+ reply_to_message_id: Optional[int] = None,
+ allow_sending_without_reply: Optional[bool] = None,
+ reply_markup: Optional[InlineKeyboardMarkup] = None,
+ **kwargs: Any,
+ ) -> SendInvoice:
+ """
+ Shortcut for method :class:`aiogram.methods.send_invoice.SendInvoice`
+ will automatically fill method attributes:
+
+ - :code:`chat_id`
+
+ Use this method to send invoices. On success, the sent :class:`aiogram.types.message.Message` is returned.
+
+ Source: https://core.telegram.org/bots/api#sendinvoice
+
+ :param title: Product name, 1-32 characters
+ :param description: Product description, 1-255 characters
+ :param payload: Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes.
+ :param provider_token: Payment provider token, obtained via `@BotFather `_
+ :param currency: Three-letter ISO 4217 currency code, see `more on currencies `_
+ :param prices: Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.)
+ :param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
+ :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
+ :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 start_parameter: Unique deep-linking parameter. If left empty, **forwarded copies** of the sent message will have a *Pay* button, allowing multiple users to pay directly from the forwarded message, using the same invoice. If non-empty, forwarded copies of the sent message will have a *URL* button with a deep link to the bot (instead of a *Pay* button), with the value used as the start parameter
+ :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.
+ :param photo_url: URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service. People like it better when they see what they are paying for.
+ :param photo_size: Photo size in bytes
+ :param photo_width: Photo width
+ :param photo_height: Photo height
+ :param need_name: Pass :code:`True` if you require the user's full name to complete the order
+ :param need_phone_number: Pass :code:`True` if you require the user's phone number to complete the order
+ :param need_email: Pass :code:`True` if you require the user's email address to complete the order
+ :param need_shipping_address: Pass :code:`True` if you require the user's shipping address to complete the order
+ :param send_phone_number_to_provider: Pass :code:`True` if the user's phone number should be sent to provider
+ :param send_email_to_provider: Pass :code:`True` if the user's email address should be sent to provider
+ :param is_flexible: Pass :code:`True` if the final price depends on the shipping method
+ :param disable_notification: Sends the message `silently `_. Users will receive a notification with no sound.
+ :param protect_content: Protects the contents of the sent message from forwarding and saving
+ :param reply_to_message_id: If the message is a reply, ID of the original message
+ :param allow_sending_without_reply: Pass :code:`True` if the message should be sent even if the specified replied-to message is not found
+ :param reply_markup: A JSON-serialized object for an `inline keyboard `_. If empty, one 'Pay :code:`total price`' button will be shown. If not empty, the first button must be a Pay button.
+ :return: instance of method :class:`aiogram.methods.send_invoice.SendInvoice`
+ """
+ # DO NOT EDIT MANUALLY!!!
+ # This method was auto-generated via `butcher`
+
+ from aiogram.methods import SendInvoice
+
+ return SendInvoice(
+ chat_id=self.user_chat_id,
+ title=title,
+ description=description,
+ payload=payload,
+ provider_token=provider_token,
+ currency=currency,
+ prices=prices,
+ message_thread_id=message_thread_id,
+ max_tip_amount=max_tip_amount,
+ suggested_tip_amounts=suggested_tip_amounts,
+ start_parameter=start_parameter,
+ provider_data=provider_data,
+ photo_url=photo_url,
+ photo_size=photo_size,
+ photo_width=photo_width,
+ photo_height=photo_height,
+ need_name=need_name,
+ need_phone_number=need_phone_number,
+ need_email=need_email,
+ need_shipping_address=need_shipping_address,
+ send_phone_number_to_provider=send_phone_number_to_provider,
+ send_email_to_provider=send_email_to_provider,
+ is_flexible=is_flexible,
+ disable_notification=disable_notification,
+ protect_content=protect_content,
+ reply_to_message_id=reply_to_message_id,
+ allow_sending_without_reply=allow_sending_without_reply,
+ reply_markup=reply_markup,
+ **kwargs,
+ ).as_(self._bot)
+
+ def answer_location(
+ self,
+ latitude: float,
+ longitude: float,
+ message_thread_id: Optional[int] = None,
+ horizontal_accuracy: Optional[float] = None,
+ live_period: Optional[int] = None,
+ heading: Optional[int] = None,
+ proximity_alert_radius: Optional[int] = None,
+ disable_notification: Optional[bool] = None,
+ protect_content: Optional[bool] = UNSET_PROTECT_CONTENT,
+ reply_to_message_id: Optional[int] = None,
+ allow_sending_without_reply: Optional[bool] = None,
+ reply_markup: Optional[
+ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
+ ] = None,
+ **kwargs: Any,
+ ) -> SendLocation:
+ """
+ Shortcut for method :class:`aiogram.methods.send_location.SendLocation`
+ will automatically fill method attributes:
+
+ - :code:`chat_id`
+
+ Use this method to send point on the map. On success, the sent :class:`aiogram.types.message.Message` is returned.
+
+ Source: https://core.telegram.org/bots/api#sendlocation
+
+ :param latitude: Latitude of the location
+ :param longitude: Longitude of the location
+ :param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
+ :param horizontal_accuracy: The radius of uncertainty for the location, measured in meters; 0-1500
+ :param live_period: Period in seconds for which the location will be updated (see `Live Locations `_, should be between 60 and 86400.
+ :param heading: For live locations, a direction in which the user is moving, in degrees. Must be between 1 and 360 if specified.
+ :param proximity_alert_radius: For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified.
+ :param disable_notification: Sends the message `silently `_. Users will receive a notification with no sound.
+ :param protect_content: Protects the contents of the sent message from forwarding and saving
+ :param reply_to_message_id: If the message is a reply, ID of the original message
+ :param allow_sending_without_reply: Pass :code:`True` if the message should be sent even if the specified replied-to message is not found
+ :param reply_markup: Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove reply keyboard or to force a reply from the user.
+ :return: instance of method :class:`aiogram.methods.send_location.SendLocation`
+ """
+ # DO NOT EDIT MANUALLY!!!
+ # This method was auto-generated via `butcher`
+
+ from aiogram.methods import SendLocation
+
+ return SendLocation(
+ chat_id=self.chat.id,
+ latitude=latitude,
+ longitude=longitude,
+ message_thread_id=message_thread_id,
+ horizontal_accuracy=horizontal_accuracy,
+ live_period=live_period,
+ heading=heading,
+ proximity_alert_radius=proximity_alert_radius,
+ disable_notification=disable_notification,
+ protect_content=protect_content,
+ reply_to_message_id=reply_to_message_id,
+ allow_sending_without_reply=allow_sending_without_reply,
+ reply_markup=reply_markup,
+ **kwargs,
+ ).as_(self._bot)
+
+ def answer_location_pm(
+ self,
+ latitude: float,
+ longitude: float,
+ message_thread_id: Optional[int] = None,
+ horizontal_accuracy: Optional[float] = None,
+ live_period: Optional[int] = None,
+ heading: Optional[int] = None,
+ proximity_alert_radius: Optional[int] = None,
+ disable_notification: Optional[bool] = None,
+ protect_content: Optional[bool] = UNSET_PROTECT_CONTENT,
+ reply_to_message_id: Optional[int] = None,
+ allow_sending_without_reply: Optional[bool] = None,
+ reply_markup: Optional[
+ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
+ ] = None,
+ **kwargs: Any,
+ ) -> SendLocation:
+ """
+ Shortcut for method :class:`aiogram.methods.send_location.SendLocation`
+ will automatically fill method attributes:
+
+ - :code:`chat_id`
+
+ Use this method to send point on the map. On success, the sent :class:`aiogram.types.message.Message` is returned.
+
+ Source: https://core.telegram.org/bots/api#sendlocation
+
+ :param latitude: Latitude of the location
+ :param longitude: Longitude of the location
+ :param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
+ :param horizontal_accuracy: The radius of uncertainty for the location, measured in meters; 0-1500
+ :param live_period: Period in seconds for which the location will be updated (see `Live Locations `_, should be between 60 and 86400.
+ :param heading: For live locations, a direction in which the user is moving, in degrees. Must be between 1 and 360 if specified.
+ :param proximity_alert_radius: For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified.
+ :param disable_notification: Sends the message `silently `_. Users will receive a notification with no sound.
+ :param protect_content: Protects the contents of the sent message from forwarding and saving
+ :param reply_to_message_id: If the message is a reply, ID of the original message
+ :param allow_sending_without_reply: Pass :code:`True` if the message should be sent even if the specified replied-to message is not found
+ :param reply_markup: Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove reply keyboard or to force a reply from the user.
+ :return: instance of method :class:`aiogram.methods.send_location.SendLocation`
+ """
+ # DO NOT EDIT MANUALLY!!!
+ # This method was auto-generated via `butcher`
+
+ from aiogram.methods import SendLocation
+
+ return SendLocation(
+ chat_id=self.user_chat_id,
+ latitude=latitude,
+ longitude=longitude,
+ message_thread_id=message_thread_id,
+ horizontal_accuracy=horizontal_accuracy,
+ live_period=live_period,
+ heading=heading,
+ proximity_alert_radius=proximity_alert_radius,
+ disable_notification=disable_notification,
+ protect_content=protect_content,
+ reply_to_message_id=reply_to_message_id,
+ allow_sending_without_reply=allow_sending_without_reply,
+ reply_markup=reply_markup,
+ **kwargs,
+ ).as_(self._bot)
+
+ def answer_media_group(
+ self,
+ media: List[Union[InputMediaAudio, InputMediaDocument, InputMediaPhoto, InputMediaVideo]],
+ message_thread_id: Optional[int] = None,
+ disable_notification: Optional[bool] = None,
+ protect_content: Optional[bool] = UNSET_PROTECT_CONTENT,
+ reply_to_message_id: Optional[int] = None,
+ allow_sending_without_reply: Optional[bool] = None,
+ **kwargs: Any,
+ ) -> SendMediaGroup:
+ """
+ Shortcut for method :class:`aiogram.methods.send_media_group.SendMediaGroup`
+ will automatically fill method attributes:
+
+ - :code:`chat_id`
+
+ Use this method to send a group of photos, videos, documents or audios as an album. Documents and audio files can be only grouped in an album with messages of the same type. On success, an array of `Messages `_ that were sent is returned.
+
+ Source: https://core.telegram.org/bots/api#sendmediagroup
+
+ :param media: A JSON-serialized array describing messages to be sent, must include 2-10 items
+ :param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
+ :param disable_notification: Sends messages `silently