Closed lostful closed 4 years ago
are you sure you aren't ratelimited? have you checked the Client#ratelimit
event? this sounds like a ratelimit issue
I am definitely not ratelimited. I have tried it with multiple bots all on 3 different hosts.
I have same problem, but with channels. I think it's problem with performance degradation on some Discord API proxy servers. Request is hanging. With different bot processed immediately; try to create new bot, if you have it just for several servers.
I don't know why timeout not occurred via Discord.js https://github.com/discordjs/discord.js/blob/2b6e6d86310a9f9fc4293c2f76f37690db9003e4/src/rest/APIRequest.js#L54-L62 Hanging for more than 1 min (sometimes 5-10-15). Latest commit: 2b6e6d86310a9f9fc4293c2f76f37690db9003e4
const Discord = require('discord.js');
const client = new Discord.Client();
client.on('error', (error) => {
console.log("Error d.js!");
});
process.on('unhandledRejection', function (reason, p) {
console.log("Possibly Unhandled Rejection at: Promise ", p, " reason: ", reason);
});
process.on('uncaughtException', function (err) {
console.log('Caught exception: ', err);
});
client.on('ready', async () => {
await (await client.channels.fetch('0000')).setName("tttt");
console.log("Done.");
});
client.on('ratelimit', (rateLimitInfo) => {
console.log("RateLimit!");
});
client.login('000');
@AkaEthan101 different bots and hosts are irrelevant here - rate limits are in relation to the rate at which your bot, any of the bots, makes requests. If any of your three bots are attempting to modify roles too quickly, exceeding the rate limit, the behaviour you observed will occur.
@xonrsoftware Discord changed the rate limits on editing channel names and topic to 2/10 minutes. Any attempt to edit the channel more often than this will be queued by discord.js until the rate limit timeout duration is complete.
@monbrey, where it's officially announced? Can't find.
See #4327
I have a bot managing a 42,000 member discord. This problem also occurs, but it is very rare. It has only happened 5 times in the last 7,000 role assignments.
The last event happened this morning. Noteably this was a roles.remove request rather than roles.add.
My suspicion is a caching issue, but I am not familiar with the caching strategy to come to any firm conclusions yet. In the meantime I will keep collecting data on this.
@monbrey It's not ratelimits though because I've been waiting for 2 days and it's still not working..
We've just had 3 new occurrences of this coupled with a spike in new members to the server. 2k new members. it seems to occur more in times of peak API load
Panic over, turns out as though I was indeed ratelimited. This was due to a loop running every 30 seconds that had a lot of code inside.
So when I make the bot add a role with some code, it adds it 5 minutes later. Does anyone know why? I am not ratelimited and I have no restrictions or anything. There are also no errors.
Here is my code:
Further details: