[Improvement] Hide "via bot" if possible

This commit is contained in:
Eric Kotato 2022-09-11 04:34:16 +03:00
parent d8846380ad
commit 0a4eebfa98
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 hideVia = false;
}; };
enum class SendType { enum class SendType {

View file

@ -4146,6 +4146,9 @@ void ApiWrap::sendInlineResult(
if (silentPost) { if (silentPost) {
sendFlags |= MTPmessages_SendInlineBotResult::Flag::f_silent; sendFlags |= MTPmessages_SendInlineBotResult::Flag::f_silent;
} }
if (bot && action.options.hideVia) {
sendFlags |= MTPmessages_SendInlineBotResult::Flag::f_hide_via;
}
if (action.options.scheduled) { if (action.options.scheduled) {
flags |= MessageFlag::IsOrWasScheduled; flags |= MessageFlag::IsOrWasScheduled;
sendFlags |= MTPmessages_SendInlineBotResult::Flag::f_schedule_date; sendFlags |= MTPmessages_SendInlineBotResult::Flag::f_schedule_date;
@ -4171,7 +4174,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.hideVia ? peerToUser(bot->id) : 0,
action.replyTo, action.replyTo,
messagePostAuthor); messagePostAuthor);

View file

@ -442,6 +442,7 @@ void GifsListWidget::selectInlineResult(
} }
forceSend |= base::IsCtrlPressed(); forceSend |= base::IsCtrlPressed();
options.hideVia = true;
if (const auto photo = item->getPhoto()) { if (const auto photo = item->getPhoto()) {
using Data::PhotoSize; using Data::PhotoSize;
const auto media = photo->activeMediaView(); const auto media = photo->activeMediaView();