mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 06:07:06 +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,
|
||||
MsgId samePeerReplyTo) {
|
||||
if (samePeerBot) {
|
||||
if (_history) {
|
||||
const auto textWithTags = TextWithTags{
|
||||
'@' + samePeerBot->username() + ' ' + query,
|
||||
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;
|
||||
const auto to = controller()->currentDialogsEntryState();
|
||||
if (!to.key.owningHistory()) {
|
||||
return false;
|
||||
}
|
||||
controller()->switchInlineQuery(to, samePeerBot, query);
|
||||
return true;
|
||||
} else if (const auto bot = _peer ? _peer->asUser() : nullptr) {
|
||||
const auto to = bot->isBot()
|
||||
? bot->botInfo->inlineReturnTo
|
||||
|
@ -2192,7 +2180,7 @@ void HistoryWidget::showHistory(
|
|||
_showAtMsgHighlightPart = {};
|
||||
_showAtMsgHighlightPartOffsetHint = 0;
|
||||
|
||||
const auto wasDialogsEntryState = computeDialogsEntryState();
|
||||
const auto wasState = controller()->currentDialogsEntryState();
|
||||
const auto startBot = (showAtMsgId == ShowAndStartBotMsgId);
|
||||
if (startBot) {
|
||||
showAtMsgId = ShowAtTheEndMsgId;
|
||||
|
@ -2297,8 +2285,8 @@ void HistoryWidget::showHistory(
|
|||
if (const auto user = _peer->asUser()) {
|
||||
if (const auto &info = user->botInfo) {
|
||||
if (startBot) {
|
||||
if (wasDialogsEntryState.key) {
|
||||
info->inlineReturnTo = wasDialogsEntryState;
|
||||
if (wasState.key) {
|
||||
info->inlineReturnTo = wasState;
|
||||
}
|
||||
sendBotStartCommand();
|
||||
_history->clearLocalDraft({});
|
||||
|
@ -2533,8 +2521,8 @@ void HistoryWidget::showHistory(
|
|||
if (const auto user = _peer->asUser()) {
|
||||
if (const auto &info = user->botInfo) {
|
||||
if (startBot) {
|
||||
if (wasDialogsEntryState.key) {
|
||||
info->inlineReturnTo = wasDialogsEntryState;
|
||||
if (wasState.key) {
|
||||
info->inlineReturnTo = wasState;
|
||||
}
|
||||
sendBotStartCommand();
|
||||
}
|
||||
|
|
|
@ -1866,6 +1866,10 @@ bool SessionController::switchInlineQuery(
|
|||
int(textWithTags.text.size()),
|
||||
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>(
|
||||
textWithTags,
|
||||
to.currentReplyTo,
|
||||
|
|
Loading…
Add table
Reference in a new issue