1
0
mirror of https://github.com/oliverbooth/VpSharp synced 2024-11-15 06:25:41 +00:00
VpSharp/VpSharp.Commands/Attributes/ExecutionChecks/RequireBotOwnerAttribute.cs

19 lines
584 B
C#
Raw Normal View History

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)
{
if (context is null)
{
throw new ArgumentNullException(nameof(context));
}
return Task.FromResult(context.Avatar.UserId == context.Client.CurrentUser?.Id);
}
}