Class RequireOwnerAttribute
- Namespace
- Discord.Interactions
- Assembly
- Discord.Net.Interactions.dll
Requires the command to be invoked by the owner of the bot.
[AttributeUsage(AttributeTargets.Class|AttributeTargets.Method, AllowMultiple = true, Inherited = true)]
public class RequireOwnerAttribute : PreconditionAttribute
- Inheritance
-
RequireOwnerAttribute
- Inherited Members
Remarks
This precondition will restrict the access of the command or module to the owner of the Discord application. If the precondition fails to be met, an erroneous PreconditionResult will be returned with the message "Command can only be run by the owner of the bot."
Methods
CheckRequirementsAsync(IInteractionContext, ICommandInfo, IServiceProvider)
Checks if the commandInfo
command to be executed meets the precondition requirements.
public override Task<PreconditionResult> CheckRequirementsAsync(IInteractionContext context, ICommandInfo command, IServiceProvider services)
Parameters
context
IInteractionContextThe context of the command.
command
ICommandInfoservices
IServiceProviderThe service collection used for dependency injection.