robertwayne / dpymenus

Simplified menus for discord.py developers.
https://dpymenus.com/
MIT License
26 stars 4 forks source link

Hitting Cloudflare Blocks #60

Closed shubhamshah02 closed 3 years ago

shubhamshah02 commented 3 years ago

Hey there, I am on the latest version of dpymenus and for some reason, I am hitting Cloudflare blocks on my bot. Is there any way to fix this?

robertwayne commented 3 years ago

Are you receiving a specific response error code?

The only way you'd come close to triggering that is if someone was basically spamming reaction-based menus without a cooldown. Remember, every reaction is a single request to the API (as Discord doesn't supply a bulk reaction add endpoint) -- so a menu with 5 buttons is going to be 6 requests (1 for the create message, 5 for add reaction). In addition, I pad requests with a delay so your buttons aren't overflowing the rate limit buckets. But lots of people opening lots of menus would still count toward your global limit per IP.

It's really, really difficult to get yourself Cloudflare banned without having some piece of code that is making a ton of requests a second. You can change your logging level to DEBUG to see each http request you are making. I did double-check my test suite, just to be safe, and I don't see any requests out of the necessary*.

*I did make a change in today's update to prevent one extra request during high latency, however, which may help.

shubhamshah02 commented 3 years ago

Hasn’t happened since again. Thanks!