parent
d65f773ed9
commit
dd5bd80017
@ -685,9 +685,6 @@ class Client(Methods, BaseClient):
|
||||
print(e.MESSAGE)
|
||||
self.phone_number = None
|
||||
self.bot_token = None
|
||||
except FloodWait as e:
|
||||
print(e.MESSAGE.format(x=e.x))
|
||||
time.sleep(e.x)
|
||||
else:
|
||||
break
|
||||
|
||||
@ -736,9 +733,6 @@ class Client(Methods, BaseClient):
|
||||
return self.recover_password(recovery_code)
|
||||
except BadRequest as e:
|
||||
print(e.MESSAGE)
|
||||
except FloodWait as e:
|
||||
print(e.MESSAGE.format(x=e.x))
|
||||
time.sleep(e.x)
|
||||
except Exception as e:
|
||||
log.error(e, exc_info=True)
|
||||
raise
|
||||
@ -749,12 +743,6 @@ class Client(Methods, BaseClient):
|
||||
except BadRequest as e:
|
||||
print(e.MESSAGE)
|
||||
self.password = None
|
||||
except FloodWait as e:
|
||||
print(e.MESSAGE.format(x=e.x))
|
||||
time.sleep(e.x)
|
||||
except FloodWait as e:
|
||||
print(e.MESSAGE.format(x=e.x))
|
||||
time.sleep(e.x)
|
||||
else:
|
||||
break
|
||||
|
||||
@ -774,9 +762,6 @@ class Client(Methods, BaseClient):
|
||||
)
|
||||
except BadRequest as e:
|
||||
print(e.MESSAGE)
|
||||
except FloodWait as e:
|
||||
print(e.MESSAGE.format(x=e.x))
|
||||
time.sleep(e.x)
|
||||
else:
|
||||
break
|
||||
|
||||
@ -1636,38 +1621,6 @@ class Client(Methods, BaseClient):
|
||||
log.warning('[{}] No plugin loaded from "{}"'.format(
|
||||
self.session_name, root))
|
||||
|
||||
# def get_initial_dialogs_chunk(self, offset_date: int = 0):
|
||||
# while True:
|
||||
# try:
|
||||
# r = self.send(
|
||||
# functions.messages.GetDialogs(
|
||||
# offset_date=offset_date,
|
||||
# offset_id=0,
|
||||
# offset_peer=types.InputPeerEmpty(),
|
||||
# limit=self.DIALOGS_AT_ONCE,
|
||||
# hash=0,
|
||||
# exclude_pinned=True
|
||||
# )
|
||||
# )
|
||||
# except FloodWait as e:
|
||||
# log.warning("get_dialogs flood: waiting {} seconds".format(e.x))
|
||||
# time.sleep(e.x)
|
||||
# else:
|
||||
# log.info("Total peers: {}".format(self.storage.peers_count))
|
||||
# return r
|
||||
#
|
||||
# def get_initial_dialogs(self):
|
||||
# self.send(functions.messages.GetPinnedDialogs(folder_id=0))
|
||||
#
|
||||
# dialogs = self.get_initial_dialogs_chunk()
|
||||
# offset_date = utils.get_offset_date(dialogs)
|
||||
#
|
||||
# while len(dialogs.dialogs) == self.DIALOGS_AT_ONCE:
|
||||
# dialogs = self.get_initial_dialogs_chunk(offset_date)
|
||||
# offset_date = utils.get_offset_date(dialogs)
|
||||
#
|
||||
# self.get_initial_dialogs_chunk()
|
||||
|
||||
def resolve_peer(self, peer_id: Union[int, str]):
|
||||
"""Get the InputPeer of a known peer id.
|
||||
Useful whenever an InputPeer type is required.
|
||||
|
@ -17,12 +17,10 @@
|
||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import logging
|
||||
import time
|
||||
from typing import List
|
||||
|
||||
import pyrogram
|
||||
from pyrogram.api import functions
|
||||
from pyrogram.errors import FloodWait
|
||||
from ...ext import BaseClient
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
@ -41,11 +39,5 @@ class GetContacts(BaseClient):
|
||||
contacts = app.get_contacts()
|
||||
print(contacts)
|
||||
"""
|
||||
while True:
|
||||
try:
|
||||
contacts = self.send(functions.contacts.GetContacts(hash=0))
|
||||
except FloodWait as e:
|
||||
log.warning("get_contacts flood: waiting {} seconds".format(e.x))
|
||||
time.sleep(e.x)
|
||||
else:
|
||||
return pyrogram.List(pyrogram.User._parse(self, user) for user in contacts.users)
|
||||
contacts = self.send(functions.contacts.GetContacts(hash=0))
|
||||
return pyrogram.List(pyrogram.User._parse(self, user) for user in contacts.users)
|
||||
|
Loading…
Reference in New Issue
Block a user