mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2025-12-29 12:04:51 +00:00
pyrofork: Handle FLOOD_PREMIUM_WAIT
Squashed commit of the following: commit 546b603 commit 0ac858d commit c8a9725 Ref: https://t.me/swiftgram/72 Signed-off-by: wulan17 <wulan17@nusantararom.org>
This commit is contained in:
parent
21de92d909
commit
e414aa2812
3 changed files with 7 additions and 7 deletions
|
|
@ -941,8 +941,7 @@ class Client(Methods):
|
||||||
location=location,
|
location=location,
|
||||||
offset=offset_bytes,
|
offset=offset_bytes,
|
||||||
limit=chunk_size
|
limit=chunk_size
|
||||||
),
|
)
|
||||||
sleep_threshold=30
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if isinstance(r, raw.types.upload.File):
|
if isinstance(r, raw.types.upload.File):
|
||||||
|
|
@ -977,8 +976,7 @@ class Client(Methods):
|
||||||
location=location,
|
location=location,
|
||||||
offset=offset_bytes,
|
offset=offset_bytes,
|
||||||
limit=chunk_size
|
limit=chunk_size
|
||||||
),
|
)
|
||||||
sleep_threshold=30
|
|
||||||
)
|
)
|
||||||
|
|
||||||
elif isinstance(r, raw.types.upload.FileCdnRedirect):
|
elif isinstance(r, raw.types.upload.FileCdnRedirect):
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ class GetChatPhotos:
|
||||||
By default, no limit is applied and all profile photos are returned.
|
By default, no limit is applied and all profile photos are returned.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
``Generator``: A generator yielding :obj:`~pyrogram.types.Photo` | :obj:`~pyrogram.types.Video` objects.
|
``Generator``: A generator yielding :obj:`~pyrogram.types.Photo` | :obj:`~pyrogram.types.Animation` objects.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,9 @@ from pyrogram import raw
|
||||||
from pyrogram.connection import Connection
|
from pyrogram.connection import Connection
|
||||||
from pyrogram.crypto import mtproto
|
from pyrogram.crypto import mtproto
|
||||||
from pyrogram.errors import (
|
from pyrogram.errors import (
|
||||||
RPCError, InternalServerError, AuthKeyDuplicated, FloodWait, ServiceUnavailable, BadMsgNotification,
|
RPCError, InternalServerError, AuthKeyDuplicated,
|
||||||
|
FloodWait, FloodPremiumWait,
|
||||||
|
ServiceUnavailable, BadMsgNotification,
|
||||||
SecurityCheckMismatch
|
SecurityCheckMismatch
|
||||||
)
|
)
|
||||||
from pyrogram.raw.all import layer
|
from pyrogram.raw.all import layer
|
||||||
|
|
@ -403,7 +405,7 @@ class Session:
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
return await self.send(query, timeout=timeout)
|
return await self.send(query, timeout=timeout)
|
||||||
except FloodWait as e:
|
except (FloodWait, FloodPremiumWait) as e:
|
||||||
amount = e.value
|
amount = e.value
|
||||||
|
|
||||||
if amount > sleep_threshold >= 0:
|
if amount > sleep_threshold >= 0:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue