VpSharp/VpSharp.Commands/Attributes/ExecutionChecks/RequireBotAttribute.cs

19 lines
503 B
C#

namespace VpSharp.Commands.Attributes.ExecutionChecks;
/// <summary>
/// Specifies that this command can only be run by bots.
/// </summary>
public sealed class RequireBotAttribute : PreExecutionCheckAttribute
{
/// <inheritdoc />
protected internal override Task<bool> PerformAsync(CommandContext context)
{
if (context is null)
{
throw new ArgumentNullException(nameof(context));
}
return Task.FromResult(context.Avatar.IsBot);
}
}