Skip to content

Commit

Permalink
Merge branch 'develop' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverbooth committed Dec 24, 2022
2 parents 099f56f + b92ac2f commit e3da614
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Present/Data/ValueConverters/UInt64ListToBytesConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ private static List<ulong> FromBytes(byte[] bytes)

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

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

return list;
Expand Down
26 changes: 13 additions & 13 deletions Present/Present.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<VersionPrefix>1.0.0</VersionPrefix>
<VersionPrefix>1.1.0</VersionPrefix>
</PropertyGroup>

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

<ItemGroup>
<PackageReference Include="CSharpVitamins.ShortGuid" Version="2.0.0" />
<PackageReference Include="DSharpPlus" Version="4.3.0" />
<PackageReference Include="DSharpPlus.SlashCommands" Version="4.3.0" />
<PackageReference Include="Humanizer.Core" Version="2.14.1" />
<PackageReference Include="CSharpVitamins.ShortGuid" Version="2.0.0"/>
<PackageReference Include="DSharpPlus" Version="4.3.0"/>
<PackageReference Include="DSharpPlus.SlashCommands" Version="4.3.0"/>
<PackageReference Include="Humanizer.Core" Version="2.14.1"/>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.1" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.0" />
<PackageReference Include="NLog" Version="5.1.0" />
<PackageReference Include="NLog.Extensions.Logging" Version="5.2.0" />
<PackageReference Include="SmartFormat.NET" Version="3.2.0" />
<PackageReference Include="X10D" Version="3.2.0-nightly.149" />
<PackageReference Include="X10D.DSharpPlus" Version="3.2.0-nightly.149" />
<PackageReference Include="X10D.Hosting" Version="3.2.0-nightly.149" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.1"/>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.0"/>
<PackageReference Include="NLog" Version="5.1.0"/>
<PackageReference Include="NLog.Extensions.Logging" Version="5.2.0"/>
<PackageReference Include="SmartFormat.NET" Version="3.2.0"/>
<PackageReference Include="X10D" Version="3.2.0-nightly.149"/>
<PackageReference Include="X10D.DSharpPlus" Version="3.2.0-nightly.149"/>
<PackageReference Include="X10D.Hosting" Version="3.2.0-nightly.149"/>
</ItemGroup>

<ItemGroup>
Expand Down
8 changes: 6 additions & 2 deletions Present/Services/GiveawayService.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Collections.Concurrent;
using System.Collections.Concurrent;
using System.Diagnostics.CodeAnalysis;
using CSharpVitamins;
using DSharpPlus;
Expand Down Expand Up @@ -201,7 +201,7 @@ public DiscordEmbedBuilder CreateGiveawayInformationEmbed(Giveaway giveaway)
List<ulong> winnerIds = giveaway.WinnerIds;
if (winnerIds.Count > 0)
{
string winnerList = string.Join('\n', giveaway.WinnerIds.Select(w => $"{MentionUtility.MentionUser(w)} ({w})"));
string winnerList = string.Join('\n', winnerIds.Select(w => $"{MentionUtility.MentionUser(w)} ({w})"));
embed.AddField(EmbedStrings.Winner.ToQuantity(winnerIds.Count), winnerList);
}

Expand Down Expand Up @@ -268,6 +268,8 @@ public DiscordEmbed CreateGiveawayPublicEmbed(Giveaway giveaway)
/// <exception cref="ArgumentNullException"><paramref name="giveaway" /> is <see langword="null" />.</exception>
public async Task EndGiveawayAsync(Giveaway giveaway)
{
ArgumentNullException.ThrowIfNull(giveaway);

giveaway.EndHandled = true;
giveaway.EndTime = DateTimeOffset.UtcNow;

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

private async Task UpdateFromDatabaseAsync(CancellationToken cancellationToken)
{
Logger.Info("Caching giveaways from the database...");

await using AsyncServiceScope scope = _serviceScopeFactory.CreateAsyncScope();
await using var context = scope.ServiceProvider.GetRequiredService<GiveawayContext>();
await context.Database.EnsureCreatedAsync(cancellationToken: cancellationToken).ConfigureAwait(false);
Expand Down

0 comments on commit e3da614

Please sign in to comment.