Class ParameterPreconditionAttribute
Requires the parameter to pass the specified precondition before execution can begin.
Namespace: Discord.Interactions
Assembly: Discord.Net.Interactions.dll
Syntax
public abstract class ParameterPreconditionAttribute : Attribute
Properties
| Improve this Doc View SourceErrorMessage
Gets the error message to be returned if execution context doesn't pass the precondition check.
Declaration
public virtual string ErrorMessage { get; }
Property Value
Type | Description |
---|---|
String |
Remarks
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.
Methods
| Improve this Doc View SourceCheckRequirementsAsync(IInteractionContext, IParameterInfo, Object, IServiceProvider)
Checks whether the condition is met before execution of the command.
Declaration
public abstract Task<PreconditionResult> CheckRequirementsAsync(IInteractionContext context, IParameterInfo parameterInfo, object value, IServiceProvider services)
Parameters
Type | Name | Description |
---|---|---|
IInteractionContext | context | The context of the command. |
IParameterInfo | parameterInfo | The parameter of the command being checked against. |
Object | value | The raw value of the parameter. |
IServiceProvider | services | The service collection used for dependency injection. |
Returns
Type | Description |
---|---|
Task<PreconditionResult> |