Add td_api::getMessageEffect.
This commit is contained in:
parent
4b3e0ee8eb
commit
aab71e18cf
@ -8406,6 +8406,9 @@ setSavedMessagesTagLabel tag:ReactionType label:string = Ok;
|
||||
//@description Returns effects that can be added to a message sent in a private chat
|
||||
getMessageEffects = MessageEffects;
|
||||
|
||||
//@description Returns information about a message effect. Returns a 404 error if the effect is not found @effect_id Unique identifier of the effect
|
||||
getMessageEffect effect_id:int64 = MessageEffect;
|
||||
|
||||
|
||||
//@description Searches for a given quote in a text. Returns found quote start position in UTF-16 code units. Returns a 404 error if the quote is not found. Can be called synchronously
|
||||
//@text Text in which to search for the quote
|
||||
|
@ -1213,6 +1213,15 @@ td_api::object_ptr<td_api::messageEffect> ReactionManager::get_message_effect_ob
|
||||
effect.emoji_, effect.is_premium_, std::move(type));
|
||||
}
|
||||
|
||||
td_api::object_ptr<td_api::messageEffect> ReactionManager::get_message_effect_object(int64 effect_id) const {
|
||||
for (auto &effect : message_effects_.effects_) {
|
||||
if (effect.id_ == effect_id) {
|
||||
return get_message_effect_object(effect);
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
td_api::object_ptr<td_api::messageEffects> ReactionManager::get_message_effects_object() const {
|
||||
auto effects =
|
||||
transform(message_effects_.effects_, [&](const Effect &effect) { return get_message_effect_object(effect); });
|
||||
@ -1323,6 +1332,18 @@ void ReactionManager::on_get_message_effects(
|
||||
promise.set_value(get_message_effects_object());
|
||||
}
|
||||
|
||||
void ReactionManager::get_message_effect(int64 effect_id,
|
||||
Promise<td_api::object_ptr<td_api::messageEffect>> &&promise) {
|
||||
/*
|
||||
load_message_effects();
|
||||
if (effects_.effects_.empty() && effects_.are_being_reloaded_) {
|
||||
pending_get_message_effect_queries_.emplace_back(effect_id, std::move(promise));
|
||||
return;
|
||||
}
|
||||
*/
|
||||
promise.set_value(get_message_effect_object(effect_id));
|
||||
}
|
||||
|
||||
void ReactionManager::get_current_state(vector<td_api::object_ptr<td_api::Update>> &updates) const {
|
||||
if (td_->auth_manager_->is_bot()) {
|
||||
return;
|
||||
|
@ -83,6 +83,8 @@ class ReactionManager final : public Actor {
|
||||
|
||||
void get_message_effects(Promise<td_api::object_ptr<td_api::messageEffects>> &&promise);
|
||||
|
||||
void get_message_effect(int64 effect_id, Promise<td_api::object_ptr<td_api::messageEffect>> &&promise);
|
||||
|
||||
void get_current_state(vector<td_api::object_ptr<td_api::Update>> &updates) const;
|
||||
|
||||
private:
|
||||
@ -259,6 +261,8 @@ class ReactionManager final : public Actor {
|
||||
|
||||
td_api::object_ptr<td_api::messageEffect> get_message_effect_object(const Effect &effect) const;
|
||||
|
||||
td_api::object_ptr<td_api::messageEffect> get_message_effect_object(int64 effect_id) const;
|
||||
|
||||
td_api::object_ptr<td_api::messageEffects> get_message_effects_object() const;
|
||||
|
||||
void on_get_message_effects(Result<telegram_api::object_ptr<telegram_api::messages_AvailableEffects>> r_effects,
|
||||
|
@ -5503,12 +5503,18 @@ void Td::on_request(uint64 id, td_api::setSavedMessagesTagLabel &request) {
|
||||
std::move(promise));
|
||||
}
|
||||
|
||||
void Td::on_request(uint64 id, td_api::getMessageEffects &request) {
|
||||
void Td::on_request(uint64 id, const td_api::getMessageEffects &request) {
|
||||
CHECK_IS_USER();
|
||||
CREATE_REQUEST_PROMISE();
|
||||
reaction_manager_->get_message_effects(std::move(promise));
|
||||
}
|
||||
|
||||
void Td::on_request(uint64 id, const td_api::getMessageEffect &request) {
|
||||
CHECK_IS_USER();
|
||||
CREATE_REQUEST_PROMISE();
|
||||
reaction_manager_->get_message_effect(request.effect_id_, std::move(promise));
|
||||
}
|
||||
|
||||
void Td::on_request(uint64 id, td_api::getMessagePublicForwards &request) {
|
||||
CHECK_IS_USER();
|
||||
CLEAN_INPUT_STRING(request.offset_);
|
||||
|
@ -831,7 +831,9 @@ class Td final : public Actor {
|
||||
|
||||
void on_request(uint64 id, td_api::setSavedMessagesTagLabel &request);
|
||||
|
||||
void on_request(uint64 id, td_api::getMessageEffects &request);
|
||||
void on_request(uint64 id, const td_api::getMessageEffects &request);
|
||||
|
||||
void on_request(uint64 id, const td_api::getMessageEffect &request);
|
||||
|
||||
void on_request(uint64 id, td_api::getMessagePublicForwards &request);
|
||||
|
||||
|
@ -2958,7 +2958,7 @@ class CliClient final : public Actor {
|
||||
get_args(args, reaction, label);
|
||||
send_request(td_api::make_object<td_api::setSavedMessagesTagLabel>(as_reaction_type(reaction), label));
|
||||
} else if (op == "gme") {
|
||||
send_request(td_api::make_object<td_api::getMessageEffects>());
|
||||
send_request(td_api::make_object<td_api::getMessageEffect>(to_integer<int64>(args)));
|
||||
} else if (op == "gmpf") {
|
||||
ChatId chat_id;
|
||||
MessageId message_id;
|
||||
|
Loading…
Reference in New Issue
Block a user