mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-24 07:51:44 +00:00
Use app.run() in the examples
This commit is contained in:
parent
fa65abf276
commit
142a27f52a
@ -34,5 +34,4 @@ def answer(client, callback_query):
|
||||
)
|
||||
|
||||
|
||||
app.start()
|
||||
app.idle()
|
||||
app.run() # Automatically start() and idle()
|
||||
|
@ -36,5 +36,4 @@ def echo(client, message):
|
||||
)
|
||||
|
||||
|
||||
app.start()
|
||||
app.idle()
|
||||
app.run() # Automatically start() and idle()
|
||||
|
@ -24,12 +24,12 @@ from pyrogram.api.errors import FloodWait
|
||||
"""This example shows how to retrieve the full message history of a chat"""
|
||||
|
||||
app = Client("my_account")
|
||||
app.start()
|
||||
|
||||
target = "me" # "me" refers to your own chat (Saved Messages)
|
||||
messages = [] # List that will contain all the messages of the target chat
|
||||
offset_id = 0 # ID of the last message of the chunk
|
||||
|
||||
app.start()
|
||||
|
||||
while True:
|
||||
try:
|
||||
m = app.get_history(target, offset_id=offset_id)
|
||||
|
@ -28,13 +28,13 @@ Refer to get_participants2.py for more than 10.000 users.
|
||||
"""
|
||||
|
||||
app = Client("my_account")
|
||||
app.start()
|
||||
|
||||
target = "pyrogramchat" # Target channel/supergroup
|
||||
users = [] # List that will contain all the users of the target chat
|
||||
limit = 200 # Amount of users to retrieve for each API call
|
||||
offset = 0 # Offset starts at 0
|
||||
|
||||
app.start()
|
||||
|
||||
while True:
|
||||
try:
|
||||
participants = app.send(
|
||||
|
@ -33,15 +33,14 @@ as some user names may not contain ascii letters at all.
|
||||
"""
|
||||
|
||||
app = Client("my_account")
|
||||
app.start()
|
||||
|
||||
target = "pyrogramchat" # Target channel/supergroup username or id
|
||||
users = {} # To ensure uniqueness, users will be stored in a dictionary with user_id as key
|
||||
limit = 200 # Amount of users to retrieve for each API call (200 is the maximum)
|
||||
|
||||
# "" + "0123456789" + "abcdefghijklmnopqrstuvwxyz" (as list)
|
||||
queries = [""] + [str(i) for i in range(10)] + list(ascii_lowercase)
|
||||
|
||||
app.start()
|
||||
|
||||
for q in queries:
|
||||
print("Searching for '{}'".format(q))
|
||||
offset = 0 # For each query, offset restarts from 0
|
||||
|
@ -28,5 +28,4 @@ def raw(client, update, users, chats):
|
||||
print(update)
|
||||
|
||||
|
||||
app.start()
|
||||
app.idle()
|
||||
app.run() # Automatically start() and idle()
|
||||
|
@ -49,5 +49,4 @@ def welcome(client, message):
|
||||
)
|
||||
|
||||
|
||||
app.start()
|
||||
app.idle()
|
||||
app.run() # Automatically start() and idle()
|
||||
|
Loading…
Reference in New Issue
Block a user