delete_forum_topic()#
- Client.delete_forum_topic()#
Use this method to delete a forum topic along with all its messages in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_delete_messages administrator rights unless the user is creator of the topic, the topic has no messages from other users and has at most 11 messages.
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
- Returns:
int
– Amount of affected messages
Example
# Create a new Topic message = await app.create_forum_topic(chat, "Topic Title") # Delete the Topic await app.delete_forum_topic(chat, message.id)