2023-05-08 17:29:39 +01:00
|
|
|
|
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);
|
2024-01-20 17:30:24 +00:00
|
|
|
|
return Task.FromResult(context.Avatar.UserId == context.Client.CurrentUser?.Id);
|
2023-05-08 17:29:39 +01:00
|
|
|
|
}
|
|
|
|
|
}
|