@@ -3,12 +3,15 @@ using System.Threading.Tasks;
namespace Discord.Commands
namespace Discord.Commands
{
{
/// <summary> Requires the module or class to pass the specified precondition before execution can begin. </summary>
/// <summary>
/// Requires the module or class to pass the specified precondition before execution can begin.
/// </summary>
/// <seealso cref="ParameterPreconditionAttribute"/>
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
public abstract class PreconditionAttribute : Attribute
public abstract class PreconditionAttribute : Attribute
{
{
/// <summary>
/// <summary>
/// Specify a group that this precondition belongs to.
/// Specifies a group that this precondition belongs to.
/// </summary>
/// </summary>
/// <remarks>
/// <remarks>
/// <see cref="Preconditions" /> of the same group require only one of the preconditions to pass in order to
/// <see cref="Preconditions" /> of the same group require only one of the preconditions to pass in order to
@@ -17,6 +20,12 @@ namespace Discord.Commands
/// </remarks>
/// </remarks>
public string Group { get; set; } = null;
public string Group { get; set; } = null;
/// <summary>
/// Checks if the <paramref name="command"/> has the sufficient permission to be executed.
/// </summary>
/// <param name="context">The context of the command.</param>
/// <param name="command">The command being executed.</param>
/// <param name="services">The service collection used for dependency injection.</param>
public abstract Task<PreconditionResult> CheckPermissionsAsync(ICommandContext context, CommandInfo command, IServiceProvider services);
public abstract Task<PreconditionResult> CheckPermissionsAsync(ICommandContext context, CommandInfo command, IServiceProvider services);
}
}
}
}