From 173fdf80563d616d32d46bc61013e4ddb2082b60 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 7 Mar 2022 11:08:52 +0400 Subject: [PATCH] Send GIFs search results without "via @bot". --- Telegram/SourceFiles/api/api_common.h | 1 + Telegram/SourceFiles/apiwrap.cpp | 5 ++++- Telegram/SourceFiles/chat_helpers/gifs_list_widget.cpp | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/api/api_common.h b/Telegram/SourceFiles/api/api_common.h index 6f5b15b35..6e2ab6e80 100644 --- a/Telegram/SourceFiles/api/api_common.h +++ b/Telegram/SourceFiles/api/api_common.h @@ -17,6 +17,7 @@ struct SendOptions { bool silent = false; bool handleSupportSwitch = false; bool removeWebPageId = false; + bool hideViaBot = false; }; enum class SendType { diff --git a/Telegram/SourceFiles/apiwrap.cpp b/Telegram/SourceFiles/apiwrap.cpp index 5f176bf99..1f579cc31 100644 --- a/Telegram/SourceFiles/apiwrap.cpp +++ b/Telegram/SourceFiles/apiwrap.cpp @@ -3591,6 +3591,9 @@ void ApiWrap::sendInlineResult( flags |= MessageFlag::IsOrWasScheduled; sendFlags |= MTPmessages_SendInlineBotResult::Flag::f_schedule_date; } + if (action.options.hideViaBot) { + sendFlags |= MTPmessages_SendInlineBotResult::Flag::f_hide_via; + } const auto sendAs = action.options.sendAs; const auto messageFromId = sendAs @@ -3612,7 +3615,7 @@ void ApiWrap::sendInlineResult( newId.msg, messageFromId, HistoryItem::NewMessageDate(action.options.scheduled), - bot ? peerToUser(bot->id) : 0, + (bot && !action.options.hideViaBot) ? peerToUser(bot->id) : 0, action.replyTo, messagePostAuthor); diff --git a/Telegram/SourceFiles/chat_helpers/gifs_list_widget.cpp b/Telegram/SourceFiles/chat_helpers/gifs_list_widget.cpp index 79d8cb4f4..ae171bbe1 100644 --- a/Telegram/SourceFiles/chat_helpers/gifs_list_widget.cpp +++ b/Telegram/SourceFiles/chat_helpers/gifs_list_widget.cpp @@ -486,6 +486,7 @@ void GifsListWidget::selectInlineResult( } } else if (const auto inlineResult = item->getResult()) { if (inlineResult->onChoose(item)) { + options.hideViaBot = true; _inlineResultChosen.fire({ .result = inlineResult, .bot = _searchBot,