Support sending big reactions.

This commit is contained in:
levlam 2022-01-26 16:41:41 +03:00
parent 1901eafe8a
commit ba5c326ba8
7 changed files with 19 additions and 11 deletions

View File

@ -4610,7 +4610,8 @@ getMessageAvailableReactions chat_id:int53 message_id:int53 = AvailableReactions
//@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
setMessageReaction chat_id:int53 message_id:int53 reaction:string = Ok;
//@is_big True, if the reaction is set 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
//@chat_id Identifier of the chat to which the message belongs

View File

@ -29,7 +29,7 @@ class SendReactionQuery final : public Td::ResultHandler {
explicit SendReactionQuery(Promise<Unit> &&promise) : promise_(std::move(promise)) {
}
void send(FullMessageId full_message_id, string reaction) {
void send(FullMessageId full_message_id, string reaction, bool is_big) {
dialog_id_ = full_message_id.get_dialog_id();
message_id_ = full_message_id.get_message_id();
@ -41,6 +41,10 @@ class SendReactionQuery final : public Td::ResultHandler {
int32 flags = 0;
if (!reaction.empty()) {
flags |= telegram_api::messages_sendReaction::REACTION_MASK;
if (is_big) {
flags |= telegram_api::messages_sendReaction::BIG_MASK;
}
}
send_query(G()->net_query_creator().create(telegram_api::messages_sendReaction(
@ -332,8 +336,9 @@ bool MessageReactions::need_update_message_reactions(const MessageReactions *old
old_reactions->need_polling_ != new_reactions->need_polling_;
}
void set_message_reaction(Td *td, FullMessageId full_message_id, string reaction, Promise<Unit> &&promise) {
td->create_handler<SendReactionQuery>(std::move(promise))->send(full_message_id, std::move(reaction));
void set_message_reaction(Td *td, FullMessageId full_message_id, string reaction, bool is_big,
Promise<Unit> &&promise) {
td->create_handler<SendReactionQuery>(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,

View File

@ -123,7 +123,7 @@ struct MessageReactions {
void parse(ParserT &parser);
};
void set_message_reaction(Td *td, FullMessageId full_message_id, string reaction, Promise<Unit> &&promise);
void set_message_reaction(Td *td, FullMessageId full_message_id, string reaction, bool is_big, Promise<Unit> &&promise);
void get_message_chosen_reactions(Td *td, FullMessageId full_message_id, string reaction, string offset, int32 limit,
Promise<td_api::object_ptr<td_api::chosenReactions>> &&promise);

View File

@ -23797,7 +23797,8 @@ Result<vector<string>> MessagesManager::get_message_available_reactions(FullMess
return result;
}
void MessagesManager::set_message_reaction(FullMessageId full_message_id, string reaction, Promise<Unit> &&promise) {
void MessagesManager::set_message_reaction(FullMessageId full_message_id, string reaction, bool is_big,
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) {
@ -23866,7 +23867,7 @@ void MessagesManager::set_message_reaction(FullMessageId full_message_id, string
send_update_message_interaction_info(dialog_id, m);
on_message_changed(d, m, true, "set_message_reaction");
::td::set_message_reaction(td_, full_message_id, std::move(reaction), std::move(promise));
::td::set_message_reaction(td_, full_message_id, std::move(reaction), is_big, std::move(promise));
}
void MessagesManager::get_message_public_forwards(FullMessageId full_message_id, string offset, int32 limit,

View File

@ -782,7 +782,7 @@ class MessagesManager final : public Actor {
Result<vector<string>> get_message_available_reactions(FullMessageId full_message_id);
void set_message_reaction(FullMessageId full_message_id, string reaction, Promise<Unit> &&promise);
void set_message_reaction(FullMessageId full_message_id, string reaction, bool is_big, 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);

View File

@ -5259,7 +5259,7 @@ void Td::on_request(uint64 id, td_api::setMessageReaction &request) {
CLEAN_INPUT_STRING(request.reaction_);
CREATE_OK_REQUEST_PROMISE();
messages_manager_->set_message_reaction({DialogId(request.chat_id_), MessageId(request.message_id_)},
std::move(request.reaction_), std::move(promise));
std::move(request.reaction_), request.is_big_, std::move(promise));
}
void Td::on_request(uint64 id, td_api::getMessageChosenReactions &request) {

View File

@ -2088,8 +2088,9 @@ class CliClient final : public Actor {
ChatId chat_id;
MessageId message_id;
string reaction;
get_args(args, chat_id, message_id, reaction);
send_request(td_api::make_object<td_api::setMessageReaction>(chat_id, message_id, 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, reaction, is_big));
} else if (op == "gmcr") {
ChatId chat_id;
MessageId message_id;