Fix attach menu suggested bot launch.

This commit is contained in:
John Preston 2023-11-01 21:04:04 +04:00
parent 4955cdcdce
commit 3da44eb5dd
1 changed files with 13 additions and 0 deletions

View File

@ -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;