Add td_api::clearRecentReactions.
This commit is contained in:
parent
ece581b797
commit
f85b79d9bc
@ -5177,6 +5177,9 @@ getCustomEmojiReactionAnimations = Files;
|
|||||||
//@message_id Identifier of the message
|
//@message_id Identifier of the message
|
||||||
getMessageAvailableReactions chat_id:int53 message_id:int53 = AvailableReactions;
|
getMessageAvailableReactions chat_id:int53 message_id:int53 = AvailableReactions;
|
||||||
|
|
||||||
|
//@description Clears the list of recently used reactions
|
||||||
|
clearRecentReactions = Ok;
|
||||||
|
|
||||||
//@description Adds a reaction to a message. Use getMessageAvailableReactions to receive the list of available reactions for the message
|
//@description Adds a reaction to a message. Use getMessageAvailableReactions to receive the list of available reactions for the message
|
||||||
//@chat_id Identifier of the chat to which the message belongs
|
//@chat_id Identifier of the chat to which the message belongs
|
||||||
//@message_id Identifier of the message
|
//@message_id Identifier of the message
|
||||||
@ -5632,7 +5635,7 @@ getRecentEmojiStatuses = EmojiStatuses;
|
|||||||
//@description Returns default emoji statuses
|
//@description Returns default emoji statuses
|
||||||
getDefaultEmojiStatuses = EmojiStatuses;
|
getDefaultEmojiStatuses = EmojiStatuses;
|
||||||
|
|
||||||
//@description Clears recent emoji statuses
|
//@description Clears the list of recently used emoji statuses
|
||||||
clearRecentEmojiStatuses = Ok;
|
clearRecentEmojiStatuses = Ok;
|
||||||
|
|
||||||
|
|
||||||
|
@ -139,6 +139,36 @@ class GetTopReactionsQuery final : public Td::ResultHandler {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class ClearRecentReactionsQuery final : public Td::ResultHandler {
|
||||||
|
Promise<Unit> promise_;
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit ClearRecentReactionsQuery(Promise<Unit> &&promise) : promise_(std::move(promise)) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void send() {
|
||||||
|
send_query(G()->net_query_creator().create(telegram_api::messages_clearRecentReactions()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void on_result(BufferSlice packet) final {
|
||||||
|
auto result_ptr = fetch_result<telegram_api::messages_clearRecentReactions>(packet);
|
||||||
|
if (result_ptr.is_error()) {
|
||||||
|
return on_error(result_ptr.move_as_error());
|
||||||
|
}
|
||||||
|
|
||||||
|
td_->stickers_manager_->reload_recent_reactions();
|
||||||
|
promise_.set_value(Unit());
|
||||||
|
}
|
||||||
|
|
||||||
|
void on_error(Status status) final {
|
||||||
|
if (!G()->is_expected_error(status)) {
|
||||||
|
LOG(ERROR) << "Receive error for clear recent reactions: " << status;
|
||||||
|
}
|
||||||
|
td_->stickers_manager_->reload_recent_reactions();
|
||||||
|
promise_.set_error(std::move(status));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
class GetAllStickersQuery final : public Td::ResultHandler {
|
class GetAllStickersQuery final : public Td::ResultHandler {
|
||||||
StickerType sticker_type_;
|
StickerType sticker_type_;
|
||||||
|
|
||||||
@ -1543,6 +1573,19 @@ td_api::object_ptr<td_api::emojiReaction> StickersManager::get_emoji_reaction_ob
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void StickersManager::clear_recent_reactions(Promise<Unit> &&promise) {
|
||||||
|
load_recent_reactions();
|
||||||
|
|
||||||
|
if (recent_reactions_.reactions_.empty()) {
|
||||||
|
return promise.set_value(Unit());
|
||||||
|
}
|
||||||
|
|
||||||
|
recent_reactions_.hash_ = 0;
|
||||||
|
recent_reactions_.reactions_.clear();
|
||||||
|
|
||||||
|
td_->create_handler<ClearRecentReactionsQuery>(std::move(promise))->send();
|
||||||
|
}
|
||||||
|
|
||||||
void StickersManager::reload_reactions() {
|
void StickersManager::reload_reactions() {
|
||||||
if (G()->close_flag() || reactions_.are_being_reloaded_) {
|
if (G()->close_flag() || reactions_.are_being_reloaded_) {
|
||||||
return;
|
return;
|
||||||
|
@ -173,6 +173,8 @@ class StickersManager final : public Actor {
|
|||||||
|
|
||||||
td_api::object_ptr<td_api::emojiReaction> get_emoji_reaction_object(const string &emoji);
|
td_api::object_ptr<td_api::emojiReaction> get_emoji_reaction_object(const string &emoji);
|
||||||
|
|
||||||
|
void clear_recent_reactions(Promise<Unit> &&promise);
|
||||||
|
|
||||||
void reload_reactions();
|
void reload_reactions();
|
||||||
|
|
||||||
void reload_recent_reactions();
|
void reload_recent_reactions();
|
||||||
|
@ -5221,6 +5221,12 @@ void Td::on_request(uint64 id, const td_api::getMessageAvailableReactions &reque
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Td::on_request(uint64 id, const td_api::clearRecentReactions &request) {
|
||||||
|
CHECK_IS_USER();
|
||||||
|
CREATE_OK_REQUEST_PROMISE();
|
||||||
|
stickers_manager_->clear_recent_reactions(std::move(promise));
|
||||||
|
}
|
||||||
|
|
||||||
void Td::on_request(uint64 id, td_api::addMessageReaction &request) {
|
void Td::on_request(uint64 id, td_api::addMessageReaction &request) {
|
||||||
CHECK_IS_USER();
|
CHECK_IS_USER();
|
||||||
CREATE_OK_REQUEST_PROMISE();
|
CREATE_OK_REQUEST_PROMISE();
|
||||||
|
@ -662,6 +662,8 @@ class Td final : public Actor {
|
|||||||
|
|
||||||
void on_request(uint64 id, const td_api::getMessageAvailableReactions &request);
|
void on_request(uint64 id, const td_api::getMessageAvailableReactions &request);
|
||||||
|
|
||||||
|
void on_request(uint64 id, const td_api::clearRecentReactions &request);
|
||||||
|
|
||||||
void on_request(uint64 id, td_api::addMessageReaction &request);
|
void on_request(uint64 id, td_api::addMessageReaction &request);
|
||||||
|
|
||||||
void on_request(uint64 id, td_api::removeMessageReaction &request);
|
void on_request(uint64 id, td_api::removeMessageReaction &request);
|
||||||
|
@ -2247,6 +2247,8 @@ class CliClient final : public Actor {
|
|||||||
MessageId message_id;
|
MessageId message_id;
|
||||||
get_args(args, chat_id, message_id);
|
get_args(args, chat_id, message_id);
|
||||||
send_request(td_api::make_object<td_api::getMessageAvailableReactions>(chat_id, message_id));
|
send_request(td_api::make_object<td_api::getMessageAvailableReactions>(chat_id, message_id));
|
||||||
|
} else if (op == "crr") {
|
||||||
|
send_request(td_api::make_object<td_api::clearRecentReactions>());
|
||||||
} else if (op == "amr" || op == "react") {
|
} else if (op == "amr" || op == "react") {
|
||||||
ChatId chat_id;
|
ChatId chat_id;
|
||||||
MessageId message_id;
|
MessageId message_id;
|
||||||
|
Loading…
Reference in New Issue
Block a user