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

    Class CommandInstanceDescriptorExtensions

    Extensions for command instance descriptors.

    Inheritance
    System.Object
    CommandInstanceDescriptorExtensions
    Namespace: TehGM.Wolfringo.Commands
    Assembly: Wolfringo.Commands.dll
    Syntax
    public static class CommandInstanceDescriptorExtensions
    Remarks

    Extensions in this class will automatically cache results to improve performance.

    Methods

    | Improve this Doc View Source

    GetAllAttributes<T>(ICommandInstanceDescriptor, Boolean)

    Gets all custom attributes of specified type.

    Declaration
    public static IEnumerable<T> GetAllAttributes<T>(this ICommandInstanceDescriptor descriptor, bool includeHandlerAttributes = false)
        where T : Attribute
    Parameters
    Type Name Description
    ICommandInstanceDescriptor descriptor

    Command instance descriptor to get the value for.

    System.Boolean includeHandlerAttributes

    Whether handler attributes should also be checked.

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<T>

    Enumerable of found attributes.

    Type Parameters
    Name Description
    T

    Type of attributes.

    | Improve this Doc View Source

    GetAttribute<T>(ICommandInstanceDescriptor, Boolean)

    Gets single custom attribute of specified type.

    Declaration
    public static T GetAttribute<T>(this ICommandInstanceDescriptor descriptor, bool includeHandlerAttributes = false)
        where T : Attribute
    Parameters
    Type Name Description
    ICommandInstanceDescriptor descriptor

    Command instance descriptor to get the value for.

    System.Boolean includeHandlerAttributes

    Whether handler attributes should also be checked.

    Returns
    Type Description
    T

    Found attribute; null if not found.

    Type Parameters
    Name Description
    T

    Type of attribute.

    | Improve this Doc View Source

    GetCaseSensitivityOverride(ICommandInstanceDescriptor)

    Checks if the command is overriding default case sensitivity.

    Declaration
    public static bool? GetCaseSensitivityOverride(this ICommandInstanceDescriptor descriptor)
    Parameters
    Type Name Description
    ICommandInstanceDescriptor descriptor
    Returns
    Type Description
    System.Nullable<System.Boolean>

    True/false if command is overriding case sensitivity - true to be case sensitive, false to be case insensitive; null if not overriding.

    Remarks

    See CaseSensitivityAttribute for more information about command case senstivity.

    | Improve this Doc View Source

    GetDisplayName(ICommandInstanceDescriptor)

    Gets display name for given command instance descriptor.

    Declaration
    public static string GetDisplayName(this ICommandInstanceDescriptor descriptor)
    Parameters
    Type Name Description
    ICommandInstanceDescriptor descriptor

    Command instance descriptor to get the value for.

    Returns
    Type Description
    System.String

    String with determined display name.

    Remarks

    Display name is determined in the following order:

    1. Value of DisplayNameAttribute if present;
    2. Command text if the command is a standard command (CommandAttribute);
    3. Regex pattern if the command is a regex command (RegexCommandAttribute);
      If the name couldn't be determined, null will be returned.
    | Improve this Doc View Source

    GetHandlerAttribute(ICommandInstanceDescriptor)

    Retrieves CommandHandler attribute for the command's handler.

    Declaration
    public static CommandsHandlerAttribute GetHandlerAttribute(this ICommandInstanceDescriptor descriptor)
    Parameters
    Type Name Description
    ICommandInstanceDescriptor descriptor

    Command descriptor.

    Returns
    Type Description
    CommandsHandlerAttribute

    CommandHandler attribute present on the command's handler type; null if not found.

    | Improve this Doc View Source

    GetHandlerType(ICommandInstanceDescriptor)

    Gets type of the command's handler.

    Declaration
    public static Type GetHandlerType(this ICommandInstanceDescriptor descriptor)
    Parameters
    Type Name Description
    ICommandInstanceDescriptor descriptor

    Command descriptor.

    Returns
    Type Description
    System.Type

    Type of command's handler.

    | Improve this Doc View Source

    GetHelpCategory(ICommandInstanceDescriptor)

    Gets help category for given command or its handler.

    Declaration
    public static HelpCategoryAttribute GetHelpCategory(this ICommandInstanceDescriptor descriptor)
    Parameters
    Type Name Description
    ICommandInstanceDescriptor descriptor

    Command instance descriptor to get the value for.

    Returns
    Type Description
    HelpCategoryAttribute

    Help Category attribute if found on command or its handler; otherwise null.

    | Improve this Doc View Source

    GetHelpOrder(ICommandInstanceDescriptor)

    Gets command's help order.

    Declaration
    public static int? GetHelpOrder(this ICommandInstanceDescriptor descriptor)
    Parameters
    Type Name Description
    ICommandInstanceDescriptor descriptor

    Command descriptor.

    Returns
    Type Description
    System.Nullable<System.Int32>

    Command's help order value. Null if help order is not specified.

    Remarks

    See HelpOrderAttribute for more information about command help order.

    See Also
    HelpOrderAttribute
    | Improve this Doc View Source

    GetPrefixOverride(ICommandInstanceDescriptor)

    Gets command's prefix override.

    Declaration
    public static string GetPrefixOverride(this ICommandInstanceDescriptor descriptor)
    Parameters
    Type Name Description
    ICommandInstanceDescriptor descriptor

    Command descriptor.

    Returns
    Type Description
    System.String

    Prefix value.

    | Improve this Doc View Source

    GetPrefixRequirementOverride(ICommandInstanceDescriptor)

    Gets command's prefix requirement override.

    Declaration
    public static PrefixRequirement? GetPrefixRequirementOverride(this ICommandInstanceDescriptor descriptor)
    Parameters
    Type Name Description
    ICommandInstanceDescriptor descriptor

    Command descriptor.

    Returns
    Type Description
    System.Nullable<PrefixRequirement>

    Prefix requirement value.

    | Improve this Doc View Source

    GetPriority(ICommandInstanceDescriptor)

    Gets command's priority.

    Declaration
    public static int GetPriority(this ICommandInstanceDescriptor descriptor)
    Parameters
    Type Name Description
    ICommandInstanceDescriptor descriptor

    Command descriptor.

    Returns
    Type Description
    System.Int32

    Command's priority value.

    Remarks

    See PriorityAttribute for more information about command priorities.

    See Also
    PriorityAttribute
    | Improve this Doc View Source

    GetRequirements(ICommandInstanceDescriptor)

    Gets command's pre-execute checks.

    Declaration
    public static IEnumerable<CommandRequirementAttribute> GetRequirements(this ICommandInstanceDescriptor descriptor)
    Parameters
    Type Name Description
    ICommandInstanceDescriptor descriptor

    Command descriptor.

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<CommandRequirementAttribute>

    Enumerable on all pre-execute checks on the command's method and handler type.

    | Improve this Doc View Source

    GetSummary(ICommandInstanceDescriptor)

    Gets summary text for given command instance descriptor.

    Declaration
    public static string GetSummary(this ICommandInstanceDescriptor descriptor)
    Parameters
    Type Name Description
    ICommandInstanceDescriptor descriptor

    Command instance descriptor to get the value for.

    Returns
    Type Description
    System.String

    Summary text if found on the command; otherwise null.

    | Improve this Doc View Source

    IsHidden(ICommandInstanceDescriptor)

    Checks if the command or its handler are hidden.

    Declaration
    public static bool IsHidden(this ICommandInstanceDescriptor descriptor)
    Parameters
    Type Name Description
    ICommandInstanceDescriptor descriptor

    Command instance descriptor to get the value for.

    Returns
    Type Description
    System.Boolean

    True if the command or its handler are marked as hidden; otherwise false.