Skip to content

Commit e3da614

Browse files
committed
Merge branch 'develop' into main
2 parents 099f56f + b92ac2f commit e3da614

3 files changed

Lines changed: 20 additions & 16 deletions

File tree

Present/Data/ValueConverters/UInt64ListToBytesConverter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ private static List<ulong> FromBytes(byte[] bytes)
3131

3232
var list = new List<ulong>(listCount);
3333

34-
for (var index = 0; index < list.Count; index++)
34+
for (var index = 0; index < listCount; index++)
3535
list.Add(reader.ReadUInt64());
3636

3737
return list;

Present/Present.csproj

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<ImplicitUsings>enable</ImplicitUsings>
77
<Nullable>enable</Nullable>
88
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
9-
<VersionPrefix>1.0.0</VersionPrefix>
9+
<VersionPrefix>1.1.0</VersionPrefix>
1010
</PropertyGroup>
1111

1212
<PropertyGroup Condition="'$(VersionSuffix)' != '' And '$(BuildNumber)' == ''">
@@ -28,22 +28,22 @@
2828
</PropertyGroup>
2929

3030
<ItemGroup>
31-
<PackageReference Include="CSharpVitamins.ShortGuid" Version="2.0.0" />
32-
<PackageReference Include="DSharpPlus" Version="4.3.0" />
33-
<PackageReference Include="DSharpPlus.SlashCommands" Version="4.3.0" />
34-
<PackageReference Include="Humanizer.Core" Version="2.14.1" />
31+
<PackageReference Include="CSharpVitamins.ShortGuid" Version="2.0.0"/>
32+
<PackageReference Include="DSharpPlus" Version="4.3.0"/>
33+
<PackageReference Include="DSharpPlus.SlashCommands" Version="4.3.0"/>
34+
<PackageReference Include="Humanizer.Core" Version="2.14.1"/>
3535
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.1">
3636
<PrivateAssets>all</PrivateAssets>
3737
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
3838
</PackageReference>
39-
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.1" />
40-
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.0" />
41-
<PackageReference Include="NLog" Version="5.1.0" />
42-
<PackageReference Include="NLog.Extensions.Logging" Version="5.2.0" />
43-
<PackageReference Include="SmartFormat.NET" Version="3.2.0" />
44-
<PackageReference Include="X10D" Version="3.2.0-nightly.149" />
45-
<PackageReference Include="X10D.DSharpPlus" Version="3.2.0-nightly.149" />
46-
<PackageReference Include="X10D.Hosting" Version="3.2.0-nightly.149" />
39+
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.1"/>
40+
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.0"/>
41+
<PackageReference Include="NLog" Version="5.1.0"/>
42+
<PackageReference Include="NLog.Extensions.Logging" Version="5.2.0"/>
43+
<PackageReference Include="SmartFormat.NET" Version="3.2.0"/>
44+
<PackageReference Include="X10D" Version="3.2.0-nightly.149"/>
45+
<PackageReference Include="X10D.DSharpPlus" Version="3.2.0-nightly.149"/>
46+
<PackageReference Include="X10D.Hosting" Version="3.2.0-nightly.149"/>
4747
</ItemGroup>
4848

4949
<ItemGroup>

Present/Services/GiveawayService.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System.Collections.Concurrent;
1+
using System.Collections.Concurrent;
22
using System.Diagnostics.CodeAnalysis;
33
using CSharpVitamins;
44
using DSharpPlus;
@@ -201,7 +201,7 @@ public DiscordEmbedBuilder CreateGiveawayInformationEmbed(Giveaway giveaway)
201201
List<ulong> winnerIds = giveaway.WinnerIds;
202202
if (winnerIds.Count > 0)
203203
{
204-
string winnerList = string.Join('\n', giveaway.WinnerIds.Select(w => $"• {MentionUtility.MentionUser(w)} ({w})"));
204+
string winnerList = string.Join('\n', winnerIds.Select(w => $"• {MentionUtility.MentionUser(w)} ({w})"));
205205
embed.AddField(EmbedStrings.Winner.ToQuantity(winnerIds.Count), winnerList);
206206
}
207207

@@ -268,6 +268,8 @@ public DiscordEmbed CreateGiveawayPublicEmbed(Giveaway giveaway)
268268
/// <exception cref="ArgumentNullException"><paramref name="giveaway" /> is <see langword="null" />.</exception>
269269
public async Task EndGiveawayAsync(Giveaway giveaway)
270270
{
271+
ArgumentNullException.ThrowIfNull(giveaway);
272+
271273
giveaway.EndHandled = true;
272274
giveaway.EndTime = DateTimeOffset.UtcNow;
273275

@@ -656,6 +658,8 @@ public bool ValidateUser(ulong userId, DiscordGuild guild, [NotNullWhen(true)] o
656658

657659
private async Task UpdateFromDatabaseAsync(CancellationToken cancellationToken)
658660
{
661+
Logger.Info("Caching giveaways from the database...");
662+
659663
await using AsyncServiceScope scope = _serviceScopeFactory.CreateAsyncScope();
660664
await using var context = scope.ServiceProvider.GetRequiredService<GiveawayContext>();
661665
await context.Database.EnsureCreatedAsync(cancellationToken: cancellationToken).ConfigureAwait(false);

0 commit comments

Comments
 (0)