Skip to main content

Class RequireOwnerAttribute

Requires the command to be invoked by the owner of the bot.

Assembly: Discord.Net.Commands.dll​
View Source​
Declaration
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true, Inherited = true)]
public class RequireOwnerAttribute : PreconditionAttribute, _Attribute

Properties​

ErrorMessage​

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.

View Source​
Declaration
public override string ErrorMessage { get; set; }

Methods​

CheckPermissionsAsync(ICommandContext, CommandInfo, IServiceProvider)​

Checks if the <code data-dev-comment-type="paramref" class="paramref">command</code> has the sufficient permission to be executed.

View Source​
Declaration
public override async Task<PreconditionResult> CheckPermissionsAsync(ICommandContext context, CommandInfo command, IServiceProvider services)
Returns​

System.Threading.Tasks.Task<Discord.Commands.PreconditionResult>

Parameters​
TypeNameDescription
Discord.Commands.ICommandContextcontextThe context of the command.
Discord.Commands.CommandInfocommandThe command being executed.
System.IServiceProviderservicesThe service collection used for dependency injection.

Implements​

  • System.Runtime.InteropServices._Attribute