Add td_api::emojiCategoryTypeChatPhoto.

This commit is contained in:
levlam 2023-01-27 15:16:40 +03:00
parent 25cdd0e6ec
commit 75dacac872
5 changed files with 25 additions and 4 deletions

View File

@ -2958,6 +2958,9 @@ emojiCategoryTypeDefault = EmojiCategoryType;
//@description The category should be used for emoji status selection
emojiCategoryTypeEmojiStatus = EmojiCategoryType;
//@description The category should be used for chat photo emoji selection
emojiCategoryTypeChatPhoto = EmojiCategoryType;
//@class CallDiscardReason @description Describes the reason why a call was discarded

View File

@ -17,6 +17,8 @@ EmojiGroupType get_emoji_group_type(const td_api::object_ptr<td_api::EmojiCatego
return EmojiGroupType::Default;
case td_api::emojiCategoryTypeEmojiStatus::ID:
return EmojiGroupType::EmojiStatus;
case td_api::emojiCategoryTypeChatPhoto::ID:
return EmojiGroupType::ProfilePhoto;
default:
UNREACHABLE();
return EmojiGroupType::Default;
@ -29,6 +31,8 @@ StringBuilder &operator<<(StringBuilder &string_builder, EmojiGroupType emoji_gr
return string_builder << "Default";
case EmojiGroupType::EmojiStatus:
return string_builder << "EmojiStatus";
case EmojiGroupType::ProfilePhoto:
return string_builder << "ChatPhoto";
default:
UNREACHABLE();
return string_builder;

View File

@ -13,9 +13,9 @@
namespace td {
enum class EmojiGroupType : int32 { Default, EmojiStatus };
enum class EmojiGroupType : int32 { Default, EmojiStatus, ProfilePhoto };
static constexpr int32 MAX_EMOJI_GROUP_TYPE = 2;
static constexpr int32 MAX_EMOJI_GROUP_TYPE = 3;
EmojiGroupType get_emoji_group_type(const td_api::object_ptr<td_api::EmojiCategoryType> &type);

View File

@ -1362,6 +1362,9 @@ class GetEmojiGroupsQuery final : public Td::ResultHandler {
case EmojiGroupType::EmojiStatus:
send_query(G()->net_query_creator().create(telegram_api::messages_getEmojiStatusGroups(hash)));
break;
case EmojiGroupType::ProfilePhoto:
send_query(G()->net_query_creator().create(telegram_api::messages_getEmojiProfilePhotoGroups(hash)));
break;
default:
UNREACHABLE();
}
@ -1371,6 +1374,9 @@ class GetEmojiGroupsQuery final : public Td::ResultHandler {
static_assert(std::is_same<telegram_api::messages_getEmojiGroups::ReturnType,
telegram_api::messages_getEmojiStatusGroups::ReturnType>::value,
"");
static_assert(std::is_same<telegram_api::messages_getEmojiGroups::ReturnType,
telegram_api::messages_getEmojiProfilePhotoGroups::ReturnType>::value,
"");
auto result_ptr = fetch_result<telegram_api::messages_getEmojiGroups>(packet);
if (result_ptr.is_error()) {
return on_error(result_ptr.move_as_error());

View File

@ -2921,8 +2921,16 @@ class CliClient final : public Actor {
send_request(td_api::make_object<td_api::searchEmojis>(args, true, vector<string>()));
} else if (op == "seru") {
send_request(td_api::make_object<td_api::searchEmojis>(args, false, vector<string>{"ru_RU"}));
} else if (op == "gec" || op == "geces") {
auto type = op == "geces" ? td_api::make_object<td_api::emojiCategoryTypeEmojiStatus>() : nullptr;
} else if (op == "gec" || op == "geces" || op == "geccp") {
auto type = [&]() -> td_api::object_ptr<td_api::EmojiCategoryType> {
if (op == "geces") {
return td_api::make_object<td_api::emojiCategoryTypeEmojiStatus>();
}
if (op == "geccp") {
return td_api::make_object<td_api::emojiCategoryTypeChatPhoto>();
}
return td_api::make_object<td_api::emojiCategoryTypeDefault>();
}();
send_request(td_api::make_object<td_api::getEmojiCategories>(std::move(type)));
} else if (op == "gae") {
send_request(td_api::make_object<td_api::getAnimatedEmoji>(args));