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