File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -243,12 +243,13 @@ async def get_participants(
243243 cl = get_client (account )
244244 await ensure_connected (cl )
245245
246- # Use iter_participants with offset to fetch only the needed slice,
247- # avoiding O(N) fetching on later pages .
246+ # iter_participants takes no ` offset`, and its `limit` is not honoured
247+ # for basic groups. Fetch through the page, then slice it out .
248248 offset = (page - 1 ) * page_size
249249 participants = []
250- async for participant in cl .iter_participants (chat_id , limit = page_size , offset = offset ):
250+ async for participant in cl .iter_participants (chat_id , limit = offset + page_size ):
251251 participants .append (participant )
252+ participants = participants [offset : offset + page_size ]
252253
253254 if not participants :
254255 return format_tool_result ([])
You can’t perform that action at this time.
0 commit comments