2018-09-28 22:57:34 +02:00
|
|
|
//
|
2022-12-31 22:28:08 +01:00
|
|
|
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023
|
2018-09-28 22:57:34 +02:00
|
|
|
//
|
|
|
|
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
|
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
|
|
//
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "td/telegram/DialogId.h"
|
|
|
|
#include "td/telegram/MessageEntity.h"
|
|
|
|
#include "td/telegram/td_api.h"
|
|
|
|
|
|
|
|
#include "td/utils/Status.h"
|
|
|
|
|
|
|
|
namespace td {
|
|
|
|
|
2023-10-17 11:31:01 +02:00
|
|
|
class Dependencies;
|
|
|
|
|
2022-07-22 17:11:55 +02:00
|
|
|
class Td;
|
2018-09-28 22:57:34 +02:00
|
|
|
|
|
|
|
class InputMessageText {
|
|
|
|
public:
|
|
|
|
FormattedText text;
|
2023-10-16 19:12:33 +02:00
|
|
|
string web_page_url;
|
2018-09-28 22:57:34 +02:00
|
|
|
bool disable_web_page_preview = false;
|
2023-10-16 19:12:33 +02:00
|
|
|
bool force_small_media = false;
|
|
|
|
bool force_large_media = false;
|
2023-10-21 23:50:19 +02:00
|
|
|
bool show_above_text = false;
|
2018-09-28 22:57:34 +02:00
|
|
|
bool clear_draft = false;
|
2023-10-16 19:12:33 +02:00
|
|
|
|
2018-09-28 22:57:34 +02:00
|
|
|
InputMessageText() = default;
|
2023-10-16 19:12:33 +02:00
|
|
|
InputMessageText(FormattedText text, string &&web_page_url, bool disable_web_page_preview, bool force_small_media,
|
2023-10-21 23:50:19 +02:00
|
|
|
bool force_large_media, bool show_above_text, bool clear_draft)
|
2023-10-16 19:12:33 +02:00
|
|
|
: 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)
|
2023-10-21 23:50:19 +02:00
|
|
|
, show_above_text(show_above_text)
|
2023-10-16 19:12:33 +02:00
|
|
|
, clear_draft(clear_draft) {
|
|
|
|
}
|
|
|
|
|
|
|
|
bool is_empty() const {
|
|
|
|
return text.text.empty() && web_page_url.empty();
|
2018-09-28 22:57:34 +02:00
|
|
|
}
|
2023-10-16 19:12:33 +02:00
|
|
|
|
2023-10-17 11:31:01 +02:00
|
|
|
void add_dependencies(Dependencies &dependencies) const;
|
|
|
|
|
2023-10-16 19:12:33 +02:00
|
|
|
telegram_api::object_ptr<telegram_api::InputMedia> get_input_media_web_page() const;
|
2023-10-16 19:56:28 +02:00
|
|
|
|
|
|
|
td_api::object_ptr<td_api::inputMessageText> get_input_message_text_object() const;
|
2018-09-28 22:57:34 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
bool operator==(const InputMessageText &lhs, const InputMessageText &rhs);
|
|
|
|
bool operator!=(const InputMessageText &lhs, const InputMessageText &rhs);
|
|
|
|
|
2022-07-22 17:11:55 +02:00
|
|
|
Result<InputMessageText> process_input_message_text(const Td *td, DialogId dialog_id,
|
2018-09-28 22:57:34 +02:00
|
|
|
tl_object_ptr<td_api::InputMessageContent> &&input_message_content,
|
|
|
|
bool is_bot, bool for_draft = false) TD_WARN_UNUSED_RESULT;
|
|
|
|
|
|
|
|
} // namespace td
|