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

Ratelimit Headers #17

Open
sudojunior opened this issue Sep 16, 2022 · 0 comments
Open

Ratelimit Headers #17

sudojunior opened this issue Sep 16, 2022 · 0 comments

Comments

@sudojunior
Copy link
Member

RequestHandler was built to built to handle memory storage of the token without having to pass it through the method arguments each time, and as a way to only provide what was needed to the action flow itself.

Despite that, it has no idea what ratelimit headers mean - nor how to handle them.

4 requests are made to Discord, all on a different API route.

  • GET /users/@me - Checking that the token works, and getting the ID of the authenticated user for later
  • GET /guilds/{guildID} - Checking that the guild exists and that the authenticated user is a member (also uses role data for permission and hierarchy checks)
  • GET /guilds/{guildID}/members/{userID} - We know that the user exists, but we didn't have their ID before starting so that's used here.
  • PATCH /guilds/{guildID}/roles/{roleID} - The final request to update the role with its new color and name.

While the request to fetch the data for the randomly chosen colour is outside the scope of this issue, it would be worth considering if it should reside in the request handler as it's own method (and also allowing for the payload to be trimmed only to what is needed).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant