discord.js
discord.js copied to clipboard
add ability to use HTTPOptions/AgentOptions for ShardingManager to use for fetchRecommendedShards
Feature
since cloudflare is being a dick sometimes and bans my bot's IP (error code: 1015, basically 429 too many requests) I have to change my bot's network interface sometimes. while I can do that for my Clients (by setting client.options.http.agent.localAddress
) I cannot select which network interface is used for fetching the recommended amount of shards (through fetchRecommendedShards
) when sharding.
Ideal solution or implementation
a good option would be to add an HTTPOptions
or AgentOptions
like setting to ShardingManagerOptions
, similar to what ClientOptions
has. of course I can use a pre-set amount of shards (totalShards
) which prevents ShardingManager
from making any requests to discord.com over the default network interface, but that seems like a less than ideal solution.
Alternative solutions or implementations
No response
Other context
No response
Why does cloudfare block your requests, any abusing things you are doing?
A easy solution would be, to install node fetch, add the http agent and doing the request manually.
my bot is just very very very popular in short bursts. we usually hit discord's global rate limits thousands times a day before we run into any issues with cloudflare. discord knows this issue and offers rate limit increase for popular bots.
my bot is just very very very popular in short bursts. we usually hit discord's global rate limits thousands times a day before we run into any issues with cloudflare. discord knows this issue and offers rate limit increase for popular bots.
Can you tell me the guilds count for your bot and what kind of bot is exactly?
Can you tell me the guilds count for your bot and what kind of bot is exactly?
30,000 guilds roughly, and it's a bot with a lot of people clicking buttons
Can you tell me the guilds count for your bot and what kind of bot is exactly?
30,000 guilds roughly, and it's a bot with a lot of people clicking buttons
Do you get ratelimited while user clicking a lot of buttons or on any other route?
You should be able to accomplish this as of v14 by just setting the undici dispatcher the REST instance uses using ClientOptions#rest#agent
or Client#rest#setAgent
.