From bd9d05a703ae149d4a1928f2aabe3fae9ffa614a Mon Sep 17 00:00:00 2001 From: Alex Root Junior Date: Fri, 21 Apr 2023 15:38:01 +0300 Subject: [PATCH] Update after release --- .../methods/answerInlineQuery/entity.json | 36 +- .butcher/methods/getMyName/entity.json | 4 +- .butcher/methods/setMyName/entity.json | 4 +- .butcher/schema/schema.json | 352 ++++++++---------- .butcher/types/BotName/entity.json | 4 +- .../types/InlineKeyboardButton/entity.json | 16 +- .../InlineQueryResultsButton/entity.json | 4 +- .../SwitchInlineQueryChosenChat/entity.json | 4 +- .butcher/types/WriteAccessAllowed/entity.json | 6 +- aiogram/client/bot.py | 14 +- aiogram/methods/answer_inline_query.py | 20 +- aiogram/types/inline_keyboard_button.py | 4 +- aiogram/types/inline_query.py | 14 +- aiogram/types/write_access_allowed.py | 2 +- docs/api/methods/index.rst | 11 +- docs/api/types/index.rst | 13 +- 16 files changed, 244 insertions(+), 264 deletions(-) diff --git a/.butcher/methods/answerInlineQuery/entity.json b/.butcher/methods/answerInlineQuery/entity.json index c01c11bc..0a15ee68 100644 --- a/.butcher/methods/answerInlineQuery/entity.json +++ b/.butcher/methods/answerInlineQuery/entity.json @@ -38,9 +38,9 @@ { "type": "Boolean", "required": false, - "description": "Pass True if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query", - "html_description": "Pass True if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query", - "rst_description": "Pass :code:`True` if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query\n", + "description": "Pass True if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query.", + "html_description": "Pass True if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query.", + "rst_description": "Pass :code:`True` if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query.\n", "name": "is_personal" }, { @@ -52,12 +52,12 @@ "name": "next_offset" }, { - "type": "String", + "type": "InlineQueryResultsButton", "required": false, - "description": "If passed, clients will display a button with specified text that switches the user to a private chat with the bot and sends the bot a start message with the parameter switch_pm_parameter", - "html_description": "If passed, clients will display a button with specified text that switches the user to a private chat with the bot and sends the bot a start message with the parameter switch_pm_parameter", - "rst_description": "If passed, clients will display a button with specified text that switches the user to a private chat with the bot and sends the bot a start message with the parameter *switch_pm_parameter*\n", - "name": "switch_pm_text" + "description": "A JSON-serialized object describing a button to be shown above inline query results", + "html_description": "A JSON-serialized object describing a button to be shown above inline query results", + "rst_description": "A JSON-serialized object describing a button to be shown above inline query results\n", + "name": "button" }, { "type": "String", @@ -65,15 +65,23 @@ "description": "Deep-linking parameter for the /start message sent to the bot when user presses the switch button. 1-64 characters, only A-Z, a-z, 0-9, _ and - are allowed.\n\nExample: An inline bot that sends YouTube videos can ask the user to connect the bot to their YouTube account to adapt search results accordingly. To do this, it displays a 'Connect your YouTube account' button above the results, or even before showing any. The user presses the button, switches to a private chat with the bot and, in doing so, passes a start parameter that instructs the bot to return an OAuth link. Once done, the bot can offer a switch_inline button so that the user can easily return to the chat where they wanted to use the bot's inline capabilities.", "html_description": "Deep-linking parameter for the /start message sent to the bot when user presses the switch button. 1-64 characters, only A-Z, a-z, 0-9, _ and - are allowed.
\n
\nExample: An inline bot that sends YouTube videos can ask the user to connect the bot to their YouTube account to adapt search results accordingly. To do this, it displays a 'Connect your YouTube account' button above the results, or even before showing any. The user presses the button, switches to a private chat with the bot and, in doing so, passes a start parameter that instructs the bot to return an OAuth link. Once done, the bot can offer a switch_inline button so that the user can easily return to the chat where they wanted to use the bot's inline capabilities.", "rst_description": "`Deep-linking `_ parameter for the /start message sent to the bot when user presses the switch button. 1-64 characters, only :code:`A-Z`, :code:`a-z`, :code:`0-9`, :code:`_` and :code:`-` are allowed.\n\n\n\n*Example:* An inline bot that sends YouTube videos can ask the user to connect the bot to their YouTube account to adapt search results accordingly. To do this, it displays a 'Connect your YouTube account' button above the results, or even before showing any. The user presses the button, switches to a private chat with the bot and, in doing so, passes a start parameter that instructs the bot to return an OAuth link. Once done, the bot can offer a `https://core.telegram.org/bots/api#inlinekeyboardmarkup `_ *switch_inline* button so that the user can easily return to the chat where they wanted to use the bot's inline capabilities.\n", - "name": "switch_pm_parameter" + "name": "switch_pm_parameter", + "deprecated": { + "version": "6.7", + "release_date": "2023-04-21" + } }, { - "type": "InlineQueryResultsButton", + "type": "String", "required": false, - "description": "A JSON serialized object describing a button to be shown above inline query results", - "html_description": "A JSON serialized object describing a button to be shown above inline query results", - "rst_description": "A JSON serialized object describing a button to be shown above inline query results\n", - "name": "button" + "description": "If passed, clients will display a button with specified text that switches the user to a private chat with the bot and sends the bot a start message with the parameter switch_pm_parameter", + "html_description": "If passed, clients will display a button with specified text that switches the user to a private chat with the bot and sends the bot a start message with the parameter switch_pm_parameter", + "rst_description": "If passed, clients will display a button with specified text that switches the user to a private chat with the bot and sends the bot a start message with the parameter *switch_pm_parameter*\n", + "name": "switch_pm_text", + "deprecated": { + "version": "6.7", + "release_date": "2023-04-21" + } } ], "category": "methods" diff --git a/.butcher/methods/getMyName/entity.json b/.butcher/methods/getMyName/entity.json index 167b6a43..848fcb86 100644 --- a/.butcher/methods/getMyName/entity.json +++ b/.butcher/methods/getMyName/entity.json @@ -1,8 +1,8 @@ { "meta": {}, "group": { - "title": "Upcoming update", - "anchor": "upcoming-update" + "title": "Available methods", + "anchor": "available-methods" }, "object": { "anchor": "getmyname", diff --git a/.butcher/methods/setMyName/entity.json b/.butcher/methods/setMyName/entity.json index 0f6bf363..e6461251 100644 --- a/.butcher/methods/setMyName/entity.json +++ b/.butcher/methods/setMyName/entity.json @@ -1,8 +1,8 @@ { "meta": {}, "group": { - "title": "Upcoming update", - "anchor": "upcoming-update" + "title": "Available methods", + "anchor": "available-methods" }, "object": { "anchor": "setmyname", diff --git a/.butcher/schema/schema.json b/.butcher/schema/schema.json index f3c56457..c3638d34 100644 --- a/.butcher/schema/schema.json +++ b/.butcher/schema/schema.json @@ -1,7 +1,7 @@ { "api": { - "version": "6.6", - "release_date": "2023-03-09" + "version": "6.7", + "release_date": "2023-04-21" }, "items": [ { @@ -2421,9 +2421,9 @@ { "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.", + "description": "This object represents a service message about a user allowing a bot to write messages after adding the bot to the attachment menu or launching a Web App from a link.", + "html_description": "

This object represents a service message about a user allowing a bot to write messages after adding the bot to the attachment menu or launching a Web App from a link.

", + "rst_description": "This object represents a service message about a user allowing a bot to write messages after adding the bot to the attachment menu or launching a Web App from a link.", "annotations": [ { "type": "String", @@ -2942,6 +2942,14 @@ "name": "switch_inline_query_current_chat", "required": false }, + { + "type": "SwitchInlineQueryChosenChat", + "description": "If set, pressing the button will prompt the user to select one of their chats of the specified type, open that chat and insert the bot's username and the specified inline query in the input field", + "html_description": "Optional. If set, pressing the button will prompt the user to select one of their chats of the specified type, open that chat and insert the bot's username and the specified inline query in the input field", + "rst_description": "*Optional*. If set, pressing the button will prompt the user to select one of their chats of the specified type, open that chat and insert the bot's username and the specified inline query in the input field\n", + "name": "switch_inline_query_chosen_chat", + "required": false + }, { "type": "CallbackGame", "description": "Description of the game that will be launched when the user presses the button.\n\nNOTE: This type of button must always be the first button in the first row.", @@ -2957,14 +2965,6 @@ "rst_description": "*Optional*. Specify :code:`True`, to send a `Pay button `_.\n\n\n\n**NOTE:** This type of button **must** always be the first button in the first row and can only be used in invoice messages.\n", "name": "pay", "required": false - }, - { - "type": "SwitchInlineQueryChosenChat", - "description": "If set, pressing the button will prompt the user to select one of their chats of the specified type, open that chat and insert the bot's username and the specified inline query in the input field", - "html_description": "Optional. If set, pressing the button will prompt the user to select one of their chats of the specified type, open that chat and insert the bot's username and the specified inline query in the input field", - "rst_description": "*Optional*. If set, pressing the button will prompt the user to select one of their chats of the specified type, open that chat and insert the bot's username and the specified inline query in the input field\n", - "name": "switch_inline_query_chosen_chat", - "required": false } ], "category": "types" @@ -3011,6 +3011,56 @@ ], "category": "types" }, + { + "anchor": "switchinlinequerychosenchat", + "name": "SwitchInlineQueryChosenChat", + "description": "This object represents an inline button that switches the current user to inline mode in a chosen chat, with an optional default inline query.", + "html_description": "

This object represents an inline button that switches the current user to inline mode in a chosen chat, with an optional default inline query.

", + "rst_description": "This object represents an inline button that switches the current user to inline mode in a chosen chat, with an optional default inline query.", + "annotations": [ + { + "type": "String", + "description": "The default inline query to be inserted in the input field. If left empty, only the bot's username will be inserted", + "html_description": "Optional. The default inline query to be inserted in the input field. If left empty, only the bot's username will be inserted", + "rst_description": "*Optional*. The default inline query to be inserted in the input field. If left empty, only the bot's username will be inserted\n", + "name": "query", + "required": false + }, + { + "type": "Boolean", + "description": "True, if private chats with users can be chosen", + "html_description": "Optional. True, if private chats with users can be chosen", + "rst_description": "*Optional*. True, if private chats with users can be chosen\n", + "name": "allow_user_chats", + "required": false + }, + { + "type": "Boolean", + "description": "True, if private chats with bots can be chosen", + "html_description": "Optional. True, if private chats with bots can be chosen", + "rst_description": "*Optional*. True, if private chats with bots can be chosen\n", + "name": "allow_bot_chats", + "required": false + }, + { + "type": "Boolean", + "description": "True, if group and supergroup chats can be chosen", + "html_description": "Optional. True, if group and supergroup chats can be chosen", + "rst_description": "*Optional*. True, if group and supergroup chats can be chosen\n", + "name": "allow_group_chats", + "required": false + }, + { + "type": "Boolean", + "description": "True, if channel chats can be chosen", + "html_description": "Optional. True, if channel chats can be chosen", + "rst_description": "*Optional*. True, if channel chats can be chosen\n", + "name": "allow_channel_chats", + "required": false + } + ], + "category": "types" + }, { "anchor": "callbackquery", "name": "CallbackQuery", @@ -4277,6 +4327,24 @@ ], "category": "types" }, + { + "anchor": "botname", + "name": "BotName", + "description": "This object represents the bot's name.", + "html_description": "

This object represents the bot's name.

", + "rst_description": "This object represents the bot's name.", + "annotations": [ + { + "type": "String", + "description": "The bot's name", + "html_description": "The bot's name", + "rst_description": "The bot's name\n", + "name": "name", + "required": true + } + ], + "category": "types" + }, { "anchor": "botdescription", "name": "BotDescription", @@ -8013,6 +8081,50 @@ ], "category": "methods" }, + { + "anchor": "setmyname", + "name": "setMyName", + "description": "Use this method to change the bot's name. Returns True on success.", + "html_description": "

Use this method to change the bot's name. Returns True on success.

", + "rst_description": "Use this method to change the bot's name. Returns :code:`True` on success.", + "annotations": [ + { + "type": "String", + "required": false, + "description": "New bot name; 0-64 characters. Pass an empty string to remove the dedicated name for the given language.", + "html_description": "New bot name; 0-64 characters. Pass an empty string to remove the dedicated name for the given language.", + "rst_description": "New bot name; 0-64 characters. Pass an empty string to remove the dedicated name for the given language.\n", + "name": "name" + }, + { + "type": "String", + "required": false, + "description": "A two-letter ISO 639-1 language code. If empty, the name will be shown to all users for whose language there is no dedicated name.", + "html_description": "A two-letter ISO 639-1 language code. If empty, the name will be shown to all users for whose language there is no dedicated name.", + "rst_description": "A two-letter ISO 639-1 language code. If empty, the name will be shown to all users for whose language there is no dedicated name.\n", + "name": "language_code" + } + ], + "category": "methods" + }, + { + "anchor": "getmyname", + "name": "getMyName", + "description": "Use this method to get the current bot name for the given user language. Returns BotName on success.", + "html_description": "

Use this method to get the current bot name for the given user language. Returns BotName on success.

", + "rst_description": "Use this method to get the current bot name for the given user language. Returns :class:`aiogram.types.bot_name.BotName` on success.", + "annotations": [ + { + "type": "String", + "required": false, + "description": "A two-letter ISO 639-1 language code or an empty string", + "html_description": "A two-letter ISO 639-1 language code or an empty string", + "rst_description": "A two-letter ISO 639-1 language code or an empty string\n", + "name": "language_code" + } + ], + "category": "methods" + }, { "anchor": "setmydescription", "name": "setMyDescription", @@ -9476,9 +9588,9 @@ { "type": "Boolean", "required": false, - "description": "Pass True if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query", - "html_description": "Pass True if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query", - "rst_description": "Pass :code:`True` if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query\n", + "description": "Pass True if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query.", + "html_description": "Pass True if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query.", + "rst_description": "Pass :code:`True` if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query.\n", "name": "is_personal" }, { @@ -9489,33 +9601,51 @@ "rst_description": "Pass the offset that a client should send in the next query with the same text to receive more results. Pass an empty string if there are no more results or if you don't support pagination. Offset length can't exceed 64 bytes.\n", "name": "next_offset" }, - { - "type": "String", - "required": false, - "description": "If passed, clients will display a button with specified text that switches the user to a private chat with the bot and sends the bot a start message with the parameter switch_pm_parameter", - "html_description": "If passed, clients will display a button with specified text that switches the user to a private chat with the bot and sends the bot a start message with the parameter switch_pm_parameter", - "rst_description": "If passed, clients will display a button with specified text that switches the user to a private chat with the bot and sends the bot a start message with the parameter *switch_pm_parameter*\n", - "name": "switch_pm_text" - }, - { - "type": "String", - "required": false, - "description": "Deep-linking parameter for the /start message sent to the bot when user presses the switch button. 1-64 characters, only A-Z, a-z, 0-9, _ and - are allowed.\n\nExample: An inline bot that sends YouTube videos can ask the user to connect the bot to their YouTube account to adapt search results accordingly. To do this, it displays a 'Connect your YouTube account' button above the results, or even before showing any. The user presses the button, switches to a private chat with the bot and, in doing so, passes a start parameter that instructs the bot to return an OAuth link. Once done, the bot can offer a switch_inline button so that the user can easily return to the chat where they wanted to use the bot's inline capabilities.", - "html_description": "Deep-linking parameter for the /start message sent to the bot when user presses the switch button. 1-64 characters, only A-Z, a-z, 0-9, _ and - are allowed.
\n
\nExample: An inline bot that sends YouTube videos can ask the user to connect the bot to their YouTube account to adapt search results accordingly. To do this, it displays a 'Connect your YouTube account' button above the results, or even before showing any. The user presses the button, switches to a private chat with the bot and, in doing so, passes a start parameter that instructs the bot to return an OAuth link. Once done, the bot can offer a switch_inline button so that the user can easily return to the chat where they wanted to use the bot's inline capabilities.", - "rst_description": "`Deep-linking `_ parameter for the /start message sent to the bot when user presses the switch button. 1-64 characters, only :code:`A-Z`, :code:`a-z`, :code:`0-9`, :code:`_` and :code:`-` are allowed.\n\n\n\n*Example:* An inline bot that sends YouTube videos can ask the user to connect the bot to their YouTube account to adapt search results accordingly. To do this, it displays a 'Connect your YouTube account' button above the results, or even before showing any. The user presses the button, switches to a private chat with the bot and, in doing so, passes a start parameter that instructs the bot to return an OAuth link. Once done, the bot can offer a `https://core.telegram.org/bots/api#inlinekeyboardmarkup `_ *switch_inline* button so that the user can easily return to the chat where they wanted to use the bot's inline capabilities.\n", - "name": "switch_pm_parameter" - }, { "type": "InlineQueryResultsButton", "required": false, - "description": "A JSON serialized object describing a button to be shown above inline query results", - "html_description": "A JSON serialized object describing a button to be shown above inline query results", - "rst_description": "A JSON serialized object describing a button to be shown above inline query results\n", + "description": "A JSON-serialized object describing a button to be shown above inline query results", + "html_description": "A JSON-serialized object describing a button to be shown above inline query results", + "rst_description": "A JSON-serialized object describing a button to be shown above inline query results\n", "name": "button" } ], "category": "methods" }, + { + "anchor": "inlinequeryresultsbutton", + "name": "InlineQueryResultsButton", + "description": "This object represents a button to be shown above inline query results. You must use exactly one of the optional fields.", + "html_description": "

This object represents a button to be shown above inline query results. You must use exactly one of the optional fields.

", + "rst_description": "This object represents a button to be shown above inline query results. You **must** use exactly one of the optional fields.", + "annotations": [ + { + "type": "String", + "description": "Label text on the button", + "html_description": "Label text on the button", + "rst_description": "Label text on the button\n", + "name": "text", + "required": true + }, + { + "type": "WebAppInfo", + "description": "Description of the Web App that will be launched when the user presses the button. The Web App will be able to switch back to the inline mode using the method web_app_switch_inline_query inside the Web App.", + "html_description": "Optional. Description of the Web App that will be launched when the user presses the button. The Web App will be able to switch back to the inline mode using the method web_app_switch_inline_query inside the Web App.", + "rst_description": "*Optional*. Description of the `Web App `_ that will be launched when the user presses the button. The Web App will be able to switch back to the inline mode using the method *web_app_switch_inline_query* inside the Web App.\n", + "name": "web_app", + "required": false + }, + { + "type": "String", + "description": "Deep-linking parameter for the /start message sent to the bot when a user presses the button. 1-64 characters, only A-Z, a-z, 0-9, _ and - are allowed.\n\nExample: An inline bot that sends YouTube videos can ask the user to connect the bot to their YouTube account to adapt search results accordingly. To do this, it displays a 'Connect your YouTube account' button above the results, or even before showing any. The user presses the button, switches to a private chat with the bot and, in doing so, passes a start parameter that instructs the bot to return an OAuth link. Once done, the bot can offer a switch_inline button so that the user can easily return to the chat where they wanted to use the bot's inline capabilities.", + "html_description": "Optional. Deep-linking parameter for the /start message sent to the bot when a user presses the button. 1-64 characters, only A-Z, a-z, 0-9, _ and - are allowed.
\n
\nExample: An inline bot that sends YouTube videos can ask the user to connect the bot to their YouTube account to adapt search results accordingly. To do this, it displays a 'Connect your YouTube account' button above the results, or even before showing any. The user presses the button, switches to a private chat with the bot and, in doing so, passes a start parameter that instructs the bot to return an OAuth link. Once done, the bot can offer a switch_inline button so that the user can easily return to the chat where they wanted to use the bot's inline capabilities.", + "rst_description": "*Optional*. `Deep-linking `_ parameter for the /start message sent to the bot when a user presses the button. 1-64 characters, only :code:`A-Z`, :code:`a-z`, :code:`0-9`, :code:`_` and :code:`-` are allowed.\n\n\n\n*Example:* An inline bot that sends YouTube videos can ask the user to connect the bot to their YouTube account to adapt search results accordingly. To do this, it displays a 'Connect your YouTube account' button above the results, or even before showing any. The user presses the button, switches to a private chat with the bot and, in doing so, passes a start parameter that instructs the bot to return an OAuth link. Once done, the bot can offer a `https://core.telegram.org/bots/api#inlinekeyboardmarkup `_ *switch_inline* button so that the user can easily return to the chat where they wanted to use the bot's inline capabilities.\n", + "name": "start_parameter", + "required": false + } + ], + "category": "types" + }, { "anchor": "inlinequeryresult", "name": "InlineQueryResult", @@ -13725,158 +13855,6 @@ } ], "description": "Your bot can offer users HTML5 games to play solo or to compete against each other in groups and one-on-one chats. Create games via @BotFather using the /newgame command. Please note that this kind of power requires responsibility: you will need to accept the terms for each game that your bots will be offering.\n - Games are a new type of content on Telegram, represented by the Game and InlineQueryResultGame objects.\n - Once you've created a game via BotFather, you can send games to chats as regular messages using the sendGame method, or use inline mode with InlineQueryResultGame.\n - If you send the game message without any buttons, it will automatically have a 'Play GameName' button. When this button is pressed, your bot gets a CallbackQuery with the game_short_name of the requested game. You provide the correct URL for this particular user and the app opens the game in the in-app browser.\n - You can manually add multiple buttons to your game message. Please note that the first button in the first row must always launch the game, using the field callback_game in InlineKeyboardButton. You can add extra buttons according to taste: e.g., for a description of the rules, or to open the game's official community.\n - To make your game more attractive, you can upload a GIF animation that demostrates the game to the users via BotFather (see Lumberjack for example).\n - A game message will also display high scores for the current chat. Use setGameScore to post high scores to the chat with the game, add the edit_message parameter to automatically update the message with the current scoreboard.\n - Use getGameHighScores to get data for in-game high score tables.\n - You can also add an extra sharing button for users to share their best score to different chats.\n - For examples of what can be done using this new stuff, check the @gamebot and @gamee bots." - }, - { - "title": "Upcoming update", - "anchor": "upcoming-update", - "children": [ - { - "anchor": "inlinequeryresultsbutton", - "name": "InlineQueryResultsButton", - "description": "This object represents a button to be shown above inline query results. You must use exactly one of the optional fields.", - "html_description": "

This object represents a button to be shown above inline query results. You must use exactly one of the optional fields.

", - "rst_description": "This object represents a button to be shown above inline query results. You **must** use exactly one of the optional fields.", - "annotations": [ - { - "type": "String", - "description": "Label text on the button", - "html_description": "Label text on the button", - "rst_description": "Label text on the button\n", - "name": "text", - "required": true - }, - { - "type": "WebAppInfo", - "description": "Description of the Web App that will be launched when the user presses the button. The Web App will be able to switch back to the inline mode using the method web_app_switch_inline_query inside the Web App.", - "html_description": "Optional. Description of the Web App that will be launched when the user presses the button. The Web App will be able to switch back to the inline mode using the method web_app_switch_inline_query inside the Web App.", - "rst_description": "*Optional*. Description of the `Web App `_ that will be launched when the user presses the button. The Web App will be able to switch back to the inline mode using the method *web_app_switch_inline_query* inside the Web App.\n", - "name": "web_app", - "required": false - }, - { - "type": "String", - "description": "Deep-linking parameter for the /start message sent to the bot when a user presses the button. 1-64 characters, only A-Z, a-z, 0-9, _ and - are allowed.\n\nExample: An inline bot that sends YouTube videos can ask the user to connect the bot to their YouTube account to adapt search results accordingly. To do this, it displays a 'Connect your YouTube account' button above the results, or even before showing any. The user presses the button, switches to a private chat with the bot and, in doing so, passes a start parameter that instructs the bot to return an OAuth link. Once done, the bot can offer a switch_inline button so that the user can easily return to the chat where they wanted to use the bot's inline capabilities.", - "html_description": "Optional. Deep-linking parameter for the /start message sent to the bot when a user presses the button. 1-64 characters, only A-Z, a-z, 0-9, _ and - are allowed.
\n
\nExample: An inline bot that sends YouTube videos can ask the user to connect the bot to their YouTube account to adapt search results accordingly. To do this, it displays a 'Connect your YouTube account' button above the results, or even before showing any. The user presses the button, switches to a private chat with the bot and, in doing so, passes a start parameter that instructs the bot to return an OAuth link. Once done, the bot can offer a switch_inline button so that the user can easily return to the chat where they wanted to use the bot's inline capabilities.", - "rst_description": "*Optional*. `Deep-linking `_ parameter for the /start message sent to the bot when a user presses the button. 1-64 characters, only :code:`A-Z`, :code:`a-z`, :code:`0-9`, :code:`_` and :code:`-` are allowed.\n\n\n\n*Example:* An inline bot that sends YouTube videos can ask the user to connect the bot to their YouTube account to adapt search results accordingly. To do this, it displays a 'Connect your YouTube account' button above the results, or even before showing any. The user presses the button, switches to a private chat with the bot and, in doing so, passes a start parameter that instructs the bot to return an OAuth link. Once done, the bot can offer a `https://core.telegram.org/bots/api#inlinekeyboardmarkup `_ *switch_inline* button so that the user can easily return to the chat where they wanted to use the bot's inline capabilities.\n", - "name": "start_parameter", - "required": false - } - ], - "category": "types" - }, - { - "anchor": "setmyname", - "name": "setMyName", - "description": "Use this method to change the bot's name. Returns True on success.", - "html_description": "

Use this method to change the bot's name. Returns True on success.

", - "rst_description": "Use this method to change the bot's name. Returns :code:`True` on success.", - "annotations": [ - { - "type": "String", - "required": false, - "description": "New bot name; 0-64 characters. Pass an empty string to remove the dedicated name for the given language.", - "html_description": "New bot name; 0-64 characters. Pass an empty string to remove the dedicated name for the given language.", - "rst_description": "New bot name; 0-64 characters. Pass an empty string to remove the dedicated name for the given language.\n", - "name": "name" - }, - { - "type": "String", - "required": false, - "description": "A two-letter ISO 639-1 language code. If empty, the name will be shown to all users for whose language there is no dedicated name.", - "html_description": "A two-letter ISO 639-1 language code. If empty, the name will be shown to all users for whose language there is no dedicated name.", - "rst_description": "A two-letter ISO 639-1 language code. If empty, the name will be shown to all users for whose language there is no dedicated name.\n", - "name": "language_code" - } - ], - "category": "methods" - }, - { - "anchor": "getmyname", - "name": "getMyName", - "description": "Use this method to get the current bot name for the given user language. Returns BotName on success.", - "html_description": "

Use this method to get the current bot name for the given user language. Returns BotName on success.

", - "rst_description": "Use this method to get the current bot name for the given user language. Returns :class:`aiogram.types.bot_name.BotName` on success.", - "annotations": [ - { - "type": "String", - "required": false, - "description": "A two-letter ISO 639-1 language code or an empty string", - "html_description": "A two-letter ISO 639-1 language code or an empty string", - "rst_description": "A two-letter ISO 639-1 language code or an empty string\n", - "name": "language_code" - } - ], - "category": "methods" - }, - { - "anchor": "botname", - "name": "BotName", - "description": "This object represents the bot's name.", - "html_description": "

This object represents the bot's name.

", - "rst_description": "This object represents the bot's name.", - "annotations": [ - { - "type": "String", - "description": "The bot's name", - "html_description": "The bot's name", - "rst_description": "The bot's name\n", - "name": "name", - "required": true - } - ], - "category": "types" - }, - { - "anchor": "switchinlinequerychosenchat", - "name": "SwitchInlineQueryChosenChat", - "description": "This object represents an inline button that switches the current user to inline mode in a chosen chat, with an optional default inline query.", - "html_description": "

This object represents an inline button that switches the current user to inline mode in a chosen chat, with an optional default inline query.

", - "rst_description": "This object represents an inline button that switches the current user to inline mode in a chosen chat, with an optional default inline query.", - "annotations": [ - { - "type": "String", - "description": "The default inline query to be inserted in the input field. If left empty, only the bot's username will be inserted", - "html_description": "Optional. The default inline query to be inserted in the input field. If left empty, only the bot's username will be inserted", - "rst_description": "*Optional*. The default inline query to be inserted in the input field. If left empty, only the bot's username will be inserted\n", - "name": "query", - "required": false - }, - { - "type": "Boolean", - "description": "True, if private chats with users can be chosen", - "html_description": "Optional. True, if private chats with users can be chosen", - "rst_description": "*Optional*. True, if private chats with users can be chosen\n", - "name": "allow_user_chats", - "required": false - }, - { - "type": "Boolean", - "description": "True, if private chats with bots can be chosen", - "html_description": "Optional. True, if private chats with bots can be chosen", - "rst_description": "*Optional*. True, if private chats with bots can be chosen\n", - "name": "allow_bot_chats", - "required": false - }, - { - "type": "Boolean", - "description": "True, if group and supergroup chats can be chosen", - "html_description": "Optional. True, if group and supergroup chats can be chosen", - "rst_description": "*Optional*. True, if group and supergroup chats can be chosen\n", - "name": "allow_group_chats", - "required": false - }, - { - "type": "Boolean", - "description": "True, if channel chats can be chosen", - "html_description": "Optional. True, if channel chats can be chosen", - "rst_description": "*Optional*. True, if channel chats can be chosen\n", - "name": "allow_channel_chats", - "required": false - } - ], - "category": "types" - } - ] } ] } diff --git a/.butcher/types/BotName/entity.json b/.butcher/types/BotName/entity.json index cd3afa82..d18b4902 100644 --- a/.butcher/types/BotName/entity.json +++ b/.butcher/types/BotName/entity.json @@ -1,8 +1,8 @@ { "meta": {}, "group": { - "title": "Upcoming update", - "anchor": "upcoming-update" + "title": "Available types", + "anchor": "available-types" }, "object": { "anchor": "botname", diff --git a/.butcher/types/InlineKeyboardButton/entity.json b/.butcher/types/InlineKeyboardButton/entity.json index d81d02c9..c7919e99 100644 --- a/.butcher/types/InlineKeyboardButton/entity.json +++ b/.butcher/types/InlineKeyboardButton/entity.json @@ -67,6 +67,14 @@ "name": "switch_inline_query_current_chat", "required": false }, + { + "type": "SwitchInlineQueryChosenChat", + "description": "If set, pressing the button will prompt the user to select one of their chats of the specified type, open that chat and insert the bot's username and the specified inline query in the input field", + "html_description": "Optional. If set, pressing the button will prompt the user to select one of their chats of the specified type, open that chat and insert the bot's username and the specified inline query in the input field", + "rst_description": "*Optional*. If set, pressing the button will prompt the user to select one of their chats of the specified type, open that chat and insert the bot's username and the specified inline query in the input field\n", + "name": "switch_inline_query_chosen_chat", + "required": false + }, { "type": "CallbackGame", "description": "Description of the game that will be launched when the user presses the button.\n\nNOTE: This type of button must always be the first button in the first row.", @@ -82,14 +90,6 @@ "rst_description": "*Optional*. Specify :code:`True`, to send a `Pay button `_.\n\n\n\n**NOTE:** This type of button **must** always be the first button in the first row and can only be used in invoice messages.\n", "name": "pay", "required": false - }, - { - "type": "SwitchInlineQueryChosenChat", - "description": "If set, pressing the button will prompt the user to select one of their chats of the specified type, open that chat and insert the bot's username and the specified inline query in the input field", - "html_description": "Optional. If set, pressing the button will prompt the user to select one of their chats of the specified type, open that chat and insert the bot's username and the specified inline query in the input field", - "rst_description": "*Optional*. If set, pressing the button will prompt the user to select one of their chats of the specified type, open that chat and insert the bot's username and the specified inline query in the input field\n", - "name": "switch_inline_query_chosen_chat", - "required": false } ], "category": "types" diff --git a/.butcher/types/InlineQueryResultsButton/entity.json b/.butcher/types/InlineQueryResultsButton/entity.json index bf0a8122..169b1c2c 100644 --- a/.butcher/types/InlineQueryResultsButton/entity.json +++ b/.butcher/types/InlineQueryResultsButton/entity.json @@ -1,8 +1,8 @@ { "meta": {}, "group": { - "title": "Upcoming update", - "anchor": "upcoming-update" + "title": "Inline mode", + "anchor": "inline-mode" }, "object": { "anchor": "inlinequeryresultsbutton", diff --git a/.butcher/types/SwitchInlineQueryChosenChat/entity.json b/.butcher/types/SwitchInlineQueryChosenChat/entity.json index d25b1459..f36f3c33 100644 --- a/.butcher/types/SwitchInlineQueryChosenChat/entity.json +++ b/.butcher/types/SwitchInlineQueryChosenChat/entity.json @@ -1,8 +1,8 @@ { "meta": {}, "group": { - "title": "Upcoming update", - "anchor": "upcoming-update" + "title": "Available types", + "anchor": "available-types" }, "object": { "anchor": "switchinlinequerychosenchat", diff --git a/.butcher/types/WriteAccessAllowed/entity.json b/.butcher/types/WriteAccessAllowed/entity.json index 65203444..62d83fdd 100644 --- a/.butcher/types/WriteAccessAllowed/entity.json +++ b/.butcher/types/WriteAccessAllowed/entity.json @@ -7,9 +7,9 @@ "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.", + "description": "This object represents a service message about a user allowing a bot to write messages after adding the bot to the attachment menu or launching a Web App from a link.", + "html_description": "

This object represents a service message about a user allowing a bot to write messages after adding the bot to the attachment menu or launching a Web App from a link.

", + "rst_description": "This object represents a service message about a user allowing a bot to write messages after adding the bot to the attachment menu or launching a Web App from a link.", "annotations": [ { "type": "String", diff --git a/aiogram/client/bot.py b/aiogram/client/bot.py index 23ced1d1..a5258eaa 100644 --- a/aiogram/client/bot.py +++ b/aiogram/client/bot.py @@ -485,9 +485,9 @@ class Bot(ContextInstanceMixin["Bot"]): cache_time: Optional[int] = None, is_personal: Optional[bool] = None, next_offset: Optional[str] = None, - switch_pm_text: Optional[str] = None, - switch_pm_parameter: Optional[str] = None, button: Optional[InlineQueryResultsButton] = None, + switch_pm_parameter: Optional[str] = None, + switch_pm_text: Optional[str] = None, request_timeout: Optional[int] = None, ) -> bool: """ @@ -500,11 +500,11 @@ class Bot(ContextInstanceMixin["Bot"]): :param inline_query_id: Unique identifier for the answered query :param results: A JSON-serialized array of results for the inline query :param cache_time: The maximum amount of time in seconds that the result of the inline query may be cached on the server. Defaults to 300. - :param is_personal: Pass :code:`True` if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query + :param is_personal: Pass :code:`True` if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query. :param next_offset: Pass the offset that a client should send in the next query with the same text to receive more results. Pass an empty string if there are no more results or if you don't support pagination. Offset length can't exceed 64 bytes. - :param switch_pm_text: If passed, clients will display a button with specified text that switches the user to a private chat with the bot and sends the bot a start message with the parameter *switch_pm_parameter* + :param button: A JSON-serialized object describing a button to be shown above inline query results :param switch_pm_parameter: `Deep-linking `_ parameter for the /start message sent to the bot when user presses the switch button. 1-64 characters, only :code:`A-Z`, :code:`a-z`, :code:`0-9`, :code:`_` and :code:`-` are allowed. - :param button: A JSON serialized object describing a button to be shown above inline query results + :param switch_pm_text: If passed, clients will display a button with specified text that switches the user to a private chat with the bot and sends the bot a start message with the parameter *switch_pm_parameter* :param request_timeout: Request timeout :return: On success, :code:`True` is returned. """ @@ -515,9 +515,9 @@ class Bot(ContextInstanceMixin["Bot"]): cache_time=cache_time, is_personal=is_personal, next_offset=next_offset, - switch_pm_text=switch_pm_text, - switch_pm_parameter=switch_pm_parameter, button=button, + switch_pm_parameter=switch_pm_parameter, + switch_pm_text=switch_pm_text, ) return await self(call, request_timeout=request_timeout) diff --git a/aiogram/methods/answer_inline_query.py b/aiogram/methods/answer_inline_query.py index 7e85a9c9..7b6b6d88 100644 --- a/aiogram/methods/answer_inline_query.py +++ b/aiogram/methods/answer_inline_query.py @@ -2,6 +2,8 @@ from __future__ import annotations from typing import TYPE_CHECKING, List, Optional +from pydantic import Field + from ..types import InlineQueryResult, InlineQueryResultsButton from .base import TelegramMethod @@ -25,12 +27,18 @@ class AnswerInlineQuery(TelegramMethod[bool]): cache_time: Optional[int] = None """The maximum amount of time in seconds that the result of the inline query may be cached on the server. Defaults to 300.""" is_personal: Optional[bool] = None - """Pass :code:`True` if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query""" + """Pass :code:`True` if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query.""" next_offset: Optional[str] = None """Pass the offset that a client should send in the next query with the same text to receive more results. Pass an empty string if there are no more results or if you don't support pagination. Offset length can't exceed 64 bytes.""" - switch_pm_text: Optional[str] = None - """If passed, clients will display a button with specified text that switches the user to a private chat with the bot and sends the bot a start message with the parameter *switch_pm_parameter*""" - switch_pm_parameter: Optional[str] = None - """`Deep-linking `_ parameter for the /start message sent to the bot when user presses the switch button. 1-64 characters, only :code:`A-Z`, :code:`a-z`, :code:`0-9`, :code:`_` and :code:`-` are allowed.""" button: Optional[InlineQueryResultsButton] = None - """A JSON serialized object describing a button to be shown above inline query results""" + """A JSON-serialized object describing a button to be shown above inline query results""" + switch_pm_parameter: Optional[str] = Field(None, deprecated=True) + """`Deep-linking `_ parameter for the /start message sent to the bot when user presses the switch button. 1-64 characters, only :code:`A-Z`, :code:`a-z`, :code:`0-9`, :code:`_` and :code:`-` are allowed. + +.. deprecated:: API:6.7 + https://core.telegram.org/bots/api-changelog#april-21-2023""" + switch_pm_text: Optional[str] = Field(None, deprecated=True) + """If passed, clients will display a button with specified text that switches the user to a private chat with the bot and sends the bot a start message with the parameter *switch_pm_parameter* + +.. deprecated:: API:6.7 + https://core.telegram.org/bots/api-changelog#april-21-2023""" diff --git a/aiogram/types/inline_keyboard_button.py b/aiogram/types/inline_keyboard_button.py index da1d50dd..977fae8d 100644 --- a/aiogram/types/inline_keyboard_button.py +++ b/aiogram/types/inline_keyboard_button.py @@ -32,9 +32,9 @@ class InlineKeyboardButton(MutableTelegramObject): """*Optional*. If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. May be empty, in which case just the bot's username will be inserted.""" switch_inline_query_current_chat: Optional[str] = None """*Optional*. If set, pressing the button will insert the bot's username and the specified inline query in the current chat's input field. May be empty, in which case only the bot's username will be inserted.""" + switch_inline_query_chosen_chat: Optional[SwitchInlineQueryChosenChat] = None + """*Optional*. If set, pressing the button will prompt the user to select one of their chats of the specified type, open that chat and insert the bot's username and the specified inline query in the input field""" callback_game: Optional[CallbackGame] = None """*Optional*. Description of the game that will be launched when the user presses the button.""" pay: Optional[bool] = None """*Optional*. Specify :code:`True`, to send a `Pay button `_.""" - switch_inline_query_chosen_chat: Optional[SwitchInlineQueryChosenChat] = None - """*Optional*. If set, pressing the button will prompt the user to select one of their chats of the specified type, open that chat and insert the bot's username and the specified inline query in the input field""" diff --git a/aiogram/types/inline_query.py b/aiogram/types/inline_query.py index 1edbbbfb..55eab72f 100644 --- a/aiogram/types/inline_query.py +++ b/aiogram/types/inline_query.py @@ -40,9 +40,9 @@ class InlineQuery(TelegramObject): cache_time: Optional[int] = None, is_personal: Optional[bool] = None, next_offset: Optional[str] = None, - switch_pm_text: Optional[str] = None, - switch_pm_parameter: Optional[str] = None, button: Optional[InlineQueryResultsButton] = None, + switch_pm_parameter: Optional[str] = None, + switch_pm_text: Optional[str] = None, **kwargs: Any, ) -> AnswerInlineQuery: """ @@ -59,11 +59,11 @@ class InlineQuery(TelegramObject): :param results: A JSON-serialized array of results for the inline query :param cache_time: The maximum amount of time in seconds that the result of the inline query may be cached on the server. Defaults to 300. - :param is_personal: Pass :code:`True` if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query + :param is_personal: Pass :code:`True` if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query. :param next_offset: Pass the offset that a client should send in the next query with the same text to receive more results. Pass an empty string if there are no more results or if you don't support pagination. Offset length can't exceed 64 bytes. - :param switch_pm_text: If passed, clients will display a button with specified text that switches the user to a private chat with the bot and sends the bot a start message with the parameter *switch_pm_parameter* + :param button: A JSON-serialized object describing a button to be shown above inline query results :param switch_pm_parameter: `Deep-linking `_ parameter for the /start message sent to the bot when user presses the switch button. 1-64 characters, only :code:`A-Z`, :code:`a-z`, :code:`0-9`, :code:`_` and :code:`-` are allowed. - :param button: A JSON serialized object describing a button to be shown above inline query results + :param switch_pm_text: If passed, clients will display a button with specified text that switches the user to a private chat with the bot and sends the bot a start message with the parameter *switch_pm_parameter* :return: instance of method :class:`aiogram.methods.answer_inline_query.AnswerInlineQuery` """ # DO NOT EDIT MANUALLY!!! @@ -77,8 +77,8 @@ class InlineQuery(TelegramObject): cache_time=cache_time, is_personal=is_personal, next_offset=next_offset, - switch_pm_text=switch_pm_text, - switch_pm_parameter=switch_pm_parameter, button=button, + switch_pm_parameter=switch_pm_parameter, + switch_pm_text=switch_pm_text, **kwargs, ) diff --git a/aiogram/types/write_access_allowed.py b/aiogram/types/write_access_allowed.py index 927ee807..32924410 100644 --- a/aiogram/types/write_access_allowed.py +++ b/aiogram/types/write_access_allowed.py @@ -5,7 +5,7 @@ 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. + This object represents a service message about a user allowing a bot to write messages after adding the bot to the attachment menu or launching a Web App from a link. Source: https://core.telegram.org/bots/api#writeaccessallowed """ diff --git a/docs/api/methods/index.rst b/docs/api/methods/index.rst index 0214a89a..4a7f4b01 100644 --- a/docs/api/methods/index.rst +++ b/docs/api/methods/index.rst @@ -42,6 +42,7 @@ Available methods get_my_commands get_my_default_administrator_rights get_my_description + get_my_name get_my_short_description get_user_profile_photos hide_general_forum_topic @@ -78,6 +79,7 @@ Available methods set_my_commands set_my_default_administrator_rights set_my_description + set_my_name set_my_short_description unban_chat_member unban_chat_sender_chat @@ -171,12 +173,3 @@ Inline mode answer_inline_query answer_web_app_query - -Upcoming update -=============== - -.. toctree:: - :maxdepth: 1 - - get_my_name - set_my_name diff --git a/docs/api/types/index.rst b/docs/api/types/index.rst index 01d5ff95..930e9354 100644 --- a/docs/api/types/index.rst +++ b/docs/api/types/index.rst @@ -34,6 +34,7 @@ Inline mode inline_query_result_venue inline_query_result_video inline_query_result_voice + inline_query_results_button input_contact_message_content input_invoice_message_content input_location_message_content @@ -60,6 +61,7 @@ Available types bot_command_scope_chat_member bot_command_scope_default bot_description + bot_name bot_short_description callback_query chat @@ -121,6 +123,7 @@ Available types reply_keyboard_markup reply_keyboard_remove response_parameters + switch_inline_query_chosen_chat user user_profile_photos user_shared @@ -192,16 +195,6 @@ Payments shipping_query successful_payment -Upcoming update -=============== - -.. toctree:: - :maxdepth: 1 - - bot_name - inline_query_results_button - switch_inline_query_chosen_chat - Games =====