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:
shriMADhav U k 2024-05-14 21:36:56 +02:00 committed by wulan17
parent 21de92d909
commit e414aa2812
No known key found for this signature in database
GPG key ID: 318CD6CD3A6AC0A5
3 changed files with 7 additions and 7 deletions

View file

@ -941,8 +941,7 @@ class Client(Methods):
location=location,
offset=offset_bytes,
limit=chunk_size
),
sleep_threshold=30
)
)
if isinstance(r, raw.types.upload.File):
@ -977,8 +976,7 @@ class Client(Methods):
location=location,
offset=offset_bytes,
limit=chunk_size
),
sleep_threshold=30
)
)
elif isinstance(r, raw.types.upload.FileCdnRedirect):

View file

@ -50,7 +50,7 @@ class GetChatPhotos:
By default, no limit is applied and all profile photos are returned.
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:
.. code-block:: python

View file

@ -29,7 +29,9 @@ from pyrogram import raw
from pyrogram.connection import Connection
from pyrogram.crypto import mtproto
from pyrogram.errors import (
RPCError, InternalServerError, AuthKeyDuplicated, FloodWait, ServiceUnavailable, BadMsgNotification,
RPCError, InternalServerError, AuthKeyDuplicated,
FloodWait, FloodPremiumWait,
ServiceUnavailable, BadMsgNotification,
SecurityCheckMismatch
)
from pyrogram.raw.all import layer
@ -403,7 +405,7 @@ class Session:
while True:
try:
return await self.send(query, timeout=timeout)
except FloodWait as e:
except (FloodWait, FloodPremiumWait) as e:
amount = e.value
if amount > sleep_threshold >= 0: