Class RequireOwnerAttribute
Requires the command to be invoked by the owner of the bot.
Namespace: Discord.Interactions
Assembly: Discord.Net.Interactions.dll
Syntax
public class RequireOwnerAttribute : PreconditionAttribute
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
| Improve this Doc View SourceCheckRequirementsAsync(IInteractionContext, ICommandInfo, IServiceProvider)
Checks if the commandInfo
command to be executed meets the precondition requirements.
Declaration
public override async Task<PreconditionResult> CheckRequirementsAsync(IInteractionContext context, ICommandInfo command, IServiceProvider services)
Parameters
Type | Name | Description |
---|---|---|
IInteractionContext | context | The context of the command. |
ICommandInfo | command | |
IServiceProvider | services | The service collection used for dependency injection. |
Returns
Type | Description |
---|---|
Task<PreconditionResult> |