diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index 852de5f9f..f6e3a38ef 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -774,16 +774,16 @@ messageReplyInfo reply_count:int32 recent_replier_ids:vector last //@description Contains information about a reaction to a message //@reaction Text representation of the reaction -//@choose_count Number of times the reaction was chosen -//@is_chosen True, if the reaction is chosen by the user -//@recent_chooser_ids Identifiers of at most 3 recent message senders, chosen the reaction; available in basic groups and supergroups -messageReaction reaction:string choose_count:int32 is_chosen:Bool recent_chooser_ids:vector = MessageReaction; +//@total_count Number of times the reaction was added +//@is_chosen True, if the reaction is chosen by the current user +//@recent_sender_ids Identifiers of at most 3 recent message senders, added the reaction; available in private chats, basic groups and supergroups +messageReaction reaction:string total_count:int32 is_chosen:Bool recent_sender_ids:vector = MessageReaction; //@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 chosen for the message +//@reactions The list of reactions added to the message messageInteractionInfo view_count:int32 forward_count:int32 reply_info:messageReplyInfo reactions:vector = MessageInteractionInfo; @@ -2387,13 +2387,13 @@ call id:int32 user_id:int53 is_outgoing:Bool is_video:Bool state:CallState = Cal phoneNumberAuthenticationSettings allow_flash_call:Bool allow_missed_call:Bool is_current_phone_number:Bool allow_sms_retriever_api:Bool authentication_tokens:vector = PhoneNumberAuthenticationSettings; -//@description Represents a chosen reaction for a message @reaction Text representation of the reaction @chooser_id Identifier of the chat member, chosen the reaction -chosenReaction reaction:string chooser_id:MessageSender = ChosenReaction; +//@description Represents a reaction applied to a message @reaction Text representation of the reaction @sender_id Identifier of the chat member, applied the reaction +addedReaction reaction:string sender_id:MessageSender = AddedReaction; -//@description Represents a list of chosen reactions for a message @total_count The total count of found reactions @reactions The list of chosen reactions @next_offset The offset for the next request. If empty, there are no more results -chosenReactions total_count:int32 reactions:vector next_offset:string = ChosenReactions; +//@description Represents a list of reactions added to a message @total_count The total count of found reactions @reactions The list of added reactions @next_offset The offset for the next request. If empty, there are no more results +addedReactions total_count:int32 reactions:vector next_offset:string = AddedReactions; -//@description Represents a list of reactions @reactions List of reactions +//@description Represents a list of available reactions @reactions List of reactions availableReactions reactions:vector = AvailableReactions; @@ -4601,7 +4601,7 @@ editInlineMessageReplyMarkup inline_message_id:string reply_markup:ReplyMarkup = editMessageSchedulingState chat_id:int53 message_id:int53 scheduling_state:MessageSchedulingState = Ok; -//@description Returns reactions, which can be set for a message. The list can change after updateReactions, updateChatAvailableReactions for the chat, or updateMessageInteractionInfo for the message +//@description Returns reactions, which can be added to a message. The list can change after updateReactions, updateChatAvailableReactions for the chat, or updateMessageInteractionInfo for the message //@chat_id Identifier of the chat to which the message belongs //@message_id Identifier of the message getMessageAvailableReactions chat_id:int53 message_id:int53 = AvailableReactions; @@ -4609,17 +4609,17 @@ getMessageAvailableReactions chat_id:int53 message_id:int53 = AvailableReactions //@description Changes chosen reaction for a message //@chat_id Identifier of the chat to which the message belongs //@message_id Identifier of the message -//@reaction Text representation of the chosen reaction. Can be an empty string or the currently chosen reaction to remove the reaction -//@is_big True, if the reaction is set with a big animation +//@reaction Text representation of the new chosen reaction. Can be an empty string or the currently chosen reaction to remove the reaction +//@is_big True, if the reaction is added with a big animation setMessageReaction chat_id:int53 message_id:int53 reaction:string is_big:Bool = Ok; -//@description Returns reactions chosen for a message, along with their source +//@description Returns reactions added for a message, along with their sender //@chat_id Identifier of the chat to which the message belongs //@message_id Identifier of the message -//@reaction If non-empty, only reactions with the specified text representation will be returned +//@reaction If non-empty, only added reactions with the specified text representation will be returned //@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results -//@limit The maximum number of chosen reactions to be returned; must be positive and can't be greater than 100 -getMessageChosenReactions chat_id:int53 message_id:int53 reaction:string offset:string limit:int32 = ChosenReactions; +//@limit The maximum number of reactions to be returned; must be positive and can't be greater than 100 +getMessageAddedReactions chat_id:int53 message_id:int53 reaction:string offset:string limit:int32 = AddedReactions; //@description Returns all entities (mentions, hashtags, cashtags, bot commands, bank card numbers, URLs, and email addresses) contained in the text. Can be called synchronously @text The text in which to look for entites diff --git a/td/telegram/MessageReaction.cpp b/td/telegram/MessageReaction.cpp index 280d6f9c5..f07ff8bce 100644 --- a/td/telegram/MessageReaction.cpp +++ b/td/telegram/MessageReaction.cpp @@ -116,14 +116,14 @@ class SendReactionQuery final : public Td::ResultHandler { }; class GetMessageReactionsListQuery final : public Td::ResultHandler { - Promise> promise_; + Promise> promise_; DialogId dialog_id_; MessageId message_id_; string reaction_; string offset_; public: - explicit GetMessageReactionsListQuery(Promise> &&promise) + explicit GetMessageReactionsListQuery(Promise> &&promise) : promise_(std::move(promise)) { } @@ -168,7 +168,7 @@ class GetMessageReactionsListQuery final : public Td::ResultHandler { total_count = static_cast(ptr->reactions_.size()); } - vector> reactions; + vector> reactions; for (auto &reaction : ptr->reactions_) { DialogId dialog_id(reaction->peer_id_); if (!dialog_id.is_valid() || (!reaction_.empty() && reaction_ != reaction->reaction_)) { @@ -178,13 +178,12 @@ class GetMessageReactionsListQuery final : public Td::ResultHandler { auto message_sender = get_min_message_sender_object(td_, dialog_id, "GetMessageReactionsListQuery"); if (message_sender != nullptr) { - reactions.push_back( - td_api::make_object(reaction->reaction_, std::move(message_sender))); + reactions.push_back(td_api::make_object(reaction->reaction_, std::move(message_sender))); } } promise_.set_value( - td_api::make_object(total_count, std::move(reactions), ptr->next_offset_)); + td_api::make_object(total_count, std::move(reactions), ptr->next_offset_)); } void on_error(Status status) final { @@ -314,18 +313,18 @@ unique_ptr MessageReactions::get_message_reactions( } MessageReaction *MessageReactions::get_reaction(const string &reaction) { - for (auto &chosen_reaction : reactions_) { - if (chosen_reaction.get_reaction() == reaction) { - return &chosen_reaction; + for (auto &added_reaction : reactions_) { + if (added_reaction.get_reaction() == reaction) { + return &added_reaction; } } return nullptr; } const MessageReaction *MessageReactions::get_reaction(const string &reaction) const { - for (auto &chosen_reaction : reactions_) { - if (chosen_reaction.get_reaction() == reaction) { - return &chosen_reaction; + for (auto &added_reaction : reactions_) { + if (added_reaction.get_reaction() == reaction) { + return &added_reaction; } } return nullptr; @@ -410,24 +409,24 @@ void set_message_reaction(Td *td, FullMessageId full_message_id, string reaction td->create_handler(std::move(promise))->send(full_message_id, std::move(reaction), is_big); } -void get_message_chosen_reactions(Td *td, FullMessageId full_message_id, string reaction, string offset, int32 limit, - Promise> &&promise) { - if (!td->messages_manager_->have_message_force(full_message_id, "get_message_chosen_reactions")) { +void get_message_added_reactions(Td *td, FullMessageId full_message_id, string reaction, string offset, int32 limit, + Promise> &&promise) { + if (!td->messages_manager_->have_message_force(full_message_id, "get_message_added_reactions")) { return promise.set_error(Status::Error(400, "Message not found")); } auto message_id = full_message_id.get_message_id(); if (full_message_id.get_dialog_id().get_type() == DialogType::SecretChat || !message_id.is_valid() || !message_id.is_server()) { - return promise.set_value(td_api::make_object(0, Auto(), string())); + return promise.set_value(td_api::make_object(0, Auto(), string())); } if (limit <= 0) { return promise.set_error(Status::Error(400, "Parameter limit must be positive")); } - static constexpr int32 MAX_GET_CHOSEN_REACTIONS = 100; // server side limit - if (limit > MAX_GET_CHOSEN_REACTIONS) { - limit = MAX_GET_CHOSEN_REACTIONS; + static constexpr int32 MAX_GET_ADDED_REACTIONS = 100; // server side limit + if (limit > MAX_GET_ADDED_REACTIONS) { + limit = MAX_GET_ADDED_REACTIONS; } td->create_handler(std::move(promise)) diff --git a/td/telegram/MessageReaction.h b/td/telegram/MessageReaction.h index dd45232a3..6d3dcd833 100644 --- a/td/telegram/MessageReaction.h +++ b/td/telegram/MessageReaction.h @@ -130,7 +130,7 @@ void reload_message_reactions(Td *td, DialogId dialog_id, vector &&me void set_message_reaction(Td *td, FullMessageId full_message_id, string reaction, bool is_big, Promise &&promise); -void get_message_chosen_reactions(Td *td, FullMessageId full_message_id, string reaction, string offset, int32 limit, - Promise> &&promise); +void get_message_added_reactions(Td *td, FullMessageId full_message_id, string reaction, string offset, int32 limit, + Promise> &&promise); } // namespace td diff --git a/td/telegram/Td.cpp b/td/telegram/Td.cpp index 3fc606a20..86ac0a3b2 100644 --- a/td/telegram/Td.cpp +++ b/td/telegram/Td.cpp @@ -5262,14 +5262,14 @@ void Td::on_request(uint64 id, td_api::setMessageReaction &request) { std::move(request.reaction_), request.is_big_, std::move(promise)); } -void Td::on_request(uint64 id, td_api::getMessageChosenReactions &request) { +void Td::on_request(uint64 id, td_api::getMessageAddedReactions &request) { CHECK_IS_USER(); CLEAN_INPUT_STRING(request.reaction_); CLEAN_INPUT_STRING(request.offset_); CREATE_REQUEST_PROMISE(); - get_message_chosen_reactions(this, {DialogId(request.chat_id_), MessageId(request.message_id_)}, - std::move(request.reaction_), std::move(request.offset_), request.limit_, - std::move(promise)); + get_message_added_reactions(this, {DialogId(request.chat_id_), MessageId(request.message_id_)}, + std::move(request.reaction_), std::move(request.offset_), request.limit_, + std::move(promise)); } void Td::on_request(uint64 id, td_api::getMessagePublicForwards &request) { diff --git a/td/telegram/Td.h b/td/telegram/Td.h index d2b9e4348..f95af0cfa 100644 --- a/td/telegram/Td.h +++ b/td/telegram/Td.h @@ -649,7 +649,7 @@ class Td final : public Actor { void on_request(uint64 id, td_api::setMessageReaction &request); - void on_request(uint64 id, td_api::getMessageChosenReactions &request); + void on_request(uint64 id, td_api::getMessageAddedReactions &request); void on_request(uint64 id, td_api::getMessagePublicForwards &request); diff --git a/td/telegram/cli.cpp b/td/telegram/cli.cpp index bdcb4f585..49994020d 100644 --- a/td/telegram/cli.cpp +++ b/td/telegram/cli.cpp @@ -2091,15 +2091,15 @@ class CliClient final : public Actor { bool is_big; get_args(args, chat_id, message_id, reaction, is_big); send_request(td_api::make_object(chat_id, message_id, reaction, is_big)); - } else if (op == "gmcr") { + } else if (op == "gmars") { ChatId chat_id; MessageId message_id; string reaction; string offset; string limit; get_args(args, chat_id, message_id, reaction, offset, limit); - send_request(td_api::make_object(chat_id, message_id, reaction, offset, - as_limit(limit))); + send_request(td_api::make_object(chat_id, message_id, reaction, offset, + as_limit(limit))); } else if (op == "gmpf") { ChatId chat_id; MessageId message_id;