Remove some redundant examples

This commit is contained in:
Dan 2018-02-27 16:54:07 +01:00
parent 48f13229bb
commit 33ea5d8641

View File

@ -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