Editing a message gets slower with time
Hello, i'm currently making a discord bot. Basically, all the bot needs to do is to edit a message every 1.1 second (to not get rate limited ). The problem with that is : The first hour, the requests my bot's sending to discord takes approximately 200 ms but past this first hour or so the requests gets slower (between 5 and 6 seconds)
21 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button![email protected]
v18.16.0
you are getting rate limited, i dont know from where did you get that editing messages with 1.1 seconds of delay will help you avoid rate limits
do you have a detailed explanation of what the rate limit is??
i can't find it
From what i understand, the bot can send 5 request every 5 seconds
rate limits are not public information
and they are also dynamic
Ratelimits are dynamically assigned by the API based on current load and may change at any point.
- The scale from okay to API-spam is sliding and depends heavily on the action you are taking
- Rainbow roles, clock and counter channels, and DM'ing advertisements to all members are all examples of things that are not okay
I've got logs, and there's not any warnings about rate limit
where do you have logs
try this
Please add the following code to your code base outside of any other event listeners and provide the full log output relevant to your issue.
- Note: if you initialize your Client as
bot
or other identifiers you need to use these instead of client
- If the output is too long to post consider using a bin instead: gist | paste.gg | sourceb.in | hastebinwhenever your bot slows down editing messages check the console and see what it shows
that's what i do to get logs :
im gonna try
I used to have a "rate limited" warn. But with the 1.1 second delay i don't have it anymore
the 5 - 6 second delay you describe does sound like a ratelimit on the channel messages endpoint
it does, but the warn doesn't show up in my logs that's my problem, i can't fix the problem if i don't know what it is
xD
Do you know where i can find rate limit for each endpoint?
i just told you that ratelimits are not public information
ok gotchu sorry
debug it with the thing i suggested and see if that shows something
forgot that u said that
if it doesnt then its gonna be tricky
i doubt is a library issue though but we will see
its ratelimit
here are my logs after an hour
so everything works perfectly fine for 1 hour, but past that, it takes longer to send a request
was ratelimit in discord js 13 but now it's ratelimited
this doesnt look like the logs from debug or warn
these are your logs, this doesnt help
hmm... it is weird though
i do see the heartbeat in your logs so uh i guess it is logging debug events, weird that the ratelimit is not showing there... unless its not supposed to, im not entirely sure on this one :/