Support setChatEmojiStatus in supergroups.

This commit is contained in:
levlam 2024-02-10 23:39:02 +03:00
parent 75a812ba10
commit 3745632f68
2 changed files with 4 additions and 6 deletions

View File

@ -8183,7 +8183,8 @@ setChatAccentColor chat_id:int53 accent_color_id:int32 background_custom_emoji_i
//@description Changes accent color and background custom emoji for profile of a supergroup or channel chat. Requires can_change_info administrator right //@description Changes accent color and background custom emoji for profile of a supergroup or channel chat. Requires can_change_info administrator right
//@chat_id Chat identifier //@chat_id Chat identifier
//@profile_accent_color_id Identifier of the accent color to use for profile; pass -1 if none. The chat must have at least profileAccentColor.min_supergroup_chat_boost_level for supergroups or profileAccentColor.min_channel_chat_boost_level for channels boost level to pass the corresponding color //@profile_accent_color_id Identifier of the accent color to use for profile; pass -1 if none. The chat must have at least profileAccentColor.min_supergroup_chat_boost_level for supergroups
//-or profileAccentColor.min_channel_chat_boost_level for channels boost level to pass the corresponding color
//@profile_background_custom_emoji_id Identifier of a custom emoji to be shown on the chat's profile photo background; 0 if none. Use chatBoostLevelFeatures.can_set_profile_background_custom_emoji to check whether a custom emoji can be set //@profile_background_custom_emoji_id Identifier of a custom emoji to be shown on the chat's profile photo background; 0 if none. Use chatBoostLevelFeatures.can_set_profile_background_custom_emoji to check whether a custom emoji can be set
setChatProfileAccentColor chat_id:int53 profile_accent_color_id:int32 profile_background_custom_emoji_id:int64 = Ok; setChatProfileAccentColor chat_id:int53 profile_accent_color_id:int32 profile_background_custom_emoji_id:int64 = Ok;

View File

@ -7290,7 +7290,7 @@ void ContactsManager::set_channel_profile_accent_color(ChannelId channel_id, Acc
return promise.set_error(Status::Error(400, "Chat not found")); return promise.set_error(Status::Error(400, "Chat not found"));
} }
if (!get_channel_status(c).can_change_info_and_settings()) { if (!get_channel_status(c).can_change_info_and_settings()) {
return promise.set_error(Status::Error(400, "Not enough rights in the channel")); return promise.set_error(Status::Error(400, "Not enough rights in the chat"));
} }
td_->create_handler<UpdateChannelColorQuery>(std::move(promise)) td_->create_handler<UpdateChannelColorQuery>(std::move(promise))
@ -7303,11 +7303,8 @@ void ContactsManager::set_channel_emoji_status(ChannelId channel_id, const Emoji
if (c == nullptr) { if (c == nullptr) {
return promise.set_error(Status::Error(400, "Chat not found")); return promise.set_error(Status::Error(400, "Chat not found"));
} }
if (c->is_megagroup) {
return promise.set_error(Status::Error(400, "Emoji status can be changed only in channel chats"));
}
if (!get_channel_status(c).can_change_info_and_settings()) { if (!get_channel_status(c).can_change_info_and_settings()) {
return promise.set_error(Status::Error(400, "Not enough rights in the channel")); return promise.set_error(Status::Error(400, "Not enough rights in the chat"));
} }
add_recent_emoji_status(td_, emoji_status); add_recent_emoji_status(td_, emoji_status);