From 3f17e88836a34e3806950d60e24b91e515e86b42 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Wed, 1 Apr 2020 18:01:10 +0200 Subject: [PATCH] Add example on how to handle flood wait errors in the FAQ --- docs/source/faq.rst | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/docs/source/faq.rst b/docs/source/faq.rst index 80df70b5..32827c76 100644 --- a/docs/source/faq.rst +++ b/docs/source/faq.rst @@ -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 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). +- 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 `_. My account has been deactivated/limited! ----------------------------------------