get_forum_topics()#

Client.get_forum_topics()#

Get one or more topic from a chat. Returns found forum topics in a forum chat. This is a temporary method for getting information about topic list from the server

Usable by Users Bots
Parameters:
  • chat_id (int | str) – Unique identifier (int) or username (str) of the target chat.

  • query (str, optional) – Query to search for in the forum topic’s name

  • offset_date (datetime, optional) – The date starting from which the results need to be fetched. Use 0 or any date in the future to get results from the last topic

  • offset_message_id (int, optional) – The message identifier of the last message in the last found topic, or 0 for the first request

  • offset_message_thread_id (int, optional) – The message thread identifier of the last found topic, or 0 for the first request

  • limit (int, optional) – The maximum number of forum topics to be returned; up to 100. For optimal performance, the number of returned forum topics is chosen by Telegram Server and can be smaller than the specified limit By default, no limit is applied and all topics are returned.

Returns:

Generator – A generator yielding ForumTopic objects.

Example

# Iterate through all topics
async for topic in app.get_forum_topics(chat_id):
    print(topic)