Remove process_input_caption in favor of get_formatted_text.
This commit is contained in:
parent
8b61255387
commit
f0a89c3dbe
@ -353,7 +353,8 @@ Result<tl_object_ptr<telegram_api::InputBotInlineMessage>> InlineQueriesManager:
|
||||
|
||||
auto constructor_id = input_message_content->get_id();
|
||||
if (constructor_id == td_api::inputMessageText::ID) {
|
||||
TRY_RESULT(input_message_text, process_input_message_text(td_, DialogId(), std::move(input_message_content), true));
|
||||
TRY_RESULT(input_message_text, process_input_message_text(td_, DialogId(td_->contacts_manager_->get_my_id()),
|
||||
std::move(input_message_content), true));
|
||||
int32 flags = 0;
|
||||
if (input_reply_markup != nullptr) {
|
||||
flags |= telegram_api::inputBotInlineMessageText::REPLY_MARKUP_MASK;
|
||||
@ -400,8 +401,8 @@ Result<tl_object_ptr<telegram_api::InputBotInlineMessage>> InlineQueriesManager:
|
||||
return venue.get_input_bot_inline_message_media_venue(std::move(input_reply_markup));
|
||||
}
|
||||
if (constructor_id == allowed_media_content_id) {
|
||||
TRY_RESULT(caption, process_input_caption(td_->contacts_manager_.get(), DialogId(),
|
||||
extract_input_caption(input_message_content), true));
|
||||
TRY_RESULT(caption, get_formatted_text(td_, DialogId(td_->contacts_manager_->get_my_id()),
|
||||
extract_input_caption(input_message_content), true, true, true, false));
|
||||
int32 flags = 0;
|
||||
if (input_reply_markup != nullptr) {
|
||||
flags |= telegram_api::inputBotInlineMessageMediaAuto::REPLY_MARKUP_MASK;
|
||||
|
@ -2017,7 +2017,7 @@ static Result<InputMessageContent> create_input_message_content(
|
||||
return Status::Error(400, "Wrong correct option ID specified");
|
||||
}
|
||||
auto r_explanation =
|
||||
process_input_caption(td->contacts_manager_.get(), dialog_id, std::move(type->explanation_), is_bot);
|
||||
get_formatted_text(td, dialog_id, std::move(type->explanation_), is_bot, true, true, false);
|
||||
if (r_explanation.is_error()) {
|
||||
return r_explanation.move_as_error();
|
||||
}
|
||||
@ -2158,8 +2158,8 @@ Result<InputMessageContent> get_input_message_content(
|
||||
}
|
||||
}
|
||||
|
||||
TRY_RESULT(caption, process_input_caption(td->contacts_manager_.get(), dialog_id,
|
||||
extract_input_caption(input_message_content), td->auth_manager_->is_bot()));
|
||||
TRY_RESULT(caption, get_formatted_text(td, dialog_id, extract_input_caption(input_message_content),
|
||||
td->auth_manager_->is_bot(), true, false, false));
|
||||
return create_input_message_content(dialog_id, std::move(input_message_content), td, std::move(caption), file_id,
|
||||
std::move(thumbnail), std::move(sticker_file_ids), is_premium);
|
||||
}
|
||||
|
@ -4292,17 +4292,6 @@ td_api::object_ptr<td_api::formattedText> extract_input_caption(
|
||||
}
|
||||
}
|
||||
|
||||
Result<FormattedText> process_input_caption(const ContactsManager *contacts_manager, DialogId dialog_id,
|
||||
tl_object_ptr<td_api::formattedText> &&caption, bool is_bot) {
|
||||
if (caption == nullptr) {
|
||||
return FormattedText();
|
||||
}
|
||||
TRY_RESULT(entities, get_message_entities(contacts_manager, std::move(caption->entities_)));
|
||||
TRY_STATUS(fix_formatted_text(caption->text_, entities, true, false,
|
||||
need_always_skip_bot_commands(contacts_manager, dialog_id, is_bot), is_bot, false));
|
||||
return FormattedText{std::move(caption->text_), std::move(entities)};
|
||||
}
|
||||
|
||||
Result<FormattedText> get_formatted_text(const Td *td, DialogId dialog_id,
|
||||
td_api::object_ptr<td_api::formattedText> &&text, bool is_bot,
|
||||
bool allow_empty, bool skip_media_timestamps, bool for_draft) {
|
||||
|
@ -212,9 +212,6 @@ FormattedText get_message_text(const ContactsManager *contacts_manager, string m
|
||||
td_api::object_ptr<td_api::formattedText> extract_input_caption(
|
||||
tl_object_ptr<td_api::InputMessageContent> &input_message_content);
|
||||
|
||||
Result<FormattedText> process_input_caption(const ContactsManager *contacts_manager, DialogId dialog_id,
|
||||
tl_object_ptr<td_api::formattedText> &&caption, bool is_bot);
|
||||
|
||||
Result<FormattedText> get_formatted_text(const Td *td, DialogId dialog_id,
|
||||
td_api::object_ptr<td_api::formattedText> &&text, bool is_bot,
|
||||
bool allow_empty, bool skip_media_timestamps, bool for_draft);
|
||||
|
@ -25523,9 +25523,8 @@ Result<MessageCopyOptions> MessagesManager::process_message_copy_options(
|
||||
result.send_copy = true;
|
||||
result.replace_caption = options->replace_caption_;
|
||||
if (result.replace_caption) {
|
||||
TRY_RESULT_ASSIGN(result.new_caption,
|
||||
process_input_caption(td_->contacts_manager_.get(), dialog_id, std::move(options->new_caption_),
|
||||
td_->auth_manager_->is_bot()));
|
||||
TRY_RESULT_ASSIGN(result.new_caption, get_formatted_text(td_, dialog_id, std::move(options->new_caption_),
|
||||
td_->auth_manager_->is_bot(), true, false, false));
|
||||
}
|
||||
return std::move(result);
|
||||
}
|
||||
@ -27275,8 +27274,8 @@ void MessagesManager::edit_message_caption(FullMessageId full_message_id,
|
||||
return promise.set_error(Status::Error(400, "There is no caption in the message to edit"));
|
||||
}
|
||||
|
||||
auto r_caption = process_input_caption(td_->contacts_manager_.get(), dialog_id, std::move(input_caption),
|
||||
td_->auth_manager_->is_bot());
|
||||
auto r_caption =
|
||||
get_formatted_text(td_, dialog_id, std::move(input_caption), td_->auth_manager_->is_bot(), true, false, false);
|
||||
if (r_caption.is_error()) {
|
||||
return promise.set_error(r_caption.move_as_error());
|
||||
}
|
||||
@ -27475,8 +27474,8 @@ void MessagesManager::edit_inline_message_caption(const string &inline_message_i
|
||||
return promise.set_error(Status::Error(400, "Method is available only for bots"));
|
||||
}
|
||||
|
||||
auto r_caption = process_input_caption(td_->contacts_manager_.get(), DialogId(), std::move(input_caption),
|
||||
td_->auth_manager_->is_bot());
|
||||
auto r_caption =
|
||||
get_formatted_text(td_, DialogId(), std::move(input_caption), td_->auth_manager_->is_bot(), true, false, false);
|
||||
if (r_caption.is_error()) {
|
||||
return promise.set_error(r_caption.move_as_error());
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user