From 3da44eb5dd01948c8cad10c682c2f38287a53b8c Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 1 Nov 2023 21:04:04 +0400 Subject: [PATCH] Fix attach menu suggested bot launch. --- .../SourceFiles/inline_bots/bot_attach_web_view.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Telegram/SourceFiles/inline_bots/bot_attach_web_view.cpp b/Telegram/SourceFiles/inline_bots/bot_attach_web_view.cpp index 29842290b..2a0a539db 100644 --- a/Telegram/SourceFiles/inline_bots/bot_attach_web_view.cpp +++ b/Telegram/SourceFiles/inline_bots/bot_attach_web_view.cpp @@ -828,6 +828,19 @@ void AttachWebView::requestWithOptionalConfirm( void AttachWebView::request(const WebViewButton &button) { Expects(_context != nullptr && _bot != nullptr); + if (button.fromAttachMenu) { + const auto bot = ranges::find( + _attachBots, + not_null{ _bot }, + &AttachWebViewBot::user); + if (bot == end(_attachBots) || bot->inactive) { + requestAddToMenu(_bot, AddToMenuOpenAttach{ + .startCommand = button.startCommand, + }); + return; + } + } + _startCommand = button.startCommand; const auto &action = _context->action;