Skip to content

Commit 1328d7d

Browse files
committed
Updates to .NET 10
Updates the project to .NET 10. Includes updating the target framework, .NET SDK version in the build workflow, and relevant package versions. Updates Color-Chan.Discord package to v5 and adapts component builder syntax.
1 parent cb94442 commit 1328d7d

File tree

12 files changed

+93
-42
lines changed

12 files changed

+93
-42
lines changed

.github/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ simple [MongoDB](https://www.mongodb.com/) connection.
7777

7878
### Built With
7979

80-
* [.NET 8](https://dotnet.microsoft.com/download/dotnet/8.0)
81-
* [ASP.NET](https://docs.microsoft.com/en-us/aspnet/core/?view=aspnetcore-8.0)
80+
* [.NET 10](https://dotnet.microsoft.com/download/dotnet/10.0)
81+
* [ASP.NET](https://docs.microsoft.com/en-us/aspnet/core/?view=aspnetcore-10.0)
8282
* [Color-Chan.Discord](https://github.com/Color-Chan/Color-Chan.Discord)
8383
* [Serilog.Sinks.Mongodb.TimeSeries](https://github.com/BrammyS/Serilog.Sinks.Mongodb.TimeSeries)
8484

@@ -90,7 +90,7 @@ To get a local copy up and running follow these simple steps.
9090

9191
### Prerequisites
9292

93-
* [.NET 8](https://dotnet.microsoft.com/download/dotnet/8.0)
93+
* [.NET 10](https://dotnet.microsoft.com/download/dotnet/10.0)
9494

9595
### Installation
9696

.github/workflows/dotnetBuild.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- name: Setup .NET SDK
1818
uses: actions/setup-dotnet@v5
1919
with:
20-
dotnet-version: 8.0.x
20+
dotnet-version: 10.0.x
2121

2222
- name: Install dependencies
2323
run: dotnet restore

src/Bot.Discord/Bot.Discord.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net8.0</TargetFramework>
4+
<TargetFramework>net10.0</TargetFramework>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Color-Chan.Discord" Version="3.0.7"/>
10+
<PackageReference Include="Color-Chan.Discord" Version="5.0.0" />
1111
</ItemGroup>
1212

1313
<ItemGroup>
14-
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="9.0.10" />
15-
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.10" />
14+
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="10.0.0" />
15+
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.0" />
1616
<ProjectReference Include="..\persistence\Bot.persistence.MongoDb\Bot.persistence.MongoDb.csproj"/>
1717
</ItemGroup>
1818

src/Bot.Discord/Commands/InviteCommands.cs

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using Color_Chan.Discord.Commands.Attributes;
22
using Color_Chan.Discord.Commands.Attributes.ProvidedRequirements;
33
using Color_Chan.Discord.Commands.MessageBuilders;
4+
using Color_Chan.Discord.Commands.MessageBuilders.Components;
45
using Color_Chan.Discord.Commands.Modules;
56
using Color_Chan.Discord.Core.Common.API.DataModels;
67
using Color_Chan.Discord.Core.Common.Models;
@@ -18,9 +19,14 @@ public class InviteCommands : SlashCommandModule
1819
public const string InviteCommandName = "invite";
1920
public const string InviteCommandDesc = "Invite the bot somewhere else!";
2021

21-
public static readonly IDiscordComponent InviteMe =
22+
private static readonly IDiscordComponent InviteMe =
2223
new ActionRowComponentBuilder()
23-
.WithButton("Invite me!", DiscordButtonStyle.Link, null, $"https://discord.com/api/oauth2/authorize?client_id={Constants.BotId}&permissions=0&scope=bot%20applications.commands")
24+
.WithSubComponent(
25+
new ButtonComponentBuilder()
26+
.WithLabel("Invite me!")
27+
.WithUrl($"https://discord.com/api/oauth2/authorize?client_id={Constants.BotId}&permissions=0&scope=bot%20applications.commands")
28+
.WithStyle(DiscordButtonStyle.Link)
29+
)
2430
.Build();
2531

2632
/// <summary>
@@ -33,17 +39,17 @@ public class InviteCommands : SlashCommandModule
3339
public Task<Result<IDiscordInteractionResponse>> InviteAsync()
3440
{
3541
var inviteMeEmbed = new DiscordEmbedBuilder()
36-
.WithTitle("Invite me")
37-
.WithDescription("I need more friends, add me to other Discord servers!")
38-
.WithColor(Constants.Colors.Successful)
39-
.WithTimeStamp()
40-
.Build();
42+
.WithTitle("Invite me")
43+
.WithDescription("I need more friends, add me to other Discord servers!")
44+
.WithColor(Constants.Colors.Successful)
45+
.WithTimeStamp()
46+
.Build();
4147

4248
// Build the embedded response.
4349
var inviteResponse = new InteractionResponseBuilder()
44-
.WithEmbed(inviteMeEmbed)
45-
.WithComponent(InviteMe)
46-
.Build();
50+
.WithEmbed(inviteMeEmbed)
51+
.WithComponent(InviteMe)
52+
.Build();
4753

4854
// Return the response to Discord.
4955
return Task.FromResult(FromSuccess(inviteResponse));

src/Bot.Discord/Components/HelpPageButtons.cs

Lines changed: 56 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using Color_Chan.Discord.Commands.Attributes;
33
using Color_Chan.Discord.Commands.Attributes.ProvidedRequirements;
44
using Color_Chan.Discord.Commands.MessageBuilders;
5+
using Color_Chan.Discord.Commands.MessageBuilders.Components;
56
using Color_Chan.Discord.Commands.Modules;
67
using Color_Chan.Discord.Core.Common.API.DataModels;
78
using Color_Chan.Discord.Core.Common.Models;
@@ -123,26 +124,70 @@ private IDiscordEmbed GetHelpPageBuilder(int pageNum)
123124

124125
public static readonly IDiscordComponent ButtonsNoBack =
125126
new ActionRowComponentBuilder()
126-
.WithButton("Previous", DiscordButtonStyle.Primary, $"{ChangeHelpPageButtonId}{Constants.ArgsSeparator}previous", disabled: true)
127-
.WithButton("Next", DiscordButtonStyle.Primary, $"{ChangeHelpPageButtonId}{Constants.ArgsSeparator}next")
127+
.WithSubComponent(
128+
new ButtonComponentBuilder()
129+
.WithLabel("Previous")
130+
.WithStyle(DiscordButtonStyle.Primary)
131+
.WithCustomId($"{ChangeHelpPageButtonId}{Constants.ArgsSeparator}previous")
132+
.WithDisabled(true)
133+
)
134+
.WithSubComponent(
135+
new ButtonComponentBuilder()
136+
.WithLabel("Next")
137+
.WithStyle(DiscordButtonStyle.Primary)
138+
.WithCustomId($"{ChangeHelpPageButtonId}{Constants.ArgsSeparator}next")
139+
)
128140
.Build();
129141

130-
public static readonly IDiscordComponent Buttons =
142+
private static readonly IDiscordComponent Buttons =
131143
new ActionRowComponentBuilder()
132-
.WithButton("Previous", DiscordButtonStyle.Primary, $"{ChangeHelpPageButtonId}{Constants.ArgsSeparator}previous")
133-
.WithButton("Next", DiscordButtonStyle.Primary, $"{ChangeHelpPageButtonId}{Constants.ArgsSeparator}next")
144+
.WithSubComponent(
145+
new ButtonComponentBuilder()
146+
.WithLabel("Previous")
147+
.WithStyle(DiscordButtonStyle.Primary)
148+
.WithCustomId($"{ChangeHelpPageButtonId}{Constants.ArgsSeparator}previous")
149+
)
150+
.WithSubComponent(
151+
new ButtonComponentBuilder()
152+
.WithLabel("Next")
153+
.WithStyle(DiscordButtonStyle.Primary)
154+
.WithCustomId($"{ChangeHelpPageButtonId}{Constants.ArgsSeparator}next")
155+
)
134156
.Build();
135157

136-
public static readonly IDiscordComponent ButtonsNoNext =
158+
private static readonly IDiscordComponent ButtonsNoNext =
137159
new ActionRowComponentBuilder()
138-
.WithButton("Previous", DiscordButtonStyle.Primary, $"{ChangeHelpPageButtonId}{Constants.ArgsSeparator}previous")
139-
.WithButton("Next", DiscordButtonStyle.Primary, $"{ChangeHelpPageButtonId}{Constants.ArgsSeparator}next", disabled: true)
160+
.WithSubComponent(
161+
new ButtonComponentBuilder()
162+
.WithLabel("Previous")
163+
.WithStyle(DiscordButtonStyle.Primary)
164+
.WithCustomId($"{ChangeHelpPageButtonId}{Constants.ArgsSeparator}previous")
165+
)
166+
.WithSubComponent(
167+
new ButtonComponentBuilder()
168+
.WithLabel("Next")
169+
.WithStyle(DiscordButtonStyle.Primary)
170+
.WithCustomId($"{ChangeHelpPageButtonId}{Constants.ArgsSeparator}next")
171+
.WithDisabled(true)
172+
)
140173
.Build();
141174

142-
public static readonly IDiscordComponent ButtonsAllDisabled =
175+
private static readonly IDiscordComponent ButtonsAllDisabled =
143176
new ActionRowComponentBuilder()
144-
.WithButton("Previous", DiscordButtonStyle.Primary, $"{ChangeHelpPageButtonId}{Constants.ArgsSeparator}previous", disabled: true)
145-
.WithButton("Next", DiscordButtonStyle.Primary, $"{ChangeHelpPageButtonId}{Constants.ArgsSeparator}next", disabled: true)
177+
.WithSubComponent(
178+
new ButtonComponentBuilder()
179+
.WithLabel("Previous")
180+
.WithStyle(DiscordButtonStyle.Primary)
181+
.WithCustomId($"{ChangeHelpPageButtonId}{Constants.ArgsSeparator}previous")
182+
.WithDisabled(true)
183+
)
184+
.WithSubComponent(
185+
new ButtonComponentBuilder()
186+
.WithLabel("Next")
187+
.WithStyle(DiscordButtonStyle.Primary)
188+
.WithCustomId($"{ChangeHelpPageButtonId}{Constants.ArgsSeparator}next")
189+
.WithDisabled(true)
190+
)
146191
.Build();
147192

148193
#endregion

src/Bot/Bot.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>net8.0</TargetFramework>
4+
<TargetFramework>net10.0</TargetFramework>
55
<Nullable>enable</Nullable>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>

src/Bot/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
1+
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS base
22
WORKDIR /app
33
EXPOSE 80
44
EXPOSE 443
55

6-
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
6+
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
77
WORKDIR /src
88
COPY ["src/Bot/Bot.csproj", "Bot/"]
99
RUN dotnet restore "src/Bot/Bot.csproj"

src/persistence/Bot.persistence.Domain/Bot.persistence.Domain.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net8.0</TargetFramework>
4+
<TargetFramework>net10.0</TargetFramework>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77
</PropertyGroup>

src/persistence/Bot.persistence.MongoDb/Bot.persistence.MongoDb.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net8.0</TargetFramework>
4+
<TargetFramework>net10.0</TargetFramework>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="9.0.10" />
11-
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.10" />
10+
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="10.0.0" />
11+
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.0" />
1212
<PackageReference Include="MongoDB.Driver" Version="3.5.0" />
1313
<PackageReference Include="Serilog" Version="4.3.0" />
14-
<PackageReference Include="Serilog.Sinks.Mongodb.TimeSeries" Version="5.0.13" />
14+
<PackageReference Include="Serilog.Sinks.Mongodb.TimeSeries" Version="6.0.0" />
1515
</ItemGroup>
1616

1717
<ItemGroup>

src/persistence/Bot.persistence/Bot.persistence.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net8.0</TargetFramework>
4+
<TargetFramework>net10.0</TargetFramework>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77
</PropertyGroup>

0 commit comments

Comments
 (0)