edit_forum_topic()

Client.edit_forum_topic()

Use this method to edit name and icon of a topic in a forum supergroup chat or a private chat with a user.

In the case of a supergroup chat the bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic.

Usable by Users Bots
Parameters:
  • chat_id (``int`` | ``str``) – Unique identifier (int) or username (str) of the target chat. For your personal cloud (Saved Messages) you can simply use “me” or “self”. For a contact that exists in your Telegram address book you can use his phone number (str).

  • message_thread_id (``int``) – Unique identifier for the target message thread of the forum topic

  • name (``str``, *optional*) – New topic name, 0-128 characters. If not specified or empty, the current name of the topic will be kept

  • icon_custom_emoji_id (``str``, *optional*) – New unique identifier of the custom emoji shown as the topic icon. Use get_forum_topic_icon_stickers() to get all allowed custom emoji identifiers. Pass an empty string to remove the icon. If not specified, the current icon will be kept

Returns:

:obj:`~pyrogram.types.Message` (On success, the edited message is returned.)

Example

# Create a new Topic
message = await app.create_forum_topic(chat, "Topic Title")
# Edit the Topic
await app.edit_forum_topic(chat, message.id, "New Topic Title")