I've been working on a bot and I left it for a while, but when I came back I realized that messages (sending, not recieving) were sending much later than I expected. I inserted a console.time measurement and it took anywhere from 10 seconds to beyond 2 minutes for the message.reply, interaction.reply or message.channel.send to finish when awaited .
I used the following code posted by someone to see why this was happening:
client.rest.on('rateLimited', (rateLimitData) => {
console.log(`Rate Limit Event`);
console.log(`\tlimit: ${rateLimitData.limit}`);
console.log(`\ttimeToReset: ${rateLimitData.timeToReset}`);
console.log(`\turl: ${rateLimitData.url}`);
});
and when I sent the message, I'd get these rate limit warnings (img attached).
I don't know if they're related but it'd be great if someone could tell me what to fix or look out for. My bot only gets used by me and a couple of my friends in one server, so there shouldn't be a reason to hit rate limits. I've already tried resetting my token.