Add QuickReplyManager::process_input_message_content.

This commit is contained in:
levlam 2024-04-15 23:12:22 +03:00
parent 5d984efdd3
commit d8a50a3ef0
2 changed files with 18 additions and 0 deletions

View File

@ -1533,6 +1533,20 @@ MessageId QuickReplyManager::get_input_reply_to_message_id(const Shortcut *s, Me
return MessageId();
}
Result<InputMessageContent> QuickReplyManager::process_input_message_content(
td_api::object_ptr<td_api::InputMessageContent> &&input_message_content) {
if (input_message_content == nullptr) {
return Status::Error(400, "Can't add quick reply without content");
}
if (input_message_content->get_id() == td_api::inputMessageForwarded::ID) {
return Status::Error(400, "Can't forward messages to quick replies");
}
if (input_message_content->get_id() == td_api::inputMessagePoll::ID) {
return Status::Error(400, "Can't add quick reply poll");
}
return get_input_message_content(DialogId(), std::move(input_message_content), td_, true);
}
vector<QuickReplyShortcutId> QuickReplyManager::get_shortcut_ids() const {
return transform(shortcuts_.shortcuts_, [](const unique_ptr<Shortcut> &shortcut) { return shortcut->shortcut_id_; });
}

View File

@ -30,6 +30,7 @@
namespace td {
class Dependencies;
struct InputMessageContent;
class MessageContent;
struct ReplyMarkup;
class Td;
@ -234,6 +235,9 @@ class QuickReplyManager final : public Actor {
static MessageId get_input_reply_to_message_id(const Shortcut *s, MessageId reply_to_message_id);
Result<InputMessageContent> process_input_message_content(
td_api::object_ptr<td_api::InputMessageContent> &&input_message_content);
bool is_shortcut_list_changed(const vector<unique_ptr<Shortcut>> &new_shortcuts) const;
vector<QuickReplyShortcutId> get_shortcut_ids() const;