YS Speedy
YS Speedy
CC#
Created by YS Speedy on 1/19/2023 in #help
❔ 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);
}
}
}
18 replies