Add td_api::setDefaultReactionType.
This commit is contained in:
parent
b14708f0f5
commit
2a2787b7ed
@ -5137,6 +5137,9 @@ setMessageReaction chat_id:int53 message_id:int53 reaction_type:ReactionType is_
|
||||
//@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;
|
||||
|
||||
//@description Changes default reaction type for the current user @reaction_type New type of the default reaction
|
||||
setDefaultReactionType reaction_type:ReactionType = Ok;
|
||||
|
||||
|
||||
//@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
|
||||
getTextEntities text:string = TextEntities;
|
||||
|
@ -1473,7 +1473,6 @@ void ConfigManager::process_app_config(tl_object_ptr<telegram_api::JSONValue> &c
|
||||
int64 chat_read_mark_expire_period = 0;
|
||||
int64 chat_read_mark_size_threshold = 0;
|
||||
double animated_emoji_zoom = 0.0;
|
||||
string default_reaction;
|
||||
int64 reactions_uniq_max = 0;
|
||||
vector<string> premium_features;
|
||||
auto &premium_limit_keys = get_premium_limit_keys();
|
||||
@ -1722,10 +1721,6 @@ void ConfigManager::process_app_config(tl_object_ptr<telegram_api::JSONValue> &c
|
||||
chat_read_mark_size_threshold = get_json_value_int(std::move(key_value->value_), key);
|
||||
continue;
|
||||
}
|
||||
if (key == "reactions_default") {
|
||||
default_reaction = get_json_value_string(std::move(key_value->value_), key);
|
||||
continue;
|
||||
}
|
||||
if (key == "reactions_uniq_max") {
|
||||
reactions_uniq_max = get_json_value_int(std::move(key_value->value_), key);
|
||||
continue;
|
||||
@ -1872,9 +1867,6 @@ void ConfigManager::process_app_config(tl_object_ptr<telegram_api::JSONValue> &c
|
||||
} else {
|
||||
options.set_option_integer("chat_read_mark_size_threshold", chat_read_mark_size_threshold);
|
||||
}
|
||||
if (!options.have_option("default_reaction_need_sync")) {
|
||||
options.set_option_string("default_reaction", default_reaction);
|
||||
}
|
||||
if (reactions_uniq_max <= 0 || reactions_uniq_max == 11) {
|
||||
options.set_option_empty("reactions_uniq_max");
|
||||
} else {
|
||||
|
@ -340,7 +340,7 @@ class SetDefaultReactionQuery final : public Td::ResultHandler {
|
||||
|
||||
LOG(INFO) << "Failed to set default reaction: " << status;
|
||||
td_->option_manager_->set_option_empty("default_reaction_needs_sync");
|
||||
send_closure(G()->config_manager(), &ConfigManager::reget_app_config, Promise<Unit>());
|
||||
send_closure(G()->config_manager(), &ConfigManager::request_config, false);
|
||||
}
|
||||
};
|
||||
|
||||
@ -683,6 +683,7 @@ void set_default_reaction(Td *td, string reaction, Promise<Unit> &&promise) {
|
||||
td->option_manager_->set_option_string("default_reaction", reaction);
|
||||
if (!td->option_manager_->get_option_boolean("default_reaction_needs_sync")) {
|
||||
td->option_manager_->set_option_boolean("default_reaction_needs_sync", true);
|
||||
send_set_default_reaction_query(td);
|
||||
}
|
||||
}
|
||||
promise.set_value(Unit());
|
||||
|
@ -51,6 +51,7 @@ void MessageReaction::parse(ParserT &parser) {
|
||||
td::parse(recent_chooser_min_channels_, parser);
|
||||
}
|
||||
CHECK(!is_empty());
|
||||
CHECK(!reaction_.empty());
|
||||
}
|
||||
|
||||
template <class StorerT>
|
||||
@ -69,6 +70,7 @@ void UnreadMessageReaction::parse(ParserT &parser) {
|
||||
END_PARSE_FLAGS();
|
||||
td::parse(reaction_, parser);
|
||||
td::parse(sender_dialog_id_, parser);
|
||||
CHECK(!reaction_.empty());
|
||||
}
|
||||
|
||||
template <class StorerT>
|
||||
|
@ -245,7 +245,7 @@ bool OptionManager::is_internal_option(Slice name) {
|
||||
name == "channels_read_media_period" || name == "chat_read_mark_expire_period" ||
|
||||
name == "chat_read_mark_size_threshold";
|
||||
case 'd':
|
||||
return name == "dc_txt_domain_name" || name == "default_reaction_needs_sync" ||
|
||||
return name == "dc_txt_domain_name" || name == "default_reaction" || name == "default_reaction_needs_sync" ||
|
||||
name == "dialog_filters_chats_limit_default" || name == "dialog_filters_chats_limit_premium" ||
|
||||
name == "dialog_filters_limit_default" || name == "dialog_filters_limit_premium" ||
|
||||
name == "dialogs_folder_pinned_limit_default" || name == "dialogs_folder_pinned_limit_premium" ||
|
||||
@ -317,9 +317,6 @@ void OptionManager::on_option_updated(Slice name) {
|
||||
}
|
||||
break;
|
||||
case 'd':
|
||||
if (name == "default_reaction_needs_sync" && get_option_boolean(name)) {
|
||||
send_set_default_reaction_query(td_);
|
||||
}
|
||||
if (name == "dice_emojis") {
|
||||
send_closure(td_->stickers_manager_actor_, &StickersManager::on_update_dice_emojis);
|
||||
}
|
||||
@ -621,14 +618,6 @@ void OptionManager::set_option(const string &name, td_api::object_ptr<td_api::Op
|
||||
}
|
||||
break;
|
||||
case 'd':
|
||||
if (!is_bot && name == "default_reaction") {
|
||||
string reaction;
|
||||
if (value_constructor_id == td_api::optionValueString::ID) {
|
||||
reaction = static_cast<td_api::optionValueString *>(value.get())->value_;
|
||||
}
|
||||
set_default_reaction(td_, std::move(reaction), std::move(promise));
|
||||
return;
|
||||
}
|
||||
if (!is_bot && set_boolean_option("disable_animated_emoji")) {
|
||||
return;
|
||||
}
|
||||
|
@ -5264,6 +5264,12 @@ void Td::on_request(uint64 id, td_api::getMessageAddedReactions &request) {
|
||||
request.limit_, std::move(promise));
|
||||
}
|
||||
|
||||
void Td::on_request(uint64 id, td_api::setDefaultReactionType &request) {
|
||||
CHECK_IS_USER();
|
||||
CREATE_OK_REQUEST_PROMISE();
|
||||
set_default_reaction(this, get_message_reaction_string(request.reaction_type_), std::move(promise));
|
||||
}
|
||||
|
||||
void Td::on_request(uint64 id, td_api::getMessagePublicForwards &request) {
|
||||
CHECK_IS_USER();
|
||||
CLEAN_INPUT_STRING(request.offset_);
|
||||
|
@ -656,6 +656,8 @@ class Td final : public Actor {
|
||||
|
||||
void on_request(uint64 id, td_api::getMessageAddedReactions &request);
|
||||
|
||||
void on_request(uint64 id, td_api::setDefaultReactionType &request);
|
||||
|
||||
void on_request(uint64 id, td_api::getMessagePublicForwards &request);
|
||||
|
||||
void on_request(uint64 id, const td_api::removeNotification &request);
|
||||
|
Loading…
x
Reference in New Issue
Block a user