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

    Class RequireBotGroupPrivilegeAttribute

    Command requirement that checks if the bot has correct group permissions.

    Inheritance
    System.Object
    System.Attribute
    CommandRequirementAttribute
    RequireBotGroupPrivilegeAttribute
    RequireBotGroupAdminAttribute
    RequireBotGroupModAttribute
    RequireBotGroupOwnerAttribute
    Implements
    ICommandRequirement
    Inherited Members
    CommandRequirementAttribute.ErrorMessage
    CommandRequirementAttribute.AbortOnFail
    CommandRequirementAttribute.SendMessageWhenSkipping
    CommandRequirementAttribute.SuccessResult
    CommandRequirementAttribute.FailureResult
    CommandRequirementAttribute.ResultFromBoolean(Boolean)
    Namespace: TehGM.Wolfringo.Commands.Attributes
    Assembly: Wolfringo.Commands.dll
    Syntax
    public class RequireBotGroupPrivilegeAttribute : CommandRequirementAttribute, ICommandRequirement
    Remarks

    Default ErrorMessage for this requirement is "(n) I don't have enough group privileges to execute this command.".

    Constructors

    | Improve this Doc View Source

    RequireBotGroupPrivilegeAttribute(WolfGroupCapabilities)

    Creates a new instance of command group privilege requirement.

    Declaration
    public RequireBotGroupPrivilegeAttribute(WolfGroupCapabilities privileges)
    Parameters
    Type Name Description
    WolfGroupCapabilities privileges

    Flags of privileges that fulfill this requirement.

    Remarks

    Only one of the privileges has to match. For example, Owner | Admin matches if bot is either Owner or Admin.

    See Also
    Privileges

    Properties

    | Improve this Doc View Source

    IgnoreInPrivate

    Whether this requirement should be ignored in private messages.

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

    If this is set to true, CheckAsync(ICommandContext, IServiceProvider, CancellationToken) will always return true for private messages. This is useful if the command should work normally in PM, even if in group it requires permissions.
    If this is set to false, CheckAsync(ICommandContext, IServiceProvider, CancellationToken) will always return false for private messages. This will make command group-only.

    Defaults to false.

    | Improve this Doc View Source

    Privileges

    Flags of privileges that fulfill this requirement.

    Declaration
    public WolfGroupCapabilities Privileges { get; }
    Property Value
    Type Description
    WolfGroupCapabilities
    Remarks

    Only one of the privileges has to match. For example, Owner | Admin matches if bot is either Owner or Admin.

    Methods

    | Improve this Doc View Source

    CheckAsync(ICommandContext, IServiceProvider, CancellationToken)

    Checks requirement.

    Declaration
    public override async 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.

    Overrides
    CommandRequirementAttribute.CheckAsync(ICommandContext, IServiceProvider, CancellationToken)

    Implements

    ICommandRequirement

    See Also

    RequireBotGroupOwnerAttribute
    RequireBotGroupAdminAttribute
    RequireBotGroupModAttribute