Add td_api::linkPreviewOptions.
This commit is contained in:
parent
77faddc76f
commit
d16fc8294c
@ -210,7 +210,7 @@ namespace TdExample
|
||||
TdApi.InlineKeyboardButton[] row = { new TdApi.InlineKeyboardButton("https://telegram.org?1", new TdApi.InlineKeyboardButtonTypeUrl()), new TdApi.InlineKeyboardButton("https://telegram.org?2", new TdApi.InlineKeyboardButtonTypeUrl()), new TdApi.InlineKeyboardButton("https://telegram.org?3", new TdApi.InlineKeyboardButtonTypeUrl()) };
|
||||
TdApi.ReplyMarkup replyMarkup = new TdApi.ReplyMarkupInlineKeyboard(new TdApi.InlineKeyboardButton[][] { row, row, row });
|
||||
|
||||
TdApi.InputMessageContent content = new TdApi.InputMessageText(new TdApi.FormattedText(message, null), false, true);
|
||||
TdApi.InputMessageContent content = new TdApi.InputMessageText(new TdApi.FormattedText(message, null), null, true);
|
||||
_client.Send(new TdApi.SendMessage(chatId, 0, null, null, replyMarkup, content), _defaultHandler);
|
||||
}
|
||||
|
||||
|
@ -293,7 +293,7 @@ public final class Example {
|
||||
TdApi.InlineKeyboardButton[] row = {new TdApi.InlineKeyboardButton("https://telegram.org?1", new TdApi.InlineKeyboardButtonTypeUrl()), new TdApi.InlineKeyboardButton("https://telegram.org?2", new TdApi.InlineKeyboardButtonTypeUrl()), new TdApi.InlineKeyboardButton("https://telegram.org?3", new TdApi.InlineKeyboardButtonTypeUrl())};
|
||||
TdApi.ReplyMarkup replyMarkup = new TdApi.ReplyMarkupInlineKeyboard(new TdApi.InlineKeyboardButton[][]{row, row, row});
|
||||
|
||||
TdApi.InputMessageContent content = new TdApi.InputMessageText(new TdApi.FormattedText(message, null), false, true);
|
||||
TdApi.InputMessageContent content = new TdApi.InputMessageText(new TdApi.FormattedText(message, null), null, true);
|
||||
client.send(new TdApi.SendMessage(chatId, 0, null, null, replyMarkup, content), defaultHandler);
|
||||
}
|
||||
|
||||
|
@ -236,7 +236,7 @@ EOT
|
||||
* auto message_text = td::td_api::make_object<td::td_api::formattedText>("Hello, world!!!",
|
||||
* td::td_api::array<td::td_api::object_ptr<td::td_api::textEntity>>());
|
||||
* auto send_message_request = td::td_api::make_object<td::td_api::sendMessage>(chat_id, 0, nullptr, nullptr, nullptr,
|
||||
* td::td_api::make_object<td::td_api::inputMessageText>(std::move(message_text), false, true));
|
||||
* td::td_api::make_object<td::td_api::inputMessageText>(std::move(message_text), nullptr, true));
|
||||
* \\endcode
|
||||
*
|
||||
* \\tparam Type Type of an object to construct.
|
||||
|
@ -2092,8 +2092,8 @@ webPageInstantView page_blocks:vector<PageBlock> view_count:int32 version:int32
|
||||
//@duration Duration of the content, in seconds
|
||||
//@author Author of the content
|
||||
//@has_large_media True, if the preview has large media and its appearance can be changed
|
||||
//@force_small_media True, if shown media preview should be small
|
||||
//@force_large_media True, if shown media preview should be large
|
||||
//@force_small_media True, if shown media preview must be small
|
||||
//@force_large_media True, if shown media preview must be large
|
||||
//@animation Preview of the content as an animation, if available; may be null
|
||||
//@audio Preview of the content as an audio file, if available; may be null
|
||||
//@document Preview of the content as a document, if available; may be null
|
||||
@ -2963,14 +2963,21 @@ messageSendOptions disable_notification:Bool from_background:Bool protect_conten
|
||||
//@new_caption New message caption; pass null to copy message without caption. Ignored if replace_caption is false
|
||||
messageCopyOptions send_copy:Bool replace_caption:Bool new_caption:formattedText = MessageCopyOptions;
|
||||
|
||||
//@description Options to be used for generation of a link preview
|
||||
//@is_disabled True, if link preview must be disabled
|
||||
//@url URL to use for link preview; ignored in secret chats. If empty, then the first URL found in the message text will be used
|
||||
//@force_small_media True, if shown media preview must be small; ignored in secret chats
|
||||
//@force_large_media True, if shown media preview must be large; ignored in secret chats
|
||||
linkPreviewOptions is_disabled:Bool url:string force_small_media:Bool force_large_media:Bool = LinkPreviewOptions;
|
||||
|
||||
|
||||
//@class InputMessageContent @description The content of a message to send
|
||||
|
||||
//@description A text message
|
||||
//@text Formatted text to be sent; 1-getOption("message_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, CustomEmoji, Code, Pre, PreCode, TextUrl and MentionName entities are allowed to be specified manually
|
||||
//@disable_web_page_preview True, if rich web page previews for URLs in the message text must be disabled
|
||||
//@link_preview_options Options to be used for generation of a link preview; pass null to use default link preview options
|
||||
//@clear_draft True, if a chat message draft must be deleted
|
||||
inputMessageText text:formattedText disable_web_page_preview:Bool clear_draft:Bool = InputMessageContent;
|
||||
inputMessageText text:formattedText link_preview_options:linkPreviewOptions clear_draft:Bool = InputMessageContent;
|
||||
|
||||
//@description An animation message (GIF-style).
|
||||
//@animation Animation file to be sent
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "td/telegram/Td.h"
|
||||
#include "td/telegram/telegram_api.h"
|
||||
#include "td/telegram/UpdatesManager.h"
|
||||
#include "td/telegram/WebPagesManager.h"
|
||||
|
||||
#include "td/utils/buffer.h"
|
||||
#include "td/utils/logging.h"
|
||||
@ -42,6 +43,7 @@ class SaveDraftMessageQuery final : public Td::ResultHandler {
|
||||
int32 flags = 0;
|
||||
ServerMessageId reply_to_message_id;
|
||||
vector<telegram_api::object_ptr<telegram_api::MessageEntity>> input_message_entities;
|
||||
telegram_api::object_ptr<telegram_api::InputMedia> media;
|
||||
if (draft_message != nullptr) {
|
||||
/*
|
||||
if (draft_message->reply_to_message_id_.is_valid() && draft_message->reply_to_message_id_.is_server()) {
|
||||
@ -57,12 +59,16 @@ class SaveDraftMessageQuery final : public Td::ResultHandler {
|
||||
if (!input_message_entities.empty()) {
|
||||
flags |= telegram_api::messages_saveDraft::ENTITIES_MASK;
|
||||
}
|
||||
media = draft_message->input_message_text_.get_input_media_web_page();
|
||||
if (media != nullptr) {
|
||||
flags |= telegram_api::messages_saveDraft::MEDIA_MASK;
|
||||
}
|
||||
}
|
||||
send_query(G()->net_query_creator().create(
|
||||
telegram_api::messages_saveDraft(
|
||||
flags, false /*ignored*/, false /*ignored*/, nullptr, std::move(input_peer),
|
||||
draft_message == nullptr ? string() : draft_message->input_message_text_.text.text,
|
||||
std::move(input_message_entities), nullptr),
|
||||
std::move(input_message_entities), std::move(media)),
|
||||
{{dialog_id}}));
|
||||
}
|
||||
|
||||
@ -164,8 +170,7 @@ td_api::object_ptr<td_api::draftMessage> DraftMessage::get_draft_message_object(
|
||||
get_input_message_text_object(input_message_text_));
|
||||
}
|
||||
|
||||
DraftMessage::DraftMessage(ContactsManager *contacts_manager,
|
||||
telegram_api::object_ptr<telegram_api::draftMessage> &&draft_message) {
|
||||
DraftMessage::DraftMessage(Td *td, telegram_api::object_ptr<telegram_api::draftMessage> &&draft_message) {
|
||||
CHECK(draft_message != nullptr);
|
||||
date_ = draft_message->date_;
|
||||
/*
|
||||
@ -179,7 +184,8 @@ DraftMessage::DraftMessage(ContactsManager *contacts_manager,
|
||||
}
|
||||
*/
|
||||
|
||||
auto entities = get_message_entities(contacts_manager, std::move(draft_message->entities_), "draftMessage");
|
||||
auto entities =
|
||||
get_message_entities(td->contacts_manager_.get(), std::move(draft_message->entities_), "draftMessage");
|
||||
auto status = fix_formatted_text(draft_message->message_, entities, true, true, true, true, true);
|
||||
if (status.is_error()) {
|
||||
LOG(ERROR) << "Receive error " << status << " while parsing draft " << draft_message->message_;
|
||||
@ -188,9 +194,22 @@ DraftMessage::DraftMessage(ContactsManager *contacts_manager,
|
||||
}
|
||||
entities = find_entities(draft_message->message_, false, true);
|
||||
}
|
||||
input_message_text_.text = FormattedText{std::move(draft_message->message_), std::move(entities)};
|
||||
input_message_text_.disable_web_page_preview = draft_message->no_webpage_;
|
||||
input_message_text_.clear_draft = false;
|
||||
string web_page_url;
|
||||
bool force_small_media = false;
|
||||
bool force_large_media = false;
|
||||
if (draft_message->media_ != nullptr) {
|
||||
if (draft_message->media_->get_id() != telegram_api::inputMediaWebPage::ID) {
|
||||
LOG(ERROR) << "Receive draft message with " << to_string(draft_message->media_);
|
||||
} else {
|
||||
auto media = telegram_api::move_object_as<telegram_api::inputMediaWebPage>(draft_message->media_);
|
||||
web_page_url = std::move(media->url_);
|
||||
force_small_media = media->force_small_media_;
|
||||
force_large_media = media->force_large_media_;
|
||||
}
|
||||
}
|
||||
input_message_text_ =
|
||||
InputMessageText(FormattedText{std::move(draft_message->message_), std::move(entities)}, std::move(web_page_url),
|
||||
draft_message->no_webpage_, force_small_media, force_large_media, false);
|
||||
}
|
||||
|
||||
Result<unique_ptr<DraftMessage>> DraftMessage::get_draft_message(
|
||||
@ -217,12 +236,12 @@ Result<unique_ptr<DraftMessage>> DraftMessage::get_draft_message(
|
||||
if (input_message_content->get_id() != td_api::inputMessageText::ID) {
|
||||
return Status::Error(400, "Input message content type must be InputMessageText");
|
||||
}
|
||||
TRY_RESULT(message_content,
|
||||
TRY_RESULT(input_message_text,
|
||||
process_input_message_text(td, dialog_id, std::move(input_message_content), false, true));
|
||||
result->input_message_text_ = std::move(message_content);
|
||||
result->input_message_text_ = std::move(input_message_text);
|
||||
}
|
||||
|
||||
if (!result->reply_to_message_id_.is_valid() && result->input_message_text_.text.text.empty()) {
|
||||
if (!result->reply_to_message_id_.is_valid() && result->input_message_text_.is_empty()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -255,7 +274,7 @@ td_api::object_ptr<td_api::draftMessage> get_draft_message_object(const unique_p
|
||||
return draft_message->get_draft_message_object();
|
||||
}
|
||||
|
||||
unique_ptr<DraftMessage> get_draft_message(ContactsManager *contacts_manager,
|
||||
unique_ptr<DraftMessage> get_draft_message(Td *td,
|
||||
telegram_api::object_ptr<telegram_api::DraftMessage> &&draft_message_ptr) {
|
||||
if (draft_message_ptr == nullptr) {
|
||||
return nullptr;
|
||||
@ -265,7 +284,7 @@ unique_ptr<DraftMessage> get_draft_message(ContactsManager *contacts_manager,
|
||||
case telegram_api::draftMessageEmpty::ID:
|
||||
return nullptr;
|
||||
case telegram_api::draftMessage::ID:
|
||||
return td::make_unique<DraftMessage>(contacts_manager,
|
||||
return td::make_unique<DraftMessage>(td,
|
||||
telegram_api::move_object_as<telegram_api::draftMessage>(draft_message_ptr));
|
||||
default:
|
||||
UNREACHABLE();
|
||||
|
@ -31,7 +31,7 @@ class DraftMessage {
|
||||
|
||||
public:
|
||||
DraftMessage() = default;
|
||||
DraftMessage(ContactsManager *contacts_manager, telegram_api::object_ptr<telegram_api::draftMessage> &&draft_message);
|
||||
DraftMessage(Td *td, telegram_api::object_ptr<telegram_api::draftMessage> &&draft_message);
|
||||
|
||||
int32 get_date() const {
|
||||
return date_;
|
||||
@ -60,7 +60,7 @@ void add_draft_message_dependencies(Dependencies &dependencies, const unique_ptr
|
||||
|
||||
td_api::object_ptr<td_api::draftMessage> get_draft_message_object(const unique_ptr<DraftMessage> &draft_message);
|
||||
|
||||
unique_ptr<DraftMessage> get_draft_message(ContactsManager *contacts_manager,
|
||||
unique_ptr<DraftMessage> get_draft_message(Td *td,
|
||||
telegram_api::object_ptr<telegram_api::DraftMessage> &&draft_message_ptr);
|
||||
|
||||
void save_draft_message(Td *td, DialogId dialog_id, const unique_ptr<DraftMessage> &draft_message,
|
||||
|
@ -28,7 +28,7 @@ ForumTopic::ForumTopic(Td *td, tl_object_ptr<telegram_api::ForumTopic> &&forum_t
|
||||
is_pinned_ = forum_topic->pinned_;
|
||||
notification_settings_ =
|
||||
get_dialog_notification_settings(std::move(forum_topic->notify_settings_), current_notification_settings);
|
||||
draft_message_ = get_draft_message(td->contacts_manager_.get(), std::move(forum_topic->draft_));
|
||||
draft_message_ = get_draft_message(td, std::move(forum_topic->draft_));
|
||||
|
||||
if (is_short_) {
|
||||
return;
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "td/telegram/InputMessageText.h"
|
||||
|
||||
#include "td/telegram/MessageEntity.h"
|
||||
#include "td/telegram/misc.h"
|
||||
|
||||
#include "td/utils/common.h"
|
||||
|
||||
@ -29,15 +30,54 @@ Result<InputMessageText> process_input_message_text(const Td *td, DialogId dialo
|
||||
auto input_message_text = static_cast<td_api::inputMessageText *>(input_message_content.get());
|
||||
TRY_RESULT(text, get_formatted_text(td, dialog_id, std::move(input_message_text->text_), is_bot, for_draft, for_draft,
|
||||
for_draft));
|
||||
return InputMessageText{std::move(text), input_message_text->disable_web_page_preview_,
|
||||
input_message_text->clear_draft_};
|
||||
string web_page_url;
|
||||
bool disable_web_page_preview = false;
|
||||
bool force_small_media = false;
|
||||
bool force_large_media = false;
|
||||
if (input_message_text->link_preview_options_ != nullptr) {
|
||||
auto options = std::move(input_message_text->link_preview_options_);
|
||||
web_page_url = std::move(options->url_);
|
||||
disable_web_page_preview = options->is_disabled_;
|
||||
force_small_media = options->force_small_media_;
|
||||
force_large_media = options->force_large_media_;
|
||||
|
||||
if (!clean_input_string(web_page_url)) {
|
||||
return Status::Error(400, "Link preview URL must be encoded in UTF-8");
|
||||
}
|
||||
}
|
||||
return InputMessageText{std::move(text), std::move(web_page_url), disable_web_page_preview,
|
||||
force_small_media, force_large_media, input_message_text->clear_draft_};
|
||||
}
|
||||
|
||||
telegram_api::object_ptr<telegram_api::InputMedia> InputMessageText::get_input_media_web_page() const {
|
||||
if (web_page_url.empty() && !force_small_media && !force_large_media) {
|
||||
return nullptr;
|
||||
}
|
||||
int32 flags = 0;
|
||||
if (force_small_media) {
|
||||
flags |= telegram_api::inputMediaWebPage::FORCE_SMALL_MEDIA_MASK;
|
||||
}
|
||||
if (force_large_media) {
|
||||
flags |= telegram_api::inputMediaWebPage::FORCE_LARGE_MEDIA_MASK;
|
||||
}
|
||||
if (!text.text.empty()) {
|
||||
flags |= telegram_api::inputMediaWebPage::OPTIONAL_MASK;
|
||||
}
|
||||
return telegram_api::make_object<telegram_api::inputMediaWebPage>(flags, false /*ignored*/, false /*ignored*/,
|
||||
false /*ignored*/, web_page_url);
|
||||
}
|
||||
|
||||
// used only for draft
|
||||
td_api::object_ptr<td_api::inputMessageText> get_input_message_text_object(const InputMessageText &input_message_text) {
|
||||
td_api::object_ptr<td_api::linkPreviewOptions> options;
|
||||
if (!input_message_text.web_page_url.empty() || input_message_text.disable_web_page_preview ||
|
||||
input_message_text.force_small_media || input_message_text.force_large_media) {
|
||||
options = td_api::make_object<td_api::linkPreviewOptions>(
|
||||
input_message_text.disable_web_page_preview, input_message_text.web_page_url,
|
||||
input_message_text.force_small_media, input_message_text.force_large_media);
|
||||
}
|
||||
return td_api::make_object<td_api::inputMessageText>(get_formatted_text_object(input_message_text.text, false, -1),
|
||||
input_message_text.disable_web_page_preview,
|
||||
input_message_text.clear_draft);
|
||||
std::move(options), input_message_text.clear_draft);
|
||||
}
|
||||
|
||||
} // namespace td
|
||||
|
@ -19,12 +19,28 @@ class Td;
|
||||
class InputMessageText {
|
||||
public:
|
||||
FormattedText text;
|
||||
string web_page_url;
|
||||
bool disable_web_page_preview = false;
|
||||
bool force_small_media = false;
|
||||
bool force_large_media = false;
|
||||
bool clear_draft = false;
|
||||
|
||||
InputMessageText() = default;
|
||||
InputMessageText(FormattedText text, bool disable_web_page_preview, bool clear_draft)
|
||||
: text(std::move(text)), disable_web_page_preview(disable_web_page_preview), clear_draft(clear_draft) {
|
||||
InputMessageText(FormattedText text, string &&web_page_url, bool disable_web_page_preview, bool force_small_media,
|
||||
bool force_large_media, bool clear_draft)
|
||||
: text(std::move(text))
|
||||
, web_page_url(std::move(web_page_url))
|
||||
, disable_web_page_preview(disable_web_page_preview)
|
||||
, force_small_media(force_small_media)
|
||||
, force_large_media(force_large_media)
|
||||
, clear_draft(clear_draft) {
|
||||
}
|
||||
|
||||
bool is_empty() const {
|
||||
return text.text.empty() && web_page_url.empty();
|
||||
}
|
||||
|
||||
telegram_api::object_ptr<telegram_api::InputMedia> get_input_media_web_page() const;
|
||||
};
|
||||
|
||||
bool operator==(const InputMessageText &lhs, const InputMessageText &rhs);
|
||||
|
@ -16,20 +16,34 @@ namespace td {
|
||||
|
||||
template <class StorerT>
|
||||
void store(const InputMessageText &input_message_text, StorerT &storer) {
|
||||
bool has_web_page_url = !input_message_text.web_page_url.empty();
|
||||
BEGIN_STORE_FLAGS();
|
||||
STORE_FLAG(input_message_text.disable_web_page_preview);
|
||||
STORE_FLAG(input_message_text.clear_draft);
|
||||
STORE_FLAG(input_message_text.force_small_media);
|
||||
STORE_FLAG(input_message_text.force_large_media);
|
||||
STORE_FLAG(has_web_page_url);
|
||||
END_STORE_FLAGS();
|
||||
store(input_message_text.text, storer);
|
||||
if (has_web_page_url) {
|
||||
store(input_message_text.web_page_url, storer);
|
||||
}
|
||||
}
|
||||
|
||||
template <class ParserT>
|
||||
void parse(InputMessageText &input_message_text, ParserT &parser) {
|
||||
bool has_web_page_url;
|
||||
BEGIN_PARSE_FLAGS();
|
||||
PARSE_FLAG(input_message_text.disable_web_page_preview);
|
||||
PARSE_FLAG(input_message_text.clear_draft);
|
||||
PARSE_FLAG(input_message_text.force_small_media);
|
||||
PARSE_FLAG(input_message_text.force_large_media);
|
||||
PARSE_FLAG(has_web_page_url);
|
||||
END_PARSE_FLAGS();
|
||||
parse(input_message_text.text, parser);
|
||||
if (has_web_page_url) {
|
||||
parse(input_message_text.web_page_url, parser);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace td
|
||||
|
@ -2179,6 +2179,7 @@ static Result<InputMessageContent> create_input_message_content(
|
||||
mime_type = MimeType::from_extension(path_view.extension());
|
||||
}
|
||||
|
||||
string web_page_url;
|
||||
bool disable_web_page_preview = false;
|
||||
bool clear_draft = false;
|
||||
unique_ptr<MessageContent> content;
|
||||
@ -2191,6 +2192,7 @@ static Result<InputMessageContent> create_input_message_content(
|
||||
case td_api::inputMessageText::ID: {
|
||||
TRY_RESULT(input_message_text,
|
||||
process_input_message_text(td, dialog_id, std::move(input_message_content), is_bot));
|
||||
web_page_url = std::move(input_message_text.web_page_url);
|
||||
disable_web_page_preview = input_message_text.disable_web_page_preview;
|
||||
clear_draft = input_message_text.clear_draft;
|
||||
|
||||
@ -2206,7 +2208,9 @@ static Result<InputMessageContent> create_input_message_content(
|
||||
if (!is_bot && !disable_web_page_preview && can_add_web_page_previews) {
|
||||
web_page_id = td->web_pages_manager_->get_web_page_by_url(get_first_url(input_message_text.text));
|
||||
}
|
||||
content = make_unique<MessageText>(std::move(input_message_text.text), web_page_id, false, false, false);
|
||||
content = make_unique<MessageText>(std::move(input_message_text.text), web_page_id,
|
||||
input_message_text.force_small_media, input_message_text.force_large_media,
|
||||
!web_page_url.empty());
|
||||
break;
|
||||
}
|
||||
case td_api::inputMessageAnimation::ID: {
|
||||
|
@ -15659,8 +15659,8 @@ void MessagesManager::on_get_dialogs(FolderId folder_id, vector<tl_object_ptr<te
|
||||
reload_dialog_info_full(dialog_id, "on_get_dialogs init available_reactions");
|
||||
}
|
||||
|
||||
need_update_dialog_pos |= update_dialog_draft_message(
|
||||
d, get_draft_message(td_->contacts_manager_.get(), std::move(dialog->draft_)), true, false);
|
||||
need_update_dialog_pos |=
|
||||
update_dialog_draft_message(d, get_draft_message(td_, std::move(dialog->draft_)), true, false);
|
||||
if (is_new) {
|
||||
bool has_pts = (dialog->flags_ & DIALOG_FLAG_HAS_PTS) != 0;
|
||||
if (last_message_id.is_valid() && !td_->auth_manager_->is_bot()) {
|
||||
@ -26483,7 +26483,7 @@ void MessagesManager::edit_message_text(MessageFullId message_full_id,
|
||||
if (r_input_message_text.is_error()) {
|
||||
return promise.set_error(r_input_message_text.move_as_error());
|
||||
}
|
||||
InputMessageText input_message_text = r_input_message_text.move_as_ok();
|
||||
const InputMessageText input_message_text = r_input_message_text.move_as_ok();
|
||||
|
||||
auto r_new_reply_markup = get_reply_markup(std::move(reply_markup), td_->auth_manager_->is_bot(), true, false,
|
||||
has_message_sender_user_id(dialog_id, m));
|
||||
@ -26500,7 +26500,8 @@ void MessagesManager::edit_message_text(MessageFullId message_full_id,
|
||||
->send(flags, dialog_id, m->message_id, input_message_text.text.text,
|
||||
get_input_message_entities(td_->contacts_manager_.get(), input_message_text.text.entities,
|
||||
"edit_message_text"),
|
||||
nullptr, std::move(input_reply_markup), get_message_schedule_date(m));
|
||||
input_message_text.get_input_media_web_page(), std::move(input_reply_markup),
|
||||
get_message_schedule_date(m));
|
||||
}
|
||||
|
||||
void MessagesManager::edit_message_live_location(MessageFullId message_full_id,
|
||||
@ -26851,7 +26852,7 @@ void MessagesManager::edit_inline_message_text(const string &inline_message_id,
|
||||
if (r_input_message_text.is_error()) {
|
||||
return promise.set_error(r_input_message_text.move_as_error());
|
||||
}
|
||||
InputMessageText input_message_text = r_input_message_text.move_as_ok();
|
||||
const InputMessageText input_message_text = r_input_message_text.move_as_ok();
|
||||
|
||||
auto r_new_reply_markup = get_reply_markup(std::move(reply_markup), td_->auth_manager_->is_bot(), true, false, true);
|
||||
if (r_new_reply_markup.is_error()) {
|
||||
@ -26871,7 +26872,8 @@ void MessagesManager::edit_inline_message_text(const string &inline_message_id,
|
||||
->send(flags, std::move(input_bot_inline_message_id), input_message_text.text.text,
|
||||
get_input_message_entities(td_->contacts_manager_.get(), input_message_text.text.entities,
|
||||
"edit_inline_message_text"),
|
||||
nullptr, get_input_reply_markup(td_->contacts_manager_.get(), r_new_reply_markup.ok()));
|
||||
input_message_text.get_input_media_web_page(),
|
||||
get_input_reply_markup(td_->contacts_manager_.get(), r_new_reply_markup.ok()));
|
||||
}
|
||||
|
||||
void MessagesManager::edit_inline_message_live_location(const string &inline_message_id,
|
||||
@ -31267,7 +31269,7 @@ void MessagesManager::on_update_dialog_draft_message(DialogId dialog_id, Message
|
||||
LOG(ERROR) << "Receive update chat draft in invalid " << dialog_id;
|
||||
return;
|
||||
}
|
||||
auto draft = get_draft_message(td_->contacts_manager_.get(), std::move(draft_message));
|
||||
auto draft = get_draft_message(td_, std::move(draft_message));
|
||||
auto d = get_dialog_force(dialog_id, "on_update_dialog_draft_message");
|
||||
if (d == nullptr) {
|
||||
LOG(INFO) << "Ignore update chat draft in unknown " << dialog_id;
|
||||
@ -38588,8 +38590,7 @@ void MessagesManager::on_get_channel_difference(DialogId dialog_id, int32 reques
|
||||
set_dialog_is_marked_as_unread(d, is_marked_as_unread);
|
||||
}
|
||||
|
||||
update_dialog_draft_message(d, get_draft_message(td_->contacts_manager_.get(), std::move(dialog->draft_)), true,
|
||||
false);
|
||||
update_dialog_draft_message(d, get_draft_message(td_, std::move(dialog->draft_)), true, false);
|
||||
|
||||
on_get_channel_dialog(dialog_id, MessageId(ServerMessageId(dialog->top_message_)),
|
||||
MessageId(ServerMessageId(dialog->read_inbox_max_id_)), dialog->unread_count_,
|
||||
|
@ -4139,7 +4139,7 @@ class CliClient final : public Actor {
|
||||
td_api::make_object<td_api::textEntity>(0, 1, td_api::make_object<td_api::textEntityTypePre>()));
|
||||
draft_message = td_api::make_object<td_api::draftMessage>(
|
||||
as_message_id(reply_to_message_id), 0,
|
||||
td_api::make_object<td_api::inputMessageText>(as_formatted_text(message, std::move(entities)), true,
|
||||
td_api::make_object<td_api::inputMessageText>(as_formatted_text(message, std::move(entities)), nullptr,
|
||||
false));
|
||||
}
|
||||
send_request(
|
||||
@ -4440,7 +4440,8 @@ class CliClient final : public Actor {
|
||||
as_local_file("rgb.jpg"), nullptr, Auto(), 0, 0, as_caption(message),
|
||||
get_message_self_destruct_type(), has_spoiler_));
|
||||
} else {
|
||||
send_message(chat_id, td_api::make_object<td_api::inputMessageText>(as_formatted_text(message), false, true));
|
||||
send_message(chat_id,
|
||||
td_api::make_object<td_api::inputMessageText>(as_formatted_text(message), nullptr, true));
|
||||
}
|
||||
}
|
||||
} else if (op == "ssm") {
|
||||
@ -4479,7 +4480,7 @@ class CliClient final : public Actor {
|
||||
if (op == "smf") {
|
||||
message = string(5097, 'a');
|
||||
}
|
||||
send_message(chat_id, td_api::make_object<td_api::inputMessageText>(as_formatted_text(message), false, true),
|
||||
send_message(chat_id, td_api::make_object<td_api::inputMessageText>(as_formatted_text(message), nullptr, true),
|
||||
op == "sms", false, reply_to);
|
||||
} else if (op == "smce") {
|
||||
ChatId chat_id;
|
||||
@ -4492,7 +4493,7 @@ class CliClient final : public Actor {
|
||||
entities.push_back(td_api::make_object<td_api::textEntity>(
|
||||
6, 5, td_api::make_object<td_api::textEntityTypeCustomEmoji>(5368324170671202286)));
|
||||
auto text = as_formatted_text("👍 😉 🧑🚒", std::move(entities));
|
||||
send_message(chat_id, td_api::make_object<td_api::inputMessageText>(std::move(text), false, true));
|
||||
send_message(chat_id, td_api::make_object<td_api::inputMessageText>(std::move(text), nullptr, true));
|
||||
} else if (op == "alm" || op == "almr") {
|
||||
ChatId chat_id;
|
||||
string sender_id;
|
||||
@ -4504,7 +4505,7 @@ class CliClient final : public Actor {
|
||||
}
|
||||
send_request(td_api::make_object<td_api::addLocalMessage>(
|
||||
chat_id, as_message_sender(sender_id), reply_to, false,
|
||||
td_api::make_object<td_api::inputMessageText>(as_formatted_text(message), false, true)));
|
||||
td_api::make_object<td_api::inputMessageText>(as_formatted_text(message), nullptr, true)));
|
||||
} else if (op == "smap" || op == "smapr" || op == "smapp" || op == "smaprp") {
|
||||
ChatId chat_id;
|
||||
InputMessageReplyTo reply_to;
|
||||
@ -4562,7 +4563,7 @@ class CliClient final : public Actor {
|
||||
get_args(args, chat_id, message_id, message);
|
||||
send_request(td_api::make_object<td_api::editMessageText>(
|
||||
chat_id, message_id, nullptr,
|
||||
td_api::make_object<td_api::inputMessageText>(as_formatted_text(message), true, true)));
|
||||
td_api::make_object<td_api::inputMessageText>(as_formatted_text(message), nullptr, true)));
|
||||
} else if (op == "eman") {
|
||||
ChatId chat_id;
|
||||
MessageId message_id;
|
||||
|
@ -191,7 +191,7 @@ using tl_object_ptr = tl::unique_ptr<Type>;
|
||||
* auto message_text = td::make_tl_object<td::td_api::formattedText>("Hello, world!!!",
|
||||
* td::td_api::array<td::tl_object_ptr<td::td_api::textEntity>>());
|
||||
* auto send_message_request = td::make_tl_object<td::td_api::sendMessage>(chat_id, 0, nullptr, nullptr, nullptr,
|
||||
* td::make_tl_object<td::td_api::inputMessageText>(std::move(message_text), false, true));
|
||||
* td::make_tl_object<td::td_api::inputMessageText>(std::move(message_text), nullptr, true));
|
||||
* \endcode
|
||||
*
|
||||
* \tparam Type Type of the TL-object to construct.
|
||||
|
@ -314,7 +314,7 @@ class SetUsername final : public TestClinetTask {
|
||||
chat->id_, 0, nullptr, nullptr, nullptr,
|
||||
td::make_tl_object<td::td_api::inputMessageText>(
|
||||
td::make_tl_object<td::td_api::formattedText>(PSTRING() << tag_ << " INIT", td::Auto()),
|
||||
false, false)),
|
||||
nullptr, false)),
|
||||
[](auto res) {});
|
||||
});
|
||||
}
|
||||
@ -385,7 +385,7 @@ class TestA final : public TestClinetTask {
|
||||
chat->id_, 0, nullptr, nullptr, nullptr,
|
||||
td::make_tl_object<td::td_api::inputMessageText>(
|
||||
td::make_tl_object<td::td_api::formattedText>(PSTRING() << tag_ << " " << (1000 + i), td::Auto()),
|
||||
false, false)),
|
||||
nullptr, false)),
|
||||
[&](auto res) { this->stop(); });
|
||||
}
|
||||
});
|
||||
@ -434,7 +434,7 @@ class TestSecretChat final : public TestClinetTask {
|
||||
chat_id_, 0, nullptr, nullptr, nullptr,
|
||||
td::make_tl_object<td::td_api::inputMessageText>(
|
||||
td::make_tl_object<td::td_api::formattedText>(PSTRING() << tag_ << " " << (1000 + i), td::Auto()),
|
||||
false, false)),
|
||||
nullptr, false)),
|
||||
[](auto res) {});
|
||||
}
|
||||
}
|
||||
@ -615,7 +615,7 @@ class CheckTestC final : public TestClinetTask {
|
||||
chat_id_, 0, nullptr, nullptr, nullptr,
|
||||
td::make_tl_object<td::td_api::inputMessageText>(
|
||||
td::make_tl_object<td::td_api::formattedText>(PSTRING() << tag_ << " ONE_FILE", td::Auto()),
|
||||
false, false)),
|
||||
nullptr, false)),
|
||||
[](auto res) { check_td_error(res); });
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user