Skip to content

Commit 92ffe44

Browse files
Sella-GHCopilot
andauthored
[release] 2.2.2 (#251)
* Add AzzyBot Maintenance Database Table (#249) * Move log statement for update checking * Create new Database Entity and actions * Add conditional debug / release environment specification * Ensure the AzzyBot table is created at startup * Add the table via migrations * Use it * Align file logging with console logging and update changelog * Fix the check if the instance is really offline (#250) * Fix the check if the instance is really offline * Update CHANGELOG.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Sella-GH <147769367+Sella-GH@users.noreply.github.com> * Update again * Update src/AzzyBot.Bot/Commands/AzuraCastCommands.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Sella-GH <147769367+Sella-GH@users.noreply.github.com> * More spelling --------- Signed-off-by: Sella-GH <147769367+Sella-GH@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Change execution time of automatic checks to include a buffer * Update DSP * Update version --------- Signed-off-by: Sella-GH <147769367+Sella-GH@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent de0e7d4 commit 92ffe44

18 files changed

+646
-46
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
## 2.2.2 - 2025-01-07
2+
### Dependencies
3+
- Updated [DSharpPlus](https://github.com/DSharpPlus/DSharpPlus) to version 5.0.0-nightly-02445
4+
5+
### Fixes
6+
- There won't be any update checks or database cleanups any 15 minutes anymore
7+
- The GitHub update url to the new version now really points to the release and not the API
8+
- File logging now shows the EventId properly instead of the event name to align with the console logging
9+
- You can now correctly force the check to determine if AzuraCast is offline
10+
- Some spelling mistakes were corrected
11+
- Automatic checks getting executed correctly now when their time has come
12+
113
## 2.2.1 - 2025-01-05
214
### Dependencies
315
- Updated [DSharpPlus](https://github.com/DSharpPlus/DSharpPlus) to version 5.0.0-nightly-02445

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
<NeutralLanguage>en</NeutralLanguage>
4747
<RepositoryType>Git</RepositoryType>
4848
<RepositoryUrl>https://github.com/Sella-GH/AzzyBot</RepositoryUrl>
49-
<Version>2.2.1</Version>
49+
<Version>2.2.2</Version>
5050
</PropertyGroup>
5151

5252
<!-- Runtimeconfig settings -->

Directory.Packages.props

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
</PropertyGroup>
55
<ItemGroup>
66
<PackageVersion Include="CsvHelper" Version="33.0.1" />
7-
<PackageVersion Include="DSharpPlus" Version="5.0.0-nightly-02445" />
8-
<PackageVersion Include="DSharpPlus.Commands" Version="5.0.0-nightly-02445" />
9-
<PackageVersion Include="DSharpPlus.Interactivity" Version="5.0.0-nightly-02445" />
7+
<PackageVersion Include="DSharpPlus" Version="5.0.0-nightly-02446" />
8+
<PackageVersion Include="DSharpPlus.Commands" Version="5.0.0-nightly-02446" />
9+
<PackageVersion Include="DSharpPlus.Interactivity" Version="5.0.0-nightly-02446" />
1010
<PackageVersion Include="EntityFrameworkCore.Exceptions.PostgreSQL" Version="8.1.3" />
1111
<PackageVersion Include="Lavalink4NET.DSharpPlus.Nightly" Version="4.0.26-preview.4" />
1212
<PackageVersion Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.0" />

src/AzzyBot.Bot/Commands/AzuraCastCommands.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ namespace AzzyBot.Bot.Commands;
4040
[SuppressMessage("Design", "CA1034:Nested types should not be visible", Justification = "DSharpPlus best practice")]
4141
public sealed class AzuraCastCommands
4242
{
43-
[Command("azuracast"), RequireGuild, RequirePermissions(UserPermissions = [DiscordPermission.Administrator]), ModuleActivatedCheck([AzzyModules.LegalTerms, AzzyModules.AzuraCast]), AzuraCastOnlineCheck]
43+
[Command("azuracast"), RequireGuild, RequirePermissions(UserPermissions = [DiscordPermission.Administrator]), ModuleActivatedCheck([AzzyModules.LegalTerms, AzzyModules.AzuraCast])]
4444
public sealed class AzuraCastGroup(ILogger<AzuraCastGroup> logger, AzuraCastApiService azuraCastApi, AzuraCastFileService azuraCastFile, AzuraCastPingService azuraCastPing, AzuraCastUpdateService azuraCastUpdate, DbActions dbActions, DiscordBotService botService, MusicStreamingService musicStreaming)
4545
{
4646
private readonly ILogger<AzuraCastGroup> _logger = logger;
@@ -52,7 +52,7 @@ public sealed class AzuraCastGroup(ILogger<AzuraCastGroup> logger, AzuraCastApiS
5252
private readonly DiscordBotService _botService = botService;
5353
private readonly MusicStreamingService _musicStreaming = musicStreaming;
5454

55-
[Command("export-playlists"), Description("Export all playlists from the selected AzuraCast station into a zip file."), AzuraCastDiscordPermCheck([AzuraCastDiscordPerm.StationAdminGroup, AzuraCastDiscordPerm.InstanceAdminGroup])]
55+
[Command("export-playlists"), Description("Export all playlists from the selected AzuraCast station into a zip file."), AzuraCastDiscordPermCheck([AzuraCastDiscordPerm.StationAdminGroup, AzuraCastDiscordPerm.InstanceAdminGroup]), AzuraCastOnlineCheck]
5656
public async ValueTask ExportPlaylistsAsync
5757
(
5858
SlashCommandContext context,
@@ -143,7 +143,7 @@ public async ValueTask ExportPlaylistsAsync
143143
FileOperations.DeleteFiles(filePaths);
144144
}
145145

146-
[Command("force-api-permission-check"), Description("Force the bot to check if the entered api key has access to all required permissions."), AzuraCastDiscordPermCheck([AzuraCastDiscordPerm.StationAdminGroup, AzuraCastDiscordPerm.InstanceAdminGroup])]
146+
[Command("force-api-permission-check"), Description("Force the bot to check if the entered api key has access to all required permissions."), AzuraCastDiscordPermCheck([AzuraCastDiscordPerm.StationAdminGroup, AzuraCastDiscordPerm.InstanceAdminGroup]), AzuraCastOnlineCheck]
147147
public async ValueTask ForceApiPermissionCheckAsync
148148
(
149149
SlashCommandContext context,
@@ -183,7 +183,7 @@ public async ValueTask ForceApiPermissionCheckAsync
183183
await context.EditResponseAsync("I initiated the permission check.\nThere won't be another message if your permissions are set correctly.");
184184
}
185185

186-
[Command("force-cache-refresh"), Description("Force the bot to refresh it's local song cache for a specific station."), AzuraCastDiscordPermCheck([AzuraCastDiscordPerm.StationAdminGroup, AzuraCastDiscordPerm.InstanceAdminGroup])]
186+
[Command("force-cache-refresh"), Description("Force the bot to refresh its local song cache for a specific station."), AzuraCastDiscordPermCheck([AzuraCastDiscordPerm.StationAdminGroup, AzuraCastDiscordPerm.InstanceAdminGroup]), AzuraCastOnlineCheck]
187187
public async ValueTask ForceCacheRefreshAsync
188188
(
189189
SlashCommandContext context,
@@ -246,7 +246,7 @@ public async ValueTask ForceOnlineCheckAsync(SlashCommandContext context)
246246
await _azuraCastPing.PingInstanceAsync(dAzuraCast);
247247
}
248248

249-
[Command("force-update-check"), Description("Force the bot to search for AzuraCast Updates."), AzuraCastDiscordPermCheck([AzuraCastDiscordPerm.InstanceAdminGroup])]
249+
[Command("force-update-check"), Description("Force the bot to search for AzuraCast Updates."), AzuraCastDiscordPermCheck([AzuraCastDiscordPerm.InstanceAdminGroup]), AzuraCastOnlineCheck]
250250
public async ValueTask ForceUpdateCheckAsync(SlashCommandContext context)
251251
{
252252
ArgumentNullException.ThrowIfNull(context);
@@ -266,7 +266,7 @@ public async ValueTask ForceUpdateCheckAsync(SlashCommandContext context)
266266
await _azuraCastUpdate.CheckForAzuraCastUpdatesAsync(dAzuraCast, true);
267267
}
268268

269-
[Command("get-system-logs"), Description("Get the system logs of the AzuraCast instance."), AzuraCastDiscordPermCheck([AzuraCastDiscordPerm.InstanceAdminGroup])]
269+
[Command("get-system-logs"), Description("Get the system logs of the AzuraCast instance."), AzuraCastDiscordPermCheck([AzuraCastDiscordPerm.InstanceAdminGroup]), AzuraCastOnlineCheck]
270270
public async ValueTask GetSystemLogsAsync
271271
(
272272
SlashCommandContext context,
@@ -338,7 +338,7 @@ public async ValueTask GetHardwareStatsAsync(SlashCommandContext context)
338338
await context.EditResponseAsync(embed);
339339
}
340340

341-
[Command("start-station"), Description("Start the selected station."), AzuraCastDiscordPermCheck([AzuraCastDiscordPerm.StationAdminGroup, AzuraCastDiscordPerm.InstanceAdminGroup])]
341+
[Command("start-station"), Description("Start the selected station."), AzuraCastDiscordPermCheck([AzuraCastDiscordPerm.StationAdminGroup, AzuraCastDiscordPerm.InstanceAdminGroup]), AzuraCastOnlineCheck]
342342
public async ValueTask StartStationAsync
343343
(
344344
SlashCommandContext context,
@@ -382,7 +382,7 @@ public async ValueTask StartStationAsync
382382
await context.FollowupAsync($"I started the station **{azuraStation.Name}**.");
383383
}
384384

385-
[Command("stop-station"), Description("Stop the selected station."), AzuraCastDiscordPermCheck([AzuraCastDiscordPerm.StationAdminGroup, AzuraCastDiscordPerm.InstanceAdminGroup])]
385+
[Command("stop-station"), Description("Stop the selected station."), AzuraCastDiscordPermCheck([AzuraCastDiscordPerm.StationAdminGroup, AzuraCastDiscordPerm.InstanceAdminGroup]), AzuraCastOnlineCheck]
386386
public async ValueTask StopStationAsync
387387
(
388388
SlashCommandContext context,
@@ -447,7 +447,7 @@ public async ValueTask StopStationAsync
447447
}
448448
}
449449

450-
[Command("toggle-song-requests"), Description("Enable or disable song requests for the selected station."), AzuraCastDiscordPermCheck([AzuraCastDiscordPerm.StationAdminGroup, AzuraCastDiscordPerm.InstanceAdminGroup])]
450+
[Command("toggle-song-requests"), Description("Enable or disable song requests for the selected station."), AzuraCastDiscordPermCheck([AzuraCastDiscordPerm.StationAdminGroup, AzuraCastDiscordPerm.InstanceAdminGroup]), AzuraCastOnlineCheck]
451451
public async ValueTask ToggleSongRequestsAsync
452452
(
453453
SlashCommandContext context,
@@ -492,7 +492,7 @@ public async ValueTask ToggleSongRequestsAsync
492492
await context.EditResponseAsync($"I {Misc.GetReadableBool(stationConfig.EnableRequests, ReadableBool.EnabledDisabled, true)} song requests for station **{stationConfig.Name}**.");
493493
}
494494

495-
[Command("update-instance"), Description("Update the AzuraCast instance to the latest version."), AzuraCastDiscordPermCheck([AzuraCastDiscordPerm.InstanceAdminGroup])]
495+
[Command("update-instance"), Description("Update the AzuraCast instance to the latest version."), AzuraCastDiscordPermCheck([AzuraCastDiscordPerm.InstanceAdminGroup]), AzuraCastOnlineCheck]
496496
public async ValueTask UpdateInstanceAsync(SlashCommandContext context)
497497
{
498498
ArgumentNullException.ThrowIfNull(context);

src/AzzyBot.Bot/Commands/CoreCommands.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public async ValueTask HardwareStatsAsync(SlashCommandContext context)
128128
await context.EditResponseAsync(embed);
129129
}
130130

131-
[Command("info"), Description("Shows information about the bot and it's components.")]
131+
[Command("info"), Description("Shows information about the bot and its components.")]
132132
public async ValueTask InfoStatsAsync(SlashCommandContext context)
133133
{
134134
ArgumentNullException.ThrowIfNull(context);

src/AzzyBot.Bot/Services/CronJobs/AzzyBotGlobalChecksJob.cs

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,34 +25,26 @@ public sealed class AzzyBotGlobalChecksJob(ILogger<AzzyBotGlobalChecksJob> logge
2525
private readonly DiscordBotService _botService = botService;
2626
private readonly DiscordClient _discordClient = discordClient;
2727
private readonly UpdaterService _updater = updater;
28-
private DateTimeOffset _lastAzzyUpdateCheck = DateTimeOffset.MinValue;
29-
private DateTimeOffset _lastDatabaseCleanup = DateTimeOffset.MinValue;
3028

3129
public async Task RunAsync(IJobExecutionContext context, CancellationToken token)
3230
{
3331
_logger.GlobalTimerTick();
32+
AzzyBotEntity azzyBot = await _dbActions.GetAzzyBotAsync() ?? throw new InvalidOperationException("AzzyBot entity is missing from the database.");
3433
IReadOnlyList<GuildEntity> guilds = await _dbActions.GetGuildsAsync(loadEverything: true);
3534
DateTimeOffset utcNow = DateTimeOffset.UtcNow;
3635

37-
if (utcNow - _lastDatabaseCleanup >= TimeSpan.FromHours(24))
38-
{
36+
if (utcNow - azzyBot.LastDatabaseCleanup >= TimeSpan.FromHours(23.85))
3937
await _dbMaintenance.CleanupLeftoverGuildsAsync(_discordClient.Guilds);
40-
_lastDatabaseCleanup = utcNow;
41-
}
4238

43-
if (utcNow - _lastAzzyUpdateCheck >= TimeSpan.FromHours(6))
44-
{
45-
_logger.GlobalTimerCheckForUpdates();
39+
if (utcNow - azzyBot.LastUpdateCheck >= TimeSpan.FromHours(5.85))
4640
await _updater.CheckForAzzyUpdatesAsync();
47-
_lastAzzyUpdateCheck = utcNow;
48-
}
4941

50-
List<GuildEntity> guildsWorkingSet = [.. guilds.Where(g => utcNow - g.LastPermissionCheck >= TimeSpan.FromHours(12))];
42+
List<GuildEntity> guildsWorkingSet = [.. guilds.Where(g => utcNow - g.LastPermissionCheck >= TimeSpan.FromHours(11.85))];
5143
_logger.GlobalTimerCheckForChannelPermissions(guildsWorkingSet.Count);
5244
if (guildsWorkingSet.Count is not 0)
5345
await _botService.CheckPermissionsAsync(guildsWorkingSet);
5446

55-
guildsWorkingSet = [.. guilds.Where(g => g.AzuraCast?.Checks.ServerStatus is true && utcNow - g.AzuraCast.Checks.LastServerStatusCheck >= TimeSpan.FromMinutes(15))];
47+
guildsWorkingSet = [.. guilds.Where(g => g.AzuraCast?.Checks.ServerStatus is true)];
5648
_logger.GlobalTimerCheckForAzuraCastStatus(guildsWorkingSet.Count);
5749
if (guildsWorkingSet.Count is not 0)
5850
{
@@ -64,7 +56,7 @@ public async Task RunAsync(IJobExecutionContext context, CancellationToken token
6456

6557
// Get it just one more time to check if the instance is offline
6658
guilds = await _dbActions.GetGuildsAsync(loadEverything: true);
67-
guildsWorkingSet = [.. guilds.Where(g => g.AzuraCast?.IsOnline is true && utcNow - g.AzuraCast.Checks.LastServerStatusCheck >= TimeSpan.FromHours(12))];
59+
guildsWorkingSet = [.. guilds.Where(g => g.AzuraCast?.IsOnline is true && utcNow - g.AzuraCast.Checks.LastServerStatusCheck >= TimeSpan.FromHours(11.85))];
6860
_logger.GlobalTimerCheckForAzuraCastApi(guildsWorkingSet.Count);
6961
if (guildsWorkingSet.Count is not 0)
7062
{
@@ -74,20 +66,20 @@ public async Task RunAsync(IJobExecutionContext context, CancellationToken token
7466
}
7567
}
7668

77-
guildsWorkingSet = [.. guilds.Where(g => g.AzuraCast?.IsOnline is true && g.AzuraCast.Stations.Any(s => s.Checks.FileChanges && utcNow - s.Checks.LastFileChangesCheck >= TimeSpan.FromHours(1)))];
69+
guildsWorkingSet = [.. guilds.Where(g => g.AzuraCast?.IsOnline is true && g.AzuraCast.Stations.Any(s => s.Checks.FileChanges && utcNow - s.Checks.LastFileChangesCheck >= TimeSpan.FromHours(0.85)))];
7870
_logger.GlobalTimerCheckForAzuraCastFiles(guildsWorkingSet.Count);
7971
if (guildsWorkingSet.Count is not 0)
8072
{
8173
foreach (GuildEntity guild in guildsWorkingSet)
8274
{
83-
foreach (AzuraCastStationEntity station in guild.AzuraCast!.Stations.Where(s => s.Checks.FileChanges && utcNow - s.Checks.LastFileChangesCheck >= TimeSpan.FromHours(1)))
75+
foreach (AzuraCastStationEntity station in guild.AzuraCast!.Stations.Where(s => s.Checks.FileChanges && utcNow - s.Checks.LastFileChangesCheck >= TimeSpan.FromHours(0.85)))
8476
{
8577
await _azuraFileService.CheckForFileChangesAsync(station);
8678
}
8779
}
8880
}
8981

90-
guildsWorkingSet = [.. guilds.Where(g => g.AzuraCast?.IsOnline is true && g.AzuraCast.Checks.Updates && utcNow - g.AzuraCast.Checks.LastUpdateCheck >= TimeSpan.FromHours(6))];
82+
guildsWorkingSet = [.. guilds.Where(g => g.AzuraCast?.IsOnline is true && g.AzuraCast.Checks.Updates && utcNow - g.AzuraCast.Checks.LastUpdateCheck >= TimeSpan.FromHours(5.85))];
9183
_logger.GlobalTimerCheckForAzuraCastUpdates(guildsWorkingSet.Count);
9284
if (guildsWorkingSet.Count is not 0)
9385
{

src/AzzyBot.Bot/Services/Modules/CoreServiceHost.cs

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
namespace AzzyBot.Bot.Services.Modules;
2323

24-
public sealed class CoreServiceHost(ILogger<CoreServiceHost> logger, IOptions<AzzyBotSettings> azzySettings, IOptions<CoreUpdaterSettings> updaterSettings, IOptions<DatabaseSettings> dbSettings, IOptions<DiscordStatusSettings> discordSettings, IOptions<MusicStreamingSettings> musicStreamingSettings, AzzyDbContext dbContext) : IHostedService
24+
public sealed class CoreServiceHost(ILogger<CoreServiceHost> logger, IOptions<AzzyBotSettings> azzySettings, IOptions<DatabaseSettings> dbSettings, IOptions<DiscordStatusSettings> discordSettings, IOptions<MusicStreamingSettings> musicStreamingSettings, IOptions<CoreUpdaterSettings> updaterSettings, AzzyDbContext dbContext) : IHostedService
2525
{
2626
private readonly ILogger<CoreServiceHost> _logger = logger;
2727
private readonly AzzyBotSettings _azzySettings = azzySettings.Value;
@@ -44,6 +44,8 @@ public async Task StartAsync(CancellationToken cancellationToken)
4444

4545
if (!string.IsNullOrWhiteSpace(_dbSettings.NewEncryptionKey) && (_dbSettings.NewEncryptionKey != _dbSettings.EncryptionKey))
4646
await ReencryptDatabaseAsync();
47+
48+
await EnsureAzzyBotDbTableIsCreatedAsync();
4749
}
4850

4951
public Task StopAsync(CancellationToken cancellationToken)
@@ -53,6 +55,27 @@ public Task StopAsync(CancellationToken cancellationToken)
5355
return _completed;
5456
}
5557

58+
private async Task EnsureAzzyBotDbTableIsCreatedAsync()
59+
{
60+
if (await _dbContext.AzzyBot.AnyAsync())
61+
return;
62+
63+
await using IDbContextTransaction transaction = await _dbContext.Database.BeginTransactionAsync();
64+
65+
try
66+
{
67+
await _dbContext.AzzyBot.AddAsync(new AzzyBotEntity());
68+
69+
await _dbContext.SaveChangesAsync();
70+
await transaction.CommitAsync();
71+
}
72+
catch (Exception ex) when (ex is DbUpdateConcurrencyException or DbUpdateException)
73+
{
74+
await transaction.RollbackAsync();
75+
throw new InvalidOperationException("An error occured while creating the AzzyBot table", ex);
76+
}
77+
}
78+
5679
private async Task ReencryptDatabaseAsync()
5780
{
5881
ArgumentException.ThrowIfNullOrWhiteSpace(_dbSettings.EncryptionKey);

src/AzzyBot.Bot/Services/UpdaterService.cs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,27 @@
88
using AzzyBot.Bot.Utilities.Records;
99
using AzzyBot.Core.Logging;
1010
using AzzyBot.Core.Utilities;
11+
using AzzyBot.Data.Services;
1112
using DSharpPlus.Entities;
1213
using Microsoft.Extensions.Logging;
1314
using Microsoft.Extensions.Options;
1415

1516
namespace AzzyBot.Bot.Services;
1617

17-
public sealed class UpdaterService(ILogger<UpdaterService> logger, IOptions<AzzyBotSettings> botSettings, IOptions<CoreUpdaterSettings> updaterSettings, DiscordBotService botService, WebRequestService webService)
18+
public sealed class UpdaterService(ILogger<UpdaterService> logger, IOptions<AzzyBotSettings> botSettings, IOptions<CoreUpdaterSettings> updaterSettings, DbActions dbActions, DiscordBotService botService, WebRequestService webService)
1819
{
1920
private readonly ILogger<UpdaterService> _logger = logger;
2021
private readonly AzzyBotSettings _botSettings = botSettings.Value;
2122
private readonly CoreUpdaterSettings _updaterSettings = updaterSettings.Value;
23+
private readonly DbActions _dbActions = dbActions;
2224
private readonly DiscordBotService _botService = botService;
2325
private readonly WebRequestService _webService = webService;
2426
private DateTimeOffset _lastAzzyUpdateNotificationTime = DateTimeOffset.MinValue;
2527
private string _lastOnlineVersion = string.Empty;
2628
private int _azzyNotifyCounter;
27-
private readonly Uri _latestUrl = new("https://api.github.com/repos/Sella-GH/AzzyBot/releases/latest");
28-
private readonly Uri _previewUrl = new("https://api.github.com/repos/Sella-GH/AzzyBot/releases");
29+
private readonly Uri _latestUrl = new("https://github.com/Sella-GH/AzzyBot/releases/latest");
30+
private readonly Uri _latestApiUrl = new("https://api.github.com/repos/Sella-GH/AzzyBot/releases/latest");
31+
private readonly Uri _previewApiUrl = new("https://api.github.com/repos/Sella-GH/AzzyBot/releases");
2932

3033
private readonly Dictionary<string, string> _headers = new(1)
3134
{
@@ -36,10 +39,12 @@ public sealed class UpdaterService(ILogger<UpdaterService> logger, IOptions<Azzy
3639

3740
public async Task CheckForAzzyUpdatesAsync()
3841
{
42+
_logger.GlobalTimerCheckForUpdates();
43+
3944
string localVersion = SoftwareStats.GetAppVersion;
4045
bool isPreview = localVersion.Contains("-preview", StringComparison.OrdinalIgnoreCase);
4146

42-
string? body = await _webService.GetWebAsync((isPreview) ? _previewUrl : _latestUrl, _headers, true);
47+
string? body = await _webService.GetWebAsync((isPreview) ? _previewApiUrl : _latestApiUrl, _headers, true);
4348
if (string.IsNullOrEmpty(body))
4449
{
4550
_logger.OnlineVersionEmpty();
@@ -53,6 +58,8 @@ public async Task CheckForAzzyUpdatesAsync()
5358
return;
5459
}
5560

61+
await _dbActions.UpdateAzzyBotAsync(lastUpdateCheck: true);
62+
5663
string onlineVersion = updaterRecord.Name;
5764
if (localVersion == onlineVersion)
5865
return;

0 commit comments

Comments
 (0)