Add setMessageReaction.update_recent_reactions.
This commit is contained in:
parent
51ea826b6c
commit
4fdac24cc5
@ -5142,7 +5142,8 @@ getMessageAvailableReactions chat_id:int53 message_id:int53 = AvailableReactions
|
||||
//@message_id Identifier of the message
|
||||
//@reaction_type Type of the new chosen reaction; pass null or the currently chosen non-big reaction to remove the reaction
|
||||
//@is_big Pass true if the reaction is added with a big animation
|
||||
setMessageReaction chat_id:int53 message_id:int53 reaction_type:ReactionType is_big:Bool = Ok;
|
||||
//@update_recent_reactions Pass true if the reaction needs to be added to recent reactions
|
||||
setMessageReaction chat_id:int53 message_id:int53 reaction_type:ReactionType is_big:Bool update_recent_reactions:Bool = Ok;
|
||||
|
||||
//@description Returns reactions added for a message, along with their sender
|
||||
//@chat_id Identifier of the chat to which the message belongs
|
||||
|
@ -169,7 +169,7 @@ class SendReactionQuery final : public Td::ResultHandler {
|
||||
explicit SendReactionQuery(Promise<Unit> &&promise) : promise_(std::move(promise)) {
|
||||
}
|
||||
|
||||
void send(FullMessageId full_message_id, string reaction, bool is_big) {
|
||||
void send(FullMessageId full_message_id, string reaction, bool is_big, bool add_to_recent) {
|
||||
dialog_id_ = full_message_id.get_dialog_id();
|
||||
|
||||
auto input_peer = td_->messages_manager_->get_input_peer(dialog_id_, AccessRights::Read);
|
||||
@ -184,6 +184,10 @@ class SendReactionQuery final : public Td::ResultHandler {
|
||||
if (is_big) {
|
||||
flags |= telegram_api::messages_sendReaction::BIG_MASK;
|
||||
}
|
||||
|
||||
if (add_to_recent) {
|
||||
flags |= telegram_api::messages_sendReaction::ADD_TO_RECENT_MASK;
|
||||
}
|
||||
}
|
||||
|
||||
vector<telegram_api::object_ptr<telegram_api::Reaction>> reactions;
|
||||
@ -689,9 +693,10 @@ void reload_message_reactions(Td *td, DialogId dialog_id, vector<MessageId> &&me
|
||||
td->create_handler<GetMessagesReactionsQuery>()->send(dialog_id, std::move(message_ids));
|
||||
}
|
||||
|
||||
void set_message_reaction(Td *td, FullMessageId full_message_id, string reaction, bool is_big,
|
||||
void set_message_reaction(Td *td, FullMessageId full_message_id, string reaction, bool is_big, bool add_to_recent,
|
||||
Promise<Unit> &&promise) {
|
||||
td->create_handler<SendReactionQuery>(std::move(promise))->send(full_message_id, std::move(reaction), is_big);
|
||||
td->create_handler<SendReactionQuery>(std::move(promise))
|
||||
->send(full_message_id, std::move(reaction), is_big, add_to_recent);
|
||||
}
|
||||
|
||||
void get_message_added_reactions(Td *td, FullMessageId full_message_id, string reaction, string offset, int32 limit,
|
||||
|
@ -183,7 +183,8 @@ string get_message_reaction_string(const td_api::object_ptr<td_api::ReactionType
|
||||
|
||||
void reload_message_reactions(Td *td, DialogId dialog_id, vector<MessageId> &&message_ids);
|
||||
|
||||
void set_message_reaction(Td *td, FullMessageId full_message_id, string reaction, bool is_big, Promise<Unit> &&promise);
|
||||
void set_message_reaction(Td *td, FullMessageId full_message_id, string reaction, bool is_big, bool add_to_recent,
|
||||
Promise<Unit> &&promise);
|
||||
|
||||
void get_message_added_reactions(Td *td, FullMessageId full_message_id, string reaction, string offset, int32 limit,
|
||||
Promise<td_api::object_ptr<td_api::addedReactions>> &&promise);
|
||||
|
@ -24515,7 +24515,7 @@ vector<AvailableReaction> MessagesManager::get_message_available_reactions(const
|
||||
}
|
||||
|
||||
void MessagesManager::set_message_reaction(FullMessageId full_message_id, string reaction, bool is_big,
|
||||
Promise<Unit> &&promise) {
|
||||
bool add_to_recent, Promise<Unit> &&promise) {
|
||||
auto dialog_id = full_message_id.get_dialog_id();
|
||||
Dialog *d = get_dialog_force(dialog_id, "set_message_reaction");
|
||||
if (d == nullptr) {
|
||||
@ -24591,7 +24591,8 @@ void MessagesManager::set_message_reaction(FullMessageId full_message_id, string
|
||||
send_closure(actor_id, &MessagesManager::on_set_message_reaction, full_message_id, std::move(result),
|
||||
std::move(promise));
|
||||
});
|
||||
::td::set_message_reaction(td_, full_message_id, std::move(reaction), is_big, std::move(query_promise));
|
||||
::td::set_message_reaction(td_, full_message_id, std::move(reaction), is_big, add_to_recent,
|
||||
std::move(query_promise));
|
||||
}
|
||||
|
||||
void MessagesManager::on_set_message_reaction(FullMessageId full_message_id, Result<Unit> result,
|
||||
|
@ -808,7 +808,8 @@ class MessagesManager final : public Actor {
|
||||
|
||||
Result<vector<AvailableReaction>> get_message_available_reactions(FullMessageId full_message_id);
|
||||
|
||||
void set_message_reaction(FullMessageId full_message_id, string reaction, bool is_big, Promise<Unit> &&promise);
|
||||
void set_message_reaction(FullMessageId full_message_id, string reaction, bool is_big, bool add_to_recent,
|
||||
Promise<Unit> &&promise);
|
||||
|
||||
void get_message_public_forwards(FullMessageId full_message_id, string offset, int32 limit,
|
||||
Promise<td_api::object_ptr<td_api::foundMessages>> &&promise);
|
||||
|
@ -5254,7 +5254,7 @@ void Td::on_request(uint64 id, td_api::setMessageReaction &request) {
|
||||
CREATE_OK_REQUEST_PROMISE();
|
||||
messages_manager_->set_message_reaction({DialogId(request.chat_id_), MessageId(request.message_id_)},
|
||||
get_message_reaction_string(request.reaction_type_), request.is_big_,
|
||||
std::move(promise));
|
||||
request.update_recent_reactions_, std::move(promise));
|
||||
}
|
||||
|
||||
void Td::on_request(uint64 id, td_api::getMessageAddedReactions &request) {
|
||||
|
@ -2225,14 +2225,14 @@ class CliClient final : public Actor {
|
||||
MessageId message_id;
|
||||
get_args(args, chat_id, message_id);
|
||||
send_request(td_api::make_object<td_api::getMessageAvailableReactions>(chat_id, message_id));
|
||||
} else if (op == "react") {
|
||||
} else if (op == "react" || op == "reactr") {
|
||||
ChatId chat_id;
|
||||
MessageId message_id;
|
||||
string reaction;
|
||||
bool is_big;
|
||||
get_args(args, chat_id, message_id, reaction, is_big);
|
||||
send_request(
|
||||
td_api::make_object<td_api::setMessageReaction>(chat_id, message_id, as_reaction_type(reaction), is_big));
|
||||
send_request(td_api::make_object<td_api::setMessageReaction>(chat_id, message_id, as_reaction_type(reaction),
|
||||
is_big, op == "reactr"));
|
||||
} else if (op == "gmars") {
|
||||
ChatId chat_id;
|
||||
MessageId message_id;
|
||||
|
Loading…
Reference in New Issue
Block a user