Skip to content

Commit 5bbe108

Browse files
authored
Merge pull request #108 from Aiko-IT-Systems/release/3_1_0
DisCatSharp.Extensions v3.1.0 Release
2 parents 007dd93 + fed02c7 commit 5bbe108

16 files changed

Lines changed: 184 additions & 189 deletions

BUILDING.md

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,36 +7,27 @@ It is recommended you have prior experience with multi-target .NET Core/Standard
77
In order to build the library, you will first need to install some software.
88

99
### Windows
10-
On Windows, we only officially support Visual Studio 2019 16.10 or newer. Visual Studio Code and other IDEs might work, but are generally not supported or even guaranteed to work properly.
10+
On Windows, we only officially support Visual Studio 2022 17.0 or newer. Visual Studio Code and other IDEs might work, but are generally not supported or even guaranteed to work properly.
1111

1212
* **Windows 10** - while we support running the library on Windows 7 and above, we only support building on Windows 10 and better.
1313
* [**Git for Windows**](https://git-scm.com/download/win) - required to clone the repository.
14-
* [**Visual Studio 2021**](https://www.visualstudio.com/downloads/) - community edition or better. We do not support Visual Studio 2017 and older. Note that to build the library, you need Visual Studio 2019 version 16.10 or newer.
15-
* **Workloads**:
16-
* **.NET Framework Desktop** - required to build .NETFX (4.5, 4.6, and 4.7 targets)
17-
* **.NET Core Cross-Platform Development** - required to build .NET Standard targets (1.1, 1.3, and 2.0) and the project overall.
18-
* **Individual Components**:
19-
* **.NET Framework 4.5 SDK** - required for .NETFX 4.5 target
20-
* **.NET Framework 4.6 SDK** - required for .NETFX 4.6 target
21-
* **.NET Framework 4.7 SDK** - required for .NETFX 4.7 target
22-
* [**.NET Core SDK 3.1**](https://www.microsoft.com/net/download) - required to build the project.
14+
* [**Visual Studio 2022**](https://www.visualstudio.com/downloads/) - community edition or better. We do not support Visual Studio 2021 and older.
2315
* **Windows PowerShell** - required to run the build scripts. You need to make sure your script execution policy allows execution of unsigned scripts.
16+
* [**.NET SDK 8.0 or newer**](https://www.microsoft.com/net/download) - required to build the project.
2417

2518
### GNU/Linux
2619
On GNU/Linux, we support building via Visual Studio Code and .NET Core SDK. Other IDEs might work, but are not supported or guaranteed to work properly.
2720

28-
While these should apply to any modern distribution, we only test against Debian 10. Your mileage may vary.
21+
While these should apply to any modern distribution, we only test against Ubuntu 24.04. Your mileage may vary.
2922

3023
When installing the below, make sure you install all the dependencies properly. We might ship a build environment as a docker container in the future.
3124

32-
* **Any modern GNU/Linux distribution** - like Debian 10.
25+
* **Any modern GNU/Linux distribution** - like Ubuntu 24.04.
3326
* **Git** - to clone the repository.
3427
* [**Visual Studio Code**](https://code.visualstudio.com/Download) - a recent version is required.
3528
* **C# for Visual Studio Code (powered by OmniSharp)** - required for syntax highlighting and basic Intellisense
36-
* [**.NET SDK 6.0**](https://www.microsoft.com/net/download) - required to build the project.
37-
* [**Mono 5.x**](http://www.mono-project.com/download/#download-lin) - required to build the .NETFX 4.5, 4.6, and 4.7 targets, as well as to build the docs.
38-
* [**PowerShell Core**](https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell-core-on-linux?view=powershell-7.1) - required to execute the build scripts.
39-
* **p7zip-full** - required to package docs.
29+
* [**.NET SDK 8.0 or newer**](https://www.microsoft.com/net/download) - required to build the project.
30+
* [**PowerShell Core**](https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell-core-on-linux?view=powershell-7.5) - required to execute the build scripts.
4031

4132
## Instructions
4233
Once you install all the necessary prerequisites, you can proceed to building. These instructions assume you have already cloned the repository.

DisCatSharp.Extensions.OAuth2Web/DisCatSharp.Extensions.OAuth2Web.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
<ItemGroup>
4040
<PackageReference Include="Backport.System.Threading.Lock" Version="3.1.4" />
4141
<PackageReference Include="ConcurrentHashSet" Version="1.3.0" />
42-
<PackageReference Include="DisCatSharp" Version="10.6.6-nightly-031" />
42+
<PackageReference Include="DisCatSharp" Version="10.6.6" />
4343
<PackageReference Include="DisCatSharp.Analyzer.Roselyn" Version="6.2.*">
4444
<PrivateAssets>all</PrivateAssets>
4545
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

DisCatSharp.Extensions.SimpleMusicCommands/DisCatSharp.Extensions.SimpleMusicCommands.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,17 @@
2424
</PropertyGroup>
2525

2626
<ItemGroup>
27-
<PackageReference Include="DisCatSharp" Version="10.6.6-nightly-031" />
27+
<PackageReference Include="DisCatSharp" Version="10.6.6" />
2828
<PackageReference Include="DisCatSharp.Analyzer.Roselyn" Version="6.2.*">
2929
<PrivateAssets>all</PrivateAssets>
3030
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
3131
</PackageReference>
3232
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.1" />
3333
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="9.0.1" />
34-
<PackageReference Include="DisCatSharp.ApplicationCommands" Version="10.6.6-nightly-031" />
34+
<PackageReference Include="DisCatSharp.ApplicationCommands" Version="10.6.6" />
3535
<PackageReference Include="DisCatSharp.Attributes" Version="10.6.*" />
36-
<PackageReference Include="DisCatSharp.Lavalink" Version="10.6.6-nightly-031" />
37-
<PackageReference Include="DisCatSharp.Common" Version="10.6.6-nightly-031" />
36+
<PackageReference Include="DisCatSharp.Lavalink" Version="10.6.6" />
37+
<PackageReference Include="DisCatSharp.Common" Version="10.6.6" />
3838
<PackageReference Include="Microsoft.DependencyValidation.Analyzers" Version="0.11.0" />
3939
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.1" />
4040
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.1" />

DisCatSharp.Extensions.SimpleMusicCommands/ExtensionMethods.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,16 @@
3131
namespace DisCatSharp.Extensions.SimpleMusicCommands;
3232

3333
/// <summary>
34-
/// Defines various extensions specific to SimpleMusicCommandsExtension.
34+
/// Defines various extensions specific to SimpleMusicCommandsExtension.
3535
/// </summary>
3636
public static class ExtensionMethods
3737
{
3838
/// <summary>
39-
/// Enables SimpleMusicCommandsExtension module on this <see cref="DiscordClient"/>.
39+
/// Enables SimpleMusicCommandsExtension module on this <see cref="DiscordClient" />.
4040
/// </summary>
4141
/// <param name="client">Client to enable SimpleMusicCommandsExtension for.</param>
4242
/// <param name="cfg">Lavalink configuration to use.</param>
43-
/// <returns>Created <see cref="SimpleMusicCommandsExtension"/>.</returns>
43+
/// <returns>Created <see cref="SimpleMusicCommandsExtension" />.</returns>
4444
public static SimpleMusicCommandsExtension UseSimpleMusicCommands(this DiscordClient client, LavalinkConfiguration? cfg = null)
4545
{
4646
if (client.GetExtension<SimpleMusicCommandsExtension>() != null)
@@ -55,11 +55,11 @@ public static SimpleMusicCommandsExtension UseSimpleMusicCommands(this DiscordCl
5555
}
5656

5757
/// <summary>
58-
/// Enables SimpleMusicCommandsExtension module on all shards in this <see cref="DiscordShardedClient"/>.
58+
/// Enables SimpleMusicCommandsExtension module on all shards in this <see cref="DiscordShardedClient" />.
5959
/// </summary>
6060
/// <param name="client">Client to enable SimpleMusicCommandsExtension for.</param>
6161
/// <param name="cfg">Lavalink configuration to use.</param>
62-
/// <returns>A dictionary of created <see cref="SimpleMusicCommandsExtension"/>, indexed by shard id.</returns>
62+
/// <returns>A dictionary of created <see cref="SimpleMusicCommandsExtension" />, indexed by shard id.</returns>
6363
public static async Task<IReadOnlyDictionary<int, SimpleMusicCommandsExtension>> UseSimpleMusicCommandsAsync(this DiscordShardedClient client, LavalinkConfiguration? cfg = null)
6464
{
6565
var modules = new Dictionary<int, SimpleMusicCommandsExtension>();
@@ -77,15 +77,15 @@ public static async Task<IReadOnlyDictionary<int, SimpleMusicCommandsExtension>>
7777
}
7878

7979
/// <summary>
80-
/// Gets the active SimpleMusicCommandsExtension module for this client.
80+
/// Gets the active SimpleMusicCommandsExtension module for this client.
8181
/// </summary>
8282
/// <param name="client">Client to get SimpleMusicCommandsExtension module from.</param>
8383
/// <returns>The module, or null if not activated.</returns>
8484
public static SimpleMusicCommandsExtension? GetSimpleMusicCommandsExtension(this DiscordClient client)
8585
=> client.GetExtension<SimpleMusicCommandsExtension>();
8686

8787
/// <summary>
88-
/// Gets the active SimpleMusicCommandsExtension modules for all shards in this client.
88+
/// Gets the active SimpleMusicCommandsExtension modules for all shards in this client.
8989
/// </summary>
9090
/// <param name="client">Client to get SimpleMusicCommandsExtension instances from.</param>
9191
/// <returns>A dictionary of the modules, indexed by shard id.</returns>

DisCatSharp.Extensions.TwoFactorCommands/DisCatSharp.Extensions.TwoFactorCommands.csproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,16 @@
2626
<ItemGroup>
2727
<PackageReference Include="Backport.System.Threading.Lock" Version="3.1.4" />
2828
<PackageReference Include="DatabaseWrapper.Sqlite" Version="6.1.4" />
29-
<PackageReference Include="DisCatSharp" Version="10.6.6-nightly-031" />
29+
<PackageReference Include="DisCatSharp" Version="10.6.6" />
3030
<PackageReference Include="DisCatSharp.Analyzer.Roselyn" Version="6.2.*">
3131
<PrivateAssets>all</PrivateAssets>
3232
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
3333
</PackageReference>
34-
<PackageReference Include="DisCatSharp.ApplicationCommands" Version="10.6.6-nightly-031" />
34+
<PackageReference Include="DisCatSharp.ApplicationCommands" Version="10.6.6" />
3535
<PackageReference Include="DisCatSharp.Attributes" Version="10.6.*" />
36-
<PackageReference Include="DisCatSharp.CommandsNext" Version="10.6.6-nightly-031" />
37-
<PackageReference Include="DisCatSharp.Common" Version="10.6.6-nightly-031" />
38-
<PackageReference Include="DisCatSharp.Interactivity" Version="10.6.6-nightly-031" />
36+
<PackageReference Include="DisCatSharp.CommandsNext" Version="10.6.6" />
37+
<PackageReference Include="DisCatSharp.Common" Version="10.6.6" />
38+
<PackageReference Include="DisCatSharp.Interactivity" Version="10.6.6" />
3939
<PackageReference Include="Microsoft.DependencyValidation.Analyzers" Version="0.11.0" />
4040
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.1" />
4141
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.1" />

DisCatSharp.Extensions.TwoFactorCommands/Entities/TwoFactorResponse.cs

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,38 +20,32 @@
2020
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121
// SOFTWARE.
2222

23-
using System;
24-
using System.Collections.Generic;
25-
using System.Linq;
26-
using System.Text;
27-
using System.Threading.Tasks;
28-
29-
using DisCatSharp.Entities;
3023
using DisCatSharp.EventArgs;
3124
using DisCatSharp.Extensions.TwoFactorCommands.Enums;
3225

3326
namespace DisCatSharp.Extensions.TwoFactorCommands.Entities;
3427

3528
/// <summary>
36-
/// The response given upon attempted two factor authentication.
29+
/// The response given upon attempted two factor authentication.
3730
/// </summary>
3831
public class TwoFactorResponse
3932
{
33+
internal TwoFactorResponse()
34+
{ }
35+
4036
/// <summary>
41-
/// The modal response <see cref="ComponentInteractionCreateEventArgs"/>. Null if <see cref="Result"/> is <see cref="TwoFactorResult.NotEnrolled"/> or <see cref="TwoFactorResult.TimedOut"/>.
37+
/// The modal response <see cref="ComponentInteractionCreateEventArgs" />. Null if <see cref="Result" /> is
38+
/// <see cref="TwoFactorResult.NotEnrolled" /> or <see cref="TwoFactorResult.TimedOut" />.
4239
/// </summary>
4340
public ComponentInteractionCreateEventArgs ComponentInteraction { get; internal set; } = null;
4441

4542
/// <summary>
46-
/// The <see cref="DiscordClient"/> this interaction took place with.
43+
/// The <see cref="DiscordClient" /> this interaction took place with.
4744
/// </summary>
4845
public DiscordClient Client { get; internal set; } = null;
4946

5047
/// <summary>
51-
/// The <see cref="TwoFactorResult"/> of the two factor authentication.
48+
/// The <see cref="TwoFactorResult" /> of the two factor authentication.
5249
/// </summary>
5350
public TwoFactorResult Result { get; internal set; } = TwoFactorResult.TimedOut;
54-
55-
internal TwoFactorResponse()
56-
{ }
5751
}

DisCatSharp.Extensions.TwoFactorCommands/Enums/TwoFactorResult.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,32 +23,32 @@
2323
namespace DisCatSharp.Extensions.TwoFactorCommands.Enums;
2424

2525
/// <summary>
26-
/// Represents two factor responses.
26+
/// Represents two factor responses.
2727
/// </summary>
28-
public enum TwoFactorResult : int
28+
public enum TwoFactorResult
2929
{
3030
/// <summary>
31-
/// Code is invalid.
31+
/// Code is invalid.
3232
/// </summary>
3333
InvalidCode = 1,
3434

3535
/// <summary>
36-
/// Code is valid.
36+
/// Code is valid.
3737
/// </summary>
3838
ValidCode = 2,
3939

4040
/// <summary>
41-
/// User is not enrolled.
41+
/// User is not enrolled.
4242
/// </summary>
4343
NotEnrolled = 3,
4444

4545
/// <summary>
46-
/// Two factor input timed out.
46+
/// Two factor input timed out.
4747
/// </summary>
4848
TimedOut = 4,
4949

5050
/// <summary>
51-
/// This function is not implemented.
51+
/// This function is not implemented.
5252
/// </summary>
5353
NotImplemented = int.MaxValue
5454
}

DisCatSharp.Extensions.TwoFactorCommands/ExtensionMethods.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,16 @@
3131
namespace DisCatSharp.Extensions.TwoFactorCommands;
3232

3333
/// <summary>
34-
/// Defines various extensions specific to TwoFactor.
34+
/// Defines various extensions specific to TwoFactor.
3535
/// </summary>
3636
public static class ExtensionMethods
3737
{
3838
/// <summary>
39-
/// Enables TwoFactor module on this <see cref="DiscordClient"/>.
39+
/// Enables TwoFactor module on this <see cref="DiscordClient" />.
4040
/// </summary>
4141
/// <param name="client">Client to enable TwoFactor for.</param>
4242
/// <param name="cfg">TwoFactor configuration to use.</param>
43-
/// <returns>Created <see cref="TwoFactorExtension"/>.</returns>
43+
/// <returns>Created <see cref="TwoFactorExtension" />.</returns>
4444
public static TwoFactorExtension UseTwoFactor(this DiscordClient client, TwoFactorConfiguration? cfg = null)
4545
{
4646
if (client.GetExtension<TwoFactorExtension>() != null)
@@ -55,11 +55,11 @@ public static TwoFactorExtension UseTwoFactor(this DiscordClient client, TwoFact
5555
}
5656

5757
/// <summary>
58-
/// Enables TwoFactor module on all shards in this <see cref="DiscordShardedClient"/>.
58+
/// Enables TwoFactor module on all shards in this <see cref="DiscordShardedClient" />.
5959
/// </summary>
6060
/// <param name="client">Client to enable TwoFactor for.</param>
6161
/// <param name="cfg">TwoFactor configuration to use.</param>
62-
/// <returns>A dictionary of created <see cref="TwoFactorExtension"/>, indexed by shard id.</returns>
62+
/// <returns>A dictionary of created <see cref="TwoFactorExtension" />, indexed by shard id.</returns>
6363
public static async Task<IReadOnlyDictionary<int, TwoFactorExtension>> UseTwoFactorAsync(this DiscordShardedClient client, TwoFactorConfiguration? cfg = null)
6464
{
6565
var modules = new Dictionary<int, TwoFactorExtension>();
@@ -77,15 +77,15 @@ public static async Task<IReadOnlyDictionary<int, TwoFactorExtension>> UseTwoFac
7777
}
7878

7979
/// <summary>
80-
/// Gets the active TwoFactor module for this client.
80+
/// Gets the active TwoFactor module for this client.
8181
/// </summary>
8282
/// <param name="client">Client to get TwoFactor module from.</param>
8383
/// <returns>The module, or null if not activated.</returns>
8484
public static TwoFactorExtension? GetTwoFactor(this DiscordClient client)
8585
=> client.GetExtension<TwoFactorExtension>();
8686

8787
/// <summary>
88-
/// Gets the active TwoFactor modules for all shards in this client.
88+
/// Gets the active TwoFactor modules for all shards in this client.
8989
/// </summary>
9090
/// <param name="client">Client to get TwoFactor instances from.</param>
9191
/// <returns>A dictionary of the modules, indexed by shard id.</returns>

DisCatSharp.Extensions.TwoFactorCommands/Extensions/ApplicationCommands/ApplicationCommandRequireEnrolledTwoFactorAttribute.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,19 @@
2929
namespace DisCatSharp.ApplicationCommands.Attributes;
3030

3131
/// <summary>
32-
/// Defines that this application command can only be executed if the user is enrolled in two factor auth.
32+
/// Defines that this application command can only be executed if the user is enrolled in two factor auth.
3333
/// </summary>
3434
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, Inherited = false)]
3535
public sealed class ApplicationCommandRequireEnrolledTwoFactorAttribute : ApplicationCommandCheckBaseAttribute
3636
{
3737
/// <summary>
38-
/// Defines that this application command can only be executed if the user is enrolled in two factor auth.
38+
/// Defines that this application command can only be executed if the user is enrolled in two factor auth.
3939
/// </summary>
4040
public ApplicationCommandRequireEnrolledTwoFactorAttribute()
4141
{ }
4242

4343
/// <summary>
44-
/// Runs checks.
44+
/// Runs checks.
4545
/// </summary>
4646
public override Task<bool> ExecuteChecksAsync(BaseContext ctx)
4747
=> Task.FromResult(ctx.Client.GetTwoFactor().IsEnrolled(ctx.User.Id));

DisCatSharp.Extensions.TwoFactorCommands/Extensions/ApplicationCommands/TwoFactorApplicationCommandExtension.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,21 @@
2727
using DisCatSharp.Entities;
2828
using DisCatSharp.Enums;
2929
using DisCatSharp.EventArgs;
30-
using DisCatSharp.Extensions.TwoFactorCommands.Enums;
3130
using DisCatSharp.Extensions.TwoFactorCommands.Entities;
31+
using DisCatSharp.Extensions.TwoFactorCommands.Enums;
3232
using DisCatSharp.Interactivity.Extensions;
3333

3434
namespace DisCatSharp.Extensions.TwoFactorCommands.ApplicationCommands;
3535

3636
public static class TwoFactorApplicationCommandExtension
3737
{
3838
/// <summary>
39-
/// <para>Asks the user via modal input for the two factor code.</para>
40-
/// <para>This uses DisCatSharp.Interactivity.</para>
41-
/// <para>To be used as first action for application commands.</para>
39+
/// <para>Asks the user via modal input for the two factor code.</para>
40+
/// <para>This uses DisCatSharp.Interactivity.</para>
41+
/// <para>To be used as first action for application commands.</para>
4242
/// </summary>
4343
/// <param name="ctx">The base context.</param>
44-
/// <returns>A <see cref="TwoFactorResponse"/>.</returns>
44+
/// <returns>A <see cref="TwoFactorResponse" />.</returns>
4545
public static async Task<TwoFactorResponse> RequestTwoFactorAsync(this BaseContext ctx)
4646
{
4747
var ext = ctx.Client.GetTwoFactor();
@@ -62,7 +62,7 @@ public static async Task<TwoFactorResponse> RequestTwoFactorAsync(this BaseConte
6262
builder.AddTextComponent(new(TextComponentStyle.Small, "code", "Code", "123456", ext.Configuration.Digits, ext.Configuration.Digits));
6363
await ctx.CreateModalResponseAsync(builder);
6464

65-
var response = new TwoFactorResponse()
65+
var response = new TwoFactorResponse
6666
{
6767
Client = ctx.Client
6868
};
@@ -99,13 +99,13 @@ public static async Task<TwoFactorResponse> RequestTwoFactorAsync(this BaseConte
9999
}
100100

101101
/// <summary>
102-
/// <para>Asks the user via modal input for the two factor code.</para>
103-
/// <para>This uses DisCatSharp.Interactivity.</para>
104-
/// <para>To be used as first action for button.</para>
102+
/// <para>Asks the user via modal input for the two factor code.</para>
103+
/// <para>This uses DisCatSharp.Interactivity.</para>
104+
/// <para>To be used as first action for button.</para>
105105
/// </summary>
106106
/// <param name="evt">The interaction context.</param>
107107
/// <param name="client">The discord client to use.</param>
108-
/// <returns>A <see cref="TwoFactorResponse"/>.</returns>
108+
/// <returns>A <see cref="TwoFactorResponse" />.</returns>
109109
public static async Task<TwoFactorResponse> RequestTwoFactorAsync(this ComponentInteractionCreateEventArgs evt, DiscordClient client)
110110
{
111111
var ext = client.GetTwoFactor();
@@ -126,7 +126,7 @@ public static async Task<TwoFactorResponse> RequestTwoFactorAsync(this Component
126126
builder.AddTextComponent(new(TextComponentStyle.Small, "code", "Code", "123456", ext.Configuration.Digits, ext.Configuration.Digits));
127127
await evt.Interaction.CreateInteractionModalResponseAsync(builder);
128128

129-
var response = new TwoFactorResponse()
129+
var response = new TwoFactorResponse
130130
{
131131
Client = client
132132
};

0 commit comments

Comments
 (0)