C
C#2y ago
YS Speedy

❔ Ratelimit

Hello, i am currently trying to program a discord bot. Ive created a method to track how many players are online on a minecraft server using MinecraftPinger API and then editing a voice channel to the number of players that are online. I have tried it with several diffrent delays, but none worked. Any help is appreciated!
public static class OnlinePlayersVC
{
public static async Task StartOnlinePlayersTracker(DiscordClient client)
{
DiscordChannel voiceChannel = await client.GetChannelAsync(MinecraftSettings.PlayerCountVC);
MinecraftPinger server = new("88.99.216.40", 25574);

while (true)
{
var status = await server.PingAsync();
await voiceChannel.ModifyAsync(x => x.Name = "Online players: " + status.Players.Online.ToString());
await Task.Delay(10000);
}
}
}
public static class OnlinePlayersVC
{
public static async Task StartOnlinePlayersTracker(DiscordClient client)
{
DiscordChannel voiceChannel = await client.GetChannelAsync(MinecraftSettings.PlayerCountVC);
MinecraftPinger server = new("88.99.216.40", 25574);

while (true)
{
var status = await server.PingAsync();
await voiceChannel.ModifyAsync(x => x.Name = "Online players: " + status.Players.Online.ToString());
await Task.Delay(10000);
}
}
}
13 Replies
Sossenbinder
Sossenbinder2y ago
What didn't work exactly?
YS Speedy
YS SpeedyOP2y ago
Everything works, the VC gets edited and it tracks the right amount of players - its just that i get follwoing error message:
[Error] Ratelimit hit, requeueing request to https://discord.com/api/v10/channels*************
[Error] Ratelimit hit, requeueing request to https://discord.com/api/v10/channels*************
Sossenbinder
Sossenbinder2y ago
I see - That means that you end up sending too many requests to the discord API apparently Is there a public documentation how many it can take?
YS Speedy
YS SpeedyOP2y ago
I dont know i coudnt find any i searched google and asked openai but i coudnt find anything
Sossenbinder
Sossenbinder2y ago
I found something here: "you can edit a channel by a bot every 5th minute" What delays did you try already?
YS Speedy
YS SpeedyOP2y ago
Longest i tried was 2 mins tbh
Sossenbinder
Sossenbinder2y ago
YS Speedy
YS SpeedyOP2y ago
Where did u find this if i am allwoed to ask?
Sossenbinder
Sossenbinder2y ago
GitHub
[Bug]: Rate limited while calling ModifyAsync on Message · Issue #2...
Check The Docs I double checked the docs and couldn't find any useful information. Verify Issue Source I verified the issue was caused by Discord.Net. Check your intents I double checked th...
Sossenbinder
Sossenbinder2y ago
I checked the Discord.Net issues because I was curious if the response objects of the library might contain ratelimit information But I found this instead
YS Speedy
YS SpeedyOP2y ago
Well, thank you very much!
Sossenbinder
Sossenbinder2y ago
Yw 🙌
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server