Skip to content

Commit

Permalink
Add net8.0 and net9.0 (#3032)
Browse files Browse the repository at this point in the history
  • Loading branch information
Misha-133 authored Dec 1, 2024
1 parent a884ad1 commit d780d6c
Show file tree
Hide file tree
Showing 20 changed files with 80 additions and 84 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<LangVersion>9.0</LangVersion>
<AssemblyName>Discord.Net.BuildOverrides</AssemblyName>
<RootNamespace>Discord.BuildOverrides</RootNamespace>
<Description>A Discord.Net extension adding a way to add build overrides for testing.</Description>
<TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">net6.0;net5.0;</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">net6.0;net5.0;</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0;</TargetFrameworks>
<IsTrimmable>false</IsTrimmable>
<IsAotCompatible>false</IsAotCompatible>
<IncludeSymbols>true</IncludeSymbols>
Expand Down
6 changes: 3 additions & 3 deletions samples/BasicBot/_BasicBot.csproj
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Discord.Net.WebSocket" Version="3.13.1" />
<PackageReference Include="Discord.Net.WebSocket" Version="3.16.0" />
</ItemGroup>

</Project>
17 changes: 9 additions & 8 deletions samples/InteractionFramework/_InteractionFramework.csproj
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<RootNamespace>InteractionFramework</RootNamespace>
<StartupObject></StartupObject>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Discord.Net.Interactions" Version="3.13.1" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.0" />
<PackageReference Include="Discord.Net.WebSocket" Version="3.16.0" />
<PackageReference Include="Discord.Net.Interactions" Version="3.16.0" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions samples/ShardedClient/_ShardedClient.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
Expand All @@ -7,8 +7,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Discord.Net" Version="3.13.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.0" />
<PackageReference Include="Discord.Net" Version="3.16.0" />
</ItemGroup>

</Project>
8 changes: 4 additions & 4 deletions samples/TextCommandFramework/_TextCommandFramework.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
Expand All @@ -7,9 +7,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Discord.Net.Commands" Version="3.13.1" />
<PackageReference Include="Discord.Net.Websocket" Version="3.13.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.0" />
<PackageReference Include="Discord.Net.Commands" Version="3.16.0" />
<PackageReference Include="Discord.Net.Websocket" Version="3.16.0" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions samples/WebhookClient/_WebhookClient.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
Expand All @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Discord.Net.Webhook" Version="3.13.1" />
<PackageReference Include="Discord.Net.Webhook" Version="3.16.0" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions samples/idn/idn.csproj
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="4.9.2" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="4.11.0" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/Discord.Net.Commands/Discord.Net.Commands.csproj
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="../../Discord.Net.targets" />
<Import Project="../../StyleAnalyzer.targets" />
<PropertyGroup>
<AssemblyName>Discord.Net.Commands</AssemblyName>
<RootNamespace>Discord.Commands</RootNamespace>
<Description>A Discord.Net extension adding support for bot commands.</Description>
<TargetFrameworks>net6.0;net5.0;net461;netstandard2.0;netstandard2.1</TargetFrameworks>
<TargetFrameworks>net9.0;net8.0;net6.0;net5.0;net461;netstandard2.0;netstandard2.1;</TargetFrameworks>
<WarningLevel>5</WarningLevel>
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
<IsTrimmable>false</IsTrimmable>
Expand Down
8 changes: 4 additions & 4 deletions src/Discord.Net.Core/Discord.Net.Core.csproj
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="../../Discord.Net.targets" />
<Import Project="../../StyleAnalyzer.targets" />
<PropertyGroup>
<AssemblyName>Discord.Net.Core</AssemblyName>
<RootNamespace>Discord</RootNamespace>
<Description>The core components for the Discord.Net library.</Description>
<TargetFrameworks>net6.0;net5.0;net461;netstandard2.0;netstandard2.1</TargetFrameworks>
<TargetFrameworks>net9.0;net8.0;net6.0;net5.0;net461;netstandard2.0;netstandard2.1</TargetFrameworks>
<WarningLevel>5</WarningLevel>
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
<IsTrimmable>false</IsTrimmable>
Expand All @@ -16,9 +16,9 @@
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="System.Interactive.Async" Version="6.0.1" />
<PackageReference Include="System.Collections.Immutable" Version="6.0.0" />
<PackageReference Include="System.Collections.Immutable" Version="9.0.0" />
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
<PackageReference Include="IDisposableAnalyzers" Version="4.0.7">
<PackageReference Include="IDisposableAnalyzers" Version="4.0.8">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,14 @@ public readonly struct MemberSearchV2QueryProperties

public MemberSearchV2QueryProperties(Dictionary<int, string> andQuery, Dictionary<int, string> orQuery)
{
AndQuery = andQuery.Select(x => new KeyValuePair<int, object>(x.Key, x.Value)).ToDictionary();
OrQuery = orQuery.Select(x => new KeyValuePair<int, object>(x.Key, x.Value)).ToDictionary();
AndQuery = andQuery.Select(x => new KeyValuePair<int, object>(x.Key, x.Value)).ToDictionary(x => x.Key, y => y.Value);
OrQuery = orQuery.Select(x => new KeyValuePair<int, object>(x.Key, x.Value)).ToDictionary(x => x.Key, y => y.Value);
}

public MemberSearchV2QueryProperties(Dictionary<int, long> andQuery, Dictionary<int, long> orQuery)
{
AndQuery = andQuery.Select(x => new KeyValuePair<int, object>(x.Key, x.Value)).ToDictionary();
OrQuery = orQuery.Select(x => new KeyValuePair<int, object>(x.Key, x.Value)).ToDictionary();
AndQuery = andQuery.Select(x => new KeyValuePair<int, object>(x.Key, x.Value)).ToDictionary(x => x.Key, y => y.Value);
OrQuery = orQuery.Select(x => new KeyValuePair<int, object>(x.Key, x.Value)).ToDictionary(x => x.Key, y => y.Value);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/Discord.Net.Examples/Discord.Net.Examples.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
Expand All @@ -15,7 +15,7 @@
<ItemGroup>
<ProjectReference Include="..\Discord.Net.Core\Discord.Net.Core.csproj" />
<ProjectReference Include="..\Discord.Net.WebSocket\Discord.Net.WebSocket.csproj" />
<PackageReference Include="JetBrains.Annotations" Version="2023.3.0" />
<PackageReference Include="JetBrains.Annotations" Version="2024.3.0" />
</ItemGroup>

</Project>
10 changes: 5 additions & 5 deletions src/Discord.Net.Interactions/Discord.Net.Interactions.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="../../Discord.Net.targets" />
<Import Project="../../StyleAnalyzer.targets" />
<PropertyGroup>
<TargetFrameworks>net6.0;net5.0;net461;netstandard2.0;netstandard2.1</TargetFrameworks>
<TargetFrameworks>net9.0;net8.0;net6.0;net5.0;net461;netstandard2.0;netstandard2.1;</TargetFrameworks>
<RootNamespace>Discord.Interactions</RootNamespace>
<AssemblyName>Discord.Net.Interactions</AssemblyName>
<Description>A Discord.Net extension adding support for Application Commands.</Description>
Expand All @@ -20,9 +20,9 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.2" />
<PackageReference Include="System.Collections.Immutable" Version="6.0.0" />
<PackageReference Include="System.Reactive" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.0" />
<PackageReference Include="System.Collections.Immutable" Version="9.0.0" />
<PackageReference Include="System.Reactive" Version="6.0.1" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.StartsWith('net4')) AND '$(MSBuildRuntimeType)' == 'Core' AND '$(OS)' != 'Windows_NT'">
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" PrivateAssets="All" />
Expand Down
10 changes: 5 additions & 5 deletions src/Discord.Net.Rest/API/Common/ApplicationCommandOption.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ public ApplicationCommandOption(IApplicationCommandOption cmd)
Type = cmd.Type;
Description = cmd.Description;

NameLocalizations = cmd.NameLocalizations?.ToDictionary() ?? Optional<Dictionary<string, string>>.Unspecified;
DescriptionLocalizations = cmd.DescriptionLocalizations?.ToDictionary() ?? Optional<Dictionary<string, string>>.Unspecified;
NameLocalizations = cmd.NameLocalizations?.ToDictionary(x => x.Key, y => y.Value) ?? Optional<Dictionary<string, string>>.Unspecified;
DescriptionLocalizations = cmd.DescriptionLocalizations?.ToDictionary(x => x.Key, y => y.Value) ?? Optional<Dictionary<string, string>>.Unspecified;
NameLocalized = cmd.NameLocalized;
DescriptionLocalized = cmd.DescriptionLocalized;
}
Expand All @@ -94,7 +94,7 @@ public ApplicationCommandOption(ApplicationCommandOptionProperties option)
{
Name = x.Name,
Value = x.Value,
NameLocalizations = x.NameLocalizations?.ToDictionary() ?? Optional<Dictionary<string, string>>.Unspecified,
NameLocalizations = x.NameLocalizations?.ToDictionary(x => x.Key, y => y.Value) ?? Optional<Dictionary<string, string>>.Unspecified,
}).ToArray() ?? Optional<ApplicationCommandOptionChoice[]>.Unspecified;

