diff --git a/.butcher/methods/closeGeneralForumTopic/entity.json b/.butcher/methods/closeGeneralForumTopic/entity.json
new file mode 100644
index 00000000..9fcbc4fe
--- /dev/null
+++ b/.butcher/methods/closeGeneralForumTopic/entity.json
@@ -0,0 +1,27 @@
+{
+ "meta": {
+ "deprecated": false
+ },
+ "group": {
+ "title": "Available methods",
+ "anchor": "available-methods"
+ },
+ "object": {
+ "anchor": "closegeneralforumtopic",
+ "name": "closeGeneralForumTopic",
+ "description": "Use this method to close an open 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. Returns True on success.",
+ "html_description": "
Use this method to close an open 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. Returns True on success.
",
+ "rst_description": "Use this method to close an open 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the *can_manage_topics* administrator rights. Returns :code:`True` on success.",
+ "annotations": [
+ {
+ "type": "Integer or String",
+ "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"
+ }
+}
diff --git a/.butcher/methods/editForumTopic/entity.json b/.butcher/methods/editForumTopic/entity.json
index 8afac424..57bd3d5b 100644
--- a/.butcher/methods/editForumTopic/entity.json
+++ b/.butcher/methods/editForumTopic/entity.json
@@ -31,18 +31,18 @@
},
{
"type": "String",
- "required": true,
- "description": "New topic name, 1-128 characters",
- "html_description": "New topic name, 1-128 characters | ",
- "rst_description": "New topic name, 1-128 characters\n",
+ "required": false,
+ "description": "New topic name, 0-128 characters. If not specififed or empty, the current name of the topic will be kept",
+ "html_description": "New topic name, 0-128 characters. If not specififed or empty, the current name of the topic will be kept | ",
+ "rst_description": "New topic name, 0-128 characters. If not specififed or empty, the current name of the topic will be kept\n",
"name": "name"
},
{
"type": "String",
- "required": true,
- "description": "New unique identifier of the custom emoji shown as the topic icon. Use getForumTopicIconStickers to get all allowed custom emoji identifiers.",
- "html_description": "New unique identifier of the custom emoji shown as the topic icon. Use getForumTopicIconStickers to get all allowed custom emoji identifiers. | ",
- "rst_description": "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.\n",
+ "required": false,
+ "description": "New unique identifier of the custom emoji shown as the topic icon. Use 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",
+ "html_description": "New unique identifier of the custom emoji shown as the topic icon. Use 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 | ",
+ "rst_description": "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\n",
"name": "icon_custom_emoji_id"
}
],
diff --git a/.butcher/methods/editGeneralForumTopic/entity.json b/.butcher/methods/editGeneralForumTopic/entity.json
new file mode 100644
index 00000000..af18e846
--- /dev/null
+++ b/.butcher/methods/editGeneralForumTopic/entity.json
@@ -0,0 +1,35 @@
+{
+ "meta": {
+ "deprecated": false
+ },
+ "group": {
+ "title": "Available methods",
+ "anchor": "available-methods"
+ },
+ "object": {
+ "anchor": "editgeneralforumtopic",
+ "name": "editGeneralForumTopic",
+ "description": "Use this method to edit the name of the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have can_manage_topics administrator rights. Returns True on success.",
+ "html_description": "Use this method to edit the name of the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have can_manage_topics administrator rights. Returns True on success.
",
+ "rst_description": "Use this method to edit the name of the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have *can_manage_topics* administrator rights. Returns :code:`True` on success.",
+ "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"
+ },
+ {
+ "type": "String",
+ "required": true,
+ "description": "New topic name, 1-128 characters",
+ "html_description": "New topic name, 1-128 characters | ",
+ "rst_description": "New topic name, 1-128 characters\n",
+ "name": "name"
+ }
+ ],
+ "category": "methods"
+ }
+}
diff --git a/.butcher/methods/getChatMember/entity.json b/.butcher/methods/getChatMember/entity.json
index 4888f3b3..b33af127 100644
--- a/.butcher/methods/getChatMember/entity.json
+++ b/.butcher/methods/getChatMember/entity.json
@@ -9,9 +9,9 @@
"object": {
"anchor": "getchatmember",
"name": "getChatMember",
- "description": "Use this method to get information about a member of a chat. Returns a ChatMember object on success.",
- "html_description": "Use this method to get information about a member of a chat. Returns a ChatMember object on success.
",
- "rst_description": "Use this method to get information about a member of a chat. Returns a :class:`aiogram.types.chat_member.ChatMember` object on success.",
+ "description": "Use this method to get information about a member of a chat. The method is guaranteed to work only if the bot is an administrator in the chat. Returns a ChatMember object on success.",
+ "html_description": "Use this method to get information about a member of a chat. The method is guaranteed to work only if the bot is an administrator in the chat. Returns a ChatMember object on success.
",
+ "rst_description": "Use this method to get information about a member of a chat. The method is guaranteed to work only if the bot is an administrator in the chat. Returns a :class:`aiogram.types.chat_member.ChatMember` object on success.",
"annotations": [
{
"type": "Integer or String",
diff --git a/.butcher/methods/hideGeneralForumTopic/entity.json b/.butcher/methods/hideGeneralForumTopic/entity.json
new file mode 100644
index 00000000..f75c012a
--- /dev/null
+++ b/.butcher/methods/hideGeneralForumTopic/entity.json
@@ -0,0 +1,27 @@
+{
+ "meta": {
+ "deprecated": false
+ },
+ "group": {
+ "title": "Available methods",
+ "anchor": "available-methods"
+ },
+ "object": {
+ "anchor": "hidegeneralforumtopic",
+ "name": "hideGeneralForumTopic",
+ "description": "Use this method to hide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. The topic will be automatically closed if it was open. Returns True on success.",
+ "html_description": "Use this method to hide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. The topic will be automatically closed if it was open. Returns True on success.
",
+ "rst_description": "Use this method to hide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the *can_manage_topics* administrator rights. The topic will be automatically closed if it was open. 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"
+ }
+}
diff --git a/.butcher/methods/reopenGeneralForumTopic/entity.json b/.butcher/methods/reopenGeneralForumTopic/entity.json
new file mode 100644
index 00000000..c6efec74
--- /dev/null
+++ b/.butcher/methods/reopenGeneralForumTopic/entity.json
@@ -0,0 +1,27 @@
+{
+ "meta": {
+ "deprecated": false
+ },
+ "group": {
+ "title": "Available methods",
+ "anchor": "available-methods"
+ },
+ "object": {
+ "anchor": "reopengeneralforumtopic",
+ "name": "reopenGeneralForumTopic",
+ "description": "Use this method to reopen a closed 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. The topic will be automatically unhidden if it was hidden. Returns True on success.",
+ "html_description": "Use this method to reopen a closed 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. The topic will be automatically unhidden if it was hidden. Returns True on success.
",
+ "rst_description": "Use this method to reopen a closed 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the *can_manage_topics* administrator rights. The topic will be automatically unhidden if it was hidden. 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"
+ }
+}
diff --git a/.butcher/methods/sendAnimation/entity.json b/.butcher/methods/sendAnimation/entity.json
index aea0f674..92ebaa2d 100644
--- a/.butcher/methods/sendAnimation/entity.json
+++ b/.butcher/methods/sendAnimation/entity.json
@@ -93,6 +93,14 @@
"rst_description": "A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*\n",
"name": "caption_entities"
},
+ {
+ "type": "Boolean",
+ "required": false,
+ "description": "Pass True if the animation needs to be covered with a spoiler animation",
+ "html_description": "Pass True if the animation needs to be covered with a spoiler animation | ",
+ "rst_description": "Pass :code:`True` if the animation needs to be covered with a spoiler animation\n",
+ "name": "has_spoiler"
+ },
{
"type": "Boolean",
"required": false,
diff --git a/.butcher/methods/sendChatAction/entity.json b/.butcher/methods/sendChatAction/entity.json
index ac43f7b8..cda25c18 100644
--- a/.butcher/methods/sendChatAction/entity.json
+++ b/.butcher/methods/sendChatAction/entity.json
@@ -21,6 +21,14 @@
"rst_description": "Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)\n",
"name": "chat_id"
},
+ {
+ "type": "Integer",
+ "required": false,
+ "description": "Unique identifier for the target message thread; supergroups only",
+ "html_description": "Unique identifier for the target message thread; supergroups only | ",
+ "rst_description": "Unique identifier for the target message thread; supergroups only\n",
+ "name": "message_thread_id"
+ },
{
"type": "String",
"required": true,
diff --git a/.butcher/methods/sendPhoto/entity.json b/.butcher/methods/sendPhoto/entity.json
index 05dea124..2cc2639f 100644
--- a/.butcher/methods/sendPhoto/entity.json
+++ b/.butcher/methods/sendPhoto/entity.json
@@ -61,6 +61,14 @@
"rst_description": "A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*\n",
"name": "caption_entities"
},
+ {
+ "type": "Boolean",
+ "required": false,
+ "description": "Pass True if the photo needs to be covered with a spoiler animation",
+ "html_description": "Pass True if the photo needs to be covered with a spoiler animation | ",
+ "rst_description": "Pass :code:`True` if the photo needs to be covered with a spoiler animation\n",
+ "name": "has_spoiler"
+ },
{
"type": "Boolean",
"required": false,
diff --git a/.butcher/methods/sendVideo/entity.json b/.butcher/methods/sendVideo/entity.json
index 8f25a6d9..9343c43f 100644
--- a/.butcher/methods/sendVideo/entity.json
+++ b/.butcher/methods/sendVideo/entity.json
@@ -93,6 +93,14 @@
"rst_description": "A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*\n",
"name": "caption_entities"
},
+ {
+ "type": "Boolean",
+ "required": false,
+ "description": "Pass True if the video needs to be covered with a spoiler animation",
+ "html_description": "Pass True if the video needs to be covered with a spoiler animation | ",
+ "rst_description": "Pass :code:`True` if the video needs to be covered with a spoiler animation\n",
+ "name": "has_spoiler"
+ },
{
"type": "Boolean",
"required": false,
diff --git a/.butcher/methods/unhideGeneralForumTopic/entity.json b/.butcher/methods/unhideGeneralForumTopic/entity.json
new file mode 100644
index 00000000..962e0473
--- /dev/null
+++ b/.butcher/methods/unhideGeneralForumTopic/entity.json
@@ -0,0 +1,27 @@
+{
+ "meta": {
+ "deprecated": false
+ },
+ "group": {
+ "title": "Available methods",
+ "anchor": "available-methods"
+ },
+ "object": {
+ "anchor": "unhidegeneralforumtopic",
+ "name": "unhideGeneralForumTopic",
+ "description": "Use this method to unhide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. Returns True on success.",
+ "html_description": "Use this method to unhide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. Returns True on success.
",
+ "rst_description": "Use this method to unhide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the *can_manage_topics* administrator rights. Returns :code:`True` on success.",
+ "annotations": [
+ {
+ "type": "Integer or String",
+ "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"
+ }
+}
diff --git a/.butcher/schema/schema.json b/.butcher/schema/schema.json
index 5a184105..b79d08ae 100644
--- a/.butcher/schema/schema.json
+++ b/.butcher/schema/schema.json
@@ -1,7 +1,7 @@
{
"api": {
- "version": "6.3",
- "release_date": "2022-11-05"
+ "version": "6.4",
+ "release_date": "2022-12-30"
},
"items": [
{
@@ -635,6 +635,22 @@
"name": "message_auto_delete_time",
"required": false
},
+ {
+ "type": "True",
+ "description": "True, if aggressive anti-spam checks are enabled in the supergroup. The field is only available to chat administrators. Returned only in getChat.",
+ "html_description": "Optional. True, if aggressive anti-spam checks are enabled in the supergroup. The field is only available to chat administrators. Returned only in getChat. | ",
+ "rst_description": "*Optional*. :code:`True`, if aggressive anti-spam checks are enabled in the supergroup. The field is only available to chat administrators. Returned only in :class:`aiogram.methods.get_chat.GetChat`.\n",
+ "name": "has_aggressive_anti_spam_enabled",
+ "required": false
+ },
+ {
+ "type": "True",
+ "description": "True, if non-administrators can only get the list of bots and administrators in the chat. Returned only in getChat.",
+ "html_description": "Optional. True, if non-administrators can only get the list of bots and administrators in the chat. Returned only in getChat. | ",
+ "rst_description": "*Optional*. :code:`True`, if non-administrators can only get the list of bots and administrators in the chat. Returned only in :class:`aiogram.methods.get_chat.GetChat`.\n",
+ "name": "has_hidden_members",
+ "required": false
+ },
{
"type": "True",
"description": "True, if messages from the chat can't be forwarded to other chats. Returned only in getChat.",
@@ -941,6 +957,14 @@
"name": "caption_entities",
"required": false
},
+ {
+ "type": "True",
+ "description": "True, if the message media is covered by a spoiler animation",
+ "html_description": "Optional. True, if the message media is covered by a spoiler animation | ",
+ "rst_description": "*Optional*. :code:`True`, if the message media is covered by a spoiler animation\n",
+ "name": "has_media_spoiler",
+ "required": false
+ },
{
"type": "Contact",
"description": "Message is a shared contact, information about the contact",
@@ -1109,6 +1133,14 @@
"name": "connected_website",
"required": false
},
+ {
+ "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",
+ "name": "write_access_allowed",
+ "required": false
+ },
{
"type": "PassportData",
"description": "Telegram Passport data",
@@ -1133,6 +1165,14 @@
"name": "forum_topic_created",
"required": false
},
+ {
+ "type": "ForumTopicEdited",
+ "description": "Service message: forum topic edited",
+ "html_description": "Optional. Service message: forum topic edited | ",
+ "rst_description": "*Optional*. Service message: forum topic edited\n",
+ "name": "forum_topic_edited",
+ "required": false
+ },
{
"type": "ForumTopicClosed",
"description": "Service message: forum topic closed",
@@ -1149,6 +1189,22 @@
"name": "forum_topic_reopened",
"required": false
},
+ {
+ "type": "GeneralForumTopicHidden",
+ "description": "Service message: the 'General' forum topic hidden",
+ "html_description": "Optional. Service message: the 'General' forum topic hidden | ",
+ "rst_description": "*Optional*. Service message: the 'General' forum topic hidden\n",
+ "name": "general_forum_topic_hidden",
+ "required": false
+ },
+ {
+ "type": "GeneralForumTopicUnhidden",
+ "description": "Service message: the 'General' forum topic unhidden",
+ "html_description": "Optional. Service message: the 'General' forum topic unhidden | ",
+ "rst_description": "*Optional*. Service message: the 'General' forum topic unhidden\n",
+ "name": "general_forum_topic_unhidden",
+ "required": false
+ },
{
"type": "VideoChatScheduled",
"description": "Service message: video chat scheduled",
@@ -2241,6 +2297,32 @@
"annotations": [],
"category": "types"
},
+ {
+ "anchor": "forumtopicedited",
+ "name": "ForumTopicEdited",
+ "description": "This object represents a service message about an edited forum topic.",
+ "html_description": "This object represents a service message about an edited forum topic.
",
+ "rst_description": "This object represents a service message about an edited forum topic.",
+ "annotations": [
+ {
+ "type": "String",
+ "description": "New name of the topic, if it was edited",
+ "html_description": "Optional. New name of the topic, if it was edited | ",
+ "rst_description": "*Optional*. New name of the topic, if it was edited\n",
+ "name": "name",
+ "required": false
+ },
+ {
+ "type": "String",
+ "description": "New identifier of the custom emoji shown as the topic icon, if it was edited; an empty string if the icon was removed",
+ "html_description": "Optional. New identifier of the custom emoji shown as the topic icon, if it was edited; an empty string if the icon was removed | ",
+ "rst_description": "*Optional*. New identifier of the custom emoji shown as the topic icon, if it was edited; an empty string if the icon was removed\n",
+ "name": "icon_custom_emoji_id",
+ "required": false
+ }
+ ],
+ "category": "types"
+ },
{
"anchor": "forumtopicreopened",
"name": "ForumTopicReopened",
@@ -2250,6 +2332,33 @@
"annotations": [],
"category": "types"
},
+ {
+ "anchor": "generalforumtopichidden",
+ "name": "GeneralForumTopicHidden",
+ "description": "This object represents a service message about General forum topic hidden in the chat. Currently holds no information.",
+ "html_description": "This object represents a service message about General forum topic hidden in the chat. Currently holds no information.
",
+ "rst_description": "This object represents a service message about General forum topic hidden in the chat. Currently holds no information.",
+ "annotations": [],
+ "category": "types"
+ },
+ {
+ "anchor": "generalforumtopicunhidden",
+ "name": "GeneralForumTopicUnhidden",
+ "description": "This object represents a service message about General forum topic unhidden in the chat. Currently holds no information.",
+ "html_description": "This object represents a service message about General forum topic unhidden in the chat. Currently holds no information.
",
+ "rst_description": "This object represents a service message about General forum topic unhidden in the chat. Currently holds no information.",
+ "annotations": [],
+ "category": "types"
+ },
+ {
+ "anchor": "writeaccessallowed",
+ "name": "WriteAccessAllowed",
+ "description": "This object represents a service message about a user allowing a bot added to the attachment menu to write messages. Currently holds no information.",
+ "html_description": "This object represents a service message about a user allowing a bot added to the attachment menu to write messages. Currently holds no information.
",
+ "rst_description": "This object represents a service message about a user allowing a bot added to the attachment menu to write messages. Currently holds no information.",
+ "annotations": [],
+ "category": "types"
+ },
{
"anchor": "videochatscheduled",
"name": "VideoChatScheduled",
@@ -2414,6 +2523,14 @@
"name": "keyboard",
"required": true
},
+ {
+ "type": "Boolean",
+ "description": "Requests clients to always show the keyboard when the regular keyboard is hidden. Defaults to false, in which case the custom keyboard can be hidden and opened with a keyboard icon.",
+ "html_description": "Optional. Requests clients to always show the keyboard when the regular keyboard is hidden. Defaults to false, in which case the custom keyboard can be hidden and opened with a keyboard icon. | ",
+ "rst_description": "*Optional*. Requests clients to always show the keyboard when the regular keyboard is hidden. Defaults to *false*, in which case the custom keyboard can be hidden and opened with a keyboard icon.\n",
+ "name": "is_persistent",
+ "required": false
+ },
{
"type": "Boolean",
"description": "Requests clients to resize the keyboard vertically for optimal fit (e.g., make the keyboard smaller if there are just two rows of buttons). Defaults to false, in which case the custom keyboard is always of the same height as the app's standard keyboard.",
@@ -4015,6 +4132,14 @@
"rst_description": "*Optional*. List of special entities that appear in the caption, which can be specified instead of *parse_mode*\n",
"name": "caption_entities",
"required": false
+ },
+ {
+ "type": "Boolean",
+ "description": "Pass True if the photo needs to be covered with a spoiler animation",
+ "html_description": "Optional. Pass True if the photo needs to be covered with a spoiler animation | ",
+ "rst_description": "*Optional*. Pass :code:`True` if the photo needs to be covered with a spoiler animation\n",
+ "name": "has_spoiler",
+ "required": false
}
],
"category": "types"
@@ -4105,6 +4230,14 @@
"rst_description": "*Optional*. Pass :code:`True` if the uploaded video is suitable for streaming\n",
"name": "supports_streaming",
"required": false
+ },
+ {
+ "type": "Boolean",
+ "description": "Pass True if the video needs to be covered with a spoiler animation",
+ "html_description": "Optional. Pass True if the video needs to be covered with a spoiler animation | ",
+ "rst_description": "*Optional*. Pass :code:`True` if the video needs to be covered with a spoiler animation\n",
+ "name": "has_spoiler",
+ "required": false
}
],
"category": "types"
@@ -4187,6 +4320,14 @@
"rst_description": "*Optional*. Animation duration in seconds\n",
"name": "duration",
"required": false
+ },
+ {
+ "type": "Boolean",
+ "description": "Pass True if the animation needs to be covered with a spoiler animation",
+ "html_description": "Optional. Pass True if the animation needs to be covered with a spoiler animation | ",
+ "rst_description": "*Optional*. Pass :code:`True` if the animation needs to be covered with a spoiler animation\n",
+ "name": "has_spoiler",
+ "required": false
}
],
"category": "types"
@@ -4699,6 +4840,14 @@
"rst_description": "A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*\n",
"name": "caption_entities"
},
+ {
+ "type": "Boolean",
+ "required": false,
+ "description": "Pass True if the photo needs to be covered with a spoiler animation",
+ "html_description": "Pass True if the photo needs to be covered with a spoiler animation | ",
+ "rst_description": "Pass :code:`True` if the photo needs to be covered with a spoiler animation\n",
+ "name": "has_spoiler"
+ },
{
"type": "Boolean",
"required": false,
@@ -5073,6 +5222,14 @@
"rst_description": "A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*\n",
"name": "caption_entities"
},
+ {
+ "type": "Boolean",
+ "required": false,
+ "description": "Pass True if the video needs to be covered with a spoiler animation",
+ "html_description": "Pass True if the video needs to be covered with a spoiler animation | ",
+ "rst_description": "Pass :code:`True` if the video needs to be covered with a spoiler animation\n",
+ "name": "has_spoiler"
+ },
{
"type": "Boolean",
"required": false,
@@ -5211,6 +5368,14 @@
"rst_description": "A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*\n",
"name": "caption_entities"
},
+ {
+ "type": "Boolean",
+ "required": false,
+ "description": "Pass True if the animation needs to be covered with a spoiler animation",
+ "html_description": "Pass True if the animation needs to be covered with a spoiler animation | ",
+ "rst_description": "Pass :code:`True` if the animation needs to be covered with a spoiler animation\n",
+ "name": "has_spoiler"
+ },
{
"type": "Boolean",
"required": false,
@@ -6241,6 +6406,14 @@
"rst_description": "Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)\n",
"name": "chat_id"
},
+ {
+ "type": "Integer",
+ "required": false,
+ "description": "Unique identifier for the target message thread; supergroups only",
+ "html_description": "Unique identifier for the target message thread; supergroups only | ",
+ "rst_description": "Unique identifier for the target message thread; supergroups only\n",
+ "name": "message_thread_id"
+ },
{
"type": "String",
"required": true,
@@ -7109,9 +7282,9 @@
{
"anchor": "getchatmember",
"name": "getChatMember",
- "description": "Use this method to get information about a member of a chat. Returns a ChatMember object on success.",
- "html_description": "Use this method to get information about a member of a chat. Returns a ChatMember object on success.
",
- "rst_description": "Use this method to get information about a member of a chat. Returns a :class:`aiogram.types.chat_member.ChatMember` object on success.",
+ "description": "Use this method to get information about a member of a chat. The method is guaranteed to work only if the bot is an administrator in the chat. Returns a ChatMember object on success.",
+ "html_description": "Use this method to get information about a member of a chat. The method is guaranteed to work only if the bot is an administrator in the chat. Returns a ChatMember object on success.
",
+ "rst_description": "Use this method to get information about a member of a chat. The method is guaranteed to work only if the bot is an administrator in the chat. Returns a :class:`aiogram.types.chat_member.ChatMember` object on success.",
"annotations": [
{
"type": "Integer or String",
@@ -7252,18 +7425,18 @@
},
{
"type": "String",
- "required": true,
- "description": "New topic name, 1-128 characters",
- "html_description": "New topic name, 1-128 characters | ",
- "rst_description": "New topic name, 1-128 characters\n",
+ "required": false,
+ "description": "New topic name, 0-128 characters. If not specififed or empty, the current name of the topic will be kept",
+ "html_description": "New topic name, 0-128 characters. If not specififed or empty, the current name of the topic will be kept | ",
+ "rst_description": "New topic name, 0-128 characters. If not specififed or empty, the current name of the topic will be kept\n",
"name": "name"
},
{
"type": "String",
- "required": true,
- "description": "New unique identifier of the custom emoji shown as the topic icon. Use getForumTopicIconStickers to get all allowed custom emoji identifiers.",
- "html_description": "New unique identifier of the custom emoji shown as the topic icon. Use getForumTopicIconStickers to get all allowed custom emoji identifiers. | ",
- "rst_description": "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.\n",
+ "required": false,
+ "description": "New unique identifier of the custom emoji shown as the topic icon. Use 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",
+ "html_description": "New unique identifier of the custom emoji shown as the topic icon. Use 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 | ",
+ "rst_description": "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\n",
"name": "icon_custom_emoji_id"
}
],
@@ -7373,6 +7546,104 @@
],
"category": "methods"
},
+ {
+ "anchor": "editgeneralforumtopic",
+ "name": "editGeneralForumTopic",
+ "description": "Use this method to edit the name of the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have can_manage_topics administrator rights. Returns True on success.",
+ "html_description": "Use this method to edit the name of the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have can_manage_topics administrator rights. Returns True on success.
",
+ "rst_description": "Use this method to edit the name of the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have *can_manage_topics* administrator rights. Returns :code:`True` on success.",
+ "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"
+ },
+ {
+ "type": "String",
+ "required": true,
+ "description": "New topic name, 1-128 characters",
+ "html_description": "New topic name, 1-128 characters | ",
+ "rst_description": "New topic name, 1-128 characters\n",
+ "name": "name"
+ }
+ ],
+ "category": "methods"
+ },
+ {
+ "anchor": "closegeneralforumtopic",
+ "name": "closeGeneralForumTopic",
+ "description": "Use this method to close an open 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. Returns True on success.",
+ "html_description": "Use this method to close an open 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. Returns True on success.
",
+ "rst_description": "Use this method to close an open 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the *can_manage_topics* administrator rights. Returns :code:`True` on success.",
+ "annotations": [
+ {
+ "type": "Integer or String",
+ "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": "reopengeneralforumtopic",
+ "name": "reopenGeneralForumTopic",
+ "description": "Use this method to reopen a closed 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. The topic will be automatically unhidden if it was hidden. Returns True on success.",
+ "html_description": "Use this method to reopen a closed 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. The topic will be automatically unhidden if it was hidden. Returns True on success.
",
+ "rst_description": "Use this method to reopen a closed 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the *can_manage_topics* administrator rights. The topic will be automatically unhidden if it was hidden. 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": "hidegeneralforumtopic",
+ "name": "hideGeneralForumTopic",
+ "description": "Use this method to hide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. The topic will be automatically closed if it was open. Returns True on success.",
+ "html_description": "Use this method to hide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. The topic will be automatically closed if it was open. Returns True on success.
",
+ "rst_description": "Use this method to hide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the *can_manage_topics* administrator rights. The topic will be automatically closed if it was open. 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": "unhidegeneralforumtopic",
+ "name": "unhideGeneralForumTopic",
+ "description": "Use this method to unhide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. Returns True on success.",
+ "html_description": "Use this method to unhide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. Returns True on success.
",
+ "rst_description": "Use this method to unhide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the *can_manage_topics* administrator rights. Returns :code:`True` on success.",
+ "annotations": [
+ {
+ "type": "Integer or String",
+ "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",
diff --git a/.butcher/types/Chat/entity.json b/.butcher/types/Chat/entity.json
index 49660a75..5ba08c1d 100644
--- a/.butcher/types/Chat/entity.json
+++ b/.butcher/types/Chat/entity.json
@@ -181,6 +181,22 @@
"name": "message_auto_delete_time",
"required": false
},
+ {
+ "type": "True",
+ "description": "True, if aggressive anti-spam checks are enabled in the supergroup. The field is only available to chat administrators. Returned only in getChat.",
+ "html_description": "Optional. True, if aggressive anti-spam checks are enabled in the supergroup. The field is only available to chat administrators. Returned only in getChat. | ",
+ "rst_description": "*Optional*. :code:`True`, if aggressive anti-spam checks are enabled in the supergroup. The field is only available to chat administrators. Returned only in :class:`aiogram.methods.get_chat.GetChat`.\n",
+ "name": "has_aggressive_anti_spam_enabled",
+ "required": false
+ },
+ {
+ "type": "True",
+ "description": "True, if non-administrators can only get the list of bots and administrators in the chat. Returned only in getChat.",
+ "html_description": "Optional. True, if non-administrators can only get the list of bots and administrators in the chat. Returned only in getChat. | ",
+ "rst_description": "*Optional*. :code:`True`, if non-administrators can only get the list of bots and administrators in the chat. Returned only in :class:`aiogram.methods.get_chat.GetChat`.\n",
+ "name": "has_hidden_members",
+ "required": false
+ },
{
"type": "True",
"description": "True, if messages from the chat can't be forwarded to other chats. Returned only in getChat.",
diff --git a/.butcher/types/ForumTopicEdited/entity.json b/.butcher/types/ForumTopicEdited/entity.json
new file mode 100644
index 00000000..0adc5fdd
--- /dev/null
+++ b/.butcher/types/ForumTopicEdited/entity.json
@@ -0,0 +1,35 @@
+{
+ "meta": {
+ "deprecated": false
+ },
+ "group": {
+ "title": "Available types",
+ "anchor": "available-types"
+ },
+ "object": {
+ "anchor": "forumtopicedited",
+ "name": "ForumTopicEdited",
+ "description": "This object represents a service message about an edited forum topic.",
+ "html_description": "This object represents a service message about an edited forum topic.
",
+ "rst_description": "This object represents a service message about an edited forum topic.",
+ "annotations": [
+ {
+ "type": "String",
+ "description": "New name of the topic, if it was edited",
+ "html_description": "Optional. New name of the topic, if it was edited | ",
+ "rst_description": "*Optional*. New name of the topic, if it was edited\n",
+ "name": "name",
+ "required": false
+ },
+ {
+ "type": "String",
+ "description": "New identifier of the custom emoji shown as the topic icon, if it was edited; an empty string if the icon was removed",
+ "html_description": "Optional. New identifier of the custom emoji shown as the topic icon, if it was edited; an empty string if the icon was removed | ",
+ "rst_description": "*Optional*. New identifier of the custom emoji shown as the topic icon, if it was edited; an empty string if the icon was removed\n",
+ "name": "icon_custom_emoji_id",
+ "required": false
+ }
+ ],
+ "category": "types"
+ }
+}
diff --git a/.butcher/types/GeneralForumTopicHidden/entity.json b/.butcher/types/GeneralForumTopicHidden/entity.json
new file mode 100644
index 00000000..de94d519
--- /dev/null
+++ b/.butcher/types/GeneralForumTopicHidden/entity.json
@@ -0,0 +1,18 @@
+{
+ "meta": {
+ "deprecated": false
+ },
+ "group": {
+ "title": "Available types",
+ "anchor": "available-types"
+ },
+ "object": {
+ "anchor": "generalforumtopichidden",
+ "name": "GeneralForumTopicHidden",
+ "description": "This object represents a service message about General forum topic hidden in the chat. Currently holds no information.",
+ "html_description": "This object represents a service message about General forum topic hidden in the chat. Currently holds no information.
",
+ "rst_description": "This object represents a service message about General forum topic hidden in the chat. Currently holds no information.",
+ "annotations": [],
+ "category": "types"
+ }
+}
diff --git a/.butcher/types/GeneralForumTopicUnhidden/entity.json b/.butcher/types/GeneralForumTopicUnhidden/entity.json
new file mode 100644
index 00000000..4c3d2287
--- /dev/null
+++ b/.butcher/types/GeneralForumTopicUnhidden/entity.json
@@ -0,0 +1,18 @@
+{
+ "meta": {
+ "deprecated": false
+ },
+ "group": {
+ "title": "Available types",
+ "anchor": "available-types"
+ },
+ "object": {
+ "anchor": "generalforumtopicunhidden",
+ "name": "GeneralForumTopicUnhidden",
+ "description": "This object represents a service message about General forum topic unhidden in the chat. Currently holds no information.",
+ "html_description": "This object represents a service message about General forum topic unhidden in the chat. Currently holds no information.
",
+ "rst_description": "This object represents a service message about General forum topic unhidden in the chat. Currently holds no information.",
+ "annotations": [],
+ "category": "types"
+ }
+}
diff --git a/.butcher/types/InputMediaAnimation/entity.json b/.butcher/types/InputMediaAnimation/entity.json
index a106d803..80dd5629 100644
--- a/.butcher/types/InputMediaAnimation/entity.json
+++ b/.butcher/types/InputMediaAnimation/entity.json
@@ -84,6 +84,14 @@
"rst_description": "*Optional*. Animation duration in seconds\n",
"name": "duration",
"required": false
+ },
+ {
+ "type": "Boolean",
+ "description": "Pass True if the animation needs to be covered with a spoiler animation",
+ "html_description": "Optional. Pass True if the animation needs to be covered with a spoiler animation | ",
+ "rst_description": "*Optional*. Pass :code:`True` if the animation needs to be covered with a spoiler animation\n",
+ "name": "has_spoiler",
+ "required": false
}
],
"category": "types"
diff --git a/.butcher/types/InputMediaPhoto/entity.json b/.butcher/types/InputMediaPhoto/entity.json
index 792f2cd1..091db974 100644
--- a/.butcher/types/InputMediaPhoto/entity.json
+++ b/.butcher/types/InputMediaPhoto/entity.json
@@ -52,6 +52,14 @@
"rst_description": "*Optional*. List of special entities that appear in the caption, which can be specified instead of *parse_mode*\n",
"name": "caption_entities",
"required": false
+ },
+ {
+ "type": "Boolean",
+ "description": "Pass True if the photo needs to be covered with a spoiler animation",
+ "html_description": "Optional. Pass True if the photo needs to be covered with a spoiler animation | ",
+ "rst_description": "*Optional*. Pass :code:`True` if the photo needs to be covered with a spoiler animation\n",
+ "name": "has_spoiler",
+ "required": false
}
],
"category": "types"
diff --git a/.butcher/types/InputMediaVideo/entity.json b/.butcher/types/InputMediaVideo/entity.json
index 2f200b46..97ceb6b7 100644
--- a/.butcher/types/InputMediaVideo/entity.json
+++ b/.butcher/types/InputMediaVideo/entity.json
@@ -92,6 +92,14 @@
"rst_description": "*Optional*. Pass :code:`True` if the uploaded video is suitable for streaming\n",
"name": "supports_streaming",
"required": false
+ },
+ {
+ "type": "Boolean",
+ "description": "Pass True if the video needs to be covered with a spoiler animation",
+ "html_description": "Optional. Pass True if the video needs to be covered with a spoiler animation | ",
+ "rst_description": "*Optional*. Pass :code:`True` if the video needs to be covered with a spoiler animation\n",
+ "name": "has_spoiler",
+ "required": false
}
],
"category": "types"
diff --git a/.butcher/types/Message/entity.json b/.butcher/types/Message/entity.json
index 8ebf773a..4613ecb7 100644
--- a/.butcher/types/Message/entity.json
+++ b/.butcher/types/Message/entity.json
@@ -269,6 +269,14 @@
"name": "caption_entities",
"required": false
},
+ {
+ "type": "True",
+ "description": "True, if the message media is covered by a spoiler animation",
+ "html_description": "Optional. True, if the message media is covered by a spoiler animation | ",
+ "rst_description": "*Optional*. :code:`True`, if the message media is covered by a spoiler animation\n",
+ "name": "has_media_spoiler",
+ "required": false
+ },
{
"type": "Contact",
"description": "Message is a shared contact, information about the contact",
@@ -437,6 +445,14 @@
"name": "connected_website",
"required": false
},
+ {
+ "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",
+ "name": "write_access_allowed",
+ "required": false
+ },
{
"type": "PassportData",
"description": "Telegram Passport data",
@@ -461,6 +477,14 @@
"name": "forum_topic_created",
"required": false
},
+ {
+ "type": "ForumTopicEdited",
+ "description": "Service message: forum topic edited",
+ "html_description": "Optional. Service message: forum topic edited | ",
+ "rst_description": "*Optional*. Service message: forum topic edited\n",
+ "name": "forum_topic_edited",
+ "required": false
+ },
{
"type": "ForumTopicClosed",
"description": "Service message: forum topic closed",
@@ -477,6 +501,22 @@
"name": "forum_topic_reopened",
"required": false
},
+ {
+ "type": "GeneralForumTopicHidden",
+ "description": "Service message: the 'General' forum topic hidden",
+ "html_description": "Optional. Service message: the 'General' forum topic hidden | ",
+ "rst_description": "*Optional*. Service message: the 'General' forum topic hidden\n",
+ "name": "general_forum_topic_hidden",
+ "required": false
+ },
+ {
+ "type": "GeneralForumTopicUnhidden",
+ "description": "Service message: the 'General' forum topic unhidden",
+ "html_description": "Optional. Service message: the 'General' forum topic unhidden | ",
+ "rst_description": "*Optional*. Service message: the 'General' forum topic unhidden\n",
+ "name": "general_forum_topic_unhidden",
+ "required": false
+ },
{
"type": "VideoChatScheduled",
"description": "Service message: video chat scheduled",
diff --git a/.butcher/types/ReplyKeyboardMarkup/entity.json b/.butcher/types/ReplyKeyboardMarkup/entity.json
index 1ae025ff..586bf507 100644
--- a/.butcher/types/ReplyKeyboardMarkup/entity.json
+++ b/.butcher/types/ReplyKeyboardMarkup/entity.json
@@ -21,6 +21,14 @@
"name": "keyboard",
"required": true
},
+ {
+ "type": "Boolean",
+ "description": "Requests clients to always show the keyboard when the regular keyboard is hidden. Defaults to false, in which case the custom keyboard can be hidden and opened with a keyboard icon.",
+ "html_description": "Optional. Requests clients to always show the keyboard when the regular keyboard is hidden. Defaults to false, in which case the custom keyboard can be hidden and opened with a keyboard icon. | ",
+ "rst_description": "*Optional*. Requests clients to always show the keyboard when the regular keyboard is hidden. Defaults to *false*, in which case the custom keyboard can be hidden and opened with a keyboard icon.\n",
+ "name": "is_persistent",
+ "required": false
+ },
{
"type": "Boolean",
"description": "Requests clients to resize the keyboard vertically for optimal fit (e.g., make the keyboard smaller if there are just two rows of buttons). Defaults to false, in which case the custom keyboard is always of the same height as the app's standard keyboard.",
diff --git a/.butcher/types/WriteAccessAllowed/entity.json b/.butcher/types/WriteAccessAllowed/entity.json
new file mode 100644
index 00000000..f9a0d1ed
--- /dev/null
+++ b/.butcher/types/WriteAccessAllowed/entity.json
@@ -0,0 +1,18 @@
+{
+ "meta": {
+ "deprecated": false
+ },
+ "group": {
+ "title": "Available types",
+ "anchor": "available-types"
+ },
+ "object": {
+ "anchor": "writeaccessallowed",
+ "name": "WriteAccessAllowed",
+ "description": "This object represents a service message about a user allowing a bot added to the attachment menu to write messages. Currently holds no information.",
+ "html_description": "This object represents a service message about a user allowing a bot added to the attachment menu to write messages. Currently holds no information.
",
+ "rst_description": "This object represents a service message about a user allowing a bot added to the attachment menu to write messages. Currently holds no information.",
+ "annotations": [],
+ "category": "types"
+ }
+}
diff --git a/aiogram/client/bot.py b/aiogram/client/bot.py
index ca06a62d..f293da9f 100644
--- a/aiogram/client/bot.py
+++ b/aiogram/client/bot.py
@@ -33,6 +33,7 @@ from ..methods import (
BanChatSenderChat,
Close,
CloseForumTopic,
+ CloseGeneralForumTopic,
CopyMessage,
CreateChatInviteLink,
CreateForumTopic,
@@ -48,6 +49,7 @@ from ..methods import (
DeleteWebhook,
EditChatInviteLink,
EditForumTopic,
+ EditGeneralForumTopic,
EditMessageCaption,
EditMessageLiveLocation,
EditMessageMedia,
@@ -71,11 +73,13 @@ from ..methods import (
GetUpdates,
GetUserProfilePhotos,
GetWebhookInfo,
+ HideGeneralForumTopic,
LeaveChat,
LogOut,
PinChatMessage,
PromoteChatMember,
ReopenForumTopic,
+ ReopenGeneralForumTopic,
RestrictChatMember,
RevokeChatInviteLink,
SendAnimation,
@@ -115,6 +119,7 @@ from ..methods import (
TelegramMethod,
UnbanChatMember,
UnbanChatSenderChat,
+ UnhideGeneralForumTopic,
UnpinAllChatMessages,
UnpinAllForumTopicMessages,
UnpinChatMessage,
@@ -1103,8 +1108,8 @@ class Bot(ContextInstanceMixin["Bot"]):
self,
chat_id: Union[int, str],
message_thread_id: int,
- name: str,
- icon_custom_emoji_id: str,
+ name: Optional[str] = None,
+ icon_custom_emoji_id: Optional[str] = None,
request_timeout: Optional[int] = None,
) -> bool:
"""
@@ -1112,8 +1117,8 @@ class Bot(ContextInstanceMixin["Bot"]):
:param chat_id: Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)
:param message_thread_id: Unique identifier for the target message thread of the forum topic
- :param name: New topic name, 1-128 characters
- :param icon_custom_emoji_id: 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.
+ :param name: New topic name, 0-128 characters. If not specififed or empty, the current name of the topic will be kept
+ :param icon_custom_emoji_id: 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
:param request_timeout: Request timeout
:return: Returns :code:`True` on success.
"""
@@ -1412,7 +1417,7 @@ class Bot(ContextInstanceMixin["Bot"]):
ChatMemberBanned,
]:
"""
- Use this method to get information about a member of a chat. Returns a :class:`aiogram.types.chat_member.ChatMember` object on success.
+ Use this method to get information about a member of a chat. The method is guaranteed to work only if the bot is an administrator in the chat. Returns a :class:`aiogram.types.chat_member.ChatMember` object on success.
:param chat_id: Unique identifier for the target chat or username of the target supergroup or channel (in the format :code:`@channelusername`)
:param user_id: Unique identifier of the target user
@@ -1878,6 +1883,7 @@ class Bot(ContextInstanceMixin["Bot"]):
caption: Optional[str] = None,
parse_mode: Optional[str] = UNSET,
caption_entities: Optional[List[MessageEntity]] = None,
+ has_spoiler: Optional[bool] = None,
disable_notification: Optional[bool] = None,
protect_content: Optional[bool] = None,
reply_to_message_id: Optional[int] = None,
@@ -1900,6 +1906,7 @@ class Bot(ContextInstanceMixin["Bot"]):
: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
@@ -1920,6 +1927,7 @@ class Bot(ContextInstanceMixin["Bot"]):
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,
@@ -1995,6 +2003,7 @@ class Bot(ContextInstanceMixin["Bot"]):
self,
chat_id: Union[int, str],
action: str,
+ message_thread_id: Optional[int] = None,
request_timeout: Optional[int] = None,
) -> bool:
"""
@@ -2006,6 +2015,7 @@ 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 action: 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 `_.
+ :param message_thread_id: Unique identifier for the target message thread; supergroups only
:param request_timeout: Request timeout
:return: The user will see a 'sending photo' status for the bot.
"""
@@ -2013,6 +2023,7 @@ class Bot(ContextInstanceMixin["Bot"]):
call = SendChatAction(
chat_id=chat_id,
action=action,
+ message_thread_id=message_thread_id,
)
return await self(call, request_timeout=request_timeout)
@@ -2451,6 +2462,7 @@ class Bot(ContextInstanceMixin["Bot"]):
caption: Optional[str] = None,
parse_mode: Optional[str] = UNSET,
caption_entities: Optional[List[MessageEntity]] = None,
+ has_spoiler: Optional[bool] = None,
disable_notification: Optional[bool] = None,
protect_content: Optional[bool] = None,
reply_to_message_id: Optional[int] = None,
@@ -2469,6 +2481,7 @@ class Bot(ContextInstanceMixin["Bot"]):
:param caption: Photo caption (may also be used when resending photos by *file_id*), 0-1024 characters after entities parsing
:param parse_mode: Mode for parsing entities in the photo 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 photo 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
@@ -2485,6 +2498,7 @@ class Bot(ContextInstanceMixin["Bot"]):
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,
@@ -2682,6 +2696,7 @@ class Bot(ContextInstanceMixin["Bot"]):
caption: Optional[str] = None,
parse_mode: Optional[str] = UNSET,
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] = None,
@@ -2705,6 +2720,7 @@ class Bot(ContextInstanceMixin["Bot"]):
:param caption: Video caption (may also be used when resending videos by *file_id*), 0-1024 characters after entities parsing
:param parse_mode: Mode for parsing entities in the video 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 video needs to be covered with a spoiler animation
:param supports_streaming: Pass :code:`True` if the uploaded video is suitable for streaming
: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
@@ -2726,6 +2742,7 @@ class Bot(ContextInstanceMixin["Bot"]):
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,
@@ -3360,3 +3377,96 @@ class Bot(ContextInstanceMixin["Bot"]):
png_sticker=png_sticker,
)
return await self(call, request_timeout=request_timeout)
+
+ async def close_general_forum_topic(
+ self,
+ chat_id: Union[int, str],
+ request_timeout: Optional[int] = None,
+ ) -> bool:
+ """
+ Use this method to close an open 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the *can_manage_topics* administrator rights. Returns :code:`True` on success.
+
+ :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 = CloseGeneralForumTopic(
+ chat_id=chat_id,
+ )
+ return await self(call, request_timeout=request_timeout)
+
+ async def edit_general_forum_topic(
+ self,
+ chat_id: Union[int, str],
+ name: str,
+ request_timeout: Optional[int] = None,
+ ) -> bool:
+ """
+ Use this method to edit the name of the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have *can_manage_topics* administrator rights. Returns :code:`True` on success.
+
+ :param chat_id: Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)
+ :param name: New topic name, 1-128 characters
+ :param request_timeout: Request timeout
+ :return: Returns :code:`True` on success.
+ """
+
+ call = EditGeneralForumTopic(
+ chat_id=chat_id,
+ name=name,
+ )
+ return await self(call, request_timeout=request_timeout)
+
+ async def hide_general_forum_topic(
+ self,
+ chat_id: Union[int, str],
+ request_timeout: Optional[int] = None,
+ ) -> bool:
+ """
+ Use this method to hide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the *can_manage_topics* administrator rights. The topic will be automatically closed if it was open. Returns :code:`True` on success.
+
+ :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 = HideGeneralForumTopic(
+ chat_id=chat_id,
+ )
+ return await self(call, request_timeout=request_timeout)
+
+ async def reopen_general_forum_topic(
+ self,
+ chat_id: Union[int, str],
+ request_timeout: Optional[int] = None,
+ ) -> bool:
+ """
+ Use this method to reopen a closed 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the *can_manage_topics* administrator rights. The topic will be automatically unhidden if it was hidden. Returns :code:`True` on success.
+
+ :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 = ReopenGeneralForumTopic(
+ chat_id=chat_id,
+ )
+ return await self(call, request_timeout=request_timeout)
+
+ async def unhide_general_forum_topic(
+ self,
+ chat_id: Union[int, str],
+ request_timeout: Optional[int] = None,
+ ) -> bool:
+ """
+ Use this method to unhide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the *can_manage_topics* administrator rights. Returns :code:`True` on success.
+
+ :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 = UnhideGeneralForumTopic(
+ chat_id=chat_id,
+ )
+ return await self(call, request_timeout=request_timeout)
diff --git a/aiogram/enums/content_type.py b/aiogram/enums/content_type.py
index 18fa3484..854fda85 100644
--- a/aiogram/enums/content_type.py
+++ b/aiogram/enums/content_type.py
@@ -17,6 +17,7 @@ class ContentType(str, Enum):
VIDEO = "video"
VIDEO_NOTE = "video_note"
VOICE = "voice"
+ HAS_MEDIA_SPOILER = "has_media_spoiler"
CONTACT = "contact"
DICE = "dice"
GAME = "game"
@@ -38,11 +39,15 @@ class ContentType(str, Enum):
INVOICE = "invoice"
SUCCESSFUL_PAYMENT = "successful_payment"
CONNECTED_WEBSITE = "connected_website"
+ WRITE_ACCESS_ALLOWED = "write_access_allowed"
PASSPORT_DATA = "passport_data"
PROXIMITY_ALERT_TRIGGERED = "proximity_alert_triggered"
FORUM_TOPIC_CREATED = "forum_topic_created"
+ FORUM_TOPIC_EDITED = "forum_topic_edited"
FORUM_TOPIC_CLOSED = "forum_topic_closed"
FORUM_TOPIC_REOPENED = "forum_topic_reopened"
+ GENERAL_FORUM_TOPIC_HIDDEN = "general_forum_topic_hidden"
+ GENERAL_FORUM_TOPIC_UNHIDDEN = "general_forum_topic_unhidden"
VIDEO_CHAT_SCHEDULED = "video_chat_scheduled"
VIDEO_CHAT_STARTED = "video_chat_started"
VIDEO_CHAT_ENDED = "video_chat_ended"
diff --git a/aiogram/methods/__init__.py b/aiogram/methods/__init__.py
index fdabfe8b..d50e99a0 100644
--- a/aiogram/methods/__init__.py
+++ b/aiogram/methods/__init__.py
@@ -10,6 +10,7 @@ from .ban_chat_sender_chat import BanChatSenderChat
from .base import Request, Response, TelegramMethod
from .close import Close
from .close_forum_topic import CloseForumTopic
+from .close_general_forum_topic import CloseGeneralForumTopic
from .copy_message import CopyMessage
from .create_chat_invite_link import CreateChatInviteLink
from .create_forum_topic import CreateForumTopic
@@ -25,6 +26,7 @@ from .delete_sticker_from_set import DeleteStickerFromSet
from .delete_webhook import DeleteWebhook
from .edit_chat_invite_link import EditChatInviteLink
from .edit_forum_topic import EditForumTopic
+from .edit_general_forum_topic import EditGeneralForumTopic
from .edit_message_caption import EditMessageCaption
from .edit_message_live_location import EditMessageLiveLocation
from .edit_message_media import EditMessageMedia
@@ -48,11 +50,13 @@ from .get_sticker_set import GetStickerSet
from .get_updates import GetUpdates
from .get_user_profile_photos import GetUserProfilePhotos
from .get_webhook_info import GetWebhookInfo
+from .hide_general_forum_topic import HideGeneralForumTopic
from .leave_chat import LeaveChat
from .log_out import LogOut
from .pin_chat_message import PinChatMessage
from .promote_chat_member import PromoteChatMember
from .reopen_forum_topic import ReopenForumTopic
+from .reopen_general_forum_topic import ReopenGeneralForumTopic
from .restrict_chat_member import RestrictChatMember
from .revoke_chat_invite_link import RevokeChatInviteLink
from .send_animation import SendAnimation
@@ -91,109 +95,115 @@ from .stop_message_live_location import StopMessageLiveLocation
from .stop_poll import StopPoll
from .unban_chat_member import UnbanChatMember
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_chat_message import UnpinChatMessage
from .upload_sticker_file import UploadStickerFile
__all__ = (
- "TelegramMethod",
- "Request",
- "Response",
- "GetUpdates",
- "SetWebhook",
- "DeleteWebhook",
- "GetWebhookInfo",
- "GetMe",
- "LogOut",
- "Close",
- "SendMessage",
- "ForwardMessage",
- "CopyMessage",
- "SendPhoto",
- "SendAudio",
- "SendDocument",
- "SendVideo",
- "SendAnimation",
- "SendVoice",
- "SendVideoNote",
- "SendMediaGroup",
- "SendLocation",
- "EditMessageLiveLocation",
- "StopMessageLiveLocation",
- "SendVenue",
- "SendContact",
- "SendPoll",
- "SendDice",
- "SendChatAction",
- "GetUserProfilePhotos",
- "GetFile",
- "BanChatMember",
- "UnbanChatMember",
- "RestrictChatMember",
- "PromoteChatMember",
- "SetChatAdministratorCustomTitle",
- "BanChatSenderChat",
- "UnbanChatSenderChat",
- "SetChatPermissions",
- "ExportChatInviteLink",
- "CreateChatInviteLink",
- "EditChatInviteLink",
- "RevokeChatInviteLink",
- "ApproveChatJoinRequest",
- "DeclineChatJoinRequest",
- "SetChatPhoto",
- "DeleteChatPhoto",
- "SetChatTitle",
- "SetChatDescription",
- "PinChatMessage",
- "UnpinChatMessage",
- "UnpinAllChatMessages",
- "LeaveChat",
- "GetChat",
- "GetChatAdministrators",
- "GetChatMemberCount",
- "GetChatMember",
- "SetChatStickerSet",
- "DeleteChatStickerSet",
- "GetForumTopicIconStickers",
- "CreateForumTopic",
- "EditForumTopic",
- "CloseForumTopic",
- "ReopenForumTopic",
- "DeleteForumTopic",
- "UnpinAllForumTopicMessages",
+ "AddStickerToSet",
"AnswerCallbackQuery",
- "SetMyCommands",
+ "AnswerInlineQuery",
+ "AnswerPreCheckoutQuery",
+ "AnswerShippingQuery",
+ "AnswerWebAppQuery",
+ "ApproveChatJoinRequest",
+ "BanChatMember",
+ "BanChatSenderChat",
+ "Close",
+ "CloseForumTopic",
+ "CloseGeneralForumTopic",
+ "CopyMessage",
+ "CreateChatInviteLink",
+ "CreateForumTopic",
+ "CreateInvoiceLink",
+ "CreateNewStickerSet",
+ "DeclineChatJoinRequest",
+ "DeleteChatPhoto",
+ "DeleteChatStickerSet",
+ "DeleteForumTopic",
+ "DeleteMessage",
"DeleteMyCommands",
- "GetMyCommands",
- "SetChatMenuButton",
- "GetChatMenuButton",
- "SetMyDefaultAdministratorRights",
- "GetMyDefaultAdministratorRights",
- "EditMessageText",
+ "DeleteStickerFromSet",
+ "DeleteWebhook",
+ "EditChatInviteLink",
+ "EditForumTopic",
+ "EditGeneralForumTopic",
"EditMessageCaption",
+ "EditMessageLiveLocation",
"EditMessageMedia",
"EditMessageReplyMarkup",
- "StopPoll",
- "DeleteMessage",
- "SendSticker",
- "GetStickerSet",
+ "EditMessageText",
+ "ExportChatInviteLink",
+ "ForwardMessage",
+ "GetChat",
+ "GetChatAdministrators",
+ "GetChatMember",
+ "GetChatMemberCount",
+ "GetChatMenuButton",
"GetCustomEmojiStickers",
- "UploadStickerFile",
- "CreateNewStickerSet",
- "AddStickerToSet",
- "SetStickerPositionInSet",
- "DeleteStickerFromSet",
- "SetStickerSetThumb",
- "AnswerInlineQuery",
- "AnswerWebAppQuery",
- "SendInvoice",
- "CreateInvoiceLink",
- "AnswerShippingQuery",
- "AnswerPreCheckoutQuery",
- "SetPassportDataErrors",
- "SendGame",
- "SetGameScore",
+ "GetFile",
+ "GetForumTopicIconStickers",
"GetGameHighScores",
+ "GetMe",
+ "GetMyCommands",
+ "GetMyDefaultAdministratorRights",
+ "GetStickerSet",
+ "GetUpdates",
+ "GetUserProfilePhotos",
+ "GetWebhookInfo",
+ "HideGeneralForumTopic",
+ "LeaveChat",
+ "LogOut",
+ "PinChatMessage",
+ "PromoteChatMember",
+ "ReopenForumTopic",
+ "ReopenGeneralForumTopic",
+ "Request",
+ "Response",
+ "RestrictChatMember",
+ "RevokeChatInviteLink",
+ "SendAnimation",
+ "SendAudio",
+ "SendChatAction",
+ "SendContact",
+ "SendDice",
+ "SendDocument",
+ "SendGame",
+ "SendInvoice",
+ "SendLocation",
+ "SendMediaGroup",
+ "SendMessage",
+ "SendPhoto",
+ "SendPoll",
+ "SendSticker",
+ "SendVenue",
+ "SendVideo",
+ "SendVideoNote",
+ "SendVoice",
+ "SetChatAdministratorCustomTitle",
+ "SetChatDescription",
+ "SetChatMenuButton",
+ "SetChatPermissions",
+ "SetChatPhoto",
+ "SetChatStickerSet",
+ "SetChatTitle",
+ "SetGameScore",
+ "SetMyCommands",
+ "SetMyDefaultAdministratorRights",
+ "SetPassportDataErrors",
+ "SetStickerPositionInSet",
+ "SetStickerSetThumb",
+ "SetWebhook",
+ "StopMessageLiveLocation",
+ "StopPoll",
+ "TelegramMethod",
+ "UnbanChatMember",
+ "UnbanChatSenderChat",
+ "UnhideGeneralForumTopic",
+ "UnpinAllChatMessages",
+ "UnpinAllForumTopicMessages",
+ "UnpinChatMessage",
+ "UploadStickerFile",
)
diff --git a/aiogram/methods/close_general_forum_topic.py b/aiogram/methods/close_general_forum_topic.py
new file mode 100644
index 00000000..1dea28c4
--- /dev/null
+++ b/aiogram/methods/close_general_forum_topic.py
@@ -0,0 +1,26 @@
+from __future__ import annotations
+
+from typing import TYPE_CHECKING, Any, Dict, Union
+
+from .base import Request, TelegramMethod
+
+if TYPE_CHECKING:
+ from ..client.bot import Bot
+
+
+class CloseGeneralForumTopic(TelegramMethod[bool]):
+ """
+ Use this method to close an open 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the *can_manage_topics* administrator rights. Returns :code:`True` on success.
+
+ Source: https://core.telegram.org/bots/api#closegeneralforumtopic
+ """
+
+ __returning__ = bool
+
+ chat_id: Union[int, str]
+ """Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)"""
+
+ def build_request(self, bot: Bot) -> Request:
+ data: Dict[str, Any] = self.dict()
+
+ return Request(method="closeGeneralForumTopic", data=data)
diff --git a/aiogram/methods/edit_forum_topic.py b/aiogram/methods/edit_forum_topic.py
index ed2f55dd..64a78558 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, Any, Dict, Union
+from typing import TYPE_CHECKING, Any, Dict, Optional, Union
from .base import Request, TelegramMethod
@@ -21,10 +21,10 @@ class EditForumTopic(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"""
- name: str
- """New topic name, 1-128 characters"""
- icon_custom_emoji_id: str
- """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."""
+ name: Optional[str] = None
+ """New topic name, 0-128 characters. If not specififed 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"""
def build_request(self, bot: Bot) -> Request:
data: Dict[str, Any] = self.dict()
diff --git a/aiogram/methods/edit_general_forum_topic.py b/aiogram/methods/edit_general_forum_topic.py
new file mode 100644
index 00000000..532e05b7
--- /dev/null
+++ b/aiogram/methods/edit_general_forum_topic.py
@@ -0,0 +1,28 @@
+from __future__ import annotations
+
+from typing import TYPE_CHECKING, Any, Dict, Union
+
+from .base import Request, TelegramMethod
+
+if TYPE_CHECKING:
+ from ..client.bot import Bot
+
+
+class EditGeneralForumTopic(TelegramMethod[bool]):
+ """
+ Use this method to edit the name of the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have *can_manage_topics* administrator rights. Returns :code:`True` on success.
+
+ Source: https://core.telegram.org/bots/api#editgeneralforumtopic
+ """
+
+ __returning__ = bool
+
+ chat_id: Union[int, str]
+ """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"""
+
+ def build_request(self, bot: Bot) -> Request:
+ data: Dict[str, Any] = self.dict()
+
+ return Request(method="editGeneralForumTopic", data=data)
diff --git a/aiogram/methods/get_chat_member.py b/aiogram/methods/get_chat_member.py
index faf5dece..29d264ab 100644
--- a/aiogram/methods/get_chat_member.py
+++ b/aiogram/methods/get_chat_member.py
@@ -29,7 +29,7 @@ class GetChatMember(
]
):
"""
- Use this method to get information about a member of a chat. Returns a :class:`aiogram.types.chat_member.ChatMember` object on success.
+ Use this method to get information about a member of a chat. The method is guaranteed to work only if the bot is an administrator in the chat. Returns a :class:`aiogram.types.chat_member.ChatMember` object on success.
Source: https://core.telegram.org/bots/api#getchatmember
"""
diff --git a/aiogram/methods/hide_general_forum_topic.py b/aiogram/methods/hide_general_forum_topic.py
new file mode 100644
index 00000000..6e20a6bd
--- /dev/null
+++ b/aiogram/methods/hide_general_forum_topic.py
@@ -0,0 +1,26 @@
+from __future__ import annotations
+
+from typing import TYPE_CHECKING, Any, Dict, Union
+
+from .base import Request, TelegramMethod
+
+if TYPE_CHECKING:
+ from ..client.bot import Bot
+
+
+class HideGeneralForumTopic(TelegramMethod[bool]):
+ """
+ Use this method to hide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the *can_manage_topics* administrator rights. The topic will be automatically closed if it was open. Returns :code:`True` on success.
+
+ Source: https://core.telegram.org/bots/api#hidegeneralforumtopic
+ """
+
+ __returning__ = bool
+
+ chat_id: Union[int, str]
+ """Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)"""
+
+ def build_request(self, bot: Bot) -> Request:
+ data: Dict[str, Any] = self.dict()
+
+ return Request(method="hideGeneralForumTopic", data=data)
diff --git a/aiogram/methods/reopen_general_forum_topic.py b/aiogram/methods/reopen_general_forum_topic.py
new file mode 100644
index 00000000..1d27ca2d
--- /dev/null
+++ b/aiogram/methods/reopen_general_forum_topic.py
@@ -0,0 +1,26 @@
+from __future__ import annotations
+
+from typing import TYPE_CHECKING, Any, Dict, Union
+
+from .base import Request, TelegramMethod
+
+if TYPE_CHECKING:
+ from ..client.bot import Bot
+
+
+class ReopenGeneralForumTopic(TelegramMethod[bool]):
+ """
+ Use this method to reopen a closed 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the *can_manage_topics* administrator rights. The topic will be automatically unhidden if it was hidden. Returns :code:`True` on success.
+
+ Source: https://core.telegram.org/bots/api#reopengeneralforumtopic
+ """
+
+ __returning__ = bool
+
+ chat_id: Union[int, str]
+ """Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)"""
+
+ def build_request(self, bot: Bot) -> Request:
+ data: Dict[str, Any] = self.dict()
+
+ return Request(method="reopenGeneralForumTopic", data=data)
diff --git a/aiogram/methods/send_animation.py b/aiogram/methods/send_animation.py
index 18533414..3bebdc78 100644
--- a/aiogram/methods/send_animation.py
+++ b/aiogram/methods/send_animation.py
@@ -47,6 +47,8 @@ class SendAnimation(TelegramMethod[Message]):
"""Mode for parsing entities in the animation caption. See `formatting options `_ for more details."""
caption_entities: Optional[List[MessageEntity]] = None
"""A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*"""
+ has_spoiler: Optional[bool] = None
+ """Pass :code:`True` if the animation needs to be covered with a spoiler animation"""
disable_notification: Optional[bool] = None
"""Sends the message `silently `_. Users will receive a notification with no sound."""
protect_content: Optional[bool] = None
diff --git a/aiogram/methods/send_chat_action.py b/aiogram/methods/send_chat_action.py
index 9eb22413..538300b2 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, Any, Dict, Union
+from typing import TYPE_CHECKING, Any, Dict, Optional, Union
from .base import Request, TelegramMethod
@@ -25,6 +25,8 @@ class SendChatAction(TelegramMethod[bool]):
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
action: str
"""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"""
def build_request(self, bot: Bot) -> Request:
data: Dict[str, Any] = self.dict()
diff --git a/aiogram/methods/send_photo.py b/aiogram/methods/send_photo.py
index 0534c841..43a4c65a 100644
--- a/aiogram/methods/send_photo.py
+++ b/aiogram/methods/send_photo.py
@@ -39,6 +39,8 @@ class SendPhoto(TelegramMethod[Message]):
"""Mode for parsing entities in the photo caption. See `formatting options `_ for more details."""
caption_entities: Optional[List[MessageEntity]] = None
"""A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*"""
+ has_spoiler: Optional[bool] = None
+ """Pass :code:`True` if the photo needs to be covered with a spoiler animation"""
disable_notification: Optional[bool] = None
"""Sends the message `silently `_. Users will receive a notification with no sound."""
protect_content: Optional[bool] = None
diff --git a/aiogram/methods/send_video.py b/aiogram/methods/send_video.py
index d30f5fed..b144d090 100644
--- a/aiogram/methods/send_video.py
+++ b/aiogram/methods/send_video.py
@@ -47,6 +47,8 @@ class SendVideo(TelegramMethod[Message]):
"""Mode for parsing entities in the video caption. See `formatting options `_ for more details."""
caption_entities: Optional[List[MessageEntity]] = None
"""A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*"""
+ has_spoiler: Optional[bool] = None
+ """Pass :code:`True` if the video needs to be covered with a spoiler animation"""
supports_streaming: Optional[bool] = None
"""Pass :code:`True` if the uploaded video is suitable for streaming"""
disable_notification: Optional[bool] = None
diff --git a/aiogram/methods/unhide_general_forum_topic.py b/aiogram/methods/unhide_general_forum_topic.py
new file mode 100644
index 00000000..2ee341aa
--- /dev/null
+++ b/aiogram/methods/unhide_general_forum_topic.py
@@ -0,0 +1,26 @@
+from __future__ import annotations
+
+from typing import TYPE_CHECKING, Any, Dict, Union
+
+from .base import Request, TelegramMethod
+
+if TYPE_CHECKING:
+ from ..client.bot import Bot
+
+
+class UnhideGeneralForumTopic(TelegramMethod[bool]):
+ """
+ Use this method to unhide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the *can_manage_topics* administrator rights. Returns :code:`True` on success.
+
+ Source: https://core.telegram.org/bots/api#unhidegeneralforumtopic
+ """
+
+ __returning__ = bool
+
+ chat_id: Union[int, str]
+ """Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)"""
+
+ def build_request(self, bot: Bot) -> Request:
+ data: Dict[str, Any] = self.dict()
+
+ return Request(method="unhideGeneralForumTopic", data=data)
diff --git a/aiogram/types/__init__.py b/aiogram/types/__init__.py
index 91d19870..b38ec2c3 100644
--- a/aiogram/types/__init__.py
+++ b/aiogram/types/__init__.py
@@ -42,9 +42,12 @@ from .force_reply import ForceReply
from .forum_topic import ForumTopic
from .forum_topic_closed import ForumTopicClosed
from .forum_topic_created import ForumTopicCreated
+from .forum_topic_edited import ForumTopicEdited
from .forum_topic_reopened import ForumTopicReopened
from .game import Game
from .game_high_score import GameHighScore
+from .general_forum_topic_hidden import GeneralForumTopicHidden
+from .general_forum_topic_unhidden import GeneralForumTopicUnhidden
from .inline_keyboard_button import InlineKeyboardButton
from .inline_keyboard_markup import InlineKeyboardMarkup
from .inline_query import InlineQuery
@@ -140,6 +143,7 @@ from .voice import Voice
from .web_app_data import WebAppData
from .web_app_info import WebAppInfo
from .webhook_info import WebhookInfo
+from .write_access_allowed import WriteAccessAllowed
__all__ = (
"Animation",
@@ -186,9 +190,12 @@ __all__ = (
"ForumTopic",
"ForumTopicClosed",
"ForumTopicCreated",
+ "ForumTopicEdited",
"ForumTopicReopened",
"Game",
"GameHighScore",
+ "GeneralForumTopicHidden",
+ "GeneralForumTopicUnhidden",
"InlineKeyboardButton",
"InlineKeyboardMarkup",
"InlineQuery",
@@ -287,6 +294,7 @@ __all__ = (
"WebAppData",
"WebAppInfo",
"WebhookInfo",
+ "WriteAccessAllowed",
)
# Load typing forward refs for every TelegramObject
diff --git a/aiogram/types/chat.py b/aiogram/types/chat.py
index a5b08173..78e7c301 100644
--- a/aiogram/types/chat.py
+++ b/aiogram/types/chat.py
@@ -91,6 +91,10 @@ class Chat(TelegramObject):
"""*Optional*. For supergroups, the minimum allowed delay between consecutive messages sent by each unpriviledged user; in seconds. Returned only in :class:`aiogram.methods.get_chat.GetChat`."""
message_auto_delete_time: Optional[int] = None
"""*Optional*. The time after which all messages sent to the chat will be automatically deleted; in seconds. Returned only in :class:`aiogram.methods.get_chat.GetChat`."""
+ has_aggressive_anti_spam_enabled: Optional[bool] = None
+ """*Optional*. :code:`True`, if aggressive anti-spam checks are enabled in the supergroup. The field is only available to chat administrators. Returned only in :class:`aiogram.methods.get_chat.GetChat`."""
+ has_hidden_members: Optional[bool] = None
+ """*Optional*. :code:`True`, if non-administrators can only get the list of bots and administrators in the chat. Returned only in :class:`aiogram.methods.get_chat.GetChat`."""
has_protected_content: Optional[bool] = None
"""*Optional*. :code:`True`, if messages from the chat can't be forwarded to other chats. Returned only in :class:`aiogram.methods.get_chat.GetChat`."""
sticker_set_name: Optional[str] = None
@@ -403,6 +407,7 @@ class Chat(TelegramObject):
def do(
self,
action: str,
+ message_thread_id: Optional[int] = None,
**kwargs: Any,
) -> SendChatAction:
"""
@@ -420,6 +425,7 @@ class Chat(TelegramObject):
Source: https://core.telegram.org/bots/api#sendchataction
:param action: 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 `_.
+ :param message_thread_id: Unique identifier for the target message thread; supergroups only
:return: instance of method :class:`aiogram.methods.send_chat_action.SendChatAction`
"""
# DO NOT EDIT MANUALLY!!!
@@ -430,6 +436,7 @@ class Chat(TelegramObject):
return SendChatAction(
chat_id=self.id,
action=action,
+ message_thread_id=message_thread_id,
**kwargs,
)
@@ -499,7 +506,7 @@ class Chat(TelegramObject):
- :code:`chat_id`
- Use this method to get information about a member of a chat. Returns a :class:`aiogram.types.chat_member.ChatMember` object on success.
+ Use this method to get information about a member of a chat. The method is guaranteed to work only if the bot is an administrator in the chat. Returns a :class:`aiogram.types.chat_member.ChatMember` object on success.
Source: https://core.telegram.org/bots/api#getchatmember
diff --git a/aiogram/types/forum_topic_edited.py b/aiogram/types/forum_topic_edited.py
new file mode 100644
index 00000000..52b4f893
--- /dev/null
+++ b/aiogram/types/forum_topic_edited.py
@@ -0,0 +1,16 @@
+from typing import Optional
+
+from aiogram.types import TelegramObject
+
+
+class ForumTopicEdited(TelegramObject):
+ """
+ This object represents a service message about an edited forum topic.
+
+ Source: https://core.telegram.org/bots/api#forumtopicedited
+ """
+
+ name: Optional[str] = None
+ """*Optional*. New name of the topic, if it was edited"""
+ icon_custom_emoji_id: Optional[str] = None
+ """*Optional*. New identifier of the custom emoji shown as the topic icon, if it was edited; an empty string if the icon was removed"""
diff --git a/aiogram/types/general_forum_topic_hidden.py b/aiogram/types/general_forum_topic_hidden.py
new file mode 100644
index 00000000..136a2753
--- /dev/null
+++ b/aiogram/types/general_forum_topic_hidden.py
@@ -0,0 +1,9 @@
+from aiogram.types import TelegramObject
+
+
+class GeneralForumTopicHidden(TelegramObject):
+ """
+ This object represents a service message about General forum topic hidden in the chat. Currently holds no information.
+
+ Source: https://core.telegram.org/bots/api#generalforumtopichidden
+ """
diff --git a/aiogram/types/general_forum_topic_unhidden.py b/aiogram/types/general_forum_topic_unhidden.py
new file mode 100644
index 00000000..9637a023
--- /dev/null
+++ b/aiogram/types/general_forum_topic_unhidden.py
@@ -0,0 +1,9 @@
+from aiogram.types import TelegramObject
+
+
+class GeneralForumTopicUnhidden(TelegramObject):
+ """
+ This object represents a service message about General forum topic unhidden in the chat. Currently holds no information.
+
+ Source: https://core.telegram.org/bots/api#generalforumtopicunhidden
+ """
diff --git a/aiogram/types/input_media_animation.py b/aiogram/types/input_media_animation.py
index 194428ec..326438d5 100644
--- a/aiogram/types/input_media_animation.py
+++ b/aiogram/types/input_media_animation.py
@@ -38,3 +38,5 @@ class InputMediaAnimation(InputMedia):
"""*Optional*. Animation height"""
duration: Optional[int] = None
"""*Optional*. Animation duration in seconds"""
+ has_spoiler: Optional[bool] = None
+ """*Optional*. Pass :code:`True` if the animation needs to be covered with a spoiler animation"""
diff --git a/aiogram/types/input_media_photo.py b/aiogram/types/input_media_photo.py
index d3eb85d1..1b6f70dd 100644
--- a/aiogram/types/input_media_photo.py
+++ b/aiogram/types/input_media_photo.py
@@ -30,3 +30,5 @@ class InputMediaPhoto(InputMedia):
"""*Optional*. Mode for parsing entities in the photo caption. See `formatting options `_ for more details."""
caption_entities: Optional[List[MessageEntity]] = None
"""*Optional*. List of special entities that appear in the caption, which can be specified instead of *parse_mode*"""
+ has_spoiler: Optional[bool] = None
+ """*Optional*. Pass :code:`True` if the photo needs to be covered with a spoiler animation"""
diff --git a/aiogram/types/input_media_video.py b/aiogram/types/input_media_video.py
index eb9dd4dd..bf701d9c 100644
--- a/aiogram/types/input_media_video.py
+++ b/aiogram/types/input_media_video.py
@@ -40,3 +40,5 @@ class InputMediaVideo(InputMedia):
"""*Optional*. Video duration in seconds"""
supports_streaming: Optional[bool] = None
"""*Optional*. Pass :code:`True` if the uploaded video is suitable for streaming"""
+ has_spoiler: Optional[bool] = None
+ """*Optional*. Pass :code:`True` if the video needs to be covered with a spoiler animation"""
diff --git a/aiogram/types/message.py b/aiogram/types/message.py
index 34a96a63..e22b16c9 100644
--- a/aiogram/types/message.py
+++ b/aiogram/types/message.py
@@ -50,8 +50,11 @@ if TYPE_CHECKING:
from .force_reply import ForceReply
from .forum_topic_closed import ForumTopicClosed
from .forum_topic_created import ForumTopicCreated
+ from .forum_topic_edited import ForumTopicEdited
from .forum_topic_reopened import ForumTopicReopened
from .game import Game
+ from .general_forum_topic_hidden import GeneralForumTopicHidden
+ from .general_forum_topic_unhidden import GeneralForumTopicUnhidden
from .inline_keyboard_markup import InlineKeyboardMarkup
from .input_file import InputFile
from .input_media import InputMedia
@@ -82,6 +85,7 @@ if TYPE_CHECKING:
from .video_note import VideoNote
from .voice import Voice
from .web_app_data import WebAppData
+ from .write_access_allowed import WriteAccessAllowed
class Message(TelegramObject):
@@ -155,6 +159,8 @@ class Message(TelegramObject):
"""*Optional*. Caption for the animation, audio, document, photo, video or voice"""
caption_entities: Optional[List[MessageEntity]] = None
"""*Optional*. For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in the caption"""
+ has_media_spoiler: Optional[bool] = None
+ """*Optional*. :code:`True`, if the message media is covered by a spoiler animation"""
contact: Optional[Contact] = None
"""*Optional*. Message is a shared contact, information about the contact"""
dice: Optional[Dice] = None
@@ -197,16 +203,24 @@ class Message(TelegramObject):
"""*Optional*. Message is a service message about a successful payment, information about the payment. `More about payments » `_"""
connected_website: Optional[str] = None
"""*Optional*. The domain name of the website on which the user has logged in. `More about Telegram Login » `_"""
+ write_access_allowed: Optional[WriteAccessAllowed] = None
+ """*Optional*. Service message: the user allowed the bot added to the attachment menu to write messages"""
passport_data: Optional[PassportData] = None
"""*Optional*. Telegram Passport data"""
proximity_alert_triggered: Optional[ProximityAlertTriggered] = None
"""*Optional*. Service message. A user in the chat triggered another user's proximity alert while sharing Live Location."""
forum_topic_created: Optional[ForumTopicCreated] = None
"""*Optional*. Service message: forum topic created"""
+ forum_topic_edited: Optional[ForumTopicEdited] = None
+ """*Optional*. Service message: forum topic edited"""
forum_topic_closed: Optional[ForumTopicClosed] = None
"""*Optional*. Service message: forum topic closed"""
forum_topic_reopened: Optional[ForumTopicReopened] = None
"""*Optional*. Service message: forum topic reopened"""
+ general_forum_topic_hidden: Optional[GeneralForumTopicHidden] = None
+ """*Optional*. Service message: the 'General' forum topic hidden"""
+ general_forum_topic_unhidden: Optional[GeneralForumTopicUnhidden] = None
+ """*Optional*. Service message: the 'General' forum topic unhidden"""
video_chat_scheduled: Optional[VideoChatScheduled] = None
"""*Optional*. Service message: video chat scheduled"""
video_chat_started: Optional[VideoChatStarted] = None
@@ -328,6 +342,7 @@ class Message(TelegramObject):
caption: Optional[str] = None,
parse_mode: Optional[str] = UNSET,
caption_entities: Optional[List[MessageEntity]] = None,
+ has_spoiler: Optional[bool] = None,
disable_notification: Optional[bool] = None,
protect_content: Optional[bool] = None,
allow_sending_without_reply: Optional[bool] = None,
@@ -356,6 +371,7 @@ class Message(TelegramObject):
: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 allow_sending_without_reply: Pass :code:`True` if the message should be sent even if the specified replied-to message is not found
@@ -379,6 +395,7 @@ class Message(TelegramObject):
caption=caption,
parse_mode=parse_mode,
caption_entities=caption_entities,
+ has_spoiler=has_spoiler,
disable_notification=disable_notification,
protect_content=protect_content,
allow_sending_without_reply=allow_sending_without_reply,
@@ -396,6 +413,7 @@ class Message(TelegramObject):
caption: Optional[str] = None,
parse_mode: Optional[str] = UNSET,
caption_entities: Optional[List[MessageEntity]] = None,
+ has_spoiler: Optional[bool] = None,
disable_notification: Optional[bool] = None,
protect_content: Optional[bool] = None,
reply_to_message_id: Optional[int] = None,
@@ -424,6 +442,7 @@ class Message(TelegramObject):
: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
@@ -447,6 +466,7 @@ class Message(TelegramObject):
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,
@@ -1463,6 +1483,7 @@ class Message(TelegramObject):
caption: Optional[str] = None,
parse_mode: Optional[str] = UNSET,
caption_entities: Optional[List[MessageEntity]] = None,
+ has_spoiler: Optional[bool] = None,
disable_notification: Optional[bool] = None,
protect_content: Optional[bool] = None,
allow_sending_without_reply: Optional[bool] = None,
@@ -1487,6 +1508,7 @@ class Message(TelegramObject):
:param caption: Photo caption (may also be used when resending photos by *file_id*), 0-1024 characters after entities parsing
:param parse_mode: Mode for parsing entities in the photo 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 photo 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 allow_sending_without_reply: Pass :code:`True` if the message should be sent even if the specified replied-to message is not found
@@ -1506,6 +1528,7 @@ class Message(TelegramObject):
caption=caption,
parse_mode=parse_mode,
caption_entities=caption_entities,
+ has_spoiler=has_spoiler,
disable_notification=disable_notification,
protect_content=protect_content,
allow_sending_without_reply=allow_sending_without_reply,
@@ -1519,6 +1542,7 @@ class Message(TelegramObject):
caption: Optional[str] = None,
parse_mode: Optional[str] = UNSET,
caption_entities: Optional[List[MessageEntity]] = None,
+ has_spoiler: Optional[bool] = None,
disable_notification: Optional[bool] = None,
protect_content: Optional[bool] = None,
reply_to_message_id: Optional[int] = None,
@@ -1543,6 +1567,7 @@ class Message(TelegramObject):
:param caption: Photo caption (may also be used when resending photos by *file_id*), 0-1024 characters after entities parsing
:param parse_mode: Mode for parsing entities in the photo 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 photo 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
@@ -1562,6 +1587,7 @@ class Message(TelegramObject):
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,
@@ -2068,6 +2094,7 @@ class Message(TelegramObject):
caption: Optional[str] = None,
parse_mode: Optional[str] = UNSET,
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] = None,
@@ -2097,6 +2124,7 @@ class Message(TelegramObject):
:param caption: Video caption (may also be used when resending videos by *file_id*), 0-1024 characters after entities parsing
:param parse_mode: Mode for parsing entities in the video 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 video needs to be covered with a spoiler animation
:param supports_streaming: Pass :code:`True` if the uploaded video is suitable for streaming
: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
@@ -2121,6 +2149,7 @@ class Message(TelegramObject):
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,
@@ -2139,6 +2168,7 @@ class Message(TelegramObject):
caption: Optional[str] = None,
parse_mode: Optional[str] = UNSET,
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] = None,
@@ -2168,6 +2198,7 @@ class Message(TelegramObject):
:param caption: Video caption (may also be used when resending videos by *file_id*), 0-1024 characters after entities parsing
:param parse_mode: Mode for parsing entities in the video 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 video needs to be covered with a spoiler animation
:param supports_streaming: Pass :code:`True` if the uploaded video is suitable for streaming
: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
@@ -2192,6 +2223,7 @@ class Message(TelegramObject):
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,
diff --git a/aiogram/types/reply_keyboard_markup.py b/aiogram/types/reply_keyboard_markup.py
index ed64e660..da2f6214 100644
--- a/aiogram/types/reply_keyboard_markup.py
+++ b/aiogram/types/reply_keyboard_markup.py
@@ -17,6 +17,8 @@ class ReplyKeyboardMarkup(MutableTelegramObject):
keyboard: List[List[KeyboardButton]]
"""Array of button rows, each represented by an Array of :class:`aiogram.types.keyboard_button.KeyboardButton` objects"""
+ is_persistent: Optional[bool] = None
+ """*Optional*. Requests clients to always show the keyboard when the regular keyboard is hidden. Defaults to *false*, in which case the custom keyboard can be hidden and opened with a keyboard icon."""
resize_keyboard: Optional[bool] = None
"""*Optional*. Requests clients to resize the keyboard vertically for optimal fit (e.g., make the keyboard smaller if there are just two rows of buttons). Defaults to *false*, in which case the custom keyboard is always of the same height as the app's standard keyboard."""
one_time_keyboard: Optional[bool] = None
diff --git a/aiogram/types/write_access_allowed.py b/aiogram/types/write_access_allowed.py
new file mode 100644
index 00000000..859280db
--- /dev/null
+++ b/aiogram/types/write_access_allowed.py
@@ -0,0 +1,9 @@
+from aiogram.types import TelegramObject
+
+
+class WriteAccessAllowed(TelegramObject):
+ """
+ This object represents a service message about a user allowing a bot added to the attachment menu to write messages. Currently holds no information.
+
+ Source: https://core.telegram.org/bots/api#writeaccessallowed
+ """
diff --git a/docs/api/methods/close_general_forum_topic.rst b/docs/api/methods/close_general_forum_topic.rst
new file mode 100644
index 00000000..1f2bfe2c
--- /dev/null
+++ b/docs/api/methods/close_general_forum_topic.rst
@@ -0,0 +1,44 @@
+######################
+closeGeneralForumTopic
+######################
+
+Returns: :obj:`bool`
+
+.. automodule:: aiogram.methods.close_general_forum_topic
+ :members:
+ :member-order: bysource
+ :undoc-members: True
+
+
+Usage
+=====
+
+As bot method
+-------------
+
+.. code-block::
+
+ result: bool = await bot.close_general_forum_topic(...)
+
+
+Method as object
+----------------
+
+Imports:
+
+- :code:`from aiogram.methods.close_general_forum_topic import CloseGeneralForumTopic`
+- alias: :code:`from aiogram.methods import CloseGeneralForumTopic`
+
+With specific bot
+~~~~~~~~~~~~~~~~~
+
+.. code-block:: python
+
+ result: bool = await bot(CloseGeneralForumTopic(...))
+
+As reply into Webhook in handler
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. code-block:: python
+
+ return CloseGeneralForumTopic(...)
diff --git a/docs/api/methods/edit_general_forum_topic.rst b/docs/api/methods/edit_general_forum_topic.rst
new file mode 100644
index 00000000..b038c9d3
--- /dev/null
+++ b/docs/api/methods/edit_general_forum_topic.rst
@@ -0,0 +1,44 @@
+#####################
+editGeneralForumTopic
+#####################
+
+Returns: :obj:`bool`
+
+.. automodule:: aiogram.methods.edit_general_forum_topic
+ :members:
+ :member-order: bysource
+ :undoc-members: True
+
+
+Usage
+=====
+
+As bot method
+-------------
+
+.. code-block::
+
+ result: bool = await bot.edit_general_forum_topic(...)
+
+
+Method as object
+----------------
+
+Imports:
+
+- :code:`from aiogram.methods.edit_general_forum_topic import EditGeneralForumTopic`
+- alias: :code:`from aiogram.methods import EditGeneralForumTopic`
+
+With specific bot
+~~~~~~~~~~~~~~~~~
+
+.. code-block:: python
+
+ result: bool = await bot(EditGeneralForumTopic(...))
+
+As reply into Webhook in handler
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. code-block:: python
+
+ return EditGeneralForumTopic(...)
diff --git a/docs/api/methods/hide_general_forum_topic.rst b/docs/api/methods/hide_general_forum_topic.rst
new file mode 100644
index 00000000..df36474e
--- /dev/null
+++ b/docs/api/methods/hide_general_forum_topic.rst
@@ -0,0 +1,44 @@
+#####################
+hideGeneralForumTopic
+#####################
+
+Returns: :obj:`bool`
+
+.. automodule:: aiogram.methods.hide_general_forum_topic
+ :members:
+ :member-order: bysource
+ :undoc-members: True
+
+
+Usage
+=====
+
+As bot method
+-------------
+
+.. code-block::
+
+ result: bool = await bot.hide_general_forum_topic(...)
+
+
+Method as object
+----------------
+
+Imports:
+
+- :code:`from aiogram.methods.hide_general_forum_topic import HideGeneralForumTopic`
+- alias: :code:`from aiogram.methods import HideGeneralForumTopic`
+
+With specific bot
+~~~~~~~~~~~~~~~~~
+
+.. code-block:: python
+
+ result: bool = await bot(HideGeneralForumTopic(...))
+
+As reply into Webhook in handler
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. code-block:: python
+
+ return HideGeneralForumTopic(...)
diff --git a/docs/api/methods/index.rst b/docs/api/methods/index.rst
index 691b928c..7bb7d2b8 100644
--- a/docs/api/methods/index.rst
+++ b/docs/api/methods/index.rst
@@ -17,6 +17,7 @@ Available methods
ban_chat_sender_chat
close
close_forum_topic
+ close_general_forum_topic
copy_message
create_chat_invite_link
create_forum_topic
@@ -27,6 +28,7 @@ Available methods
delete_my_commands
edit_chat_invite_link
edit_forum_topic
+ edit_general_forum_topic
edit_message_live_location
export_chat_invite_link
forward_message
@@ -41,11 +43,13 @@ Available methods
get_my_commands
get_my_default_administrator_rights
get_user_profile_photos
+ hide_general_forum_topic
leave_chat
log_out
pin_chat_message
promote_chat_member
reopen_forum_topic
+ reopen_general_forum_topic
restrict_chat_member
revoke_chat_invite_link
send_animation
@@ -75,6 +79,7 @@ Available methods
stop_message_live_location
unban_chat_member
unban_chat_sender_chat
+ unhide_general_forum_topic
unpin_all_chat_messages
unpin_all_forum_topic_messages
unpin_chat_message
diff --git a/docs/api/methods/reopen_general_forum_topic.rst b/docs/api/methods/reopen_general_forum_topic.rst
new file mode 100644
index 00000000..ec217d9c
--- /dev/null
+++ b/docs/api/methods/reopen_general_forum_topic.rst
@@ -0,0 +1,44 @@
+#######################
+reopenGeneralForumTopic
+#######################
+
+Returns: :obj:`bool`
+
+.. automodule:: aiogram.methods.reopen_general_forum_topic
+ :members:
+ :member-order: bysource
+ :undoc-members: True
+
+
+Usage
+=====
+
+As bot method
+-------------
+
+.. code-block::
+
+ result: bool = await bot.reopen_general_forum_topic(...)
+
+
+Method as object
+----------------
+
+Imports:
+
+- :code:`from aiogram.methods.reopen_general_forum_topic import ReopenGeneralForumTopic`
+- alias: :code:`from aiogram.methods import ReopenGeneralForumTopic`
+
+With specific bot
+~~~~~~~~~~~~~~~~~
+
+.. code-block:: python
+
+ result: bool = await bot(ReopenGeneralForumTopic(...))
+
+As reply into Webhook in handler
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. code-block:: python
+
+ return ReopenGeneralForumTopic(...)
diff --git a/docs/api/methods/unhide_general_forum_topic.rst b/docs/api/methods/unhide_general_forum_topic.rst
new file mode 100644
index 00000000..e2601df8
--- /dev/null
+++ b/docs/api/methods/unhide_general_forum_topic.rst
@@ -0,0 +1,44 @@
+#######################
+unhideGeneralForumTopic
+#######################
+
+Returns: :obj:`bool`
+
+.. automodule:: aiogram.methods.unhide_general_forum_topic
+ :members:
+ :member-order: bysource
+ :undoc-members: True
+
+
+Usage
+=====
+
+As bot method
+-------------
+
+.. code-block::
+
+ result: bool = await bot.unhide_general_forum_topic(...)
+
+
+Method as object
+----------------
+
+Imports:
+
+- :code:`from aiogram.methods.unhide_general_forum_topic import UnhideGeneralForumTopic`
+- alias: :code:`from aiogram.methods import UnhideGeneralForumTopic`
+
+With specific bot
+~~~~~~~~~~~~~~~~~
+
+.. code-block:: python
+
+ result: bool = await bot(UnhideGeneralForumTopic(...))
+
+As reply into Webhook in handler
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. code-block:: python
+
+ return UnhideGeneralForumTopic(...)
diff --git a/docs/api/types/forum_topic_edited.rst b/docs/api/types/forum_topic_edited.rst
new file mode 100644
index 00000000..6909332f
--- /dev/null
+++ b/docs/api/types/forum_topic_edited.rst
@@ -0,0 +1,9 @@
+################
+ForumTopicEdited
+################
+
+
+.. automodule:: aiogram.types.forum_topic_edited
+ :members:
+ :member-order: bysource
+ :undoc-members: True
diff --git a/docs/api/types/general_forum_topic_hidden.rst b/docs/api/types/general_forum_topic_hidden.rst
new file mode 100644
index 00000000..f83b143a
--- /dev/null
+++ b/docs/api/types/general_forum_topic_hidden.rst
@@ -0,0 +1,9 @@
+#######################
+GeneralForumTopicHidden
+#######################
+
+
+.. automodule:: aiogram.types.general_forum_topic_hidden
+ :members:
+ :member-order: bysource
+ :undoc-members: True
diff --git a/docs/api/types/general_forum_topic_unhidden.rst b/docs/api/types/general_forum_topic_unhidden.rst
new file mode 100644
index 00000000..9dee46cb
--- /dev/null
+++ b/docs/api/types/general_forum_topic_unhidden.rst
@@ -0,0 +1,9 @@
+#########################
+GeneralForumTopicUnhidden
+#########################
+
+
+.. automodule:: aiogram.types.general_forum_topic_unhidden
+ :members:
+ :member-order: bysource
+ :undoc-members: True
diff --git a/docs/api/types/index.rst b/docs/api/types/index.rst
index a5615062..c3b365a9 100644
--- a/docs/api/types/index.rst
+++ b/docs/api/types/index.rst
@@ -83,7 +83,10 @@ Available types
forum_topic
forum_topic_closed
forum_topic_created
+ forum_topic_edited
forum_topic_reopened
+ general_forum_topic_hidden
+ general_forum_topic_unhidden
inline_keyboard_button
inline_keyboard_markup
input_file
@@ -125,6 +128,7 @@ Available types
voice
web_app_data
web_app_info
+ write_access_allowed
Telegram Passport
=================
diff --git a/docs/api/types/write_access_allowed.rst b/docs/api/types/write_access_allowed.rst
new file mode 100644
index 00000000..d2afa3bc
--- /dev/null
+++ b/docs/api/types/write_access_allowed.rst
@@ -0,0 +1,9 @@
+##################
+WriteAccessAllowed
+##################
+
+
+.. automodule:: aiogram.types.write_access_allowed
+ :members:
+ :member-order: bysource
+ :undoc-members: True
diff --git a/tests/test_api/test_methods/test_close_general_forum_topic.py b/tests/test_api/test_methods/test_close_general_forum_topic.py
new file mode 100644
index 00000000..a62ce146
--- /dev/null
+++ b/tests/test_api/test_methods/test_close_general_forum_topic.py
@@ -0,0 +1,20 @@
+from aiogram.methods import CloseGeneralForumTopic, Request
+from tests.mocked_bot import MockedBot
+
+
+class TestCloseGeneralForumTopic:
+ async def test_method(self, bot: MockedBot):
+ prepare_result = bot.add_result_for(CloseGeneralForumTopic, ok=True, result=True)
+
+ response: bool = await bot(CloseGeneralForumTopic(chat_id=42))
+ request: Request = bot.get_request()
+ assert request.method == "closeGeneralForumTopic"
+ assert response == prepare_result.result
+
+ async def test_bot_method(self, bot: MockedBot):
+ prepare_result = bot.add_result_for(CloseGeneralForumTopic, ok=True, result=True)
+
+ response: bool = await bot.close_general_forum_topic(chat_id=42)
+ request: Request = bot.get_request()
+ assert request.method == "closeGeneralForumTopic"
+ assert response == prepare_result.result
diff --git a/tests/test_api/test_methods/test_edit_general_forum_topic.py b/tests/test_api/test_methods/test_edit_general_forum_topic.py
new file mode 100644
index 00000000..01bff1d6
--- /dev/null
+++ b/tests/test_api/test_methods/test_edit_general_forum_topic.py
@@ -0,0 +1,20 @@
+from aiogram.methods import EditGeneralForumTopic, Request
+from tests.mocked_bot import MockedBot
+
+
+class TestCloseGeneralForumTopic:
+ async def test_method(self, bot: MockedBot):
+ prepare_result = bot.add_result_for(EditGeneralForumTopic, ok=True, result=True)
+
+ response: bool = await bot(EditGeneralForumTopic(chat_id=42, name="Test"))
+ request: Request = bot.get_request()
+ assert request.method == "editGeneralForumTopic"
+ assert response == prepare_result.result
+
+ async def test_bot_method(self, bot: MockedBot):
+ prepare_result = bot.add_result_for(EditGeneralForumTopic, ok=True, result=True)
+
+ response: bool = await bot.edit_general_forum_topic(chat_id=42, name="Test")
+ request: Request = bot.get_request()
+ assert request.method == "editGeneralForumTopic"
+ assert response == prepare_result.result
diff --git a/tests/test_api/test_methods/test_hide_general_forum_topic.py b/tests/test_api/test_methods/test_hide_general_forum_topic.py
new file mode 100644
index 00000000..51e6684b
--- /dev/null
+++ b/tests/test_api/test_methods/test_hide_general_forum_topic.py
@@ -0,0 +1,20 @@
+from aiogram.methods import HideGeneralForumTopic, Request
+from tests.mocked_bot import MockedBot
+
+
+class TestHideGeneralForumTopic:
+ async def test_method(self, bot: MockedBot):
+ prepare_result = bot.add_result_for(HideGeneralForumTopic, ok=True, result=True)
+
+ response: bool = await bot(HideGeneralForumTopic(chat_id=42))
+ request: Request = bot.get_request()
+ assert request.method == "hideGeneralForumTopic"
+ assert response == prepare_result.result
+
+ async def test_bot_method(self, bot: MockedBot):
+ prepare_result = bot.add_result_for(HideGeneralForumTopic, ok=True, result=True)
+
+ response: bool = await bot.hide_general_forum_topic(chat_id=42)
+ request: Request = bot.get_request()
+ assert request.method == "hideGeneralForumTopic"
+ assert response == prepare_result.result
diff --git a/tests/test_api/test_methods/test_reopen_general_forum_topic.py b/tests/test_api/test_methods/test_reopen_general_forum_topic.py
new file mode 100644
index 00000000..af1abf55
--- /dev/null
+++ b/tests/test_api/test_methods/test_reopen_general_forum_topic.py
@@ -0,0 +1,20 @@
+from aiogram.methods import ReopenGeneralForumTopic, Request
+from tests.mocked_bot import MockedBot
+
+
+class TestReopenGeneralForumTopic:
+ async def test_method(self, bot: MockedBot):
+ prepare_result = bot.add_result_for(ReopenGeneralForumTopic, ok=True, result=True)
+
+ response: bool = await bot(ReopenGeneralForumTopic(chat_id=42))
+ request: Request = bot.get_request()
+ assert request.method == "reopenGeneralForumTopic"
+ assert response == prepare_result.result
+
+ async def test_bot_method(self, bot: MockedBot):
+ prepare_result = bot.add_result_for(ReopenGeneralForumTopic, ok=True, result=True)
+
+ response: bool = await bot.reopen_general_forum_topic(chat_id=42)
+ request: Request = bot.get_request()
+ assert request.method == "reopenGeneralForumTopic"
+ assert response == prepare_result.result
diff --git a/tests/test_api/test_methods/test_unhide_general_forum_topic.py b/tests/test_api/test_methods/test_unhide_general_forum_topic.py
new file mode 100644
index 00000000..45fcb0c8
--- /dev/null
+++ b/tests/test_api/test_methods/test_unhide_general_forum_topic.py
@@ -0,0 +1,20 @@
+from aiogram.methods import Request, UnhideGeneralForumTopic
+from tests.mocked_bot import MockedBot
+
+
+class TestUnhideGeneralForumTopic:
+ async def test_method(self, bot: MockedBot):
+ prepare_result = bot.add_result_for(UnhideGeneralForumTopic, ok=True, result=True)
+
+ response: bool = await bot(UnhideGeneralForumTopic(chat_id=42))
+ request: Request = bot.get_request()
+ assert request.method == "unhideGeneralForumTopic"
+ assert response == prepare_result.result
+
+ async def test_bot_method(self, bot: MockedBot):
+ prepare_result = bot.add_result_for(UnhideGeneralForumTopic, ok=True, result=True)
+
+ response: bool = await bot.unhide_general_forum_topic(chat_id=42)
+ request: Request = bot.get_request()
+ assert request.method == "unhideGeneralForumTopic"
+ assert response == prepare_result.result
diff --git a/tests/test_filters/test_callback_data.py b/tests/test_filters/test_callback_data.py
index e2f1f1fc..70388689 100644
--- a/tests/test_filters/test_callback_data.py
+++ b/tests/test_filters/test_callback_data.py
@@ -1,5 +1,8 @@
+from decimal import Decimal
from enum import Enum, auto
+from fractions import Fraction
from typing import Optional
+from uuid import UUID
import pytest
from magic_filter import MagicFilter
@@ -45,36 +48,35 @@ class TestCallbackData:
class MyInvalidCallback(CallbackData, prefix="sp@m", sep="@"):
pass
- #
- # @pytest.mark.parametrize(
- # "value,success,expected",
- # [
- # [None, True, ""],
- # [42, True, "42"],
- # ["test", True, "test"],
- # [9.99, True, "9.99"],
- # [Decimal("9.99"), True, "9.99"],
- # [Fraction("3/2"), True, "3/2"],
- # [
- # UUID("123e4567-e89b-12d3-a456-426655440000"),
- # True,
- # "123e4567-e89b-12d3-a456-426655440000",
- # ],
- # [MyIntEnum.FOO, True, "1"],
- # [MyStringEnum.FOO, True, "FOO"],
- # [..., False, "..."],
- # [object, False, "..."],
- # [object(), False, "..."],
- # [User(id=42, is_bot=False, first_name="test"), False, "..."],
- # ],
- # )
- # def test_encode_value(self, value, success, expected):
- # callback = MyCallback(foo="test", bar=42)
- # if success:
- # assert callback._encode_value("test", value) == expected
- # else:
- # with pytest.raises(ValueError):
- # assert callback._encode_value("test", value) == expected
+ @pytest.mark.parametrize(
+ "value,success,expected",
+ [
+ [None, True, ""],
+ [42, True, "42"],
+ ["test", True, "test"],
+ [9.99, True, "9.99"],
+ [Decimal("9.99"), True, "9.99"],
+ [Fraction("3/2"), True, "3/2"],
+ [
+ UUID("123e4567-e89b-12d3-a456-426655440000"),
+ True,
+ "123e4567-e89b-12d3-a456-426655440000",
+ ],
+ [MyIntEnum.FOO, True, "1"],
+ [MyStringEnum.FOO, True, "FOO"],
+ [..., False, "..."],
+ [object, False, "..."],
+ [object(), False, "..."],
+ [User(id=42, is_bot=False, first_name="test"), False, "..."],
+ ],
+ )
+ def test_encode_value(self, value, success, expected):
+ callback = MyCallback(foo="test", bar=42)
+ if success:
+ assert callback._encode_value("test", value) == expected
+ else:
+ with pytest.raises(ValueError):
+ assert callback._encode_value("test", value) == expected
def test_pack(self):
with pytest.raises(ValueError, match="Separator symbol .+"):