From 5f4ca8284175ade209d280f7924ca7c195cb5d66 Mon Sep 17 00:00:00 2001 From: Sella-GH <147769367+Sella-GH@users.noreply.github.com> Date: Sun, 29 Dec 2024 01:17:40 +0100 Subject: [PATCH 1/5] Update NCronJob --- CHANGELOG.md | 4 ++++ Directory.Packages.props | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d98abc4..a206f53e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.3.0 +### Dependencies +- Updated [NCronJob](https://github.com/NCronJob-Dev/NCronJob) to version 4.0.2 + ## 2.2.0 - 2024-12-23 ### BREAKING CHANGES - The settings file structure changed and will require a migration! diff --git a/Directory.Packages.props b/Directory.Packages.props index 91467545..a76ed77b 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -11,7 +11,7 @@ - + From e0f63bb4ba70b850151c9500754b9c210eff95e6 Mon Sep 17 00:00:00 2001 From: Sella-GH <147769367+Sella-GH@users.noreply.github.com> Date: Mon, 30 Dec 2024 21:16:55 +0100 Subject: [PATCH 2/5] Remove ordering penalty --- src/AzzyBot.Data/Services/DbActions.cs | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/src/AzzyBot.Data/Services/DbActions.cs b/src/AzzyBot.Data/Services/DbActions.cs index 2b4d10be..3cc6231c 100644 --- a/src/AzzyBot.Data/Services/DbActions.cs +++ b/src/AzzyBot.Data/Services/DbActions.cs @@ -49,7 +49,6 @@ public Task AddAzuraCastAsync(ulong guildId, Uri baseUrl, string apiKey, u return ExecuteDbActionAsync(async context => { GuildEntity? guild = await context.Guilds - .OrderBy(static g => g.Id) .FirstOrDefaultAsync(g => g.UniqueId == guildId); if (guild is null) @@ -90,7 +89,6 @@ public Task AddAzuraCastStationAsync(ulong guildId, int stationId, ulong s return ExecuteDbActionAsync(async context => { AzuraCastEntity? azura = await context.AzuraCast - .OrderBy(static a => a.Id) .FirstOrDefaultAsync(a => a.Guild.UniqueId == guildId); if (azura is null) @@ -136,7 +134,6 @@ public Task AddAzuraCastStationRequestAsync(ulong guildId, int stationId, return ExecuteDbActionAsync(async context => { AzuraCastStationEntity? station = await context.AzuraCastStations - .OrderBy(static s => s.Id) .FirstOrDefaultAsync(s => s.AzuraCast.Guild.UniqueId == guildId && s.StationId == stationId); if (station is null) @@ -169,9 +166,7 @@ public async Task> AddGuildsAsync(IReadOnlyDictionary< { ArgumentNullException.ThrowIfNull(guilds); - IEnumerable existingGuilds = _dbContext.Guilds - .OrderBy(static g => g.Id); - + IEnumerable existingGuilds = _dbContext.Guilds; IEnumerable newGuilds = guilds.Keys .Where(guild => !existingGuilds.Select(static g => g.UniqueId).Contains(guild)) .Select(static guild => new GuildEntity() { UniqueId = guild }) @@ -213,9 +208,7 @@ public async Task> DeleteGuildsAsync(IReadOnlyDictionary existingGuilds = _dbContext.Guilds - .OrderBy(static g => g.Id); - + IEnumerable existingGuilds = _dbContext.Guilds; IEnumerable guildsToDelete = existingGuilds .Where(guild => !guilds.Keys.Contains(guild.UniqueId)) .ToList(); @@ -241,7 +234,6 @@ public async Task> DeleteGuildsAsync(IReadOnlyDictionary a.Guild.UniqueId == guildId) - .OrderBy(static a => a.Id) .IncludeIf(loadChecks, static q => q.Include(static a => a.Checks)) .IncludeIf(loadPrefs, static q => q.Include(static a => a.Preferences)) .IncludeIf(loadStations, static q => q.Include(static a => a.Stations)) @@ -256,7 +248,6 @@ public async Task> DeleteGuildsAsync(IReadOnlyDictionary s.AzuraCast.Guild.UniqueId == guildId && s.StationId == stationId) - .OrderBy(static s => s.Id) .IncludeIf(loadChecks, static q => q.Include(static s => s.Checks)) .IncludeIf(loadPrefs, static q => q.Include(static s => s.Preferences)) .IncludeIf(loadRequests, static q => q.Include(static s => s.Requests)) @@ -270,7 +261,6 @@ public async Task> DeleteGuildsAsync(IReadOnlyDictionary p.Station.AzuraCast.Guild.UniqueId == guildId && p.Station.StationId == stationId) - .OrderBy(static p => p.Id) .IncludeIf(loadStation, static q => q.Include(static p => p.Station)) .FirstOrDefaultAsync(); } @@ -288,7 +278,6 @@ public Task GetAzuraCastStationRequestsCountAsync(ulong guildId, int statio return _dbContext.Guilds .AsNoTracking() .Where(g => g.UniqueId == guildId) - .OrderBy(static g => g.Id) .IncludeIf(loadEverything, static q => q.Include(static g => g.Preferences)) .IncludeIf(loadEverything, static q => q.Include(static g => g.AzuraCast).Include(static g => g.AzuraCast!.Checks).Include(static g => g.AzuraCast!.Preferences)) .IncludeIf(loadEverything, static q => q.Include(static g => g.AzuraCast!.Stations).ThenInclude(static s => s.Checks)) @@ -300,7 +289,6 @@ public async Task> GetGuildsAsync(bool loadGuildPrefs { return await _dbContext.Guilds .AsNoTracking() - .OrderBy(static g => g.Id) .IncludeIf(loadGuildPrefs || loadEverything, static q => q.Include(static g => g.Preferences)) .IncludeIf(loadEverything, static q => q.Include(static g => g.AzuraCast).Include(static g => g.AzuraCast!.Checks).Include(static g => g.AzuraCast!.Preferences)) .IncludeIf(loadEverything, static q => q.Include(static g => g.AzuraCast!.Stations).ThenInclude(static s => s.Checks)) @@ -313,7 +301,6 @@ public async Task> GetGuildsAsync(bool loadGuildPrefs return _dbContext.Guilds .AsNoTracking() .Where(g => g.UniqueId == guildId) - .OrderBy(static g => g.Id) .Select(static g => g.Preferences) .FirstOrDefaultAsync(); } @@ -324,7 +311,6 @@ public Task UpdateAzuraCastAsync(ulong guildId, Uri? baseUrl = null, strin { AzuraCastEntity? azuraCast = await context.AzuraCast .Where(a => a.Guild.UniqueId == guildId) - .OrderBy(static a => a.Id) .FirstOrDefaultAsync(); if (azuraCast is null) @@ -352,7 +338,6 @@ public Task UpdateAzuraCastChecksAsync(ulong guildId, bool? serverStatus = { AzuraCastChecksEntity? checks = await context.AzuraCastChecks .Where(c => c.AzuraCast.Guild.UniqueId == guildId) - .OrderBy(static c => c.Id) .FirstOrDefaultAsync(); if (checks is null) @@ -389,7 +374,6 @@ public Task UpdateAzuraCastPreferencesAsync(ulong guildId, ulong? instance { AzuraCastPreferencesEntity? preferences = await context.AzuraCastPreferences .Where(p => p.AzuraCast.Guild.UniqueId == guildId) - .OrderBy(static p => p.Id) .FirstOrDefaultAsync(); if (preferences is null) @@ -417,7 +401,6 @@ public Task UpdateAzuraCastStationAsync(ulong guildId, int station, int? s { AzuraCastStationEntity? azuraStation = await context.AzuraCastStations .Where(s => s.AzuraCast.Guild.UniqueId == guildId && s.StationId == station) - .OrderBy(static s => s.Id) .FirstOrDefaultAsync(); if (azuraStation is null) @@ -448,7 +431,6 @@ public Task UpdateAzuraCastStationChecksAsync(ulong guildId, int stationId { AzuraCastStationChecksEntity? checks = await context.AzuraCastStationChecks .Where(c => c.Station.AzuraCast.Guild.UniqueId == guildId && c.Station.StationId == stationId) - .OrderBy(static c => c.Id) .FirstOrDefaultAsync(); if (checks is null) @@ -473,7 +455,6 @@ public Task UpdateAzuraCastStationPreferencesAsync(ulong guildId, int stat { AzuraCastStationPreferencesEntity? preferences = await context.AzuraCastStationPreferences .Where(p => p.Station.AzuraCast.Guild.UniqueId == guildId && p.Station.StationId == stationId) - .OrderBy(static p => p.Id) .FirstOrDefaultAsync(); if (preferences is null) @@ -510,7 +491,6 @@ public Task UpdateGuildAsync(ulong guildId, bool? lastPermissionCheck = nu { GuildEntity? guild = await context.Guilds .Where(g => g.UniqueId == guildId) - .OrderBy(static g => g.Id) .FirstOrDefaultAsync(); if (guild is null) @@ -539,7 +519,6 @@ public Task UpdateGuildPreferencesAsync(ulong guildId, ulong? adminRoleId GuildPreferencesEntity? preferences = await context.GuildPreferences .Where(p => p.Guild.UniqueId == guildId) .Include(static p => p.Guild) - .OrderBy(static p => p.Id) .FirstOrDefaultAsync(); if (preferences is null) From 5b001a9816b5910e70cc9c3f608ab25cef308296 Mon Sep 17 00:00:00 2001 From: Sella-GH <147769367+Sella-GH@users.noreply.github.com> Date: Mon, 30 Dec 2024 21:34:44 +0100 Subject: [PATCH 3/5] Change some `.editorconfig` settings --- .editorconfig | 4 ++-- src/AzzyBot.Bot/Commands/AdminCommands.cs | 3 +++ .../Commands/Autocompletes/AzuraCastMountAutocomplete.cs | 3 +++ .../Commands/Autocompletes/AzuraCastPlaylistAutocomplete.cs | 3 +++ .../Commands/Autocompletes/AzuraCastRequestAutocomplete.cs | 3 +++ .../Commands/Autocompletes/AzuraCastStationsAutocomplete.cs | 3 +++ .../Commands/Autocompletes/AzuraCastSystemLogAutocomplete.cs | 3 +++ .../Commands/Autocompletes/AzzyHelpAutocomplete.cs | 3 +++ .../Commands/Autocompletes/AzzyViewLogsAutocomplete.cs | 2 ++ src/AzzyBot.Bot/Commands/Autocompletes/GuildsAutocomplete.cs | 3 +++ src/AzzyBot.Bot/Commands/AzuraCastCommands.cs | 3 +++ .../Commands/Checks/AzuraCastDiscordChannelCheck.cs | 3 +++ .../Commands/Checks/AzuraCastDiscordChannelCheckAttribute.cs | 1 + src/AzzyBot.Bot/Commands/Checks/AzuraCastDiscordPermCheck.cs | 3 +++ .../Commands/Checks/AzuraCastDiscordPermCheckAttribute.cs | 2 ++ src/AzzyBot.Bot/Commands/Checks/AzuraCastFeatureCheck.cs | 3 +++ .../Commands/Checks/AzuraCastFeatureCheckAttribute.cs | 2 ++ src/AzzyBot.Bot/Commands/Checks/AzuraCastOnlineCheck.cs | 3 +++ .../Commands/Checks/AzuraCastOnlineCheckAttribute.cs | 1 + src/AzzyBot.Bot/Commands/Checks/ModuleActivatedCheck.cs | 3 +++ .../Commands/Checks/ModuleActivatedCheckAttribute.cs | 2 ++ .../Commands/Choices/AzuraExportPlaylistProvider.cs | 1 + .../Commands/Choices/BooleanEnabledDisabledStateProvider.cs | 1 + .../Commands/Choices/BooleanYesNoStateProvider.cs | 1 + src/AzzyBot.Bot/Commands/Choices/BotActivityProvider.cs | 1 + src/AzzyBot.Bot/Commands/Choices/BotStatusProvider.cs | 1 + .../Commands/Choices/MusicStreamingPlatformProvider.cs | 2 ++ src/AzzyBot.Bot/Commands/ConfigCommands.cs | 3 +++ src/AzzyBot.Bot/Commands/Converters/UriArgumentConverter.cs | 1 + src/AzzyBot.Bot/Commands/CoreCommands.cs | 3 +++ src/AzzyBot.Bot/Commands/DebugCommands.cs | 3 +++ src/AzzyBot.Bot/Commands/MusicStreamingCommands.cs | 4 ++++ .../Extensions/IConfigurationManagerExtensions.cs | 1 + src/AzzyBot.Bot/Extensions/IHostExtensions.cs | 3 +++ src/AzzyBot.Bot/Extensions/IServiceCollectionExtensions.cs | 5 +++++ src/AzzyBot.Bot/Services/CronJobManager.cs | 2 ++ src/AzzyBot.Bot/Services/CronJobs/AzuraRequestJob.cs | 3 +++ src/AzzyBot.Bot/Services/CronJobs/AzzyBotGlobalChecksJob.cs | 4 ++++ src/AzzyBot.Bot/Services/CronJobs/LogfileCleaningJob.cs | 3 +++ src/AzzyBot.Bot/Services/DiscordBotService.cs | 3 +++ src/AzzyBot.Bot/Services/DiscordBotServiceHost.cs | 3 +++ .../Services/DiscordEvents/DiscordCommandsErrorHandler.cs | 3 +++ .../Services/DiscordEvents/DiscordErrorsHandler.cs | 1 + .../Services/DiscordEvents/DiscordGuildsHandler.cs | 3 +++ src/AzzyBot.Bot/Services/Modules/AzuraCastApiService.cs | 3 +++ src/AzzyBot.Bot/Services/Modules/AzuraCastFileService.cs | 3 +++ src/AzzyBot.Bot/Services/Modules/AzuraCastPingService.cs | 2 ++ src/AzzyBot.Bot/Services/Modules/AzuraCastUpdateService.cs | 2 ++ src/AzzyBot.Bot/Services/Modules/CoreServiceHost.cs | 2 ++ src/AzzyBot.Bot/Services/Modules/MusicStreamingService.cs | 4 ++++ src/AzzyBot.Bot/Services/UpdaterService.cs | 3 +++ src/AzzyBot.Bot/Services/WebRequestService.cs | 2 ++ src/AzzyBot.Bot/Settings/Validators/AppStatsValidator.cs | 2 ++ .../Settings/Validators/AzzyBotSettingsValidator.cs | 1 + src/AzzyBot.Bot/Settings/Validators/CoreUpdaterValidator.cs | 1 + .../Settings/Validators/DatabaseSettingsValidator.cs | 2 ++ .../Settings/Validators/DiscordStatusSettingsValidator.cs | 1 + .../Settings/Validators/MusicStreamingSettingsValidator.cs | 1 + src/AzzyBot.Bot/Startup.cs | 2 ++ src/AzzyBot.Bot/Utilities/AzuraFileChecker.cs | 1 + src/AzzyBot.Bot/Utilities/AzuraFileComparer.cs | 1 + src/AzzyBot.Bot/Utilities/AzzyHelp.cs | 2 ++ src/AzzyBot.Bot/Utilities/EmbedBuilder.cs | 3 +++ .../Utilities/JsonDeserializationListSourceGen.cs | 1 + src/AzzyBot.Bot/Utilities/JsonDeserializationSourceGen.cs | 1 + src/AzzyBot.Bot/Utilities/JsonSerializationListSourceGen.cs | 1 + src/AzzyBot.Bot/Utilities/JsonSerializationSourceGen.cs | 1 + .../Utilities/Records/AzuraCast/AzuraPlaylistRecord.cs | 1 + src/AzzyBot.Core/Extensions/ILoggingBuilderExtensions.cs | 2 ++ src/AzzyBot.Core/Logging/LoggerActions.cs | 1 + src/AzzyBot.Core/Utilities/FileOperations.cs | 1 + src/AzzyBot.Core/Utilities/HardwareStats.cs | 1 + src/AzzyBot.Core/Utilities/Misc.cs | 1 + src/AzzyBot.Core/Utilities/SoftwareStats.cs | 1 + src/AzzyBot.Data/Entities/GuildEntity.cs | 1 + src/AzzyBot.Data/Extensions/IServiceCollectionExtensions.cs | 4 ++++ src/AzzyBot.Data/Services/AzzyDbContext.cs | 1 + src/AzzyBot.Data/Services/DbActions.cs | 3 +++ src/AzzyBot.Data/Services/DbMaintenance.cs | 3 +++ 79 files changed, 171 insertions(+), 2 deletions(-) diff --git a/.editorconfig b/.editorconfig index cb2331ce..8b5e71f0 100644 --- a/.editorconfig +++ b/.editorconfig @@ -87,6 +87,7 @@ dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case # Code style defaults csharp_using_directive_placement = outside_namespace:warning dotnet_sort_system_directives_first = true +dotnet_separate_import_directive_groups = true csharp_prefer_braces = when_multiline:warning csharp_preserve_single_line_blocks = true:warning csharp_preserve_single_line_statements = false:warning @@ -199,7 +200,6 @@ roslynator_blank_line_after_file_scoped_namespace_declaration = true roslynator_blank_line_between_closing_brace_and_switch_section = true roslynator_blank_line_between_single_line_accessors = false roslynator_blank_line_between_switch_sections = include -roslynator_blank_line_between_using_directives = never roslynator_block_braces_style = single_line_when_empty roslynator_body_style = expression roslynator_conditional_operator_condition_parentheses_style = include @@ -265,7 +265,7 @@ dotnet_diagnostic.rcs0012.severity = none dotnet_diagnostic.rcs0013.severity = none ## Add/remove blank line between using directives -dotnet_diagnostic.rcs0015.severity = warning +dotnet_diagnostic.rcs0015.severity = none ## Put attribute list on its own line dotnet_diagnostic.rcs0016.severity = warning diff --git a/src/AzzyBot.Bot/Commands/AdminCommands.cs b/src/AzzyBot.Bot/Commands/AdminCommands.cs index aeb9f202..533717d7 100644 --- a/src/AzzyBot.Bot/Commands/AdminCommands.cs +++ b/src/AzzyBot.Bot/Commands/AdminCommands.cs @@ -7,6 +7,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; + using AzzyBot.Bot.Commands.Autocompletes; using AzzyBot.Bot.Commands.Choices; using AzzyBot.Bot.Services; @@ -17,12 +18,14 @@ using AzzyBot.Core.Utilities; using AzzyBot.Data.Entities; using AzzyBot.Data.Services; + using DSharpPlus.Commands; using DSharpPlus.Commands.ArgumentModifiers; using DSharpPlus.Commands.ContextChecks; using DSharpPlus.Commands.Processors.SlashCommands; using DSharpPlus.Commands.Processors.SlashCommands.ArgumentModifiers; using DSharpPlus.Entities; + using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; diff --git a/src/AzzyBot.Bot/Commands/Autocompletes/AzuraCastMountAutocomplete.cs b/src/AzzyBot.Bot/Commands/Autocompletes/AzuraCastMountAutocomplete.cs index d7bb280e..8b411905 100644 --- a/src/AzzyBot.Bot/Commands/Autocompletes/AzuraCastMountAutocomplete.cs +++ b/src/AzzyBot.Bot/Commands/Autocompletes/AzuraCastMountAutocomplete.cs @@ -5,6 +5,7 @@ using System.Net.Http; using System.Text; using System.Threading.Tasks; + using AzzyBot.Bot.Services; using AzzyBot.Bot.Services.Modules; using AzzyBot.Bot.Utilities.Records; @@ -13,9 +14,11 @@ using AzzyBot.Core.Utilities.Encryption; using AzzyBot.Data.Entities; using AzzyBot.Data.Services; + using DSharpPlus.Commands.Processors.SlashCommands; using DSharpPlus.Commands.Processors.SlashCommands.ArgumentModifiers; using DSharpPlus.Entities; + using Microsoft.Extensions.Logging; namespace AzzyBot.Bot.Commands.Autocompletes; diff --git a/src/AzzyBot.Bot/Commands/Autocompletes/AzuraCastPlaylistAutocomplete.cs b/src/AzzyBot.Bot/Commands/Autocompletes/AzuraCastPlaylistAutocomplete.cs index 8d1a87a4..dc1e674f 100644 --- a/src/AzzyBot.Bot/Commands/Autocompletes/AzuraCastPlaylistAutocomplete.cs +++ b/src/AzzyBot.Bot/Commands/Autocompletes/AzuraCastPlaylistAutocomplete.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Net.Http; using System.Threading.Tasks; + using AzzyBot.Bot.Services; using AzzyBot.Bot.Services.Modules; using AzzyBot.Bot.Utilities.Records.AzuraCast; @@ -13,9 +14,11 @@ using AzzyBot.Core.Utilities.Enums; using AzzyBot.Data.Entities; using AzzyBot.Data.Services; + using DSharpPlus.Commands.Processors.SlashCommands; using DSharpPlus.Commands.Processors.SlashCommands.ArgumentModifiers; using DSharpPlus.Entities; + using Microsoft.Extensions.Logging; namespace AzzyBot.Bot.Commands.Autocompletes; diff --git a/src/AzzyBot.Bot/Commands/Autocompletes/AzuraCastRequestAutocomplete.cs b/src/AzzyBot.Bot/Commands/Autocompletes/AzuraCastRequestAutocomplete.cs index 2ff16c23..1df20d44 100644 --- a/src/AzzyBot.Bot/Commands/Autocompletes/AzuraCastRequestAutocomplete.cs +++ b/src/AzzyBot.Bot/Commands/Autocompletes/AzuraCastRequestAutocomplete.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; + using AzzyBot.Bot.Services; using AzzyBot.Bot.Services.Modules; using AzzyBot.Bot.Utilities.Records.AzuraCast; @@ -11,9 +12,11 @@ using AzzyBot.Core.Utilities.Encryption; using AzzyBot.Data.Entities; using AzzyBot.Data.Services; + using DSharpPlus.Commands.Processors.SlashCommands; using DSharpPlus.Commands.Processors.SlashCommands.ArgumentModifiers; using DSharpPlus.Entities; + using Microsoft.Extensions.Logging; namespace AzzyBot.Bot.Commands.Autocompletes; diff --git a/src/AzzyBot.Bot/Commands/Autocompletes/AzuraCastStationsAutocomplete.cs b/src/AzzyBot.Bot/Commands/Autocompletes/AzuraCastStationsAutocomplete.cs index 5dd37a4e..96621efa 100644 --- a/src/AzzyBot.Bot/Commands/Autocompletes/AzuraCastStationsAutocomplete.cs +++ b/src/AzzyBot.Bot/Commands/Autocompletes/AzuraCastStationsAutocomplete.cs @@ -3,6 +3,7 @@ using System.Linq; using System.Net.Http; using System.Threading.Tasks; + using AzzyBot.Bot.Services; using AzzyBot.Bot.Services.Modules; using AzzyBot.Bot.Utilities.Records.AzuraCast; @@ -12,9 +13,11 @@ using AzzyBot.Core.Utilities.Enums; using AzzyBot.Data.Entities; using AzzyBot.Data.Services; + using DSharpPlus.Commands.Processors.SlashCommands; using DSharpPlus.Commands.Processors.SlashCommands.ArgumentModifiers; using DSharpPlus.Entities; + using Microsoft.Extensions.Logging; namespace AzzyBot.Bot.Commands.Autocompletes; diff --git a/src/AzzyBot.Bot/Commands/Autocompletes/AzuraCastSystemLogAutocomplete.cs b/src/AzzyBot.Bot/Commands/Autocompletes/AzuraCastSystemLogAutocomplete.cs index 513b0a0b..fb3353ee 100644 --- a/src/AzzyBot.Bot/Commands/Autocompletes/AzuraCastSystemLogAutocomplete.cs +++ b/src/AzzyBot.Bot/Commands/Autocompletes/AzuraCastSystemLogAutocomplete.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Net.Http; using System.Threading.Tasks; + using AzzyBot.Bot.Services; using AzzyBot.Bot.Services.Modules; using AzzyBot.Bot.Utilities.Records.AzuraCast; @@ -9,9 +10,11 @@ using AzzyBot.Core.Utilities.Encryption; using AzzyBot.Data.Entities; using AzzyBot.Data.Services; + using DSharpPlus.Commands.Processors.SlashCommands; using DSharpPlus.Commands.Processors.SlashCommands.ArgumentModifiers; using DSharpPlus.Entities; + using Microsoft.Extensions.Logging; namespace AzzyBot.Bot.Commands.Autocompletes; diff --git a/src/AzzyBot.Bot/Commands/Autocompletes/AzzyHelpAutocomplete.cs b/src/AzzyBot.Bot/Commands/Autocompletes/AzzyHelpAutocomplete.cs index 642d9866..040634ba 100644 --- a/src/AzzyBot.Bot/Commands/Autocompletes/AzzyHelpAutocomplete.cs +++ b/src/AzzyBot.Bot/Commands/Autocompletes/AzzyHelpAutocomplete.cs @@ -2,12 +2,15 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; + using AzzyBot.Bot.Settings; using AzzyBot.Bot.Utilities; using AzzyBot.Bot.Utilities.Records; + using DSharpPlus.Commands.Processors.SlashCommands; using DSharpPlus.Commands.Processors.SlashCommands.ArgumentModifiers; using DSharpPlus.Entities; + using Microsoft.Extensions.Options; namespace AzzyBot.Bot.Commands.Autocompletes; diff --git a/src/AzzyBot.Bot/Commands/Autocompletes/AzzyViewLogsAutocomplete.cs b/src/AzzyBot.Bot/Commands/Autocompletes/AzzyViewLogsAutocomplete.cs index 0d3ae960..d9a19d47 100644 --- a/src/AzzyBot.Bot/Commands/Autocompletes/AzzyViewLogsAutocomplete.cs +++ b/src/AzzyBot.Bot/Commands/Autocompletes/AzzyViewLogsAutocomplete.cs @@ -3,7 +3,9 @@ using System.IO; using System.Linq; using System.Threading.Tasks; + using AzzyBot.Core.Utilities; + using DSharpPlus.Commands.Processors.SlashCommands; using DSharpPlus.Commands.Processors.SlashCommands.ArgumentModifiers; using DSharpPlus.Entities; diff --git a/src/AzzyBot.Bot/Commands/Autocompletes/GuildsAutocomplete.cs b/src/AzzyBot.Bot/Commands/Autocompletes/GuildsAutocomplete.cs index 8e33a3be..546e4a4f 100644 --- a/src/AzzyBot.Bot/Commands/Autocompletes/GuildsAutocomplete.cs +++ b/src/AzzyBot.Bot/Commands/Autocompletes/GuildsAutocomplete.cs @@ -3,11 +3,14 @@ using System.Globalization; using System.Linq; using System.Threading.Tasks; + using AzzyBot.Bot.Services; using AzzyBot.Bot.Settings; + using DSharpPlus.Commands.Processors.SlashCommands; using DSharpPlus.Commands.Processors.SlashCommands.ArgumentModifiers; using DSharpPlus.Entities; + using Microsoft.Extensions.Options; namespace AzzyBot.Bot.Commands.Autocompletes; diff --git a/src/AzzyBot.Bot/Commands/AzuraCastCommands.cs b/src/AzzyBot.Bot/Commands/AzuraCastCommands.cs index 50aadd8f..606bb763 100644 --- a/src/AzzyBot.Bot/Commands/AzuraCastCommands.cs +++ b/src/AzzyBot.Bot/Commands/AzuraCastCommands.cs @@ -9,6 +9,7 @@ using System.Text; using System.Text.Json; using System.Threading.Tasks; + using AzzyBot.Bot.Commands.Autocompletes; using AzzyBot.Bot.Commands.Checks; using AzzyBot.Bot.Commands.Choices; @@ -25,6 +26,7 @@ using AzzyBot.Core.Utilities.Helpers; using AzzyBot.Data.Entities; using AzzyBot.Data.Services; + using DSharpPlus.Commands; using DSharpPlus.Commands.ContextChecks; using DSharpPlus.Commands.Processors.SlashCommands; @@ -33,6 +35,7 @@ using DSharpPlus.EventArgs; using DSharpPlus.Interactivity; using DSharpPlus.Interactivity.Extensions; + using Microsoft.Extensions.Logging; namespace AzzyBot.Bot.Commands; diff --git a/src/AzzyBot.Bot/Commands/Checks/AzuraCastDiscordChannelCheck.cs b/src/AzzyBot.Bot/Commands/Checks/AzuraCastDiscordChannelCheck.cs index f57a5f74..0ad287ee 100644 --- a/src/AzzyBot.Bot/Commands/Checks/AzuraCastDiscordChannelCheck.cs +++ b/src/AzzyBot.Bot/Commands/Checks/AzuraCastDiscordChannelCheck.cs @@ -2,13 +2,16 @@ using System.Globalization; using System.Linq; using System.Threading.Tasks; + using AzzyBot.Core.Logging; using AzzyBot.Data.Entities; using AzzyBot.Data.Services; + using DSharpPlus.Commands; using DSharpPlus.Commands.ContextChecks; using DSharpPlus.Commands.Processors.SlashCommands; using DSharpPlus.Entities; + using Microsoft.Extensions.Logging; namespace AzzyBot.Bot.Commands.Checks; diff --git a/src/AzzyBot.Bot/Commands/Checks/AzuraCastDiscordChannelCheckAttribute.cs b/src/AzzyBot.Bot/Commands/Checks/AzuraCastDiscordChannelCheckAttribute.cs index d70e3b05..62dd2ec0 100644 --- a/src/AzzyBot.Bot/Commands/Checks/AzuraCastDiscordChannelCheckAttribute.cs +++ b/src/AzzyBot.Bot/Commands/Checks/AzuraCastDiscordChannelCheckAttribute.cs @@ -1,4 +1,5 @@ using System; + using DSharpPlus.Commands.ContextChecks; namespace AzzyBot.Bot.Commands.Checks; diff --git a/src/AzzyBot.Bot/Commands/Checks/AzuraCastDiscordPermCheck.cs b/src/AzzyBot.Bot/Commands/Checks/AzuraCastDiscordPermCheck.cs index 9811cfc9..2b16e13b 100644 --- a/src/AzzyBot.Bot/Commands/Checks/AzuraCastDiscordPermCheck.cs +++ b/src/AzzyBot.Bot/Commands/Checks/AzuraCastDiscordPermCheck.cs @@ -4,14 +4,17 @@ using System.Globalization; using System.Linq; using System.Threading.Tasks; + using AzzyBot.Bot.Utilities.Enums; using AzzyBot.Core.Logging; using AzzyBot.Data.Entities; using AzzyBot.Data.Services; + using DSharpPlus.Commands; using DSharpPlus.Commands.ContextChecks; using DSharpPlus.Commands.Processors.SlashCommands; using DSharpPlus.Entities; + using Microsoft.Extensions.Logging; namespace AzzyBot.Bot.Commands.Checks; diff --git a/src/AzzyBot.Bot/Commands/Checks/AzuraCastDiscordPermCheckAttribute.cs b/src/AzzyBot.Bot/Commands/Checks/AzuraCastDiscordPermCheckAttribute.cs index 6a8a7e0b..7d9dc675 100644 --- a/src/AzzyBot.Bot/Commands/Checks/AzuraCastDiscordPermCheckAttribute.cs +++ b/src/AzzyBot.Bot/Commands/Checks/AzuraCastDiscordPermCheckAttribute.cs @@ -1,5 +1,7 @@ using System; + using AzzyBot.Bot.Utilities.Enums; + using DSharpPlus.Commands.ContextChecks; namespace AzzyBot.Bot.Commands.Checks; diff --git a/src/AzzyBot.Bot/Commands/Checks/AzuraCastFeatureCheck.cs b/src/AzzyBot.Bot/Commands/Checks/AzuraCastFeatureCheck.cs index 2999a818..2d1f0a8b 100644 --- a/src/AzzyBot.Bot/Commands/Checks/AzuraCastFeatureCheck.cs +++ b/src/AzzyBot.Bot/Commands/Checks/AzuraCastFeatureCheck.cs @@ -2,14 +2,17 @@ using System.Globalization; using System.Linq; using System.Threading.Tasks; + using AzzyBot.Bot.Utilities.Enums; using AzzyBot.Core.Logging; using AzzyBot.Data.Entities; using AzzyBot.Data.Services; + using DSharpPlus.Commands; using DSharpPlus.Commands.ContextChecks; using DSharpPlus.Commands.Processors.SlashCommands; using DSharpPlus.Entities; + using Microsoft.Extensions.Logging; namespace AzzyBot.Bot.Commands.Checks; diff --git a/src/AzzyBot.Bot/Commands/Checks/AzuraCastFeatureCheckAttribute.cs b/src/AzzyBot.Bot/Commands/Checks/AzuraCastFeatureCheckAttribute.cs index 92ab1eff..8d023b9e 100644 --- a/src/AzzyBot.Bot/Commands/Checks/AzuraCastFeatureCheckAttribute.cs +++ b/src/AzzyBot.Bot/Commands/Checks/AzuraCastFeatureCheckAttribute.cs @@ -1,5 +1,7 @@ using System; + using AzzyBot.Bot.Utilities.Enums; + using DSharpPlus.Commands.ContextChecks; namespace AzzyBot.Bot.Commands.Checks; diff --git a/src/AzzyBot.Bot/Commands/Checks/AzuraCastOnlineCheck.cs b/src/AzzyBot.Bot/Commands/Checks/AzuraCastOnlineCheck.cs index 5c75401a..cca90e51 100644 --- a/src/AzzyBot.Bot/Commands/Checks/AzuraCastOnlineCheck.cs +++ b/src/AzzyBot.Bot/Commands/Checks/AzuraCastOnlineCheck.cs @@ -1,12 +1,15 @@ using System; using System.Threading.Tasks; + using AzzyBot.Core.Logging; using AzzyBot.Data.Entities; using AzzyBot.Data.Services; + using DSharpPlus.Commands; using DSharpPlus.Commands.ContextChecks; using DSharpPlus.Commands.Processors.SlashCommands; using DSharpPlus.Entities; + using Microsoft.Extensions.Logging; namespace AzzyBot.Bot.Commands.Checks; diff --git a/src/AzzyBot.Bot/Commands/Checks/AzuraCastOnlineCheckAttribute.cs b/src/AzzyBot.Bot/Commands/Checks/AzuraCastOnlineCheckAttribute.cs index a987e777..843c48ac 100644 --- a/src/AzzyBot.Bot/Commands/Checks/AzuraCastOnlineCheckAttribute.cs +++ b/src/AzzyBot.Bot/Commands/Checks/AzuraCastOnlineCheckAttribute.cs @@ -1,4 +1,5 @@ using System; + using DSharpPlus.Commands.ContextChecks; namespace AzzyBot.Bot.Commands.Checks; diff --git a/src/AzzyBot.Bot/Commands/Checks/ModuleActivatedCheck.cs b/src/AzzyBot.Bot/Commands/Checks/ModuleActivatedCheck.cs index 9d22920a..24b59cd4 100644 --- a/src/AzzyBot.Bot/Commands/Checks/ModuleActivatedCheck.cs +++ b/src/AzzyBot.Bot/Commands/Checks/ModuleActivatedCheck.cs @@ -1,14 +1,17 @@ using System; using System.Threading.Tasks; + using AzzyBot.Bot.Utilities.Enums; using AzzyBot.Bot.Utilities.Helpers; using AzzyBot.Core.Logging; using AzzyBot.Data.Entities; using AzzyBot.Data.Services; + using DSharpPlus.Commands; using DSharpPlus.Commands.ContextChecks; using DSharpPlus.Commands.Processors.SlashCommands; using DSharpPlus.Entities; + using Microsoft.Extensions.Logging; namespace AzzyBot.Bot.Commands.Checks; diff --git a/src/AzzyBot.Bot/Commands/Checks/ModuleActivatedCheckAttribute.cs b/src/AzzyBot.Bot/Commands/Checks/ModuleActivatedCheckAttribute.cs index 0e9b2418..400555c5 100644 --- a/src/AzzyBot.Bot/Commands/Checks/ModuleActivatedCheckAttribute.cs +++ b/src/AzzyBot.Bot/Commands/Checks/ModuleActivatedCheckAttribute.cs @@ -1,5 +1,7 @@ using System; + using AzzyBot.Bot.Utilities.Enums; + using DSharpPlus.Commands.ContextChecks; namespace AzzyBot.Bot.Commands.Checks; diff --git a/src/AzzyBot.Bot/Commands/Choices/AzuraExportPlaylistProvider.cs b/src/AzzyBot.Bot/Commands/Choices/AzuraExportPlaylistProvider.cs index 6c0d94a1..d7cc4653 100644 --- a/src/AzzyBot.Bot/Commands/Choices/AzuraExportPlaylistProvider.cs +++ b/src/AzzyBot.Bot/Commands/Choices/AzuraExportPlaylistProvider.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Threading.Tasks; + using DSharpPlus.Commands.Processors.SlashCommands.ArgumentModifiers; using DSharpPlus.Commands.Trees; using DSharpPlus.Entities; diff --git a/src/AzzyBot.Bot/Commands/Choices/BooleanEnabledDisabledStateProvider.cs b/src/AzzyBot.Bot/Commands/Choices/BooleanEnabledDisabledStateProvider.cs index 3a2df17f..22c436e4 100644 --- a/src/AzzyBot.Bot/Commands/Choices/BooleanEnabledDisabledStateProvider.cs +++ b/src/AzzyBot.Bot/Commands/Choices/BooleanEnabledDisabledStateProvider.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Threading.Tasks; + using DSharpPlus.Commands.Processors.SlashCommands.ArgumentModifiers; using DSharpPlus.Commands.Trees; using DSharpPlus.Entities; diff --git a/src/AzzyBot.Bot/Commands/Choices/BooleanYesNoStateProvider.cs b/src/AzzyBot.Bot/Commands/Choices/BooleanYesNoStateProvider.cs index 3aacb80e..7a4b049b 100644 --- a/src/AzzyBot.Bot/Commands/Choices/BooleanYesNoStateProvider.cs +++ b/src/AzzyBot.Bot/Commands/Choices/BooleanYesNoStateProvider.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Threading.Tasks; + using DSharpPlus.Commands.Processors.SlashCommands.ArgumentModifiers; using DSharpPlus.Commands.Trees; using DSharpPlus.Entities; diff --git a/src/AzzyBot.Bot/Commands/Choices/BotActivityProvider.cs b/src/AzzyBot.Bot/Commands/Choices/BotActivityProvider.cs index 3e205a42..c52c2a3e 100644 --- a/src/AzzyBot.Bot/Commands/Choices/BotActivityProvider.cs +++ b/src/AzzyBot.Bot/Commands/Choices/BotActivityProvider.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Threading.Tasks; + using DSharpPlus.Commands.Processors.SlashCommands.ArgumentModifiers; using DSharpPlus.Commands.Trees; using DSharpPlus.Entities; diff --git a/src/AzzyBot.Bot/Commands/Choices/BotStatusProvider.cs b/src/AzzyBot.Bot/Commands/Choices/BotStatusProvider.cs index 4912b58e..e2571920 100644 --- a/src/AzzyBot.Bot/Commands/Choices/BotStatusProvider.cs +++ b/src/AzzyBot.Bot/Commands/Choices/BotStatusProvider.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Threading.Tasks; + using DSharpPlus.Commands.Processors.SlashCommands.ArgumentModifiers; using DSharpPlus.Commands.Trees; using DSharpPlus.Entities; diff --git a/src/AzzyBot.Bot/Commands/Choices/MusicStreamingPlatformProvider.cs b/src/AzzyBot.Bot/Commands/Choices/MusicStreamingPlatformProvider.cs index 9c401f9f..f74cbb49 100644 --- a/src/AzzyBot.Bot/Commands/Choices/MusicStreamingPlatformProvider.cs +++ b/src/AzzyBot.Bot/Commands/Choices/MusicStreamingPlatformProvider.cs @@ -1,8 +1,10 @@ using System.Collections.Generic; using System.Threading.Tasks; + using DSharpPlus.Commands.Processors.SlashCommands.ArgumentModifiers; using DSharpPlus.Commands.Trees; using DSharpPlus.Entities; + using Lavalink4NET.Rest.Entities.Tracks; namespace AzzyBot.Bot.Commands.Choices; diff --git a/src/AzzyBot.Bot/Commands/ConfigCommands.cs b/src/AzzyBot.Bot/Commands/ConfigCommands.cs index 118e7cbd..02a83bac 100644 --- a/src/AzzyBot.Bot/Commands/ConfigCommands.cs +++ b/src/AzzyBot.Bot/Commands/ConfigCommands.cs @@ -6,6 +6,7 @@ using System.Linq; using System.Net.Http; using System.Threading.Tasks; + using AzzyBot.Bot.Commands.Autocompletes; using AzzyBot.Bot.Commands.Checks; using AzzyBot.Bot.Commands.Choices; @@ -21,6 +22,7 @@ using AzzyBot.Core.Utilities.Encryption; using AzzyBot.Data.Entities; using AzzyBot.Data.Services; + using DSharpPlus.Commands; using DSharpPlus.Commands.ArgumentModifiers; using DSharpPlus.Commands.ContextChecks; @@ -30,6 +32,7 @@ using DSharpPlus.EventArgs; using DSharpPlus.Interactivity; using DSharpPlus.Interactivity.Extensions; + using Microsoft.Extensions.Logging; namespace AzzyBot.Bot.Commands; diff --git a/src/AzzyBot.Bot/Commands/Converters/UriArgumentConverter.cs b/src/AzzyBot.Bot/Commands/Converters/UriArgumentConverter.cs index 42f160cc..e57fe58b 100644 --- a/src/AzzyBot.Bot/Commands/Converters/UriArgumentConverter.cs +++ b/src/AzzyBot.Bot/Commands/Converters/UriArgumentConverter.cs @@ -1,5 +1,6 @@ using System; using System.Threading.Tasks; + using DSharpPlus.Commands.Converters; using DSharpPlus.Commands.Processors.SlashCommands; using DSharpPlus.Entities; diff --git a/src/AzzyBot.Bot/Commands/CoreCommands.cs b/src/AzzyBot.Bot/Commands/CoreCommands.cs index 2bb53299..50ff204d 100644 --- a/src/AzzyBot.Bot/Commands/CoreCommands.cs +++ b/src/AzzyBot.Bot/Commands/CoreCommands.cs @@ -4,6 +4,7 @@ using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Threading.Tasks; + using AzzyBot.Bot.Commands.Autocompletes; using AzzyBot.Bot.Commands.Checks; using AzzyBot.Bot.Services; @@ -16,11 +17,13 @@ using AzzyBot.Core.Utilities.Records; using AzzyBot.Data.Entities; using AzzyBot.Data.Services; + using DSharpPlus.Commands; using DSharpPlus.Commands.ContextChecks; using DSharpPlus.Commands.Processors.SlashCommands; using DSharpPlus.Commands.Processors.SlashCommands.ArgumentModifiers; using DSharpPlus.Entities; + using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; diff --git a/src/AzzyBot.Bot/Commands/DebugCommands.cs b/src/AzzyBot.Bot/Commands/DebugCommands.cs index c96e4461..c0112c11 100644 --- a/src/AzzyBot.Bot/Commands/DebugCommands.cs +++ b/src/AzzyBot.Bot/Commands/DebugCommands.cs @@ -2,16 +2,19 @@ using System.ComponentModel; using System.Diagnostics.CodeAnalysis; using System.Threading.Tasks; + using AzzyBot.Bot.Commands.Choices; using AzzyBot.Bot.Services; using AzzyBot.Core.Logging; using AzzyBot.Core.Utilities.Encryption; + using DSharpPlus.Commands; using DSharpPlus.Commands.ArgumentModifiers; using DSharpPlus.Commands.ContextChecks; using DSharpPlus.Commands.Processors.SlashCommands; using DSharpPlus.Commands.Processors.SlashCommands.ArgumentModifiers; using DSharpPlus.Entities; + using Microsoft.Extensions.Logging; namespace AzzyBot.Bot.Commands; diff --git a/src/AzzyBot.Bot/Commands/MusicStreamingCommands.cs b/src/AzzyBot.Bot/Commands/MusicStreamingCommands.cs index d5f5f6c6..d933d260 100644 --- a/src/AzzyBot.Bot/Commands/MusicStreamingCommands.cs +++ b/src/AzzyBot.Bot/Commands/MusicStreamingCommands.cs @@ -5,6 +5,7 @@ using System.Linq; using System.Net.Http; using System.Threading.Tasks; + using AzzyBot.Bot.Commands.Autocompletes; using AzzyBot.Bot.Commands.Checks; using AzzyBot.Bot.Commands.Choices; @@ -17,13 +18,16 @@ using AzzyBot.Core.Utilities.Encryption; using AzzyBot.Data.Entities; using AzzyBot.Data.Services; + using DSharpPlus.Commands; using DSharpPlus.Commands.ContextChecks; using DSharpPlus.Commands.Processors.SlashCommands; using DSharpPlus.Commands.Processors.SlashCommands.ArgumentModifiers; using DSharpPlus.Entities; + using Lavalink4NET.Players; using Lavalink4NET.Tracks; + using Microsoft.Extensions.Logging; namespace AzzyBot.Bot.Commands; diff --git a/src/AzzyBot.Bot/Extensions/IConfigurationManagerExtensions.cs b/src/AzzyBot.Bot/Extensions/IConfigurationManagerExtensions.cs index 56dc9f86..f1726d49 100644 --- a/src/AzzyBot.Bot/Extensions/IConfigurationManagerExtensions.cs +++ b/src/AzzyBot.Bot/Extensions/IConfigurationManagerExtensions.cs @@ -1,4 +1,5 @@ using System.IO; + using Microsoft.Extensions.Configuration; namespace AzzyBot.Bot.Extensions; diff --git a/src/AzzyBot.Bot/Extensions/IHostExtensions.cs b/src/AzzyBot.Bot/Extensions/IHostExtensions.cs index 8af463ea..df07b20b 100644 --- a/src/AzzyBot.Bot/Extensions/IHostExtensions.cs +++ b/src/AzzyBot.Bot/Extensions/IHostExtensions.cs @@ -1,10 +1,13 @@ using System; using System.Linq; using System.Threading.Tasks; + using AzzyBot.Data.Services; + using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; + using Npgsql; namespace AzzyBot.Bot.Extensions; diff --git a/src/AzzyBot.Bot/Extensions/IServiceCollectionExtensions.cs b/src/AzzyBot.Bot/Extensions/IServiceCollectionExtensions.cs index aab0cf86..02f96f32 100644 --- a/src/AzzyBot.Bot/Extensions/IServiceCollectionExtensions.cs +++ b/src/AzzyBot.Bot/Extensions/IServiceCollectionExtensions.cs @@ -1,4 +1,5 @@ using System; + using AzzyBot.Bot.Commands; using AzzyBot.Bot.Commands.Checks; using AzzyBot.Bot.Commands.Converters; @@ -11,6 +12,7 @@ using AzzyBot.Core.Utilities.Records; using AzzyBot.Data.Extensions; using AzzyBot.Data.Settings; + using DSharpPlus; using DSharpPlus.Commands; using DSharpPlus.Commands.Processors.SlashCommands; @@ -19,9 +21,12 @@ using DSharpPlus.Interactivity; using DSharpPlus.Interactivity.Enums; using DSharpPlus.Interactivity.Extensions; + using Lavalink4NET.Extensions; + using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; + using NCronJob; namespace AzzyBot.Bot.Extensions; diff --git a/src/AzzyBot.Bot/Services/CronJobManager.cs b/src/AzzyBot.Bot/Services/CronJobManager.cs index b999b449..afde5347 100644 --- a/src/AzzyBot.Bot/Services/CronJobManager.cs +++ b/src/AzzyBot.Bot/Services/CronJobManager.cs @@ -1,8 +1,10 @@ using System; using System.Threading; using System.Threading.Tasks; + using AzzyBot.Bot.Services.CronJobs; using AzzyBot.Bot.Utilities.Records.AzuraCast; + using NCronJob; namespace AzzyBot.Bot.Services; diff --git a/src/AzzyBot.Bot/Services/CronJobs/AzuraRequestJob.cs b/src/AzzyBot.Bot/Services/CronJobs/AzuraRequestJob.cs index 66783b7a..f5ddd7f9 100644 --- a/src/AzzyBot.Bot/Services/CronJobs/AzuraRequestJob.cs +++ b/src/AzzyBot.Bot/Services/CronJobs/AzuraRequestJob.cs @@ -2,12 +2,15 @@ using System.Net.Http; using System.Threading; using System.Threading.Tasks; + using AzzyBot.Bot.Services.Modules; using AzzyBot.Bot.Utilities.Records.AzuraCast; using AzzyBot.Core.Logging; using AzzyBot.Data.Entities; using AzzyBot.Data.Services; + using Microsoft.Extensions.Logging; + using NCronJob; namespace AzzyBot.Bot.Services.CronJobs; diff --git a/src/AzzyBot.Bot/Services/CronJobs/AzzyBotGlobalChecksJob.cs b/src/AzzyBot.Bot/Services/CronJobs/AzzyBotGlobalChecksJob.cs index 60a2adf5..45e6fa96 100644 --- a/src/AzzyBot.Bot/Services/CronJobs/AzzyBotGlobalChecksJob.cs +++ b/src/AzzyBot.Bot/Services/CronJobs/AzzyBotGlobalChecksJob.cs @@ -3,12 +3,16 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; + using AzzyBot.Bot.Services.Modules; using AzzyBot.Core.Logging; using AzzyBot.Data.Entities; using AzzyBot.Data.Services; + using DSharpPlus; + using Microsoft.Extensions.Logging; + using NCronJob; namespace AzzyBot.Bot.Services.CronJobs; diff --git a/src/AzzyBot.Bot/Services/CronJobs/LogfileCleaningJob.cs b/src/AzzyBot.Bot/Services/CronJobs/LogfileCleaningJob.cs index e0c38946..5e48a148 100644 --- a/src/AzzyBot.Bot/Services/CronJobs/LogfileCleaningJob.cs +++ b/src/AzzyBot.Bot/Services/CronJobs/LogfileCleaningJob.cs @@ -4,8 +4,11 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; + using AzzyBot.Core.Logging; + using Microsoft.Extensions.Logging; + using NCronJob; namespace AzzyBot.Bot.Services.CronJobs; diff --git a/src/AzzyBot.Bot/Services/DiscordBotService.cs b/src/AzzyBot.Bot/Services/DiscordBotService.cs index f807a974..170000e3 100644 --- a/src/AzzyBot.Bot/Services/DiscordBotService.cs +++ b/src/AzzyBot.Bot/Services/DiscordBotService.cs @@ -7,6 +7,7 @@ using System.Text; using System.Text.Json; using System.Threading.Tasks; + using AzzyBot.Bot.Commands.Checks; using AzzyBot.Bot.Resources; using AzzyBot.Bot.Settings; @@ -17,6 +18,7 @@ using AzzyBot.Core.Utilities.Helpers; using AzzyBot.Data.Entities; using AzzyBot.Data.Services; + using DSharpPlus; using DSharpPlus.Commands.ContextChecks; using DSharpPlus.Commands.Exceptions; @@ -24,6 +26,7 @@ using DSharpPlus.Commands.Trees; using DSharpPlus.Entities; using DSharpPlus.Exceptions; + using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; diff --git a/src/AzzyBot.Bot/Services/DiscordBotServiceHost.cs b/src/AzzyBot.Bot/Services/DiscordBotServiceHost.cs index e6e8dedf..8773ffa0 100644 --- a/src/AzzyBot.Bot/Services/DiscordBotServiceHost.cs +++ b/src/AzzyBot.Bot/Services/DiscordBotServiceHost.cs @@ -1,9 +1,12 @@ using System.Threading; using System.Threading.Tasks; + using AzzyBot.Bot.Settings; using AzzyBot.Core.Logging; + using DSharpPlus; using DSharpPlus.Entities; + using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; diff --git a/src/AzzyBot.Bot/Services/DiscordEvents/DiscordCommandsErrorHandler.cs b/src/AzzyBot.Bot/Services/DiscordEvents/DiscordCommandsErrorHandler.cs index 8ae09571..4e3b1407 100644 --- a/src/AzzyBot.Bot/Services/DiscordEvents/DiscordCommandsErrorHandler.cs +++ b/src/AzzyBot.Bot/Services/DiscordEvents/DiscordCommandsErrorHandler.cs @@ -1,11 +1,14 @@ using System; using System.Threading.Tasks; + using AzzyBot.Core.Logging; + using DSharpPlus.Commands; using DSharpPlus.Commands.EventArgs; using DSharpPlus.Commands.Exceptions; using DSharpPlus.Commands.Processors.SlashCommands; using DSharpPlus.Exceptions; + using Microsoft.Extensions.Logging; namespace AzzyBot.Bot.Services.DiscordEvents; diff --git a/src/AzzyBot.Bot/Services/DiscordEvents/DiscordErrorsHandler.cs b/src/AzzyBot.Bot/Services/DiscordEvents/DiscordErrorsHandler.cs index 7d4c3980..f62d91a6 100644 --- a/src/AzzyBot.Bot/Services/DiscordEvents/DiscordErrorsHandler.cs +++ b/src/AzzyBot.Bot/Services/DiscordEvents/DiscordErrorsHandler.cs @@ -1,5 +1,6 @@ using System; using System.Threading.Tasks; + using DSharpPlus; using DSharpPlus.Exceptions; diff --git a/src/AzzyBot.Bot/Services/DiscordEvents/DiscordGuildsHandler.cs b/src/AzzyBot.Bot/Services/DiscordEvents/DiscordGuildsHandler.cs index 156edaac..31b59d69 100644 --- a/src/AzzyBot.Bot/Services/DiscordEvents/DiscordGuildsHandler.cs +++ b/src/AzzyBot.Bot/Services/DiscordEvents/DiscordGuildsHandler.cs @@ -2,15 +2,18 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; + using AzzyBot.Bot.Settings; using AzzyBot.Bot.Utilities; using AzzyBot.Bot.Utilities.Helpers; using AzzyBot.Core.Logging; using AzzyBot.Data.Entities; using AzzyBot.Data.Services; + using DSharpPlus; using DSharpPlus.Entities; using DSharpPlus.EventArgs; + using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; diff --git a/src/AzzyBot.Bot/Services/Modules/AzuraCastApiService.cs b/src/AzzyBot.Bot/Services/Modules/AzuraCastApiService.cs index a29ec036..55110658 100644 --- a/src/AzzyBot.Bot/Services/Modules/AzuraCastApiService.cs +++ b/src/AzzyBot.Bot/Services/Modules/AzuraCastApiService.cs @@ -7,6 +7,7 @@ using System.Text; using System.Text.Json; using System.Threading.Tasks; + using AzzyBot.Bot.Utilities; using AzzyBot.Bot.Utilities.Helpers; using AzzyBot.Bot.Utilities.Records.AzuraCast; @@ -14,7 +15,9 @@ using AzzyBot.Core.Utilities; using AzzyBot.Core.Utilities.Encryption; using AzzyBot.Data.Entities; + using DSharpPlus.Commands.Processors.SlashCommands; + using Microsoft.Extensions.Logging; namespace AzzyBot.Bot.Services.Modules; diff --git a/src/AzzyBot.Bot/Services/Modules/AzuraCastFileService.cs b/src/AzzyBot.Bot/Services/Modules/AzuraCastFileService.cs index 93ab6bef..ef58d47e 100644 --- a/src/AzzyBot.Bot/Services/Modules/AzuraCastFileService.cs +++ b/src/AzzyBot.Bot/Services/Modules/AzuraCastFileService.cs @@ -5,6 +5,7 @@ using System.Text; using System.Text.Json; using System.Threading.Tasks; + using AzzyBot.Bot.Utilities; using AzzyBot.Bot.Utilities.Records.AzuraCast; using AzzyBot.Core.Logging; @@ -12,7 +13,9 @@ using AzzyBot.Core.Utilities.Encryption; using AzzyBot.Data.Entities; using AzzyBot.Data.Services; + using DSharpPlus.Entities; + using Microsoft.Extensions.Logging; namespace AzzyBot.Bot.Services.Modules; diff --git a/src/AzzyBot.Bot/Services/Modules/AzuraCastPingService.cs b/src/AzzyBot.Bot/Services/Modules/AzuraCastPingService.cs index 36f6a622..14ca40ad 100644 --- a/src/AzzyBot.Bot/Services/Modules/AzuraCastPingService.cs +++ b/src/AzzyBot.Bot/Services/Modules/AzuraCastPingService.cs @@ -1,11 +1,13 @@ using System; using System.Net.Http; using System.Threading.Tasks; + using AzzyBot.Bot.Utilities.Records.AzuraCast; using AzzyBot.Core.Logging; using AzzyBot.Core.Utilities.Encryption; using AzzyBot.Data.Entities; using AzzyBot.Data.Services; + using Microsoft.Extensions.Logging; namespace AzzyBot.Bot.Services.Modules; diff --git a/src/AzzyBot.Bot/Services/Modules/AzuraCastUpdateService.cs b/src/AzzyBot.Bot/Services/Modules/AzuraCastUpdateService.cs index 123cac3c..9f8a62ac 100644 --- a/src/AzzyBot.Bot/Services/Modules/AzuraCastUpdateService.cs +++ b/src/AzzyBot.Bot/Services/Modules/AzuraCastUpdateService.cs @@ -2,12 +2,14 @@ using System.Collections.Generic; using System.Text.Json; using System.Threading.Tasks; + using AzzyBot.Bot.Resources; using AzzyBot.Bot.Utilities; using AzzyBot.Bot.Utilities.Records.AzuraCast; using AzzyBot.Core.Utilities.Encryption; using AzzyBot.Data.Entities; using AzzyBot.Data.Services; + using DSharpPlus.Entities; namespace AzzyBot.Bot.Services.Modules; diff --git a/src/AzzyBot.Bot/Services/Modules/CoreServiceHost.cs b/src/AzzyBot.Bot/Services/Modules/CoreServiceHost.cs index 60ac2202..68489a03 100644 --- a/src/AzzyBot.Bot/Services/Modules/CoreServiceHost.cs +++ b/src/AzzyBot.Bot/Services/Modules/CoreServiceHost.cs @@ -5,6 +5,7 @@ using System.Text.Json; using System.Threading; using System.Threading.Tasks; + using AzzyBot.Bot.Settings; using AzzyBot.Bot.Utilities; using AzzyBot.Core.Logging; @@ -13,6 +14,7 @@ using AzzyBot.Data.Entities; using AzzyBot.Data.Services; using AzzyBot.Data.Settings; + using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Storage; using Microsoft.Extensions.Hosting; diff --git a/src/AzzyBot.Bot/Services/Modules/MusicStreamingService.cs b/src/AzzyBot.Bot/Services/Modules/MusicStreamingService.cs index 624f92c1..50d0bd99 100644 --- a/src/AzzyBot.Bot/Services/Modules/MusicStreamingService.cs +++ b/src/AzzyBot.Bot/Services/Modules/MusicStreamingService.cs @@ -2,10 +2,13 @@ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Threading.Tasks; + using AzzyBot.Bot.Utilities.Helpers; using AzzyBot.Core.Logging; + using DSharpPlus.Commands.Processors.SlashCommands; using DSharpPlus.Entities; + using Lavalink4NET; using Lavalink4NET.Clients; using Lavalink4NET.Players; @@ -14,6 +17,7 @@ using Lavalink4NET.Rest.Entities; using Lavalink4NET.Rest.Entities.Tracks; using Lavalink4NET.Tracks; + using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; diff --git a/src/AzzyBot.Bot/Services/UpdaterService.cs b/src/AzzyBot.Bot/Services/UpdaterService.cs index 9254ec2f..fa5546ae 100644 --- a/src/AzzyBot.Bot/Services/UpdaterService.cs +++ b/src/AzzyBot.Bot/Services/UpdaterService.cs @@ -3,12 +3,15 @@ using System.Globalization; using System.Text.Json; using System.Threading.Tasks; + using AzzyBot.Bot.Settings; using AzzyBot.Bot.Utilities; using AzzyBot.Bot.Utilities.Records; using AzzyBot.Core.Logging; using AzzyBot.Core.Utilities; + using DSharpPlus.Entities; + using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; diff --git a/src/AzzyBot.Bot/Services/WebRequestService.cs b/src/AzzyBot.Bot/Services/WebRequestService.cs index 288f0666..de4715ef 100644 --- a/src/AzzyBot.Bot/Services/WebRequestService.cs +++ b/src/AzzyBot.Bot/Services/WebRequestService.cs @@ -12,11 +12,13 @@ using System.Text.Json; using System.Threading; using System.Threading.Tasks; + using AzzyBot.Bot.Resources; using AzzyBot.Bot.Utilities; using AzzyBot.Bot.Utilities.Records; using AzzyBot.Core.Logging; using AzzyBot.Core.Utilities; + using Microsoft.Extensions.Logging; namespace AzzyBot.Bot.Services; diff --git a/src/AzzyBot.Bot/Settings/Validators/AppStatsValidator.cs b/src/AzzyBot.Bot/Settings/Validators/AppStatsValidator.cs index befa627b..c672b7ab 100644 --- a/src/AzzyBot.Bot/Settings/Validators/AppStatsValidator.cs +++ b/src/AzzyBot.Bot/Settings/Validators/AppStatsValidator.cs @@ -1,5 +1,7 @@ using System.Diagnostics.CodeAnalysis; + using AzzyBot.Core.Utilities.Records; + using Microsoft.Extensions.Options; namespace AzzyBot.Bot.Settings.Validators; diff --git a/src/AzzyBot.Bot/Settings/Validators/AzzyBotSettingsValidator.cs b/src/AzzyBot.Bot/Settings/Validators/AzzyBotSettingsValidator.cs index 5dc024ee..6d4e9da3 100644 --- a/src/AzzyBot.Bot/Settings/Validators/AzzyBotSettingsValidator.cs +++ b/src/AzzyBot.Bot/Settings/Validators/AzzyBotSettingsValidator.cs @@ -1,4 +1,5 @@ using System.Diagnostics.CodeAnalysis; + using Microsoft.Extensions.Options; namespace AzzyBot.Bot.Settings.Validators; diff --git a/src/AzzyBot.Bot/Settings/Validators/CoreUpdaterValidator.cs b/src/AzzyBot.Bot/Settings/Validators/CoreUpdaterValidator.cs index 5776c799..71de856f 100644 --- a/src/AzzyBot.Bot/Settings/Validators/CoreUpdaterValidator.cs +++ b/src/AzzyBot.Bot/Settings/Validators/CoreUpdaterValidator.cs @@ -1,4 +1,5 @@ using System.Diagnostics.CodeAnalysis; + using Microsoft.Extensions.Options; namespace AzzyBot.Bot.Settings.Validators; diff --git a/src/AzzyBot.Bot/Settings/Validators/DatabaseSettingsValidator.cs b/src/AzzyBot.Bot/Settings/Validators/DatabaseSettingsValidator.cs index 4659419e..5d90ccb9 100644 --- a/src/AzzyBot.Bot/Settings/Validators/DatabaseSettingsValidator.cs +++ b/src/AzzyBot.Bot/Settings/Validators/DatabaseSettingsValidator.cs @@ -1,5 +1,7 @@ using System.Diagnostics.CodeAnalysis; + using AzzyBot.Data.Settings; + using Microsoft.Extensions.Options; namespace AzzyBot.Bot.Settings.Validators; diff --git a/src/AzzyBot.Bot/Settings/Validators/DiscordStatusSettingsValidator.cs b/src/AzzyBot.Bot/Settings/Validators/DiscordStatusSettingsValidator.cs index 0062e541..c9c22987 100644 --- a/src/AzzyBot.Bot/Settings/Validators/DiscordStatusSettingsValidator.cs +++ b/src/AzzyBot.Bot/Settings/Validators/DiscordStatusSettingsValidator.cs @@ -1,4 +1,5 @@ using System.Diagnostics.CodeAnalysis; + using Microsoft.Extensions.Options; namespace AzzyBot.Bot.Settings.Validators; diff --git a/src/AzzyBot.Bot/Settings/Validators/MusicStreamingSettingsValidator.cs b/src/AzzyBot.Bot/Settings/Validators/MusicStreamingSettingsValidator.cs index 89ba39f2..86cea98b 100644 --- a/src/AzzyBot.Bot/Settings/Validators/MusicStreamingSettingsValidator.cs +++ b/src/AzzyBot.Bot/Settings/Validators/MusicStreamingSettingsValidator.cs @@ -1,4 +1,5 @@ using System.Diagnostics.CodeAnalysis; + using Microsoft.Extensions.Options; namespace AzzyBot.Bot.Settings.Validators; diff --git a/src/AzzyBot.Bot/Startup.cs b/src/AzzyBot.Bot/Startup.cs index efdd8c80..d039b764 100644 --- a/src/AzzyBot.Bot/Startup.cs +++ b/src/AzzyBot.Bot/Startup.cs @@ -3,9 +3,11 @@ using System.IO; using System.Linq; using System.Threading.Tasks; + using AzzyBot.Bot.Extensions; using AzzyBot.Core.Extensions; using AzzyBot.Core.Utilities; + using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Options; diff --git a/src/AzzyBot.Bot/Utilities/AzuraFileChecker.cs b/src/AzzyBot.Bot/Utilities/AzuraFileChecker.cs index d68f9c08..67d3f533 100644 --- a/src/AzzyBot.Bot/Utilities/AzuraFileChecker.cs +++ b/src/AzzyBot.Bot/Utilities/AzuraFileChecker.cs @@ -1,4 +1,5 @@ using AzzyBot.Bot.Utilities.Records.AzuraCast; + using TagLib; namespace AzzyBot.Bot.Utilities; diff --git a/src/AzzyBot.Bot/Utilities/AzuraFileComparer.cs b/src/AzzyBot.Bot/Utilities/AzuraFileComparer.cs index 0edfe5c1..c57b84f3 100644 --- a/src/AzzyBot.Bot/Utilities/AzuraFileComparer.cs +++ b/src/AzzyBot.Bot/Utilities/AzuraFileComparer.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; + using AzzyBot.Bot.Utilities.Records.AzuraCast; namespace AzzyBot.Bot.Utilities; diff --git a/src/AzzyBot.Bot/Utilities/AzzyHelp.cs b/src/AzzyBot.Bot/Utilities/AzzyHelp.cs index 5f24af90..f1a7b3e2 100644 --- a/src/AzzyBot.Bot/Utilities/AzzyHelp.cs +++ b/src/AzzyBot.Bot/Utilities/AzzyHelp.cs @@ -1,7 +1,9 @@ using System; using System.Collections.Generic; using System.Linq; + using AzzyBot.Bot.Utilities.Records; + using DSharpPlus.Commands.Trees; using DSharpPlus.Entities; diff --git a/src/AzzyBot.Bot/Utilities/EmbedBuilder.cs b/src/AzzyBot.Bot/Utilities/EmbedBuilder.cs index b824fdaa..b99b4ba4 100644 --- a/src/AzzyBot.Bot/Utilities/EmbedBuilder.cs +++ b/src/AzzyBot.Bot/Utilities/EmbedBuilder.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; + using AzzyBot.Bot.Resources; using AzzyBot.Bot.Utilities.Records; using AzzyBot.Bot.Utilities.Records.AzuraCast; @@ -12,7 +13,9 @@ using AzzyBot.Core.Utilities.Enums; using AzzyBot.Core.Utilities.Records; using AzzyBot.Data.Entities; + using DSharpPlus.Entities; + using Lavalink4NET.Players; using Lavalink4NET.Tracks; diff --git a/src/AzzyBot.Bot/Utilities/JsonDeserializationListSourceGen.cs b/src/AzzyBot.Bot/Utilities/JsonDeserializationListSourceGen.cs index fc25d680..023a59a5 100644 --- a/src/AzzyBot.Bot/Utilities/JsonDeserializationListSourceGen.cs +++ b/src/AzzyBot.Bot/Utilities/JsonDeserializationListSourceGen.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Text.Json.Serialization; + using AzzyBot.Bot.Utilities.Records.AzuraCast; namespace AzzyBot.Bot.Utilities; diff --git a/src/AzzyBot.Bot/Utilities/JsonDeserializationSourceGen.cs b/src/AzzyBot.Bot/Utilities/JsonDeserializationSourceGen.cs index cd544d8c..b3a26f6f 100644 --- a/src/AzzyBot.Bot/Utilities/JsonDeserializationSourceGen.cs +++ b/src/AzzyBot.Bot/Utilities/JsonDeserializationSourceGen.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Text.Json.Serialization; + using AzzyBot.Bot.Utilities.Records; using AzzyBot.Bot.Utilities.Records.AzuraCast; diff --git a/src/AzzyBot.Bot/Utilities/JsonSerializationListSourceGen.cs b/src/AzzyBot.Bot/Utilities/JsonSerializationListSourceGen.cs index bd82ce3c..b67bac94 100644 --- a/src/AzzyBot.Bot/Utilities/JsonSerializationListSourceGen.cs +++ b/src/AzzyBot.Bot/Utilities/JsonSerializationListSourceGen.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Text.Json.Serialization; + using AzzyBot.Bot.Utilities.Records.AzuraCast; namespace AzzyBot.Bot.Utilities; diff --git a/src/AzzyBot.Bot/Utilities/JsonSerializationSourceGen.cs b/src/AzzyBot.Bot/Utilities/JsonSerializationSourceGen.cs index 4c15c71b..2968ef99 100644 --- a/src/AzzyBot.Bot/Utilities/JsonSerializationSourceGen.cs +++ b/src/AzzyBot.Bot/Utilities/JsonSerializationSourceGen.cs @@ -1,5 +1,6 @@ using System.Diagnostics.CodeAnalysis; using System.Text.Json.Serialization; + using AzzyBot.Bot.Settings; using AzzyBot.Bot.Utilities.Records.AzuraCast; using AzzyBot.Core.Utilities.Records; diff --git a/src/AzzyBot.Bot/Utilities/Records/AzuraCast/AzuraPlaylistRecord.cs b/src/AzzyBot.Bot/Utilities/Records/AzuraCast/AzuraPlaylistRecord.cs index 6f32000d..f35fb4f7 100644 --- a/src/AzzyBot.Bot/Utilities/Records/AzuraCast/AzuraPlaylistRecord.cs +++ b/src/AzzyBot.Bot/Utilities/Records/AzuraCast/AzuraPlaylistRecord.cs @@ -1,5 +1,6 @@ using System; using System.Text.Json.Serialization; + using AzzyBot.Bot.Resources; namespace AzzyBot.Bot.Utilities.Records.AzuraCast; diff --git a/src/AzzyBot.Core/Extensions/ILoggingBuilderExtensions.cs b/src/AzzyBot.Core/Extensions/ILoggingBuilderExtensions.cs index 16485e03..76829003 100644 --- a/src/AzzyBot.Core/Extensions/ILoggingBuilderExtensions.cs +++ b/src/AzzyBot.Core/Extensions/ILoggingBuilderExtensions.cs @@ -2,8 +2,10 @@ using System.Globalization; using System.IO; using System.Linq; + using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Console; + using NReco.Logging.File; namespace AzzyBot.Core.Extensions; diff --git a/src/AzzyBot.Core/Logging/LoggerActions.cs b/src/AzzyBot.Core/Logging/LoggerActions.cs index 9aa23ce6..c00c6ada 100644 --- a/src/AzzyBot.Core/Logging/LoggerActions.cs +++ b/src/AzzyBot.Core/Logging/LoggerActions.cs @@ -1,5 +1,6 @@ using System; using System.Net.Http; + using Microsoft.Extensions.Logging; namespace AzzyBot.Core.Logging; diff --git a/src/AzzyBot.Core/Utilities/FileOperations.cs b/src/AzzyBot.Core/Utilities/FileOperations.cs index f9ed1dc4..d70f4b80 100644 --- a/src/AzzyBot.Core/Utilities/FileOperations.cs +++ b/src/AzzyBot.Core/Utilities/FileOperations.cs @@ -6,6 +6,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; + using CsvHelper; using CsvHelper.Configuration; diff --git a/src/AzzyBot.Core/Utilities/HardwareStats.cs b/src/AzzyBot.Core/Utilities/HardwareStats.cs index c5245637..f4cdc9da 100644 --- a/src/AzzyBot.Core/Utilities/HardwareStats.cs +++ b/src/AzzyBot.Core/Utilities/HardwareStats.cs @@ -4,6 +4,7 @@ using System.IO; using System.Runtime.InteropServices; using System.Threading.Tasks; + using AzzyBot.Core.Utilities.Records; namespace AzzyBot.Core.Utilities; diff --git a/src/AzzyBot.Core/Utilities/Misc.cs b/src/AzzyBot.Core/Utilities/Misc.cs index ed771854..06a62150 100644 --- a/src/AzzyBot.Core/Utilities/Misc.cs +++ b/src/AzzyBot.Core/Utilities/Misc.cs @@ -1,6 +1,7 @@ using System; using System.Diagnostics.CodeAnalysis; using System.Text; + using AzzyBot.Core.Utilities.Enums; namespace AzzyBot.Core.Utilities; diff --git a/src/AzzyBot.Core/Utilities/SoftwareStats.cs b/src/AzzyBot.Core/Utilities/SoftwareStats.cs index e00364ea..e2e2e478 100644 --- a/src/AzzyBot.Core/Utilities/SoftwareStats.cs +++ b/src/AzzyBot.Core/Utilities/SoftwareStats.cs @@ -1,6 +1,7 @@ using System; using System.Diagnostics; using System.IO; + using Microsoft.Extensions.Hosting; namespace AzzyBot.Core.Utilities; diff --git a/src/AzzyBot.Data/Entities/GuildEntity.cs b/src/AzzyBot.Data/Entities/GuildEntity.cs index ac0b3c27..a62090c0 100644 --- a/src/AzzyBot.Data/Entities/GuildEntity.cs +++ b/src/AzzyBot.Data/Entities/GuildEntity.cs @@ -1,4 +1,5 @@ using System; + using DSharpPlus.Entities; namespace AzzyBot.Data.Entities; diff --git a/src/AzzyBot.Data/Extensions/IServiceCollectionExtensions.cs b/src/AzzyBot.Data/Extensions/IServiceCollectionExtensions.cs index 88caf85c..ab0a2c37 100644 --- a/src/AzzyBot.Data/Extensions/IServiceCollectionExtensions.cs +++ b/src/AzzyBot.Data/Extensions/IServiceCollectionExtensions.cs @@ -1,9 +1,13 @@ using System.Text; + using AzzyBot.Core.Utilities.Encryption; using AzzyBot.Data.Services; + using EntityFramework.Exceptions.PostgreSQL; + using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; + using Npgsql; namespace AzzyBot.Data.Extensions; diff --git a/src/AzzyBot.Data/Services/AzzyDbContext.cs b/src/AzzyBot.Data/Services/AzzyDbContext.cs index 58185792..7b6c7a60 100644 --- a/src/AzzyBot.Data/Services/AzzyDbContext.cs +++ b/src/AzzyBot.Data/Services/AzzyDbContext.cs @@ -1,4 +1,5 @@ using AzzyBot.Data.Entities; + using Microsoft.EntityFrameworkCore; namespace AzzyBot.Data.Services; diff --git a/src/AzzyBot.Data/Services/DbActions.cs b/src/AzzyBot.Data/Services/DbActions.cs index 3cc6231c..dc3347ba 100644 --- a/src/AzzyBot.Data/Services/DbActions.cs +++ b/src/AzzyBot.Data/Services/DbActions.cs @@ -2,11 +2,14 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; + using AzzyBot.Core.Logging; using AzzyBot.Core.Utilities.Encryption; using AzzyBot.Data.Entities; using AzzyBot.Data.Extensions; + using DSharpPlus.Entities; + using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Storage; using Microsoft.Extensions.Logging; diff --git a/src/AzzyBot.Data/Services/DbMaintenance.cs b/src/AzzyBot.Data/Services/DbMaintenance.cs index f7e92af7..844830bf 100644 --- a/src/AzzyBot.Data/Services/DbMaintenance.cs +++ b/src/AzzyBot.Data/Services/DbMaintenance.cs @@ -1,8 +1,11 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; + using AzzyBot.Core.Logging; + using DSharpPlus.Entities; + using Microsoft.Extensions.Logging; namespace AzzyBot.Data.Services; From 74a5fd69a50b4c814ed203d89b7dc2ae4c4a1378 Mon Sep 17 00:00:00 2001 From: Sella-GH <147769367+Sella-GH@users.noreply.github.com> Date: Mon, 30 Dec 2024 22:08:17 +0100 Subject: [PATCH 4/5] Change some more `.editorconfig` things --- .editorconfig | 51 ++++++++++++++----- src/AzzyBot.Bot/Commands/AzuraCastCommands.cs | 2 +- .../Checks/AzuraCastDiscordPermCheck.cs | 2 +- .../Services/Modules/AzuraCastApiService.cs | 2 +- src/AzzyBot.Bot/Utilities/AzzyHelp.cs | 2 +- 5 files changed, 41 insertions(+), 18 deletions(-) diff --git a/.editorconfig b/.editorconfig index 8b5e71f0..0766d479 100644 --- a/.editorconfig +++ b/.editorconfig @@ -22,8 +22,6 @@ generated_code = true # C# files [*.cs] -# C# 10 features -csharp_style_namespace_declarations=file_scoped:warning # New line preferences csharp_new_line_before_open_brace = all @@ -85,22 +83,45 @@ dotnet_naming_style.camel_case_underscore_style.required_prefix = _ dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case # Code style defaults -csharp_using_directive_placement = outside_namespace:warning -dotnet_sort_system_directives_first = true -dotnet_separate_import_directive_groups = true csharp_prefer_braces = when_multiline:warning -csharp_preserve_single_line_blocks = true:warning -csharp_preserve_single_line_statements = false:warning csharp_prefer_static_anonymous_function = true:warning csharp_prefer_static_local_function = true:warning -csharp_prefer_simple_using_statement = false:warning +csharp_prefer_simple_using_statement = true:warning +csharp_prefer_system_threading_lock = true:warning +csharp_preserve_single_line_blocks = true:warning +csharp_preserve_single_line_statements = false:warning +csharp_style_deconstructed_variable_declaration = true:warning +csharp_style_implicit_object_creation_when_type_is_apparent = true:warning +csharp_style_namespace_declarations=file_scoped:warning +csharp_style_prefer_extended_property_pattern = true:warning +csharp_style_prefer_local_over_anonymous_function = true:warning +csharp_style_prefer_method_group_conversion = true:warning +csharp_style_prefer_null_check_over_type_check = true:warning +csharp_style_prefer_primary_constructors = true:warning +csharp_style_prefer_readonly_struct = true:warning +csharp_style_prefer_readonly_struct_member = true:warning csharp_style_prefer_switch_expression = true:warning +csharp_style_prefer_top_level_statements = false:warning +csharp_style_prefer_tuple_swap = true:warning +csharp_style_prefer_utf8_string_literals = true:warning +csharp_style_unused_value_assignment_preference = discard_variable:warning +csharp_style_unused_value_expression_statement_preference = discard_variable:warning +csharp_using_directive_placement = outside_namespace:warning +dotnet_separate_import_directive_groups = true:warning +dotnet_sort_system_directives_first = true:warning +dotnet_style_explicit_tuple_names = true:warning +dotnet_style_namespace_match_folder = true:warning +dotnet_style_prefer_compound_assignment = true:warning +dotnet_style_prefer_foreach_explicit_cast_in_source = always:warning +dotnet_style_prefer_simplified_boolean_expressions = true:warning +dotnet_style_prefer_simplified_interpolation = true:warning dotnet_style_readonly_field = true:warning +dotnet_style_require_accessibility_modifiers = true:warning # Expression-level preferences +csharp_prefer_simple_default_expression = true:warning dotnet_style_object_initializer = true:warning dotnet_style_collection_initializer = true:warning -dotnet_style_explicit_tuple_names = true:warning dotnet_style_coalesce_expression = true:warning dotnet_style_null_propagation = true:warning dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning @@ -109,8 +130,7 @@ dotnet_style_prefer_inferred_anonymous_type_member_names = true:warning dotnet_style_prefer_auto_properties = true:warning dotnet_style_prefer_conditional_expression_over_assignment = true:warning dotnet_style_prefer_conditional_expression_over_return = true:warning -dotnet_style_prefer_collection_expression = when_types_exactly_match -csharp_prefer_simple_default_expression = true:warning +dotnet_style_prefer_collection_expression = when_types_loosely_match:warning # Expression-bodied members csharp_style_expression_bodied_methods = when_on_single_line:warning @@ -123,18 +143,21 @@ csharp_style_expression_bodied_lambdas = true:warning csharp_style_expression_bodied_local_functions = true:warning # Pattern matching +csharp_style_inlined_variable_declaration = true:warning csharp_style_pattern_matching_over_is_with_cast_check = true:warning csharp_style_pattern_matching_over_as_with_null_check = true:warning -csharp_style_inlined_variable_declaration = true:warning +csharp_style_prefer_not_pattern = true:warning +csharp_style_prefer_pattern_matching = true:warning # Null checking preferences csharp_style_throw_expression = true:warning csharp_style_conditional_delegate_call = true:warning # Other features -csharp_style_prefer_index_operator = false:warning -csharp_style_prefer_range_operator = false:warning +csharp_style_prefer_index_operator = true:warning +csharp_style_prefer_range_operator = true:warning csharp_style_pattern_local_over_anonymous_function = false:warning +dotnet_code_quality_unused_parameters = all:warning # Space preferences csharp_space_after_cast = false diff --git a/src/AzzyBot.Bot/Commands/AzuraCastCommands.cs b/src/AzzyBot.Bot/Commands/AzuraCastCommands.cs index 606bb763..01d52c2a 100644 --- a/src/AzzyBot.Bot/Commands/AzuraCastCommands.cs +++ b/src/AzzyBot.Bot/Commands/AzuraCastCommands.cs @@ -875,7 +875,7 @@ public async ValueTask GetSongHistoryAsync return; } - IEnumerable exportHistory = history.Select(h => new AzuraStationHistoryExportRecord() { Date = dateString, PlayedAt = Converter.ConvertFromUnixTime(h.PlayedAt), Song = h.Song, SongRequest = h.IsRequest, Streamer = h.Streamer, Playlist = h.Playlist }).Reverse().ToList(); + IEnumerable exportHistory = [.. history.Select(h => new AzuraStationHistoryExportRecord() { Date = dateString, PlayedAt = Converter.ConvertFromUnixTime(h.PlayedAt), Song = h.Song, SongRequest = h.IsRequest, Streamer = h.Streamer, Playlist = h.Playlist }).Reverse()]; string fileName = $"{ac.GuildId}-{ac.Id}-{acStation.Id}-{acStation.StationId}_SongHistory_{dateStringFile}.csv"; string filePath = await FileOperations.CreateCsvFileAsync(exportHistory, fileName); await using FileStream fileStream = new(filePath, FileMode.Open, FileAccess.Read); diff --git a/src/AzzyBot.Bot/Commands/Checks/AzuraCastDiscordPermCheck.cs b/src/AzzyBot.Bot/Commands/Checks/AzuraCastDiscordPermCheck.cs index 2b16e13b..49fdbbbb 100644 --- a/src/AzzyBot.Bot/Commands/Checks/AzuraCastDiscordPermCheck.cs +++ b/src/AzzyBot.Bot/Commands/Checks/AzuraCastDiscordPermCheck.cs @@ -84,7 +84,7 @@ public class AzuraCastDiscordPermCheck(ILogger logger IEnumerable userRoles = context.Member.Roles; foreach (AzuraCastDiscordPerm perm in attribute.Perms) { - result = CheckPermission(perm, guildRoles, azuraCast, station, userRoles.ToList(), context.Command.FullName); + result = CheckPermission(perm, guildRoles, azuraCast, station, [.. userRoles], context.Command.FullName); if (result is not null) break; } diff --git a/src/AzzyBot.Bot/Services/Modules/AzuraCastApiService.cs b/src/AzzyBot.Bot/Services/Modules/AzuraCastApiService.cs index 55110658..01757e06 100644 --- a/src/AzzyBot.Bot/Services/Modules/AzuraCastApiService.cs +++ b/src/AzzyBot.Bot/Services/Modules/AzuraCastApiService.cs @@ -592,7 +592,7 @@ public async Task RequestInternalSongAsync(Uri baseUrl, string apiKey, int stati if (lastSlash is -1) throw new InvalidOperationException($"Invalid song path: {songPath}"); - AzuraInternalRequestRecord songRequest = new(songPath.Substring(0, lastSlash), AzuraApiEndpoints.Queue, [songPath]); + AzuraInternalRequestRecord songRequest = new(songPath[..lastSlash], AzuraApiEndpoints.Queue, [songPath]); await PutToApiAsync(baseUrl, endpoint, JsonSerializer.Serialize(songRequest, JsonSerializationSourceGen.Default.AzuraInternalRequestRecord), CreateHeader(apiKey)); } diff --git a/src/AzzyBot.Bot/Utilities/AzzyHelp.cs b/src/AzzyBot.Bot/Utilities/AzzyHelp.cs index f1a7b3e2..c445a7c0 100644 --- a/src/AzzyBot.Bot/Utilities/AzzyHelp.cs +++ b/src/AzzyBot.Bot/Utilities/AzzyHelp.cs @@ -55,7 +55,7 @@ private static Dictionary> GetCommandGroups(IReadOn foreach (string group in commandGroups) { Command command = commands[group]; - List subCommands = GetCommands(command.Subcommands.Where(static c => c.Description is not "No description provided.").ToList(), command.Name, singleCommand); + List subCommands = GetCommands([.. command.Subcommands.Where(static c => c.Description is not "No description provided.")], command.Name, singleCommand); foreach (Command subCommand in command.Subcommands.Where(static c => c.Subcommands.Count > 0)) { subCommands.AddRange(GetCommands(subCommand.Subcommands, command.Name, singleCommand)); From da21088813927cab38046cb6d75cfc030c6ea93b Mon Sep 17 00:00:00 2001 From: Sella-GH <147769367+Sella-GH@users.noreply.github.com> Date: Mon, 30 Dec 2024 22:08:31 +0100 Subject: [PATCH 5/5] Prefer some more collection expressions --- src/AzzyBot.Data/Services/DbActions.cs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/AzzyBot.Data/Services/DbActions.cs b/src/AzzyBot.Data/Services/DbActions.cs index dc3347ba..6d946147 100644 --- a/src/AzzyBot.Data/Services/DbActions.cs +++ b/src/AzzyBot.Data/Services/DbActions.cs @@ -170,10 +170,9 @@ public async Task> AddGuildsAsync(IReadOnlyDictionary< ArgumentNullException.ThrowIfNull(guilds); IEnumerable existingGuilds = _dbContext.Guilds; - IEnumerable newGuilds = guilds.Keys + IEnumerable newGuilds = [.. guilds.Keys .Where(guild => !existingGuilds.Select(static g => g.UniqueId).Contains(guild)) - .Select(static guild => new GuildEntity() { UniqueId = guild }) - .ToList(); + .Select(static guild => new GuildEntity() { UniqueId = guild })]; if (!newGuilds.Any()) return []; @@ -212,9 +211,7 @@ public async Task> DeleteGuildsAsync(IReadOnlyDictionary existingGuilds = _dbContext.Guilds; - IEnumerable guildsToDelete = existingGuilds - .Where(guild => !guilds.Keys.Contains(guild.UniqueId)) - .ToList(); + IEnumerable guildsToDelete = [.. existingGuilds.Where(guild => !guilds.Keys.Contains(guild.UniqueId))]; if (!guildsToDelete.Any()) return [];