From c98a3825a55d131bf1099e7cffd7ed24d988f27e Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 18 Nov 2020 14:49:42 +0300 Subject: [PATCH] Fix sending bot commands from autocomplete. --- Telegram/SourceFiles/history/history_widget.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index 9d9878ead..342199b28 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -3430,7 +3430,8 @@ void HistoryWidget::sendBotCommand( bool lastKeyboardUsed = (_keyboard->forMsgId() == FullMsgId(_channel, _history->lastKeyboardId)) && (_keyboard->forMsgId() == FullMsgId(_channel, replyTo)); - const auto toSend = replyTo + // 'bot' may be nullptr in case of sending from FieldAutocomplete. + const auto toSend = (replyTo || !bot) ? cmd : HistoryView::WrapBotCommandInChat(_peer, cmd, bot);