mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-28 21:07:59 +00:00
Add example on how to handle flood wait errors in the FAQ
This commit is contained in:
parent
8681ca2043
commit
3f17e88836
@ -366,6 +366,20 @@ Having said that, here's some insights about limits:
|
|||||||
- Limits vary based on methods and the arguments passed to methods. For example: log-ins are expensive and thus have
|
- Limits vary based on methods and the arguments passed to methods. For example: log-ins are expensive and thus have
|
||||||
stricter limits; replying to a user command could cause a flood wait in case the user starts flooding, but
|
stricter limits; replying to a user command could cause a flood wait in case the user starts flooding, but
|
||||||
such limit will only be applied to that particular chat (i.e.: other users are not affected).
|
such limit will only be applied to that particular chat (i.e.: other users are not affected).
|
||||||
|
- You can catch Flood Wait exceptions in your code and wait the required seconds before continuing, this way:
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
import time
|
||||||
|
from pyrogram.errors import FloodWait
|
||||||
|
|
||||||
|
try:
|
||||||
|
... # Your code
|
||||||
|
except FloodWait as e:
|
||||||
|
time.sleep(e.x) # Wait "x" seconds before continuing
|
||||||
|
|
||||||
|
|
||||||
|
More info about error handling can be found `here <start/errors>`_.
|
||||||
|
|
||||||
My account has been deactivated/limited!
|
My account has been deactivated/limited!
|
||||||
----------------------------------------
|
----------------------------------------
|
||||||
|
Loading…
x
Reference in New Issue
Block a user