diff --git a/Justice/Commands/Settings.cs b/Justice/Commands/Settings.cs index 5566e7c..a38407c 100644 --- a/Justice/Commands/Settings.cs +++ b/Justice/Commands/Settings.cs @@ -17,7 +17,7 @@ namespace DiscordApp.Discord.Commands [DefaultMemberPermissions(GuildPermission.Administrator)] public async Task addAutoBranches(IChannel channel, string branchName = "Обсуждение") { - //await DeferAsync(true); + await DeferAsync(true); Autobranches autobranches = new() { ChannelId = channel.Id, diff --git a/Justice/Interactions/BiznessInteractions.cs b/Justice/Interactions/BiznessInteractions.cs index bb6ba88..74c2a37 100644 --- a/Justice/Interactions/BiznessInteractions.cs +++ b/Justice/Interactions/BiznessInteractions.cs @@ -18,8 +18,9 @@ namespace DiscordApp.Justice.Interactions [ModalInteraction("newIndividualEterpreneurModal")] public async Task newIndividualEterpreneur(INewIndividualEntrepreneur modal) { - - Passport? applicant = await Startup.appDbContext.Passport.FindAsync(int.Parse(modal.passportId)); + await DeferAsync(true); + Passport? applicant = Startup.appDbContext.Passport.FirstOrDefault(k => k.Id == int.Parse(modal.passportId)); + await Console.Out.WriteLineAsync(applicant.ToString()); if (applicant == null) { await FollowupAsync("Ошибка! Такого паспорта не существует. Попробуйте старого бота.", ephemeral: true); diff --git a/JusticeHandler.cs b/JusticeHandler.cs index 215c0e7..046dfe6 100644 --- a/JusticeHandler.cs +++ b/JusticeHandler.cs @@ -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); + } } }