discord / discord-api-docs

Official Discord API Documentation
https://discord.com/developers/docs/intro
Other
5.95k stars 1.26k forks source link

POST /guild/{guild.id}/emojis has one-hour rate limits #2250

Closed ioistired closed 3 years ago

ioistired commented 3 years ago

Description

I would like to see the guild emoji rate limit special casing lifted, and replaced with something much closer to the rate limits that users receive. Maybe not quite as lax as the user rate limits, but 3600 seconds is unacceptable.

Why This is Needed

I have a bot which acts as an alternative frontend for the Server Settings → Emojis pane. It supports some features that the official client doesn't support, like copying emojis without downloading them first, and importantly, importing a zip file of images. It is this last command that's a problem for my users. The bot is only able to add a few emojis before getting rate limited for half an hour to an hour. This is frustrating for my users, and they often kick the bot and re-invite it to try and fix the issue, or believe it to be broken. The only proper solution is to wait it out, defeating the purpose of the bot and forcing them to use the emoji settings pane.

Alternatives Considered

  1. Cancel the interaction after a timeout has passed. While this doesn't mislead people, it defeats the purpose of the bot as mentioned.
  2. Allow the user to cancel. Has the same problems as ①.
  3. Subvert the rate limit using "minion" bots. My bot grows rapidly, and seeing as these are against TOS, they would not be verified. Assuming every new guild adds one minion bot, given my current growth rate and the application limit of 25 apps per Discord account, that would mean I'd have to create a new discord alt every 30 days. I have enough alts as it is.

Remarks

The docs state:

Routes for controlling emojis do not follow the normal rate limit conventions. These routes are specifically limited on a per-guild basis to prevent abuse. This means that the quota returned by our APIs may be inaccurate, and you may encounter 429s.

However, it's not clear what kind of abuse this is. Conceivably it's to disable "fake nitro" bots, in order to encourage people to buy Nitro instead, but all of the fake nitro bots I know of do one of two things:

  1. Add all user-submitted emojis to their own, internal, managed guilds, and hop between them round-robin, thereby distributing the rate-limit load across all.
  2. Require that users add emojis to their own guilds, and pool emojis from all guilds the bot is in, regardless of who owns the guilds.

So it seems that the only kinds of bots that these special-cased rate limits prevent, are ones like mine, which only let you manage your own guilds. The use case for this kind of bot is actually not that useful for someone who doesn't have Nitro. It's most useful for people who already have nitro and are using the bot to manage, for example, their own dedicated emote guild, or are trying to salvage all emotes from a guild on the brink of deletion. On the other hand, users of a "fake nitro" bot do not care what server the emojis came from, all they care about is that the bot is able to use emojis on their behalf, so the bot can pull any kinds of tricks it wants to circumvent this RL.

muddyfish commented 3 years ago

I'm pretty sure the hour rate limit is actually shared between accounts, so your minion solution wouldn't be applicable. For my own web console/bulk upload commands, I've got my bot to explain the issue in full, including about how it can only upload 50 an hour and to try again in however long.

Also, I have a bot which tries to automatically populate an entire server's worth of emotes in one go - would it be possible to change the limit from 50 to 100 given that brand-new servers can have 100 emotes uploaded?

ioistired commented 3 years ago

I've got my bot to explain the issue in full

Would you mind sharing your code for that? I'm just curious.

would it be possible to change the limit from 50 to 100 given that brand-new servers can have 100 emotes uploaded?

Or perhaps make the rate limit scale based on how many slots the guild has.

ryleu commented 3 years ago

I'm trying to make basically the exact same bot, but I couldn't find how long the ratelimit is in the docs. Could it at least be shown there?