Closed ca10s closed 1 year ago
Having the pre-emptive rate limit renaming the channel but timing out the interaction afterwards somewhat breaks the workflow in my app.
Channel name and topic edits have a 2/10 minutes rate limit so it's waiting 10 minutes. The interaction token is only valid for 15 minutes so it expires. Discord does not like apps that rename channels constantly, so what you're doing is frowned down upon.
Is there a reason why both the pre-emptive and "hard" rate limiting don't raise an exception but wait for the rate limit time to pass?
Most rate limits are not long. Someone sending a message would be pretty annoyed if they ended up having an exception raised when the proper way to deal with it is just waiting for the rate limit to be over. In fact that's the way to go for a vast majority of rate limits, well over 99% of them.
Raising an exception right away would make it possible to do some internal cleanup in my app and/or send a message to the user like "try again later"
If you want to toggle the maximum timeout before raising discord.RateLimited
(new in v2.0) then you can set max_ratelimit_timeout
in Client.__init__
to some value you think is too long. For example 5 minutes or something.
Summary
Function returns only after 10 minutes and timeouts interaction after calling edit() on a TextChannel twice in a short period of time
Reproduction Steps
The Code snippet below creates a simple command to change the name of a channel.
Minimal Reproducible Code
Expected Results
The channel gets renamed again and the execution of on_submit continues right away
Actual Results
The channel gets renamed but the Modal does time out and the log only shows "after edit" only after 10 minutes.
Intents
discord.Intents.default()
System Information
Checklist
Additional Context
As far as I know the rate limit for editing channel names is 2 times within 10 minutes so the second edit shouldn't hit the rate limit. Based on that I read through all the debug output and found the following lines for the second edit:
and 10 minutes later:
Having the pre-emptive rate limit renaming the channel but timing out the interaction afterwards somewhat breaks the workflow in my app.
Another question that came to my mind: Is there a reason why both the pre-emptive and "hard" rate limiting don't raise an exception but wait for the rate limit time to pass? Raising an exception right away would make it possible to do some internal cleanup in my app and/or send a message to the user like "try again later"