Skip to content

Commit beda726

Browse files
hhvrcCopilot
andauthored
feat: .NET 10 (#51)
* Bump to .NET 10 * Some cleanup * Update MessageHandler.cs * Update Dockerfile * Update DiscordBot/MessageHandler/MessageHandler.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 755bc6e commit beda726

22 files changed

+46
-67
lines changed

DiscordBot/Commands/Admin/AdminListCommand.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using Discord.Interactions;
2-
using Discord.WebSocket;
32

43
namespace OpenShock.DiscordBot.Commands.Admin;
54

DiscordBot/Commands/ControlCommands.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
using OneOf.Types;
99
using OpenShock.DiscordBot.OpenShockDiscordDb;
1010
using OpenShock.DiscordBot.Utils;
11-
using OpenShock.SDK.CSharp;
1211
using OpenShock.SDK.CSharp.Errors;
1312
using OpenShock.SDK.CSharp.Models;
1413

DiscordBot/Commands/Profanity/ProfanityListCommand.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using Discord;
22
using Discord.Interactions;
33
using Microsoft.EntityFrameworkCore;
4-
using OpenShock.DiscordBot.OpenShockDiscordDb;
54

65
namespace OpenShock.DiscordBot.Commands.Profanity;
76

@@ -12,8 +11,8 @@ public async Task ProfanityListCommand()
1211
{
1312
await DeferAsync(ephemeral: true);
1413

15-
var rules = await Queryable
16-
.OrderByDescending<ProfanityRule, DateTimeOffset>(_db.ProfanityRules, r => r.CreatedAt)
14+
var rules = await _db.ProfanityRules
15+
.OrderByDescending(r => r.CreatedAt)
1716
.Take(10)
1817
.ToListAsync();
1918

DiscordBot/Commands/ProfanityAdmin/ProfanityRemoveCommand.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using System.Text;
22
using Discord.Interactions;
33
using Microsoft.EntityFrameworkCore;
4-
using OpenShock.DiscordBot.OpenShockDiscordDb;
54

65
namespace OpenShock.DiscordBot.Commands.ProfanityAdmin;
76

DiscordBot/Commands/ProfanityAdmin/ProfanitySuggestionListCommand.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using Discord;
33
using Discord.Interactions;
44
using Microsoft.EntityFrameworkCore;
5-
using OpenShock.DiscordBot.OpenShockDiscordDb;
65

76
namespace OpenShock.DiscordBot.Commands.ProfanityAdmin;
87

DiscordBot/Commands/Setup/SetupConnectionCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public async Task ExecuteSetupCommand()
3030
ApiToken = user.ApiKey,
3131
ApiServer = user.ApiServer
3232
};
33-
await Context.Interaction.RespondWithModalAsync<SetupModal>(SetupModalId, previousData);
33+
await Context.Interaction.RespondWithModalAsync(SetupModalId, previousData);
3434
}
3535

3636
// Responds to the modal.

DiscordBot/DiscordBot.csproj

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net9.0</TargetFramework>
5+
<TargetFramework>net10.0</TargetFramework>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<Nullable>enable</Nullable>
88
<Company>OpenShock</Company>
@@ -13,32 +13,31 @@
1313
<AssemblyName>OpenShock.DiscordBot</AssemblyName>
1414
<RootNamespace>OpenShock.DiscordBot</RootNamespace>
1515
<InvariantGlobalization>false</InvariantGlobalization>
16-
<LangVersion>13</LangVersion>
1716
<UserSecretsId>05918ba7-2547-4661-9c92-1172d1441505</UserSecretsId>
1817
</PropertyGroup>
1918

2019
<ItemGroup>
2120
<PackageReference Include="Discord.Addons.Hosting" Version="6.1.0" />
2221
<PackageReference Include="Discord.Net" Version="3.18.0" />
23-
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.10" />
24-
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.10">
22+
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="10.0.0" />
23+
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="10.0.0">
2524
<PrivateAssets>all</PrivateAssets>
2625
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2726
</PackageReference>
28-
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="9.0.10" />
29-
<PackageReference Include="Microsoft.Extensions.ApiDescription.Client" Version="9.0.10">
27+
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="10.0.0" />
28+
<PackageReference Include="Microsoft.Extensions.ApiDescription.Client" Version="10.0.0">
3029
<PrivateAssets>all</PrivateAssets>
3130
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
3231
</PackageReference>
33-
<PackageReference Include="Microsoft.Extensions.Configuration" Version="9.0.10" />
34-
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.10" />
35-
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.10" />
36-
<PackageReference Include="Microsoft.Extensions.Http" Version="9.0.10" />
37-
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.10" />
38-
<PackageReference Include="Microsoft.Extensions.Logging.Configuration" Version="9.0.10" />
39-
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.4" />
32+
<PackageReference Include="Microsoft.Extensions.Configuration" Version="10.0.0" />
33+
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.0" />
34+
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="10.0.0" />
35+
<PackageReference Include="Microsoft.Extensions.Http" Version="10.0.0" />
36+
<PackageReference Include="Microsoft.Extensions.Logging" Version="10.0.0" />
37+
<PackageReference Include="Microsoft.Extensions.Logging.Configuration" Version="10.0.0" />
38+
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="10.0.0" />
4039
<PackageReference Include="OneOf" Version="3.0.271" />
41-
<PackageReference Include="OpenShock.SDK.CSharp" Version="0.0.39" />
40+
<PackageReference Include="OpenShock.SDK.CSharp" Version="0.0.40" />
4241
<PackageReference Include="Serilog" Version="4.3.0" />
4342
<PackageReference Include="Serilog.Extensions.Autofac.DependencyInjection" Version="5.0.0" />
4443
<PackageReference Include="Serilog.Extensions.Hosting" Version="9.0.0" />
@@ -49,7 +48,7 @@
4948
</ItemGroup>
5049

5150
<ItemGroup>
52-
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.10" />
51+
<PackageReference Include="Microsoft.Extensions.Hosting" Version="10.0.0" />
5352
<None Remove="appsettings.json" />
5453
<Content Include="appsettings.json">
5554
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>

DiscordBot/MessageHandler/MessageHandler.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@
55
using OpenShock.DiscordBot.OpenShockDiscordDb;
66
using OpenShock.DiscordBot.Services;
77
using OpenShock.DiscordBot.Services.ProfanityDetector;
8-
using OpenShock.DiscordBot.Utils;
98
using OpenShock.SDK.CSharp.Models;
109

11-
namespace OpenShock.DiscordBot;
10+
namespace OpenShock.DiscordBot.MessageHandler;
1211

1312
public sealed partial class MessageHandler
1413
{
@@ -77,9 +76,9 @@ public async Task HandleMessageAsync(SocketMessage message)
7776

7877
// Send reaction and trigger shock
7978
await Task.WhenAll([
80-
message.AddReactionAsync(new Emoji("⚡")),
81-
ShockUserAsync(scope, authorDiscordId, intensityPercent)
82-
]);
79+
message.AddReactionAsync(new Emoji("⚡")),
80+
ShockUserAsync(scope, authorDiscordId, intensityPercent)
81+
]);
8382
}
8483
}
8584
}

DiscordBot/OpenShockDiscordDb/BotAdmin.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
using System;
2-
using System.Collections.Generic;
3-
4-
namespace OpenShock.DiscordBot.OpenShockDiscordDb;
1+
namespace OpenShock.DiscordBot.OpenShockDiscordDb;
52

63
public partial class BotAdmin
74
{

DiscordBot/OpenShockDiscordDb/OpenShockDiscordContext.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using Microsoft.EntityFrameworkCore;
1+
using Microsoft.EntityFrameworkCore;
42

53
namespace OpenShock.DiscordBot.OpenShockDiscordDb;
64

0 commit comments

Comments
 (0)