robertwayne / dpymenus

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

reactions tempban #44

Closed InspiredImpact closed 3 years ago

InspiredImpact commented 3 years ago

Hi, can you please tell me what to do if it temporarily blocks discord when using your library? I have a timeout for 90 seconds, I don't work with reactions anywhere else

WARNING:discord.http:We are being rate limited. Retrying in 0.08 seconds. Handled under the bucket "776763204285235220:None:/channels/{channel_id}/messages/{message_id}/reactions/{emoji}/@me"

robertwayne commented 3 years ago

How many buttons are you using? Generally adding reactions is what gets you bucketed, as it's roughly 1 per 0.25s per channel, if I remember correctly.

discord.py handles this internally, though, so you're not actually being stopped by Discord -- discord.py protects you before you ever hit the real servers. The requests will just sit in the dpy bucket and execute when it is safe to make your request again.

InspiredImpact commented 3 years ago

I use 5 buttons in ButtonMenu

robertwayne commented 3 years ago

There isn't anything you can do, as the bot will always try to add them faster than the limit allows. This happens with or without this library when you try adding lots of reactions to a message.

You can basically ignore it. Just know that your last button will always be slightly slower to show up.

Like I mentioned above, discord.py is built to bucket your requests before sending them, so it will delay your reaction adds until your bot can safely add it to a message. It would be no different than delaying them yourself, hence why I don't delay them internally either. EDIT: It's also why the logger for this lib will warn users if they add more than 5 buttons to a menu, as things will be throttled. It isn't dangerous, but it isn't a great user experience depending on how slow it gets.

InspiredImpact commented 3 years ago

understood thanks, it turns out the more the command will be used, the more dpy will delay the addition of buttons?

robertwayne commented 3 years ago

Basically. Discords rate limits are dynamic, but going by what I know, reaction add/delete is per channel. So you should be fine if the menus are being opened on different channels. EDIT: Up to a point, then you worry about the global rate limit which I think is 50 requests per second.

InspiredImpact commented 3 years ago

okay, thank you again!