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

15 lines
525 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)
{
ArgumentNullException.ThrowIfNull(context);
return Task.FromResult(context.Avatar.User.Id == context.Client.CurrentUser?.Id);
}
}