Improve editForumTopic.

This commit is contained in:
levlam 2022-11-30 17:18:22 +03:00
parent 7a93fcdeb4
commit 4d82036ac4
2 changed files with 4 additions and 1 deletions

View File

@ -5326,7 +5326,7 @@ createForumTopic chat_id:int53 name:string icon:forumTopicIcon = ForumTopicInfo;
//@chat_id Identifier of the chat
//@message_thread_id Message thread identifier of the forum topic
//@name New name of the topic; 0-128 characters. If empty, the previous topic name is kept
//@edit_icon_custom_emoji Pass true to edit the icon of the topic
//@edit_icon_custom_emoji Pass true to edit the icon of the topic. Icon of the General topic can't be edited
//@icon_custom_emoji_id Identifier of the new custom emoji for topic icon; pass 0 to remove the custom emoji. Ignored if edit_icon_custom_emoji is false. Telegram Premium users can use any custom emoji, other users can use only a custom emoji returned by getForumTopicDefaultIcons
editForumTopic chat_id:int53 message_thread_id:int53 name:string edit_icon_custom_emoji:Bool icon_custom_emoji_id:int64 = Ok;

View File

@ -283,6 +283,9 @@ void ForumTopicManager::edit_forum_topic(DialogId dialog_id, MessageId top_threa
if (edit_title && new_title.empty()) {
return promise.set_error(Status::Error(400, "Title must be non-empty"));
}
if (!edit_title && !edit_icon_custom_emoji) {
return promise.set_value(Unit());
}
td_->create_handler<EditForumTopicQuery>(std::move(promise))
->send(channel_id, top_thread_message_id, edit_title, new_title, edit_icon_custom_emoji, icon_custom_emoji_id);