handle rate limit

This commit is contained in:
Casper da Costa-Luis 2024-10-28 00:51:33 +00:00
parent 670840021d
commit 61365d8321
No known key found for this signature in database
GPG Key ID: F5126E5FBD2512AD
1 changed files with 3 additions and 2 deletions

View File

@ -48,8 +48,9 @@ class DiscordIO(MonoWorker):
except Exception as e:
tqdm_auto.write(str(e))
else:
if 'id' not in res:
warn("Message not sent", TqdmWarning, stacklevel=2)
if res.get('error_code') == 429:
warn("Creation rate limit: try increasing `mininterval`.",
TqdmWarning, stacklevel=2)
else:
self._message_id = res['id']
return self._message_id