CRBT-Team/Purplet

Rest: Rate limiting issues on Bearer token requests

paperclover opened this issue · 6 comments

reported by hycord via discord

const restClient = new Rest({ token: access_token, tokenType: token_type })
  let userData = {};
  try {
  console.log('restClient > getCurrentUser : getCurrentUser()')
  userData = await restClient.user.getCurrentUser() } catch (e) {
    return {
      status: e.status,
      body: { message: e.message }
    }
  }
  console.log('restClient > getCurrentUser : getCurrentUserGuilds()')
  userData.guilds = (await restClient.user.getCurrentUserGuilds()).sort((a) => a.owner ? -1 : 0);

for some reason it is throwing rate limit on getCurrentUserGuilds

I am also reminded I never handled global rate limiting so lol

I thought I broke something lmao

seems to be stuff with bearer token requests which isn't something I widely tested. gotta see if these share with other bearer tokens from the same bot and so on.

https://discord.com/developers/docs/topics/oauth2#client-credentials-grant

Good for testing oAuth Bearer tokens

I just realized are these routes even exposed by our thing because they're not written as actual endpoints

yes 🕺🏼

this is a rounding issue and a fix has been implemented in an upcoming pr.