discord / discord-api-docs

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

Unavoidable rate limit when operating anti spam bot #5002

Open xPolar opened 2 years ago

xPolar commented 2 years ago

Description

I run an anti raid bot called Beemo Helper which is a third-party extension of Beemo, the two thousand nonmember ban limit prevents me from dealing with raids as sometimes just when I ban users they leave the server and I get rate limited. So I was hoping a skip parameter could be introduced to the ban endpoint to skip nonmember bans and thus not get rate limited.

Steps to Reproduce

Encounter large bot raid where they leave right after sending their spam.

Expected Behavior

You're able to ban all of the raiders.

Current Behavior

You get rate limited after two thousand bans and none of the integrations within the server can ban either.

Screenshots/Videos

No response

Client and System Information

Discord's API

Jupith commented 2 years ago

+1 a parameter to skip bans if its going to result in the non member ban counter incrimenting would be great.

wasdennnoch commented 2 years ago

Adding additional context, especially for the named use case (antiraid bots) it would be a huge plus being able to avoid hitting this rate limit. Sometimes, especially in big raids, due to various latencies and request queueing, you can't be fully sure if a user is actually still a guild member by the time the ban request is sent. Even if you try to GET /members/:id before every ban, there is still a real chance the user has left the guild in the time between discord sending the member response, you receiving it, sending the ban request, and discord receiving and processing the ban request, be it because they left by themselves or because another bot kicked/banned them in the mean time.

We aren't intentionally trying to get the ban list is large as possible, but once you encounter the largest of raids, have multiple bots working on the problem and factor in latency, accidental non-member bans are pretty much guaranteed and impact all bots in the entire guild - possibly also moderators who can't ban users using their moderation bots anymore for the next 24h. And, even worse, if your guild happens to run into this limit you don't even know which bot caused it.

We'd love to see a proper way to avoid non-member bans to not run into such situations.

erkinalp commented 2 years ago

We'd love to see a proper way to avoid non-member bans to not run into such situations.

The proper way would be to lift the nonmember ban rate limit and instead limit the total number of bans per guild, monotonously increasing with guild age and member count.

jdongdiscord commented 2 years ago

Synced to "Rate limit related items" main task.