From 40ff7c6bdf29f178da1df341bd4dc2f3685e2906 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Fri, 17 Sep 2021 20:19:23 +0200 Subject: [PATCH] Document default behaviour of limit --- telethon/_client/telegramclient.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/telethon/_client/telegramclient.py b/telethon/_client/telegramclient.py index 1a9e7bef..30c2811a 100644 --- a/telethon/_client/telegramclient.py +++ b/telethon/_client/telegramclient.py @@ -735,6 +735,10 @@ class TelegramClient: limit (`int`): Limits amount of participants fetched. + By default, there is no limit set when using the result as + an iterator. When using ``await``, the default limit is 1, + so the method returns a single user. + search (`str`, optional): Look for participants with this string in name/username. @@ -822,6 +826,10 @@ class TelegramClient: The limit may also be `None`, which would eventually return the whole history. + By default, there is no limit set when using the result as + an iterator. When using ``await``, the default limit is 1, + so the method returns the last event. + max_id (`int`): All the events with a higher (newer) ID or equal to this will be excluded. @@ -930,6 +938,10 @@ class TelegramClient: The limit may also be `None`, which would eventually all the photos that are still available. + By default, there is no limit set when using the result as + an iterator. When using ``await``, the default limit is 1, + so the method returns the last profile photo. + offset (`int`): How many photos should be skipped before returning the first one. @@ -1407,6 +1419,10 @@ class TelegramClient: will tell the library to slow down through a ``FloodWaitError``. + By default, there is no limit set when using the result as + an iterator. When using ``await``, the default limit is 1, + so the method returns the most-recent dialog. + offset_date (`datetime`, optional): The offset date to be used. @@ -2001,6 +2017,10 @@ class TelegramClient: The limit may also be `None`, which would eventually return the whole history. + By default, there is no limit set when using the result as + an iterator. When using ``await``, the default limit is 1, + so the method returns the last message. + offset_date (`datetime`): Offset date (messages *previous* to this date will be retrieved). Exclusive.