Add updateDefaultReactionType.

This commit is contained in:
levlam 2022-08-22 15:23:17 +03:00
parent 2a2787b7ed
commit c2a62dbc09
4 changed files with 21 additions and 1 deletions

View File

@ -4476,6 +4476,9 @@ updateWebAppMessageSent web_app_launch_id:int64 = Update;
//@description The list of supported reactions has changed @reactions The new list of supported reactions //@description The list of supported reactions has changed @reactions The new list of supported reactions
updateReactions reactions:vector<reaction> = Update; updateReactions reactions:vector<reaction> = Update;
//@description The type of default reaction has changed @reaction_type The new type of the default reaction
updateDefaultReactionType reaction_type:ReactionType = Update;
//@description The list of supported dice emojis has changed @emojis The new list of supported dice emojis //@description The list of supported dice emojis has changed @emojis The new list of supported dice emojis
updateDiceEmojis emojis:vector<string> = Update; updateDiceEmojis emojis:vector<string> = Update;
@ -5137,7 +5140,7 @@ 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 //@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; 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 //@description Changes type of default reaction for the current user @reaction_type New type of the default reaction
setDefaultReactionType reaction_type:ReactionType = Ok; setDefaultReactionType reaction_type:ReactionType = Ok;

View File

@ -693,4 +693,14 @@ void send_set_default_reaction_query(Td *td) {
td->create_handler<SetDefaultReactionQuery>()->send(td->option_manager_->get_option_string("default_reaction")); td->create_handler<SetDefaultReactionQuery>()->send(td->option_manager_->get_option_string("default_reaction"));
} }
void send_update_default_reaction_type() {
auto default_reaction = G()->get_option_string("default_reaction");
if (default_reaction.empty()) {
LOG(ERROR) << "Have no default reaction";
return;
}
send_closure(G()->td(), &Td::send_update,
td_api::make_object<td_api::updateDefaultReactionType>(get_reaction_type_object(default_reaction)));
}
} // namespace td } // namespace td

View File

@ -186,4 +186,6 @@ void set_default_reaction(Td *td, string reaction, Promise<Unit> &&promise);
void send_set_default_reaction_query(Td *td); void send_set_default_reaction_query(Td *td);
void send_update_default_reaction_type();
} // namespace td } // namespace td

View File

@ -65,6 +65,8 @@ OptionManager::OptionManager(Td *td)
vector<SuggestedAction> added_actions{SuggestedAction{SuggestedAction::Type::SetPassword, DialogId(), days}}; vector<SuggestedAction> added_actions{SuggestedAction{SuggestedAction::Type::SetPassword, DialogId(), days}};
send_closure(G()->td(), &Td::send_update, get_update_suggested_actions_object(added_actions, {})); send_closure(G()->td(), &Td::send_update, get_update_suggested_actions_object(added_actions, {}));
} }
} else if (name == "default_reaction") {
send_update_default_reaction_type();
} }
} }
@ -317,6 +319,9 @@ void OptionManager::on_option_updated(Slice name) {
} }
break; break;
case 'd': case 'd':
if (name == "default_reaction") {
send_update_default_reaction_type();
}
if (name == "dice_emojis") { if (name == "dice_emojis") {
send_closure(td_->stickers_manager_actor_, &StickersManager::on_update_dice_emojis); send_closure(td_->stickers_manager_actor_, &StickersManager::on_update_dice_emojis);
} }