Wolfringo Wolfringo
Wolfringo Wolfringo
Wolfringo (c) 2020 TehGM
DocFX, DiscordFX theme.
Search Results for

    Class CommandRequirementAttribute

    Represents any special validation that message needs to pass for command to be executed.

    Inheritance
    System.Object
    System.Attribute
    CommandRequirementAttribute
    RequireBotGroupPrivilegeAttribute
    RequireBotUserPrivilegeAttribute
    RequireGroupPrivilegeAttribute
    RequireUserPrivilegeAttribute
    GroupOnlyAttribute
    IgnoreBotsAttribute
    PrivateOnlyAttribute
    RequireMaximumReputationAttribute
    RequireMinimumReputationAttribute
    Implements
    ICommandRequirement
    Namespace: TehGM.Wolfringo.Commands.Attributes
    Assembly: Wolfringo.Commands.dll
    Syntax
    [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method, AllowMultiple = true, Inherited = true)]
    public abstract class CommandRequirementAttribute : Attribute, ICommandRequirement

    Properties

    | Improve this Doc View Source

    AbortOnFail

    Whether check fail should cause Command execution to be aborted completely. True by default.

    Declaration
    public bool AbortOnFail { get; set; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    ErrorMessage

    The message that bot should reply with if requirement was not fulfilled.

    Declaration
    public string ErrorMessage { get; set; }
    Property Value
    Type Description
    System.String
    | Improve this Doc View Source

    FailureResult

    Standard failure result.

    Declaration
    protected ICommandResult FailureResult { get; }
    Property Value
    Type Description
    ICommandResult
    Remarks

    This result will automatically use ErrorMessage if it's set.

    | Improve this Doc View Source

    SendMessageWhenSkipping

    Whether skip result should cause ErrorMessage to be sent. Defaults to false.

    Declaration
    public bool SendMessageWhenSkipping { get; set; }
    Property Value
    Type Description
    System.Boolean
    Remarks

    Has no effect if AbortOnFail is set to false;

    | Improve this Doc View Source

    SuccessResult

    Standard success result.

    Declaration
    protected ICommandResult SuccessResult { get; }
    Property Value
    Type Description
    ICommandResult

    Methods

    | Improve this Doc View Source

    CheckAsync(ICommandContext, IServiceProvider, CancellationToken)

    Checks requirement.

    Declaration
    public abstract Task<ICommandResult> CheckAsync(ICommandContext context, IServiceProvider services, CancellationToken cancellationToken = default(CancellationToken))
    Parameters
    Type Name Description
    ICommandContext context

    Command to check the requirement for.

    System.IServiceProvider services

    Services that can be used during requirement checks.

    System.Threading.CancellationToken cancellationToken

    Token for cancelling the task.

    Returns
    Type Description
    System.Threading.Tasks.Task<ICommandResult>

    True if requirement was fullfilled; otherwise false.

    | Improve this Doc View Source

    ResultFromBoolean(Boolean)

    Converts a simple boolean to a proper command result.

    Declaration
    protected ICommandResult ResultFromBoolean(bool isSuccess)
    Parameters
    Type Name Description
    System.Boolean isSuccess

    Whether success or failure result should be returned.

    Returns
    Type Description
    ICommandResult

    Command result based on isSuccess.

    Implements

    ICommandRequirement