From 61365d8321ae4ca433d2c6cda770a73a8e0e62cb Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Mon, 28 Oct 2024 00:51:33 +0000 Subject: [PATCH] handle rate limit --- tqdm/contrib/discord.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tqdm/contrib/discord.py b/tqdm/contrib/discord.py index 59d63e18..d3e94284 100644 --- a/tqdm/contrib/discord.py +++ b/tqdm/contrib/discord.py @@ -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