Add td_api::getThemedChatEmojiStatuses.
This commit is contained in:
parent
40b585d74f
commit
e2747b6c76
@ -8259,7 +8259,7 @@ getAttachmentMenuBot bot_user_id:int53 = AttachmentMenuBot;
|
|||||||
toggleBotIsAddedToAttachmentMenu bot_user_id:int53 is_added:Bool allow_write_access:Bool = Ok;
|
toggleBotIsAddedToAttachmentMenu bot_user_id:int53 is_added:Bool allow_write_access:Bool = Ok;
|
||||||
|
|
||||||
|
|
||||||
//@description Returns up to 8 emoji statuses, which must be shown right after the default Premium Badge in the emoji status list
|
//@description Returns up to 8 emoji statuses, which must be shown right after the default Premium Badge in the emoji status list for users
|
||||||
getThemedEmojiStatuses = EmojiStatuses;
|
getThemedEmojiStatuses = EmojiStatuses;
|
||||||
|
|
||||||
//@description Returns recent emoji statuses
|
//@description Returns recent emoji statuses
|
||||||
@ -8272,6 +8272,10 @@ getDefaultEmojiStatuses = EmojiStatuses;
|
|||||||
clearRecentEmojiStatuses = Ok;
|
clearRecentEmojiStatuses = Ok;
|
||||||
|
|
||||||
|
|
||||||
|
//@description Returns up to 8 emoji statuses, which must be shown in the emoji status list for chats
|
||||||
|
getThemedChatEmojiStatuses = EmojiStatuses;
|
||||||
|
|
||||||
|
|
||||||
//@description Downloads a file from the cloud. Download progress and completion of the download will be notified through updateFile updates
|
//@description Downloads a file from the cloud. Download progress and completion of the download will be notified through updateFile updates
|
||||||
//@file_id Identifier of the file to download
|
//@file_id Identifier of the file to download
|
||||||
//@priority Priority of the download (1-32). The higher the priority, the earlier the file will be downloaded. If the priorities of two files are equal, then the last one for which downloadFile/addFileToDownloads was called will be downloaded first
|
//@priority Priority of the download (1-32). The higher the priority, the earlier the file will be downloaded. If the priorities of two files are equal, then the last one for which downloadFile/addFileToDownloads was called will be downloaded first
|
||||||
|
@ -37,6 +37,10 @@ SpecialStickerSetType SpecialStickerSetType::default_statuses() {
|
|||||||
return SpecialStickerSetType("default_statuses_sticker_set");
|
return SpecialStickerSetType("default_statuses_sticker_set");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SpecialStickerSetType SpecialStickerSetType::default_channel_statuses() {
|
||||||
|
return SpecialStickerSetType("default_channel_statuses_sticker_set");
|
||||||
|
}
|
||||||
|
|
||||||
SpecialStickerSetType SpecialStickerSetType::default_topic_icons() {
|
SpecialStickerSetType SpecialStickerSetType::default_topic_icons() {
|
||||||
return SpecialStickerSetType("default_topic_icons_sticker_set");
|
return SpecialStickerSetType("default_topic_icons_sticker_set");
|
||||||
}
|
}
|
||||||
@ -63,12 +67,12 @@ SpecialStickerSetType::SpecialStickerSetType(
|
|||||||
case telegram_api::inputStickerSetEmojiDefaultStatuses::ID:
|
case telegram_api::inputStickerSetEmojiDefaultStatuses::ID:
|
||||||
*this = default_statuses();
|
*this = default_statuses();
|
||||||
break;
|
break;
|
||||||
|
case telegram_api::inputStickerSetEmojiChannelDefaultStatuses::ID:
|
||||||
|
*this = default_channel_statuses();
|
||||||
|
break;
|
||||||
case telegram_api::inputStickerSetEmojiDefaultTopicIcons::ID:
|
case telegram_api::inputStickerSetEmojiDefaultTopicIcons::ID:
|
||||||
*this = default_topic_icons();
|
*this = default_topic_icons();
|
||||||
break;
|
break;
|
||||||
case telegram_api::inputStickerSetEmojiChannelDefaultStatuses::ID:
|
|
||||||
*this = default_statuses();
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
break;
|
break;
|
||||||
@ -99,6 +103,9 @@ telegram_api::object_ptr<telegram_api::InputStickerSet> SpecialStickerSetType::g
|
|||||||
if (*this == default_statuses()) {
|
if (*this == default_statuses()) {
|
||||||
return telegram_api::make_object<telegram_api::inputStickerSetEmojiDefaultStatuses>();
|
return telegram_api::make_object<telegram_api::inputStickerSetEmojiDefaultStatuses>();
|
||||||
}
|
}
|
||||||
|
if (*this == default_channel_statuses()) {
|
||||||
|
return telegram_api::make_object<telegram_api::inputStickerSetEmojiChannelDefaultStatuses>();
|
||||||
|
}
|
||||||
if (*this == default_topic_icons()) {
|
if (*this == default_topic_icons()) {
|
||||||
return telegram_api::make_object<telegram_api::inputStickerSetEmojiDefaultTopicIcons>();
|
return telegram_api::make_object<telegram_api::inputStickerSetEmojiDefaultTopicIcons>();
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,8 @@ class SpecialStickerSetType {
|
|||||||
|
|
||||||
static SpecialStickerSetType default_statuses();
|
static SpecialStickerSetType default_statuses();
|
||||||
|
|
||||||
|
static SpecialStickerSetType default_channel_statuses();
|
||||||
|
|
||||||
static SpecialStickerSetType default_topic_icons();
|
static SpecialStickerSetType default_topic_icons();
|
||||||
|
|
||||||
string get_dice_emoji() const;
|
string get_dice_emoji() const;
|
||||||
|
@ -1695,6 +1695,10 @@ void StickersManager::init() {
|
|||||||
auto &sticker_set = add_special_sticker_set(SpecialStickerSetType::default_statuses());
|
auto &sticker_set = add_special_sticker_set(SpecialStickerSetType::default_statuses());
|
||||||
load_special_sticker_set_info_from_binlog(sticker_set);
|
load_special_sticker_set_info_from_binlog(sticker_set);
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
auto &sticker_set = add_special_sticker_set(SpecialStickerSetType::default_channel_statuses());
|
||||||
|
load_special_sticker_set_info_from_binlog(sticker_set);
|
||||||
|
}
|
||||||
{
|
{
|
||||||
auto &sticker_set = add_special_sticker_set(SpecialStickerSetType::default_topic_icons());
|
auto &sticker_set = add_special_sticker_set(SpecialStickerSetType::default_topic_icons());
|
||||||
load_special_sticker_set_info_from_binlog(sticker_set);
|
load_special_sticker_set_info_from_binlog(sticker_set);
|
||||||
@ -1917,6 +1921,10 @@ void StickersManager::on_load_special_sticker_set(const SpecialStickerSetType &t
|
|||||||
set_promises(pending_get_default_statuses_queries_);
|
set_promises(pending_get_default_statuses_queries_);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (type == SpecialStickerSetType::default_channel_statuses()) {
|
||||||
|
set_promises(pending_get_default_channel_statuses_queries_);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (type == SpecialStickerSetType::default_topic_icons()) {
|
if (type == SpecialStickerSetType::default_topic_icons()) {
|
||||||
set_promises(pending_get_default_topic_icons_queries_);
|
set_promises(pending_get_default_topic_icons_queries_);
|
||||||
return;
|
return;
|
||||||
@ -3066,8 +3074,8 @@ StickerSetId StickersManager::get_sticker_set_id(const tl_object_ptr<telegram_ap
|
|||||||
case telegram_api::inputStickerSetPremiumGifts::ID:
|
case telegram_api::inputStickerSetPremiumGifts::ID:
|
||||||
case telegram_api::inputStickerSetEmojiGenericAnimations::ID:
|
case telegram_api::inputStickerSetEmojiGenericAnimations::ID:
|
||||||
case telegram_api::inputStickerSetEmojiDefaultStatuses::ID:
|
case telegram_api::inputStickerSetEmojiDefaultStatuses::ID:
|
||||||
case telegram_api::inputStickerSetEmojiDefaultTopicIcons::ID:
|
|
||||||
case telegram_api::inputStickerSetEmojiChannelDefaultStatuses::ID:
|
case telegram_api::inputStickerSetEmojiChannelDefaultStatuses::ID:
|
||||||
|
case telegram_api::inputStickerSetEmojiDefaultTopicIcons::ID:
|
||||||
LOG(ERROR) << "Receive special sticker set " << to_string(set_ptr);
|
LOG(ERROR) << "Receive special sticker set " << to_string(set_ptr);
|
||||||
return add_special_sticker_set(SpecialStickerSetType(set_ptr)).id_;
|
return add_special_sticker_set(SpecialStickerSetType(set_ptr)).id_;
|
||||||
case telegram_api::inputStickerSetDice::ID:
|
case telegram_api::inputStickerSetDice::ID:
|
||||||
@ -3100,8 +3108,8 @@ StickerSetId StickersManager::add_sticker_set(tl_object_ptr<telegram_api::InputS
|
|||||||
case telegram_api::inputStickerSetPremiumGifts::ID:
|
case telegram_api::inputStickerSetPremiumGifts::ID:
|
||||||
case telegram_api::inputStickerSetEmojiGenericAnimations::ID:
|
case telegram_api::inputStickerSetEmojiGenericAnimations::ID:
|
||||||
case telegram_api::inputStickerSetEmojiDefaultStatuses::ID:
|
case telegram_api::inputStickerSetEmojiDefaultStatuses::ID:
|
||||||
case telegram_api::inputStickerSetEmojiDefaultTopicIcons::ID:
|
|
||||||
case telegram_api::inputStickerSetEmojiChannelDefaultStatuses::ID:
|
case telegram_api::inputStickerSetEmojiChannelDefaultStatuses::ID:
|
||||||
|
case telegram_api::inputStickerSetEmojiDefaultTopicIcons::ID:
|
||||||
LOG(ERROR) << "Receive special sticker set " << to_string(set_ptr);
|
LOG(ERROR) << "Receive special sticker set " << to_string(set_ptr);
|
||||||
return add_special_sticker_set(SpecialStickerSetType(set_ptr)).id_;
|
return add_special_sticker_set(SpecialStickerSetType(set_ptr)).id_;
|
||||||
case telegram_api::inputStickerSetDice::ID:
|
case telegram_api::inputStickerSetDice::ID:
|
||||||
@ -3298,8 +3306,8 @@ StickerSetId StickersManager::on_get_input_sticker_set(FileId sticker_file_id,
|
|||||||
case telegram_api::inputStickerSetPremiumGifts::ID:
|
case telegram_api::inputStickerSetPremiumGifts::ID:
|
||||||
case telegram_api::inputStickerSetEmojiGenericAnimations::ID:
|
case telegram_api::inputStickerSetEmojiGenericAnimations::ID:
|
||||||
case telegram_api::inputStickerSetEmojiDefaultStatuses::ID:
|
case telegram_api::inputStickerSetEmojiDefaultStatuses::ID:
|
||||||
case telegram_api::inputStickerSetEmojiDefaultTopicIcons::ID:
|
|
||||||
case telegram_api::inputStickerSetEmojiChannelDefaultStatuses::ID:
|
case telegram_api::inputStickerSetEmojiChannelDefaultStatuses::ID:
|
||||||
|
case telegram_api::inputStickerSetEmojiDefaultTopicIcons::ID:
|
||||||
return add_special_sticker_set(SpecialStickerSetType(set_ptr)).id_;
|
return add_special_sticker_set(SpecialStickerSetType(set_ptr)).id_;
|
||||||
case telegram_api::inputStickerSetDice::ID:
|
case telegram_api::inputStickerSetDice::ID:
|
||||||
return StickerSetId();
|
return StickerSetId();
|
||||||
@ -6020,6 +6028,44 @@ bool StickersManager::is_default_emoji_status(CustomEmojiId custom_emoji_id) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void StickersManager::get_default_channel_emoji_statuses(bool is_recursive,
|
||||||
|
Promise<td_api::object_ptr<td_api::emojiStatuses>> &&promise) {
|
||||||
|
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||||
|
|
||||||
|
auto &special_sticker_set = add_special_sticker_set(SpecialStickerSetType::default_channel_statuses());
|
||||||
|
auto sticker_set = get_sticker_set(special_sticker_set.id_);
|
||||||
|
if (sticker_set == nullptr || !sticker_set->was_loaded_) {
|
||||||
|
if (is_recursive) {
|
||||||
|
return promise.set_value(td_api::make_object<td_api::emojiStatuses>());
|
||||||
|
}
|
||||||
|
|
||||||
|
pending_get_default_channel_statuses_queries_.push_back(PromiseCreator::lambda(
|
||||||
|
[actor_id = actor_id(this), promise = std::move(promise)](Result<Unit> &&result) mutable {
|
||||||
|
if (result.is_error()) {
|
||||||
|
promise.set_error(result.move_as_error());
|
||||||
|
} else {
|
||||||
|
send_closure(actor_id, &StickersManager::get_default_channel_emoji_statuses, true, std::move(promise));
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
load_special_sticker_set(special_sticker_set);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
vector<int64> custom_emoji_ids;
|
||||||
|
for (auto sticker_id : sticker_set->sticker_ids_) {
|
||||||
|
auto custom_emoji_id = get_custom_emoji_id(sticker_id);
|
||||||
|
if (!custom_emoji_id.is_valid()) {
|
||||||
|
LOG(ERROR) << "Ignore wrong sticker " << sticker_id;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
custom_emoji_ids.push_back(custom_emoji_id.get());
|
||||||
|
if (custom_emoji_ids.size() >= 8) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
promise.set_value(td_api::make_object<td_api::emojiStatuses>(std::move(custom_emoji_ids)));
|
||||||
|
}
|
||||||
|
|
||||||
void StickersManager::get_default_topic_icons(bool is_recursive,
|
void StickersManager::get_default_topic_icons(bool is_recursive,
|
||||||
Promise<td_api::object_ptr<td_api::stickers>> &&promise) {
|
Promise<td_api::object_ptr<td_api::stickers>> &&promise) {
|
||||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||||
|
@ -130,6 +130,9 @@ class StickersManager final : public Actor {
|
|||||||
|
|
||||||
bool is_default_emoji_status(CustomEmojiId custom_emoji_id);
|
bool is_default_emoji_status(CustomEmojiId custom_emoji_id);
|
||||||
|
|
||||||
|
void get_default_channel_emoji_statuses(bool is_recursive,
|
||||||
|
Promise<td_api::object_ptr<td_api::emojiStatuses>> &&promise);
|
||||||
|
|
||||||
void get_default_topic_icons(bool is_recursive, Promise<td_api::object_ptr<td_api::stickers>> &&promise);
|
void get_default_topic_icons(bool is_recursive, Promise<td_api::object_ptr<td_api::stickers>> &&promise);
|
||||||
|
|
||||||
void get_custom_emoji_stickers(vector<CustomEmojiId> custom_emoji_ids, bool use_database,
|
void get_custom_emoji_stickers(vector<CustomEmojiId> custom_emoji_ids, bool use_database,
|
||||||
@ -1060,6 +1063,7 @@ class StickersManager final : public Actor {
|
|||||||
vector<Promise<Unit>> pending_get_premium_gift_option_sticker_queries_;
|
vector<Promise<Unit>> pending_get_premium_gift_option_sticker_queries_;
|
||||||
vector<Promise<Unit>> pending_get_generic_animations_queries_;
|
vector<Promise<Unit>> pending_get_generic_animations_queries_;
|
||||||
vector<Promise<Unit>> pending_get_default_statuses_queries_;
|
vector<Promise<Unit>> pending_get_default_statuses_queries_;
|
||||||
|
vector<Promise<Unit>> pending_get_default_channel_statuses_queries_;
|
||||||
vector<Promise<Unit>> pending_get_default_topic_icons_queries_;
|
vector<Promise<Unit>> pending_get_default_topic_icons_queries_;
|
||||||
|
|
||||||
double next_click_animated_emoji_message_time_ = 0;
|
double next_click_animated_emoji_message_time_ = 0;
|
||||||
|
@ -7456,6 +7456,12 @@ void Td::on_request(uint64 id, const td_api::getThemedEmojiStatuses &request) {
|
|||||||
stickers_manager_->get_default_emoji_statuses(false, std::move(promise));
|
stickers_manager_->get_default_emoji_statuses(false, std::move(promise));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Td::on_request(uint64 id, const td_api::getThemedChatEmojiStatuses &request) {
|
||||||
|
CHECK_IS_USER();
|
||||||
|
CREATE_REQUEST_PROMISE();
|
||||||
|
stickers_manager_->get_default_channel_emoji_statuses(false, std::move(promise));
|
||||||
|
}
|
||||||
|
|
||||||
void Td::on_request(uint64 id, const td_api::getDefaultEmojiStatuses &request) {
|
void Td::on_request(uint64 id, const td_api::getDefaultEmojiStatuses &request) {
|
||||||
CHECK_IS_USER();
|
CHECK_IS_USER();
|
||||||
CREATE_REQUEST_PROMISE();
|
CREATE_REQUEST_PROMISE();
|
||||||
|
@ -1247,6 +1247,8 @@ class Td final : public Actor {
|
|||||||
|
|
||||||
void on_request(uint64 id, const td_api::getThemedEmojiStatuses &request);
|
void on_request(uint64 id, const td_api::getThemedEmojiStatuses &request);
|
||||||
|
|
||||||
|
void on_request(uint64 id, const td_api::getThemedChatEmojiStatuses &request);
|
||||||
|
|
||||||
void on_request(uint64 id, const td_api::getDefaultEmojiStatuses &request);
|
void on_request(uint64 id, const td_api::getDefaultEmojiStatuses &request);
|
||||||
|
|
||||||
void on_request(uint64 id, const td_api::getRecentEmojiStatuses &request);
|
void on_request(uint64 id, const td_api::getRecentEmojiStatuses &request);
|
||||||
|
@ -2273,6 +2273,7 @@ void UpdatesManager::try_reload_data() {
|
|||||||
td_->stickers_manager_->reload_special_sticker_set_by_type(SpecialStickerSetType::premium_gifts());
|
td_->stickers_manager_->reload_special_sticker_set_by_type(SpecialStickerSetType::premium_gifts());
|
||||||
td_->stickers_manager_->reload_special_sticker_set_by_type(SpecialStickerSetType::generic_animations());
|
td_->stickers_manager_->reload_special_sticker_set_by_type(SpecialStickerSetType::generic_animations());
|
||||||
td_->stickers_manager_->reload_special_sticker_set_by_type(SpecialStickerSetType::default_statuses());
|
td_->stickers_manager_->reload_special_sticker_set_by_type(SpecialStickerSetType::default_statuses());
|
||||||
|
td_->stickers_manager_->reload_special_sticker_set_by_type(SpecialStickerSetType::default_channel_statuses());
|
||||||
td_->stickers_manager_->reload_special_sticker_set_by_type(SpecialStickerSetType::default_topic_icons());
|
td_->stickers_manager_->reload_special_sticker_set_by_type(SpecialStickerSetType::default_topic_icons());
|
||||||
td_->stickers_manager_->get_default_custom_emoji_stickers(StickerListType::DialogPhoto, true, Auto());
|
td_->stickers_manager_->get_default_custom_emoji_stickers(StickerListType::DialogPhoto, true, Auto());
|
||||||
td_->stickers_manager_->get_default_custom_emoji_stickers(StickerListType::UserProfilePhoto, true, Auto());
|
td_->stickers_manager_->get_default_custom_emoji_stickers(StickerListType::UserProfilePhoto, true, Auto());
|
||||||
|
@ -5587,6 +5587,8 @@ class CliClient final : public Actor {
|
|||||||
send_request(td_api::make_object<td_api::getRecentEmojiStatuses>());
|
send_request(td_api::make_object<td_api::getRecentEmojiStatuses>());
|
||||||
} else if (op == "cres") {
|
} else if (op == "cres") {
|
||||||
send_request(td_api::make_object<td_api::clearRecentEmojiStatuses>());
|
send_request(td_api::make_object<td_api::clearRecentEmojiStatuses>());
|
||||||
|
} else if (op == "gtces") {
|
||||||
|
send_request(td_api::make_object<td_api::getThemedChatEmojiStatuses>());
|
||||||
} else if (op == "ccun") {
|
} else if (op == "ccun") {
|
||||||
ChatId chat_id;
|
ChatId chat_id;
|
||||||
string username;
|
string username;
|
||||||
|
Loading…
Reference in New Issue
Block a user