Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Rest] Full support for using multiple bot tokens #3137

Open
Tracked by #3270
AwesomeStickz opened this issue Sep 21, 2023 · 2 comments · May be fixed by #3185
Open
Tracked by #3270

[Rest] Full support for using multiple bot tokens #3137

AwesomeStickz opened this issue Sep 21, 2023 · 2 comments · May be fixed by #3185
Labels
w-pending This depends on a different Issue/PR being resolved
Milestone

Comments

@AwesomeStickz
Copy link
Member

AwesomeStickz commented Sep 21, 2023

Currently, you can have a rest proxy and have your bot send requests to Discord API through that, and with #3122, you can now have a single rest proxy for multiple bots. This is great, however, there's a few things to be addressed to make this truly reliable for multiple bots:

Ratelimit handling:

Current behavior is assuming we use only one token, thus ratelimit handling is done in one place only. But we need a way for ratelimits to be stored and handled individually for different bot tokens used by rest requests, so that they all can utilize their individual limits fully. As an example, with the current implementation, if there are 5 bots trying to send a message in the same channel using the same rest proxy, they can only send 5 messages per 5 secs but if the ratelimit handling is split individually for as many bot tokens used, they can send 25 messages per 5 secs (5 per bot). So they'll basically have to have different ratelimit data stored for different tokens and also global ratelimit should only affect a single bot and not all bots.

Invalid Requests handling:

I believe current implementation might not need much changes regarding this but while making a PR to do ratelimit handling individually, it should be made sure that it doesn't end up having different invalid requests tracker, this must continue to remain global, as invalid requests for the cloudflare ban is based on IP and not token.

Copy link

github-actions bot commented Dec 1, 2023

This issue has gone stale for over a month. If this issue is useful, leave a comment below. Otherwise, it will be closed shortly.

@Fleny113
Copy link
Contributor

Fleny113 commented Dec 1, 2023

In pr #3185 all the queues and ratelimit information are prefixed by the authentication being used. So, it might also address this issue as a rest proxy for example could use the Authorization header (changing the proxy auth header) to be able handle the ratelimit for all the tokens propriety

@H01001000 H01001000 added this to the v19 milestone Dec 7, 2023
@AwesomeStickz AwesomeStickz added the w-pending This depends on a different Issue/PR being resolved label Dec 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
w-pending This depends on a different Issue/PR being resolved
Projects
None yet
3 participants