Discord.Net: ModifyAsync Breaks ratelimit for ANY channel
I have been able to modify a voice channel for the past 6 months with no issues but recently the rate limit has blocked this. i have not changed the code for the modification at all. and its not an issue with more than one instance of the bot, ive tried changing the code but nothing seems to help.
here is my code
private async Task UpdateUserCount(SocketGuildUser arg)
{
try
{
var g = _client.GetGuild(Global.SwissGuildId);
if (g == null)
return;
var users = g.Users;
Global.UserCount = users.Count + 2;
var chan = g.GetVoiceChannel(Global.StatsTotChanID);
if (chan.Name != $"Total Users: {users.Count}")
{
Global.ConsoleLog($"Ucount {users.Count - 20}, usersSCount{users.Count}");
Global.ConsoleLog("Modifying..");
await chan.ModifyAsync(x =>
{
x.Name = $"Total Users: {users.Count}";
}, new RequestOptions() { AuditLogReason = "Update User count." });
Global.ConsoleLog("Completed mod..");
}
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
}
and here is the result of this
ps. the voice channels id is (715943838941970514) which your seeing in the console
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 1
- Comments: 17 (13 by maintainers)
My bot currently updates the channel name every 2 minutes and get rate limits. First it was updating every 30 seconds. I stopped my bot after so many rates I couldn’t do anything, and setting the update interval to 1 minute and still rates. At 2 minutes, rates and guess I will need to delay it even further. I would debug this project, but to busy and lazy to do so. Thanks @quinchs