Check for reactionTypePaid in getMessageAddedReactions.

This commit is contained in:
levlam 2024-08-12 14:35:38 +03:00
parent 8347f4e5b2
commit 411c93d9f8
3 changed files with 15 additions and 12 deletions

View File

@ -9095,7 +9095,7 @@ setMessageReactions chat_id:int53 message_id:int53 reaction_types:vector<Reactio
//@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. Use message.interaction_info.reactions.can_get_added_reactions to check whether added reactions can be received for the message
//@reaction_type Type of the reactions to return; pass null to return all added reactions
//@reaction_type Type of the reactions to return; pass null to return all added reactions; reactionTypePaid isn't supported
//@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 reactions to be returned; must be positive and can't be greater than 100
getMessageAddedReactions chat_id:int53 message_id:int53 reaction_type:ReactionType offset:string limit:int32 = AddedReactions;

View File

@ -1113,6 +1113,9 @@ void get_message_added_reactions(Td *td, MessageFullId message_full_id, Reaction
if (!td->messages_manager_->have_message_force(message_full_id, "get_message_added_reactions")) {
return promise.set_error(Status::Error(400, "Message not found"));
}
if (reaction_type.is_paid_reaction()) {
return promise.set_error(Status::Error(400, "Can't use the method for paid reaction"));
}
auto message_id = message_full_id.get_message_id();
if (message_full_id.get_dialog_id().get_type() == DialogType::SecretChat || !message_id.is_valid() ||

View File

@ -2954,17 +2954,6 @@ class CliClient final : public Actor {
get_args(args, chat_id, message_id, reaction, is_big, update_recent_reactions);
send_request(td_api::make_object<td_api::addMessageReaction>(chat_id, message_id, as_reaction_type(reaction),
is_big, update_recent_reactions));
} else if (op == "apmr" || op == "apmra") {
ChatId chat_id;
MessageId message_id;
int64 star_count;
get_args(args, chat_id, message_id, star_count);
send_request(td_api::make_object<td_api::addPaidMessageReaction>(chat_id, message_id, star_count, op == "apmra"));
} else if (op == "rppmr") {
ChatId chat_id;
MessageId message_id;
get_args(args, chat_id, message_id);
send_request(td_api::make_object<td_api::removePendingPaidMessageReactions>(chat_id, message_id));
} else if (op == "rmr") {
ChatId chat_id;
MessageId message_id;
@ -2979,6 +2968,17 @@ class CliClient final : public Actor {
auto reaction_types = transform(autosplit_str(reactions), as_reaction_type);
send_request(td_api::make_object<td_api::setMessageReactions>(chat_id, message_id, std::move(reaction_types),
op == "reactbotbig"));
} else if (op == "apmr" || op == "apmra") {
ChatId chat_id;
MessageId message_id;
int64 star_count;
get_args(args, chat_id, message_id, star_count);
send_request(td_api::make_object<td_api::addPaidMessageReaction>(chat_id, message_id, star_count, op == "apmra"));
} else if (op == "rppmr") {
ChatId chat_id;
MessageId message_id;
get_args(args, chat_id, message_id);
send_request(td_api::make_object<td_api::removePendingPaidMessageReactions>(chat_id, message_id));
} else if (op == "gmars") {
ChatId chat_id;
MessageId message_id;