mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
parent
9532a2e3da
commit
e3d9216b10
2 changed files with 14 additions and 22 deletions
|
@ -1947,24 +1947,12 @@ bool HistoryWidget::notify_switchInlineBotButtonReceived(
|
||||||
UserData *samePeerBot,
|
UserData *samePeerBot,
|
||||||
MsgId samePeerReplyTo) {
|
MsgId samePeerReplyTo) {
|
||||||
if (samePeerBot) {
|
if (samePeerBot) {
|
||||||
if (_history) {
|
const auto to = controller()->currentDialogsEntryState();
|
||||||
const auto textWithTags = TextWithTags{
|
if (!to.key.owningHistory()) {
|
||||||
'@' + samePeerBot->username() + ' ' + query,
|
return false;
|
||||||
TextWithTags::Tags(),
|
|
||||||
};
|
|
||||||
MessageCursor cursor = {
|
|
||||||
int(textWithTags.text.size()),
|
|
||||||
int(textWithTags.text.size()),
|
|
||||||
Ui::kQFixedMax,
|
|
||||||
};
|
|
||||||
_history->setLocalDraft(std::make_unique<Data::Draft>(
|
|
||||||
textWithTags,
|
|
||||||
FullReplyTo(),
|
|
||||||
cursor,
|
|
||||||
Data::WebPageDraft()));
|
|
||||||
applyDraft();
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
controller()->switchInlineQuery(to, samePeerBot, query);
|
||||||
|
return true;
|
||||||
} else if (const auto bot = _peer ? _peer->asUser() : nullptr) {
|
} else if (const auto bot = _peer ? _peer->asUser() : nullptr) {
|
||||||
const auto to = bot->isBot()
|
const auto to = bot->isBot()
|
||||||
? bot->botInfo->inlineReturnTo
|
? bot->botInfo->inlineReturnTo
|
||||||
|
@ -2192,7 +2180,7 @@ void HistoryWidget::showHistory(
|
||||||
_showAtMsgHighlightPart = {};
|
_showAtMsgHighlightPart = {};
|
||||||
_showAtMsgHighlightPartOffsetHint = 0;
|
_showAtMsgHighlightPartOffsetHint = 0;
|
||||||
|
|
||||||
const auto wasDialogsEntryState = computeDialogsEntryState();
|
const auto wasState = controller()->currentDialogsEntryState();
|
||||||
const auto startBot = (showAtMsgId == ShowAndStartBotMsgId);
|
const auto startBot = (showAtMsgId == ShowAndStartBotMsgId);
|
||||||
if (startBot) {
|
if (startBot) {
|
||||||
showAtMsgId = ShowAtTheEndMsgId;
|
showAtMsgId = ShowAtTheEndMsgId;
|
||||||
|
@ -2297,8 +2285,8 @@ void HistoryWidget::showHistory(
|
||||||
if (const auto user = _peer->asUser()) {
|
if (const auto user = _peer->asUser()) {
|
||||||
if (const auto &info = user->botInfo) {
|
if (const auto &info = user->botInfo) {
|
||||||
if (startBot) {
|
if (startBot) {
|
||||||
if (wasDialogsEntryState.key) {
|
if (wasState.key) {
|
||||||
info->inlineReturnTo = wasDialogsEntryState;
|
info->inlineReturnTo = wasState;
|
||||||
}
|
}
|
||||||
sendBotStartCommand();
|
sendBotStartCommand();
|
||||||
_history->clearLocalDraft({});
|
_history->clearLocalDraft({});
|
||||||
|
@ -2533,8 +2521,8 @@ void HistoryWidget::showHistory(
|
||||||
if (const auto user = _peer->asUser()) {
|
if (const auto user = _peer->asUser()) {
|
||||||
if (const auto &info = user->botInfo) {
|
if (const auto &info = user->botInfo) {
|
||||||
if (startBot) {
|
if (startBot) {
|
||||||
if (wasDialogsEntryState.key) {
|
if (wasState.key) {
|
||||||
info->inlineReturnTo = wasDialogsEntryState;
|
info->inlineReturnTo = wasState;
|
||||||
}
|
}
|
||||||
sendBotStartCommand();
|
sendBotStartCommand();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1866,6 +1866,10 @@ bool SessionController::switchInlineQuery(
|
||||||
int(textWithTags.text.size()),
|
int(textWithTags.text.size()),
|
||||||
Ui::kQFixedMax
|
Ui::kQFixedMax
|
||||||
};
|
};
|
||||||
|
if (to.currentReplyTo.messageId.msg == to.currentReplyTo.topicRootId
|
||||||
|
&& to.currentReplyTo.quote.empty()) {
|
||||||
|
to.currentReplyTo.messageId.msg = MsgId();
|
||||||
|
}
|
||||||
auto draft = std::make_unique<Data::Draft>(
|
auto draft = std::make_unique<Data::Draft>(
|
||||||
textWithTags,
|
textWithTags,
|
||||||
to.currentReplyTo,
|
to.currentReplyTo,
|
||||||
|
|
Loading…
Add table
Reference in a new issue