From dcd8f3bfd0a5c2a60bd601f62c593efb59764d98 Mon Sep 17 00:00:00 2001 From: levlam Date: Wed, 15 Sep 2021 14:44:11 +0300 Subject: [PATCH] Add animated_emoji_click_sticker_set_name. --- td/telegram/SpecialStickerSetType.cpp | 12 ++++++++++- td/telegram/SpecialStickerSetType.h | 2 ++ td/telegram/StickersManager.cpp | 30 ++++++++++++++++++++------- 3 files changed, 36 insertions(+), 8 deletions(-) diff --git a/td/telegram/SpecialStickerSetType.cpp b/td/telegram/SpecialStickerSetType.cpp index b43e15501..42ffbc50a 100644 --- a/td/telegram/SpecialStickerSetType.cpp +++ b/td/telegram/SpecialStickerSetType.cpp @@ -16,6 +16,10 @@ string SpecialStickerSetType::animated_emoji() { return "animated_emoji_sticker_set"; } +string SpecialStickerSetType::animated_emoji_click() { + return "animated_emoji_click_sticker_set"; +} + string SpecialStickerSetType::animated_dice(const string &emoji) { CHECK(!emoji.empty()); return PSTRING() << "animated_dice_sticker_set#" << emoji; @@ -28,6 +32,9 @@ SpecialStickerSetType::SpecialStickerSetType( case telegram_api::inputStickerSetAnimatedEmoji::ID: type_ = animated_emoji(); break; + case telegram_api::inputStickerSetAnimatedEmojiAnimations::ID: + type_ = animated_emoji_click(); + break; case telegram_api::inputStickerSetDice::ID: type_ = animated_dice(static_cast(input_sticker_set.get())->emoticon_); break; @@ -45,9 +52,12 @@ string SpecialStickerSetType::get_dice_emoji() const { } telegram_api::object_ptr SpecialStickerSetType::get_input_sticker_set() const { - if (type_ == "animated_emoji_sticker_set") { + if (type_ == animated_emoji()) { return telegram_api::make_object(); } + if (type_ == animated_emoji_click()) { + return telegram_api::make_object(); + } auto emoji = get_dice_emoji(); if (!emoji.empty()) { return telegram_api::make_object(emoji); diff --git a/td/telegram/SpecialStickerSetType.h b/td/telegram/SpecialStickerSetType.h index 94cb9f6c7..5a25c0188 100644 --- a/td/telegram/SpecialStickerSetType.h +++ b/td/telegram/SpecialStickerSetType.h @@ -17,6 +17,8 @@ struct SpecialStickerSetType { static string animated_emoji(); + static string animated_emoji_click(); + static string animated_dice(const string &emoji); string get_dice_emoji() const; diff --git a/td/telegram/StickersManager.cpp b/td/telegram/StickersManager.cpp index a154b518b..8ba79f5a9 100644 --- a/td/telegram/StickersManager.cpp +++ b/td/telegram/StickersManager.cpp @@ -665,6 +665,7 @@ class GetStickerSetQuery final : public Td::ResultHandler { sticker_set_name_ = static_cast(input_sticker_set.get())->short_name_; } + // input_sticker_set = make_tl_object(); LOG(INFO) << "Load " << sticker_set_id << " from server: " << to_string(input_sticker_set); send_query(G()->net_query_creator().create(telegram_api::messages_getStickerSet(std::move(input_sticker_set)))); } @@ -1211,15 +1212,21 @@ void StickersManager::init() { { // add animated emoji sticker set - auto &animated_emoji_sticker_set = add_special_sticker_set(SpecialStickerSetType::animated_emoji()); + auto &sticker_set = add_special_sticker_set(SpecialStickerSetType::animated_emoji()); if (G()->is_test_dc()) { - init_special_sticker_set(animated_emoji_sticker_set, 1258816259751954, 4879754868529595811, "emojies"); + init_special_sticker_set(sticker_set, 1258816259751954, 4879754868529595811, "emojies"); } else { - init_special_sticker_set(animated_emoji_sticker_set, 1258816259751983, 5100237018658464041, "AnimatedEmojies"); + init_special_sticker_set(sticker_set, 1258816259751983, 5100237018658464041, "AnimatedEmojies"); } - load_special_sticker_set_info_from_binlog(animated_emoji_sticker_set); - G()->shared_config().set_option_string(PSLICE() << animated_emoji_sticker_set.type_.type_ << "_name", - animated_emoji_sticker_set.short_name_); + load_special_sticker_set_info_from_binlog(sticker_set); + G()->shared_config().set_option_string(PSLICE() << sticker_set.type_.type_ << "_name", sticker_set.short_name_); + } + if (!G()->is_test_dc()) { + // add animated emoji click sticker set + auto &sticker_set = add_special_sticker_set(SpecialStickerSetType::animated_emoji_click()); + init_special_sticker_set(sticker_set, 1258816259751996, 1, "EmojiAnimations"); + load_special_sticker_set_info_from_binlog(sticker_set); + G()->shared_config().set_option_string(PSLICE() << sticker_set.type_.type_ << "_name", sticker_set.short_name_); } dice_emojis_str_ = @@ -2025,6 +2032,7 @@ StickerSetId StickersManager::get_sticker_set_id(const tl_object_ptr(set_ptr.get())->short_name_, Auto()); case telegram_api::inputStickerSetAnimatedEmoji::ID: + case telegram_api::inputStickerSetAnimatedEmojiAnimations::ID: LOG(ERROR) << "Receive special sticker set " << to_string(set_ptr); return add_special_sticker_set(SpecialStickerSetType(set_ptr).type_).id_; case telegram_api::inputStickerSetDice::ID: @@ -2053,6 +2061,7 @@ StickerSetId StickersManager::add_sticker_set(tl_object_ptrshort_name_, Auto()); } case telegram_api::inputStickerSetAnimatedEmoji::ID: + case telegram_api::inputStickerSetAnimatedEmojiAnimations::ID: LOG(ERROR) << "Receive special sticker set " << to_string(set_ptr); return add_special_sticker_set(SpecialStickerSetType(set_ptr).type_).id_; case telegram_api::inputStickerSetDice::ID: @@ -2239,6 +2248,7 @@ StickerSetId StickersManager::on_get_input_sticker_set(FileId sticker_file_id, return StickerSetId(); } case telegram_api::inputStickerSetAnimatedEmoji::ID: + case telegram_api::inputStickerSetAnimatedEmojiAnimations::ID: return add_special_sticker_set(SpecialStickerSetType(set_ptr).type_).id_; case telegram_api::inputStickerSetDice::ID: return StickerSetId(); @@ -2790,8 +2800,11 @@ void StickersManager::on_get_special_sticker_set(const SpecialStickerSetType &ty CHECK(s->is_inited); CHECK(s->is_loaded); + LOG(INFO) << "Receive special sticker set " << type.type_ << ": " << sticker_set_id << ' ' << s->access_hash << ' ' + << s->short_name; auto &sticker_set = add_special_sticker_set(type.type_); - if (sticker_set_id == sticker_set.id_ && s->short_name == sticker_set.short_name_ && !s->short_name.empty()) { + if (sticker_set_id == sticker_set.id_ && s->access_hash == sticker_set.access_hash_ && + s->short_name == sticker_set.short_name_ && !s->short_name.empty()) { on_load_special_sticker_set(type, Status::OK()); return; } @@ -2805,6 +2818,8 @@ void StickersManager::on_get_special_sticker_set(const SpecialStickerSetType &ty << ' ' << sticker_set.short_name_); if (type.type_ == SpecialStickerSetType::animated_emoji()) { G()->shared_config().set_option_string(PSLICE() << type.type_ << "_name", sticker_set.short_name_); + } else if (type.type_ == SpecialStickerSetType::animated_emoji_click()) { + G()->shared_config().set_option_string(PSLICE() << type.type_ << "_name", sticker_set.short_name_); } else if (!type.get_dice_emoji().empty()) { sticker_set.is_being_loaded_ = true; } @@ -6677,6 +6692,7 @@ void StickersManager::after_get_difference() { get_favorite_stickers(Auto()); reload_special_sticker_set(add_special_sticker_set(SpecialStickerSetType::animated_emoji())); + reload_special_sticker_set(add_special_sticker_set(SpecialStickerSetType::animated_emoji_click())); } }