#maybe a bug on the request handler?

33 messages · Page 1 of 1 (latest)

dense hill
#

if discord.js handles the request if the bot will hit the rate limit.
so why this request status is 429

strange anvil
#

maybe you are sending an editing those messages too fast?, iirc sending and editing messages share the same ratelimits

dense hill
native karma
#

BOT d.js docs:

Channel name and topic changes are limited to roughly 2 times per 10 minutes.
If your channel changes are not going through, this might be why.

dense hill
#

i know but if the 429 status is the reponse of the request

#

then the ratelimit event should be triggerd but its not in my case

native karma
#

wym? 429 is the ratelimit?

dense hill
#

yeah according to discord api

#
< Content-Type: application/json
< Retry-After: 1337
< X-RateLimit-Limit: 10
< X-RateLimit-Remaining: 9
< X-RateLimit-Reset: 1470173023.123
< X-RateLimit-Reset-After: 64.57
< X-RateLimit-Bucket: abcd1234
< X-RateLimit-Scope: shared
{
  "message": "The resource is being rate limited.",
  "retry_after": 1336.57,
  "global": false
}```
native karma
strange anvil
native karma
#

It doesn't seem to fire for 429, when doing channel name edits on 13.8.0 either

dense hill
#

yeah i didn't see that till last night i got my bot host server ip banned

#

and decided to log every request

#

"IP addresses that make too many invalid HTTP requests are automatically and temporarily restricted from accessing the Discord API. Currently, this limit is 10,000 per 10 minutes"

wild lava
#

429 responses are avoided by inspecting the rate limit headers documented above and by not making requests on exhausted buckets until after they have reset. 429 errors returned with X-RateLimit-Scope: shared are not counted against you

#

editing channel names is one of those, you can't account for another bot draining the ratelimit bucket

native karma
dense hill
last granite
#

Ur prob editing channel names

#

Discord has a sub-limit specifically for bots when performing said action

dense hill
last granite
#

Can you check if the sublimit appears when using the debug event?

dense hill
#

I'm just checking the response headers and logging them

last granite
#

The debug event should say Hit a 429 while executing a request … Sublimit: 123ms

dense hill
#

Okay I see that but why the rate limit event didn't get triggered

last granite
#

I think I see the issue

#

That sleep would make it so that the request is no longer rate limited, which caused the while loop that emits the rateLimit event to not run

dense hill
#

Yeah so it's a bug on the request handler

last granite
#

Yea

dense hill
#

It need to be fixed