mirror of
https://github.com/oliverbooth/VpSharp
synced 2024-11-10 07:15:41 +00:00
19 lines
584 B
C#
19 lines
584 B
C#
namespace VpSharp.Commands.Attributes.ExecutionChecks;
|
|
|
|
/// <summary>
|
|
/// Specifies that this command can only be run by the user under whom this bot is authenticated.
|
|
/// </summary>
|
|
public sealed class RequireBotOwnerAttribute : PreExecutionCheckAttribute
|
|
{
|
|
/// <inheritdoc />
|
|
protected internal override Task<bool> PerformAsync(CommandContext context)
|
|
{
|
|
if (context is null)
|
|
{
|
|
throw new ArgumentNullException(nameof(context));
|
|
}
|
|
|
|
return Task.FromResult(context.Avatar.UserId == context.Client.CurrentUser?.Id);
|
|
}
|
|
}
|