diff --git a/docs/source/start/BasicUsage.rst b/docs/source/start/BasicUsage.rst index db8ad2cf..f154c086 100644 --- a/docs/source/start/BasicUsage.rst +++ b/docs/source/start/BasicUsage.rst @@ -93,72 +93,4 @@ Here some examples: ) ) -- Get channel/supergroup participants: - - .. code-block:: python - - import time - from pyrogram.api import types, functions - - ... - - users = [] - limit = 200 - offset = 0 - - while True: - try: - participants = client.send( - functions.channels.GetParticipants( - channel=client.resolve_peer("username"), # ID or username - filter=types.ChannelParticipantsSearch(""), # Filter by empty string (search for all) - offset=offset, - limit=limit, - hash=0 - ) - ) - except FloodWait as e: - # Very large channels will trigger FloodWait. - # When happens, wait X seconds before continuing - time.sleep(e.x) - continue - - if not participants.participants: - break # No more participants left - - users.extend(participants.users) - offset += limit - -- Get history of a chat: - - .. code-block:: python - - import time - from pyrogram.api import types, functions - - ... - - history = [] - limit = 100 - offset = 0 - - while True: - try: - messages = client.send( - functions.messages.GetHistory( - client.resolve_peer("me"), # Get your own history - 0, 0, offset, limit, 0, 0, 0 - ) - ) - except FloodWait as e: - # For very large histories the method call can raise a FloodWait - time.sleep(e.x) - continue - - if not messages.messages: - break # No more messages left - - history.extend(messages.messages) - offset += limit - .. _bot-like: https://core.telegram.org/bots/api#available-methods \ No newline at end of file