Options = option.Options?.Select(x => new ApplicationCommandOption(x)).ToArray() ?? Optional<ApplicationCommandOption[]>.Unspecified;
Expand All @@ -114,8 +114,8 @@ public ApplicationCommandOption(ApplicationCommandOptionProperties option)
Description = option.Description;
Autocomplete = option.IsAutocomplete;

NameLocalizations = option.NameLocalizations?.ToDictionary() ?? Optional<Dictionary<string, string>>.Unspecified;
DescriptionLocalizations = option.DescriptionLocalizations?.ToDictionary() ?? Optional<Dictionary<string, string>>.Unspecified;
NameLocalizations = option.NameLocalizations?.ToDictionary(x => x.Key, y => y.Value) ?? Optional<Dictionary<string, string>>.Unspecified;
DescriptionLocalizations = option.DescriptionLocalizations?.ToDictionary(x => x.Key, y => y.Value) ?? Optional<Dictionary<string, string>>.Unspecified;
}
}
}
4 changes: 2 additions & 2 deletions src/Discord.Net.Rest/ClientHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,8 @@ public static async Task<IReadOnlyCollection<RoleConnectionMetadata>> ModifyRole
Description = x.Description,
Key = x.Key,
Type = x.Type,
NameLocalizations = x.NameLocalizations?.ToDictionary(),
DescriptionLocalizations = x.DescriptionLocalizations?.ToDictionary()
NameLocalizations = x.NameLocalizations?.ToDictionary(x => x.Key, y => y.Value),
DescriptionLocalizations = x.DescriptionLocalizations?.ToDictionary(x => x.Key, y => y.Value)
}).ToArray()))
.Select(model
=> new RoleConnectionMetadata(
Expand Down
4 changes: 2 additions & 2 deletions src/Discord.Net.Rest/Discord.Net.Rest.csproj
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="../../Discord.Net.targets" />
<Import Project="../../StyleAnalyzer.targets" />
<PropertyGroup>
<AssemblyName>Discord.Net.Rest</AssemblyName>
<RootNamespace>Discord.Rest</RootNamespace>
<Description>A core Discord.Net library containing the REST client and models.</Description>
<TargetFrameworks>net6.0;net5.0;net461;netstandard2.0;netstandard2.1</TargetFrameworks>
<TargetFrameworks>net9.0;net8.0;net6.0;net5.0;net461;netstandard2.0;netstandard2.1;</TargetFrameworks>
<WarningLevel>5</WarningLevel>
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
<IsTrimmable>false</IsTrimmable>
Expand Down
24 changes: 12 additions & 12 deletions src/Discord.Net.Rest/Entities/Interactions/InteractionHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ public static Task<ApplicationCommand> CreateGlobalCommandAsync(BaseDiscordClien
DefaultPermission = arg.IsDefaultPermission.IsSpecified
? arg.IsDefaultPermission.Value
: Optional<bool>.Unspecified,
NameLocalizations = arg.NameLocalizations?.ToDictionary(),
DescriptionLocalizations = arg.DescriptionLocalizations?.ToDictionary(),
NameLocalizations = arg.NameLocalizations?.ToDictionary(x => x.Key, y => y.Value),
DescriptionLocalizations = arg.DescriptionLocalizations?.ToDictionary(x => x.Key, y => y.Value),

// TODO: better conversion to nullable optionals
DefaultMemberPermission = arg.DefaultMemberPermissions.ToNullable(),
Expand Down Expand Up @@ -142,8 +142,8 @@ public static Task<ApplicationCommand[]> BulkOverwriteGlobalCommandsAsync(BaseDi
DefaultPermission = arg.IsDefaultPermission.IsSpecified
? arg.IsDefaultPermission.Value
: Optional<bool>.Unspecified,
NameLocalizations = arg.NameLocalizations?.ToDictionary(),
DescriptionLocalizations = arg.DescriptionLocalizations?.ToDictionary(),
NameLocalizations = arg.NameLocalizations?.ToDictionary(x => x.Key, y => y.Value),
DescriptionLocalizations = arg.DescriptionLocalizations?.ToDictionary(x => x.Key, y => y.Value),

// TODO: better conversion to nullable optionals
DefaultMemberPermission = arg.DefaultMemberPermissions.ToNullable(),
Expand Down Expand Up @@ -188,8 +188,8 @@ public static async Task<IReadOnlyCollection<ApplicationCommand>> BulkOverwriteG
DefaultPermission = arg.IsDefaultPermission.IsSpecified
? arg.IsDefaultPermission.Value
: Optional<bool>.Unspecified,
NameLocalizations = arg.NameLocalizations?.ToDictionary(),
DescriptionLocalizations = arg.DescriptionLocalizations?.ToDictionary(),
NameLocalizations = arg.NameLocalizations?.ToDictionary(x => x.Key, y => y.Value),
DescriptionLocalizations = arg.DescriptionLocalizations?.ToDictionary(x => x.Key, y => y.Value),

// TODO: better conversion to nullable optionals
DefaultMemberPermission = arg.DefaultMemberPermissions.ToNullable(),
Expand Down Expand Up @@ -257,8 +257,8 @@ public static Task<ApplicationCommand> ModifyGlobalCommandAsync(BaseDiscordClien
DefaultPermission = args.IsDefaultPermission.IsSpecified
? args.IsDefaultPermission.Value
: Optional<bool>.Unspecified,
NameLocalizations = args.NameLocalizations?.ToDictionary(),
DescriptionLocalizations = args.DescriptionLocalizations?.ToDictionary(),
NameLocalizations = args.NameLocalizations?.ToDictionary(x => x.Key, y => y.Value),
DescriptionLocalizations = args.DescriptionLocalizations?.ToDictionary(x => x.Key, y => y.Value),
Nsfw = args.IsNsfw.GetValueOrDefault(false),
DefaultMemberPermission = args.DefaultMemberPermissions.ToNullable(),
IntegrationTypes = args.IntegrationTypes,
Expand Down Expand Up @@ -317,8 +317,8 @@ public static Task<ApplicationCommand> CreateGuildCommandAsync(BaseDiscordClient
DefaultPermission = arg.IsDefaultPermission.IsSpecified
? arg.IsDefaultPermission.Value
: Optional<bool>.Unspecified,
NameLocalizations = arg.NameLocalizations?.ToDictionary(),
DescriptionLocalizations = arg.DescriptionLocalizations?.ToDictionary(),
NameLocalizations = arg.NameLocalizations?.ToDictionary(x => x.Key, y => y.Value),
DescriptionLocalizations = arg.DescriptionLocalizations?.ToDictionary(x => x.Key, y => y.Value),

// TODO: better conversion to nullable optionals
DefaultMemberPermission = arg.DefaultMemberPermissions.ToNullable(),
Expand Down Expand Up @@ -357,8 +357,8 @@ public static Task<ApplicationCommand> ModifyGuildCommandAsync(BaseDiscordClient
DefaultPermission = arg.IsDefaultPermission.IsSpecified
? arg.IsDefaultPermission.Value
: Optional<bool>.Unspecified,
NameLocalizations = arg.NameLocalizations?.ToDictionary(),
DescriptionLocalizations = arg.DescriptionLocalizations?.ToDictionary(),
NameLocalizations = arg.NameLocalizations?.ToDictionary(x => x.Key, y => y.Value),
DescriptionLocalizations = arg.DescriptionLocalizations?.ToDictionary(x => x.Key, y => y.Value),
Nsfw = arg.IsNsfw.GetValueOrDefault(false),
DefaultMemberPermission = arg.DefaultMemberPermissions.ToNullable()
};
Expand Down
4 changes: 2 additions & 2 deletions src/Discord.Net.WebSocket/Discord.Net.WebSocket.csproj
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="../../Discord.Net.targets" />
<Import Project="../../StyleAnalyzer.targets" />
<PropertyGroup>
<AssemblyName>Discord.Net.WebSocket</AssemblyName>
<RootNamespace>Discord.WebSocket</RootNamespace>
<Description>A core Discord.Net library containing the WebSocket client and models.</Description>
<TargetFrameworks>net6.0;net5.0;net461;netstandard2.0;netstandard2.1</TargetFrameworks>
<TargetFrameworks>net9.0;net8.0;net6.0;net5.0;net461;netstandard2.0;netstandard2.1</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<WarningLevel>5</WarningLevel>
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
Expand Down
Loading

0 comments on commit d780d6c

Please sign in to comment.