Search Results for

    Show / Hide Table of Contents

    Class ParameterPreconditionAttribute

    Requires the parameter to pass the specified precondition before execution can begin.

    Inheritance
    Object
    ParameterPreconditionAttribute
    Namespace: Discord.Interactions
    Assembly: Discord.Net.Interactions.dll
    Syntax
    public abstract class ParameterPreconditionAttribute : Attribute

    Properties

    | Improve this Doc View Source

    ErrorMessage

    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 Source

    CheckRequirementsAsync(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>

    See Also

    PreconditionAttribute

    Theme

    • Improve this Doc
    • View Source
    In This Article
    Back to top Discord.Net (c) 2015-2022 3.7.2