diff --git a/telebot/__init__.py b/telebot/__init__.py index bf94fd5..95ec936 100644 --- a/telebot/__init__.py +++ b/telebot/__init__.py @@ -4648,8 +4648,8 @@ class TeleBot: def edit_forum_topic( self, chat_id: Union[int, str], - message_thread_id: int, name: str, - icon_custom_emoji_id: str, + message_thread_id: int, name: Optional[str]=None, + icon_custom_emoji_id: Optional[str]=None ) -> bool: """ Use this method to edit name and icon of a topic in a forum supergroup chat. The bot must be an @@ -4664,10 +4664,13 @@ class TeleBot: :param message_thread_id: Identifier of the topic to edit :type message_thread_id: :obj:`int` - :param name: New name of the topic, 1-128 characters + :param name: Optional, New name of the topic, 1-128 characters. If not specififed or empty, + the current name of the topic will be kept :type name: :obj:`str` - :param icon_custom_emoji_id: New custom emoji for the topic icon. Must be an emoji of type “tgs” and must be exactly 1 character long + :param icon_custom_emoji_id: Optional, New unique identifier of the custom emoji shown as the topic icon. + Use getForumTopicIconStickers to get all allowed custom emoji identifiers. Pass an empty string to remove the + icon. If not specified, the current icon will be kept :type icon_custom_emoji_id: :obj:`str` :return: On success, True is returned. diff --git a/telebot/apihelper.py b/telebot/apihelper.py index 005ac33..4f56705 100644 --- a/telebot/apihelper.py +++ b/telebot/apihelper.py @@ -1773,9 +1773,13 @@ def create_forum_topic(token, chat_id, name, icon_color=None, icon_custom_emoji_ payload['icon_custom_emoji_id'] = icon_custom_emoji_id return _make_request(token, method_url, params=payload) -def edit_forum_topic(token, chat_id, message_thread_id, name, icon_custom_emoji_id): +def edit_forum_topic(token, chat_id, message_thread_id, name=None, icon_custom_emoji_id=None): method_url = r'editForumTopic' - payload = {'chat_id': chat_id, 'message_thread_id': message_thread_id, 'name': name, 'icon_custom_emoji_id': icon_custom_emoji_id} + payload = {'chat_id': chat_id, 'message_thread_id': message_thread_id} + if name is not None: + payload['name'] = name + if icon_custom_emoji_id is not None: + payload['icon_custom_emoji_id'] = icon_custom_emoji_id return _make_request(token, method_url, params=payload) def close_forum_topic(token, chat_id, message_thread_id): diff --git a/telebot/async_telebot.py b/telebot/async_telebot.py index bbaeb53..65accb8 100644 --- a/telebot/async_telebot.py +++ b/telebot/async_telebot.py @@ -5514,8 +5514,8 @@ class AsyncTeleBot: async def edit_forum_topic( self, chat_id: Union[int, str], - message_thread_id: int, name: str, - icon_custom_emoji_id: str, + message_thread_id: int, name: Optional[str]=None, + icon_custom_emoji_id: Optional[str]=None ) -> bool: """ Use this method to edit name and icon of a topic in a forum supergroup chat. The bot must be an @@ -5530,10 +5530,13 @@ class AsyncTeleBot: :param message_thread_id: Identifier of the topic to edit :type message_thread_id: :obj:`int` - :param name: New name of the topic, 1-128 characters + :param name: Optional, New name of the topic, 1-128 characters. If not specififed or empty, + the current name of the topic will be kept :type name: :obj:`str` - :param icon_custom_emoji_id: New custom emoji for the topic icon. Must be an emoji of type “tgs” and must be exactly 1 character long + :param icon_custom_emoji_id: Optional, New unique identifier of the custom emoji shown as the topic icon. + Use getForumTopicIconStickers to get all allowed custom emoji identifiers. Pass an empty string to remove the + icon. If not specified, the current icon will be kept :type icon_custom_emoji_id: :obj:`str` :return: On success, True is returned. diff --git a/telebot/asyncio_helper.py b/telebot/asyncio_helper.py index 2ae1934..8bbdc3d 100644 --- a/telebot/asyncio_helper.py +++ b/telebot/asyncio_helper.py @@ -1764,9 +1764,13 @@ async def create_forum_topic(token, chat_id, name, icon_color=None, icon_custom_ payload['icon_custom_emoji_id'] = icon_custom_emoji_id return await _process_request(token, method_url, params=payload) -async def edit_forum_topic(token, chat_id, message_thread_id, name, icon_custom_emoji_id): +async def edit_forum_topic(token, chat_id, message_thread_id, name=None, icon_custom_emoji_id=None): method_url = r'editForumTopic' - payload = {'chat_id': chat_id, 'message_thread_id': message_thread_id, 'name': name, 'icon_custom_emoji_id': icon_custom_emoji_id} + payload = {'chat_id': chat_id, 'message_thread_id': message_thread_id} + if name is not None: + payload['name'] = name + if icon_custom_emoji_id is not None: + payload['icon_custom_emoji_id'] = icon_custom_emoji_id return await _process_request(token, method_url, params=payload) async def close_forum_topic(token, chat_id, message_thread_id):