VpSharp/VpSharp.Commands/Attributes/ExecutionChecks/RequireBotOwnerAttribute.cs

15 lines
524 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)
{
ArgumentNullException.ThrowIfNull(context);
return Task.FromResult(context.Avatar.UserId == context.Client.CurrentUser?.Id);
}
}