2023-05-08 16:29:39 +00: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)
|
|
|
|
|
{
|
2024-02-15 22:38:48 +00:00
|
|
|
|
if (context is null)
|
|
|
|
|
{
|
|
|
|
|
throw new ArgumentNullException(nameof(context));
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-20 17:30:24 +00:00
|
|
|
|
return Task.FromResult(context.Avatar.UserId == context.Client.CurrentUser?.Id);
|
2023-05-08 16:29:39 +00:00
|
|
|
|
}
|
|
|
|
|
}
|