Skip to content

Commit

Permalink
fix!: proper naming of functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Lulalaby committed Mar 29, 2023
1 parent 8abc96f commit df6ad31
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ namespace DisCatSharp.ApplicationCommands.Attributes;
/// Defines that this application command can only be executed if the user is enrolled in two factor auth.
/// </summary>
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, Inherited = false)]
public sealed class ApplicationCommandRequireTwoFactorAttribute : ApplicationCommandCheckBaseAttribute
public sealed class ApplicationCommandRequireEnrolledTwoFactorAttribute : ApplicationCommandCheckBaseAttribute
{
/// <summary>
/// Defines that this application command can only be executed if the user is enrolled in two factor auth.
/// </summary>
public ApplicationCommandRequireTwoFactorAttribute()
public ApplicationCommandRequireEnrolledTwoFactorAttribute()
{ }

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public static class TwoFactorApplicationCommandExtension
/// </summary>
/// <param name="ctx">The base context.</param>
/// <returns>A <see cref="TwoFactorResponse"/>.</returns>
public static async Task<TwoFactorResponse> AskForTwoFactorAsync(this BaseContext ctx)
public static async Task<TwoFactorResponse> RequestTwoFactorAsync(this BaseContext ctx)
{
var ext = ctx.Client.GetTwoFactor();
/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ namespace DisCatSharp.CommandsNext.Attributes;
/// Defines that this command can only be executed if the user is enrolled in two factor auth.
/// </summary>
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, Inherited = false), Experimental("No support for this yet")]
public sealed class CommandRequireTwoFactorAttribute : CheckBaseAttribute
public sealed class CommandRequireEnrolledTwoFactorAttribute : CheckBaseAttribute
{
/// <summary>
/// Defines that this command can only be executed if the user is enrolled in two factor auth.
/// </summary>
public CommandRequireTwoFactorAttribute()
public CommandRequireEnrolledTwoFactorAttribute()
{ }

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,11 @@ public static class TwoFactorCommandsNextExtension
/// <para>Asks the user via private for the two factor code.</para>
/// <para>This uses DisCatSharp.Interactivity.</para>
/// <para>To be used for commands next.</para>
/// <para><note type="caution">Not implemented yet. Returns <see cref="TwoFactorResponse.NotImplemented"/>.</note></para>
/// </summary>
/// <param name="ctx">The command context.</param>
/// <returns>A <see cref="TwoFactorResponse"/>.</returns>
[Experimental("No support for this yet. Not implemented")]
public static async Task<TwoFactorResponse> AskForTwoFactorAsync(CommandContext ctx)
public static async Task<TwoFactorResponse> RequestTwoFactorAsync(CommandContext ctx)
=> await Task.FromResult(TwoFactorResponse.NotImplemented);
}
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,6 @@ internal void EnrollUser(ulong user, string secret)
/// Unenrolls given user id from two factor auth.
/// </summary>
/// <param name="user">User id to unenroll.</param>
internal void UnenrollUser(ulong user)
internal void DisenrollUser(ulong user)
=> this.RemoveSecret(user);
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,16 @@ public static class TwoFactorExtensionUtilities
/// <param name="client">The discord client.</param>
/// <param name="user">The user id to check.</param>
/// <returns>Whether the user is enrolled.</returns>
public static bool CheckTwoFactorEnrollment(this DiscordClient client, ulong user)
public static bool CheckTwoFactorEnrollmentFor(this DiscordClient client, ulong user)
=> client.GetTwoFactor().IsEnrolled(user);

/// <summary>
/// Removes the two factor registration for the given user id.
/// </summary>
/// <param name="client">The discord client.</param>
/// <param name="user">The user id to check.</param>
public static void RemoveTwoFactorEnrollment(this DiscordClient client, ulong user)
=> client.GetTwoFactor().UnenrollUser(user);
public static void DisenrollTwoFactor(this DiscordClient client, ulong user)
=> client.GetTwoFactor().DisenrollUser(user);

/// <summary>
/// Registers two factor for the given user.
Expand Down

0 comments on commit df6ad31

Please sign in to comment.