Skip to content

Commit

Permalink
pyrofork: Add offset_{date,id,topic} parameters to get_forum_topics m…
Browse files Browse the repository at this point in the history
…ethod

Signed-off-by: wulan17 <[email protected]>
  • Loading branch information
wulan17 committed Mar 2, 2025
1 parent 682efb0 commit 37c6546
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions pyrogram/methods/chats/get_forum_topics.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ class GetForumTopics:
async def get_forum_topics(
self: "pyrogram.Client",
chat_id: Union[int, str],
limit: int = 0
limit: int = 0,
offset_date: int = 0,
offset_id: int = 0,
offset_topic: int = 0
) -> Optional[AsyncGenerator["types.ForumTopic", None]]:
"""Get one or more topic from a chat.
Expand All @@ -46,6 +49,15 @@ async def get_forum_topics(
limit (``int``, *optional*):
Limits the number of topics to be retrieved.
offset_date (``int``, *optional*):
Date of the last message of the last found topic.
offset_id (``int``, *optional*):
ID of the last message of the last found topic.
offset_topic (``int``, *optional*):
ID of the last found topic.
Returns:
``Generator``: On success, a generator yielding :obj:`~pyrogram.types.ForumTopic` objects is returned.
Expand All @@ -62,7 +74,7 @@ async def get_forum_topics(

peer = await self.resolve_peer(chat_id)

rpc = raw.functions.channels.GetForumTopics(channel=peer, offset_date=0, offset_id=0, offset_topic=0, limit=limit)
rpc = raw.functions.channels.GetForumTopics(channel=peer, offset_date=offset_date, offset_id=offset_id, offset_topic=offset_topic, limit=limit)

r = await self.invoke(rpc, sleep_threshold=-1)

Expand Down

0 comments on commit 37c6546

Please sign in to comment.