2022-12-05 01:43:40 +00:00
|
|
|
|
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)
|
|
|
|
|
{
|
2024-02-15 22:38:48 +00:00
|
|
|
|
if (context is null)
|
|
|
|
|
{
|
|
|
|
|
throw new ArgumentNullException(nameof(context));
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-05 01:43:40 +00:00
|
|
|
|
return Task.FromResult(context.Avatar.IsBot);
|
|
|
|
|
}
|
|
|
|
|
}
|