diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index 45920eb8f..4ac178fcf 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -3120,7 +3120,7 @@ speechRecognitionResultError error:error = SpeechRecognitionResult; //@description Describes a color to highlight a bot added to attachment menu @light_color Color in the RGB24 format for light themes @dark_color Color in the RGB24 format for dark themes attachmentMenuBotColor light_color:int32 dark_color:int32 = AttachmentMenuBotColor; -//@description Represents a bot added to attachment menu +//@description Represents a bot, which can be added to attachment menu //@bot_user_id User identifier of the bot added to attachment menu //@supports_self_chat True, if the bot supports opening from attachment menu in the chat with the bot //@supports_user_chats True, if the bot supports opening from attachment menu in private chats with ordinary users @@ -3128,6 +3128,7 @@ attachmentMenuBotColor light_color:int32 dark_color:int32 = AttachmentMenuBotCol //@supports_group_chats True, if the bot supports opening from attachment menu in basic group and supergroup chats //@supports_channel_chats True, if the bot supports opening from attachment menu in channel chats //@supports_settings True, if the bot supports "settings_button_pressed" event +//@request_write_access True, if the user needs to be requested to give the permission to the bot to send them messages //@name Name for the bot in attachment menu //@name_color Color to highlight selected name of the bot if appropriate; may be null //@default_icon Default attachment menu icon for the bot in SVG format; may be null @@ -3137,7 +3138,7 @@ attachmentMenuBotColor light_color:int32 dark_color:int32 = AttachmentMenuBotCol //@macos_icon Attachment menu icon for the bot in TGS format for the official native macOS app; may be null //@icon_color Color to highlight selected icon of the bot if appropriate; may be null //@web_app_placeholder Default placeholder for opened Web Apps in SVG format; may be null -attachmentMenuBot bot_user_id:int53 supports_self_chat:Bool supports_user_chats:Bool supports_bot_chats:Bool supports_group_chats:Bool supports_channel_chats:Bool supports_settings:Bool name:string name_color:attachmentMenuBotColor default_icon:file ios_static_icon:file ios_animated_icon:file android_icon:file macos_icon:file icon_color:attachmentMenuBotColor web_app_placeholder:file = AttachmentMenuBot; +attachmentMenuBot bot_user_id:int53 supports_self_chat:Bool supports_user_chats:Bool supports_bot_chats:Bool supports_group_chats:Bool supports_channel_chats:Bool supports_settings:Bool request_write_access:Bool name:string name_color:attachmentMenuBotColor default_icon:file ios_static_icon:file ios_animated_icon:file android_icon:file macos_icon:file icon_color:attachmentMenuBotColor web_app_placeholder:file = AttachmentMenuBot; //@description Information about the message sent by answerWebAppQuery @inline_message_id Identifier of the sent inline message, if known sentWebAppMessage inline_message_id:string = SentWebAppMessage; diff --git a/td/telegram/AttachMenuManager.cpp b/td/telegram/AttachMenuManager.cpp index 3702c5fed..396d6363d 100644 --- a/td/telegram/AttachMenuManager.cpp +++ b/td/telegram/AttachMenuManager.cpp @@ -311,8 +311,8 @@ bool operator==(const AttachMenuManager::AttachMenuBot &lhs, const AttachMenuMan lhs.supports_bot_dialogs_ == rhs.supports_bot_dialogs_ && lhs.supports_group_dialogs_ == rhs.supports_group_dialogs_ && lhs.supports_broadcast_dialogs_ == rhs.supports_broadcast_dialogs_ && - lhs.supports_settings_ == rhs.supports_settings_ && lhs.name_ == rhs.name_ && - lhs.default_icon_file_id_ == rhs.default_icon_file_id_ && + lhs.supports_settings_ == rhs.supports_settings_ && lhs.request_write_access_ == rhs.request_write_access_ && + lhs.name_ == rhs.name_ && lhs.default_icon_file_id_ == rhs.default_icon_file_id_ && lhs.ios_static_icon_file_id_ == rhs.ios_static_icon_file_id_ && lhs.ios_animated_icon_file_id_ == rhs.ios_animated_icon_file_id_ && lhs.android_icon_file_id_ == rhs.android_icon_file_id_ && lhs.macos_icon_file_id_ == rhs.macos_icon_file_id_ && @@ -352,6 +352,7 @@ void AttachMenuManager::AttachMenuBot::store(StorerT &storer) const { STORE_FLAG(supports_settings_); STORE_FLAG(has_placeholder_file_id); STORE_FLAG(has_cache_version); + STORE_FLAG(request_write_access_); END_STORE_FLAGS(); td::store(user_id_, storer); td::store(name_, storer); @@ -410,6 +411,7 @@ void AttachMenuManager::AttachMenuBot::parse(ParserT &parser) { PARSE_FLAG(supports_settings_); PARSE_FLAG(has_placeholder_file_id); PARSE_FLAG(has_cache_version); + PARSE_FLAG(request_write_access_); END_PARSE_FLAGS(); td::parse(user_id_, parser); td::parse(name_, parser); @@ -816,6 +818,7 @@ Result AttachMenuManager::get_attach_menu_bot( } } attach_menu_bot.supports_settings_ = bot->has_settings_; + attach_menu_bot.request_write_access_ = bot->request_write_access_; if (!attach_menu_bot.default_icon_file_id_.is_valid()) { return Status::Error(PSLICE() << "Have no default icon for " << user_id); } @@ -1057,7 +1060,7 @@ td_api::object_ptr AttachMenuManager::get_attachment_ return td_api::make_object( td_->contacts_manager_->get_user_id_object(bot.user_id_, "get_attachment_menu_bot_object"), bot.supports_self_dialog_, bot.supports_user_dialogs_, bot.supports_bot_dialogs_, bot.supports_group_dialogs_, - bot.supports_broadcast_dialogs_, bot.supports_settings_, bot.name_, + bot.supports_broadcast_dialogs_, bot.supports_settings_, bot.request_write_access_, bot.name_, get_attach_menu_bot_color_object(bot.name_color_), get_file(bot.default_icon_file_id_), get_file(bot.ios_static_icon_file_id_), get_file(bot.ios_animated_icon_file_id_), get_file(bot.android_icon_file_id_), get_file(bot.macos_icon_file_id_), diff --git a/td/telegram/AttachMenuManager.h b/td/telegram/AttachMenuManager.h index 12c9d82ce..8019991ee 100644 --- a/td/telegram/AttachMenuManager.h +++ b/td/telegram/AttachMenuManager.h @@ -88,6 +88,7 @@ class AttachMenuManager final : public Actor { bool supports_group_dialogs_ = false; bool supports_broadcast_dialogs_ = false; bool supports_settings_ = false; + bool request_write_access_ = false; string name_; AttachMenuBotColor name_color_; FileId default_icon_file_id_; @@ -98,7 +99,7 @@ class AttachMenuManager final : public Actor { AttachMenuBotColor icon_color_; FileId placeholder_file_id_; - static constexpr uint32 CACHE_VERSION = 1; + static constexpr uint32 CACHE_VERSION = 2; uint32 cache_version_ = 0; template