Send GIFs search results without "via @bot".

This commit is contained in:
John Preston 2022-03-07 11:08:52 +04:00
parent eb72b1a925
commit 173fdf8056
3 changed files with 6 additions and 1 deletions

View File

@ -17,6 +17,7 @@ struct SendOptions {
bool silent = false; bool silent = false;
bool handleSupportSwitch = false; bool handleSupportSwitch = false;
bool removeWebPageId = false; bool removeWebPageId = false;
bool hideViaBot = false;
}; };
enum class SendType { enum class SendType {

View File

@ -3591,6 +3591,9 @@ void ApiWrap::sendInlineResult(
flags |= MessageFlag::IsOrWasScheduled; flags |= MessageFlag::IsOrWasScheduled;
sendFlags |= MTPmessages_SendInlineBotResult::Flag::f_schedule_date; 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 sendAs = action.options.sendAs;
const auto messageFromId = sendAs const auto messageFromId = sendAs
@ -3612,7 +3615,7 @@ void ApiWrap::sendInlineResult(
newId.msg, newId.msg,
messageFromId, messageFromId,
HistoryItem::NewMessageDate(action.options.scheduled), HistoryItem::NewMessageDate(action.options.scheduled),
bot ? peerToUser(bot->id) : 0, (bot && !action.options.hideViaBot) ? peerToUser(bot->id) : 0,
action.replyTo, action.replyTo,
messagePostAuthor); messagePostAuthor);

View File

@ -486,6 +486,7 @@ void GifsListWidget::selectInlineResult(
} }
} else if (const auto inlineResult = item->getResult()) { } else if (const auto inlineResult = item->getResult()) {
if (inlineResult->onChoose(item)) { if (inlineResult->onChoose(item)) {
options.hideViaBot = true;
_inlineResultChosen.fire({ _inlineResultChosen.fire({
.result = inlineResult, .result = inlineResult,
.bot = _searchBot, .bot = _searchBot,