javascript - Discord.js Rate Limit Delay - Stack Overflow

Before you read the question, I would like to inform you that I'm not intrested in mand cooldown t

Before you read the question, I would like to inform you that I'm not intrested in mand cooldown thing and this question is not connected to it.

Since my friend server got raided about 30 times last week I stared wondering about writing a bot in js using discord.js v12...


But...
I couldn't find a way to get over Discord rate limit. By that I mean so if the action of the bot is rejected bcs of rate limit the bot will wait for those 5 seconds and would go again with the action.

So, let me explain it a little further with an example:
20 raiders started spamming with pings etc. bot detected that but after few bans meets the rate limit, and since we don't want to just spam discord API and keep receiving messages about rate limiting I wonder if we could slow it down a little so the bot would ban 1 pearson from those 20 per second or get info how much do we need to wait after receiving rate limit message and resuming actions after the time we had to wait
Yeah I know that this may be quite slow but at least will work...

Sorry for over plicating this a little ^-^"

Before you read the question, I would like to inform you that I'm not intrested in mand cooldown thing and this question is not connected to it.

Since my friend server got raided about 30 times last week I stared wondering about writing a bot in js using discord.js v12...


But...
I couldn't find a way to get over Discord rate limit. By that I mean so if the action of the bot is rejected bcs of rate limit the bot will wait for those 5 seconds and would go again with the action.

So, let me explain it a little further with an example:
20 raiders started spamming with pings etc. bot detected that but after few bans meets the rate limit, and since we don't want to just spam discord API and keep receiving messages about rate limiting I wonder if we could slow it down a little so the bot would ban 1 pearson from those 20 per second or get info how much do we need to wait after receiving rate limit message and resuming actions after the time we had to wait
Yeah I know that this may be quite slow but at least will work...

Sorry for over plicating this a little ^-^"

Share Improve this question edited Feb 8, 2021 at 1:46 Hakunek asked Feb 8, 2021 at 1:39 HakunekHakunek 231 silver badge6 bronze badges 1
  • If you're looking for general rate limits you could ask in the Discord API official server. However, you should focus on better server security to prevent such raids. Otherwise just set up a bot that will take in manual input to ban 1 member at a time. – Elitezen Commented Feb 8, 2021 at 2:24
Add a ment  | 

1 Answer 1

Reset to default 4

I don't have a turnkey solution for you, but here are some resources to check out that could help you:

  • https://discord.js/#/docs/main/v12/class/Client?scrollTo=e-rateLimit

  • https://discord./developers/docs/topics/rate-limits

Rate limits are dynamic, hence the "rateLimit" event of the library could be of use to you.

However, I had the notion discord.js natively handled rate limits by queuing actions accordingly (see here), so I'm unsure you have to handle this by yourself.

By the way, useful resources if you are a beginner with discord.js: https://discordjs.guide/

PS: You could also step up the verification level of your server. It probably would be both more easy and effective.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744716395a4589643.html

相关推荐

  • javascript - Discord.js Rate Limit Delay - Stack Overflow

    Before you read the question, I would like to inform you that I'm not intrested in mand cooldown t

    22小时前
    30

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信