This commit is contained in:
Дмитрий Шиманский
2023-11-13 07:42:15 +03:00
parent 119e367e56
commit f9cd50d646
3 changed files with 15 additions and 8 deletions

View File

@@ -47,11 +47,17 @@ namespace DiscordApp
await handler.RegisterCommandsGloballyAsync(true);
while (true)
{
var request = await http.GetAsync("https://api.mcsrvstat.us/3/pl.spworlds.ru");
JsonNode responseAboutPL = JsonNode.Parse(request.Content.ReadAsStringAsync().Result);
if (responseAboutPL["online"].Equals("false")) await client.SetGameAsync($"выключенный PL", "https://yaflay.ru/", ActivityType.Watching);
else await client.SetGameAsync($"онлайн на PL: {responseAboutPL["players"]["online"]}", "https://yaflay.ru/", ActivityType.Watching);
await Task.Delay(30000);
try
{
var request = await http.GetAsync("https://api.mcsrvstat.us/3/pl.spworlds.ru");
JsonNode responseAboutPL = JsonNode.Parse(request.Content.ReadAsStringAsync().Result);
if (responseAboutPL["online"].Equals("false")) await client.SetGameAsync($"выключенный PL", "https://yaflay.ru/", ActivityType.Watching);
else await client.SetGameAsync($"онлайн на PL: {responseAboutPL["players"]["online"]}", "https://yaflay.ru/", ActivityType.Watching);
}
finally
{
await Task.Delay(30000);
}
}
}