diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index 272ba1c46..a36227092 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -1228,13 +1228,16 @@ messageReplyInfo reply_count:int32 recent_replier_ids:vector last //@recent_sender_ids Identifiers of at most 3 recent message senders, added the reaction; available in private, basic group and supergroup chats messageReaction type:ReactionType total_count:int32 is_chosen:Bool used_sender_id:MessageSender recent_sender_ids:vector = MessageReaction; +//@description Contains a list of reactions added to a message @reactions List of added reactions @are_tags True, if the reactions are tags and the message can be found by them +messageReactions reactions:vector are_tags:Bool = MessageReactions; + //@description Contains information about interactions with a message //@view_count Number of times the message was viewed //@forward_count Number of times the message was forwarded //@reply_info Information about direct or indirect replies to the message; may be null. Currently, available only in channels with a discussion supergroup and discussion supergroups for messages, which are not replies itself -//@reactions The list of reactions added to the message -messageInteractionInfo view_count:int32 forward_count:int32 reply_info:messageReplyInfo reactions:vector = MessageInteractionInfo; +//@reactions The list of reactions or tags added to the message; may be null +messageInteractionInfo view_count:int32 forward_count:int32 reply_info:messageReplyInfo reactions:messageReactions = MessageInteractionInfo; //@description Contains information about an unread reaction to a message //@type Type of the reaction diff --git a/td/telegram/MessageReaction.cpp b/td/telegram/MessageReaction.cpp index 0ee4292f8..66945b1d4 100644 --- a/td/telegram/MessageReaction.cpp +++ b/td/telegram/MessageReaction.cpp @@ -465,6 +465,7 @@ unique_ptr MessageReactions::get_message_reactions( auto result = make_unique(); result->can_get_added_reactions_ = reactions->can_see_list_; result->is_min_ = reactions->min_; + result->are_tags_ = reactions->reactions_as_tags_; DialogId my_dialog_id; for (auto &peer_reaction : reactions->recent_reactions_) { @@ -796,11 +797,12 @@ bool MessageReactions::are_consistent_with_list( } } -vector> MessageReactions::get_message_reactions_object( - Td *td, UserId my_user_id, UserId peer_user_id) const { - return transform(reactions_, [td, my_user_id, peer_user_id](const MessageReaction &reaction) { +td_api::object_ptr MessageReactions::get_message_reactions_object(Td *td, UserId my_user_id, + UserId peer_user_id) const { + auto reactions = transform(reactions_, [td, my_user_id, peer_user_id](const MessageReaction &reaction) { return reaction.get_message_reaction_object(td, my_user_id, peer_user_id); }); + return td_api::make_object(std::move(reactions), are_tags_); } void MessageReactions::add_min_channels(Td *td) const { @@ -835,7 +837,8 @@ bool MessageReactions::need_update_message_reactions(const MessageReactions *old // unread_reactions_ and chosen_reaction_order_ are updated independently; compare all other fields return old_reactions->reactions_ != new_reactions->reactions_ || old_reactions->is_min_ != new_reactions->is_min_ || old_reactions->can_get_added_reactions_ != new_reactions->can_get_added_reactions_ || - old_reactions->need_polling_ != new_reactions->need_polling_; + old_reactions->need_polling_ != new_reactions->need_polling_ || + old_reactions->are_tags_ != new_reactions->are_tags_; } bool MessageReactions::need_update_unread_reactions(const MessageReactions *old_reactions, @@ -847,10 +850,13 @@ bool MessageReactions::need_update_unread_reactions(const MessageReactions *old_ } StringBuilder &operator<<(StringBuilder &string_builder, const MessageReactions &reactions) { + if (reactions.are_tags_) { + return string_builder << "MessageTags{" << reactions.reactions_ << '}'; + } return string_builder << (reactions.is_min_ ? "Min" : "") << "MessageReactions{" << reactions.reactions_ << " with unread " << reactions.unread_reactions_ << ", reaction order " << reactions.chosen_reaction_order_ - << " and can_get_added_reactions = " << reactions.can_get_added_reactions_; + << " and can_get_added_reactions = " << reactions.can_get_added_reactions_ << '}'; } StringBuilder &operator<<(StringBuilder &string_builder, const unique_ptr &reactions) { diff --git a/td/telegram/MessageReaction.h b/td/telegram/MessageReaction.h index 7af1b6c1d..dac26162f 100644 --- a/td/telegram/MessageReaction.h +++ b/td/telegram/MessageReaction.h @@ -156,6 +156,7 @@ struct MessageReactions { bool is_min_ = false; bool need_polling_ = true; bool can_get_added_reactions_ = false; + bool are_tags_ = false; MessageReactions() = default; @@ -186,8 +187,8 @@ struct MessageReactions { FlatHashMap, ReactionTypeHash> reaction_types, int32 total_count) const; - vector> get_message_reactions_object(Td *td, UserId my_user_id, - UserId peer_user_id) const; + td_api::object_ptr get_message_reactions_object(Td *td, UserId my_user_id, + UserId peer_user_id) const; void add_min_channels(Td *td) const; diff --git a/td/telegram/MessageReaction.hpp b/td/telegram/MessageReaction.hpp index 2bfec8369..75941c11a 100644 --- a/td/telegram/MessageReaction.hpp +++ b/td/telegram/MessageReaction.hpp @@ -107,6 +107,7 @@ void MessageReactions::store(StorerT &storer) const { STORE_FLAG(has_unread_reactions); STORE_FLAG(has_reactions); STORE_FLAG(has_chosen_reaction_order); + STORE_FLAG(are_tags_); END_STORE_FLAGS(); if (has_reactions) { td::store(reactions_, storer); @@ -131,6 +132,7 @@ void MessageReactions::parse(ParserT &parser) { PARSE_FLAG(has_unread_reactions); PARSE_FLAG(has_reactions); PARSE_FLAG(has_chosen_reaction_order); + PARSE_FLAG(are_tags_); END_PARSE_FLAGS(); if (has_reactions) { td::parse(reactions_, parser); diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index 3a90741f1..50cec02a6 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -6466,7 +6466,7 @@ td_api::object_ptr MessagesManager::get_message_ CHECK(reply_info != nullptr); } - vector> reactions; + td_api::object_ptr reactions; if (has_reactions) { UserId my_user_id; UserId peer_user_id;