question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ModifyAsync Breaks ratelimit for ANY channel

See original GitHub issue

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

image

ps. the voice channels id is (715943838941970514) which your seeing in the console

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:17 (13 by maintainers)

github_iconTop GitHub Comments

2reactions
segg21commented, May 31, 2020

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

0reactions
quinchscommented, May 31, 2020

@LegitSoulja no problem 😕 hopefully they change that

Read more comments on GitHub >

github_iconTop Results From Across the Web

Discord.net 1.0 - How to get Messages to delete?
1) Deleting many messages individually in a loop will cause a very unpleasant rate limit exception. var messages = await msg.Channel.
Read more >
Changelog
Guilds utilizing Channel Categories will no longer crash bots on the READY event. [1.0.1] - 2017-07-05. Fixed. #732: Fixed parameter preconditions not being ......
Read more >
IPWorks 2022 .NET Edition Reference
The Lightweight Directory Access Protocol (LDAP) Component is used to search, manage, ... MaxTransferRate, The transfer rate limit in bytes per second.
Read more >
Rate Limits | Slack
This article gives an overview of the rate limits you're likely to encounter for Slack platform features, and then notes how the limits...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found