Skip to main content

Class PreconditionAttribute

Requires the module or class to pass the specified precondition before execution can begin.

Assembly: Revolt.Net.Commands.dll​
View Source​
Declaration
public abstract class PreconditionAttribute : Attribute

Properties​

Group​

Specifies a group that this precondition belongs to.

View Source​
Declaration
public string Group { get; set; }

ErrorMessage​

When overridden in a derived class, uses the supplied string as the error message if the precondition doesn't pass. Setting this for a class that doesn't override this property is a no-op.

View Source​
Declaration
public virtual string ErrorMessage { get; set; }

Methods​

CheckPermissionsAsync(ICommandContext, CommandInfo, IServiceProvider)​

Checks if the <code data-dev-comment-type="paramref" class="paramref">command</code> has the sufficient permission to be executed.

View Source​
Declaration
public abstract Task<PreconditionResult> CheckPermissionsAsync(ICommandContext context, CommandInfo command, IServiceProvider services)
Returns​

Task<Revolt.Commands.Results.PreconditionResult>

Parameters​
TypeNameDescription
Revolt.Commands.ICommandContextcontextThe context of the command.
Revolt.Commands.Info.CommandInfocommandThe command being executed.
IServiceProviderservicesThe service collection used for dependency injection.