I'm looking to debug an issue and, for that, I need to know the exact time at which discord.js sends the request to Discord and the exact time it's received at, as well as any rateLimits that occurred in the way. I'm not too familiar with rest so I'd like to know if this is possible and where I can see the history of rateLimits on my code without having to listen to the rateLimit event from rest
#How can I get the precise time at which a request is sent?
14 messages · Page 1 of 1 (latest)
• What's your exact discord.js npm list discord.js and node node -v version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.
There is no history of rate limits stored anywhere
rest events are the closest you'll get unless you want to start diving into internal source code to add additional debugging
response event probably is your best bet here
The only time you can know for certain is the time the bot sends a ping to the server and the time the pong is received by the bot.
there isn't a lot of documentation around this from what I saw, but I assume that event is fired when a response is received? Or is it when it's sent?
yeah I would go into the source code but I need to debug this in production and it's not too easy to change an external package in prod
seems like the response event is emitted when the response is received. I'll try to use that and the rateLimit event to see if I can figure something out
also @crisp moon since you replied to the issue, is that separate handler you mentioned something you're gonna PR into rest or is it something you will use to test yourself?
If you‘re talking about the burst handler, that already has a PR
you can also use diagnostics channel to see when undici sends requests
im not too familiar with how undici works, can you elaborate?
link please