Improve class names and documentation.
This commit is contained in:
parent
81a3544cc8
commit
6ebb83a194
@ -774,16 +774,16 @@ messageReplyInfo reply_count:int32 recent_replier_ids:vector<MessageSender> 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<MessageSender> = 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<MessageSender> = 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<messageReaction> = 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<string> = 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<chosenReaction> 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<addedReaction> 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<string> = 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
|
||||
|
@ -116,14 +116,14 @@ class SendReactionQuery final : public Td::ResultHandler {
|
||||
};
|
||||
|
||||
class GetMessageReactionsListQuery final : public Td::ResultHandler {
|
||||
Promise<td_api::object_ptr<td_api::chosenReactions>> promise_;
|
||||
Promise<td_api::object_ptr<td_api::addedReactions>> promise_;
|
||||
DialogId dialog_id_;
|
||||
MessageId message_id_;
|
||||
string reaction_;
|
||||
string offset_;
|
||||
|
||||
public:
|
||||
explicit GetMessageReactionsListQuery(Promise<td_api::object_ptr<td_api::chosenReactions>> &&promise)
|
||||
explicit GetMessageReactionsListQuery(Promise<td_api::object_ptr<td_api::addedReactions>> &&promise)
|
||||
: promise_(std::move(promise)) {
|
||||
}
|
||||
|
||||
@ -168,7 +168,7 @@ class GetMessageReactionsListQuery final : public Td::ResultHandler {
|
||||
total_count = static_cast<int32>(ptr->reactions_.size());
|
||||
}
|
||||
|
||||
vector<td_api::object_ptr<td_api::chosenReaction>> reactions;
|
||||
vector<td_api::object_ptr<td_api::addedReaction>> 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<td_api::chosenReaction>(reaction->reaction_, std::move(message_sender)));
|
||||
reactions.push_back(td_api::make_object<td_api::addedReaction>(reaction->reaction_, std::move(message_sender)));
|
||||
}
|
||||
}
|
||||
|
||||
promise_.set_value(
|
||||
td_api::make_object<td_api::chosenReactions>(total_count, std::move(reactions), ptr->next_offset_));
|
||||
td_api::make_object<td_api::addedReactions>(total_count, std::move(reactions), ptr->next_offset_));
|
||||
}
|
||||
|
||||
void on_error(Status status) final {
|
||||
@ -314,18 +313,18 @@ unique_ptr<MessageReactions> 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<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,
|
||||
Promise<td_api::object_ptr<td_api::chosenReactions>> &&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<td_api::object_ptr<td_api::addedReactions>> &&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<td_api::chosenReactions>(0, Auto(), string()));
|
||||
return promise.set_value(td_api::make_object<td_api::addedReactions>(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<GetMessageReactionsListQuery>(std::move(promise))
|
||||
|
@ -130,7 +130,7 @@ void reload_message_reactions(Td *td, DialogId dialog_id, vector<MessageId> &&me
|
||||
|
||||
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);
|
||||
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);
|
||||
|
||||
} // namespace td
|
||||
|
@ -5262,12 +5262,12 @@ 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_)},
|
||||
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));
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
|
@ -2091,14 +2091,14 @@ class CliClient final : public Actor {
|
||||
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") {
|
||||
} 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<td_api::getMessageChosenReactions>(chat_id, message_id, reaction, offset,
|
||||
send_request(td_api::make_object<td_api::getMessageAddedReactions>(chat_id, message_id, reaction, offset,
|
||||
as_limit(limit)));
|
||||
} else if (op == "gmpf") {
|
||||
ChatId chat_id;
|
||||
|
Loading…
Reference in New Issue
Block a user