add base on map registration

This commit is contained in:
Дмитрий Шиманский
2023-11-16 19:08:16 +03:00
parent f9cd50d646
commit b8db704fef
14 changed files with 661 additions and 37 deletions

View File

@@ -51,7 +51,8 @@ namespace DiscordApp
{
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);
bool result;
if (bool.TryParse(responseAboutPL["online"].ToString(), out result) || result) await client.SetGameAsync($"выключенный PL", "https://yaflay.ru/", ActivityType.Watching);
else await client.SetGameAsync($"онлайн на PL: {responseAboutPL["players"]["online"]}", "https://yaflay.ru/", ActivityType.Watching);
}
finally