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

    Class CommandInstanceBase

    Base class with shared functionality for RegexCommandInstance and StandardCommandInstance.

    Inheritance
    System.Object
    CommandInstanceBase
    RegexCommandInstance
    StandardCommandInstance
    Namespace: TehGM.Wolfringo.Commands.Initialization
    Assembly: Wolfringo.Commands.dll
    Syntax
    public abstract class CommandInstanceBase
    Remarks

    This class was created for internal use.
    Command instances might inherit from this class, but this is not required. If you want to use a shared abstraction for command instances, use ICommandInstance instead.

    Constructors

    | Improve this Doc View Source

    CommandInstanceBase(MethodInfo, IEnumerable<ICommandRequirement>, String, Nullable<PrefixRequirement>, Nullable<Boolean>, Int32)

    Creates a new command instance.

    Declaration
    public CommandInstanceBase(MethodInfo method, IEnumerable<ICommandRequirement> requirements, string prefixOverride, PrefixRequirement? prefixRequirementOverride, bool? caseSensitivityOverride, int timeout)
    Parameters
    Type Name Description
    System.Reflection.MethodInfo method

    Method that will be executed.

    System.Collections.Generic.IEnumerable<ICommandRequirement> requirements

    Execution requirements.

    System.String prefixOverride

    Prefix override; null for no overriding.

    System.Nullable<PrefixRequirement> prefixRequirementOverride

    Prefix requireent override; null for no overriding.

    System.Nullable<System.Boolean> caseSensitivityOverride

    Case sensitivity override; null for no overriding.

    System.Int32 timeout

    Timeout value for command execution. -1 for no timeout.

    Properties

    | Improve this Doc View Source

    CaseSensitivityOverride

    Case sensitivity override; null for no overriding.

    Declaration
    public bool? CaseSensitivityOverride { get; }
    Property Value
    Type Description
    System.Nullable<System.Boolean>
    | Improve this Doc View Source

    HandlerType

    Type of the handler containing the command.

    Declaration
    public Type HandlerType { get; }
    Property Value
    Type Description
    System.Type
    | Improve this Doc View Source

    Method

    Method that will be executed.

    Declaration
    public MethodInfo Method { get; }
    Property Value
    Type Description
    System.Reflection.MethodInfo
    | Improve this Doc View Source

    Parameters

    All command method's parameters.

    Declaration
    protected ParameterInfo[] Parameters { get; }
    Property Value
    Type Description
    System.Reflection.ParameterInfo[]
    | Improve this Doc View Source

    PrefixOverride

    Prefix override; null for no overriding.

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

    PrefixRequirementOverride

    Prefix requireent override; null for no overriding.

    Declaration
    public PrefixRequirement? PrefixRequirementOverride { get; }
    Property Value
    Type Description
    System.Nullable<PrefixRequirement>
    | Improve this Doc View Source

    Requirements

    Execution requirements.

    Declaration
    public IEnumerable<ICommandRequirement> Requirements { get; }
    Property Value
    Type Description
    System.Collections.Generic.IEnumerable<ICommandRequirement>
    | Improve this Doc View Source

    Timeout

    Timeout value for command execution.

    Declaration
    public TimeSpan Timeout { get; }
    Property Value
    Type Description
    System.TimeSpan

    Methods

    | Improve this Doc View Source

    CheckMatch(ICommandContext, out Int32, out CommandContextOptions)

    Performs shared match checks.

    Declaration
    protected bool CheckMatch(ICommandContext context, out int startIndex, out CommandContextOptions options)
    Parameters
    Type Name Description
    ICommandContext context

    Command context to check.

    System.Int32 startIndex

    The index of command start (after prefix).

    CommandContextOptions options

    Options for command context, with command's overrides applied.

    Returns
    Type Description
    System.Boolean

    True if all checks passed; otherwise false.

    | Improve this Doc View Source

    GetOptionsForContext(ICommandContext)

    Returns options for command context, with command's overrides applied.

    Declaration
    protected CommandContextOptions GetOptionsForContext(ICommandContext context)
    Parameters
    Type Name Description
    ICommandContext context

    Command context in execution.

    Returns
    Type Description
    CommandContextOptions

    Options for command context, with command's overrides applied.

    | Improve this Doc View Source

    InvokeCommandAsync(ParameterBuilderValues, IServiceProvider, Object, CancellationToken)

    Builds command parameters and invokes the method.

    Declaration
    protected async Task<ICommandResult> InvokeCommandAsync(ParameterBuilderValues parameterBuilderValues, IServiceProvider services, object handler, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    ParameterBuilderValues parameterBuilderValues

    Values for parameter builder.

    System.IServiceProvider services

    Services provider for injecting parameters into command method.

    System.Object handler

    Handler object to execute the command method in.

    System.Threading.CancellationToken cancellationToken

    Cancellation token to cancel the execution.

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

    Result of the execution.