mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-08-06 11:52:58 +00:00
Supported ephemeral media replies to bots.
This commit is contained in:
@@ -19,6 +19,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "data/data_file_origin.h"
|
||||
#include "data/data_histories.h"
|
||||
#include "data/data_changes.h"
|
||||
#include "data/components/ephemeral_messages.h"
|
||||
#include "data/stickers/data_stickers.h"
|
||||
#include "history/history.h"
|
||||
#include "history/history_item.h"
|
||||
@@ -183,6 +184,12 @@ void SendExistingMedia(
|
||||
flags |= MessageFlag::HasReplyInfo;
|
||||
sendFlags |= MTPmessages_SendMedia::Flag::f_reply_to;
|
||||
}
|
||||
if (!action.options.scheduled
|
||||
&& !action.options.shortcutId
|
||||
&& session->ephemeralMessages().isEphemeralBotReply(
|
||||
action.replyTo.messageId)) {
|
||||
flags |= MessageFlag::Ephemeral;
|
||||
}
|
||||
const auto silentPost = ShouldSendSilent(peer, action.options);
|
||||
InnerFillMessagePostFlags(action.options, peer, flags);
|
||||
if (silentPost) {
|
||||
@@ -236,7 +243,7 @@ void SendExistingMedia(
|
||||
|
||||
session->data().registerMessageRandomId(randomId, newId);
|
||||
|
||||
history->addNewLocalMessage({
|
||||
const auto item = history->addNewLocalMessage({
|
||||
.id = newId.msg,
|
||||
.flags = flags,
|
||||
.from = NewMessageFromId(action),
|
||||
@@ -251,6 +258,11 @@ void SendExistingMedia(
|
||||
.mediaSpoiler = action.options.mediaSpoiler,
|
||||
}, media, caption);
|
||||
|
||||
if (session->ephemeralMessages().sendMedia(item, inputMedia())) {
|
||||
api->finishForwarding(action);
|
||||
return;
|
||||
}
|
||||
|
||||
const auto performRequest = [=](const auto &repeatRequest) -> void {
|
||||
auto &histories = history->owner().histories();
|
||||
const auto session = &history->session();
|
||||
@@ -587,6 +599,14 @@ void SendConfirmedFile(
|
||||
if (file->to.replyTo) {
|
||||
flags |= MessageFlag::HasReplyInfo;
|
||||
}
|
||||
if (!isEditing
|
||||
&& !groupId
|
||||
&& !file->to.options.scheduled
|
||||
&& !file->to.options.shortcutId
|
||||
&& session->ephemeralMessages().isEphemeralBotReply(
|
||||
file->to.replyTo.messageId)) {
|
||||
flags |= MessageFlag::Ephemeral;
|
||||
}
|
||||
FillMessagePostFlags(action, peer, flags);
|
||||
if (file->to.options.scheduled) {
|
||||
flags |= MessageFlag::IsOrWasScheduled;
|
||||
|
||||
Reference in New Issue
Block a user