You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Occasionally, rate limits result in errors instead of warnings. In this case the request is not rescheduled.
Reproduction Steps
For testing, a simple bot is created that will await message.delete() when on_message(message) is called.
Users will produce simulated spam in an attempt to overwhelm the API rate limit.
The bot will re-schedule all DELETE requests that are missed while the bot was rate limited WARNING discord.http We are being rate limited. DELETE https://discord.com/api/v10/channels/XXXXXXXXXX/messages/XXXXXXXXXX responded with 429. Retrying in 0.XX seconds.
Actual Results
For some few messages, instead of deleting the message, the following error message is displayed
ERROR discord.client Ignoring exception in on_message
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/discord/client.py", line 441, in _run_event
await coro(*args, **kwargs)
File "//./bot.py", line 20, in on_message
await message.delete()
File "/usr/local/lib/python3.10/site-packages/discord/message.py", line 841, in delete
await self._state.http.delete_message(self.channel.id, self.id)
File "/usr/local/lib/python3.10/site-packages/discord/http.py", line 759, in request
raise HTTPException(response, data)
discord.errors.HTTPException: 429 Too Many Requests (error code: 0): You are being rate limited.
Intents
discord.Intents.all()
System Information
- Python v3.10.11-final
- discord.py v2.2.3-final
- aiohttp v3.8.4
- system info: Linux 5.15.0-71-generic #78-Ubuntu SMP Tue Apr 18 09:00:29 UTC 2023
Checklist
I have searched the open issues for duplicates.
I have shown the entire traceback, if possible.
I have removed my token from display, if visible.
Additional Context
No response
The text was updated successfully, but these errors were encountered:
This sounds like a bad idea. If you're consistently reaching the only code path that can have this happen, you're getting a 429 without at least some of the ratelimit info, see:
And it's likely a Cloudflare 429 from other times people have hit this. There's no good way to reschedule this even if it did make sense at that point, and it's better to error out when you've got a pathological case that got picked up by cloudflare than to keep trying anyhow.
My concern is that I was able to trigger this condition with a single user (On a different network/ IP). Using a bot for moderation, it is safe to assume that even a server with a dozen or so online users would overwhelm the bot easily. That doesn't make sense, how are other unverified bots able to avoid this issue?
Summary
Occasionally, rate limits result in errors instead of warnings. In this case the request is not rescheduled.
Reproduction Steps
For testing, a simple bot is created that will await message.delete() when on_message(message) is called.
Users will produce simulated spam in an attempt to overwhelm the API rate limit.
Minimal Reproducible Code
Expected Results
The bot will re-schedule all DELETE requests that are missed while the bot was rate limited
WARNING discord.http We are being rate limited. DELETE https://discord.com/api/v10/channels/XXXXXXXXXX/messages/XXXXXXXXXX responded with 429. Retrying in 0.XX seconds.
Actual Results
For some few messages, instead of deleting the message, the following error message is displayed
Intents
discord.Intents.all()
System Information
Checklist
Additional Context
No response
The text was updated successfully, but these errors were encountered: